From bd5b7c29986b8106595f35cbe303fc44cf8c4d0d Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 8 Aug 2016 08:53:46 +0300 Subject: Rename the project --- Makefile.am | 24 +- NEWS | 2 +- README.hacking | 4 +- README.standalone | 12 +- README.submodule | 34 +-- am/argot.m4 | 245 ++++++++++++++++ am/grecs.m4 | 245 ---------------- build-aux/getopt.m4 | 24 +- build-aux/git2chg.awk | 2 +- build-aux/yyrename | 4 +- configure.ac | 6 +- doc/ARGOT_SETUP.3 | 159 +++++++++++ doc/GRECS_SETUP.3 | 159 ----------- doc/Makefile.am | 32 +-- doc/argot-syntax.texi | 404 ++++++++++++++++++++++++++ doc/argot_asprintf.3 | 88 ++++++ doc/argot_config.5 | 352 +++++++++++++++++++++++ doc/argot_error.3 | 184 ++++++++++++ doc/argot_format_locus.3 | 94 ++++++ doc/argot_format_node.3 | 129 +++++++++ doc/argot_format_node_path.3 | 82 ++++++ doc/argot_format_value.3 | 74 +++++ doc/argot_include_path_setup.3 | 66 +++++ doc/argot_malloc.3 | 141 +++++++++ doc/argot_node_free.3 | 61 ++++ doc/argot_parse.3 | 199 +++++++++++++ doc/argot_stmt_path.5 | 121 ++++++++ doc/argot_strdup.3 | 68 +++++ doc/argot_tree_free.3 | 59 ++++ doc/grecs-syntax.texi | 404 -------------------------- doc/grecs_asprintf.3 | 88 ------ doc/grecs_config.5 | 352 ----------------------- doc/grecs_error.3 | 184 ------------ doc/grecs_format_locus.3 | 94 ------ doc/grecs_format_node.3 | 129 --------- doc/grecs_format_node_path.3 | 82 ------ doc/grecs_format_value.3 | 74 ----- doc/grecs_include_path_setup.3 | 66 ----- doc/grecs_malloc.3 | 141 --------- doc/grecs_node_free.3 | 61 ---- doc/grecs_parse.3 | 199 ------------- doc/grecs_stmt_path.5 | 121 -------- doc/grecs_strdup.3 | 68 ----- doc/grecs_tree_free.3 | 59 ---- doc/tmpl.3 | 10 +- doc/wordsplit.3 | 6 +- include/Makefile.am | 22 +- include/argot.h | 40 +++ include/argot/.gitignore | 1 + include/argot/Makefile.am | 43 +++ include/argot/doc.h | 32 +++ include/argot/error.h | 38 +++ include/argot/format.h | 62 ++++ include/argot/json.h | 99 +++++++ include/argot/lex.h | 52 ++++ include/argot/list.h | 54 ++++ include/argot/locus.h | 80 ++++++ include/argot/mem.h | 33 +++ include/argot/node.h | 62 ++++ include/argot/opt.h | 58 ++++ include/argot/parser.h | 56 ++++ include/argot/preproc.h | 46 +++ include/argot/sockaddr.h | 66 +++++ include/argot/symtab.h | 53 ++++ include/argot/table.h | 102 +++++++ include/argot/tree.h | 71 +++++ include/argot/txtacc.h | 36 +++ include/argot/types.h.in | 24 ++ include/argot/util.h | 26 ++ include/argot/value.h | 52 ++++ include/argot/version.h | 40 +++ include/grecs.h | 40 --- include/grecs/.gitignore | 1 - include/grecs/Makefile.am | 43 --- include/grecs/doc.h | 32 --- include/grecs/error.h | 38 --- include/grecs/format.h | 62 ---- include/grecs/json.h | 99 ------- include/grecs/lex.h | 52 ---- include/grecs/list.h | 54 ---- include/grecs/locus.h | 80 ------ include/grecs/mem.h | 33 --- include/grecs/node.h | 62 ---- include/grecs/opt.h | 58 ---- include/grecs/parser.h | 56 ---- include/grecs/preproc.h | 46 --- include/grecs/sockaddr.h | 66 ----- include/grecs/symtab.h | 53 ---- include/grecs/table.h | 102 ------- include/grecs/tree.h | 71 ----- include/grecs/txtacc.h | 36 --- include/grecs/types.h.in | 24 -- include/grecs/util.h | 26 -- include/grecs/value.h | 52 ---- include/grecs/version.h | 40 --- src/.gitignore | 10 +- src/Make-inst.am | 8 +- src/Make-shared.am | 6 +- src/Make-static.am | 6 +- src/Make.am | 70 ++--- src/argot-gram.y | 274 ++++++++++++++++++ src/argot-lex.l | 443 +++++++++++++++++++++++++++++ src/asprintf.c | 10 +- src/bind-gram.y | 152 +++++----- src/bind-lex.l | 132 ++++----- src/cidr.c | 62 ++-- src/dhcpd-gram.y | 160 +++++------ src/dhcpd-lex.l | 154 +++++----- src/diag.c | 36 +-- src/format.c | 204 ++++++------- src/git-parser.c | 150 +++++----- src/grecs-gram.y | 274 ------------------ src/grecs-lex.l | 443 ----------------------------- src/ipstr.c | 16 +- src/join.c | 36 +-- src/json-gram.y | 76 ++--- src/json-lex.l | 22 +- src/jsonfmt.c | 18 +- src/libargot.m4 | 47 +++ src/libgrecs.m4 | 47 --- src/lineacc.c | 46 +-- src/list.c | 84 +++--- src/lookup.c | 252 ++++++++-------- src/mem.c | 48 ++-- src/meta1-gram.y | 80 +++--- src/meta1-lex.l | 56 ++-- src/opthelp.c | 52 ++-- src/parser.c | 54 ++-- src/parsertab.c | 26 +- src/path-parser.c | 82 +++--- src/pp-setup | 2 +- src/preproc.c | 258 ++++++++--------- src/sockaddr.c | 96 +++---- src/sort.c | 36 +-- src/symtab.c | 92 +++--- src/text.c | 32 +-- src/tree.c | 632 ++++++++++++++++++++--------------------- src/txtacc.c | 124 ++++---- src/version.c | 100 +++---- src/yytrans | 8 +- tests/Makefile.am | 26 +- tests/argot00.at | 44 +++ tests/bind00.at | 4 +- tests/cfhelp.at | 2 +- tests/distck.at | 2 +- tests/distck.c | 12 +- tests/empty.at | 12 +- tests/enum.at | 2 +- tests/format00.at | 2 +- tests/format01.at | 2 +- tests/format02.at | 2 +- tests/gcf1.conf | 2 +- tests/gcfenum.c | 24 +- tests/gcffmt.c | 64 ++--- tests/gcfpeek.c | 44 +-- tests/gcfset.c | 136 ++++----- tests/gcfver.c | 14 +- tests/git.conf | 2 +- tests/glob00.at | 2 +- tests/glob01.at | 2 +- tests/glob02.at | 2 +- tests/glob03.at | 2 +- tests/glob04.at | 2 +- tests/glob05.at | 2 +- tests/grecs00.at | 44 --- tests/incl00.at | 2 +- tests/incl01.at | 2 +- tests/incl02.at | 2 +- tests/incl03.at | 2 +- tests/join.at | 2 +- tests/json.c | 10 +- tests/locus-bind.at | 2 +- tests/locus-git.at | 8 +- tests/locus-meta1.at | 2 +- tests/locus00.at | 2 +- tests/locus01.at | 2 +- tests/locus02.at | 2 +- tests/parser-bind.at | 2 +- tests/parser-dhcpd.at | 2 +- tests/parser-git.at | 4 +- tests/parser-meta1.at | 2 +- tests/path-locus.at | 2 +- tests/peek00.at | 2 +- tests/peek01.at | 2 +- tests/peek02.at | 2 +- tests/peek03.at | 2 +- tests/reduce00.at | 4 +- tests/reduce01.at | 4 +- tests/reduce02.at | 4 +- tests/reduce03.at | 4 +- tests/set.at | 2 +- tests/sort00.at | 4 +- tests/sort01.at | 4 +- tests/stradj.at | 2 +- tests/strcat.at | 2 +- tests/testsuite.at | 10 +- tests/vercmp.at | 2 +- tests/wordsplit.at | 2 +- tests/wsp.c | 6 +- 199 files changed, 6631 insertions(+), 6631 deletions(-) create mode 100644 am/argot.m4 delete mode 100644 am/grecs.m4 create mode 100644 doc/ARGOT_SETUP.3 delete mode 100644 doc/GRECS_SETUP.3 create mode 100644 doc/argot-syntax.texi create mode 100644 doc/argot_asprintf.3 create mode 100644 doc/argot_config.5 create mode 100644 doc/argot_error.3 create mode 100644 doc/argot_format_locus.3 create mode 100644 doc/argot_format_node.3 create mode 100644 doc/argot_format_node_path.3 create mode 100644 doc/argot_format_value.3 create mode 100644 doc/argot_include_path_setup.3 create mode 100644 doc/argot_malloc.3 create mode 100644 doc/argot_node_free.3 create mode 100644 doc/argot_parse.3 create mode 100644 doc/argot_stmt_path.5 create mode 100644 doc/argot_strdup.3 create mode 100644 doc/argot_tree_free.3 delete mode 100644 doc/grecs-syntax.texi delete mode 100644 doc/grecs_asprintf.3 delete mode 100644 doc/grecs_config.5 delete mode 100644 doc/grecs_error.3 delete mode 100644 doc/grecs_format_locus.3 delete mode 100644 doc/grecs_format_node.3 delete mode 100644 doc/grecs_format_node_path.3 delete mode 100644 doc/grecs_format_value.3 delete mode 100644 doc/grecs_include_path_setup.3 delete mode 100644 doc/grecs_malloc.3 delete mode 100644 doc/grecs_node_free.3 delete mode 100644 doc/grecs_parse.3 delete mode 100644 doc/grecs_stmt_path.5 delete mode 100644 doc/grecs_strdup.3 delete mode 100644 doc/grecs_tree_free.3 create mode 100644 include/argot.h create mode 100644 include/argot/.gitignore create mode 100644 include/argot/Makefile.am create mode 100644 include/argot/doc.h create mode 100644 include/argot/error.h create mode 100644 include/argot/format.h create mode 100644 include/argot/json.h create mode 100644 include/argot/lex.h create mode 100644 include/argot/list.h create mode 100644 include/argot/locus.h create mode 100644 include/argot/mem.h create mode 100644 include/argot/node.h create mode 100644 include/argot/opt.h create mode 100644 include/argot/parser.h create mode 100644 include/argot/preproc.h create mode 100644 include/argot/sockaddr.h create mode 100644 include/argot/symtab.h create mode 100644 include/argot/table.h create mode 100644 include/argot/tree.h create mode 100644 include/argot/txtacc.h create mode 100644 include/argot/types.h.in create mode 100644 include/argot/util.h create mode 100644 include/argot/value.h create mode 100644 include/argot/version.h delete mode 100644 include/grecs.h delete mode 100644 include/grecs/.gitignore delete mode 100644 include/grecs/Makefile.am delete mode 100644 include/grecs/doc.h delete mode 100644 include/grecs/error.h delete mode 100644 include/grecs/format.h delete mode 100644 include/grecs/json.h delete mode 100644 include/grecs/lex.h delete mode 100644 include/grecs/list.h delete mode 100644 include/grecs/locus.h delete mode 100644 include/grecs/mem.h delete mode 100644 include/grecs/node.h delete mode 100644 include/grecs/opt.h delete mode 100644 include/grecs/parser.h delete mode 100644 include/grecs/preproc.h delete mode 100644 include/grecs/sockaddr.h delete mode 100644 include/grecs/symtab.h delete mode 100644 include/grecs/table.h delete mode 100644 include/grecs/tree.h delete mode 100644 include/grecs/txtacc.h delete mode 100644 include/grecs/types.h.in delete mode 100644 include/grecs/util.h delete mode 100644 include/grecs/value.h delete mode 100644 include/grecs/version.h create mode 100644 src/argot-gram.y create mode 100644 src/argot-lex.l delete mode 100644 src/grecs-gram.y delete mode 100644 src/grecs-lex.l create mode 100644 src/libargot.m4 delete mode 100644 src/libgrecs.m4 create mode 100644 tests/argot00.at delete mode 100644 tests/grecs00.at diff --git a/Makefile.am b/Makefile.am index 3eaa8df..c86d78b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,8 +15,8 @@ # along with Grecs. If not, see . ACLOCAL_AMFLAGS = -I am -SUBDIRS=. include src @GRECS_TESTDIR@ @GRECS_DOCDIR@ -EXTRA_DIST=build-aux/yyrename @GRECS_BUILD_AUX@ @GRECS_DISTDOC@ gitid.h +SUBDIRS=. include src @ARGOT_TESTDIR@ @ARGOT_DOCDIR@ +EXTRA_DIST=build-aux/yyrename @ARGOT_BUILD_AUX@ @ARGOT_DISTDOC@ gitid.h noinst_HEADERS = gitid.h BUILT_SOURCES = gitid.h README @@ -26,23 +26,23 @@ gitid.h: @if test -e .git; then \ url=`git config --get remote.origin.url | sed 's|.*://||;s|/gitroot/|/|'`; \ case $$url in \ - git.gnu.org.ua/grecs.git|*@git.gnu.org.ua/grecs.git) \ + git.gnu.org.ua/argot.git|*@git.gnu.org.ua/argot.git) \ dirty=`git diff-index --name-only HEAD 2>/dev/null` || dirty=;\ test -n "$$dirty" && dirty="-dirty"; \ ID=`git log -1 --pretty='format:%H-%ct-%ae'`$$dirty;\ - echo "#define GRECS_GIT_ID \"$$ID\"";; \ - *) echo "#define GRECS_GIT_ID \"unknown\"";; \ + echo "#define ARGOT_GIT_ID \"$$ID\"";; \ + *) echo "#define ARGOT_GIT_ID \"unknown\"";; \ esac > gitid.tmp; \ cmp gitid.tmp gitid.h >/dev/null 2>&1 || mv gitid.tmp gitid.h; \ rm -f gitid.tmp; \ fi; README: - test -f @GRECS_README@ && cp @GRECS_README@ README + test -f @ARGOT_README@ && cp @ARGOT_README@ README -@GRECS_CHANGELOG@.PHONY: ChangeLog -@GRECS_CHANGELOG@ChangeLog: -@GRECS_CHANGELOG@ $(AM_V_GEN)if test -d .git; then \ -@GRECS_CHANGELOG@ git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \ -@GRECS_CHANGELOG@ awk -f $(top_srcdir)/build-aux/git2chg.awk > ChangeLog; \ -@GRECS_CHANGELOG@ fi +@ARGOT_CHANGELOG@.PHONY: ChangeLog +@ARGOT_CHANGELOG@ChangeLog: +@ARGOT_CHANGELOG@ $(AM_V_GEN)if test -d .git; then \ +@ARGOT_CHANGELOG@ git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \ +@ARGOT_CHANGELOG@ awk -f $(top_srcdir)/build-aux/git2chg.awk > ChangeLog; \ +@ARGOT_CHANGELOG@ fi diff --git a/NEWS b/NEWS index 5841811..7f37d39 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ Grecs NEWS -- history of user-visible changes. 2016-07-04 Copyright (C) 2011-2016 Sergey Poznyakoff See the end of file for copying conditions. -Please send libgrecs bug reports to +Please send libargot bug reports to Version 1.0 (Git) diff --git a/README.hacking b/README.hacking index 77e8e54..e43584f 100644 --- a/README.hacking +++ b/README.hacking @@ -11,7 +11,7 @@ For information about the standalone version, see the file README.standalone in this directory. For a detailed description of Grecs, see the documentation in -the doc/ subdirectory, or visit http://grecs.man.gnu.org.ua. +the doc/ subdirectory, or visit http://argot.man.gnu.org.ua. * Overview @@ -64,7 +64,7 @@ with the actual ChangeLog after make. * Bug reporting. -Send bug reports to . +Send bug reports to . * Copyright information: diff --git a/README.standalone b/README.standalone index 6a4a1b6..470ae86 100644 --- a/README.standalone +++ b/README.standalone @@ -10,11 +10,11 @@ for the documentation, and is provided as a brief reference only. The complete documentation for Grecs is available in the doc/ subdirectory, both as a set of manpages and as texinfo documents. To access the latter without installing the package -run `info -f doc/grecs.info'. After the package is installed -the documentation can be accessed by running `info grecs'. +run `info -f doc/argot.info'. After the package is installed +the documentation can be accessed by running `info argot'. An online copy of the documentation in various formats is available -at http://grecs.man.gnu.org.ua. +at http://argot.man.gnu.org.ua. * Overview @@ -31,9 +31,9 @@ recursively, joining several trees together, reductions, etc. * Downloads -New versions of Libgrecs are available for download from +New versions of Libargot are available for download from - ftp://download.gnu.org.ua/pub/release/grecs + ftp://download.gnu.org.ua/pub/release/argot * Building @@ -48,7 +48,7 @@ available [OPTIONS], see the file INSTALL in this directory. * Bug reporting. -Send bug reports to . +Send bug reports to . * Copyright information: diff --git a/README.submodule b/README.submodule index e04a4ec..5573a64 100644 --- a/README.submodule +++ b/README.submodule @@ -9,11 +9,11 @@ You will find a complete documentation for Grecs, in form of man pages, in the doc/ subdirectory. An online copy of the documentation in various formats is available -at http://grecs.man.gnu.org.ua. +at http://argot.man.gnu.org.ua. -If you are interested in libgrecs, a standalone library implementation +If you are interested in libargot, a standalone library implementation of Grecs, see the file README.standalone in this directory, or visit -http://grecs.man.gnu.org.ua. +http://argot.man.gnu.org.ua. * Overview @@ -30,37 +30,37 @@ recursively, joining several trees together, reductions, etc. * Usage -1. Install grecs as a submodule: +1. Install argot as a submodule: - git submodule add git://git.gnu.org.ua/grecs.git grecs + git submodule add git://git.gnu.org.ua/argot.git argot -2. Add a call to GRECS_SETUP to your configure.ac. It can be as +2. Add a call to ARGOT_SETUP to your configure.ac. It can be as simple as: - GRECS_SETUP + ARGOT_SETUP -If the subproject directory is not 'grecs', supply the actual +If the subproject directory is not 'argot', supply the actual directory name as the first argument to this macro, e.g.: - GRECS_SETUP(lib/grecs) + ARGOT_SETUP(lib/argot) -For a detailed description of the GRECS_SETUP macro, run -`man doc/GRECS_SETUP.3'. +For a detailed description of the ARGOT_SETUP macro, run +`man doc/ARGOT_SETUP.3'. -3. In your Makefile.am, add @GRECS_INCLUDES@ to the INCLUDES value, -and @GRECS_LDADD@ to LDADD, e.g.: +3. In your Makefile.am, add @ARGOT_INCLUDES@ to the INCLUDES value, +and @ARGOT_LDADD@ to LDADD, e.g.: - INCLUDES = @GRECS_INCLUDES@ - LDADD = @GRECS_LDADD@ + INCLUDES = @ARGOT_INCLUDES@ + LDADD = @ARGOT_LDADD@ -4. Include "grecs.h" +4. Include "argot.h" 5. Use the library to handle your configuration files. See the documentation for a detailed discussion. * Bug reporting. -Send bug reports to . +Send bug reports to . * Copyright information: diff --git a/am/argot.m4 b/am/argot.m4 new file mode 100644 index 0000000..f5a21aa --- /dev/null +++ b/am/argot.m4 @@ -0,0 +1,245 @@ +# This file is part of argot - Gray's Extensible Configuration System -*- autoconf -*- +# Copyright (C) 2007-2016 Sergey Poznyakoff +# +# Grex is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Grex is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Grex. If not, see . + +# _ARGOT_MANGLE_OPTION(NAME) +# ------------------------- +# Convert NAME to a valid m4 identifier, by replacing invalid characters +# with underscores, and prepend the _ARGOT_OPTION_ suffix to it. +AC_DEFUN([_ARGOT_MANGLE_OPTION], +[[_ARGOT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _ARGOT_SET_OPTION(NAME) +# ---------------------- +# Set option NAME. +AC_DEFUN([_ARGOT_SET_OPTION], +[m4_define(_ARGOT_MANGLE_OPTION([$1]), 1)]) + +# _ARGOT_IF_OPTION_SET(NAME,IF-SET,IF-NOT-SET) +# ------------------------------------------- +# Check if option NAME is set. +AC_DEFUN([_ARGOT_IF_OPTION_SET], +[m4_ifset(_ARGOT_MANGLE_OPTION([$1]),[$2],[$3])]) + +# _ARGOT_OPTION_SWITCH(NAME1,IF-SET1,[NAME2,IF-SET2,[...]],[IF-NOT-SET]) +# ------------------------------------------------------------------------ +# If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2. +# Continue the process for all name-if-set pairs within [...]. If none +# of the options is set, run IF-NOT-SET. +AC_DEFUN([_ARGOT_OPTION_SWITCH], +[m4_if([$4],,[_ARGOT_IF_OPTION_SET($@)],dnl +[$3],,[_ARGOT_IF_OPTION_SET($@)],dnl +[_ARGOT_IF_OPTION_SET([$1],[$2],[_ARGOT_OPTION_SWITCH(m4_shift(m4_shift($@)))])])]) + +# _ARGOT_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Grecs options. +AC_DEFUN([_ARGOT_SET_OPTIONS], +[m4_foreach_w([_ARGOT_Option], [$1], [_ARGOT_SET_OPTION(_ARGOT_Option)])]) + +# ARGOT_SETUP([dir],[OPTIONS],[pp-setup-file]) +# dir - Directory in the source tree where argot has been cloned. +# OPTIONS are: +# no-preproc Disable the use of preprocessor. +# std-pp-setup Install standard pp-setup file. +# pp-setup-option Add the --with-pp-setup-file option to the +# configuration file. The option allows user to +# control whether the pp-setup file is installed. +# tests Build tests. +# getopt Add getopt.m4 to the distribution. +# git2chg Add git2chg.awk to the distribution. +# syntax-doc Add doc/argot-syntax.texi to the distribution. +# install Build installable library. +# shared Build shared (convenience) library. +# install-headers [with "shared"] Install Grecs headers to +# ARGOT_INCLUDE_DIR. +# tree-api Use alternative signature of callback functions, +# passing a pointer to argot_node_t as an argument, +# instead of pointers to the value and locus. +# sockaddr-list Sockaddr type keeps a singly-linked list of addresses +# returned by getaddrinfo. +# json Compile JSON support +# +# The pp-setup-file argument supplies the pathname of the preprocessor +# setup file in the source tree. It is ignored if std-pp-setup option is +# given. +# +# If neither std-pp-setup option, nor pp-setup-file argument are supplied, +# no preprocessor setup file is installed. + +AC_DEFUN([ARGOT_SETUP],[ + m4_pushdef([argotdir],m4_if($1,[.],,$1,,[argot/],$1/)) + AC_PROG_YACC + AM_PROG_LEX + + AC_HEADER_SYS_WAIT + + AC_SUBST([ARGOT_SUBDIR],m4_if($1,,argot,$1)) + _ARGOT_SET_OPTIONS([$2]) + # ********************** + # Preprocessor + # ********************** + _ARGOT_IF_OPTION_SET([no-preproc], + [use_ext_pp=no], + [AC_ARG_WITH([preprocessor], + AC_HELP_STRING([--without-preprocessor], + [do not use external preprocessor]), + [case "${withval}" in + yes) use_ext_pp=yes ;; + no) use_ext_pp=no ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-preprocessor) ;; + esac],[use_ext_pp=yes])]) + + if test $use_ext_pp != no; then + # Check for default preprocessor + AC_ARG_VAR([DEFAULT_PREPROCESSOR], + [Set default preprocessor name]) + if test -z "$DEFAULT_PREPROCESSOR" ; then + DEFAULT_PREPROCESSOR="m4 -s" + fi + + save_PATH=$PATH + PREPROC_OPTIONS=`echo $DEFAULT_PREPROCESSOR | sed -n 's/[[^ ]][[^ ]]* //p'` + case "$DEFAULT_PREPROCESSOR" in + /*) PATH=`expr $DEFAULT_PREPROCESSOR : '\(.*\)/.*'`:$PATH + DEFAULT_PREPROCESSOR=`expr $DEFAULT_PREPROCESSOR : '.*/\(.*\)'`;; + esac + AC_PATH_PROG(PPBIN, $DEFAULT_PREPROCESSOR) + if test -n "$PPBIN"; then + DEFAULT_PREPROCESSOR="$PPBIN $PREPROC_OPTIONS" + _ARGOT_IF_OPTION_SET([std-pp-setup], + [PP_SETUP_FILE='pp-setup'], + [m4_if([$3],,[PP_SETUP_FILE=],[PP_SETUP_FILE='$3'])]) + AC_SUBST(PP_SETUP_FILE) + if test -n "$PP_SETUP_FILE"; then + _ARGOT_IF_OPTION_SET([pp-setup-option], + [AC_ARG_WITH([pp-setup-file], + AC_HELP_STRING([--with-pp-setup-file], + [install the default pp-setup file]), + [case "${withval}" in + yes) ;; + no) PP_SETUP_FILE=;; + *) AC_MSG_ERROR([bad value ${withval} for --with-pp-setup-file]) ;; + esac])], + [case $PPBIN in + *m4) ;; # Install default pp-setup + *) PP_SETUP_FILE=;; # Skip it + esac]) + fi + DEFAULT_PREPROCESSOR="\\\"$DEFAULT_PREPROCESSOR\\\"" + else + AC_MSG_WARN([requested preprocessor command "$DEFAULT_PREPROCESSOR" not found]) + AC_MSG_WARN([preprocessing disabled]) + DEFAULT_PREPROCESSOR=NULL + fi + PATH=$save_PATH + else + DEFAULT_PREPROCESSOR=NULL + fi + _ARGOT_IF_OPTION_SET([tests], + [m4_pushdef([TESTDIR],argotdir[tests]) + AC_CONFIG_TESTDIR(TESTDIR) + AC_CONFIG_FILES(TESTDIR/Makefile TESTDIR/atlocal) + m4_popdef([TESTDIR]) + AM_MISSING_PROG([AUTOM4TE], [autom4te]) + ARGOT_TESTDIR=tests + ]) + _ARGOT_IF_OPTION_SET([getopt],[ + AC_CHECK_HEADERS([getopt.h]) + AC_CHECK_FUNCS([sysconf getdtablesize getopt_long]) + ARGOT_BUILD_AUX="build-aux/getopt.m4" + ]) + _ARGOT_IF_OPTION_SET([git2chg],[ARGOT_BUILD_AUX="$ARGOT_BUILD_AUX build-aux/git2chg.awk"]) + AM_CONDITIONAL([ARGOT_COND_META1_PARSER], + _ARGOT_OPTION_SWITCH([parser-meta1],[true], + [all-parsers],[true], + [false])) + AM_CONDITIONAL([ARGOT_COND_BIND_PARSER], + _ARGOT_OPTION_SWITCH([parser-bind],[true], + [all-parsers],[true], + [false])) + AM_CONDITIONAL([ARGOT_COND_DHCPD_PARSER], + _ARGOT_OPTION_SWITCH([parser-dhcpd],[true], + [all-parsers],[true], + [false])) + AM_CONDITIONAL([ARGOT_COND_GIT_PARSER], + _ARGOT_OPTION_SWITCH([parser-git],[true], + [all-parsers],[true], + [false])) + AM_CONDITIONAL([ARGOT_COND_INSTALLHEADERS], + _ARGOT_IF_OPTION_SET([install-headers],[true],[false])) + + AM_CONDITIONAL([ARGOT_COND_SOCKADDR_LIST], + _ARGOT_IF_OPTION_SET([sockaddr-list],[true],[false])) + AM_CONDITIONAL([ARGOT_COND_JSON], + _ARGOT_IF_OPTION_SET([json],[true],[false])) + + AC_SUBST([ARGOT_SOCKADDR_LIST]) + _ARGOT_IF_OPTION_SET([sockaddr-list],[ARGOT_SOCKADDR_LIST=1], + [ARGOT_SOCKADDR_LIST=0]) + + AC_SUBST([ARGOT_TREE_API]) + _ARGOT_IF_OPTION_SET([tree-api],[ARGOT_TREE_API=1],[ARGOT_TREE_API=0]) + + AC_SUBST([ARGOT_SRCDIR],$1) + AC_SUBST([ARGOT_BUILD_AUX]) + AC_SUBST([ARGOT_INCLUDES]) + AC_SUBST([ARGOT_TESTDIR]) + AC_SUBST([ARGOT_LDADD]) + AC_SUBST([ARGOT_DOCDIR]) + AC_SUBST([ARGOT_CHANGELOG]) + AC_SUBST([ARGOT_DISTCK_AT]) + AC_SUBST([ARGOT_README]) + AC_SUBST([ARGOT_INCLUDES],['-I$(top_srcdir)/]argotdir[include] [-I$(top_builddir)/]argotdir[include]') + AC_SUBST([ARGOT_HOST_PROJECT_INCLUDES]) + AC_SUBST([ARGOT_DISTDOC]) + AC_SUBST([ARGOT_INCLUDE_DIR],['$(pkgincludedir)']) + + _ARGOT_OPTION_SWITCH([install],[ + LT_INIT + ARGOT_BUILD_TYPE=install + ARGOT_LDADD=['$(top_builddir)/]argotdir[src/libargot.la'] + ARGOT_DOCDIR='doc' + ARGOT_CHANGELOG= + ARGOT_DISTCK_AT=distck.at + ARGOT_README=README.standalone + AC_CONFIG_FILES(argotdir[src/Makefile]:argotdir[src/Make-inst.in] + argotdir[doc/Makefile]) + ],[shared],[ + LT_INIT + ARGOT_BUILD_TYPE=shared + ARGOT_LDADD=['$(top_builddir)/]argotdir[src/libargot.la'] + ARGOT_CHANGELOG='#' + ARGOT_README=README.submodule + _ARGOT_IF_OPTION_SET([syntax-doc],[ARGOT_DISTDOC=doc/argot-syntax.texi]) + AC_CONFIG_FILES(argotdir[src/Makefile]:argotdir[src/Make-shared.in]) + ],[ + ARGOT_BUILD_TYPE=static + ARGOT_LDADD=['$(top_builddir)/]argotdir[src/libargot.a'] + ARGOT_CHANGELOG='#' + ARGOT_README=README.submodule + _ARGOT_IF_OPTION_SET([syntax-doc],[ARGOT_DISTDOC=doc/argot-syntax.texi]) + AC_CONFIG_FILES(argotdir[src/Makefile]:argotdir[src/Make-static.in]) + ]) + AM_CONDITIONAL([ARGOT_COND_BUILD_INSTALL],[test $ARGOT_BUILD_TYPE = install]) + AM_CONDITIONAL([ARGOT_COND_BUILD_SHARED],[test $ARGOT_BUILD_TYPE = shared]) + AM_CONDITIONAL([ARGOT_COND_BUILD_STATIC],[test $ARGOT_BUILD_TYPE = static]) + + AC_CONFIG_FILES(argotdir[Makefile] + argotdir[include/Makefile] + argotdir[include/argot/Makefile] + argotdir[include/argot/types.h]:argotdir[include/argot/types.h.in]) + m4_popdef([argotdir]) +]) diff --git a/am/grecs.m4 b/am/grecs.m4 deleted file mode 100644 index 60244a1..0000000 --- a/am/grecs.m4 +++ /dev/null @@ -1,245 +0,0 @@ -# This file is part of grecs - Gray's Extensible Configuration System -*- autoconf -*- -# Copyright (C) 2007-2016 Sergey Poznyakoff -# -# Grex is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# Grex is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Grex. If not, see . - -# _GRECS_MANGLE_OPTION(NAME) -# ------------------------- -# Convert NAME to a valid m4 identifier, by replacing invalid characters -# with underscores, and prepend the _GRECS_OPTION_ suffix to it. -AC_DEFUN([_GRECS_MANGLE_OPTION], -[[_GRECS_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _GRECS_SET_OPTION(NAME) -# ---------------------- -# Set option NAME. -AC_DEFUN([_GRECS_SET_OPTION], -[m4_define(_GRECS_MANGLE_OPTION([$1]), 1)]) - -# _GRECS_IF_OPTION_SET(NAME,IF-SET,IF-NOT-SET) -# ------------------------------------------- -# Check if option NAME is set. -AC_DEFUN([_GRECS_IF_OPTION_SET], -[m4_ifset(_GRECS_MANGLE_OPTION([$1]),[$2],[$3])]) - -# _GRECS_OPTION_SWITCH(NAME1,IF-SET1,[NAME2,IF-SET2,[...]],[IF-NOT-SET]) -# ------------------------------------------------------------------------ -# If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2. -# Continue the process for all name-if-set pairs within [...]. If none -# of the options is set, run IF-NOT-SET. -AC_DEFUN([_GRECS_OPTION_SWITCH], -[m4_if([$4],,[_GRECS_IF_OPTION_SET($@)],dnl -[$3],,[_GRECS_IF_OPTION_SET($@)],dnl -[_GRECS_IF_OPTION_SET([$1],[$2],[_GRECS_OPTION_SWITCH(m4_shift(m4_shift($@)))])])]) - -# _GRECS_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Grecs options. -AC_DEFUN([_GRECS_SET_OPTIONS], -[m4_foreach_w([_GRECS_Option], [$1], [_GRECS_SET_OPTION(_GRECS_Option)])]) - -# GRECS_SETUP([dir],[OPTIONS],[pp-setup-file]) -# dir - Directory in the source tree where grecs has been cloned. -# OPTIONS are: -# no-preproc Disable the use of preprocessor. -# std-pp-setup Install standard pp-setup file. -# pp-setup-option Add the --with-pp-setup-file option to the -# configuration file. The option allows user to -# control whether the pp-setup file is installed. -# tests Build tests. -# getopt Add getopt.m4 to the distribution. -# git2chg Add git2chg.awk to the distribution. -# syntax-doc Add doc/grecs-syntax.texi to the distribution. -# install Build installable library. -# shared Build shared (convenience) library. -# install-headers [with "shared"] Install Grecs headers to -# GRECS_INCLUDE_DIR. -# tree-api Use alternative signature of callback functions, -# passing a pointer to grecs_node_t as an argument, -# instead of pointers to the value and locus. -# sockaddr-list Sockaddr type keeps a singly-linked list of addresses -# returned by getaddrinfo. -# json Compile JSON support -# -# The pp-setup-file argument supplies the pathname of the preprocessor -# setup file in the source tree. It is ignored if std-pp-setup option is -# given. -# -# If neither std-pp-setup option, nor pp-setup-file argument are supplied, -# no preprocessor setup file is installed. - -AC_DEFUN([GRECS_SETUP],[ - m4_pushdef([grecsdir],m4_if($1,[.],,$1,,[grecs/],$1/)) - AC_PROG_YACC - AM_PROG_LEX - - AC_HEADER_SYS_WAIT - - AC_SUBST([GRECS_SUBDIR],m4_if($1,,grecs,$1)) - _GRECS_SET_OPTIONS([$2]) - # ********************** - # Preprocessor - # ********************** - _GRECS_IF_OPTION_SET([no-preproc], - [use_ext_pp=no], - [AC_ARG_WITH([preprocessor], - AC_HELP_STRING([--without-preprocessor], - [do not use external preprocessor]), - [case "${withval}" in - yes) use_ext_pp=yes ;; - no) use_ext_pp=no ;; - *) AC_MSG_ERROR(bad value ${withval} for --with-preprocessor) ;; - esac],[use_ext_pp=yes])]) - - if test $use_ext_pp != no; then - # Check for default preprocessor - AC_ARG_VAR([DEFAULT_PREPROCESSOR], - [Set default preprocessor name]) - if test -z "$DEFAULT_PREPROCESSOR" ; then - DEFAULT_PREPROCESSOR="m4 -s" - fi - - save_PATH=$PATH - PREPROC_OPTIONS=`echo $DEFAULT_PREPROCESSOR | sed -n 's/[[^ ]][[^ ]]* //p'` - case "$DEFAULT_PREPROCESSOR" in - /*) PATH=`expr $DEFAULT_PREPROCESSOR : '\(.*\)/.*'`:$PATH - DEFAULT_PREPROCESSOR=`expr $DEFAULT_PREPROCESSOR : '.*/\(.*\)'`;; - esac - AC_PATH_PROG(PPBIN, $DEFAULT_PREPROCESSOR) - if test -n "$PPBIN"; then - DEFAULT_PREPROCESSOR="$PPBIN $PREPROC_OPTIONS" - _GRECS_IF_OPTION_SET([std-pp-setup], - [PP_SETUP_FILE='pp-setup'], - [m4_if([$3],,[PP_SETUP_FILE=],[PP_SETUP_FILE='$3'])]) - AC_SUBST(PP_SETUP_FILE) - if test -n "$PP_SETUP_FILE"; then - _GRECS_IF_OPTION_SET([pp-setup-option], - [AC_ARG_WITH([pp-setup-file], - AC_HELP_STRING([--with-pp-setup-file], - [install the default pp-setup file]), - [case "${withval}" in - yes) ;; - no) PP_SETUP_FILE=;; - *) AC_MSG_ERROR([bad value ${withval} for --with-pp-setup-file]) ;; - esac])], - [case $PPBIN in - *m4) ;; # Install default pp-setup - *) PP_SETUP_FILE=;; # Skip it - esac]) - fi - DEFAULT_PREPROCESSOR="\\\"$DEFAULT_PREPROCESSOR\\\"" - else - AC_MSG_WARN([requested preprocessor command "$DEFAULT_PREPROCESSOR" not found]) - AC_MSG_WARN([preprocessing disabled]) - DEFAULT_PREPROCESSOR=NULL - fi - PATH=$save_PATH - else - DEFAULT_PREPROCESSOR=NULL - fi - _GRECS_IF_OPTION_SET([tests], - [m4_pushdef([TESTDIR],grecsdir[tests]) - AC_CONFIG_TESTDIR(TESTDIR) - AC_CONFIG_FILES(TESTDIR/Makefile TESTDIR/atlocal) - m4_popdef([TESTDIR]) - AM_MISSING_PROG([AUTOM4TE], [autom4te]) - GRECS_TESTDIR=tests - ]) - _GRECS_IF_OPTION_SET([getopt],[ - AC_CHECK_HEADERS([getopt.h]) - AC_CHECK_FUNCS([sysconf getdtablesize getopt_long]) - GRECS_BUILD_AUX="build-aux/getopt.m4" - ]) - _GRECS_IF_OPTION_SET([git2chg],[GRECS_BUILD_AUX="$GRECS_BUILD_AUX build-aux/git2chg.awk"]) - AM_CONDITIONAL([GRECS_COND_META1_PARSER], - _GRECS_OPTION_SWITCH([parser-meta1],[true], - [all-parsers],[true], - [false])) - AM_CONDITIONAL([GRECS_COND_BIND_PARSER], - _GRECS_OPTION_SWITCH([parser-bind],[true], - [all-parsers],[true], - [false])) - AM_CONDITIONAL([GRECS_COND_DHCPD_PARSER], - _GRECS_OPTION_SWITCH([parser-dhcpd],[true], - [all-parsers],[true], - [false])) - AM_CONDITIONAL([GRECS_COND_GIT_PARSER], - _GRECS_OPTION_SWITCH([parser-git],[true], - [all-parsers],[true], - [false])) - AM_CONDITIONAL([GRECS_COND_INSTALLHEADERS], - _GRECS_IF_OPTION_SET([install-headers],[true],[false])) - - AM_CONDITIONAL([GRECS_COND_SOCKADDR_LIST], - _GRECS_IF_OPTION_SET([sockaddr-list],[true],[false])) - AM_CONDITIONAL([GRECS_COND_JSON], - _GRECS_IF_OPTION_SET([json],[true],[false])) - - AC_SUBST([GRECS_SOCKADDR_LIST]) - _GRECS_IF_OPTION_SET([sockaddr-list],[GRECS_SOCKADDR_LIST=1], - [GRECS_SOCKADDR_LIST=0]) - - AC_SUBST([GRECS_TREE_API]) - _GRECS_IF_OPTION_SET([tree-api],[GRECS_TREE_API=1],[GRECS_TREE_API=0]) - - AC_SUBST([GRECS_SRCDIR],$1) - AC_SUBST([GRECS_BUILD_AUX]) - AC_SUBST([GRECS_INCLUDES]) - AC_SUBST([GRECS_TESTDIR]) - AC_SUBST([GRECS_LDADD]) - AC_SUBST([GRECS_DOCDIR]) - AC_SUBST([GRECS_CHANGELOG]) - AC_SUBST([GRECS_DISTCK_AT]) - AC_SUBST([GRECS_README]) - AC_SUBST([GRECS_INCLUDES],['-I$(top_srcdir)/]grecsdir[include] [-I$(top_builddir)/]grecsdir[include]') - AC_SUBST([GRECS_HOST_PROJECT_INCLUDES]) - AC_SUBST([GRECS_DISTDOC]) - AC_SUBST([GRECS_INCLUDE_DIR],['$(pkgincludedir)']) - - _GRECS_OPTION_SWITCH([install],[ - LT_INIT - GRECS_BUILD_TYPE=install - GRECS_LDADD=['$(top_builddir)/]grecsdir[src/libgrecs.la'] - GRECS_DOCDIR='doc' - GRECS_CHANGELOG= - GRECS_DISTCK_AT=distck.at - GRECS_README=README.standalone - AC_CONFIG_FILES(grecsdir[src/Makefile]:grecsdir[src/Make-inst.in] - grecsdir[doc/Makefile]) - ],[shared],[ - LT_INIT - GRECS_BUILD_TYPE=shared - GRECS_LDADD=['$(top_builddir)/]grecsdir[src/libgrecs.la'] - GRECS_CHANGELOG='#' - GRECS_README=README.submodule - _GRECS_IF_OPTION_SET([syntax-doc],[GRECS_DISTDOC=doc/grecs-syntax.texi]) - AC_CONFIG_FILES(grecsdir[src/Makefile]:grecsdir[src/Make-shared.in]) - ],[ - GRECS_BUILD_TYPE=static - GRECS_LDADD=['$(top_builddir)/]grecsdir[src/libgrecs.a'] - GRECS_CHANGELOG='#' - GRECS_README=README.submodule - _GRECS_IF_OPTION_SET([syntax-doc],[GRECS_DISTDOC=doc/grecs-syntax.texi]) - AC_CONFIG_FILES(grecsdir[src/Makefile]:grecsdir[src/Make-static.in]) - ]) - AM_CONDITIONAL([GRECS_COND_BUILD_INSTALL],[test $GRECS_BUILD_TYPE = install]) - AM_CONDITIONAL([GRECS_COND_BUILD_SHARED],[test $GRECS_BUILD_TYPE = shared]) - AM_CONDITIONAL([GRECS_COND_BUILD_STATIC],[test $GRECS_BUILD_TYPE = static]) - - AC_CONFIG_FILES(grecsdir[Makefile] - grecsdir[include/Makefile] - grecsdir[include/grecs/Makefile] - grecsdir[include/grecs/types.h]:grecsdir[include/grecs/types.h.in]) - m4_popdef([grecsdir]) -]) diff --git a/build-aux/getopt.m4 b/build-aux/getopt.m4 index 86bac99..1b278bc 100644 --- a/build-aux/getopt.m4 +++ b/build-aux/getopt.m4 @@ -1,4 +1,4 @@ -dnl This file is part of grecs +dnl This file is part of argot dnl Copyright (C) 2007-2016 Sergey Poznyakoff dnl dnl Grecs is free software; you can redistribute it and/or modify @@ -254,11 +254,11 @@ popdef([<__GETOPT_SELECTOR>])>]) dnl OPTNODE(name, value) define([],[]) @@ -306,7 +306,7 @@ __GETOPT_LASTOPT >],[<$3 = optind;>]) if (cmdline_tree) { - struct grecs_node *rn = grecs_node_create(grecs_node_root, NULL); + struct argot_node *rn = argot_node_create(argot_node_root, NULL); rn->down = cmdline_tree; cmdline_tree = rn; } @@ -323,7 +323,7 @@ static char *subcommands[] = { _getopt_sc_array($3) NULL };>]) -static struct grecs_proginfo proginfo = { +static struct argot_proginfo proginfo = { $2, /* progname */ ifelse([<$3>],,NULL,subcommands), /* subcommands */ ifelse([<$4>],,"",N_("$4")), /* docstring */ @@ -344,7 +344,7 @@ _getopt_if_option_set([],dnl PACKAGE_URL, /* url */ NULL /* epilogue */ }; -static struct grecs_node *cmdline_tree; +static struct argot_node *cmdline_tree; _getopt_if_option_set([],dnl []) = $2 " (" PACKAGE_NAME ") " PACKAGE_VERSION; @@ -374,20 +374,20 @@ _getopt_if_option_set([],[< GROUP([]) OPTION([],h,,[]) BEGIN - grecs_print_help(&proginfo); + argot_print_help(&proginfo); exit(0); END _getopt_if_option_set([],,[< OPTION([],,,[]) BEGIN - grecs_print_usage(&proginfo); + argot_print_usage(&proginfo); exit(0); END>]) _getopt_if_option_set([],,[< OPTION([],V,,[]) BEGIN /* Give version */ - grecs_print_version(&proginfo, stdout); + argot_print_version(&proginfo, stdout); exit(0); END>])>]) divert @@ -400,8 +400,8 @@ _getopt_if_option_set([],,[< #endif #include >]) -#include -#include +#include +#include /* Option codes */ enum { _OPTION_INIT=255, @@ -414,7 +414,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; #endif -static struct grecs_opthelp opthelp[] = { +static struct argot_opthelp opthelp[] = { undivert(3) }; undivert(5) diff --git a/build-aux/git2chg.awk b/build-aux/git2chg.awk index 254bb02..e6278e3 100644 --- a/build-aux/git2chg.awk +++ b/build-aux/git2chg.awk @@ -1,4 +1,4 @@ -# This file is part of grecs +# This file is part of argot # Copyright (C) 2007-2016 Sergey Poznyakoff # # Grecs is free software; you can redistribute it and/or modify diff --git a/build-aux/yyrename b/build-aux/yyrename index f23ee18..802cdb4 100755 --- a/build-aux/yyrename +++ b/build-aux/yyrename @@ -27,7 +27,7 @@ # # The prefix is looked up in the file yytrans, located in the INFILE's # directory. If this file does not exist, the prefix is constructed -# by concatenating the string 'grecs_' and the ``root name''. The root +# by concatenating the string 'argot_' and the ``root name''. The root # name is built by removing '-lex.l' or '-gram.y' from the base name. # If the latter does not end in any of these, the root name # is constructed by removing the suffix from the base name. @@ -85,7 +85,7 @@ else pfx= fi if test -z "$pfx"; then - pfx=grecs_`echo $root | tr .- __` + pfx=argot_`echo $root | tr .- __` fi eval $* || exit $? diff --git a/configure.ac b/configure.ac index 6ffa55b..19e90ee 100644 --- a/configure.ac +++ b/configure.ac @@ -15,8 +15,8 @@ # along with Grecs. If not, see . AC_PREREQ(2.63) -AC_INIT([libgrecs], [1.0], [gray+grecs@gnu.org.ua]) -AC_CONFIG_SRCDIR([src/grecs-gram.y]) +AC_INIT([libargot], [1.0], [gray+argot@gnu.org.ua]) +AC_CONFIG_SRCDIR([src/argot-gram.y]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([1.11 gnu tar-ustar dist-xz std-options silent-rules]) @@ -37,6 +37,6 @@ AC_HEADER_STDC # Grecs subsystem -GRECS_SETUP(., [install tests git2chg all-parsers json]) +ARGOT_SETUP(., [install tests git2chg all-parsers json]) AC_OUTPUT diff --git a/doc/ARGOT_SETUP.3 b/doc/ARGOT_SETUP.3 new file mode 100644 index 0000000..3c18d1e --- /dev/null +++ b/doc/ARGOT_SETUP.3 @@ -0,0 +1,159 @@ +.\" This file is part of argot -*- nroff -*- +.\" Copyright (C) 2007-2016 Sergey Poznyakoff +.\" +.\" Grecs is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 3, or (at your option) +.\" any later version. +.\" +.\" Grecs is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with Grecs. If not, see . +.\" +.TH ARGOT_SETUP 3 "August 13, 2012" "ARGOT" "Grecs User Reference" +.SH NAME +ARGOT_SETUP \- Initialize \fBargot\fR submodule. +.SH SYNOPSIS +.BI "ARGOT_SETUP(" "dir" ", " "options" ", " "pp-setup-file" ) +.SH DESCRIPTION +The \fBARGOT_SETUP\fR macro is invoked from the host project's +\fBconfigure.ac\fR. It initializes the \fBargot\fR submodule +variables for compilation within that project. +.PP +All arguments are optional. +.PP +The +.I dir +argument specifies the directory, relative to the source tree top, +where \fBargot\fR has been cloned. If omitted, \fBargot\fR is assumed. +.sp +For example, if \fBargot\fR was cloned using the following command: +.sp +.nf + git clone ssh://git.gnu.org.ua/gitroot/argot.git lib/argot +.fi +.sp +then the \fIdir\fR argument must be \fBlib/argot\fR. +.PP +The +.I options +argument is a space-separated list of options. The following options +are understood: +.TP +.B all-parsers +Compile all available parsers. +.TP +.B parser-bind +Build the parser for BIND configuration files. +.TP +.B parser-dhcpd +Build the parser for DHCPD configuration files. +.TP +.B parser-git +Build the parser for GIT-style configuration files. +.TP +.B parser-meta1 +Build the parser for MeTA1 configuration files. +.TP +.B no-preproc +Disable the use of preprocessor. +.TP +.B install +Create and install shared library \fBlibargot.so\fR. Install the +documentation as well. +.TP +.B shared +Create a shared convenience library. By default, a static library is +created. Use this option if you want to incorporate argot into another +shared library. +.TP +.B install-header +Install header files. This option is valid only when used together +with \fBshared\fR. Header files will be installed in +\fBpkgincludedir\fR. To select another installation directory, define +the variable \fBARGOT_INCLUDE_DIR\fR to the name of that directory. +.TP +.B std-pp-setup +Install the standard \fBpp-setup\fR file. +.TP +.B pp-setup-option +Add the +.B --with-pp-setup-file +option to the produced configuration file. This option allows user to +control whether to install the \fBpp-setup\fR file. +.TP +.B tests +Build tests. +.TP +.B getopt +Add \fBgetopt.m4\fR to the distributed tarball. The file is located +in \fIdir\fR/build-aux. +.TP +.B git2chg +Add \fBgit2chg.awk\fR to the distributed tarball. The file is located +in \fIdir\fR/build-aux. +.TP +.B syntax-doc +Add \fBdoc/argot-syntax.texi\fR file to the distributed tarball. Use this +if your texinfo documentation includes that file. +.PP +The +.I pp-setup-file +argument supplies the pathname of the alternative preprocessor +setup file. It is ignored if +.B std-pp-setup option +is given. +.PP +If neither +.B std-pp-setup +option, nor +.I pp-setup-file +parameter are supplied, no preprocessor setup file is installed. +.SH EXAMPLE +.SS "Default setup" +.RS 4 +.nf +ARGOT_SETUP +.fi +.RE +.SS "Complex setup" +The library sources are in \fBlib/argot\fR. Configure the testsuite +and add the \fBgetopt.m4\fR file to the distribution. Install +preprocessor setup file from \fBsrc/pp-setup\fR: +.sp +.RS 4 +.nf +ARGOT_SETUP(lib/argot, [tests getopt], [$(top_srcdir)/src/pp-setup]) +.RE +.SH "SEE ALSO" +.BR getopt.m4 (5), +.BR pp-setup (5). +.SH AUTHORS +Sergey Poznyakoff +.SH "BUG REPORTS" +Report bugs to . +.SH COLOPHON +The \fBGrecs\fR library is constantly changing, so this manual page +may be incorrect or out-of-date. For the latest copy of \fBGrecs\fR +documentation, visit . +.SH COPYRIGHT +Copyright \(co 2011 Sergey Poznyakoff +.br +.na +License GPLv3+: GNU GPL version 3 or later +.br +.ad +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.\" Local variables: +.\" eval: (add-hook 'write-file-hooks 'time-stamp) +.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \"" +.\" time-stamp-format: "%:B %:d, %:y" +.\" time-stamp-end: "\"" +.\" time-stamp-line-limit: 20 +.\" end: + diff --git a/doc/GRECS_SETUP.3 b/doc/GRECS_SETUP.3 deleted file mode 100644 index 8aa086a..0000000 --- a/doc/GRECS_SETUP.3 +++ /dev/null @@ -1,159 +0,0 @@ -.\" This file is part of grecs -*- nroff -*- -.\" Copyright (C) 2007-2016 Sergey Poznyakoff -.\" -.\" Grecs is free software; you can redistribute it and/or modify -.\" it under the terms of the GNU General Public License as published by -.\" the Free Software Foundation; either version 3, or (at your option) -.\" any later version. -.\" -.\" Grecs is distributed in the hope that it will be useful, -.\" but WITHOUT ANY WARRANTY; without even the implied warranty of -.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.\" GNU General Public License for more details. -.\" -.\" You should have received a copy of the GNU General Public License -.\" along with Grecs. If not, see . -.\" -.TH GRECS_SETUP 3 "August 13, 2012" "GRECS" "Grecs User Reference" -.SH NAME -GRECS_SETUP \- Initialize \fBgrecs\fR submodule. -.SH SYNOPSIS -.BI "GRECS_SETUP(" "dir" ", " "options" ", " "pp-setup-file" ) -.SH DESCRIPTION -The \fBGRECS_SETUP\fR macro is invoked from the host project's -\fBconfigure.ac\fR. It initializes the \fBgrecs\fR submodule -variables for compilation within that project. -.PP -All arguments are optional. -.PP -The -.I dir -argument specifies the directory, relative to the source tree top, -where \fBgrecs\fR has been cloned. If omitted, \fBgrecs\fR is assumed. -.sp -For example, if \fBgrecs\fR was cloned using the following command: -.sp -.nf - git clone ssh://git.gnu.org.ua/gitroot/grecs.git lib/grecs -.fi -.sp -then the \fIdir\fR argument must be \fBlib/grecs\fR. -.PP -The -.I options -argument is a space-separated list of options. The following options -are understood: -.TP -.B all-parsers -Compile all available parsers. -.TP -.B parser-bind -Build the parser for BIND configuration files. -.TP -.B parser-dhcpd -Build the parser for DHCPD configuration files. -.TP -.B parser-git -Build the parser for GIT-style configuration files. -.TP -.B parser-meta1 -Build the parser for MeTA1 configuration files. -.TP -.B no-preproc -Disable the use of preprocessor. -.TP -.B install -Create and install shared library \fBlibgrecs.so\fR. Install the -documentation as well. -.TP -.B shared -Create a shared convenience library. By default, a static library is -created. Use this option if you want to incorporate grecs into another -shared library. -.TP -.B install-header -Install header files. This option is valid only when used together -with \fBshared\fR. Header files will be installed in -\fBpkgincludedir\fR. To select another installation directory, define -the variable \fBGRECS_INCLUDE_DIR\fR to the name of that directory. -.TP -.B std-pp-setup -Install the standard \fBpp-setup\fR file. -.TP -.B pp-setup-option -Add the -.B --with-pp-setup-file -option to the produced configuration file. This option allows user to -control whether to install the \fBpp-setup\fR file. -.TP -.B tests -Build tests. -.TP -.B getopt -Add \fBgetopt.m4\fR to the distributed tarball. The file is located -in \fIdir\fR/build-aux. -.TP -.B git2chg -Add \fBgit2chg.awk\fR to the distributed tarball. The file is located -in \fIdir\fR/build-aux. -.TP -.B syntax-doc -Add \fBdoc/grecs-syntax.texi\fR file to the distributed tarball. Use this -if your texinfo documentation includes that file. -.PP -The -.I pp-setup-file -argument supplies the pathname of the alternative preprocessor -setup file. It is ignored if -.B std-pp-setup option -is given. -.PP -If neither -.B std-pp-setup -option, nor -.I pp-setup-file -parameter are supplied, no preprocessor setup file is installed. -.SH EXAMPLE -.SS "Default setup" -.RS 4 -.nf -GRECS_SETUP -.fi -.RE -.SS "Complex setup" -The library sources are in \fBlib/grecs\fR. Configure the testsuite -and add the \fBgetopt.m4\fR file to the distribution. Install -preprocessor setup file from \fBsrc/pp-setup\fR: -.sp -.RS 4 -.nf -GRECS_SETUP(lib/grecs, [tests getopt], [$(top_srcdir)/src/pp-setup]) -.RE -.SH "SEE ALSO" -.BR getopt.m4 (5), -.BR pp-setup (5). -.SH AUTHORS -Sergey Poznyakoff -.SH "BUG REPORTS" -Report bugs to . -.SH COLOPHON -The \fBGrecs\fR library is constantly changing, so this manual page -may be incorrect or out-of-date. For the latest copy of \fBGrecs\fR -documentation, visit . -.SH COPYRIGHT -Copyright \(co 2011 Sergey Poznyakoff -.br -.na -License GPLv3+: GNU GPL version 3 or later -.br -.ad -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. -.\" Local variables: -.\" eval: (add-hook 'write-file-hooks 'time-stamp) -.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \"" -.\" time-stamp-format: "%:B %:d, %:y" -.\" time-stamp-end: "\"" -.\" time-stamp-line-limit: 20 -.\" end: - diff --git a/doc/Makefile.am b/doc/Makefile.am index a646367..ac32a36 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,4 @@ -# This file is part of grecs - Gray's Extensible Configuration System +# This file is part of argot - Gray's Extensible Configuration System # Copyright (C) 2007-2016 Sergey Poznyakoff # # Grecs is free software; you can redistribute it and/or modify @@ -15,19 +15,19 @@ # along with Grecs. If not, see . dist_man_MANS = \ - GRECS_SETUP.3\ - grecs_asprintf.3\ - grecs_config.5\ - grecs_error.3\ - grecs_format_locus.3\ - grecs_format_node_path.3\ - grecs_format_node.3\ - grecs_format_value.3\ - grecs_include_path_setup.3\ - grecs_malloc.3\ - grecs_node_free.3\ - grecs_parse.3\ - grecs_stmt_path.5\ - grecs_strdup.3\ - grecs_tree_free.3 + ARGOT_SETUP.3\ + argot_asprintf.3\ + argot_config.5\ + argot_error.3\ + argot_format_locus.3\ + argot_format_node_path.3\ + argot_format_node.3\ + argot_format_value.3\ + argot_include_path_setup.3\ + argot_malloc.3\ + argot_node_free.3\ + argot_parse.3\ + argot_stmt_path.5\ + argot_strdup.3\ + argot_tree_free.3 diff --git a/doc/argot-syntax.texi b/doc/argot-syntax.texi new file mode 100644 index 0000000..db81133 --- /dev/null +++ b/doc/argot-syntax.texi @@ -0,0 +1,404 @@ +@c This file is part of argot - Gray's Extensible Configuration System +@c Copyright (C) 2007-2016 Sergey Poznyakoff +@c +@c Grecs is free software; you can redistribute it and/or modify +@c it under the terms of the GNU General Public License as published by +@c the Free Software Foundation; either version 3, or (at your option) +@c any later version. +@c +@c Grecs is distributed in the hope that it will be useful, +@c but WITHOUT ANY WARRANTY; without even the implied warranty of +@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@c GNU General Public License for more details. +@c +@c You should have received a copy of the GNU General Public License +@c along with Grecs. If not, see . + +@c TIPS: 1. You can @include this file directly into your Texinfo +@c document. It produces a section as its upper level sectioning +@c command. If it is not appropriate, use @raisesections or +@c @lowersections: +@c +@c @raisesections +@c @include argot-syntax.texi +@c @lowersections +@c +@c 2. This texinfo source refers to the following values: +@c +@c PACKAGE - name of the package +@c PROGNAME - name of the program, which uses Grecs (without any +@c Texinfo markup) +@c +@c 3. Some additional/optional parts of the text are commented out, and +@c marked with `@c FIXME:' comments. + + The configuration file consists of statements and comments. + + There are three classes of lexical tokens: keywords, values, and +separators. Blanks, tabs, newlines and comments, collectively called +@dfn{white space} are ignored except as they serve to separate +tokens. Some white space is required to separate otherwise adjacent +keywords and values. + +@menu +* Comments:: +* Pragmatic Comments:: +* Statements:: +* Preprocessor:: +@end menu + +@node Comments +@subsection Comments +@cindex Comments in a configuration file +@cindex single-line comments + @dfn{Comments} may appear anywhere where white space may appear in the +configuration file. There are two kinds of comments: +single-line and multi-line comments. @dfn{Single-line} comments start +with @samp{#} or @samp{//} and continue to the end of the line: + +@smallexample +# This is a comment +// This too is a comment +@end smallexample + +@cindex multi-line comments + @dfn{Multi-line} or @dfn{C-style} comments start with the two +characters @samp{/*} (slash, star) and continue until the first +occurrence of @samp{*/} (star, slash). + + Multi-line comments cannot be nested. However, single-line comments +may well appear within multi-line ones. + +@node Pragmatic Comments +@subsection Pragmatic Comments +@cindex comments, pragmatic +@cindex pragmatic comments + Pragmatic comments are similar to usual single-line comments, +except that they cause some changes in the way the configuration is +parsed. Pragmatic comments begin with a @samp{#} sign and end with the +next physical newline character. + +@table @code +@kwindex #include +@item #include <@var{file}> +@itemx #include @var{file} +Include the contents of the file @var{file}. There are three possible +use cases. + +If @var{file} is an absolute file name, the named file is included. +An error message will be issued if it does not exist. + +If @var{file} contains wildcard characters (@samp{*}, @samp{[}, +@samp{]} or @samp{?}), it is interpreted as shell globbing pattern and +all files matching that pattern are included, in lexicographical +order. If no files match the pattern, the statement is silently +ignored. + +Otherwise, the form with angle brackets searches for file in the +@dfn{include search path}, while the second one looks for it in the +current working directory first, and, if not found there, in the +include search path. If the file is not found, an error message will +be issued. + +The default include search path is: + +@enumerate 1 +@item @file{@var{prefix}/share/@value{PROGNAME}/@value{VERSION}/include} +@item @file{@var{prefix}/share/@value{PROGNAME}/include} +@end enumerate + +@noindent +where @var{prefix} is the installation prefix. + +@c FIXME: Uncomment this, if necessary: +@ignore +New directories can be appended in front of it using @option{-I} +(@option{--include-directory}) command line option +(@pxref{Preprocessor, include-directory}). +} +@end ignore + +@kwindex #include_once +@item #include_once <@var{file}> +@itemx #include_once @var{file} + Same as @code{#include}, except that, if the @var{file} has already +been included, it will not be included again. + +@kwindex #line +@item #line @var{num} +@itemx #line @var{num} "@var{file}" + This line causes the parser to believe, for purposes of error +diagnostics, that the line number of the next source line is given by +@var{num} and the current input file is named by @var{file}. +If the latter is absent, the remembered file name does not change. + +@item # @var{num} "@var{file}" + This is a special form of @code{#line} statement, understood for +compatibility with the @sc{c} preprocessor. +@end table + + In fact, these statements provide a rudimentary preprocessing +features. For more sophisticated ways to modify configuration before +parsing, see @ref{Preprocessor}. + +@node Statements +@subsection Statements +@cindex statements, configuration file +@cindex configuration file statements +@cindex statement, simple +@cindex simple statements + A @dfn{simple statement} consists of a keyword and value +separated by any amount of whitespace. Simple statement is terminated +with a semicolon (@samp{;}). + + The following is a simple statement: + +@smallexample +standalone yes; +pidfile /var/run/slb.pid; +@end smallexample + + A @dfn{keyword} begins with a letter and may contain letters, +decimal digits, underscores (@samp{_}) and dashes (@samp{-}). +Examples of keywords are: @samp{expression}, @samp{output-file}. + + A @dfn{value} can be one of the following: + +@table @asis +@item number + A number is a sequence of decimal digits. + +@item boolean +@cindex boolean value + A boolean value is one of the following: @samp{yes}, @samp{true}, +@samp{t} or @samp{1}, meaning @dfn{true}, and @samp{no}, +@samp{false}, @samp{nil}, @samp{0} meaning @dfn{false}. + +@item unquoted string +@cindex string, unquoted + An unquoted string may contain letters, digits, and any of the +following characters: @samp{_}, @samp{-}, @samp{.}, @samp{/}, +@samp{@@}, @samp{*}, @samp{:}. + +@item quoted string +@cindex quoted string +@cindex string, quoted +@cindex escape sequence + A quoted string is any sequence of characters enclosed in +double-quotes (@samp{"}). A backslash appearing within a quoted +string introduces an @dfn{escape sequence}, which is replaced +with a single character according to the following rules: + +@float Table, backslash-interpretation +@caption{Backslash escapes} +@multitable @columnfractions 0.30 .5 +@item Sequence @tab Replaced with +@item \a @tab Audible bell character (@acronym{ASCII} 7) +@item \b @tab Backspace character (@acronym{ASCII} 8) +@item \f @tab Form-feed character (@acronym{ASCII} 12) +@item \n @tab Newline character (@acronym{ASCII} 10) +@item \r @tab Carriage return character (@acronym{ASCII} 13) +@item \t @tab Horizontal tabulation character (@acronym{ASCII} 9) +@item \v @tab Vertical tabulation character (@acronym{ASCII} 11) +@item \\ @tab A single backslash (@samp{\}) +@item \" @tab A double-quote. +@end multitable +@end float + + In addition, the sequence @samp{\@var{newline}} is removed from +the string. This allows to split long strings over several +physical lines, e.g.: + +@smallexample +@group +"a long string may be\ + split over several lines" +@end group +@end smallexample + + If the character following a backslash is not one of those specified +above, the backslash is ignored and a warning is issued. + +@c FIXME: If argot_parser_options variable has +@c FIXME: ARGOT_OPTION_QUOTED_STRING_CONCAT bit set, then the +@c FIXME: following holds: + +@ignore + Two or more adjacent quoted strings are concatenated, which gives +another way to split long strings over several lines to improve +readability. The following fragment produces the same result as the +example above: + +@smallexample +@group +"a long string may be" +" split over several lines" +@end group +@end smallexample +@end ignore + +@anchor{here-document} +@item Here-document +@cindex here-document + A @dfn{here-document} is a special construct that allows to introduce +strings of text containing embedded newlines. + + The @code{<<@var{word}} construct instructs the parser to read all +the following lines up to the line containing only @var{word}, with +possible trailing blanks. Any lines thus read are concatenated +together into a single string. For example: + +@smallexample +@group +<