From 5d17cb205505a08c79f71380e56ba08529589a4e Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Mon, 27 Jul 2015 01:36:47 +0100 Subject: [PATCH] Release v6.0. Signed-off-by: Gary V. Vaughan --- .travis.yml | 48 +- AUTHORS | 5 +- ChangeLog | 267 ++++++ Makefile.am | 23 +- Makefile.in | 274 ++++-- NEWS | 114 +++ README | 72 +- aclocal.m4 | 67 +- bootstrap.conf | 2 + build-aux/ar-lib | 2 +- build-aux/compile | 2 +- build-aux/config.guess | 173 +--- build-aux/config.ld.in | 30 + build-aux/config.sub | 36 +- build-aux/depcomp | 2 +- build-aux/install-sh | 366 ++++---- build-aux/ltmain.sh | 81 +- build-aux/missing | 2 +- build-aux/mkrockspecs | 2 +- build-aux/release.mk | 5 +- build-aux/specl.mk | 20 +- configure | 810 ++++++++++++------ configure.ac | 74 +- doc/index.html | 97 +++ doc/ldoc.css | 304 +++++++ doc/modules/lyaml.explicit.html | 267 ++++++ doc/modules/lyaml.functional.html | 233 +++++ doc/modules/lyaml.html | 242 ++++++ doc/modules/lyaml.implicit.html | 533 ++++++++++++ lib/lyaml.lua | 282 ++++-- lib/lyaml/explicit.lua | 122 +++ lib/lyaml/functional.lua | 83 ++ lib/lyaml/implicit.lua | 235 +++++ local.mk | 94 +- ...l-5.1.4-1.rockspec => lyaml-6.0-1.rockspec | 6 +- m4/ax_lua.m4 | 241 ++++-- m4/libtool.m4 | 171 ++-- m4/ltoptions.m4 | 2 +- m4/ltsugar.m4 | 2 +- m4/ltversion.m4 | 12 +- m4/lt~obsolete.m4 | 2 +- specs/lib_lyaml_spec.yaml | 269 ++++-- specs/spec_helper.lua | 32 +- travis.yml.in | 46 +- 44 files changed, 4591 insertions(+), 1161 deletions(-) create mode 100644 build-aux/config.ld.in create mode 100644 doc/index.html create mode 100644 doc/ldoc.css create mode 100644 doc/modules/lyaml.explicit.html create mode 100644 doc/modules/lyaml.functional.html create mode 100644 doc/modules/lyaml.html create mode 100644 doc/modules/lyaml.implicit.html create mode 100644 lib/lyaml/explicit.lua create mode 100644 lib/lyaml/functional.lua create mode 100644 lib/lyaml/implicit.lua rename lyaml-5.1.4-1.rockspec => lyaml-6.0-1.rockspec (84%) diff --git a/.travis.yml b/.travis.yml index 1e1c407..8ec4f39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: c env: global: - _COMPILE="libtool --mode=compile --tag=CC gcc" - - _CFLAGS="-O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX" + - _CFLAGS="-O2 -Wall -DLUA_COMPAT_ALL -DLUA_COMPAT_5_2 -DLUA_USE_LINUX" - _INSTALL="libtool --mode=install install -p" - _LINK="libtool --mode=link --tag=CC gcc" - _LIBS="-lm -Wl,-E -ldl -lreadline" @@ -12,6 +12,10 @@ env: - bindir=$prefix/bin - incdir=$prefix/include - libdir=$prefix/lib + + - _inst=$TRAVIS_BUILD_DIR/_inst + - luadir=$_inst/share/lua + - luaexecdir=$_inst/lib/lua matrix: - LUA=lua5.3 - LUA=lua5.2 @@ -28,12 +32,12 @@ before_install: # Fetch Lua sources. - cd $TRAVIS_BUILD_DIR - 'if test lua5.3 = "$LUA"; then - curl http://www.lua.org/work/lua-5.3.0-rc2.tar.gz | tar xz; - cd lua-5.3.0; + curl http://www.lua.org/ftp/lua-5.3.1.tar.gz | tar xz; + cd lua-5.3.1; fi' - 'if test lua5.2 = "$LUA"; then - curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz; - cd lua-5.2.3; + curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz; + cd lua-5.2.4; fi' - 'if test lua5.1 = "$LUA"; then curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz; @@ -87,12 +91,12 @@ before_install: # Tidy up file droppings. - cd $TRAVIS_BUILD_DIR - - rm -rf lua-5.3.0 lua-5.2.3 lua-5.1.5 LuaJIT-2.0.3 luarocks-2.2.0 + - rm -rf lua-5.3.1 lua-5.2.4 lua-5.1.5 LuaJIT-2.0.3 luarocks-2.2.0 install: # Use Lua 5.3 compatible rocks, where available. - - 'for rock in ansicolors specl""; do + - 'for rock in ansicolors ldoc specl""; do if test -z "$rock"; then break; fi; if luarocks list | grep "^$rock$" >/dev/null; then continue; fi; sudo luarocks install --server=http://rocks.moonscript.org/manifests/gvvaughan $rock; @@ -106,21 +110,37 @@ install: sleep 1; touch configure; fi' - # Build from rockspec. - - export ROCKSPEC=lyaml-5.1.4-1.rockspec - - 'test -f "$ROCKSPEC" || ROCKSPEC=lyaml-git-1.rockspec' - - sudo luarocks make $ROCKSPEC LUA="$LUA" + # Build from rockspec, forcing uninstall of older luarocks installed + # above when testing the git rockspec, both for enforcing backwards + # compatibility by default, and for ease of maintenance. + - if test -f 'lyaml-6.0-1.rockspec'; then + sudo luarocks make 'lyaml-6.0-1.rockspec' LUA="$LUA"; + else + sudo luarocks make --force 'lyaml-git-1.rockspec' LUA="$LUA"; + fi # Clean up files created by root - sudo git clean -dfx - - sudo rm -rf slingshot + - sudo rm -rf slingshot /tmp/ldoc script: + # Reconfigure for in-tree test install. - test -f configure || ./bootstrap --verbose - - test -f Makefile || ./configure --disable-silent-rules LUA="$LUA" + - ./configure --prefix="$_inst" --disable-silent-rules LUA="$LUA" + + # Verify luarocks installation. + - make installcheck || make installcheck V=1 + + # Verify local build. - make - - make check V=1 + - make check || make check V=1 + + # Verify configured installation. + - make install prefix="$_inst" luadir="$luadir" luaexecdir="$luaexecdir" + - LUA_PATH="$luadir/?.lua;$luadir/?/init.lua;;" + LUA_CPATH="$luaexecdir/?.so;;" + make installcheck V=1 # Run sanity checks on CI server, ignoring buggy automakes. diff --git a/AUTHORS b/AUTHORS index 05396d1..0688ce0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ this list, please file an issue on github (run `./configure --help` for the URL). * Andrew Danforth : - Designed and implemented lyaml. + Designed and implemented the C LibYAML binding. * Gary V. Vaughan : - Lua 5.2 compatibility, build system, luarock packaging, releases. + Lua 5.2 and 5.3 compatibility, build system, luarock packaging, + lymal Lua code, release. diff --git a/ChangeLog b/ChangeLog index 3886cef..46dca2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,272 @@ +2015-07-27 Gary V. Vaughan + + Release version 6.0 + * NEWS.md: Record release date. + + maint: support installcheck rules. + * specs/spec_helper.lua (package.path, package.cpath): Don't + set these paths for installcheck! + + slingshot: sync with upstream. + * slingshot: Sync with upstream for Lua 5.3.1 support. + + configury: bump release number to 6.0. + * configure.ac (AC_INIT): Bump release number to 6.0. + * .travis.yml: Regenerate. + + lyaml: recognize merging of sequence alias. + * specs/lib_lyaml_spec.yaml: Specify behaviour for loading an + alias to a sequence. + * lib/lyaml.lua (alias_type): New table mapping anchor save types + to equivalent later alias load types. + (parser_mt:add_anchor): Use it to save the anchor type in addition + to the node value, so we can distingish between saved sequence + tables and map tables. + (parser_mt:load_map, parser_mt:load_sequence) + (parser_mt:load_scalar): Return value and type of actual event. + (parser_mt:load_alias): Return value, and type of aliased event. + (parser_mt:load_map): Simplify. Now that aliases are expanded + recursively, no need to handle ALIAS events specially. + * specs/lib_lyaml_spec.yaml: Simplify some examples with local + variables for intermediate values. + Adjust error messages expectations to match reality! + +2015-07-26 Gary V. Vaughan + + lyaml: ensure lyaml.dump has an equivalent signature to lyaml.load. + * lib/lyaml.lua (dump): Accept an option table of options. + (Dumper): Normalise options. + (dumper_mt.dump_scalar): Quote any strings that would be implicitly + converted by opts.implicit_scalar function otherwise. + * NEWS.md: Update accordingly. + * README.md: Update. + + lyaml: merge bare maps and sequences. + * specs/lib_lyaml_spec.yaml (context with merge keys): Specify + behaviour with non-alias merge key arguments more thoroughly, + especially merging bare maps and sequences. + * lib/lyaml.lua (parser_mt.load_map): generalize support of + arguments to merge key to satisfy new specifications. + +2015-07-25 Gary V. Vaughan + + specs: specify loading of more variant boolean and y/n tokens. + * specs/lib_lyaml_spec.yaml (it recognizes booleans): Specify + behaviour with "yes" and "no". + (it loads bare y and n as strings): Specify behaviour with "y" + and "n". + (it recognizes strings): Specify behaviour with quoted "yes". + (it recognizes !!bool): Specify behaviours with variations of + yes, no, y and n. + + doc: clarify lyaml._VERSION docs. + * lib/lyaml.lua (_VERSION): Clarify what this is the version of! + + maint: consolidate .gitignore files. + * build-aux/.gitignore: Remove. + * .gitignore: Ignore everything in build-aux except config.ld.in + and sanity-cfg.mk. + + configury: install api docs correctly. + * configure.ac: Modernize. + (HAVE_LDOC): New conditional, so that installation from a + release tarball works without LDoc installed. + * local.mk (modulesdir): Destination for api ldocs. + (dist_doc_DATA): VPATH search automatically prepends $(srcdir). + (dist_docmodules_DATA): Oops, not this... + (dist_modules_DATA): ...it should be spelled like this. And + we should reference sources relative to Makefile directory + +2015-07-23 Gary V. Vaughan + + maint: add ldoc to bootstrap travis_extra_rocks. + * bootstrap.conf (travis_extra_rocks): Add ldoc. + * .travis.yml.in: Regenerate. + + maint: add ldoc to bootstrap buildreq. + * bootstrap.conf (buildreq): Add ldoc. + + doc: preliminary LDoc API documentation. + * build-aux/config.ld.in: New file. LDoc configuration. + * configure.ac (AC_CONFIG_FILES): Generate config.ld. + (AC_PATH_PROG): Find ldoc binary in path. + * local.mk (src/doc): Automatically generate API documentation. + * lib/lyaml.lua, lib/lyaml/explicit.lua, lib/lyaml/functional.lua, + lib/lyaml/implicit.lua: Add API doc-comments markup. + * AUTHORS: Update. + +2015-07-22 Gary V. Vaughan + + lyaml: provide API for loading scalar types. + In the process of factoring the scalar parsing in user over- + ridable parameters, we also make default boolean value parsing + more idiomatic - namely, bare y and n tokens remain as y and + n string values respectively, unless preceded by the !!bool + tag, when they are parsed to true and false values. + * lib/lyaml.lua (istruthy, isfalsey, isnan, isinf) + (parser_mt.load_float, parser_mt.load_int) + (parser_mt.load_scalar): Factor implicit scalar loaders from + here... + * lib/lyaml/implicit.lua (binary, decimal, float, hexadecimal) + (inf, nan, null, octal, sexagesimal, sexfloat, bool): New file. + ...to here. + * lib/lyaml/functional.lua: New file with minimal higher order + functions for internal use. + * lib/lyaml.lua (parser_mt.load_scalar): Factor explicit tagged + scalar loaders from here... + * lib/lyaml/explicit.lua (bool, float, int, null, str): New + file. ...to here. + * lib/lyaml.lua (default.explicit_scalar) + (default.implicit_scalar): Compose equivalent functionality to + prefactored code from the new functions above. + (Parser): Fallback to scalar value parsing from default. + (load): If opts is a table, accept keys that override default + scalar loading functions with the user's own. + * specs/lib_lyaml_spec.yaml: Adjust specifications to match + clearer error messages and more idiomatic parsing of y and n. + * README.md (lyaml.load): Describe new APIs. + +2015-07-20 Nick Muerdter + + lyaml: parse empty values as null, not empty strings. + Close #10 + According to the [spec](http://yaml.org/type/null.html) an empty value + should be null. lyaml was previously treating empty values as empty + strings which isn't correct. + + This change means that `lyaml.load("foo: ")` will now be parsed as + `{ foo = lyaml.null }` instead of `{ foo = "" }`. + + This also adjusts how real empty string values are dumped, since they + need to be quoted rather than an empty value. So + `lyaml.dump({{ foo = "" }})` will now be dumped as `foo: ''` instead of + `foo: `. + + This does change a number of existing tests that involved empty + documents now becoming nulls, rather than empty strings, but I've + verified that the new behavior seems to match Ruby's YAML library in all + these cases. Here's a few examples of these empty document changes (I + updated the lyaml test suite accordingly): + + ``` + > YAML.load_stream("---") + => [nil] + > YAML.load_stream("---\n...\n---\ntwo\n...\n---\n...") + => [nil, "two", nil] + > YAML.dump("") + => "--- ''\n" + ``` + + I've also added new tests to explicitly check the null handling for + empty values. Here's also a few more examples verifying the new null + behavior against the Ruby YAML library: + + ``` + > YAML.load_stream("foo: ") + => [{"foo"=>nil}] + > YAML.load_stream("- ~\n- \n- true\n- 42") + => [[nil, nil, true, 42]] + > YAML.load_stream("''") + => [""] + ``` + * specs/lib_lyaml_spec.yaml (writes an empty document): Correct + behaviour is to dump a literal empty string. + (writes a mapping): Specify dumping an empts string value. + (lyaml.loads an empty document): Correct behaviour is to return + lyaml.null for no content. + (reports an empty document): Likewise for multi-document streams. + (recognizes version number): Adjust accordingly. + (recognizes null): Specify behaviour when loading an empty value, + (recognizes strings): Specify behaviour when loading an empty + string. + (recognizes block sequences): Likewise for empty sequence values. + * lib/lyaml.lua (dumper_mt): Set SINGLE_QUOTED style for empty + strings. + (parser_mt): Load an empty string as lyaml.null. + From Nick Muerdter + +2015-07-20 Nick Muerdter + + doc: clarify multiple document handling. + Close #9 + * README.md: This is based on the discussion regarding how the + API handles multiple documents here: + https://github.com/gvvaughan/lyaml/issues/7 + From Nick Muerdter + +2015-07-13 Gary V. Vaughan + + lyaml: support !!merge key type. + Fixes #8. + * specs/lib_lyaml_spec.yaml (load): Specify input types for + merge tag value strings and how they should be loaded. + * lib/lyaml.lua (parser_mt.merge_map): Fetch an alias or sequence + of aliases, and merge them into the containing map. + (parser_mt.load_map): Use it to !!merge tag. + * NEWS.md (New Features): Update accordingly. + Reported by Yuichi Murata + + lyaml: load the whole range of !!int arguments fully. + * specs/lib_lyaml_spec.yaml (load): Specify more input types for + int tag value strings and how they should be loaded. + * lib/lyaml.lua (istruthy, isfalsey): New sets of accepted !!int + value strings that will convert to Lua true and false respectively. + (parser_mt.load_scalar): Parse !!int tag arguments fully. + * NEWS.md (Bug fixes): Update accordingly. + +2015-07-12 Gary V. Vaughan + + lyaml: load the whole range of !!float arguments fully. + * specs/lib_lyaml_spec.yaml (load): Specify more input types for + float tag value strings and how they should be loaded. + * lib/lyaml.lua (isnan, isinf): New sets of accepted !!float + value strings that will convert to Lua 0/0 and inf respectively. + (parser_mt.load_scalar): Parse !!float tag arguments fully. + (dumper_mt.dump_scalar): Dump NaN and Inf values idiomatically. + * NEWS.md (Bug fixes): Update accordingly. + + lyaml: load the full range of !!bool arguments fully. + * specs/lib_lyaml_spec.yaml (load): Specify more input types for + bool tag value strings and how they should be loaded. + * lib/lyaml.lua (istruthy, isfalsey): New sets of accepted !!bool + value strings that will convert to Lua true and false respectively. + (parser_mt.load_scalar): Parse !!bool tag arguments fully. + * NEWS.md (Bug fixes): Update accordingly. + + lyaml: recognize !!null tags. + * specs/lib_lyaml_spec.yaml (load): Specify correct loading of + !!null tags. + * lib/lyaml.lua (parser_mt.load_scalar): Load a !!null tag as an + lyaml.null reference. + * NEWS (Bugs Fixed): Update. + +2015-06-21 Nick Muerdter + + lyaml.dumper_mt: fix multi-line string dumping. + Close #6. + Multi-line strings were previously being dumped using single quotes + which caused the dumped YAML to break, dump using LITERAL syntax in + this case. + * specs/lib_lyaml_spec.yaml (lyaml dumping): Specify correct + behaviours for dumping multi-line strings. + (lyaml loading): Likewise for loading strings dumped this way. + * lib/lyaml.lua (dumper_mt): use "LITERAL" style to dump strings + containing embedded newlines. + * NEWS.md (Bug fixes): Update. + +2015-01-19 Gary V. Vaughan + + slingshot: sync with upstream for lua 5.3.0 final support. + * slingshot: Sync with upstream. + * .travis.yml: Regenerate. + 2015-01-01 Gary V. Vaughan + maint: post-release administrivia. + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * ./local.mk (old_NEWS_hash): Auto-update. + Release version 5.1.4 * NEWS.md: Record release date. diff --git a/Makefile.am b/Makefile.am index eb5bd80..4ade870 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,8 @@ LUA_PATH ?= ; LUA_CPATH ?= ; SPECL_ENV = +CHECK_ENV = +INSTALLCHECK_ENV = ## ---------- ## @@ -52,6 +54,7 @@ check_local = dist_bin_SCRIPTS = dist_lua_DATA = doc_DATA = +installcheck_local = install_exec_hooks = remove-luaexec-lafiles uninstall_hooks = uninstall-luaexec-modules lib_LTLIBRARIES = @@ -74,16 +77,18 @@ check-local: $(check_local) ## Installation. ## ## ------------- ## +installcheck-local: $(installcheck_local) + install-exec-hook: $(install_exec_hooks) # Neither Lua itself, nor LuaRocks can use .la files, and LuaRocks # actually moves such files aside anyway, so we just remove them from # the installation directory. remove-luaexec-lafiles: - @for la in $(luaexec_LTLIBRARIES); do \ - f=`echo "$$la" |sed 's|^.*/||'`; \ - echo rm -f $(luaexecdir)/$$f; \ - rm -f $(luaexecdir)/$$f; \ + @for la in $(luaexec_LTLIBRARIES); do \ + f=`echo "$$la" |sed 's|^.*/||'`; \ + echo rm -f $(DESTDIR)$(luaexecdir)/$$f; \ + rm -f $(DESTDIR)$(luaexecdir)/$$f; \ done @@ -96,9 +101,9 @@ uninstall-hook: $(uninstall_hooks) # We removed the .la files from luaexecdir, so the standard uninstall, # with libtool --mode=uninstall, can't find everything anymore. uninstall-luaexec-modules: - @for la in $(luaexec_LTLIBRARIES); do \ - base=`echo "$$la" \ - |sed 's|^.*/\(.*\)\.la|\1|'`; \ - echo rm -f $(luaexecdir)/$$base.so; \ - rm -f $(luaexecdir)/$$base.so; \ + @for la in $(luaexec_LTLIBRARIES); do \ + base=`echo "$$la" \ + |sed 's|^.*/\(.*\)\.la|\1|'`; \ + echo rm -f $(DESTDIR)$(luaexecdir)/$$base.so; \ + rm -f $(DESTDIR)$(luaexecdir)/$$base.so; \ done diff --git a/Makefile.in b/Makefile.in index dcedcf8..f308cbf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -37,23 +37,24 @@ # Copyright (C) 2013-2015 Gary V. Vaughan # Written by Gary V. Vaughan, 2013 # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Lyaml Specl make rules. # @@ -140,7 +141,17 @@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -203,21 +214,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/local.mk $(srcdir)/specs/specs.mk \ - $(srcdir)/build-aux/specl.mk $(srcdir)/build-aux/rockspecs.mk \ - INSTALL NEWS README AUTHORS ChangeLog $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(srcdir)/config.h.in \ - $(dist_bin_SCRIPTS) $(top_srcdir)/build-aux/depcomp \ - $(dist_lua_DATA) COPYING build-aux/ar-lib build-aux/compile \ - build-aux/config.guess build-aux/config.sub build-aux/depcomp \ - build-aux/install-sh build-aux/missing build-aux/ltmain.sh \ - $(top_srcdir)/build-aux/ar-lib $(top_srcdir)/build-aux/compile \ - $(top_srcdir)/build-aux/config.guess \ - $(top_srcdir)/build-aux/config.sub \ - $(top_srcdir)/build-aux/install-sh \ - $(top_srcdir)/build-aux/ltmain.sh \ - $(top_srcdir)/build-aux/missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lua.m4 \ @@ -226,11 +222,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lua.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(dist_bin_SCRIPTS) $(dist_doc_DATA) \ + $(dist_lua_DATA) $(dist_lualyaml_DATA) $(dist_modules_DATA) \ + $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = build-aux/config.ld CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -261,7 +261,9 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(luaexecdir)" \ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(luadir)" "$(DESTDIR)$(docdir)" + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(luadir)" \ + "$(DESTDIR)$(lualyamldir)" "$(DESTDIR)$(modulesdir)" \ + "$(DESTDIR)$(docdir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(luaexec_LTLIBRARIES) ext_yaml_yaml_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp @@ -321,7 +323,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -DATA = $(dist_lua_DATA) $(doc_DATA) +DATA = $(dist_doc_DATA) $(dist_lua_DATA) $(dist_lualyaml_DATA) \ + $(dist_modules_DATA) $(doc_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, @@ -344,6 +347,21 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/build-aux/rockspecs.mk $(srcdir)/build-aux/specl.mk \ + $(srcdir)/config.h.in $(srcdir)/local.mk \ + $(srcdir)/specs/specs.mk $(top_srcdir)/build-aux/ar-lib \ + $(top_srcdir)/build-aux/compile \ + $(top_srcdir)/build-aux/config.guess \ + $(top_srcdir)/build-aux/config.ld.in \ + $(top_srcdir)/build-aux/config.sub \ + $(top_srcdir)/build-aux/depcomp \ + $(top_srcdir)/build-aux/install-sh \ + $(top_srcdir)/build-aux/ltmain.sh \ + $(top_srcdir)/build-aux/missing AUTHORS COPYING ChangeLog \ + INSTALL NEWS README build-aux/ar-lib build-aux/compile \ + build-aux/config.guess build-aux/config.sub build-aux/depcomp \ + build-aux/install-sh build-aux/ltmain.sh build-aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -394,6 +412,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LDOC = @LDOC@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -401,6 +420,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ LUA = @LUA@ LUA_EXEC_PREFIX = @LUA_EXEC_PREFIX@ LUA_INCLUDE = @LUA_INCLUDE@ @@ -490,16 +510,21 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SPECL_ENV = LUA='$(LUA)' abs_top_builddir='$(abs_top_builddir)' \ +SPECL_ENV = +CHECK_ENV = LUA='$(LUA)' PACKAGE_STRING='$(PACKAGE_STRING)' \ + abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ top_builddir='$(top_builddir)' top_srcdir='$(top_srcdir)' \ $(NOTHING_ELSE) +INSTALLCHECK_ENV = LUA='$(LUA)' PACKAGE_STRING='$(PACKAGE_STRING)' \ + installcheck='true' $(NOTHING_ELSE) ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = $(LUA_INCLUDE) EXTRA_DIST = $(srcdir)/specs/spec_helper.lua $(NOTHING_ELSE) \ $(specl_SPECS) $(NOTHING_ELSE) ext/yaml/lyaml.h \ - $(NOTHING_ELSE) $(mkrockspecs) $(package_rockspec) \ - $(rockspec_conf) $(NOTHING_ELSE) + $(NOTHING_ELSE) build-aux/config.ld.in $(NOTHING_ELSE) \ + $(mkrockspecs) $(package_rockspec) $(rockspec_conf) \ + $(NOTHING_ELSE) EXTRA_LTLIBRARIES = CLEANFILES = DISTCLEANFILES = $(luarocks_config) $(NOTHING_ELSE) @@ -510,6 +535,7 @@ check_local = specl-check-local dist_bin_SCRIPTS = dist_lua_DATA = lib/lyaml.lua $(NOTHING_ELSE) doc_DATA = +installcheck_local = specl-installcheck-local install_exec_hooks = remove-luaexec-lafiles uninstall_hooks = uninstall-luaexec-modules lib_LTLIBRARIES = @@ -529,6 +555,12 @@ update_copyright_env = \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_FORCE=1 +modulesdir = $(docdir)/modules +dist_doc_DATA = doc/index.html doc/ldoc.css $(NOTHING_ELSE) +dist_modules_DATA = doc/modules/lyaml.html \ + doc/modules/lyaml.explicit.html \ + doc/modules/lyaml.functional.html \ + doc/modules/lyaml.implicit.html $(NOTHING_ELSE) specl_SPECS = \ $(srcdir)/specs/ext_yaml_emitter_spec.yaml \ $(srcdir)/specs/ext_yaml_parser_spec.yaml \ @@ -545,6 +577,13 @@ ext_yaml_yaml_la_SOURCES = \ ext_yaml_yaml_la_LDFLAGS = -module -avoid-version ext_yaml_yaml_la_CPPFLAGS = $(LUA_INCLUDE) $(YAML_INCLUDE) +lualyamldir = $(luadir)/lyaml +dist_lualyaml_DATA = \ + lib/lyaml/explicit.lua \ + lib/lyaml/functional.lua \ + lib/lyaml/implicit.lua \ + $(NOTHING_ELSE) + # Point mkrockspecs at the in-tree lyaml module. MKROCKSPECS_ENV = $(LUA_ENV) @@ -590,7 +629,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/local.mk $(srcdir)/specs echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -600,7 +638,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/local.mk $(srcdir)/specs/specs.mk $(srcdir)/build-aux/specl.mk $(srcdir)/build-aux/rockspecs.mk: +$(srcdir)/local.mk $(srcdir)/specs/specs.mk $(srcdir)/build-aux/specl.mk $(srcdir)/build-aux/rockspecs.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -625,6 +663,8 @@ $(srcdir)/config.h.in: $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 +build-aux/config.ld: $(top_builddir)/config.status $(top_srcdir)/build-aux/config.ld.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @@ -857,6 +897,27 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-dist_luaDATA: $(dist_lua_DATA) @$(NORMAL_INSTALL) @list='$(dist_lua_DATA)'; test -n "$(luadir)" || list=; \ @@ -878,6 +939,48 @@ uninstall-dist_luaDATA: @list='$(dist_lua_DATA)'; test -n "$(luadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(luadir)'; $(am__uninstall_files_from_dir) +install-dist_lualyamlDATA: $(dist_lualyaml_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_lualyaml_DATA)'; test -n "$(lualyamldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(lualyamldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(lualyamldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(lualyamldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(lualyamldir)" || exit $$?; \ + done + +uninstall-dist_lualyamlDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_lualyaml_DATA)'; test -n "$(lualyamldir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(lualyamldir)'; $(am__uninstall_files_from_dir) +install-dist_modulesDATA: $(dist_modules_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(modulesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(modulesdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(modulesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(modulesdir)" || exit $$?; \ + done + +uninstall-dist_modulesDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_modules_DATA)'; test -n "$(modulesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(modulesdir)'; $(am__uninstall_files_from_dir) install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ @@ -1015,15 +1118,15 @@ dist-xz: distdir $(am__post_remove_distdir) dist-tarZ: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) @@ -1059,17 +1162,17 @@ distcheck: dist esac chmod -R a-w $(distdir) chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=.. --prefix="$$dc_install_base" \ + --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ @@ -1127,7 +1230,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(DATA) config.h installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(luaexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(luadir)" "$(DESTDIR)$(docdir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(luaexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(luadir)" "$(DESTDIR)$(lualyamldir)" "$(DESTDIR)$(modulesdir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1189,7 +1292,9 @@ info: info-am info-am: -install-data-am: install-dist_luaDATA install-docDATA +install-data-am: install-dist_docDATA install-dist_luaDATA \ + install-dist_lualyamlDATA install-dist_modulesDATA \ + install-docDATA install-dvi: install-dvi-am @@ -1217,7 +1322,7 @@ install-ps: install-ps-am install-ps-am: -installcheck-am: +installcheck-am: installcheck-local maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -1240,8 +1345,10 @@ ps: ps-am ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-dist_binSCRIPTS \ - uninstall-dist_luaDATA uninstall-docDATA \ - uninstall-libLTLIBRARIES uninstall-luaexecLTLIBRARIES + uninstall-dist_docDATA uninstall-dist_luaDATA \ + uninstall-dist_lualyamlDATA uninstall-dist_modulesDATA \ + uninstall-docDATA uninstall-libLTLIBRARIES \ + uninstall-luaexecLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: all check-am install-am install-exec-am install-strip \ @@ -1256,29 +1363,44 @@ uninstall-am: uninstall-binSCRIPTS uninstall-dist_binSCRIPTS \ distclean-hdr distclean-libtool distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binSCRIPTS install-data \ - install-data-am install-dist_binSCRIPTS install-dist_luaDATA \ - install-docDATA install-dvi install-dvi-am install-exec \ - install-exec-am install-exec-hook install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-luaexecLTLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binSCRIPTS \ - uninstall-dist_binSCRIPTS uninstall-dist_luaDATA \ + install-data-am install-dist_binSCRIPTS install-dist_docDATA \ + install-dist_luaDATA install-dist_lualyamlDATA \ + install-dist_modulesDATA install-docDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-hook \ + install-html install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-luaexecLTLIBRARIES install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installcheck-local \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binSCRIPTS uninstall-dist_binSCRIPTS \ + uninstall-dist_docDATA uninstall-dist_luaDATA \ + uninstall-dist_lualyamlDATA uninstall-dist_modulesDATA \ uninstall-docDATA uninstall-hook uninstall-libLTLIBRARIES \ uninstall-luaexecLTLIBRARIES +.PRECIOUS: Makefile + LUA_PATH ?= ; LUA_CPATH ?= ; specl-check-local: $(specl_SPECS) - $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) + $(CHECK_ENV) $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) +specl-installcheck-local: $(specl_SPECS) + $(INSTALLCHECK_ENV) $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) # Make sure yaml is built before calling mkrockspecs. $(package_rockspec) $(scm_rockspec): $(lib_LTLIBRARIES) +$(dist_doc_DATA) $(dist_docmodules_DATA): $(srcdir)/doc + +$(srcdir)/doc: $(dist_lua_DATA) $(dist_lualyaml_DATA) + test -d $@ || mkdir $@ +@HAVE_LDOC_TRUE@ $(LDOC) -c build-aux/config.ld -d $(abs_srcdir)/doc . +@HAVE_LDOC_FALSE@ $(MKDIR_P) doc +@HAVE_LDOC_FALSE@ touch doc/index.html doc/ldoc.css + $(luarocks_config): Makefile.am @test -d build-aux || mkdir build-aux $(AM_V_GEN){ \ @@ -1313,16 +1435,18 @@ rockspecs: check-local: $(check_local) +installcheck-local: $(installcheck_local) + install-exec-hook: $(install_exec_hooks) # Neither Lua itself, nor LuaRocks can use .la files, and LuaRocks # actually moves such files aside anyway, so we just remove them from # the installation directory. remove-luaexec-lafiles: - @for la in $(luaexec_LTLIBRARIES); do \ - f=`echo "$$la" |sed 's|^.*/||'`; \ - echo rm -f $(luaexecdir)/$$f; \ - rm -f $(luaexecdir)/$$f; \ + @for la in $(luaexec_LTLIBRARIES); do \ + f=`echo "$$la" |sed 's|^.*/||'`; \ + echo rm -f $(DESTDIR)$(luaexecdir)/$$f; \ + rm -f $(DESTDIR)$(luaexecdir)/$$f; \ done uninstall-hook: $(uninstall_hooks) @@ -1330,11 +1454,11 @@ uninstall-hook: $(uninstall_hooks) # We removed the .la files from luaexecdir, so the standard uninstall, # with libtool --mode=uninstall, can't find everything anymore. uninstall-luaexec-modules: - @for la in $(luaexec_LTLIBRARIES); do \ - base=`echo "$$la" \ - |sed 's|^.*/\(.*\)\.la|\1|'`; \ - echo rm -f $(luaexecdir)/$$base.so; \ - rm -f $(luaexecdir)/$$base.so; \ + @for la in $(luaexec_LTLIBRARIES); do \ + base=`echo "$$la" \ + |sed 's|^.*/\(.*\)\.la|\1|'`; \ + echo rm -f $(DESTDIR)$(luaexecdir)/$$base.so; \ + rm -f $(DESTDIR)$(luaexecdir)/$$base.so; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/NEWS b/NEWS index a79813b..5018442 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,119 @@ # lyaml NEWS - User visible changes +## Noteworthy changes in release 6.0 (2015-07-27) [stable] + +### New Features + + - `lyaml.load` now correctly reads a !!bool tagged scalar from a + YAML document, or an implicit bool value, according to + [the specification][boolspec]. + + ```yaml + %TAG ! tag:yaml.org,2002: + --- + truthy: + - !bool Y + - !bool y + - !bool True + - !bool "on" + falsey: + - !bool n + - !bool OFF + - !bool garbage + ``` + + - `lyaml.load` now correctly reads a !!float tagged scalar from a + YAML document, or an implicit float value, according to + [the specification][floatspec]. + + - `lyaml.load` now correctly reads a !!int tagged scalar from a + YAML document, or an implicit integer value, according to + [the specification][intspec]. + + - `lyaml.load` now supports the !!merge key type according to + [the specification][mergespec]. + + ```yaml + - &MERGE { x: 1, y: 2 } + - &OVERRIDE { x: 0, z: 1 } + - + << : [&MERGE, &OVERRIDE] + z: 3 + ``` + + The anchored tables remain in the document too, so this results in + the following Lua table: + + ```lua + { -- START_STREAM + { -- START_DOCUMENT + { x = 1, y = 2 }, -- MERGE + { x = 0, z = 1 }, -- OVERRIDE + { x = 1, y = 2, z = 3}, -- <<< + } -- END_DOCUMENT + } -- END_STREAM + ``` + +### Bug fixes + + - Multi-line strings were previously being dumped using single quotes + which caused the dumped YAML to break. + + For example, { foo = "a\nmultiline\nstring" } would get dumped as: + + ```yaml + foo: 'a + + multiline + + string' + ``` + + Note the extra line-breaks in between each line. This also causes + YAML parsing to fail (since the blank lines didn't have the expected + indentation). + + This patch fixes the dump to use the YAML literal syntax for any + multi-line strings so the same example gets dumped as: + + ```yaml + foo: |- + a + multiline + string + ``` + + - `lyaml.load` now correctly reads the !!null tag in a YAML + document as an `lyaml.null` reference, identical to the "~" + shorthand syntax, according to [the specification][nullspec]. + +### Incompatible Changes + + - `lyaml.load` now takes a table of options as an optional second + argument, not a simple boolean to determine whether all documents + should be returned from the stream. For now, a `true` second + argument will be converted to the modern equivalent: + + ```lua + lyaml.load (document, { all = true }) + ``` + + - `lyaml.dump` now takes a table of options as an optional second + argument, not an initial table of anchors. For now, a second + argument without any new API keys will be converted to the modern + equivalent: + + ```lua + lyaml.dump (t, { anchors = arg2 }) + ``` + +[boolspec]: http://yaml.org/type/bool.html +[floatspec]: http://yaml.org/type/float.html +[intspec]: http://yaml.org/type/int.html +[mergespec]: http://yaml.org/type/merge.html +[nullspec]: http://yaml.org/type/null.html + + ## Noteworthy changes in release 5.1.4 (2015-01-01) [stable] - This release is functionally identical to the last. diff --git a/README b/README index 21b9402..9a469d6 100644 --- a/README +++ b/README @@ -19,11 +19,79 @@ and [%YAML 1.1][yaml11] format strings. ```lua local lyaml = require "lyaml" -local t = lyaml.load (YAML-STRING) -local yamlstr = lyaml.dump (LUA-TABLE) +local t = lyaml.load (YAML-STRING, [OPTS-TABLE]) +local yamlstr = lyaml.dump (LUA-TABLE, [OPTS-TABLE]) local null = lyaml.null () ``` +#### `lyaml.load` + +`lyaml.load` accepts a YAML string for parsing. If the YAML string contains +multiple documents, only the first document will be returned by default. To +return multiple documents as a table, set `all = true` in the second +argument OPTS-TABLE. + +```lua +lyaml.load("foo: bar") +--> { foo = "bar" } + +lyaml.load("foo: bar", { all = true }) +--> { { foo = "bar" } } + +multi_doc_yaml = [[ +--- +one +... +--- +two +... +]] + +lyaml.load(multi_doc_yaml) +--> "one" + +lyaml.load(multi_doc_yaml, { all = true }) +--> { "one", "two" } +``` + +You can supply an alternative function for converting implicit plain +scalar values in the `implicit_scalar` field of the OPTS-TABLE argument; +otherwise a default is composed from the functions in the `lyaml.implicit` +module. + +You can also supply an alternative table for coverting explicitly tagged +scalar values in the `explicit_scalar` field of the OPTS-TABLE argument; +otherwise all supported tags are parsed by default using the functions +from the `lyaml.explicit` module. + +#### `lyaml.dump` + +`lyaml.dump` accepts a table of values to dump. Each value in the table +represents a single YAML document. To dump a table of lua values this means +the table must be wrapped in another table (the outer table represents the +YAML documents, the inner table is the single document table to dump). + +```lua +lyaml.dump({ { foo = "bar" } }) +--> --- +--> foo: bar +--> ... + +lyaml.dump({ "one", "two" }) +--> --- one +--> ... +--> --- two +--> ... +``` + +If you need to round-trip load a dumped document, and you used a custom +function for converting implicit scalars, then you should pass that same +function in the `implicit_scalar` field of the OPTS-TABLE argument to +`lyaml.dump` so that it can quote strings that might otherwise be +implicitly converted on reload. + +#### Nil Values + [Lua] tables treat `nil` valued keys as if they were not there, where [YAML] explicitly supports `null` values (and keys!). Lyaml will retain [YAML] `null` values as `lyaml.null ()` by default, diff --git a/aclocal.m4 b/aclocal.m4 index 182278e..d863457 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- +# generated automatically by aclocal 1.15 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2013 Free Software Foundation, Inc. +# Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' +[am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], +m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,12 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl +[AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# Copyright (C) 2011-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ AC_SUBST([AR])dnl # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -163,15 +163,14 @@ AC_SUBST([AR])dnl # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -202,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -393,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -469,7 +468,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -559,8 +558,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl @@ -633,7 +632,11 @@ to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi -fi]) +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further @@ -662,7 +665,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -673,7 +676,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -683,7 +686,7 @@ if test x"${install_sh}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -704,7 +707,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -754,7 +757,7 @@ rm -f confinc confmf # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -793,7 +796,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -822,7 +825,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -869,7 +872,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -888,7 +891,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -969,7 +972,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2013 Free Software Foundation, Inc. +# Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1029,7 +1032,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1057,7 +1060,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1076,7 +1079,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/bootstrap.conf b/bootstrap.conf index ce6127c..07bdc31 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -33,6 +33,7 @@ buildreq=' git - http://git-scm.com tar - http://www.gnu.org/s/tar + ldoc 1.4.2 http://rocks.moonscript.org/manifests/steved/ldoc-1.4.2-1.rockspec specl 14 http://rocks.moonscript.org/manifests/gvvaughan/specl-14-1.rockspec ' @@ -56,6 +57,7 @@ slingshot_files=' # Prequisite rocks that need to be installed for travis builds to work. travis_extra_rocks=' ansicolors + ldoc specl ' diff --git a/build-aux/ar-lib b/build-aux/ar-lib index fe2301e..463b9ec 100755 --- a/build-aux/ar-lib +++ b/build-aux/ar-lib @@ -4,7 +4,7 @@ me=ar-lib scriptversion=2012-03-01.08; # UTC -# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify diff --git a/build-aux/compile b/build-aux/compile index 531136b..a85b723 100755 --- a/build-aux/compile +++ b/build-aux/compile @@ -3,7 +3,7 @@ scriptversion=2012-10-14.11; # UTC -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify diff --git a/build-aux/config.guess b/build-aux/config.guess index 9afd676..6c32c86 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-11-29' +timestamp='2014-11-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ timestamp='2013-11-29' # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -149,7 +149,7 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac @@ -579,8 +579,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -826,7 +827,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -969,10 +970,10 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} exit ;; - or32:Linux:*:*) + or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) @@ -1371,154 +1372,6 @@ EOF exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -68,7 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -283,8 +283,10 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -296,11 +298,11 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -311,6 +313,7 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -325,6 +328,9 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -402,8 +408,10 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -415,6 +423,7 @@ case $basic_machine in | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -432,6 +441,7 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -769,6 +779,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -824,6 +837,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1369,14 +1386,14 @@ case $os in | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1594,9 +1611,6 @@ case $basic_machine in mips*-*) os=-elf ;; - or1k-*) - os=-elf - ;; or32-*) os=-coff ;; diff --git a/build-aux/depcomp b/build-aux/depcomp index 4ebd5b3..fc98710 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -3,7 +3,7 @@ scriptversion=2013-05-30.07; # UTC -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/build-aux/install-sh b/build-aux/install-sh index 377bb86..0b0fdcb 100755 --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-11-20.07; # UTC +scriptversion=2013-12-25.23; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC # This script is compatible with the BSD install script, but was written # from scratch. +tab=' ' nl=' ' -IFS=" "" $nl" +IFS=" $tab$nl" -# set DOITPROG to echo to test this script +# Set DOITPROG to "echo" to test this script. -# Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi +doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. @@ -68,17 +64,6 @@ mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - posix_mkdir= # Desired mode of installed file. @@ -97,7 +82,7 @@ dir_arg= dst_arg= copy_on_change=false -no_target_directory= +is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE @@ -137,46 +122,57 @@ while test $# -ne 0; do -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift;; + shift;; -s) stripcmd=$stripprog;; - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; - -T) no_target_directory=true;; + -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; - --) shift - break;; + --) shift + break;; - -*) echo "$0: invalid option: $1" >&2 - exit 1;; + -*) echo "$0: invalid option: $1" >&2 + exit 1;; *) break;; esac shift done +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -207,6 +203,15 @@ if test $# -eq 0; then exit 0 fi +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 @@ -223,16 +228,16 @@ if test -z "$dir_arg"; then *[0-7]) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw='% 200' + u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw=,u+rw + u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac @@ -269,41 +274,15 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - + dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi @@ -314,74 +293,74 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; esac if $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else @@ -391,53 +370,51 @@ do # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; esac - eval "$initialize_posix_glob" - oIFS=$IFS IFS=/ - $posix_glob set -f + set -f set fnord $dstdir shift - $posix_glob set +f + set +f IFS=$oIFS prefixes= for d do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ done if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi fi fi @@ -472,15 +449,12 @@ do # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - + set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then @@ -493,24 +467,24 @@ do # to itself, or perhaps because mv is so ancient that it does not # support -f. { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh index 5eca4ae..0f0a2da 100644 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh @@ -2,11 +2,11 @@ ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 -# libtool (GNU libtool) 2.4.4 +# libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.4 -package_revision=2.4.4 +VERSION=2.4.6 +package_revision=2.4.6 ## ------ ## @@ -64,12 +64,12 @@ package_revision=2.4.4 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2014-01-03.01; # UTC +scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -192,7 +192,7 @@ func_path_progs () _G_path_prog_max=0 _G_path_prog_found=false - _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. @@ -1375,7 +1375,7 @@ scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2014 Free Software Foundation, Inc. +# Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -1977,7 +1977,7 @@ func_version () # End: # Set a version string. -scriptversion='(GNU libtool) 2.4.4' +scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... @@ -2039,7 +2039,12 @@ usage_message="Options: " # Additional text appended to 'usage_message' in response to '--help'. -long_help_message=$long_help_message" +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message MODE must be one of the following: @@ -2063,13 +2068,15 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.4 + version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." + exit 0 +} # func_lo2o OBJECT-NAME @@ -6461,6 +6468,24 @@ func_win32_import_lib_p () esac } +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + # func_mode_link arg... func_mode_link () { @@ -7437,6 +7462,9 @@ func_mode_link () eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" @@ -8599,6 +8627,37 @@ func_mode_link () eval $var=\"$tmp_libs\" done # for var fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= diff --git a/build-aux/missing b/build-aux/missing index db98974..f62bbae 100755 --- a/build-aux/missing +++ b/build-aux/missing @@ -3,7 +3,7 @@ scriptversion=2013-10-28.13; # UTC -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/build-aux/mkrockspecs b/build-aux/mkrockspecs index 1b1080b..622d328 100755 --- a/build-aux/mkrockspecs +++ b/build-aux/mkrockspecs @@ -376,7 +376,7 @@ else spec.source.url = "git://" .. url .. ".git" spec.source.branch = prog.opts.branch spec.build.modules = nil - default.build.build_command = "./bootstrap && " .. default.build.build_command + default.build.build_command = "LUA='$(LUA)' ./bootstrap && " .. default.build.build_command end diff --git a/build-aux/release.mk b/build-aux/release.mk index 6218d77..13dce9a 100644 --- a/build-aux/release.mk +++ b/build-aux/release.mk @@ -323,10 +323,7 @@ announcement: NEWS -e p NEWS |$(SED) -e 1,2d $(AM_V_at)printf '%s\n' \ 'Install it with LuaRocks, using:' '' \ - ' luarocks install $(PACKAGE) $(VERSION)' '' \ - 'If the latest rocks are not yet available from the official repository,' \ - 'you can install directly from the $(PACKAGE) release branch, with:' \ - '' ' $$ luarocks install '\\ + ' luarocks install $(PACKAGE) $(VERSION)' $(AM_V_at)$(ANNOUNCE_PRINT) 'print ($(GITHUB_ROCKSPEC))' diff --git a/build-aux/specl.mk b/build-aux/specl.mk index 69ae66d..530d961 100644 --- a/build-aux/specl.mk +++ b/build-aux/specl.mk @@ -33,8 +33,9 @@ ## Specl. ## ## ------ ## -SPECL_ENV += \ +CHECK_ENV += \ LUA='$(LUA)' \ + PACKAGE_STRING='$(PACKAGE_STRING)' \ abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ top_builddir='$(top_builddir)' \ @@ -43,7 +44,22 @@ SPECL_ENV += \ check_local += specl-check-local specl-check-local: $(specl_SPECS) - $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) + $(CHECK_ENV) $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) + + +## ------------- ## +## Installation. ## +## ------------- ## + +INSTALLCHECK_ENV += \ + LUA='$(LUA)' \ + PACKAGE_STRING='$(PACKAGE_STRING)' \ + installcheck='true' \ + $(NOTHING_ELSE) + +installcheck_local += specl-installcheck-local +specl-installcheck-local: $(specl_SPECS) + $(INSTALLCHECK_ENV) $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) ## ------------- ## diff --git a/configure b/configure index 6e45067..df8ea33 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lyaml 5.1.4. +# Generated by GNU Autoconf 2.69 for lyaml 6.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='lyaml' PACKAGE_TARNAME='lyaml' -PACKAGE_VERSION='5.1.4' -PACKAGE_STRING='lyaml 5.1.4' +PACKAGE_VERSION='6.0' +PACKAGE_STRING='lyaml 6.0' PACKAGE_BUGREPORT='http://github.com/gvvaughan/lyaml/issues' PACKAGE_URL='' @@ -635,6 +635,9 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +HAVE_LDOC_FALSE +HAVE_LDOC_TRUE +LDOC LUA_INCLUDE pkgluaexecdir luaexecdir @@ -651,6 +654,7 @@ LIBTOOL_DEPS shrext objdir CPP +LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO @@ -784,6 +788,7 @@ CFLAGS LDFLAGS LIBS CPPFLAGS +LT_SYS_LIBRARY_PATH CPP LUA LUA_INCLUDE' @@ -1327,7 +1332,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lyaml 5.1.4 to adapt to many kinds of systems. +\`configure' configures lyaml 6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1402,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lyaml 5.1.4:";; + short | recursive ) echo "Configuration of lyaml 6.0:";; esac cat <<\_ACEOF @@ -1437,6 +1442,8 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. CPP C preprocessor LUA The Lua interpreter, e.g. /usr/bin/lua5.1 LUA_INCLUDE The Lua includes, e.g. -I/usr/include/lua5.1 @@ -1507,7 +1514,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lyaml configure 5.1.4 +lyaml configure 6.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1876,7 +1883,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lyaml $as_me 5.1.4, which was +It was created by lyaml $as_me 6.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2255,12 +2262,12 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -$as_echo "## ----------------------- ## -## Configuring lyaml 5.1.4 ## -## ----------------------- ##" +$as_echo "## --------------------- ## +## Configuring lyaml 6.0 ## +## --------------------- ##" echo -am__api_version='1.14' +am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2432,8 +2439,8 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2452,7 +2459,7 @@ else $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -2746,7 +2753,7 @@ fi # Define the identity of the package. PACKAGE='lyaml' - VERSION='5.1.4' + VERSION='6.0' cat >>confdefs.h <<_ACEOF @@ -2780,8 +2787,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # mkdir_p='$(MKDIR_P)' -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' @@ -2838,6 +2845,7 @@ END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi + # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -2878,6 +2886,7 @@ fi AM_BACKSLASH='\' +## required by automake 1.12.x, not available in 1.10.x DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" @@ -4099,8 +4108,8 @@ esac -macro_version='2.4.4' -macro_revision='2.4.4' +macro_version='2.4.6' +macro_revision='2.4.6' @@ -6522,6 +6531,21 @@ $as_echo "$lt_cv_truncate_bin" >&6; } + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; @@ -7529,6 +7553,41 @@ $as_echo "$lt_cv_ld_force_load" >&6; } ;; esac +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8115,15 +8174,8 @@ test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +func_cc_basename $compiler +cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it @@ -10582,6 +10634,8 @@ hardcode_into_libs=no # flags to be left without arguments need_version=unknown + + case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor @@ -10870,6 +10924,7 @@ freebsd* | dragonfly*) case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; @@ -10929,10 +10984,11 @@ hpux9* | hpux10* | hpux11*) soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -11084,7 +11140,12 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -11309,10 +11370,25 @@ fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi + if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + @@ -12098,6 +12174,7 @@ module=yes eval shrext=$shrext_cmds +## Check for programs ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -12824,6 +12901,195 @@ else fi + +## Check for header files +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +for ac_header in yaml.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "yaml.h" "ac_cv_header_yaml_h" "$ac_includes_default" +if test "x$ac_cv_header_yaml_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_YAML_H 1 +_ACEOF + +fi + +done + + +## Search libs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yaml_document_initialize" >&5 +$as_echo_n "checking for library containing yaml_document_initialize... " >&6; } +if ${ac_cv_search_yaml_document_initialize+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char yaml_document_initialize (); +int +main () +{ +return yaml_document_initialize (); + ; + return 0; +} +_ACEOF +for ac_lib in '' yaml; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_yaml_document_initialize=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_yaml_document_initialize+:} false; then : + break +fi +done +if ${ac_cv_search_yaml_document_initialize+:} false; then : + +else + ac_cv_search_yaml_document_initialize=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yaml_document_initialize" >&5 +$as_echo "$ac_cv_search_yaml_document_initialize" >&6; } +ac_res=$ac_cv_search_yaml_document_initialize +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + + as_fn_error $? "Required library 'yaml' could not be found" "$LINENO" 5 +fi + + +## Lua # Extract the first word of "specl", so it can be a program name with args. set dummy specl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -12870,11 +13136,24 @@ fi + + + if test "x$LUA" != 'x'; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LUA is a Lua interpreter" >&5 $as_echo_n "checking if $LUA is a Lua interpreter... " >&6; } - if $LUA -e "print('Hello ' .. _VERSION .. '!')" >/dev/null 2>&1; then : + _ax_lua_factorial=`$LUA 2>/dev/null -e ' + -- a simple factorial + function fact (n) + if n == 0 then + return 1 + else + return n * fact(n-1) + end + end + print("fact(5) is " .. fact(5))'` + if test "$_ax_lua_factorial" = 'fact(5) is 120'; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else @@ -12888,12 +13167,24 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking $_ax_check_text" >&5 $as_echo_n "checking $_ax_check_text... " >&6; } - if $LUA 2>/dev/null -e ' - function norm (v) - i,j=v:match "(%d+)%.(%d+)" if i then return 100 * i + j end - end - v, toobig=norm (_VERSION), norm "5.4" or math.huge - os.exit ((v >= norm ("5.1") and v < toobig) and 0 or 1)'; then : + _ax_lua_good_version=`$LUA -e ' + -- a script to compare versions + function verstr2num(verstr) + local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") + if majorver and minorver then + return tonumber(majorver) * 100 + tonumber(minorver) + end + end + local minver = verstr2num("5.1") + local _, _, trimver = string.find(_VERSION, "^Lua (.*)") + local ver = verstr2num(trimver) + local maxver = verstr2num("5.4") or 1e9 + if minver <= ver and ver < maxver then + print("yes") + else + print("no") + end'` + if test "x$_ax_lua_good_version" = "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else @@ -12914,19 +13205,41 @@ else for ax_cv_pathless_LUA in lua lua5.2 lua52 lua5.1 lua51 lua50 none; do test "x$ax_cv_pathless_LUA" = 'xnone' && break - if $ax_cv_pathless_LUA -e "print('Hello ' .. _VERSION .. '!')" >/dev/null 2>&1; then : + _ax_lua_factorial=`$ax_cv_pathless_LUA 2>/dev/null -e ' + -- a simple factorial + function fact (n) + if n == 0 then + return 1 + else + return n * fact(n-1) + end + end + print("fact(5) is " .. fact(5))'` + if test "$_ax_lua_factorial" = 'fact(5) is 120'; then : else continue fi - if $ax_cv_pathless_LUA 2>/dev/null -e ' - function norm (v) - i,j=v:match "(%d+)%.(%d+)" if i then return 100 * i + j end - end - v, toobig=norm (_VERSION), norm "5.4" or math.huge - os.exit ((v >= norm ("5.1") and v < toobig) and 0 or 1)'; then : + _ax_lua_good_version=`$ax_cv_pathless_LUA -e ' + -- a script to compare versions + function verstr2num(verstr) + local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") + if majorver and minorver then + return tonumber(majorver) * 100 + tonumber(minorver) + end + end + local minver = verstr2num("5.1") + local _, _, trimver = string.find(_VERSION, "^Lua (.*)") + local ver = verstr2num(trimver) + local maxver = verstr2num("5.4") or 1e9 + if minver <= ver and ver < maxver then + print("yes") + else + print("no") + end'` + if test "x$_ax_lua_good_version" = "xyes"; then : break fi @@ -12993,7 +13306,11 @@ $as_echo_n "checking for $ax_display_LUA version... " >&6; } if ${ax_cv_lua_version+:} false; then : $as_echo_n "(cached) " >&6 else - ax_cv_lua_version=`$LUA -e 'print(_VERSION:match "(%d+%.%d+)")'` + ax_cv_lua_version=`$LUA -e ' + -- return a version number in X.Y format + local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)") + print(ver)'` + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_version" >&5 $as_echo "$ax_cv_lua_version" >&6; } @@ -13002,7 +13319,7 @@ $as_echo "$ax_cv_lua_version" >&6; } fi LUA_VERSION=$ax_cv_lua_version - LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'` + LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ax_display_LUA platform" >&5 @@ -13010,7 +13327,7 @@ $as_echo_n "checking for $ax_display_LUA platform... " >&6; } if ${ax_cv_lua_platform+:} false; then : $as_echo_n "(cached) " >&6 else - ax_cv_lua_platform=`$LUA -e "print('unknown')"` + ax_cv_lua_platform=`$LUA -e 'print("unknown")'` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_platform" >&5 $as_echo "$ax_cv_lua_platform" >&6; } @@ -13037,20 +13354,37 @@ fi - ax_lua_prefixed_path=`$LUA 2>/dev/null -e ' - package.path:gsub ("([^;]+)", - function (p) - p = p:gsub ("%?.*$", ""):gsub ("/[^/]*$", "") - if p:match ("^$ax_lua_prefix") and (not shortest or #shortest > #p) then - shortest = p + ax_lua_prefixed_path=`$LUA -e ' + -- get the path based on search type + local searchtype = "script" + local paths = "" + if searchtype == "script" then + paths = (package and package.path) or LUA_PATH + elseif searchtype == "module" then + paths = (package and package.cpath) or LUA_CPATH + end + -- search for the prefix + local prefix = "'$ax_lua_prefix'" + local minpath = "" + local mindepth = 1e9 + string.gsub(paths, "([^;]+)", + function (path) + path = string.gsub(path, "%?.*$", "") + path = string.gsub(path, "/[^/]*$", "") + if string.find(path, prefix) then + local depth = string.len(string.gsub(path, "[^/]", "")) + if depth < mindepth then + minpath = path + mindepth = depth + end end end) - print (shortest or "")'` + print(minpath)'` if test "x$ax_lua_prefixed_path" != 'x'; then : - _ax_strip_prefix=`echo "$ax_lua_prefix" | sed 's|.|.|g'` + _ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'` ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \ - sed "s,^$_ax_strip_prefix,$LUA_PREFIX,"` + $SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"` fi @@ -13077,20 +13411,37 @@ fi - ax_lua_prefixed_path=`$LUA 2>/dev/null -e ' - package.cpath:gsub ("([^;]+)", - function (p) - p = p:gsub ("%?.*$", ""):gsub ("/[^/]*$", "") - if p:match ("^$ax_lua_exec_prefix") and (not shortest or #shortest > #p) then - shortest = p + ax_lua_prefixed_path=`$LUA -e ' + -- get the path based on search type + local searchtype = "module" + local paths = "" + if searchtype == "script" then + paths = (package and package.path) or LUA_PATH + elseif searchtype == "module" then + paths = (package and package.cpath) or LUA_CPATH + end + -- search for the prefix + local prefix = "'$ax_lua_exec_prefix'" + local minpath = "" + local mindepth = 1e9 + string.gsub(paths, "([^;]+)", + function (path) + path = string.gsub(path, "%?.*$", "") + path = string.gsub(path, "/[^/]*$", "") + if string.find(path, prefix) then + local depth = string.len(string.gsub(path, "[^/]", "")) + if depth < mindepth then + minpath = path + mindepth = depth + end end end) - print (shortest or "")'` + print(minpath)'` if test "x$ax_lua_prefixed_path" != 'x'; then : - _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | sed 's|.|.|g'` + _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'` ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \ - sed "s,^$_ax_strip_prefix,$LUA_EXEC_PREFIX,"` + $SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"` fi @@ -13121,7 +13472,7 @@ fi - LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'` + LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` _ax_lua_saved_cppflags=$CPPFLAGS @@ -13144,6 +13495,7 @@ done if test "x$LUA_INCLUDE" = 'x' && test "x$ac_cv_header_lua_h" != 'xyes'; then : for _ax_include_path in /usr/include/lua$LUA_VERSION \ + /usr/include/lua-$LUA_VERSION \ /usr/include/lua/$LUA_VERSION \ /usr/include/lua$LUA_SHORT_VERSION \ /usr/local/include/lua$LUA_VERSION \ @@ -13189,16 +13541,17 @@ fi fi - if test "x$ac_cv_header_lua_h" = 'xyes' && test "x$cross_compiling" != 'xyes'; then : + if test "x$ac_cv_header_lua_h" = 'xyes'; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua header version" >&5 + if test "x$cross_compiling" != 'xyes'; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua header version" >&5 $as_echo_n "checking for Lua header version... " >&6; } if ${ax_cv_lua_header_version+:} false; then : $as_echo_n "(cached) " >&6 else _ax_lua_saved_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" - if test "$cross_compiling" = yes; then : + CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" + if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling @@ -13220,8 +13573,7 @@ int main(int argc, char ** argv) _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_lua_header_version=`./conftest$EXEEXT p | \ - sed "s|^Lua \(.*\)|\1|" | \ - grep -E -o "^[0-9]+\.[0-9]+"` + $SED -n "s|^Lua \([0-9]\{1,\}\.[0-9]\{1,\}\).\{0,\}|\1|p"` else ax_cv_lua_header_version='unknown' @@ -13230,29 +13582,32 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - CPPFLAGS=$_ax_lua_saved_cppflags + CPPFLAGS=$_ax_lua_saved_cppflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_header_version" >&5 $as_echo "$ax_cv_lua_header_version" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Lua header version matches $LUA_VERSION" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Lua header version matches $LUA_VERSION" >&5 $as_echo_n "checking if Lua header version matches $LUA_VERSION... " >&6; } - if test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"; then : + if test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ax_header_version_match='yes' + ax_header_version_match='yes' else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ax_header_version_match='no' + ax_header_version_match='no' fi else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling so assuming header version number matches" >&5 +$as_echo "$as_me: WARNING: cross compiling so assuming header version number matches" >&2;} + ax_header_version_match='yes' - ax_header_version_match='yes' +fi fi @@ -13268,194 +13623,61 @@ else fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -for ac_header in yaml.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "yaml.h" "ac_cv_header_yaml_h" "$ac_includes_default" -if test "x$ac_cv_header_yaml_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_YAML_H 1 -_ACEOF - -fi - -done - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yaml_document_initialize" >&5 -$as_echo_n "checking for library containing yaml_document_initialize... " >&6; } -if ${ac_cv_search_yaml_document_initialize+:} false; then : +## LDoc +# Extract the first word of "ldoc", so it can be a program name with args. +set dummy ldoc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LDOC+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char yaml_document_initialize (); -int -main () -{ -return yaml_document_initialize (); - ; - return 0; -} -_ACEOF -for ac_lib in '' yaml; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + case $LDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_LDOC="$LDOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LDOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_yaml_document_initialize=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_yaml_document_initialize+:} false; then : - break -fi done -if ${ac_cv_search_yaml_document_initialize+:} false; then : + done +IFS=$as_save_IFS -else - ac_cv_search_yaml_document_initialize=no + test -z "$ac_cv_path_LDOC" && ac_cv_path_LDOC="false" + ;; +esac fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +LDOC=$ac_cv_path_LDOC +if test -n "$LDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDOC" >&5 +$as_echo "$LDOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yaml_document_initialize" >&5 -$as_echo "$ac_cv_search_yaml_document_initialize" >&6; } -ac_res=$ac_cv_search_yaml_document_initialize -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -else - as_fn_error $? "Required library 'yaml' could not be found" "$LINENO" 5 + if test false != "$LDOC"; then + HAVE_LDOC_TRUE= + HAVE_LDOC_FALSE='#' +else + HAVE_LDOC_TRUE='#' + HAVE_LDOC_FALSE= fi +## Generate output files ac_config_headers="$ac_config_headers config.h" -ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile build-aux/config.ld" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -13594,6 +13816,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_LDOC_TRUE}" && test -z "${HAVE_LDOC_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LDOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -13991,7 +14217,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lyaml $as_me 5.1.4, which was +This file was extended by lyaml $as_me 6.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14057,7 +14283,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -lyaml config.status 5.1.4 +lyaml config.status 6.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -14313,7 +14539,8 @@ finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' @@ -14431,7 +14658,8 @@ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes @@ -14471,6 +14699,7 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "build-aux/config.ld") CONFIG_FILES="$CONFIG_FILES build-aux/config.ld" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -15206,6 +15435,9 @@ $as_echo X"$file" | # The names of the tagged configurations supported by this script. available_tags='' +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? @@ -15455,8 +15687,11 @@ hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen @@ -15605,6 +15840,65 @@ hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + _LT_EOF case $host_os in diff --git a/configure.ac b/configure.ac index b8e2b50..ca20229 100644 --- a/configure.ac +++ b/configure.ac @@ -1,30 +1,32 @@ -dnl configure.ac -dnl Written by Gary V. Vaughan, 2013 -dnl -dnl Copyright (C) 2013-2015 Gary V. Vaughan -dnl -dnl Permission is hereby granted, free of charge, to any person obtaining a copy -dnl of this software and associated documentation files (the "Software"), to deal -dnl in the Software without restriction, including without limitation the rights -dnl to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -dnl copies of the Software, and to permit persons to whom the Software is -dnl furnished to do so, subject to the following conditions: -dnl -dnl The above copyright notice and this permission notice shall be included in -dnl all copies or substantial portions of the Software. -dnl -dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -dnl AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -dnl OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -dnl THE SOFTWARE. +## configure.ac +## Written by Gary V. Vaughan, 2013 +## +## Copyright (C) 2013-2015 Gary V. Vaughan +## +## Permission is hereby granted, free of charge, to any person obtaining +## a copy of this software and associated documentation files (the +## "Software"), to deal +## in the Software without restriction, including without limitation the +## rights to use, copy, modify, merge, publish, distribute, sublicense, +## and/or sell copies of the Software, and to permit persons to whom the +## Software is furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be +## included in all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. AC_PREREQ([2.68]) -dnl Initialise autoconf and automake -AC_INIT([lyaml], [5.1.4], [http://github.com/gvvaughan/lyaml/issues]) +## Initialise autoconf and automake +AC_INIT([lyaml], [6.0], [http://github.com/gvvaughan/lyaml/issues]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) @@ -34,7 +36,7 @@ echo AM_INIT_AUTOMAKE([-Wall subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -dnl required by automake 1.12.x, not available in 1.10.x +## required by automake 1.12.x, not available in 1.10.x m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) LT_PREREQ([2.4.2]) @@ -46,21 +48,27 @@ AC_SUBST([objdir]) AC_SUBST([shrext]) AC_SUBST(LIBTOOL_DEPS) -dnl Check for programs +## Check for programs AC_PROG_CC -AC_PATH_PROG([SPECL], [specl], [:]) -AX_PROG_LUA(5.1, 5.4) -AX_LUA_HEADERS -dnl Check for header files +## Check for header files AC_HEADER_STDC AC_CHECK_HEADERS([yaml.h]) -dnl Search libs +## Search libs AC_SEARCH_LIBS([yaml_document_initialize], [yaml], [], [ AC_MSG_ERROR([Required library 'yaml' could not be found])]) -dnl Generate output files +## Lua +AC_PATH_PROG([SPECL], [specl], [:]) +AX_PROG_LUA(5.1, 5.4) +AX_LUA_HEADERS + +## LDoc +AC_PATH_PROG([LDOC], [ldoc], [false]) +AM_CONDITIONAL([HAVE_LDOC], [test false != "$LDOC"]) + +## Generate output files AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile build-aux/config.ld]) AC_OUTPUT diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..6a6e0c2 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,97 @@ + + + + + lyaml 6.0 Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

+

LYAML binding for Lua

+ +

This is a Lua binding for the fast libYAML C library for converting +between %YAML 1.1 and Lua tables, with a flexible Lua language +API to load and save YAML documents.

+ +

It works with Lua 5.1 (including LuaJIT), 5.2 and 5.3.

+ +

LICENSE

+ +

The code is copyright by its respective authors, and released under the +MIT license (the same license as Lua itself). There is no warranty.

+ + + +

Modules

+ + + + + + + + + + + + + + + + + +
lyaml + +
lyaml.explicit + +
lyaml.functional + +
lyaml.implicit + +
+ +
+
+
+generated by LDoc 1.4.3 +Last updated 2015-07-27 01:35:37 +
+
+ + diff --git a/doc/ldoc.css b/doc/ldoc.css new file mode 100644 index 0000000..ce77ac8 --- /dev/null +++ b/doc/ldoc.css @@ -0,0 +1,304 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + list-style: disc; + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 14em; + vertical-align: top; + background-color: #f0f0f0; + overflow: visible; +} + +#navigation h2 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + width: 700px; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.module_list td.summary { width: 100%; } + + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +ul.nowrap { + overflow:auto; + white-space:nowrap; +} + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/doc/modules/lyaml.explicit.html b/doc/modules/lyaml.explicit.html new file mode 100644 index 0000000..36ca3ac --- /dev/null +++ b/doc/modules/lyaml.explicit.html @@ -0,0 +1,267 @@ + + + + + lyaml 6.0 Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module lyaml.explicit

+

+ +

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + +
bool (value)Parse the value following an explicit !!bool tag.
float (value)Parse the value following an explicit !!float tag.
int (value)Parse the value following an explicit !!int tag.
null ()Parse an explicit !!null tag.
str (value)Parse the value following an explicit !!str tag.
+ +
+
+ + +

Functions

+ +
+
+ + bool (value) +
+
+ Parse the value following an explicit !!bool tag. + + +

Parameters:

+
    +
  • value + token +
  • +
+ +

Returns:

+
    + + bool + boolean equivalent, if a valid value was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_bool = explicit.bool (tagarg)
    +
+ +
+
+ + float (value) +
+
+ Parse the value following an explicit !!float tag. + + +

Parameters:

+
    +
  • value + token +
  • +
+ +

Returns:

+
    + + number + float equivalent, if a valid value was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_float = explicit.float (tagarg)
    +
+ +
+
+ + int (value) +
+
+ Parse the value following an explicit !!int tag. + + +

Parameters:

+
    +
  • value + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid value was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = explicit.int (tagarg)
    +
+ +
+
+ + null () +
+
+ Parse an explicit !!null tag. + + + +

Returns:

+
    + + lyaml.null + + + +
+ + + +

Usage:

+
    +
    null = explicit.null (tagarg)
    +
+ +
+
+ + str (value) +
+
+ Parse the value following an explicit !!str tag. + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + string + value which was a string already +
+ + + +

Usage:

+
    +
    tagarg = explicit.str (tagarg)
    +
+ +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2015-07-27 01:35:37 +
+
+ + diff --git a/doc/modules/lyaml.functional.html b/doc/modules/lyaml.functional.html new file mode 100644 index 0000000..58772aa --- /dev/null +++ b/doc/modules/lyaml.functional.html @@ -0,0 +1,233 @@ + + + + + lyaml 6.0 Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module lyaml.functional

+

+ +

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
isnull (x)lyaml.null predicate.
iscallable (x)Callable predicate.
anyof (fns)Compose a function to try each callable with supplied args.
id (...)Return arguments unchanged.
+

Tables

+ + + + + +
NULLlyaml.null value.
+ +
+
+ + +

Functions

+ +
+
+ + isnull (x) +
+
+ lyaml.null predicate. + + +

Parameters:

+
    +
  • x + operand +
  • +
+ +

Returns:

+
    + + bool + true if x is lyaml.null. +
+ + + + +
+
+ + iscallable (x) +
+
+ Callable predicate. + + +

Parameters:

+
    +
  • x + operand +
  • +
+ +

Returns:

+
    + + bool + true if x is a function has a __call metamethod +
+ + + +

Usage:

+
    +
    r = iscallable (x) and x (...)
    +
+ +
+
+ + anyof (fns) +
+
+ Compose a function to try each callable with supplied args. + + +

Parameters:

+
    +
  • fns + table + list of functions to try +
  • +
+ +

Returns:

+
    + + function + a new function to call ... functions, stopping + and returning the first non-nil result, if any +
+ + + + +
+
+ + id (...) +
+
+ Return arguments unchanged. + + +

Parameters:

+
    +
  • ... + arguments +
  • +
+ +

Returns:

+
    + + ... +
+ + + + +
+
+

Tables

+ +
+
+ + NULL +
+
+ lyaml.null value. + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2015-07-27 01:35:37 +
+
+ + diff --git a/doc/modules/lyaml.html b/doc/modules/lyaml.html new file mode 100644 index 0000000..1ada3e1 --- /dev/null +++ b/doc/modules/lyaml.html @@ -0,0 +1,242 @@ + + + + + lyaml 6.0 Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module lyaml

+

+ +

+

+ +

+ + +

Functions

+ + + + + + + + + +
dump (documents[, opts])Dump a list of Lua tables to an equivalent YAML stream.
load (s[, opts])Load a YAML stream into a Lua table.
+

Tables

+ + + + + + + + + + + + + +
nulllyaml.null value.
dumper_optsDump options table.
loader_optsLoad options table.
+ +
+
+ + +

Functions

+ +
+
+ + dump (documents[, opts]) +
+
+ Dump a list of Lua tables to an equivalent YAML stream. + + +

Parameters:

+
    +
  • documents + table + a sequence of Lua tables. +
  • +
  • opts + dumper_opts + initialisation options + (optional) +
  • +
+ +

Returns:

+
    + + string + equivalest YAML stream +
+ + + + +
+
+ + load (s[, opts]) +
+
+ Load a YAML stream into a Lua table. + + +

Parameters:

+
    +
  • s + string + YAML stream +
  • +
  • opts + loader_opts + initialisation options + (optional) +
  • +
+ +

Returns:

+
    + + table + Lua table equivalent of stream s +
+ + + + +
+
+

Tables

+ +
+
+ + null +
+
+ lyaml.null value. + + + + + + + +
+
+ + dumper_opts +
+
+ Dump options table. + + +

Fields:

+
    +
  • anchors + table + map initial anchor names to values +
  • +
  • implicit_scalar + function + parse implicit scalar values +
  • +
+ + + + + +
+
+ + loader_opts +
+
+ Load options table. + + +

Fields:

+
    +
  • all + boolean + load all documents from the stream +
  • +
  • explicit_scalar + table + map full tag-names to parser functions +
  • +
  • implicit_scalar + function + parse implicit scalar values +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2015-07-27 01:35:37 +
+
+ + diff --git a/doc/modules/lyaml.implicit.html b/doc/modules/lyaml.implicit.html new file mode 100644 index 0000000..22eb2dc --- /dev/null +++ b/doc/modules/lyaml.implicit.html @@ -0,0 +1,533 @@ + + + + + lyaml 6.0 Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module lyaml.implicit

+

+ +

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
null (value)Parse a null token to a null value.
bool (value)Parse a boolean token to the equivalent value.
binary (value)Parse a binary token, such as "0b1010_0111_0100_1010_1110".
octal (value)Parse an octal token, such as "012345".
decimal (value)Parse a decimal token, such as "0" or "12345".
hexadecimal (value)Parse a hexadecimal token, such as "0xdeadbeef".
sexagesimal (value)Parse a sexagesimal token, such as "190:20:30".
nan (value)Parse a nan token.
inf (value)Parse a signed inf token.
float (value)Parse a floating point number token, such as "1e-3" or "-0.12".
sexfloat (value)Parse a sexagesimal float, such as "190:20:30.15".
+ +
+
+ + +

Functions

+ +
+
+ + null (value) +
+
+ Parse a null token to a null value. + + +

Parameters:

+
    +
  • value + token +
  • +
+ +

Returns:

+
    + + lyaml.null, for an empty string or literal ~ +
+

Or

+
    + + nil otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_null = implicit.null (token)
    +
+ +
+
+ + bool (value) +
+
+ Parse a boolean token to the equivalent value. + Treats capilalized, lower and upper-cased variants of true/false, + yes/no or on/off tokens as boolean true and false values. + + +

Parameters:

+
    +
  • value + token +
  • +
+ +

Returns:

+
    + + bool + if a valid boolean token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_bool = implicit.bool (token)
    +
+ +
+
+ + binary (value) +
+
+ Parse a binary token, such as "0b1010_0111_0100_1010_1110". + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = implicit.binary (value)
    +
+ +
+
+ + octal (value) +
+
+ Parse an octal token, such as "012345". + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = implicit.octal (value)
    +
+ +
+
+ + decimal (value) +
+
+ Parse a decimal token, such as "0" or "12345". + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = implicit.decimal (value)
    +
+ +
+
+ + hexadecimal (value) +
+
+ Parse a hexadecimal token, such as "0xdeadbeef". + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = implicit.hexadecimal (value)
    +
+ +
+
+ + sexagesimal (value) +
+
+ Parse a sexagesimal token, such as "190:20:30". + Useful for times and angles. + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + int + integer equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_int = implicit.sexagesimal (value)
    +
+ +
+
+ + nan (value) +
+
+ Parse a nan token. + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + nan + not-a-number, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_nan = implicit.nan (value)
    +
+ +
+
+ + inf (value) +
+
+ Parse a signed inf token. + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + number + plus/minus-infinity, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_inf = implicit.inf (value)
    +
+ +
+
+ + float (value) +
+
+ Parse a floating point number token, such as "1e-3" or "-0.12". + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + number + float equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_float = implicit.float (value)
    +
+ +
+
+ + sexfloat (value) +
+
+ Parse a sexagesimal float, such as "190:20:30.15". + Useful for times and angles. + + +

Parameters:

+
    +
  • value + string + token +
  • +
+ +

Returns:

+
    + + number + float equivalent, if a valid token was recognized +
+

Or

+
    + + nil + otherwise, nil +
+ + + +

Usage:

+
    +
    maybe_float = implicit.sexfloat (value)
    +
+ +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2015-07-27 01:35:37 +
+
+ + diff --git a/lib/lyaml.lua b/lib/lyaml.lua index ebc41b1..b16f0c1 100644 --- a/lib/lyaml.lua +++ b/lib/lyaml.lua @@ -3,40 +3,80 @@ -- -- Copyright (c) 2013-2015 Gary V. Vaughan -- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the "Software"), --- to deal in the Software without restriction, including without limitation --- the rights to use, copy, modify, merge, publish, distribute, sublicense, --- and/or sell copies of the Software, and to permit persons to whom the --- Software is furnished to do so, subject to the following conditions: +-- Permission is hereby granted, free of charge, to any person obtaining +-- a copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, sublicense, and/or sell copies of the Software, and to +-- permit persons to whom the Software is furnished to do so, subject to +-- the following conditions: -- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. +-- The above copyright notice and this permission notice shall be +-- included in all copies or substantial portions of the Software. -- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL --- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING --- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER --- DEALINGS IN THE SOFTWARE. +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- --- Portions of this software were inspired by an earlier LibYAML binding by --- Andrew Danforth +-- Portions of this software were inspired by an earlier LibYAML binding +-- by Andrew Danforth +--- @module lyaml -local yaml = require "yaml" +local yaml = require "yaml" +local explicit = require "lyaml.explicit" +local implicit = require "lyaml.implicit" +local functional = require "lyaml.functional" + +local anyof, id, isnull = + functional.anyof, functional.id, functional.isnull + + +--- `lyaml.null` value. +-- @table null +local null = functional.NULL local TAG_PREFIX = "tag:yaml.org,2002:" -local null = setmetatable ({}, { _type = "LYAML null" }) -local function isnull (x) - return (getmetatable (x) or {})._type == "LYAML null" +local function tag (name) + return TAG_PREFIX .. name end +local default = { + -- Tag table to lookup explicit scalar conversions. + explicit_scalar = { + [tag "bool"] = explicit.bool, + [tag "float"] = explicit.float, + [tag "int"] = explicit.int, + [tag "null"] = explicit.null, + [tag "str"] = explicit.str, + }, + -- Order is important, so we put most likely and fastest nearer + -- the top to reduce average number of comparisons and funcalls. + implicit_scalar = anyof { + implicit.null, + implicit.octal, -- subset of decimal, must come earlier + implicit.decimal, + implicit.float, + implicit.bool, + implicit.inf, + implicit.nan, + implicit.hexadecimal, + implicit.binary, + implicit.sexagesimal, + implicit.sexfloat, + id, + }, +} + + -- Metatable for Dumper objects. local dumper_mt = { __index = { @@ -125,12 +165,19 @@ local dumper_mt = { local anchor = self:get_anchor (value) local itsa = type (value) local style = "PLAIN" - if value == "true" or value == "false" or - value == "yes" or value == "no" or value == "~" or - (type (value) ~= "number" and tonumber (value) ~= nil) then + if itsa == "string" and self.implicit_scalar (value) ~= value then + -- take care to round-trip strings that look like scalars style = "SINGLE_QUOTED" + elseif value == math.huge then + value = ".inf" + elseif value == -math.huge then + value = "-.inf" + elseif value ~= value then + value = ".nan" elseif itsa == "number" or itsa == "boolean" then value = tostring (value) + elseif itsa == "string" and string.find (value, "\n") then + style = "LITERAL" end return self:emit { type = "SCALAR", @@ -171,20 +218,42 @@ local dumper_mt = { -- Emitter object constructor. -local function Dumper (anchors) - local t = {} - for k, v in pairs (anchors or {}) do t[v] = k end +local function Dumper (opts) + local anchors = {} + for k, v in pairs (opts.anchors) do anchors[v] = k end local object = { - anchors = t, - aliased = {}, - emitter = yaml.emitter (), + aliased = {}, + anchors = anchors, + emitter = yaml.emitter (), + implicit_scalar = opts.implicit_scalar, } return setmetatable (object, dumper_mt) end -local function dump (documents, anchors) - local dumper = Dumper (anchors) +--- Dump options table. +-- @table dumper_opts +-- @tfield table anchors map initial anchor names to values +-- @tfield function implicit_scalar parse implicit scalar values + + +--- Dump a list of Lua tables to an equivalent YAML stream. +-- @tparam table documents a sequence of Lua tables. +-- @tparam[opt] dumper_opts opts initialisation options +-- @treturn string equivalest YAML stream +local function dump (documents, opts) + opts = opts or {} + + -- backwards compatibility + if opts.anchors == nil and opts.implicit_scalar == nil then + opts = { anchors = opts } + end + + local dumper = Dumper { + anchors = opts.anchors or {}, + implicit_scalar = opts.implicit_scalar or default.implicit_scalar, + } + dumper:emit { type = "STREAM_START", encoding = "UTF8" } for _, document in ipairs (documents) do dumper:dump_document (document) @@ -194,6 +263,17 @@ local function dump (documents, anchors) end +-- We save anchor types that will match the node type from expanding +-- an alias for that anchor. +local alias_type = { + MAPPING_END = "MAPPING_END", + MAPPING_START = "MAPPING_END", + SCALAR = "SCALAR", + SEQUENCE_END = "SEQUENCE_END", + SEQUENCE_START = "SEQUENCE_END", +} + + -- Metatable for Parser objects. local parser_mt = { __index = { @@ -203,15 +283,18 @@ local parser_mt = { end, -- Raise a parse error. - error = function (self, errmsg) - error (string.format ("%d:%d: %s", self.mark.line, - self.mark.column, errmsg), 0) + error = function (self, errmsg, ...) + error (string.format ("%d:%d: " .. errmsg, self.mark.line, + self.mark.column, ...), 0) end, -- Save node in the anchor table for reference in future ALIASes. add_anchor = function (self, node) if self.event.anchor ~= nil then - self.anchors[self.event.anchor] = node + self.anchors[self.event.anchor] = { + type = alias_type[self.event.type], + value = node, + } end end, @@ -236,14 +319,41 @@ local parser_mt = { self:add_anchor (map) while true do local key = self:load_node () + local tag = self.event.tag + if tag then tag = tag:match ("^" .. TAG_PREFIX .. "(.*)$") end if key == nil then break end - local value, event = self:load_node () - if value == nil then - self:error ("unexpected " .. self:type () .. "event") - end - map[key] = value + if key == "<<" or tag == "merge" then + tag = self.event.tag or key + local node, event = self:load_node () + if event == "MAPPING_END" then + for k, v in pairs (node) do + if map[k] == nil then map[k] = v end + end + + elseif event == "SEQUENCE_END" then + for i, merge in ipairs (node) do + if type (merge) ~= "table" then + self:error ("invalid '%s' sequence element %d: %s", + tag, i, tostring (merge)) + end + for k, v in pairs (merge) do + if map[k] == nil then map[k] = v end + end + end + + else + if event == "SCALAR" then event = tostring (node) end + self:error ("invalid '%s' merge event: %s", tag, event) + end + else + local value, event = self:load_node () + if value == nil then + self:error ("unexpected %s event", self:type ()) + end + map[key] = value + end end - return map + return map, self:type () end, -- Construct a Lua array table from following events. @@ -255,44 +365,37 @@ local parser_mt = { if node == nil then break end sequence[#sequence + 1] = node end - return sequence + return sequence, self:type () end, -- Construct a primitive type from the current event. load_scalar = function (self) local value = self.event.value local tag = self.event.tag - if tag then - tag = tag:match ("^" .. TAG_PREFIX .. "(.*)$") - if tag == "str" then - -- value is already a string - elseif tag == "int" or tag == "float" then - value = tonumber (value) - elseif tag == "bool" then - value = (value == "true" or value == "yes") + local explicit = self.explicit_scalar[tag] + + -- Explicitly tagged values. + if explicit then + value = explicit (value) + if value == nil then + self:error ("invalid '%s' value: '%s'", tag, self.event.value) end + + -- Otherwise, implicit conversion according to value content. elseif self.event.style == "PLAIN" then - if value == "~" then - value = null - elseif value == "true" or value == "yes" then - value = true - elseif value == "false" or value == "no" then - value = false - else - local number = tonumber (value) - if number then value = number end - end + value = self.implicit_scalar (self.event.value) end self:add_anchor (value) - return value + return value, self:type () end, load_alias = function (self) local anchor = self.event.anchor - if self.anchors[anchor] == nil then - self:error ("invalid reference: " .. tostring (anchor)) + local event = self.anchors[anchor] + if event == nil then + self:error ("invalid reference: %s", tostring (anchor)) end - return self.anchors[anchor] + return event.value, event.type end, load_node = function (self) @@ -308,7 +411,7 @@ local parser_mt = { local event = self:parse () if dispatch[event] == nil then - self:error ("invalid event: " .. self:type ()) + self:error ("invalid event: %s", self:type ()) end return dispatch[event] (self) end, @@ -317,19 +420,43 @@ local parser_mt = { -- Parser object constructor. -local function Parser (s) +local function Parser (s, opts) local object = { - anchors = {}, - mark = { line = 0, column = 0 }, - next = yaml.parser (s), + anchors = {}, + explicit_scalar = opts.explicit_scalar, + implicit_scalar = opts.implicit_scalar, + mark = { line = 0, column = 0 }, + next = yaml.parser (s), } return setmetatable (object, parser_mt) end -local function load (s, all) +--- Load options table. +-- @table loader_opts +-- @tfield boolean all load all documents from the stream +-- @tfield table explicit_scalar map full tag-names to parser functions +-- @tfield function implicit_scalar parse implicit scalar values + + +--- Load a YAML stream into a Lua table. +-- @tparam string s YAML stream +-- @tparam[opt] loader_opts opts initialisation options +-- @treturn table Lua table equivalent of stream *s* +local function load (s, opts) + opts = opts or {} local documents = {} - local parser = Parser (s) + local all = false + + -- backwards compatibility + if opts == true then + opts = { all = true } + end + + local parser = Parser (s, { + explicit_scalar = opts.explicit_scalar or default.explicit_scalar, + implicit_scalar = opts.implicit_scalar or default.implicit_scalar, + }) if parser:parse () ~= "STREAM_START" then error ("expecting STREAM_START event, but got " .. parser:type (), 2) @@ -352,7 +479,7 @@ local function load (s, all) parser.anchors = {} end - return all and documents or documents[1] + return opts.all and documents or documents[1] end @@ -360,11 +487,14 @@ end --[[ Public Interface. ]]-- --[[ ----------------- ]]-- -local M = { + +--- @export +return { dump = dump, load = load, null = null, + + --- Version number from yaml C binding. + -- @table _VERSION _VERSION = yaml.version, } - -return M diff --git a/lib/lyaml/explicit.lua b/lib/lyaml/explicit.lua new file mode 100644 index 0000000..a0fbb6f --- /dev/null +++ b/lib/lyaml/explicit.lua @@ -0,0 +1,122 @@ +-- LYAML parse explicit token values. +-- Written by Gary V. Vaughan, 2015 +-- +-- Copyright (c) 2015 Gary V. Vaughan +-- +-- Permission is hereby granted, free of charge, to any person obtaining +-- a copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, sublicense, and/or sell copies of the Software, and to +-- permit persons to whom the Software is furnished to do so, subject to +-- the following conditions: +-- +-- The above copyright notice and this permission notice shall be +-- included in all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- @module lyaml.explicit + +local functional = require "lyaml.functional" +local implicit = require "lyaml.implicit" + +local anyof, id = functional.anyof, functional.id + +local NULL = functional.NULL + + +local yn = { + y = true, Y = true, n = false, N = false, +} + + +--- Parse the value following an explicit `!!bool` tag. +-- @function bool +-- @param value token +-- @treturn[1] bool boolean equivalent, if a valid value was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_bool = explicit.bool (tagarg) +local bool = anyof { + implicit.bool, + function (x) return yn[x] end, +} + + +--- Return a function that converts integer results to equivalent float. +-- @tparam function fn token parsing function +-- @treturn function new function that converts int results to float +-- @usage maybe_float = maybefloat (implicit.decimal) (tagarg) +local function maybefloat (fn) + return function (...) + local r = fn (...) + if type (r) == "number" then + return r + 0.0 + end + end +end + + +--- Parse the value following an explicit `!!float` tag. +-- @function float +-- @param value token +-- @treturn[1] number float equivalent, if a valid value was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_float = explicit.float (tagarg) +local float = anyof { + implicit.float, + implicit.nan, + implicit.inf, + maybefloat (implicit.octal), + maybefloat (implicit.decimal), + maybefloat (implicit.hexadecimal), + maybefloat (implicit.binary), + implicit.sexfloat, +} + + +--- Parse the value following an explicit `!!int` tag. +-- @function int +-- @param value token +-- @treturn[1] int integer equivalent, if a valid value was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = explicit.int (tagarg) +local int = anyof { + implicit.octal, + implicit.decimal, + implicit.hexadecimal, + implicit.binary, + implicit.sexagesimal, +} + + +--- Parse an explicit `!!null` tag. +-- @treturn lyaml.null +-- @usage null = explicit.null (tagarg) +local function null () + return NULL +end + + +--- Parse the value following an explicit `!!str` tag. +-- @function str +-- @tparam string value token +-- @treturn string *value* which was a string already +-- @usage tagarg = explicit.str (tagarg) +local str = id + + +--- @export +return { + bool = bool, + float = float, + int = int, + null = null, + str = str, +} diff --git a/lib/lyaml/functional.lua b/lib/lyaml/functional.lua new file mode 100644 index 0000000..ef8af18 --- /dev/null +++ b/lib/lyaml/functional.lua @@ -0,0 +1,83 @@ +-- Minimal functional programming utilities. +-- Written by Gary V. Vaughan, 2015 +-- +-- Copyright (c) 2015 Gary V. Vaughan +-- +-- Permission is hereby granted, free of charge, to any person obtaining +-- a copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, sublicense, and/or sell copies of the Software, and to +-- permit persons to whom the Software is furnished to do so, subject to +-- the following conditions: +-- +-- The above copyright notice and this permission notice shall be +-- included in all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- @module lyaml.functional + + +--- `lyaml.null` value. +-- @table NULL +local NULL = setmetatable ({}, { _type = "LYAML null" }) + + +--- `lyaml.null` predicate. +-- @param x operand +-- @treturn bool `true` if *x* is `lyaml.null`. +local function isnull (x) + return (getmetatable (x) or {})._type == "LYAML null" +end + + +--- Callable predicate. +-- @param x operand +-- @treturn bool `true` if *x* is a function has a __call metamethod +-- @usage r = iscallable (x) and x (...) +local function iscallable (x) + if type (x) ~= "function" then + x = (getmetatable (x) or {}).__call + end + if type (x) == "function" then return x end +end + + +--- Compose a function to try each callable with supplied args. +-- @tparam table fns list of functions to try +-- @treturn function a new function to call *...* functions, stopping +-- and returning the first non-nil result, if any +local function anyof (fns) + return function (...) + for _, fn in ipairs (fns) do + if iscallable (fn) then + local r = fn (...) + if r ~= nil then return r end + end + end + end +end + + +--- Return arguments unchanged. +-- @param ... arguments +-- @return *...* +local function id (...) + return ... +end + +--- @export +return { + NULL = NULL, + anyof = anyof, + id = id, + iscallable = iscallable, + isnull = isnull, +} diff --git a/lib/lyaml/implicit.lua b/lib/lyaml/implicit.lua new file mode 100644 index 0000000..a43b0d8 --- /dev/null +++ b/lib/lyaml/implicit.lua @@ -0,0 +1,235 @@ +-- LYAML parse implicit type tokens. +-- Written by Gary V. Vaughan, 2015 +-- +-- Copyright (c) 2015 Gary V. Vaughan +-- +-- Permission is hereby granted, free of charge, to any person obtaining +-- a copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, sublicense, and/or sell copies of the Software, and to +-- permit persons to whom the Software is furnished to do so, subject to +-- the following conditions: +-- +-- The above copyright notice and this permission notice shall be +-- included in all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- @module lyaml.implicit + + +local NULL = require "lyaml.functional".NULL + + + +--- Parse a null token to a null value. +-- @param value token +-- @return[1] lyaml.null, for an empty string or literal ~ +-- @return[2] nil otherwise, nil +-- @usage maybe_null = implicit.null (token) +local function null (value) + if value == "~" or value == "" then + return NULL + end +end + + +local to_bool = { + ["true"] = true, True = true, TRUE = true, + ["false"] = false, False = false, FALSE = false, + yes = true, Yes = true, YES = true, + no = false, No = false, NO = false, + on = true, On = true, ON = true, + off = false, Off = false, OFF = false, +} + + +--- Parse a boolean token to the equivalent value. +-- Treats capilalized, lower and upper-cased variants of true/false, +-- yes/no or on/off tokens as boolean `true` and `false` values. +-- @param value token +-- @treturn[1] bool if a valid boolean token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_bool = implicit.bool (token) +local function bool (value) + return to_bool[value] +end + + +--- Parse a binary token, such as "0b1010\_0111\_0100\_1010\_1110". +-- @tparam string value token +-- @treturn[1] int integer equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = implicit.binary (value) +local function binary (value) + local r + value:gsub ("^([+-]?)0b_*([01][01_]+)$", function (sign, rest) + r = 0 + rest:gsub ("_*(.)", function (digit) + r = r * 2 + tonumber (digit) + end) + if sign == "-" then r = r * -1 end + end) + return r +end + + +--- Parse an octal token, such as "012345". +-- @tparam string value token +-- @treturn[1] int integer equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = implicit.octal (value) +local function octal (value) + local r + value:gsub ("^([+-]?)0_*([0-7][0-7_]*)$", function (sign, rest) + r = 0 + rest:gsub ("_*(.)", function (digit) + r = r * 8 + tonumber (digit) + end) + if sign == "-" then r = r * -1 end + end) + return r +end + + +--- Parse a decimal token, such as "0" or "12345". +-- @tparam string value token +-- @treturn[1] int integer equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = implicit.decimal (value) +local function decimal (value) + local r + value:gsub ("^([+-]?)_*([0-9][0-9_]*)$", function (sign, rest) + rest = rest:gsub ("_", "") + if rest == "0" or #rest > 1 or rest:sub (1, 1) ~= "0" then + r = tonumber (rest) + if sign == "-" then r = r * -1 end + end + end) + return r +end + + +--- Parse a hexadecimal token, such as "0xdeadbeef". +-- @tparam string value token +-- @treturn[1] int integer equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = implicit.hexadecimal (value) +local function hexadecimal (value) + local r + value:gsub ("^([+-]?)(0x_*[0-9a-fA-F][0-9a-fA-F_]*)$", + function (sign, rest) + rest = rest:gsub ("_", "") + r = tonumber (rest) + if sign == "-" then r = r * -1 end + end + ) + return r +end + + +--- Parse a sexagesimal token, such as "190:20:30". +-- Useful for times and angles. +-- @tparam string value token +-- @treturn[1] int integer equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_int = implicit.sexagesimal (value) +local function sexagesimal (value) + local r + value:gsub ("^([+-]?)([0-9]+:[0-5]?[0-9][:0-9]*)$", function (sign, rest) + r = 0 + rest:gsub ("([0-9]+):?", function (digit) + r = r * 60 + tonumber (digit) + end) + if sign == "-" then r = r * -1 end + end) + return r +end + + +local isnan = { + [".nan"] = true, [".NaN"] = true, [".NAN"] = true, +} + + +--- Parse a `nan` token. +-- @tparam string value token +-- @treturn[1] nan not-a-number, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_nan = implicit.nan (value) +local function nan (value) + if isnan[value] then return 0/0 end +end + + +local isinf = { + [".inf"] = math.huge, [".Inf"] = math.huge, [".INF"] = math.huge, + ["+.inf"] = math.huge, ["+.Inf"] = math.huge, ["+.INF"] = math.huge, + ["-.inf"] = -math.huge, ["-.Inf"] = -math.huge, ["-.INF"] = -math.huge, +} + + +--- Parse a signed `inf` token. +-- @tparam string value token +-- @treturn[1] number plus/minus-infinity, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_inf = implicit.inf (value) +local function inf (value) + return isinf[value] +end + + +--- Parse a floating point number token, such as "1e-3" or "-0.12". +-- @tparam string value token +-- @treturn[1] number float equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_float = implicit.float (value) +local function float (value) + local r = tonumber ((value:gsub ("_", ""))) + if r and value:find "[%.eE]" then return r end +end + + +--- Parse a sexagesimal float, such as "190:20:30.15". +-- Useful for times and angles. +-- @tparam string value token +-- @treturn[1] number float equivalent, if a valid token was recognized +-- @treturn[2] nil otherwise, nil +-- @usage maybe_float = implicit.sexfloat (value) +local function sexfloat (value) + local r + value:gsub ("^([+-]?)([0-9]+:[0-5]?[0-9][:0-9]*)(%.[0-9]+)$", + function (sign, rest, float) + r = 0 + rest:gsub ("([0-9]+):?", function (digit) + r = r * 60 + tonumber (digit) + end) + r = r + tonumber (float) + if sign == "-" then r = r * -1 end + end + ) + return r +end + + +--- @export +return { + binary = binary, + decimal = decimal, + float = float, + hexadecimal = hexadecimal, + inf = inf, + nan = nan, + null = null, + octal = octal, + sexagesimal = sexagesimal, + sexfloat = sexfloat, + bool = bool, +} diff --git a/local.mk b/local.mk index d63d8d8..69fe778 100644 --- a/local.mk +++ b/local.mk @@ -3,23 +3,24 @@ # Copyright (C) 2013-2015 Gary V. Vaughan # Written by Gary V. Vaughan, 2013 # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ------------ ## @@ -46,13 +47,23 @@ update_copyright_env = \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_FORCE=1 -include specs/specs.mk - ## ------------- ## ## Declarations. ## ## ------------- ## +modulesdir = $(docdir)/modules + +dist_doc_DATA = +dist_modules_DATA = + +include specs/specs.mk + + +## ------ ## +## Build. ## +## ------ ## + luaexec_LTLIBRARIES += ext/yaml/yaml.la ext_yaml_yaml_la_SOURCES = \ @@ -73,8 +84,57 @@ dist_lua_DATA += \ lib/lyaml.lua \ $(NOTHING_ELSE) +lualyamldir = $(luadir)/lyaml + +dist_lualyaml_DATA = \ + lib/lyaml/explicit.lua \ + lib/lyaml/functional.lua \ + lib/lyaml/implicit.lua \ + $(NOTHING_ELSE) + # Point mkrockspecs at the in-tree lyaml module. MKROCKSPECS_ENV = $(LUA_ENV) # Make sure yaml is built before calling mkrockspecs. $(package_rockspec) $(scm_rockspec): $(lib_LTLIBRARIES) + + +## ------------- ## +## Distribution. ## +## ------------- ## + +EXTRA_DIST += \ + build-aux/config.ld.in \ + $(NOTHING_ELSE) + + +## -------------- ## +## Documentation. ## +## -------------- ## + +dist_doc_DATA += \ + doc/index.html \ + doc/ldoc.css \ + $(NOTHING_ELSE) + +dist_modules_DATA += \ + doc/modules/lyaml.html \ + doc/modules/lyaml.explicit.html \ + doc/modules/lyaml.functional.html \ + doc/modules/lyaml.implicit.html \ + $(NOTHING_ELSE) + + +## Parallel make gets confused when one command ($(LDOC)) produces +## multiple targets (all the html files above), so use the presence +## of the doc directory as a sentinel file. +$(dist_doc_DATA) $(dist_docmodules_DATA): $(srcdir)/doc + +$(srcdir)/doc: $(dist_lua_DATA) $(dist_lualyaml_DATA) + test -d $@ || mkdir $@ +if HAVE_LDOC + $(LDOC) -c build-aux/config.ld -d $(abs_srcdir)/doc . +else + $(MKDIR_P) doc + touch doc/index.html doc/ldoc.css +endif diff --git a/lyaml-5.1.4-1.rockspec b/lyaml-6.0-1.rockspec similarity index 84% rename from lyaml-5.1.4-1.rockspec rename to lyaml-6.0-1.rockspec index faf2141..bc09d5c 100644 --- a/lyaml-5.1.4-1.rockspec +++ b/lyaml-6.0-1.rockspec @@ -1,5 +1,5 @@ package = "lyaml" -version = "5.1.4-1" +version = "6.0-1" description = { detailed = "Read and write YAML format files with Lua.", homepage = "http://github.com/gvvaughan/lyaml", @@ -7,8 +7,8 @@ description = { summary = "libYAML binding for Lua", } source = { - dir = "lyaml-release-v5.1.4", - url = "http://github.com/gvvaughan/lyaml/archive/release-v5.1.4.zip", + dir = "lyaml-release-v6.0", + url = "http://github.com/gvvaughan/lyaml/archive/release-v6.0.zip", } dependencies = { "lua >= 5.1, < 5.4", diff --git a/m4/ax_lua.m4 b/m4/ax_lua.m4 index 15376af..8da0a07 100644 --- a/m4/ax_lua.m4 +++ b/m4/ax_lua.m4 @@ -51,7 +51,7 @@ # # If MINIMUM-VERSION is supplied, then only Lua interpreters with a # version number greater or equal to MINIMUM-VERSION will be accepted. If -# TOO-BIG- VERSION is also supplied, then only Lua interpreters with a +# TOO-BIG-VERSION is also supplied, then only Lua interpreters with a # version number greater or equal to MINIMUM-VERSION and less than # TOO-BIG-VERSION will be accepted. # @@ -66,12 +66,13 @@ # luaexecdir Directory to install Lua modules. # pkgluaexecdir $luaexecdir/$PACKAGE # -# These paths a found based on $prefix, $exec_prefix, Lua's package.path, -# and package.cpath. The first path of package.path beginning with $prefix -# is selected as luadir. The first path of package.cpath beginning with -# $exec_prefix is used as luaexecdir. This should work on all reasonable -# Lua installations. If a path cannot be determined, a default path is -# used. Of course, the user can override these later when invoking make. +# These paths are found based on $prefix, $exec_prefix, Lua's +# package.path, and package.cpath. The first path of package.path +# beginning with $prefix is selected as luadir. The first path of +# package.cpath beginning with $exec_prefix is used as luaexecdir. This +# should work on all reasonable Lua installations. If a path cannot be +# determined, a default path is used. Of course, the user can override +# these later when invoking make. # # luadir Default: $prefix/share/lua/$LUA_VERSION # luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION @@ -151,8 +152,8 @@ # # LICENSE # -# Copyright (c) 2014 Reuben Thomas -# Copyright (c) 2013 Tim Perkins +# Copyright (c) 2015 Reuben Thomas +# Copyright (c) 2014 Tim Perkins # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -180,7 +181,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 28 +#serial 38 dnl ========================================================================= dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION], @@ -188,6 +189,10 @@ dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ========================================================================= AC_DEFUN([AX_PROG_LUA], [ + dnl Check for required tools. + AC_REQUIRE([AC_PROG_GREP]) + AC_REQUIRE([AC_PROG_SED]) + dnl Make LUA a precious variable. AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1]) @@ -201,12 +206,14 @@ AC_DEFUN([AX_PROG_LUA], [AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])]) ax_display_LUA='lua' - dnl At least check if this is a Lua interpreter. - AC_MSG_CHECKING([if $LUA is a Lua interpreter]) - _AX_LUA_CHK_IS_INTRP([$LUA], - [AC_MSG_RESULT([yes])], - [ AC_MSG_RESULT([no]) - AC_MSG_ERROR([not a Lua interpreter]) + AS_IF([test "x$LUA" != 'x:'], + [ dnl At least check if this is a Lua interpreter. + AC_MSG_CHECKING([if $LUA is a Lua interpreter]) + _AX_LUA_CHK_IS_INTRP([$LUA], + [AC_MSG_RESULT([yes])], + [ AC_MSG_RESULT([no]) + AC_MSG_ERROR([not a Lua interpreter]) + ]) ]) ], [ dnl A version check is needed. @@ -254,18 +261,26 @@ AC_DEFUN([AX_PROG_LUA], m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])]) ], [ dnl Query Lua for its version number. - AC_CACHE_CHECK([for $ax_display_LUA version], [ax_cv_lua_version], - [ ax_cv_lua_version=`$LUA -e 'print(_VERSION:match "(%d+%.%d+)")'` ]) + AC_CACHE_CHECK([for $ax_display_LUA version], + [ax_cv_lua_version], + [ dnl Get the interpreter version in X.Y format. This should work for + dnl interpreters version 5.0 and beyond. + ax_cv_lua_version=[`$LUA -e ' + -- return a version number in X.Y format + local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)") + print(ver)'`] + ]) AS_IF([test "x$ax_cv_lua_version" = 'x'], [AC_MSG_ERROR([invalid Lua version number])]) AC_SUBST([LUA_VERSION], [$ax_cv_lua_version]) - AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | sed 's|\.||'`]) + AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | $SED 's|\.||'`]) dnl The following check is not supported: dnl At times (like when building shared libraries) you may want to know dnl which OS platform Lua thinks this is. - AC_CACHE_CHECK([for $ax_display_LUA platform], [ax_cv_lua_platform], - [ax_cv_lua_platform=`$LUA -e "print('unknown')"`]) + AC_CACHE_CHECK([for $ax_display_LUA platform], + [ax_cv_lua_platform], + [ax_cv_lua_platform=[`$LUA -e 'print("unknown")'`]]) AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform]) dnl Use the values of $prefix and $exec_prefix for the corresponding @@ -290,12 +305,12 @@ AC_DEFUN([AX_PROG_LUA], ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION" dnl Try to find a path with the prefix. - _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [package.path]) + _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [script]) AS_IF([test "x$ax_lua_prefixed_path" != 'x'], [ dnl Fix the prefix. - _ax_strip_prefix=`echo "$ax_lua_prefix" | sed 's|.|.|g'` + _ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'` ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \ - sed "s,^$_ax_strip_prefix,$LUA_PREFIX,"` + $SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"` ]) ]) AC_SUBST([luadir], [$ax_cv_lua_luadir]) @@ -317,12 +332,12 @@ AC_DEFUN([AX_PROG_LUA], dnl Try to find a path with the prefix. _AX_LUA_FND_PRFX_PTH([$LUA], - [$ax_lua_exec_prefix], [package.cpath]) + [$ax_lua_exec_prefix], [module]) AS_IF([test "x$ax_lua_prefixed_path" != 'x'], [ dnl Fix the prefix. - _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | sed 's|.|.|g'` + _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'` ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \ - sed "s,^$_ax_strip_prefix,$LUA_EXEC_PREFIX,"` + $SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"` ]) ]) AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir]) @@ -336,7 +351,7 @@ AC_DEFUN([AX_PROG_LUA], dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA. AC_DEFUN([AX_WITH_LUA], [ - AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA]]) + AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA instead]]) AX_PROG_LUA ]) @@ -346,8 +361,19 @@ dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) dnl ========================================================================= AC_DEFUN([_AX_LUA_CHK_IS_INTRP], [ - dnl Just print _VERSION because all Lua interpreters have this global. - AS_IF([$1 -e "print('Hello ' .. _VERSION .. '!')" >/dev/null 2>&1], + dnl A minimal Lua factorial to prove this is an interpreter. This should work + dnl for Lua interpreters version 5.0 and beyond. + _ax_lua_factorial=[`$1 2>/dev/null -e ' + -- a simple factorial + function fact (n) + if n == 0 then + return 1 + else + return n * fact(n-1) + end + end + print("fact(5) is " .. fact(5))'`] + AS_IF([test "$_ax_lua_factorial" = 'fact(5) is 120'], [$2], [$3]) ]) @@ -358,36 +384,70 @@ dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE]) dnl ========================================================================= AC_DEFUN([_AX_LUA_CHK_VER], [ - AS_IF([$1 2>/dev/null -e ' - function norm (v) - i,j=v:match "(%d+)%.(%d+)" if i then return 100 * i + j end - end - v, toobig=norm (_VERSION), norm "$3" or math.huge - os.exit ((v >= norm ("$2") and v < toobig) and 0 or 1)'], - [$4], [$5]) + dnl Check that the Lua version is within the bounds. Only the major and minor + dnl version numbers are considered. This should work for Lua interpreters + dnl version 5.0 and beyond. + _ax_lua_good_version=[`$1 -e ' + -- a script to compare versions + function verstr2num(verstr) + local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") + if majorver and minorver then + return tonumber(majorver) * 100 + tonumber(minorver) + end + end + local minver = verstr2num("$2") + local _, _, trimver = string.find(_VERSION, "^Lua (.*)") + local ver = verstr2num(trimver) + local maxver = verstr2num("$3") or 1e9 + if minver <= ver and ver < maxver then + print("yes") + else + print("no") + end'`] + AS_IF([test "x$_ax_lua_good_version" = "xyes"], + [$4], [$5]) ]) dnl ========================================================================= -dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, LUA-PATH-VARIABLE) +dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, SCRIPT-OR-MODULE-DIR) dnl ========================================================================= AC_DEFUN([_AX_LUA_FND_PRFX_PTH], [ - dnl Invokes the Lua interpreter PROG to print the path variable - dnl LUA-PATH-VARIABLE, usually package.path or package.cpath. Paths are - dnl then matched against PREFIX. Then ax_lua_prefixed_path is set to the - dnl shortest sub path beginning with PREFIX up to the last directory - dnl that does not contain a '?', if any. - - ax_lua_prefixed_path=`$1 2>/dev/null -e ' - $3:gsub ("(@<:@^;@:>@+)", - function (p) - p = p:gsub ("%?.*$", ""):gsub ("/@<:@^/@:>@*$", "") - if p:match ("^$2") and (not shortest or #shortest > #p) then - shortest = p + dnl Get the script or module directory by querying the Lua interpreter, + dnl filtering on the given prefix, and selecting the shallowest path. If no + dnl path is found matching the prefix, the result will be an empty string. + dnl The third argument determines the type of search, it can be 'script' or + dnl 'module'. Supplying 'script' will perform the search with package.path + dnl and LUA_PATH, and supplying 'module' will search with package.cpath and + dnl LUA_CPATH. This is done for compatibility with Lua 5.0. + + ax_lua_prefixed_path=[`$1 -e ' + -- get the path based on search type + local searchtype = "$3" + local paths = "" + if searchtype == "script" then + paths = (package and package.path) or LUA_PATH + elseif searchtype == "module" then + paths = (package and package.cpath) or LUA_CPATH + end + -- search for the prefix + local prefix = "'$2'" + local minpath = "" + local mindepth = 1e9 + string.gsub(paths, "(@<:@^;@:>@+)", + function (path) + path = string.gsub(path, "%?.*$", "") + path = string.gsub(path, "/@<:@^/@:>@*$", "") + if string.find(path, prefix) then + local depth = string.len(string.gsub(path, "@<:@^/@:>@", "")) + if depth < mindepth then + minpath = path + mindepth = depth + end end end) - print (shortest or "")'` + print(minpath)'`] ]) @@ -408,9 +468,10 @@ AC_DEFUN([AX_LUA_HEADERS], AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1]) dnl Some default directories to search. - LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'` + LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` m4_define_default([_AX_LUA_INCLUDE_LIST], [ /usr/include/lua$LUA_VERSION \ + /usr/include/lua-$LUA_VERSION \ /usr/include/lua/$LUA_VERSION \ /usr/include/lua$LUA_SHORT_VERSION \ /usr/local/include/lua$LUA_VERSION \ @@ -452,16 +513,19 @@ AC_DEFUN([AX_LUA_HEADERS], done ]) - AS_IF([test "x$ac_cv_header_lua_h" = 'xyes' && test "x$cross_compiling" != 'xyes'], + AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'], [ dnl Make a program to print LUA_VERSION defined in the header. - dnl TODO This probably shouldn't be a runtime test. - - AC_CACHE_CHECK([for Lua header version], - [ax_cv_lua_header_version], - [ _ax_lua_saved_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" - AC_RUN_IFELSE( - [ AC_LANG_SOURCE([[ + dnl TODO It would be really nice if we could do this without compiling a + dnl program, then it would work when cross compiling. But I'm not sure how + dnl to do this reliably. For now, assume versions match when cross compiling. + + AS_IF([test "x$cross_compiling" != 'xyes'], + [ AC_CACHE_CHECK([for Lua header version], + [ax_cv_lua_header_version], + [ _ax_lua_saved_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" + AC_RUN_IFELSE( + [ AC_LANG_SOURCE([[ #include #include #include @@ -471,27 +535,27 @@ int main(int argc, char ** argv) exit(EXIT_SUCCESS); } ]]) + ], + [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \ + $SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"` + ], + [ax_cv_lua_header_version='unknown']) + CPPFLAGS=$_ax_lua_saved_cppflags + ]) + + dnl Compare this to the previously found LUA_VERSION. + AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) + AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], + [ AC_MSG_RESULT([yes]) + ax_header_version_match='yes' ], - [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \ - sed "s|^Lua \(.*\)|\1|" | \ - grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"` - ], - [ax_cv_lua_header_version='unknown']) - CPPFLAGS=$_ax_lua_saved_cppflags - ]) - - dnl Compare this to the previously found LUA_VERSION. - AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) - AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], - [ AC_MSG_RESULT([yes]) - ax_header_version_match='yes' + [ AC_MSG_RESULT([no]) + ax_header_version_match='no' + ]) ], - [ AC_MSG_RESULT([no]) - ax_header_version_match='no' + [ AC_MSG_WARN([cross compiling so assuming header version number matches]) + ax_header_version_match='yes' ]) - ], - [ - ax_header_version_match='yes' ]) dnl Was LUA_INCLUDE specified? @@ -507,7 +571,7 @@ int main(int argc, char ** argv) dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS. AC_DEFUN([AX_LUA_HEADERS_VERSION], [ - AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS]]) + AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS instead]]) ]) @@ -563,14 +627,15 @@ AC_DEFUN([AX_LUA_LIBS], _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" AC_SEARCH_LIBS([lua_load], - [ lua$LUA_VERSION \ - lua$LUA_SHORT_VERSION \ - lua-$LUA_VERSION \ - lua-$LUA_SHORT_VERSION \ - lua], - [_ax_found_lua_libs='yes'], - [_ax_found_lua_libs='no'], - [$_ax_lua_extra_libs]) + [ lua$LUA_VERSION \ + lua$LUA_SHORT_VERSION \ + lua-$LUA_VERSION \ + lua-$LUA_SHORT_VERSION \ + lua \ + ], + [_ax_found_lua_libs='yes'], + [_ax_found_lua_libs='no'], + [$_ax_lua_extra_libs]) LIBS=$_ax_lua_saved_libs AS_IF([test "x$ac_cv_search_lua_load" != 'xno' && diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 9c089e0..a3bc337 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1,6 +1,6 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -103,19 +103,36 @@ dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + # _LT_CC_BASENAME(CC) # ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result ]) @@ -720,11 +737,25 @@ _LT_CONFIG_SAVE_COMMANDS([ _LT_COPYING _LT_LIBTOOL_TAGS +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + _LT_EOF case $host_os in @@ -2202,6 +2233,47 @@ _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics @@ -2212,6 +2284,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2306,6 +2379,9 @@ hardcode_into_libs=no # flags to be left without arguments need_version=unknown +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor @@ -2594,6 +2670,7 @@ freebsd* | dragonfly*) case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; @@ -2653,10 +2730,11 @@ hpux9* | hpux10* | hpux11*) soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -2789,7 +2867,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -3013,10 +3096,20 @@ fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi + if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) @@ -3049,8 +3142,10 @@ _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER @@ -7350,6 +7445,7 @@ func_stripname_cnf () } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -7528,51 +7624,6 @@ interix[[3-9]]*) _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test yes != "$solaris_use_stlport4"; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test yes != "$solaris_use_stlport4"; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; esac ]) diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index f51ec8c..94b0829 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 @@ -1,6 +1,6 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2014 Free Software +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index da4ac6b..48bc934 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 @@ -1,6 +1,6 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2014 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index cb6da68..fa04b52 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -1,6 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -9,15 +9,15 @@ # @configure_input@ -# serial 4151 ltversion.m4 +# serial 4179 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.4]) -m4_define([LT_PACKAGE_REVISION], [2.4.4]) +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.4' -macro_revision='2.4.4' +[macro_version='2.4.6' +macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 index 6975098..c6b26f8 100644 --- a/m4/lt~obsolete.m4 +++ b/m4/lt~obsolete.m4 @@ -1,6 +1,6 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2014 Free Software +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # diff --git a/specs/lib_lyaml_spec.yaml b/specs/lib_lyaml_spec.yaml index 7c18ed1..9015193 100644 --- a/specs/lib_lyaml_spec.yaml +++ b/specs/lib_lyaml_spec.yaml @@ -13,7 +13,7 @@ specify lyaml: - context documents: - it writes an empty document: - expect (lyaml.dump {""}).to_match "^%-%-%-%s*\n%.%.%.%s*$" + expect (lyaml.dump {""}).to_match "^%-%-%-%s*''\n%.%.%.%s*$" - it writes consecutive documents: expect (lyaml.dump {"one", "two"}). to_match "^%-%-%-%s+one%s*\n%.%.%.%s*\n%-%-%-%s+two%s*\n%.%.%.%s*$" @@ -32,11 +32,17 @@ specify lyaml: - it writes numbers: expect (lyaml.dump {"123"}).to_be "--- '123'\n...\n" expect (lyaml.dump {"12.3"}).to_be "--- '12.3'\n...\n" + expect (lyaml.dump {"0/0"}).to_be "--- 0/0\n...\n" expect (lyaml.dump {123}).to_be "--- 123\n...\n" expect (lyaml.dump {12.3}).to_be "--- 12.3\n...\n" + expect (lyaml.dump {0/0}).to_be "--- .nan\n...\n" + expect (lyaml.dump {math.huge}).to_be "--- .inf\n...\n" + expect (lyaml.dump {-math.huge}).to_be "--- -.inf\n...\n" - it writes strings: expect (lyaml.dump {"a string"}).to_be "--- a string\n...\n" expect (lyaml.dump {"'a string'"}).to_be "--- '''a string'''\n...\n" + expect (lyaml.dump {"a\nmultiline\nstring"}).to_be "--- |-\n a\n multiline\n string\n...\n" + expect (lyaml.dump {""}).to_be "--- ''\n...\n" - context sequences: - it writes a sequence: @@ -44,8 +50,8 @@ specify lyaml: - context mappings: - it writes a mapping: | - expect (lyaml.dump {{a=1, b=2, c=3}}). - to_contain.all_of {"a: 1", "b: 2", "c: 3"} + expect (lyaml.dump {{a=1, b=2, c=3, d=""}}). + to_contain.all_of {"a: 1", "b: 2", "c: 3", "d: ''"} - context anchors and aliases: - before: @@ -66,118 +72,249 @@ specify lyaml: - describe loading: + - before: + fn = lyaml.load + - it loads an empty stream: - expect (lyaml.load "").to_equal {} + expect (fn "").to_equal {} - it ignores comments: ' - expect (lyaml.load "# A comment\nnon-comment # trailing comment\n"). + expect (fn "# A comment\nnon-comment # trailing comment\n"). to_equal { "non-comment" }' - it diagnoses unexpected events: ' - expect (lyaml.load "...").to_error "1:1: did not find expected node content" - expect (lyaml.load "---\n...\ngarbage\n"). + expect (fn "...").to_error "1:1: did not find expected node content" + expect (fn "---\n...\ngarbage\n"). to_error "2:1: did not find expected " - expect (lyaml.load " *ALIAS"). + expect (fn " *ALIAS"). to_error "1:2: invalid reference: ALIAS"' - context documents: - it lyaml.loads an empty document: - expect (lyaml.load "---").to_equal {""} - expect (lyaml.load "---\n").to_equal {""} - expect (lyaml.load "---\n...").to_equal {""} - expect (lyaml.load "---\n...\n").to_equal {""} + expect (fn "---").to_equal {lyaml.null} + expect (fn "---\n").to_equal {lyaml.null} + expect (fn "---\n...").to_equal {lyaml.null} + expect (fn "---\n...\n").to_equal {lyaml.null} - it lyaml.loads multiple documents: - expect (lyaml.load "one\n---\ntwo").to_equal {"one", "two"} - expect (lyaml.load "---\none\n---\ntwo").to_equal {"one", "two"} - expect (lyaml.load "one\n...\n---\ntwo\n...").to_equal {"one", "two"} - expect (lyaml.load "---\none\n...\n---\ntwo\n...").to_equal {"one", "two"} + expect (fn "one\n---\ntwo").to_equal {"one", "two"} + expect (fn "---\none\n---\ntwo").to_equal {"one", "two"} + expect (fn "one\n...\n---\ntwo\n...").to_equal {"one", "two"} + expect (fn "---\none\n...\n---\ntwo\n...").to_equal {"one", "two"} - it reports an empty document: - expect (lyaml.load "---\n---\ntwo\n---"). - to_equal {"", "two", ""} - expect (lyaml.load "---\n...\n---\ntwo\n---"). - to_equal {"", "two", ""} - expect (lyaml.load "---\n...\n---\ntwo\n...\n---"). - to_equal {"", "two", ""} - expect (lyaml.load "---\n...\n---\ntwo\n...\n---\n..."). - to_equal {"", "two", ""} + expect (fn "---\n---\ntwo\n---"). + to_equal {lyaml.null, "two", lyaml.null} + expect (fn "---\n...\n---\ntwo\n---"). + to_equal {lyaml.null, "two", lyaml.null} + expect (fn "---\n...\n---\ntwo\n...\n---"). + to_equal {lyaml.null, "two", lyaml.null} + expect (fn "---\n...\n---\ntwo\n...\n---\n..."). + to_equal {lyaml.null, "two", lyaml.null} - context version directive: - it recognizes version number: - expect (lyaml.load "%YAML 1.1\n---").to_equal {""} + expect (fn "%YAML 1.1\n---").to_equal {lyaml.null} - it diagneses missing document start: - expect (lyaml.load "%YAML 1.1"). + expect (fn "%YAML 1.1"). to_error "expected " - it diagnoses unsupported version: - expect (lyaml.load "%YAML 2.0\n---"). + expect (fn "%YAML 2.0\n---"). to_error "incompatible YAML document" - context tag directive: - it recognizes primary tag directive: ' - expect (lyaml.load ("%TAG ! tag:yaml.org,2002:\n" .. + expect (fn ("%TAG ! tag:yaml.org,2002:\n" .. "---\n" .. - "!bool untrue")).to_equal {false}' + "!bool N")).to_equal {false}' - it recognizes secondary tag directive: ' - expect (lyaml.load ("%TAG !! tag:ben-kiki.org,2000:\n" .. + expect (fn ("%TAG !! tag:ben-kiki.org,2000:\n" .. "---\n" .. "!!bool untrue")).to_equal {"untrue"}' - it recognizes named tag directive: ' - expect (lyaml.load ("%TAG !bkk! tag:ben-kiki.org,2000:\n" .. + expect (fn ("%TAG !bkk! tag:ben-kiki.org,2000:\n" .. "---\n" .. "!bkk!bool untrue")).to_equal {"untrue"}' - it diagnoses undefined tag handles: ' - expect (lyaml.load ("!bkk!bool untrue")). + expect (fn ("!bkk!bool untrue")). to_error "undefined tag handle"' - context scalars: - it recognizes null: ' - expect (lyaml.load "~").to_equal {lyaml.null}' + expect (fn "~").to_equal {lyaml.null} + expect (fn "foo: ").to_equal {{foo = lyaml.null}}' - it recognizes booleans: ' - expect (lyaml.load "yes").to_equal {true} - expect (lyaml.load "true").to_equal {true} - expect (lyaml.load "false").to_equal {false} - expect (lyaml.load "no").to_equal {false}' - - it recognizes numbers: - expect (lyaml.load "123").to_equal {123} - expect (lyaml.load "12.3").to_equal {12.3} + expect (fn "true").to_equal {true} + expect (fn "false").to_equal {false} + expect (fn "yes").to_equal {true} + expect (fn "no").to_equal {false}' + - it loads bare y and n as strings: + expect (fn "y").to_equal {"y"} + expect (fn "n").to_equal {"n"} + - it recognizes integers: + expect (fn "0b001010011010").to_equal {666} + expect (fn "0b0010_1001_1010").to_equal {666} + expect (fn "+0b001_010_011_010").to_equal {666} + expect (fn "-0b0010_1001_1010").to_equal {-666} + expect (fn "0_1232").to_equal {666} + expect (fn "-01232").to_equal {-666} + expect (fn "666").to_equal {666} + expect (fn "0x29a").to_equal {666} + expect (fn "-0x29a").to_equal {-666} + expect (fn "12_345_678").to_equal {12345678} + expect (fn "11:6").to_equal {666} + - it recognizes floats: + expect (fn "12.3").to_equal {12.3} + expect (fn "685.230_15e+03").to_equal {685230.15} + expect (fn "685_230.15e+03").to_equal {685230150.0} + expect (fn "12_345_678.9").to_equal {12345678.9} + expect (fn "11:6.777").to_equal {666.777} + expect (fn ".Inf").to_equal {math.huge} + expect (fn "-.inf").to_equal {-math.huge} + nant = fn ".NaN" + expect (nant[1]).not_to_equal (nant[1]) - it recognizes strings: - expect (lyaml.load "a string").to_equal {"a string"} - expect (lyaml.load "'''a string'''").to_equal {"'a string'"} + expect (fn "a string").to_equal {"a string"} + expect (fn "'''a string'''").to_equal {"'a string'"} + expect (fn "|-\n a\n multiline\n string").to_equal {"a\nmultiline\nstring"} + expect (fn "'yes'").to_equal {"yes"} + expect (fn "''").to_equal {""} + expect (fn '""').to_equal {""} - context global tags: - - it recognizes !!bool: - expect (lyaml.load "!!bool true").to_equal {true} - expect (lyaml.load "!!bool yes").to_equal {true} - expect (lyaml.load "!!bool no").to_equal {false} - expect (lyaml.load "!!bool false").to_equal {false} - expect (lyaml.load "!!bool garbage").to_equal {false} - - it recognizes !!int: - expect (lyaml.load "!!int 42").to_equal {42} - - it recognizes !!float: - expect (lyaml.load "!!float 3.141592").to_equal {3.141592} + - it recognizes !!null: + expect (fn "!!null").to_equal {lyaml.null} + - it recognizes !!bool: | + expect (fn '!!bool "true"').to_equal {true} + expect (fn '!!bool true').to_equal {true} + expect (fn '!!bool True').to_equal {true} + expect (fn '!!bool TRUE').to_equal {true} + expect (fn "!!bool 'false'").to_equal {false} + expect (fn '!!bool false').to_equal {false} + expect (fn '!!bool False').to_equal {false} + expect (fn '!!bool FALSE').to_equal {false} + expect (fn '!!bool "yes"').to_equal {true} + expect (fn "!!bool 'Yes'").to_equal {true} + expect (fn '!!bool YES').to_equal {true} + expect (fn '!!bool no').to_equal {false} + expect (fn "!!bool 'No'").to_equal {false} + expect (fn '!!bool "NO"').to_equal {false} + expect (fn '!!bool garbage'). + to_raise "invalid 'tag:yaml.org,2002:bool' value: 'garbage'" + - it loads explicit y and n as booleans: + expect (fn '!!bool Y').to_equal {true} + expect (fn '!!bool y').to_equal {true} + expect (fn '!!bool N').to_equal {false} + expect (fn '!!bool n').to_equal {false} + - it recognizes !!float: | + expect (fn '!!float 42').to_equal {42.0} + expect (fn '!!float "42"').to_equal {42.0} + expect (fn '!!float +42').to_equal {42.0} + expect (fn '!!float 12.3').to_equal {12.3} + expect (fn '!!float -3.141592').to_equal {-3.141592} + expect (fn '!!float 685_230.15e+03').to_equal {685230150.0} + expect (fn '!!float +685.230_15e+03').to_equal {685230.15} + expect (fn '!!float 12_345_678.9').to_equal {12345678.9} + expect (fn '!!float -0:3:11:6.777').to_equal {-11466.777} + expect (fn '!!float .Inf').to_equal {math.huge} + expect (fn '!!float -.inf').to_equal {-math.huge} + nant = fn '!!float .NaN' + expect (nant[1]).not_to_equal (nant[1]) + expect (fn '!!float garbage'). + to_raise "invalid 'tag:yaml.org,2002:float' value: 'garbage'" + - it recognizes !!int: | + expect (fn '!!int 0b0010_1001_1010').to_equal {666} + expect (fn '!!int "+0b001_010_011_010"').to_equal {666} + expect (fn '!!int -0b0010_1001_1010').to_equal {-666} + expect (fn '!!int 0_1232').to_equal {666} + expect (fn '!!int "-01232"').to_equal {-666} + expect (fn '!!int 666').to_equal {666} + expect (fn '!!int 0668').to_equal {668} + expect (fn '!!int "0x29a"').to_equal {666} + expect (fn '!!int -0x29a').to_equal {-666} + expect (fn '!!int 12_345_678').to_equal {12345678} + expect (fn '!!int 11:6').to_equal {666} + expect (fn '!!int 12.3'). + to_raise "invalid 'tag:yaml.org,2002:int' value: '12.3'" + expect (fn '!!int garbage'). + to_raise "invalid 'tag:yaml.org,2002:int' value: 'garbage'" - context sequences: - it recognizes block sequences: - expect (lyaml.load "- ~\n- true\n- 42"). - to_equal {{lyaml.null, true, 42}} + expect (fn "- ~\n- \n- true\n- 42"). + to_equal {{lyaml.null, lyaml.null, true, 42}} - it recognizes flow sequences: - expect (lyaml.load "[~, true, 42]"). + expect (fn "[~, true, 42]"). to_equal {{lyaml.null, true, 42}} - - context mapping: - - it recognizes block mapping: ' - expect (lyaml.load "null: ~\nboolean: yes\nnumber: 3.14"). - to_equal {{null = lyaml.null, boolean = true, number = 3.14}}' - - it recognizes flow mapping: ' - expect (lyaml.load "{null: ~, boolean: yes, number: 3.14}"). - to_equal {{null = lyaml.null, boolean = true, number = 3.14}}' - - context anchors and aliases: - it resolves scalar anchors: ' - expect (lyaml.load "anchor: &SS Sammy Sosa\nalias: *SS"). + expect (fn "anchor: &SS Sammy Sosa\nalias: *SS"). to_equal {{anchor = "Sammy Sosa", alias = "Sammy Sosa"}}' - it resolves sequence anchors: ' - expect (lyaml.load "anchor: &SEQ [Mark McGwire, Sammy Sosa]\nalias: *SEQ"). + expect (fn "anchor: &SEQ [Mark McGwire, Sammy Sosa]\nalias: *SEQ"). to_equal {{anchor = {"Mark McGwire", "Sammy Sosa"}, alias = {"Mark McGwire", "Sammy Sosa"}}}' - it resolves mapping anchors: ' - expect (lyaml.load "anchor: &MAP {Mark McGwire: 65, Sammy Sosa: 63}\nalias: *MAP"). + expect (fn "anchor: &MAP {Mark McGwire: 65, Sammy Sosa: 63}\nalias: *MAP"). to_equal {{anchor = {["Mark McGwire"] = 65, ["Sammy Sosa"] = 63}, alias = {["Mark McGwire"] = 65, ["Sammy Sosa"] = 63}}}' + + - context a map: + - it recognizes block mapping: | + expect (fn "null: ~\nboolean: yes\nnumber: 3.14"). + to_equal {{null = lyaml.null, boolean = true, number = 3.14}} + - it recognizes flow mapping: | + expect (fn "{null: ~, boolean: yes, number: 3.14}"). + to_equal {{null = lyaml.null, boolean = true, number = 3.14}} + - context with merge keys: + - before: | + merge = {x=1, y=2} + override = {x=0, z=2} + bogus = true + YAML = "- &MERGE {x: 1, y: 2}\n" .. + "- &OVERRIDE {x: 0, z: 2}\n" .. + "- &BOGUS true\n" + - it diagnoses invalid merge events: | + expect (fn "-\n !!merge : x\n z: 3"). + to_raise "invalid 'tag:yaml.org,2002:merge' merge event: x" + expect (fn "-\n << : x\n z: 3"). + to_raise "invalid '<<' merge event: x" + - it diagnoses invalid merge alias types: | + expect (fn (YAML .. "-\n !!merge : *BOGUS")). + to_raise "invalid 'tag:yaml.org,2002:merge' merge event: true" + expect (fn (YAML .. "-\n << : *BOGUS")). + to_raise "invalid '<<' merge event: true" + - it diagnoses invalid merge sequence elements: | + expect (fn (YAML .. '-\n !!merge : [*MERGE, OVERRIDE]')). + to_raise "invalid 'tag:yaml.org,2002:merge' sequence element 2: OVERRIDE" + expect (fn (YAML .. '-\n <<: [*MERGE, OVERRIDE]')). + to_raise "invalid '<<' sequence element 2: OVERRIDE" + - it diagnoses invalid merge sequence alias tyes: | + expect (fn (YAML .. '-\n !!merge : [*MERGE, *BOGUS]')). + to_raise "invalid 'tag:yaml.org,2002:merge' sequence element 2: true" + expect (fn (YAML .. '-\n <<: [*MERGE, *BOGUS]')). + to_raise "invalid '<<' sequence element 2: true" + - it supports merging bare maps: | + expect (fn ("-\n !!merge : {x: 1, y: 2}\n z: 3")). + to_equal {{{x=1, y=2, z=3}}} + expect (fn "-\n <<: {x: 1, y: 2}\n z: 3"). + to_equal {{{x=1, y=2, z=3}}} + - it supports merging map aliases: | + expect (fn (YAML .. "-\n !!merge : *MERGE\n z: 3")). + to_equal {{merge, override, bogus, {x=1, y=2, z=3}}} + expect (fn (YAML .. "-\n <<: *MERGE\n z: 3")). + to_equal {{merge, override, bogus, {x=1, y=2, z=3}}} + - it merges sequence of bare maps with decreasing precedence: | + expect (fn "-\n !!merge : [{x: 1, y: 2}, {x: 0, z: 2}]\n z: 3"). + to_equal {{{x=1, y=2, z=3}}} + expect (fn "-\n <<: [{x: 1, y: 2}, {x: 0, z: 2}]\n z: 3"). + to_equal {{{x=1, y=2, z=3}}} + - it merges sequence of aliases with decreasing precedence: | + expect (fn (YAML .. "-\n !!merge : [*MERGE, *OVERRIDE]\n z: 3")). + to_equal {{merge, override, bogus, {x=1, y=2, z=3}}} + expect (fn (YAML .. "-\n <<: [*MERGE, *OVERRIDE]\n z: 3")). + to_equal {{merge, override, bogus, {x=1, y=2, z=3}}} + - it merges a sequence alias with decreasing precedence: | + seq = {merge, override} + r = {{merge, override, bogus, seq, {x=1, y=2, z=3}}} + expect (fn (YAML .. "- &SEQ [*MERGE, *OVERRIDE]\n" .. + "-\n !!merge : *SEQ\n z: 3")).to_equal (r) + expect (fn (YAML .. "- &SEQ [*MERGE, *OVERRIDE]\n" .. + "-\n <<: *SEQ\n z: 3")).to_equal (r) diff --git a/specs/spec_helper.lua b/specs/spec_helper.lua index ca66bdf..d37d7e4 100644 --- a/specs/spec_helper.lua +++ b/specs/spec_helper.lua @@ -1,21 +1,23 @@ -local std = require "specl.std" +if os.getenv "installcheck" == nil then + -- Unless we're running inside `make installcheck`, add the dev-tree + -- directories to the module search paths. + local std = require "specl.std" -local top_srcdir = os.getenv "top_srcdir" or "." -local top_builddir = os.getenv "top_builddir" or "." + local top_srcdir = os.getenv "top_srcdir" or "." + local top_builddir = os.getenv "top_builddir" or "." -package.path = std.package.normalize ( - top_builddir .. "/lib/?.lua", - top_srcdir .. "/lib/?.lua", - package.path - ) + package.path = std.package.normalize ( + top_builddir .. "/lib/?.lua", + top_srcdir .. "/lib/?.lua", + package.path) -package.cpath = std.package.normalize ( - top_builddir .. "/ext/yaml/.libs/?.so", - top_builddir .. "/ext/yaml/_libs/?.dll", - top_srcdir .. "/ext/yaml/.libs/?.so", - top_srcdir .. "/ext/yaml/_libs/?.dll", - package.cpathi - ) + package.cpath = std.package.normalize ( + top_builddir .. "/ext/yaml/.libs/?.so", + top_builddir .. "/ext/yaml/_libs/?.dll", + top_srcdir .. "/ext/yaml/.libs/?.so", + top_srcdir .. "/ext/yaml/_libs/?.dll", + package.cpath) +end yaml = require "yaml" diff --git a/travis.yml.in b/travis.yml.in index 4594f0c..90a0e67 100644 --- a/travis.yml.in +++ b/travis.yml.in @@ -3,7 +3,7 @@ language: c env: global: - _COMPILE="libtool --mode=compile --tag=CC gcc" - - _CFLAGS="-O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX" + - _CFLAGS="-O2 -Wall -DLUA_COMPAT_ALL -DLUA_COMPAT_5_2 -DLUA_USE_LINUX" - _INSTALL="libtool --mode=install install -p" - _LINK="libtool --mode=link --tag=CC gcc" - _LIBS="-lm -Wl,-E -ldl -lreadline" @@ -12,6 +12,10 @@ env: - bindir=$prefix/bin - incdir=$prefix/include - libdir=$prefix/lib + + - _inst=$TRAVIS_BUILD_DIR/_inst + - luadir=$_inst/share/lua + - luaexecdir=$_inst/lib/lua matrix: - LUA=lua5.3 - LUA=lua5.2 @@ -28,12 +32,12 @@ before_install: # Fetch Lua sources. - cd $TRAVIS_BUILD_DIR - 'if test lua5.3 = "$LUA"; then - curl http://www.lua.org/work/lua-5.3.0-rc2.tar.gz | tar xz; - cd lua-5.3.0; + curl http://www.lua.org/ftp/lua-5.3.1.tar.gz | tar xz; + cd lua-5.3.1; fi' - 'if test lua5.2 = "$LUA"; then - curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz; - cd lua-5.2.3; + curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz; + cd lua-5.2.4; fi' - 'if test lua5.1 = "$LUA"; then curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz; @@ -87,7 +91,7 @@ before_install: # Tidy up file droppings. - cd $TRAVIS_BUILD_DIR - - rm -rf lua-5.3.0 lua-5.2.3 lua-5.1.5 LuaJIT-2.0.3 luarocks-2.2.0 + - rm -rf lua-5.3.1 lua-5.2.4 lua-5.1.5 LuaJIT-2.0.3 luarocks-2.2.0 install: @@ -106,21 +110,37 @@ install: sleep 1; touch configure; fi' - # Build from rockspec. - - export ROCKSPEC=@PACKAGE@-@VERSION@-1.rockspec - - 'test -f "$ROCKSPEC" || ROCKSPEC=@PACKAGE@-git-1.rockspec' - - sudo luarocks make $ROCKSPEC LUA="$LUA" + # Build from rockspec, forcing uninstall of older luarocks installed + # above when testing the git rockspec, both for enforcing backwards + # compatibility by default, and for ease of maintenance. + - if test -f '@PACKAGE@-@VERSION@-1.rockspec'; then + sudo luarocks make '@PACKAGE@-@VERSION@-1.rockspec' LUA="$LUA"; + else + sudo luarocks make --force '@PACKAGE@-git-1.rockspec' LUA="$LUA"; + fi # Clean up files created by root - sudo git clean -dfx - - sudo rm -rf slingshot + - sudo rm -rf slingshot /tmp/ldoc script: + # Reconfigure for in-tree test install. - test -f configure || ./bootstrap --verbose - - test -f Makefile || ./configure --disable-silent-rules LUA="$LUA" + - ./configure --prefix="$_inst" --disable-silent-rules LUA="$LUA" + + # Verify luarocks installation. + - make installcheck || make installcheck V=1 + + # Verify local build. - make - - make check V=1 + - make check || make check V=1 + + # Verify configured installation. + - make install prefix="$_inst" luadir="$luadir" luaexecdir="$luaexecdir" + - LUA_PATH="$luadir/?.lua;$luadir/?/init.lua;;" + LUA_CPATH="$luaexecdir/?.so;;" + make installcheck V=1 # Run sanity checks on CI server, ignoring buggy automakes.