summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2016-08-08 05:53:46 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-08-08 05:53:46 (GMT)
commitbd5b7c29986b8106595f35cbe303fc44cf8c4d0d (patch) (side-by-side diff)
tree84b39cc6d228b3642f7105c48162193a05982882
parent102d1b9c1a94548dfa0c498845c77933db6a7738 (diff)
downloadgrecs-argot.tar.gz
grecs-argot.tar.bz2
Rename the projectargot
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.am24
-rw-r--r--NEWS2
-rw-r--r--README.hacking4
-rw-r--r--README.standalone12
-rw-r--r--README.submodule34
-rw-r--r--am/argot.m4 (renamed from am/grecs.m4)196
-rw-r--r--build-aux/getopt.m424
-rw-r--r--build-aux/git2chg.awk2
-rwxr-xr-xbuild-aux/yyrename4
-rw-r--r--configure.ac6
-rw-r--r--doc/ARGOT_SETUP.3 (renamed from doc/GRECS_SETUP.3)38
-rw-r--r--doc/Makefile.am32
-rw-r--r--doc/argot-syntax.texi (renamed from doc/grecs-syntax.texi)8
-rw-r--r--doc/argot_asprintf.3 (renamed from doc/grecs_asprintf.3)28
-rw-r--r--doc/argot_config.5 (renamed from doc/grecs_config.5)20
-rw-r--r--doc/argot_error.3 (renamed from doc/grecs_error.3)48
-rw-r--r--doc/argot_format_locus.3 (renamed from doc/grecs_format_locus.3)32
-rw-r--r--doc/argot_format_node.3 (renamed from doc/grecs_format_node.3)56
-rw-r--r--doc/argot_format_node_path.3 (renamed from doc/grecs_format_node_path.3)36
-rw-r--r--doc/argot_format_value.3 (renamed from doc/grecs_format_value.3)30
-rw-r--r--doc/argot_include_path_setup.3 (renamed from doc/grecs_include_path_setup.3)26
-rw-r--r--doc/argot_malloc.3 (renamed from doc/grecs_malloc.3)72
-rw-r--r--doc/argot_node_free.3 (renamed from doc/grecs_node_free.3)20
-rw-r--r--doc/argot_parse.3 (renamed from doc/grecs_parse.3)92
-rw-r--r--doc/argot_stmt_path.5 (renamed from doc/grecs_stmt_path.5)12
-rw-r--r--doc/argot_strdup.3 (renamed from doc/grecs_strdup.3)24
-rw-r--r--doc/argot_tree_free.3 (renamed from doc/grecs_tree_free.3)20
-rw-r--r--doc/tmpl.310
-rw-r--r--doc/wordsplit.36
-rw-r--r--include/Makefile.am22
-rw-r--r--include/argot.h (renamed from include/grecs.h)44
-rw-r--r--include/argot/.gitignore (renamed from include/grecs/.gitignore)0
-rw-r--r--include/argot/Makefile.am43
-rw-r--r--include/argot/doc.h (renamed from include/grecs/doc.h)16
-rw-r--r--include/argot/error.h (renamed from include/grecs/error.h)22
-rw-r--r--include/argot/format.h62
-rw-r--r--include/argot/json.h (renamed from include/grecs/json.h)10
-rw-r--r--include/argot/lex.h52
-rw-r--r--include/argot/list.h54
-rw-r--r--include/argot/locus.h (renamed from include/grecs/locus.h)22
-rw-r--r--include/argot/mem.h (renamed from include/grecs/mem.h)28
-rw-r--r--include/argot/node.h62
-rw-r--r--include/argot/opt.h (renamed from include/grecs/opt.h)20
-rw-r--r--include/argot/parser.h56
-rw-r--r--include/argot/preproc.h46
-rw-r--r--include/argot/sockaddr.h66
-rw-r--r--include/argot/symtab.h53
-rw-r--r--include/argot/table.h102
-rw-r--r--include/argot/tree.h71
-rw-r--r--include/argot/txtacc.h (renamed from include/grecs/txtacc.h)28
-rw-r--r--include/argot/types.h.in (renamed from include/grecs/types.h.in)12
-rw-r--r--include/argot/util.h (renamed from include/grecs/util.h)12
-rw-r--r--include/argot/value.h (renamed from include/grecs/value.h)40
-rw-r--r--include/argot/version.h (renamed from include/grecs/version.h)22
-rw-r--r--include/grecs/Makefile.am43
-rw-r--r--include/grecs/format.h62
-rw-r--r--include/grecs/lex.h52
-rw-r--r--include/grecs/list.h54
-rw-r--r--include/grecs/node.h62
-rw-r--r--include/grecs/parser.h56
-rw-r--r--include/grecs/preproc.h46
-rw-r--r--include/grecs/sockaddr.h66
-rw-r--r--include/grecs/symtab.h53
-rw-r--r--include/grecs/table.h102
-rw-r--r--include/grecs/tree.h71
-rw-r--r--src/.gitignore10
-rw-r--r--src/Make-inst.am8
-rw-r--r--src/Make-shared.am6
-rw-r--r--src/Make-static.am6
-rw-r--r--src/Make.am70
-rw-r--r--src/argot-gram.y (renamed from src/grecs-gram.y)98
-rw-r--r--src/argot-lex.l (renamed from src/grecs-lex.l)160
-rw-r--r--src/asprintf.c10
-rw-r--r--src/bind-gram.y152
-rw-r--r--src/bind-lex.l132
-rw-r--r--src/cidr.c62
-rw-r--r--src/dhcpd-gram.y160
-rw-r--r--src/dhcpd-lex.l154
-rw-r--r--src/diag.c36
-rw-r--r--src/format.c204
-rw-r--r--src/git-parser.c150
-rw-r--r--src/ipstr.c16
-rw-r--r--src/join.c36
-rw-r--r--src/json-gram.y76
-rw-r--r--src/json-lex.l22
-rw-r--r--src/jsonfmt.c18
-rw-r--r--src/libargot.m4 (renamed from src/libgrecs.m4)32
-rw-r--r--src/lineacc.c46
-rw-r--r--src/list.c84
-rw-r--r--src/lookup.c252
-rw-r--r--src/mem.c48
-rw-r--r--src/meta1-gram.y80
-rw-r--r--src/meta1-lex.l56
-rw-r--r--src/opthelp.c52
-rw-r--r--src/parser.c54
-rw-r--r--src/parsertab.c26
-rw-r--r--src/path-parser.c82
-rw-r--r--src/pp-setup2
-rw-r--r--src/preproc.c258
-rw-r--r--src/sockaddr.c96
-rw-r--r--src/sort.c36
-rw-r--r--src/symtab.c92
-rw-r--r--src/text.c32
-rw-r--r--src/tree.c632
-rw-r--r--src/txtacc.c124
-rw-r--r--src/version.c100
-rw-r--r--src/yytrans8
-rw-r--r--tests/Makefile.am26
-rw-r--r--tests/argot00.at (renamed from tests/grecs00.at)8
-rw-r--r--tests/bind00.at4
-rw-r--r--tests/cfhelp.at2
-rw-r--r--tests/distck.at2
-rw-r--r--tests/distck.c12
-rw-r--r--tests/empty.at12
-rw-r--r--tests/enum.at2
-rw-r--r--tests/format00.at2
-rw-r--r--tests/format01.at2
-rw-r--r--tests/format02.at2
-rw-r--r--tests/gcf1.conf2
-rw-r--r--tests/gcfenum.c24
-rw-r--r--tests/gcffmt.c64
-rw-r--r--tests/gcfpeek.c44
-rw-r--r--tests/gcfset.c136
-rw-r--r--tests/gcfver.c14
-rw-r--r--tests/git.conf2
-rw-r--r--tests/glob00.at2
-rw-r--r--tests/glob01.at2
-rw-r--r--tests/glob02.at2
-rw-r--r--tests/glob03.at2
-rw-r--r--tests/glob04.at2
-rw-r--r--tests/glob05.at2
-rw-r--r--tests/incl00.at2
-rw-r--r--tests/incl01.at2
-rw-r--r--tests/incl02.at2
-rw-r--r--tests/incl03.at2
-rw-r--r--tests/join.at2
-rw-r--r--tests/json.c10
-rw-r--r--tests/locus-bind.at2
-rw-r--r--tests/locus-git.at8
-rw-r--r--tests/locus-meta1.at2
-rw-r--r--tests/locus00.at2
-rw-r--r--tests/locus01.at2
-rw-r--r--tests/locus02.at2
-rw-r--r--tests/parser-bind.at2
-rw-r--r--tests/parser-dhcpd.at2
-rw-r--r--tests/parser-git.at4
-rw-r--r--tests/parser-meta1.at2
-rw-r--r--tests/path-locus.at2
-rw-r--r--tests/peek00.at2
-rw-r--r--tests/peek01.at2
-rw-r--r--tests/peek02.at2
-rw-r--r--tests/peek03.at2
-rw-r--r--tests/reduce00.at4
-rw-r--r--tests/reduce01.at4
-rw-r--r--tests/reduce02.at4
-rw-r--r--tests/reduce03.at4
-rw-r--r--tests/set.at2
-rw-r--r--tests/sort00.at4
-rw-r--r--tests/sort01.at4
-rw-r--r--tests/stradj.at2
-rw-r--r--tests/strcat.at2
-rw-r--r--tests/testsuite.at10
-rw-r--r--tests/vercmp.at2
-rw-r--r--tests/wordsplit.at2
-rw-r--r--tests/wsp.c6
165 files changed, 3404 insertions, 3404 deletions
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 <http://www.gnu.org/licenses/>.
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 <gray+grecs@gnu.org.ua>
+Please send libargot bug reports to <gray+argot@gnu.org.ua>
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 <gray+grecs@gnu.org.ua>.
+Send bug reports to <gray+argot@gnu.org.ua>.
* 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 <gray+grecs@gnu.org.ua>.
+Send bug reports to <gray+argot@gnu.org.ua>.
* 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 <gray+grecs@gnu.org.ua>.
+Send bug reports to <gray+argot@gnu.org.ua>.
* Copyright information:
diff --git a/am/grecs.m4 b/am/argot.m4
index 60244a1..f5a21aa 100644
--- a/am/grecs.m4
+++ b/am/argot.m4
@@ -1,4 +1,4 @@
-# This file is part of grecs - Gray's Extensible Configuration System -*- autoconf -*-
+# 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
@@ -14,43 +14,43 @@
# You should have received a copy of the GNU General Public License
# along with Grex. If not, see <http://www.gnu.org/licenses/>.
-# _GRECS_MANGLE_OPTION(NAME)
+# _ARGOT_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_]], [_])])
+# with underscores, and prepend the _ARGOT_OPTION_ suffix to it.
+AC_DEFUN([_ARGOT_MANGLE_OPTION],
+[[_ARGOT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-# _GRECS_SET_OPTION(NAME)
+# _ARGOT_SET_OPTION(NAME)
# ----------------------
# Set option NAME.
-AC_DEFUN([_GRECS_SET_OPTION],
-[m4_define(_GRECS_MANGLE_OPTION([$1]), 1)])
+AC_DEFUN([_ARGOT_SET_OPTION],
+[m4_define(_ARGOT_MANGLE_OPTION([$1]), 1)])
-# _GRECS_IF_OPTION_SET(NAME,IF-SET,IF-NOT-SET)
+# _ARGOT_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])])
+AC_DEFUN([_ARGOT_IF_OPTION_SET],
+[m4_ifset(_ARGOT_MANGLE_OPTION([$1]),[$2],[$3])])
-# _GRECS_OPTION_SWITCH(NAME1,IF-SET1,[NAME2,IF-SET2,[...]],[IF-NOT-SET])
+# _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([_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($@)))])])])
+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($@)))])])])
-# _GRECS_SET_OPTIONS(OPTIONS)
+# _ARGOT_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)])])
+AC_DEFUN([_ARGOT_SET_OPTIONS],
+[m4_foreach_w([_ARGOT_Option], [$1], [_ARGOT_SET_OPTION(_ARGOT_Option)])])
-# GRECS_SETUP([dir],[OPTIONS],[pp-setup-file])
-# dir - Directory in the source tree where grecs has been cloned.
+# 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.
@@ -60,13 +60,13 @@ AC_DEFUN([_GRECS_SET_OPTIONS],
# 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.
+# 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
-# GRECS_INCLUDE_DIR.
+# ARGOT_INCLUDE_DIR.
# tree-api Use alternative signature of callback functions,
-# passing a pointer to grecs_node_t as an argument,
+# 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.
@@ -79,19 +79,19 @@ AC_DEFUN([_GRECS_SET_OPTIONS],
# 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_DEFUN([ARGOT_SETUP],[
+ m4_pushdef([argotdir],m4_if($1,[.],,$1,,[argot/],$1/))
AC_PROG_YACC
AM_PROG_LEX
AC_HEADER_SYS_WAIT
- AC_SUBST([GRECS_SUBDIR],m4_if($1,,grecs,$1))
- _GRECS_SET_OPTIONS([$2])
+ AC_SUBST([ARGOT_SUBDIR],m4_if($1,,argot,$1))
+ _ARGOT_SET_OPTIONS([$2])
# **********************
# Preprocessor
# **********************
- _GRECS_IF_OPTION_SET([no-preproc],
+ _ARGOT_IF_OPTION_SET([no-preproc],
[use_ext_pp=no],
[AC_ARG_WITH([preprocessor],
AC_HELP_STRING([--without-preprocessor],
@@ -119,12 +119,12 @@ AC_DEFUN([GRECS_SETUP],[
AC_PATH_PROG(PPBIN, $DEFAULT_PREPROCESSOR)
if test -n "$PPBIN"; then
DEFAULT_PREPROCESSOR="$PPBIN $PREPROC_OPTIONS"
- _GRECS_IF_OPTION_SET([std-pp-setup],
+ _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
- _GRECS_IF_OPTION_SET([pp-setup-option],
+ _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]),
@@ -148,98 +148,98 @@ AC_DEFUN([GRECS_SETUP],[
else
DEFAULT_PREPROCESSOR=NULL
fi
- _GRECS_IF_OPTION_SET([tests],
- [m4_pushdef([TESTDIR],grecsdir[tests])
+ _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])
- GRECS_TESTDIR=tests
+ ARGOT_TESTDIR=tests
])
- _GRECS_IF_OPTION_SET([getopt],[
+ _ARGOT_IF_OPTION_SET([getopt],[
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_FUNCS([sysconf getdtablesize getopt_long])
- GRECS_BUILD_AUX="build-aux/getopt.m4"
+ ARGOT_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],
+ _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([GRECS_COND_BIND_PARSER],
- _GRECS_OPTION_SWITCH([parser-bind],[true],
+ AM_CONDITIONAL([ARGOT_COND_BIND_PARSER],
+ _ARGOT_OPTION_SWITCH([parser-bind],[true],
[all-parsers],[true],
[false]))
- AM_CONDITIONAL([GRECS_COND_DHCPD_PARSER],
- _GRECS_OPTION_SWITCH([parser-dhcpd],[true],
+ AM_CONDITIONAL([ARGOT_COND_DHCPD_PARSER],
+ _ARGOT_OPTION_SWITCH([parser-dhcpd],[true],
[all-parsers],[true],
[false]))
- AM_CONDITIONAL([GRECS_COND_GIT_PARSER],
- _GRECS_OPTION_SWITCH([parser-git],[true],
+ AM_CONDITIONAL([ARGOT_COND_GIT_PARSER],
+ _ARGOT_OPTION_SWITCH([parser-git],[true],
[all-parsers],[true],
[false]))
- AM_CONDITIONAL([GRECS_COND_INSTALLHEADERS],
- _GRECS_IF_OPTION_SET([install-headers],[true],[false]))
+ AM_CONDITIONAL([ARGOT_COND_INSTALLHEADERS],
+ _ARGOT_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]))
+ 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([GRECS_SOCKADDR_LIST])
- _GRECS_IF_OPTION_SET([sockaddr-list],[GRECS_SOCKADDR_LIST=1],
- [GRECS_SOCKADDR_LIST=0])
+ AC_SUBST([ARGOT_SOCKADDR_LIST])
+ _ARGOT_IF_OPTION_SET([sockaddr-list],[ARGOT_SOCKADDR_LIST=1],
+ [ARGOT_SOCKADDR_LIST=0])
- AC_SUBST([GRECS_TREE_API])
- _GRECS_IF_OPTION_SET([tree-api],[GRECS_TREE_API=1],[GRECS_TREE_API=0])
+ AC_SUBST([ARGOT_TREE_API])
+ _ARGOT_IF_OPTION_SET([tree-api],[ARGOT_TREE_API=1],[ARGOT_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)'])
+ 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)'])
- _GRECS_OPTION_SWITCH([install],[
+ _ARGOT_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])
+ 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
- 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])
+ 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])
],[
- 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])
+ 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([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])
+ 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(grecsdir[Makefile]
- grecsdir[include/Makefile]
- grecsdir[include/grecs/Makefile]
- grecsdir[include/grecs/types.h]:grecsdir[include/grecs/types.h.in])
- m4_popdef([grecsdir])
+ 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/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([<OPTNODE>],[<do {
- struct grecs_node *node = grecs_node_from_path($1, $2);
+ struct argot_node *node = argot_node_from_path($1, $2);
if (!cmdline_tree)
cmdline_tree = node;
else
- grecs_node_bind(cmdline_tree, node, 0);
+ argot_node_bind(cmdline_tree, node, 0);
} while(0)
>])
@@ -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([<copyright_holder>],dnl
PACKAGE_URL, /* url */
NULL /* epilogue */
};
-static struct grecs_node *cmdline_tree;
+static struct argot_node *cmdline_tree;
_getopt_if_option_set([<program_version>],dnl
[<const char *_getopt_if_option_null(program_version,program_version,[<_getopt_get_option(program_version)>]) = $2 " (" PACKAGE_NAME ") " PACKAGE_VERSION;
@@ -374,20 +374,20 @@ _getopt_if_option_set([<gnu>],[<
GROUP([<Other options>])
OPTION([<help>],h,,[<Give this help list>])
BEGIN
- grecs_print_help(&proginfo);
+ argot_print_help(&proginfo);
exit(0);
END
_getopt_if_option_set([<nousage>],,[<
OPTION([<usage>],,,[<Give a short usage message>])
BEGIN
- grecs_print_usage(&proginfo);
+ argot_print_usage(&proginfo);
exit(0);
END>])
_getopt_if_option_set([<noversion>],,[<
OPTION([<version>],V,,[<Print program version>])
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([<nostdincl>],,[<
#endif
#include <unistd.h>
>])
-#include <grecs.h>
-#include <grecs/opt.h>
+#include <argot.h>
+#include <argot/opt.h>
/* 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 <http://www.gnu.org/licenses/>.
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/GRECS_SETUP.3 b/doc/ARGOT_SETUP.3
index 8aa086a..3c18d1e 100644
--- a/doc/GRECS_SETUP.3
+++ b/doc/ARGOT_SETUP.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,14 +14,14 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_SETUP 3 "August 13, 2012" "GRECS" "Grecs User Reference"
+.TH ARGOT_SETUP 3 "August 13, 2012" "ARGOT" "Grecs User Reference"
.SH NAME
-GRECS_SETUP \- Initialize \fBgrecs\fR submodule.
+ARGOT_SETUP \- Initialize \fBargot\fR submodule.
.SH SYNOPSIS
-.BI "GRECS_SETUP(" "dir" ", " "options" ", " "pp-setup-file" )
+.BI "ARGOT_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
+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.
@@ -29,15 +29,15 @@ All arguments are optional.
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.
+where \fBargot\fR has been cloned. If omitted, \fBargot\fR is assumed.
.sp
-For example, if \fBgrecs\fR was cloned using the following command:
+For example, if \fBargot\fR was cloned using the following command:
.sp
.nf
- git clone ssh://git.gnu.org.ua/gitroot/grecs.git lib/grecs
+ git clone ssh://git.gnu.org.ua/gitroot/argot.git lib/argot
.fi
.sp
-then the \fIdir\fR argument must be \fBlib/grecs\fR.
+then the \fIdir\fR argument must be \fBlib/argot\fR.
.PP
The
.I options
@@ -63,19 +63,19 @@ Build the parser for MeTA1 configuration files.
Disable the use of preprocessor.
.TP
.B install
-Create and install shared library \fBlibgrecs.so\fR. Install the
+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 grecs into another
+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 \fBGRECS_INCLUDE_DIR\fR to the name of that directory.
+the variable \fBARGOT_INCLUDE_DIR\fR to the name of that directory.
.TP
.B std-pp-setup
Install the standard \fBpp-setup\fR file.
@@ -98,7 +98,7 @@ 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
+Add \fBdoc/argot-syntax.texi\fR file to the distributed tarball. Use this
if your texinfo documentation includes that file.
.PP
The
@@ -117,17 +117,17 @@ parameter are supplied, no preprocessor setup file is installed.
.SS "Default setup"
.RS 4
.nf
-GRECS_SETUP
+ARGOT_SETUP
.fi
.RE
.SS "Complex setup"
-The library sources are in \fBlib/grecs\fR. Configure the testsuite
+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
-GRECS_SETUP(lib/grecs, [tests getopt], [$(top_srcdir)/src/pp-setup])
+ARGOT_SETUP(lib/argot, [tests getopt], [$(top_srcdir)/src/pp-setup])
.RE
.SH "SEE ALSO"
.BR getopt.m4 (5),
@@ -135,11 +135,11 @@ GRECS_SETUP(lib/grecs, [tests getopt], [$(top_srcdir)/src/pp-setup])
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
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 <http://www.gnu.org/licenses/>.
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/grecs-syntax.texi b/doc/argot-syntax.texi
index 2ddedea..db81133 100644
--- a/doc/grecs-syntax.texi
+++ b/doc/argot-syntax.texi
@@ -1,4 +1,4 @@
-@c This file is part of grecs - Gray's Extensible Configuration System
+@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
@@ -20,7 +20,7 @@
@c @lowersections:
@c
@c @raisesections
-@c @include grecs-syntax.texi
+@c @include argot-syntax.texi
@c @lowersections
@c
@c 2. This texinfo source refers to the following values:
@@ -219,8 +219,8 @@ physical lines, e.g.:
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 grecs_parser_options variable has
-@c FIXME: GRECS_OPTION_QUOTED_STRING_CONCAT bit set, then the
+@c FIXME: If argot_parser_options variable has
+@c FIXME: ARGOT_OPTION_QUOTED_STRING_CONCAT bit set, then the
@c FIXME: following holds:
@ignore
diff --git a/doc/grecs_asprintf.3 b/doc/argot_asprintf.3
index 25279be..fa86190 100644
--- a/doc/grecs_asprintf.3
+++ b/doc/argot_asprintf.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,25 +14,25 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_ASPRINTF 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_ASPRINTF 3 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_asprintf, grecs_vasprintf \- print to allocated string
+argot_asprintf, argot_vasprintf \- print to allocated string
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "int grecs_vasprintf(char " "**pbuf" ", size_t " "*psize" \
+.BI "int argot_vasprintf(char " "**pbuf" ", size_t " "*psize" \
", const char " "*format" ", "
.ti +17
.BI "va_list " "ap" );
.br
-.BI "int grecs_asprintf(char " "**pbuf" ", size_t " "*psize" \
+.BI "int argot_asprintf(char " "**pbuf" ", size_t " "*psize" \
", const char *" "format" ", ...);"
.SH DESCRIPTION
The functions
-.BI grecs_asprintf ()
+.BI argot_asprintf ()
and
-.BI grecs_vasprintf ()
+.BI argot_vasprintf ()
are analogs of
.BR sprintf (3)
and
@@ -52,23 +52,23 @@ In both cases, if the buffer has been reallocated, on return
\fBpbuf\fR will contain its new address and \fBpsize\fR its new size.
.PP
For initial allocation,
-.BR grecs_malloc (3)
+.BR argot_malloc (3)
is used. To reallocate memory, both functions use
-.BR grecs_realloc (3).
+.BR argot_realloc (3).
.SH RETURN VALUE
None. If memory allocation fails, a diagnostics is output and the
program is terminated.
.SH "SEE ALSO"
-.BR grecs_malloc (3),
-.BR grecs_realloc (3).
+.BR argot_malloc (3),
+.BR argot_realloc (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_config.5 b/doc/argot_config.5
index 5fdaed4..abd6420 100644
--- a/doc/grecs_config.5
+++ b/doc/argot_config.5
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_CONFIG 3 "December 25, 2014" "GRECS" "Grecs User Reference"
+.TH ARGOT_CONFIG 3 "December 25, 2014" "ARGOT" "Grecs User Reference"
.SH NAME
\fBGrecs\fR configuration file syntax
.SH DESCRIPTION
@@ -94,11 +94,11 @@ the program which uses the configuration file, and \fIVERSION\fR for
its version number.
.sp
The include search path can be modified using the
-.BI grecs_include_path_setup ()
+.BI argot_include_path_setup ()
and
-.BI grecs_include_path_setup_v ()
+.BI argot_include_path_setup_v ()
functions. Refer to
-.BR grecs_include_path_setup (3),
+.BR argot_include_path_setup (3),
for a detailed discussion.
.TP
.BR "#include_once <" "file" >
@@ -323,17 +323,17 @@ advantage that it works with non-GNU m4 implementations as
well.
.SH "SEE ALSO"
.BR m4 (1),
-.BR grecs_parse (3),
-.BR grecs_include_path_setup (3),
-.BR grecs_tree_process (3).
+.BR argot_parse (3),
+.BR argot_include_path_setup (3),
+.BR argot_tree_process (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_error.3 b/doc/argot_error.3
index a020d36..ab623dc 100644
--- a/doc/grecs_error.3
+++ b/doc/argot_error.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,29 +14,29 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_ERROR 3 "July 1, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_ERROR 3 "July 1, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_error, grecs_warning \- grecs error reporting functions
+argot_error, argot_warning \- argot error reporting functions
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_error(grecs_locus_t " "*locus" ", int " "errnum" ", "
+.BI "void argot_error(argot_locus_t " "*locus" ", int " "errnum" ", "
.ti +17
.BI "const char " "*format" ", ...);"
.br
-.BI "void grecs_warning(grecs_locus_t " "*locus" ", int " "errnum" ", "
+.BI "void argot_warning(argot_locus_t " "*locus" ", int " "errnum" ", "
.ti +17
.BI "const char " "*format" ", ...);"
.sp
-.BI "void (*grecs_print_diag_fun)(grecs_locus_t " "*locus" ", "
+.BI "void (*argot_print_diag_fun)(argot_locus_t " "*locus" ", "
.ti +17
.BI "int " "err" ", int " "errnum" ", const char " "*msg" );
.sp
-.B extern int grecs_error_count;
+.B extern int argot_error_count;
.SH DESCRIPTION
-.BI grecs_error ()
-is a error reporting function for \fBgrecs\fR library. It flushes
+.BI argot_error ()
+is a error reporting function for \fBargot\fR library. It flushes
stdout, and outputs to stderr the file name and line number, as
supplied by the
.BI locus
@@ -52,22 +52,22 @@ If \fIlocus\fR is \fBNULL\fR, it is ignored and no file location is
printed.
.PP
Each call to
-.BI grecs_error ()
+.BI argot_error ()
increments the value of the
-.BI grecs_error_count
+.BI argot_error_count
global variable.
The
-.BI grecs_warning ()
+.BI argot_warning ()
function works the same as
-.BI grecs_error (),
+.BI argot_error (),
except that it outputs, before the formatted message and after the
file location, the word \fBwarning\fR, followed by a semicolon
and a space character. It does not modify the
-.BI grecs_error_count
+.BI argot_error_count
variable.
.PP
Calling program can modify the behavior of both functions by setting
-.BI grecs_print_diag_fun
+.BI argot_print_diag_fun
to the address of a custom error-reporting function. This function is
called with the following arguments:
.TP
@@ -86,21 +86,21 @@ System error code, or \fB0\fR, if no system error occurred.
.I msg
Formatted message.
.PP
-The \fBgrecs_locus_t\fR structure consists of two \fBpoints\fR, each
+The \fBargot_locus_t\fR structure consists of two \fBpoints\fR, each
point describing the beginning and the end of the input fragment in
question:
.sp
.nf
.in +5
-struct grecs_locus_point {
+struct argot_locus_point {
char *file;
unsigned line;
unsigned col;
};
typedef struct {
- struct grecs_locus_point beg;
- struct grecs_locus_point end;
-} grecs_locus_t;
+ struct argot_locus_point beg;
+ struct argot_locus_point end;
+} argot_locus_t;
.in
.fi
.PP
@@ -109,7 +109,7 @@ member contains the input line number and the \fBcol\fR member
contains the column number. Both lines and columns are numbered from
1.
.PP
-On output, the \fBgrecs_locus_t\fR structure is formatted as follows:
+On output, the \fBargot_locus_t\fR structure is formatted as follows:
.sp
.nf
.in +5
@@ -160,11 +160,11 @@ None.
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_format_locus.3 b/doc/argot_format_locus.3
index 5ab3542..52bfc3d 100644
--- a/doc/grecs_format_locus.3
+++ b/doc/argot_format_locus.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,27 +14,27 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_FORMAT_LOCUS 3 "May 19, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_FORMAT_LOCUS 3 "May 19, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_format_locus \- format and output source file location
+argot_format_locus \- format and output source file location
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_format_locus(grecs_locus_t " "*locus" ","
+.BI "void argot_format_locus(argot_locus_t " "*locus" ","
.ti +17
-.BI "struct grecs_format_closure " "*clos" );
+.BI "struct argot_format_closure " "*clos" );
.sp
-.BI "void grecs_print_locus(grecs_locus_t " "*locus" ", FILE " "*fp" );
+.BI "void argot_print_locus(argot_locus_t " "*locus" ", FILE " "*fp" );
.SH DESCRIPTION
-\fBgrecs_print_locus\fR formats the location from \fIlocus\fR in the
+\fBargot_print_locus\fR formats the location from \fIlocus\fR in the
human-readable form and outputs it using the format closure
\fIclos\fR. The closure is defined as:
.sp
.nf
.in +5
-struct grecs_format_closure
+struct argot_format_closure
{
int (*fmtfun)(const char *str, void *data);
void *data;
@@ -47,7 +47,7 @@ be called one or more times. On each invocation, it is supplied with
the string to be output as its first argument, and pointer to
\fBdata\fR as the second one.
.PP
-\fBgrecs_print_locus\fR is an alternative interface, which formats the
+\fBargot_print_locus\fR is an alternative interface, which formats the
location from \fIlocus\fR in the human-readable form and outputs it to
file \fBfp\fR.
.PP
@@ -60,21 +60,21 @@ doing anything.
None.
.SH NOTES
This are auxiliary functions used by
-.BR grecs_format_node (3)
+.BR argot_format_node (3)
and
-.BR grecs_print_node (3),
+.BR argot_print_node (3),
correspondingly. They are is seldom needed in user programs.
.SH "SEE ALSO"
-.BR grecs_format_node (3),
-.BR grecs_print_node (3).
+.BR argot_format_node (3),
+.BR argot_print_node (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_format_node.3 b/doc/argot_format_node.3
index bf2b8db..3e0a9fb 100644
--- a/doc/grecs_format_node.3
+++ b/doc/argot_format_node.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,26 +14,26 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_FORMAT_NODE 3 "May 19, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_FORMAT_NODE 3 "May 19, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_format_node \- format and print a single node from a syntax tree
+argot_format_node \- format and print a single node from a syntax tree
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_format_node(struct grecs_node *" "node" ", int " \
+.BI "void argot_format_node(struct argot_node *" "node" ", int " \
"flags" ","
.ti +17
-.BI "struct grecs_format_closure " "*clos" );
+.BI "struct argot_format_closure " "*clos" );
.sp
-.BI "void grecs_print_node(struct grecs_node *" "node" ", int " \
+.BI "void argot_print_node(struct argot_node *" "node" ", int " \
"flags" ", FILE " "*fp" );
.SH DESCRIPTION
-\fBgrecs_format_node\fR formats the contents of a parse tree node
+\fBargot_format_node\fR formats the contents of a parse tree node
\fInode\fR, according to formatting options, given by \fIflags\fR. The
formatter closure \fIclos\fR is used for actual output.
.PP
-\fBgrecs_print_node\fR is an alternative entry point, which formats
+\fBargot_print_node\fR is an alternative entry point, which formats
the node to the given file.
.PP
The \fBflags\fR argument is a bitwise \fBOR\fR of one or more of the
@@ -43,49 +43,49 @@ following options:
This character will be used as pathname component separator, instead
of the default dot.
.TP
-.B GRECS_NODE_FLAG_LOCUS
+.B ARGOT_NODE_FLAG_LOCUS
Print the source location. The location is printed as the file name,
followed by a semicolon, followed by the line number and another
semicolon. Locations are separated from the rest of output by a single
space character.
.TP
-.B GRECS_NODE_FLAG_PATH
+.B ARGOT_NODE_FLAG_PATH
Print the \fInode path\fR. See
-.BR grecs_stmt_path (5),
+.BR argot_stmt_path (5),
for a description. If printed, the path is separated from the
remaining output on its right by a semicolon and a space.
.TP
-.B GRECS_NODE_FLAG_VALUE
+.B ARGOT_NODE_FLAG_VALUE
Print the node value.
.TP
-.B GRECS_NODE_FLAG_QUOTE
+.B ARGOT_NODE_FLAG_QUOTE
Always quote the value. By default, the value will be quoted only
when necessary, i.e. if it contains white space, quotes or special
characters. This option is useful only together with
-\fBGRECS_NODE_FLAG_VALUE\fR.
+\fBARGOT_NODE_FLAG_VALUE\fR.
.TP
-.B GRECS_NODE_FLAG_NOQUOTE
-Never quote values. If both \fBGRECS_NODE_FLAG_QUOTE\fR and
-\fBGRECS_NODE_FLAG_NOQUOTE\fR are given, the former takes precedence
+.B ARGOT_NODE_FLAG_NOQUOTE
+Never quote values. If both \fBARGOT_NODE_FLAG_QUOTE\fR and
+\fBARGOT_NODE_FLAG_NOQUOTE\fR are given, the former takes precedence
over the latter.
.TP
-.B GRECS_NODE_FLAG_QUOTE_HEX
+.B ARGOT_NODE_FLAG_QUOTE_HEX
Print non-printable characters as C hex escapets. This option is
-ignored if \fBGRECS_NODE_FLAG_NOQUOTE\fR is set.
+ignored if \fBARGOT_NODE_FLAG_NOQUOTE\fR is set.
.TP
-.B GRECS_NODE_FLAG_DEFAULT
+.B ARGOT_NODE_FLAG_DEFAULT
Same as
.sp
.nf
-GRECS_NODE_FLAG_PATH|GRECS_NODE_FLAG_VALUE|GRECS_NODE_FLAG_QUOTE
+ARGOT_NODE_FLAG_PATH|ARGOT_NODE_FLAG_VALUE|ARGOT_NODE_FLAG_QUOTE
.PP
-If \fBflag\fR is 0, \fBGRECS_NODE_FLAG_DEFAULT\fR is assumed.
+If \fBflag\fR is 0, \fBARGOT_NODE_FLAG_DEFAULT\fR is assumed.
.SH CLOSURE
The format closure is defined as:
.sp
.nf
.in +5
-struct grecs_format_closure
+struct argot_format_closure
{
int (*fmtfun)(const char *str, void *data);
void *data;
@@ -100,16 +100,16 @@ the string to be output as its first argument, and pointer to
.SH "RETURN VALUE"
None.
.SH "SEE ALSO"
-.BR grecs_config (5),
-.BR grecs_stmt_path (5).
+.BR argot_config (5),
+.BR argot_stmt_path (5).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_format_node_path.3 b/doc/argot_format_node_path.3
index 0d4fa85..e85e2bb 100644
--- a/doc/grecs_format_node_path.3
+++ b/doc/argot_format_node_path.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,55 +14,55 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_FORMAT_NODE_PATH 3 "May 19, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_FORMAT_NODE_PATH 3 "May 19, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_format_node_path \- format and output statement pathname for the
+argot_format_node_path \- format and output statement pathname for the
node
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_format_node_path(struct grecs_node " "*node" ", int " \
+.BI "void argot_format_node_path(struct argot_node " "*node" ", int " \
"flag" ", "
.ti +17
-.BI "struct grecs_format_closure " "*clos" );
+.BI "struct argot_format_closure " "*clos" );
.sp
-.BI "void grecs_print_node_path(struct grecs_node " "*node" ", int " \
+.BI "void argot_print_node_path(struct argot_node " "*node" ", int " \
"flag" ", FILE " "*fp" );
.SH DESCRIPTION
-\fBgrecs_format_node_path\fR computes the \fIstatement pathname\fR for
+\fBargot_format_node_path\fR computes the \fIstatement pathname\fR for
the \fInode\fR, and outputs it using the closure \fIclos\fR. See
section \fBCLOSURE\fR in
-.BR grecs_format_node (3),
-for a description of struct grecs_format_closure.
+.BR argot_format_node (3),
+for a description of struct argot_format_closure.
.PP
-\fBgrecs_print_node_path\fR is an alternative interface that outputs
+\fBargot_print_node_path\fR is an alternative interface that outputs
the formatted data to the file.
.PP
The \fIflags\fR argument describes what character to use as a pathname
component separator and how to format the statement tag, if \fInode\fR
refers to a block statement. See
-.BR grecs_format_node (3),
+.BR argot_format_node (3),
for a discussion of available flags.
.SH "RETURN VALUE"
None.
.SH NOTES
This are auxiliary functions used by
-.BR grecs_format_node (3)
+.BR argot_format_node (3)
and
-.BR grecs_print_node (3),
+.BR argot_print_node (3),
correspondingly. They are is seldom needed in user programs.
.SH "SEE ALSO"
-.BR grecs_format_node (3),
-.BR grecs_stmt_path (5).
+.BR argot_format_node (3),
+.BR argot_stmt_path (5).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_format_value.3 b/doc/argot_format_value.3
index bfd90a2..73a667c 100644
--- a/doc/grecs_format_value.3
+++ b/doc/argot_format_value.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,47 +14,47 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_FORMAT_VALUE 3 "May 19, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_FORMAT_VALUE 3 "May 19, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_format_value \- format and output a configuration value
+argot_format_value \- format and output a configuration value
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_format_value(struct grecs_value *" "val" ", int " \
+.BI "void argot_format_value(struct argot_value *" "val" ", int " \
"flags" ", "
.ti +17
-.BI "struct grecs_format_closure " "*clos" );
+.BI "struct argot_format_closure " "*clos" );
.sp
-.BI "void grecs_print_value(struct grecs_value *" "val" ", int " \
+.BI "void argot_print_value(struct argot_value *" "val" ", int " \
"flags" ", FILE " "*fp" );
.SH DESCRIPTION
-\fBgrecs_format_value\fR formats the value \fIval\fR and outputs it
+\fBargot_format_value\fR formats the value \fIval\fR and outputs it
using the formatting closure \fIclos\fR. The \fIflags\fR argument
describes how to format the value. See
-.BR grecs_format_node (3),
+.BR argot_format_node (3),
for a discussion of available flags.
.PP
-\fBgrecs_print_value\fR is an alternative interface that outputs the
+\fBargot_print_value\fR is an alternative interface that outputs the
formatted data to a file.
.SH "RETURN VALUE"
None.
.SH NOTES
This are auxiliary functions used by
-.BR grecs_format_node (3)
+.BR argot_format_node (3)
and
-.BR grecs_print_node (3),
+.BR argot_print_node (3),
correspondingly. They are is seldom needed in user programs.
.SH "SEE ALSO"
-.BR grecs_format_node (3).
+.BR argot_format_node (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_include_path_setup.3 b/doc/argot_include_path_setup.3
index 6e61ec9..49ce06f 100644
--- a/doc/grecs_include_path_setup.3
+++ b/doc/argot_include_path_setup.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,39 +14,39 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_INCLUDE_PATH_SETUP 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_INCLUDE_PATH_SETUP 3 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_include_path_setup, grecs_include_path_setup_v \- add
-directories to the \fBgrecs\fR preprocessor include path
+argot_include_path_setup, argot_include_path_setup_v \- add
+directories to the \fBargot\fR preprocessor include path
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_include_path_setup(const char *" "dir" ", ...);"
+.BI "void argot_include_path_setup(const char *" "dir" ", ...);"
.br
-.BI "void grecs_include_path_setup_v(char **" "dirs" );
+.BI "void argot_include_path_setup_v(char **" "dirs" );
.SH DESCRIPTION
These functions add directories to the end of the include search path
-used by the \fBgrecs\fR preprocessor.
+used by the \fBargot\fR preprocessor.
.PP
-\fBgrecs_include_path_setup\fR takes arbitrary number of
+\fBargot_include_path_setup\fR takes arbitrary number of
arguments. Each argument must be pointer to a directory name. The
argument list must terminate with a \fBNULL\fR argument.
.PP
-\fBgrecs_include_path_setup_v\fR takes directory names from a
+\fBargot_include_path_setup_v\fR takes directory names from a
\fBNULL\fR-terminated array of character pointers.
.SH "RETURN VALUE"
None.
.SH "SEE ALSO"
-.BR grecs_config (5).
+.BR argot_config (5).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_malloc.3 b/doc/argot_malloc.3
index 97d4273..0059bbb 100644
--- a/doc/grecs_malloc.3
+++ b/doc/argot_malloc.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,41 +14,41 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_MALLOC 3 "May 7, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_MALLOC 3 "May 7, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_malloc, grecs_zalloc, grecs_calloc, grecs_realloc \- Allocate
+argot_malloc, argot_zalloc, argot_calloc, argot_realloc \- Allocate
dynamic memory for \fBGrecs\fR.
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void *grecs_malloc(size_t " "size" );
+.BI "void *argot_malloc(size_t " "size" );
.br
-.BI "void *grecs_zalloc(size_t " "size" );
+.BI "void *argot_zalloc(size_t " "size" );
.br
-.BI "void *grecs_calloc(size_t " "nmemb" ", size_t " "size" );
+.BI "void *argot_calloc(size_t " "nmemb" ", size_t " "size" );
.br
-.BI "void *grecs_realloc(void " "*ptr" ", size_t " "size" );
+.BI "void *argot_realloc(void " "*ptr" ", size_t " "size" );
.br
-.BI "void grecs_free(void " "*ptr" );
+.BI "void argot_free(void " "*ptr" );
.br
-.BI "void grecs_alloc_die(void);"
+.BI "void argot_alloc_die(void);"
.sp
-.BI "void *(*grecs_malloc_fun)(size_t " "size" );
+.BI "void *(*argot_malloc_fun)(size_t " "size" );
.br
-.BI "void *(*grecs_realloc_fun)(void " "*ptr" ", size_t " "size" );
+.BI "void *(*argot_realloc_fun)(void " "*ptr" ", size_t " "size" );
.br
-.BI "void (*grecs_free_fun)(void " "*ptr" );
+.BI "void (*argot_free_fun)(void " "*ptr" );
.br
-.BI "void (*grecs_alloc_die_fun)(void);"
+.BI "void (*argot_alloc_die_fun)(void);"
.SH DESCRIPTION
.PP
-The \fBgrecs_malloc\fR, \fBgrecs_calloc\fR and \fBgrecs_realloc\fR
+The \fBargot_malloc\fR, \fBargot_calloc\fR and \fBargot_realloc\fR
functions work exactly as they \fIlibc\fR counterparts do, except that
if unable to allocate memory they terminate the program, by calling
-\fBgrecs_alloc_die\fR function.
+\fBargot_alloc_die\fR function.
.PP
-.BR grecs_calloc ()
+.BR argot_calloc ()
allocates memory for an array of
.I nmemb
elements of
@@ -56,13 +56,13 @@ elements of
bytes each and returns a pointer to the allocated memory.
The memory is set to zero.
.PP
-.BR grecs_malloc ()
+.BR argot_malloc ()
allocates
.I size
bytes and returns a pointer to the allocated memory.
The memory is not cleared.
.PP
-.BR grecs_realloc ()
+.BR argot_realloc ()
changes the size of the memory block pointed to by
.I ptr
to
@@ -72,56 +72,56 @@ The contents will be unchanged to the minimum of the old and new
sizes;
newly allocated memory will be uninitialized.
.PP
-.BR grecs_zalloc ()
+.BR argot_zalloc ()
allocates
.I size
bytes and returns a pointer to the allocated memory. The memory is
set to zero.
.PP
-.BR grecs_free ()
+.BR argot_free ()
frees the memory space pointed to by \fBptr\fR, which must have been
returned by a previous call to one of the memory allocation functions
discussed above.
.PP
-The \fBgrecs_malloc_fun\fR hook is used \fBgrecs_malloc\fR,
-\fBgrecs_calloc\fR and \fBgrecs_zalloc\fR to allocate new memory
+The \fBargot_malloc_fun\fR hook is used \fBargot_malloc\fR,
+\fBargot_calloc\fR and \fBargot_zalloc\fR to allocate new memory
chunk. By default it points to
.BR malloc (3).
.PP
-Similarly, the \fBgrecs_realloc_fun\fR, is used by
-\fBgrecs_realloc\fR function. By default it points to
+Similarly, the \fBargot_realloc_fun\fR, is used by
+\fBargot_realloc\fR function. By default it points to
.BR realloc (3).
.PP
-The \fBgrecs_free_fun\fR is used by
-.BR grecs_free ().
+The \fBargot_free_fun\fR is used by
+.BR argot_free ().
By default it points to
.BR free (3).
.PP
These hooks provide a way for the calling program to use its custom
memory allocation routines.
.PP
-.BR grecs_alloc_die ()
+.BR argot_alloc_die ()
This function is called when memory allocation fails. It prints
-appropriate diagnostics using \fBgrecs_error(3)\fR and aborts the
-program. If \fBgrecs_alloc_die_fun\fR, it is called prior to
+appropriate diagnostics using \fBargot_error(3)\fR and aborts the
+program. If \fBargot_alloc_die_fun\fR, it is called prior to
outputting the diagnostics.
.SH "RETURN VALUE"
-For \fBgrecs_malloc\fR, \fBgrecs_calloc\fR, \fBgrecs_zalloc\fR and
-\fBgrecs_realloc\fR return a pointer to the allocated memory, which is
+For \fBargot_malloc\fR, \fBargot_calloc\fR, \fBargot_zalloc\fR and
+\fBargot_realloc\fR return a pointer to the allocated memory, which is
suitably aligned for any kind of variable.
.PP
-On error, \fBgrecs_alloc_die\fR is called and the program is terminated.
+On error, \fBargot_alloc_die\fR is called and the program is terminated.
.SH "SEE ALSO"
-.BR grecs_strdup (3)
+.BR argot_strdup (3)
.SH AUTHORS
Sergey Poznyakoff.
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_node_free.3 b/doc/argot_node_free.3
index 8637811..6fd6f61 100644
--- a/doc/grecs_node_free.3
+++ b/doc/argot_node_free.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,34 +14,34 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_NODE_FREE 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_NODE_FREE 3 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_node_free \- reclaim the memory used by a node
+argot_node_free \- reclaim the memory used by a node
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_node_free(struct grecs_node " "*node" );
+.BI "void argot_node_free(struct argot_node " "*node" );
.SH DESCRIPTION
-\fBgrecs_node_free\fR reclaims the memory used by the parse tree node
+\fBargot_node_free\fR reclaims the memory used by the parse tree node
\fInode\fR.
.PP
The function does not unlink the node from the lists it is part of,
see
-.BR grecs_tree_free (3),
+.BR argot_tree_free (3),
if this is what you need.
.SH "RETURN VALUE"
None.
.SH "SEE ALSO"
-.BR grecs_tree_free (3).
+.BR argot_tree_free (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_parse.3 b/doc/argot_parse.3
index 27e451b..4db155c 100644
--- a/doc/grecs_parse.3
+++ b/doc/argot_parse.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,23 +14,23 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_PARSE 3 "July 1, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_PARSE 3 "July 1, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_parse \- parse a configuration file.
+argot_parse \- parse a configuration file.
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "struct grecs_node *grecs_parse(const char *" "name" );
+.BI "struct argot_node *argot_parse(const char *" "name" );
.SH DESCRIPTION
The
-.BR grecs_parse ()
+.BR argot_parse ()
function reads the file \fBname\fR, which must be formatted
according to
-.BR grecs_config (5)
+.BR argot_config (5)
and returns the parsed-out syntax tree. On errors, \fBNULL\fR is
returned and appropriate diagnostic messages are printed using
-.BR grecs_error (3).
+.BR argot_error (3).
.PP
The syntax tree consists of \fInodes\fR, linked together so as to
represent the file structure. A node is described by the following
@@ -38,32 +38,32 @@ object:
.sp
.nf
.in +5
-typedef struct grecs_node {
- enum grecs_node_type type;
- grecs_locus_t locus;
- struct grecs_node *up;
- struct grecs_node *down;
- struct grecs_node *next;
- struct grecs_node *prev;
+typedef struct argot_node {
+ enum argot_node_type type;
+ argot_locus_t locus;
+ struct argot_node *up;
+ struct argot_node *down;
+ struct argot_node *next;
+ struct argot_node *prev;
char *ident;
- grecs_locus_t idloc;
+ argot_locus_t idloc;
union {
- struct grecs_value *value;
- struct grecs_symtab *texttab;
+ struct argot_value *value;
+ struct argot_symtab *texttab;
} v;
-} grecs_node_t;
+} argot_node_t;
.in
.fi
.PP
The \fItype\fR member describes the type of this node. Its value is
-\fBgrecs_node_stmt\fR for simple statements and
-\fBgrecs_node_block\fR, for block statements. The topmost node (the
-one returned by \fBgrecs_tree_parse\fR) has type \fBgrecs_node_root\fR.
+\fBargot_node_stmt\fR for simple statements and
+\fBargot_node_block\fR, for block statements. The topmost node (the
+one returned by \fBargot_tree_parse\fR) has type \fBargot_node_root\fR.
.PP
The \fIlocus\fR describes the location in the input file, which this
node described. See
-.BR grecs_error (3),
-for a description of \fBgrecs_locus_t\fR.
+.BR argot_error (3),
+for a description of \fBargot_locus_t\fR.
.PP
Adjacent nodes form a doubly-linked list using the \fBnext\fR and
\fBprev\fR pointers. Thus, the node pointed to by \fBnext\fR
@@ -71,7 +71,7 @@ describes the statement that appears immediately after the one
described by the current node, whereas \fBprev\fR points to the node
describing a preceding statement.
.PP
-If \fItype\fR is \fBgrecs_node_block\fR, the \fBdown\fR member points
+If \fItype\fR is \fBargot_node_block\fR, the \fBdown\fR member points
to the first \fBsub-statement\fR in this block. \fBdown->next\fR
will point to the second statement (if any), and so on.
.PP
@@ -105,7 +105,7 @@ input file. Notice, that it differs from \fBlocus\fR described above.
.PP
The \fBv\fR union keeps data which depend on the type of this node.
The \fBv.texttab\fR member is defined only for the root node (type
-\fBgrecs_node_root\fR). It points to a symbol table which holds shared
+\fBargot_node_root\fR). It points to a symbol table which holds shared
strings for this tree. In particular, this table holds file names
referenced by \fBlocus\fR members of all underlying nodes.
.PP
@@ -114,33 +114,33 @@ the value associated with this statement. A value is defined as:
.sp
.nf
.in +5
-typedef struct grecs_value {
+typedef struct argot_value {
int type;
- grecs_locus_t locus;
+ argot_locus_t locus;
union {
- struct grecs_list *list;
+ struct argot_list *list;
char *string;
struct {
size_t c;
- struct grecs_value **v;
+ struct argot_value **v;
} arg;
} v;
-} grecs_value_t;
+} argot_value_t;
.in
.fi
.PP
-The \fBtype\fR will be \fBGRECS_TYPE_STRING\fR, for string values,
-\fBGRECS_TYPE_LIST\fR, for list values, and \fBGRECS_TYPE_ARRAY\fR,
+The \fBtype\fR will be \fBARGOT_TYPE_STRING\fR, for string values,
+\fBARGOT_TYPE_LIST\fR, for list values, and \fBARGOT_TYPE_ARRAY\fR,
for arrays of values. Depending on its value, the following members
of the union are used:
.TP
-.B GRECS_TYPE_STRING
+.B ARGOT_TYPE_STRING
Actual string value is pointed to by \fBv.string\fR.
.TP
-.B GRECS_TYPE_LIST
+.B ARGOT_TYPE_LIST
The list value is pointed to by \fBv.list\fR.
.TP
-.B GRECS_TYPE_ARRAY
+.B ARGOT_TYPE_ARRAY
The array itself is stored in \fBv.arg.v\fR. The \fBv.arg.c\fR member
contains the number of elements in the array.
.PP
@@ -157,29 +157,29 @@ screen:
int
main(int argc, char **argv)
{
- struct grecs_node *tree;
+ struct argot_node *tree;
- tree = grecs_parse(argv[1]);
- grecs_format_node(tree, GRECS_NODE_FLAG_DEFAULT, stdout);
+ tree = argot_parse(argv[1]);
+ argot_format_node(tree, ARGOT_NODE_FLAG_DEFAULT, stdout);
fputc('\\n', stdout);
- grecs_tree_free(tree);
+ argot_tree_free(tree);
exit(0);
}
.in
.fi
.SH "SEE ALSO"
-.BR grecs_config (5),
-.BR grecs_error (3),
-.BR grecs_format_node (3),
-.BR grecs_tree_free (3).
+.BR argot_config (5),
+.BR argot_error (3),
+.BR argot_format_node (3),
+.BR argot_tree_free (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_stmt_path.5 b/doc/argot_stmt_path.5
index 2436630..bc2cc0a 100644
--- a/doc/grecs_stmt_path.5
+++ b/doc/argot_stmt_path.5
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,10 +14,10 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_STMT_PATH 5 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_STMT_PATH 5 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
Statement pathname \- a unique identifier of a statement in
-\fBgrecs\fR configuration file.
+\fBargot\fR configuration file.
.SH DESCRIPTION
\fBGrecs\fR configuration files have a distinct hierarchical
structure. Each statement in such a file can therefore be identified
@@ -93,15 +93,15 @@ component separator, e.g.:
.program=\(dqa.out\(dq.bar.baz
.fi
.SH "SEE ALSO"
-.BR grecs_config (5).
+.BR argot_config (5).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_strdup.3 b/doc/argot_strdup.3
index e180264..ce53b07 100644
--- a/doc/grecs_strdup.3
+++ b/doc/argot_strdup.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,41 +14,41 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_STRDUP 3 "May 7, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_STRDUP 3 "May 7, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_strdup \- duplicate a string
+argot_strdup \- duplicate a string
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "char *grecs_strdup(const char *" "str" );
+.BI "char *argot_strdup(const char *" "str" );
.SH DESCRIPTION
The
.BR strdup ()
function returns a pointer to a new string which is a duplicate of the
string \fIstr\fR. Memory for the new string is obtained with
-.BR grecs_malloc (3),
+.BR argot_malloc (3),
and must be freed with
-.BR grecs_free (3).
+.BR argot_free (3).
.SH "RETURN VALUE"
The
-.BR grecs_strdup ()
+.BR argot_strdup ()
function returns a pointer to the duplicated string.
.PP
On error,
-.BR grecs_alloc_die (3)
+.BR argot_alloc_die (3)
is called, which terminates the program.
.SH "SEE ALSO"
-.BR grecs_alloc_die (3)
+.BR argot_alloc_die (3)
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/grecs_tree_free.3 b/doc/argot_tree_free.3
index 7b0faf6..b064a23 100644
--- a/doc/grecs_tree_free.3
+++ b/doc/argot_tree_free.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,32 +14,32 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_XXX 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_XXX 3 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
-grecs_tree_free \- reclaim the memory used by entire parse tree
+argot_tree_free \- reclaim the memory used by entire parse tree
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
-.BI "void grecs_tree_free(struct grecs_node " "*node" );
+.BI "void argot_tree_free(struct argot_node " "*node" );
.SH DESCRIPTION
-\fBgrecs_tree_free\fR reclaims the memory used by \fInode\fR and all
+\fBargot_tree_free\fR reclaims the memory used by \fInode\fR and all
nodes it points to, recursively.
.PP
The argument \fInode\fR must be the root of a parse tree.
.SH "RETURN VALUE"
None.
.SH "SEE ALSO"
-.BR grecs_parse (3),
-.BR grecs_node_free (3).
+.BR argot_parse (3),
+.BR argot_node_free (3).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/tmpl.3 b/doc/tmpl.3
index b4eeb96..6827d77 100644
--- a/doc/tmpl.3
+++ b/doc/tmpl.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,12 +14,12 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_XXX 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH ARGOT_XXX 3 "May 4, 2011" "ARGOT" "Grecs User Reference"
.SH NAME
.SH SYNOPSIS
.nf
-.B #include <grecs.h>
+.B #include <argot.h>
.sp
.SH DESCRIPTION
.SH "RETURN VALUE"
@@ -28,11 +28,11 @@
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.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 <http://www.gnu.org.ua/software/grecs>.
+documentation, visit <http://www.gnu.org.ua/software/argot>.
.SH COPYRIGHT
Copyright \(co 2011 Sergey Poznyakoff
.br
diff --git a/doc/wordsplit.3 b/doc/wordsplit.3
index 067ea5e..13b634b 100644
--- a/doc/wordsplit.3
+++ b/doc/wordsplit.3
@@ -1,4 +1,4 @@
-.\" This file is part of grecs -*- nroff -*-
+.\" This file is part of argot -*- nroff -*-
.\" Copyright (C) 2007-2016 Sergey Poznyakoff
.\"
.\" Grecs is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH WORDSPLIT 3 "December 3, 2014" "GRECS" "Grecs User Reference"
+.TH WORDSPLIT 3 "December 3, 2014" "ARGOT" "Grecs User Reference"
.SH NAME
wordsplit \- split string into words
.SH SYNOPSIS
@@ -971,7 +971,7 @@ char **shell_parse(char *s)
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray+grecs@gnu.org.ua>.
+Report bugs to <gray+argot@gnu.org.ua>.
.SH COPYRIGHT
Copyright \(co 2009-2014 Sergey Poznyakoff
.br
diff --git a/include/Makefile.am b/include/Makefile.am
index 6a017a3..75c70ce 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,19 +1,19 @@
-SUBDIRS = grecs
-GRECS_HDR = grecs.h wordsplit.h
+SUBDIRS = argot
+ARGOT_HDR = argot.h wordsplit.h
-if GRECS_COND_BUILD_INSTALL
- include_HEADERS = $(GRECS_HDR)
+if ARGOT_COND_BUILD_INSTALL
+ include_HEADERS = $(ARGOT_HDR)
endif
-if GRECS_COND_BUILD_SHARED
-if GRECS_COND_INSTALLHEADERS
- grecsincludedir = @GRECS_INCLUDE_DIR@
- grecsinclude_HEADERS = $(GRECS_HDR)
+if ARGOT_COND_BUILD_SHARED
+if ARGOT_COND_INSTALLHEADERS
+ argotincludedir = @ARGOT_INCLUDE_DIR@
+ argotinclude_HEADERS = $(ARGOT_HDR)
else
- noinst_HEADERS = $(GRECS_HDR)
+ noinst_HEADERS = $(ARGOT_HDR)
endif
endif
-if GRECS_COND_BUILD_STATIC
- noinst_HEADERS = $(GRECS_HDR)
+if ARGOT_COND_BUILD_STATIC
+ noinst_HEADERS = $(ARGOT_HDR)
endif
diff --git a/include/grecs.h b/include/argot.h
index eac11d4..0f5e870 100644
--- a/include/grecs.h
+++ b/include/argot.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,27 +14,27 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_H
-#define _GRECS_H
+#ifndef _ARGOT_H
+#define _ARGOT_H
-#include <grecs/types.h>
-#include <grecs/version.h>
-#include <grecs/doc.h>
-#include <grecs/error.h>
-#include <grecs/format.h>
-#include <grecs/lex.h>
-#include <grecs/list.h>
-#include <grecs/locus.h>
-#include <grecs/mem.h>
-#include <grecs/node.h>
-#include <grecs/parser.h>
-#include <grecs/preproc.h>
-#include <grecs/sockaddr.h>
-#include <grecs/symtab.h>
-#include <grecs/table.h>
-#include <grecs/tree.h>
-#include <grecs/txtacc.h>
-#include <grecs/util.h>
-#include <grecs/value.h>
+#include <argot/types.h>
+#include <argot/version.h>
+#include <argot/doc.h>
+#include <argot/error.h>
+#include <argot/format.h>
+#include <argot/lex.h>
+#include <argot/list.h>
+#include <argot/locus.h>
+#include <argot/mem.h>
+#include <argot/node.h>
+#include <argot/parser.h>
+#include <argot/preproc.h>
+#include <argot/sockaddr.h>
+#include <argot/symtab.h>
+#include <argot/table.h>
+#include <argot/tree.h>
+#include <argot/txtacc.h>
+#include <argot/util.h>
+#include <argot/value.h>
#endif
diff --git a/include/grecs/.gitignore b/include/argot/.gitignore
index 8cb8a05..8cb8a05 100644
--- a/include/grecs/.gitignore
+++ b/include/argot/.gitignore
diff --git a/include/argot/Makefile.am b/include/argot/Makefile.am
new file mode 100644
index 0000000..9fb3fa1
--- a/dev/null
+++ b/include/argot/Makefile.am
@@ -0,0 +1,43 @@
+ARGOT_PKG_HDR =\
+ doc.h\
+ error.h\
+ format.h\
+ lex.h\
+ list.h\
+ locus.h\
+ mem.h\
+ node.h\
+ opt.h\
+ parser.h\
+ preproc.h\
+ sockaddr.h\
+ symtab.h\
+ table.h\
+ tree.h\
+ txtacc.h\
+ types.h\
+ util.h\
+ value.h\
+ version.h
+
+if ARGOT_COND_JSON
+ ARGOT_PKG_HDR += json.h
+endif
+
+if ARGOT_COND_BUILD_INSTALL
+ argotincludedir = @ARGOT_INCLUDE_DIR@
+ argotinclude_HEADERS = $(ARGOT_PKG_HDR)
+endif
+
+if ARGOT_COND_BUILD_SHARED
+if ARGOT_COND_INSTALLHEADERS
+ argotincludedir = @ARGOT_INCLUDE_DIR@
+ argotinclude_HEADERS = $(ARGOT_PKG_HDR)
+else
+ noinst_HEADERS = $(ARGOT_PKG_HDR)
+endif
+endif
+
+if ARGOT_COND_BUILD_STATIC
+ noinst_HEADERS = $(ARGOT_PKG_HDR)
+endif
diff --git a/include/grecs/doc.h b/include/argot/doc.h
index b2514fb..2b2da95 100644
--- a/include/grecs/doc.h
+++ b/include/argot/doc.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,19 +14,19 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_DOC_H
-#define _GRECS_DOC_H
+#ifndef _ARGOT_DOC_H
+#define _ARGOT_DOC_H
#include <stdio.h>
-#include <grecs/table.h>
+#include <argot/table.h>
-void grecs_print_docstring(const char *docstring, unsigned level,
+void argot_print_docstring(const char *docstring, unsigned level,
FILE *stream);
-void grecs_print_simple_statement(struct grecs_keyword *kwp,
+void argot_print_simple_statement(struct argot_keyword *kwp,
unsigned level, FILE *stream);
-void grecs_print_block_statement(struct grecs_keyword *kwp,
+void argot_print_block_statement(struct argot_keyword *kwp,
unsigned level, FILE *stream);
-void grecs_print_statement_array(struct grecs_keyword *kwp,
+void argot_print_statement_array(struct argot_keyword *kwp,
unsigned n,
unsigned level, FILE *stream);
#endif
diff --git a/include/grecs/error.h b/include/argot/error.h
index 8630b8a..423af12 100644
--- a/include/grecs/error.h
+++ b/include/argot/error.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,25 +14,25 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_ERROR_H
-#define _GRECS_ERROR_H
+#ifndef _ARGOT_ERROR_H
+#define _ARGOT_ERROR_H
-#include <grecs/locus.h>
+#include <argot/locus.h>
-extern int grecs_log_to_stderr;
-extern void (*grecs_log_setup_hook)(void);
+extern int argot_log_to_stderr;
+extern void (*argot_log_setup_hook)(void);
-extern void (*grecs_print_diag_fun)(grecs_locus_t const *, int, int,
+extern void (*argot_print_diag_fun)(argot_locus_t const *, int, int,
const char*);
-void grecs_warning(grecs_locus_t const *locus,
+void argot_warning(argot_locus_t const *locus,
int errcode, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
-void grecs_error(grecs_locus_t const *locus, int errcode,
+void argot_error(argot_locus_t const *locus, int errcode,
const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
-int grecs_asprint_locus(char **locstr, size_t *size,
- grecs_locus_t const *locus);
+int argot_asprint_locus(char **locstr, size_t *size,
+ argot_locus_t const *locus);
#endif
diff --git a/include/argot/format.h b/include/argot/format.h
new file mode 100644
index 0000000..f989904
--- a/dev/null
+++ b/include/argot/format.h
@@ -0,0 +1,62 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_FORMAT_H
+#define _ARGOT_FORMAT_H
+
+#include <argot/value.h>
+#include <argot/locus.h>
+#include <argot/node.h>
+#include <argot/txtacc.h>
+
+struct argot_format_closure {
+ int (*fmtfun)(const char *, void *);
+ void *data;
+};
+
+void argot_format_locus(argot_locus_t *locus, struct argot_format_closure *fp);
+void argot_format_node_path(struct argot_node *node, int flag,
+ struct argot_format_closure *fp);
+void argot_format_value(struct argot_value *val, int flags,
+ struct argot_format_closure *fp);
+
+#define ARGOT_NODE_FLAG_PATH 0x00100
+#define ARGOT_NODE_FLAG_VALUE 0x00200
+#define ARGOT_NODE_FLAG_DESCEND 0x01000
+#define ARGOT_NODE_FLAG_LOCUS 0x02000
+#define ARGOT_NODE_FLAG_QUOTE 0x04000
+#define ARGOT_NODE_FLAG_NOQUOTE 0x08000
+#define ARGOT_NODE_FLAG_QUOTE_HEX 0x10000
+
+#define _ARGOT_NODE_MASK_DELIM 0x000ff
+#define _ARGOT_NODE_MASK_OUTPUT 0x00f00
+
+#define ARGOT_NODE_FLAG_DEFAULT \
+ (ARGOT_NODE_FLAG_PATH|ARGOT_NODE_FLAG_VALUE|\
+ ARGOT_NODE_FLAG_DESCEND|ARGOT_NODE_FLAG_QUOTE)
+int argot_format_node(struct argot_node *node, int flags,
+ struct argot_format_closure *fp);
+
+void argot_print_locus(argot_locus_t *locus, FILE *fp);
+void argot_print_node_path(struct argot_node *node, int flag, FILE *fp);
+void argot_print_value(struct argot_value *val, int flags, FILE *fp);
+
+int argot_print_node(struct argot_node *node, int flags, FILE *fp);
+
+void argot_txtacc_format_value(struct argot_value *val, int flags,
+ argot_txtacc_t acc);
+
+#endif
diff --git a/include/grecs/json.h b/include/argot/json.h
index f8402e7..f453ecf 100644
--- a/include/grecs/json.h
+++ b/include/argot/json.h
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#include <grecs.h>
+#include <argot.h>
enum json_value_type
{
@@ -30,7 +30,7 @@ struct json_value;
struct json_array {
size_t oc;
struct json_value **ov;
- struct grecs_list *ol;
+ struct argot_list *ol;
};
struct json_value {
@@ -40,7 +40,7 @@ struct json_value {
double n; /* json_number */
char *s; /* json_string */
struct json_array *a; /* json_arr */
- struct grecs_symtab *o; /* json_object */
+ struct argot_symtab *o; /* json_object */
} v;
};
@@ -50,7 +50,7 @@ struct json_pair {
};
extern char const *json_err_diag;
-extern struct grecs_locus json_err_locus;
+extern struct argot_locus json_err_locus;
extern struct json_value *json_return_obj;
void jsonlex_setup(char const *s, size_t l);
@@ -58,7 +58,7 @@ void jsonlex_diag(const char *s);
int json_unescape(char c, char *o);
struct json_value *json_value_create(int type);
-struct grecs_symtab *json_assoc_create(void);
+struct argot_symtab *json_assoc_create(void);
void json_value_free(struct json_value *obj);
struct json_value *json_parse_string(char const *input, size_t len);
diff --git a/include/argot/lex.h b/include/argot/lex.h
new file mode 100644
index 0000000..f0699d2
--- a/dev/null
+++ b/include/argot/lex.h
@@ -0,0 +1,52 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_LEX_H
+#define _ARGOT_LEX_H
+
+int argot_lex_begin(const char*, int);
+void argot_lex_end(int err);
+
+char *argot_install_text(const char *str);
+void argot_destroy_text(void);
+struct argot_symtab *argot_text_table(void);
+
+void argot_parse_line_directive(char *text, argot_locus_t *ploc,
+ struct argot_locus_point *ppoint,
+ size_t *pxlines);
+void argot_parse_line_directive_cpp(char *text, argot_locus_t *ploc,
+ struct argot_locus_point *ppoint,
+ size_t *pxlines);
+
+void argot_line_acc_create(void);
+void argot_line_acc_free(void);
+void argot_line_acc_grow_char(int c);
+int argot_line_acc_grow_char_unescape(int c);
+void argot_line_acc_grow(const char *text, size_t len);
+void argot_line_acc_grow_unescape_last(char *text, size_t len,
+ argot_locus_t const *loc);
+
+void argot_line_begin(void);
+#define argot_line_add argot_line_acc_grow
+char *argot_line_finish(void);
+
+int argot_str_is_ipv4(const char *addr);
+int argot_str_is_num(const char *s);
+int argot_str_is_ipv6(const char *addr);
+int argot_str_is_num(const char *s);
+int argot_str_is_ipaddr(const char *addr);
+
+#endif
diff --git a/include/argot/list.h b/include/argot/list.h
new file mode 100644
index 0000000..8293fc6
--- a/dev/null
+++ b/include/argot/list.h
@@ -0,0 +1,54 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_LIST_H
+#define _ARGOT_LIST_H
+
+typedef struct argot_list_entry *argot_list_entry_ptr_t;
+typedef struct argot_list *argot_list_ptr_t;
+
+struct argot_list_entry {
+ struct argot_list_entry *next, *prev;
+ void *data;
+};
+
+struct argot_list {
+ struct argot_list_entry *head, *tail;
+ size_t count;
+ int (*cmp)(const void *, const void *);
+ void (*free_entry)(void *);
+};
+
+argot_list_ptr_t argot_list_create(void);
+size_t argot_list_size(argot_list_ptr_t);
+void argot_list_append(argot_list_ptr_t, void *);
+void argot_list_push(argot_list_ptr_t, void *);
+void *argot_list_pop(argot_list_ptr_t);
+void *argot_list_locate(argot_list_ptr_t, void *);
+void *argot_list_index(argot_list_ptr_t, size_t);
+void *argot_list_remove_tail(argot_list_ptr_t);
+void argot_list_remove_entry(argot_list_ptr_t, argot_list_entry_ptr_t);
+void argot_list_clear(argot_list_ptr_t);
+void argot_list_free(argot_list_ptr_t);
+void argot_list_add(argot_list_ptr_t, argot_list_ptr_t);
+int argot_list_compare(argot_list_ptr_t, argot_list_ptr_t);
+
+/* FIXME */
+struct argot_list *_argot_simple_list_create(int dispose);
+struct argot_list *argot_value_list_create(void);
+
+
+#endif
diff --git a/include/grecs/locus.h b/include/argot/locus.h
index 4ca6d21..1f8071b 100644
--- a/include/grecs/locus.h
+++ b/include/argot/locus.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,29 +14,29 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_LOCUS_H
-#define _GRECS_LOCUS_H
+#ifndef _ARGOT_LOCUS_H
+#define _ARGOT_LOCUS_H
-struct grecs_locus_point {
+struct argot_locus_point {
char *file;
unsigned line;
unsigned col;
};
-#define grecs_locus_point_advance_line(loc) do { \
+#define argot_locus_point_advance_line(loc) do { \
(loc).line++; \
(loc).col = 0; \
} while (0)
-#define GRECS_LOCUS_POINT_EQ(a,b) \
+#define ARGOT_LOCUS_POINT_EQ(a,b) \
((strcmp((a)->file, (b)->file) == 0) && ((a)->line == (b)->line))
-typedef struct grecs_locus {
- struct grecs_locus_point beg;
- struct grecs_locus_point end;
-} grecs_locus_t;
+typedef struct argot_locus {
+ struct argot_locus_point beg;
+ struct argot_locus_point end;
+} argot_locus_t;
-#define YYLTYPE grecs_locus_t
+#define YYLTYPE argot_locus_t
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
diff --git a/include/grecs/mem.h b/include/argot/mem.h
index de46b32..8607902 100644
--- a/include/grecs/mem.h
+++ b/include/argot/mem.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,20 +14,20 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_MEM_H
-#define _GRECS_MEM_H
+#ifndef _ARGOT_MEM_H
+#define _ARGOT_MEM_H
-extern void *(*grecs_malloc_fun)(size_t size);
-extern void *(*grecs_realloc_fun)(void *ptr, size_t size);
-extern void (*grecs_alloc_die_fun)(void);
-extern void (*grecs_free_fun)(void *ptr);
+extern void *(*argot_malloc_fun)(size_t size);
+extern void *(*argot_realloc_fun)(void *ptr, size_t size);
+extern void (*argot_alloc_die_fun)(void);
+extern void (*argot_free_fun)(void *ptr);
-void *grecs_malloc(size_t size);
-void *grecs_zalloc(size_t size);
-void *grecs_calloc(size_t nmemb, size_t size);
-void *grecs_realloc(void *ptr, size_t size);
-void grecs_alloc_die(void);
-char *grecs_strdup(const char *str);
-void grecs_free(void *ptr);
+void *argot_malloc(size_t size);
+void *argot_zalloc(size_t size);
+void *argot_calloc(size_t nmemb, size_t size);
+void *argot_realloc(void *ptr, size_t size);
+void argot_alloc_die(void);
+char *argot_strdup(const char *str);
+void argot_free(void *ptr);
#endif
diff --git a/include/argot/node.h b/include/argot/node.h
new file mode 100644
index 0000000..fcf542e
--- a/dev/null
+++ b/include/argot/node.h
@@ -0,0 +1,62 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_NODE_H
+#define _ARGOT_NODE_H
+
+#include <argot/locus.h>
+#include <argot/symtab.h>
+#include <argot/value.h>
+
+enum argot_node_type {
+ argot_node_root,
+ argot_node_stmt,
+ argot_node_block
+};
+
+typedef struct argot_node {
+ enum argot_node_type type;
+ argot_locus_t locus;
+ struct argot_node *up;
+ struct argot_node *down;
+ struct argot_node *next;
+ struct argot_node *prev;
+ char *ident;
+ argot_locus_t idloc;
+ union {
+ argot_value_t *value;
+ argot_symtab_ptr_t texttab;
+ } v;
+} argot_node_t;
+
+void argot_node_free(struct argot_node *node);
+struct argot_node *argot_node_create(enum argot_node_type type,
+ argot_locus_t *loc);
+struct argot_node *argot_node_create_points(enum argot_node_type type,
+ struct argot_locus_point beg,
+ struct argot_locus_point end);
+void argot_node_bind(struct argot_node *master, struct argot_node *node,
+ int dn);
+int argot_node_eq(struct argot_node *a, struct argot_node *b);
+int argot_node_unlink(struct argot_node *node);
+
+struct argot_node *argot_node_from_path(const char *path, const char *value);
+struct argot_node *argot_node_from_path_locus(const char *path,
+ const char *value,
+ argot_locus_t *locus,
+ argot_locus_t *vallocus);
+
+#endif
diff --git a/include/grecs/opt.h b/include/argot/opt.h
index 5153033..24d4035 100644
--- a/include/grecs/opt.h
+++ b/include/argot/opt.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,15 +14,15 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_OPT_H
-#define _GRECS_OPT_H
+#ifndef _ARGOT_OPT_H
+#define _ARGOT_OPT_H
-struct grecs_proginfo {
+struct argot_proginfo {
const char *progname;
char **subcmd;
const char *docstring;
const char *args_doc;
- struct grecs_opthelp *opthelp;
+ struct argot_opthelp *opthelp;
size_t optcount;
void (*print_help_hook)(FILE *stream);
void (*print_version_hook)(FILE *stream);
@@ -37,7 +37,7 @@ struct grecs_proginfo {
const char *epilogue;
};
-struct grecs_opthelp {
+struct argot_opthelp {
const char *opt;
const char *arg;
int is_optional;
@@ -49,10 +49,10 @@ struct grecs_opthelp {
#define GROUPCOLUMN 2
#define USAGECOLUMN 13
-void grecs_print_help(struct grecs_proginfo *pinfo);
-void grecs_print_usage(struct grecs_proginfo *pinfo);
-void grecs_print_version_only(struct grecs_proginfo *pinfo, FILE *stream);
-void grecs_print_version(struct grecs_proginfo *pinfo, FILE *stream);
+void argot_print_help(struct argot_proginfo *pinfo);
+void argot_print_usage(struct argot_proginfo *pinfo);
+void argot_print_version_only(struct argot_proginfo *pinfo, FILE *stream);
+void argot_print_version(struct argot_proginfo *pinfo, FILE *stream);
#endif
diff --git a/include/argot/parser.h b/include/argot/parser.h
new file mode 100644
index 0000000..286e42e
--- a/dev/null
+++ b/include/argot/parser.h
@@ -0,0 +1,56 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_PARSER_H
+#define _ARGOT_PARSER_H
+
+typedef struct argot_node *(*argot_parser_t)(const char *name, int trace);
+
+#define ARGOT_TRACE_GRAM 0x01
+#define ARGOT_TRACE_LEX 0x02
+
+extern int argot_trace_flags;
+extern argot_parser_t argot_parser_fun;
+extern int argot_default_port;
+
+extern struct argot_locus_point argot_current_locus_point;
+extern argot_locus_t argot_locus;
+extern int argot_error_count;
+
+#define ARGOT_OPTION_ADJUST_STRING_LOCATIONS 0x01
+#define ARGOT_OPTION_QUOTED_STRING_CONCAT 0x02
+extern int argot_parser_options;
+
+/* Main entry point */
+struct argot_node *argot_parse(const char *name);
+void argot_gram_trace(int n);
+void argot_lex_trace(int n);
+
+/* Parsers: */
+struct argot_node *argot_argot_parser(const char *name, int traceflags);
+struct argot_node *argot_meta1_parser(const char *name, int traceflags);
+struct argot_node *argot_bind_parser(const char *name, int traceflags);
+struct argot_node *argot_dhcpd_parser(const char *name, int traceflags);
+struct argot_node *argot_git_parser(const char *name, int traceflags);
+struct argot_node *argot_path_parser(const char *name, int traceflags);
+
+
+/* Parser database */
+int argot_enumerate_parsers(int (*fun)(const char *, argot_parser_t, void *),
+ void *);
+argot_parser_t argot_get_parser_by_type(const char *type);
+
+#endif
diff --git a/include/argot/preproc.h b/include/argot/preproc.h
new file mode 100644
index 0000000..dc567c8
--- a/dev/null
+++ b/include/argot/preproc.h
@@ -0,0 +1,46 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_PREPROC_H
+#define _ARGOT_PREPROC_H
+
+#include <sys/types.h>
+
+extern const char *argot_preprocessor;
+
+size_t argot_preproc_fill_buffer(char *buf, size_t size);
+void argot_preproc_add_include_dir(char *dir);
+int argot_preproc_init(const char *name);
+void argot_preproc_done(void);
+int argot_preproc_run(const char *config_file, const char *extpp);
+
+#define ARGOT_STD_INCLUDE 0x01
+#define ARGOT_USR_INCLUDE 0x02
+
+size_t argot_include_path_count(int flag);
+int argot_foreach_include_dir(int flag, int (*fun)(int, const char *, void *),
+ void *data);
+
+char *argot_find_include_file(const char *name, int allow_cwd);
+
+FILE *argot_preproc_extrn_start(const char *file, pid_t *ppid);
+void argot_preproc_extrn_shutdown(pid_t pid);
+
+void argot_include_path_clear(void);
+void argot_include_path_setup(const char *dir, ...);
+void argot_include_path_setup_v(char **dirs);
+
+#endif
diff --git a/include/argot/sockaddr.h b/include/argot/sockaddr.h
new file mode 100644
index 0000000..e5325c1
--- a/dev/null
+++ b/include/argot/sockaddr.h
@@ -0,0 +1,66 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_SOCKADDR_H
+#define _ARGOT_SOCKADDR_H
+
+struct argot_sockaddr {
+#if ARGOT_SOCKADDR_LIST
+ struct argot_sockaddr *next;
+#endif
+ int len;
+ struct sockaddr *sa;
+};
+
+#if ARGOT_SOCKADDR_LIST
+
+#define ARGOT_AH_PASSIVE 0x01
+#define ARGOT_HINT_SERVICE 0x02
+#define ARGOT_HINT_PORT 0x04
+
+struct argot_sockaddr_hints {
+ int flags;
+ char *service;
+ unsigned short port;
+};
+
+extern struct argot_sockaddr_hints *argot_sockaddr_hints;
+
+struct argot_sockaddr *argot_sockaddr_new(size_t s);
+void argot_sockaddr_free(struct argot_sockaddr *p);
+
+int argot_str_to_sockaddr(struct argot_sockaddr **sap,
+ const char *arg, struct argot_sockaddr_hints *gh,
+ argot_locus_t const *locus);
+#endif
+
+#define ARGOT_INADDR_BYTES 16
+
+struct argot_cidr
+{
+ int family;
+ int len;
+ unsigned char address[ARGOT_INADDR_BYTES];
+ unsigned char netmask[ARGOT_INADDR_BYTES];
+};
+
+int argot_str_to_cidr(struct argot_cidr *pcidr, const char *str,
+ argot_locus_t const *locus);
+
+int argot_sockaddr_to_cidr(struct argot_cidr *cidr, const struct sockaddr *sa);
+int argot_sockadd_cidr_match(struct sockaddr *sa, struct argot_cidr *cidr);
+
+#endif
diff --git a/include/argot/symtab.h b/include/argot/symtab.h
new file mode 100644
index 0000000..b84f3b7
--- a/dev/null
+++ b/include/argot/symtab.h
@@ -0,0 +1,53 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_SYMTAB_H
+#define _ARGOT_SYMTAB_H
+
+typedef struct argot_symtab *argot_symtab_ptr_t;
+typedef struct argot_syment *argot_syment_ptr_t;
+
+struct argot_syment {
+ char *name;
+};
+
+typedef int (*argot_symtab_enumerator_t)(void *sym, void *data);
+
+const char *argot_symtab_strerror(int rc);
+
+void *argot_symtab_lookup_or_install(argot_symtab_ptr_t st,
+ void *key, int *install);
+void argot_symtab_clear(argot_symtab_ptr_t st);
+argot_symtab_ptr_t argot_symtab_create(size_t elsize,
+ unsigned (*hash_fun)(void *, unsigned long),
+ int (*cmp_fun)(const void *, const void *),
+ int (*copy_fun)(void *, void *),
+ void *(*alloc_fun)(size_t),
+ void (*free_fun)(void *));
+argot_symtab_ptr_t argot_symtab_create_default(size_t elsize);
+
+void argot_symtab_free(argot_symtab_ptr_t pst);
+int argot_symtab_remove(argot_symtab_ptr_t st, void *elt);
+int argot_symtab_replace(argot_symtab_ptr_t st, void *ent, void **old_ent);
+int argot_symtab_enumerate(argot_symtab_ptr_t st,
+ argot_symtab_enumerator_t fun, void *data);
+
+size_t argot_symtab_count_entries(argot_symtab_ptr_t st);
+
+unsigned argot_hash_string(const char *name, unsigned long hashsize);
+unsigned argot_hash_string_ci(const char *name, unsigned long hashsize);
+
+#endif
diff --git a/include/argot/table.h b/include/argot/table.h
new file mode 100644
index 0000000..73d4a4d
--- a/dev/null
+++ b/include/argot/table.h
@@ -0,0 +1,102 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_TABLE_H
+#define _ARGOT_TABLE_H
+
+#include <argot/node.h>
+
+enum argot_data_type {
+ argot_type_void,
+ argot_type_string,
+ argot_type_short,
+ argot_type_ushort,
+ argot_type_int,
+ argot_type_uint,
+ argot_type_long,
+ argot_type_ulong,
+ argot_type_size,
+/* argot_type_off,*/
+ argot_type_time,
+ argot_type_bool,
+ argot_type_ipv4,
+ argot_type_cidr,
+ argot_type_host,
+ argot_type_sockaddr,
+ argot_type_section,
+ argot_type_null
+};
+
+#define ARGOT_DFLT 0x00 /* Default keyword flags */
+#define ARGOT_AGGR 0x01 /* Multiple entries aggregate */
+#define ARGOT_MULT 0x02 /* Statement can appear multiple times */
+#define ARGOT_INAC 0x04 /* Inactive keyword */
+#define ARGOT_LIST 0x08 /* Value is a list of declared type */
+#define ARGOT_HIDDEN 0x10 /* Hidden keyword: don't display in help output */
+#define ARGOT_CONST 0x20 /* For string types: initial value is constant,
+ don't try to free it before assigning new value.
+ This flag is cleared after the first assignment.
+ */
+
+enum argot_callback_command {
+ argot_callback_section_begin,
+ argot_callback_section_end,
+ argot_callback_set_value
+};
+
+typedef int (*argot_callback_fn)(
+#if ARGOT_TREE_API
+ enum argot_callback_command cmd,
+ argot_node_t * /* node */,
+ void * /* varptr */,
+ void * /* cb_data */
+#else
+ enum argot_callback_command cmd,
+ argot_locus_t * /* locus */,
+ void * /* varptr */,
+ argot_value_t * /* value */,
+ void * /* cb_data */
+#endif
+ );
+
+struct argot_keyword {
+ const char *ident;
+ const char *argname;
+ const char *docstring;
+ enum argot_data_type type;
+ int flags;
+ void *varptr;
+ size_t offset;
+ argot_callback_fn callback;
+ void *callback_data;
+ struct argot_keyword *kwd;
+};
+
+extern int argot_string_convert(void *target, enum argot_data_type type,
+ const char *string,
+ argot_locus_t const *locus);
+extern void argot_process_ident(struct argot_keyword *kwp,
+ argot_value_t *value,
+ void *base,
+ argot_locus_t *locus);
+
+const char *argot_data_type_string(enum argot_data_type type);
+
+int argot_tree_process(struct argot_node *node, struct argot_keyword *kwd);
+int argot_tree_reduce(struct argot_node *node, struct argot_keyword *kwd,
+ int flags);
+
+#endif
diff --git a/include/argot/tree.h b/include/argot/tree.h
new file mode 100644
index 0000000..a3ad5c6
--- a/dev/null
+++ b/include/argot/tree.h
@@ -0,0 +1,71 @@
+/* argot - Gray's Extensible Configuration System -*- c -*-
+ 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef _ARGOT_TREE_H
+#define _ARGOT_TREE_H
+
+#include <argot/node.h>
+
+int argot_tree_free(struct argot_node *node);
+void argot_tree_sort(struct argot_node *node,
+ int (*compare)(struct argot_node const *,
+ struct argot_node const *));
+struct argot_node *argot_tree_first_node(struct argot_node *tree);
+struct argot_node *argot_next_node(struct argot_node *node);
+
+struct argot_node *argot_find_node(struct argot_node *node, const char *path);
+
+enum argot_tree_recurse_op {
+ argot_tree_recurse_set,
+ argot_tree_recurse_pre,
+ argot_tree_recurse_post
+};
+
+enum argot_tree_recurse_res {
+ argot_tree_recurse_ok,
+ argot_tree_recurse_fail,
+ argot_tree_recurse_skip,
+ argot_tree_recurse_stop
+};
+
+typedef enum argot_tree_recurse_res
+ (*argot_tree_recursor_t)(enum argot_tree_recurse_op,
+ struct argot_node *, void *);
+
+int argot_tree_recurse(struct argot_node *node, argot_tree_recursor_t recfun,
+ void *data);
+int argot_tree_join(struct argot_node *dst, struct argot_node *src);
+
+enum argot_tree_recurse_res argot_node_exact_match(
+ enum argot_tree_recurse_op op,
+ struct argot_node *node, void *data);
+
+typedef struct argot_match_buf *argot_match_buf_t;
+struct argot_node *argot_match_first(struct argot_node *tree,
+ const char *pattern,
+ argot_match_buf_t *buf);
+struct argot_node *argot_match_next(struct argot_match_buf *buf);
+void argot_match_buf_free(struct argot_match_buf *buf);
+argot_match_buf_t argot_match_buf_create(int argc, char **argv,
+ struct argot_value **labelv);
+struct argot_node *argot_match_buf_first(struct argot_match_buf *buf,
+ struct argot_node *tree);
+struct argot_node *argot_match_buf_get_node(argot_match_buf_t buf);
+size_t argot_match_buf_get_args(argot_match_buf_t buf, char ***argv);
+struct argot_node *argot_match_buf_get_root(argot_match_buf_t buf);
+void argot_match_buf_set_root(argot_match_buf_t buf, struct argot_node *root);
+
+#endif
diff --git a/include/grecs/txtacc.h b/include/argot/txtacc.h
index d6dc1c4..bdcccbc 100644
--- a/include/grecs/txtacc.h
+++ b/include/argot/txtacc.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,23 +14,23 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_TXTACC_H
-#define _GRECS_TXTACC_H
+#ifndef _ARGOT_TXTACC_H
+#define _ARGOT_TXTACC_H
-#define GRECS_TXTACC_BUFSIZE 1024
-typedef struct grecs_txtacc *grecs_txtacc_t;
+#define ARGOT_TXTACC_BUFSIZE 1024
+typedef struct argot_txtacc *argot_txtacc_t;
-grecs_txtacc_t grecs_txtacc_create(void);
-void grecs_txtacc_free(grecs_txtacc_t);
-void grecs_txtacc_grow(grecs_txtacc_t, const char *, size_t);
-void grecs_txtacc_grow_string(grecs_txtacc_t, const char *);
-void grecs_txtacc_grow_string_escape(grecs_txtacc_t, const char *);
-#define grecs_txtacc_grow_char(acc,c) \
+argot_txtacc_t argot_txtacc_create(void);
+void argot_txtacc_free(argot_txtacc_t);
+void argot_txtacc_grow(argot_txtacc_t, const char *, size_t);
+void argot_txtacc_grow_string(argot_txtacc_t, const char *);
+void argot_txtacc_grow_string_escape(argot_txtacc_t, const char *);
+#define argot_txtacc_grow_char(acc,c) \
do { \
char __ch = c; \
- grecs_txtacc_grow(acc,&__ch,1); \
+ argot_txtacc_grow(acc,&__ch,1); \
} while (0)
-char *grecs_txtacc_finish(grecs_txtacc_t, int);
-void grecs_txtacc_free_string(grecs_txtacc_t, char *);
+char *argot_txtacc_finish(argot_txtacc_t, int);
+void argot_txtacc_free_string(argot_txtacc_t, char *);
#endif
diff --git a/include/grecs/types.h.in b/include/argot/types.h.in
index b891a05..41f6628 100644
--- a/include/grecs/types.h.in
+++ b/include/argot/types.h.in
@@ -1,11 +1,11 @@
-#ifndef _GRECS_TYPES_H
-#define _GRECS_TYPES_H
+#ifndef _ARGOT_TYPES_H
+#define _ARGOT_TYPES_H
-#define GRECS_VERSION_MAJOR 1
-#define GRECS_VERSION_MINOR 0
+#define ARGOT_VERSION_MAJOR 1
+#define ARGOT_VERSION_MINOR 0
-#define GRECS_TREE_API @GRECS_TREE_API@
-#define GRECS_SOCKADDR_LIST @GRECS_SOCKADDR_LIST@
+#define ARGOT_TREE_API @ARGOT_TREE_API@
+#define ARGOT_SOCKADDR_LIST @ARGOT_SOCKADDR_LIST@
#if ENABLE_NLS
# include "gettext.h"
diff --git a/include/grecs/util.h b/include/argot/util.h
index cf3bee1..0208100 100644
--- a/include/grecs/util.h
+++ b/include/argot/util.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,13 +14,13 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_UTIL_H
-#define _GRECS_UTIL_H
+#ifndef _ARGOT_UTIL_H
+#define _ARGOT_UTIL_H
#include <stdarg.h>
-ssize_t grecs_getline(char **pbuf, size_t *psize, FILE *fp);
-int grecs_vasprintf(char **pbuf, size_t *psize, const char *fmt, va_list ap);
-int grecs_asprintf(char **pbuf, size_t *psize, const char *fmt, ...);
+ssize_t argot_getline(char **pbuf, size_t *psize, FILE *fp);
+int argot_vasprintf(char **pbuf, size_t *psize, const char *fmt, va_list ap);
+int argot_asprintf(char **pbuf, size_t *psize, const char *fmt, ...);
#endif
diff --git a/include/grecs/value.h b/include/argot/value.h
index 8cd2800..1bfc8b0 100644
--- a/include/grecs/value.h
+++ b/include/argot/value.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,39 +14,39 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_VALUE_H
-#define _GRECS_VALUE_H
+#ifndef _ARGOT_VALUE_H
+#define _ARGOT_VALUE_H
-#include <grecs/locus.h>
-#include <grecs/list.h>
+#include <argot/locus.h>
+#include <argot/list.h>
-#define GRECS_TYPE_STRING 0
-#define GRECS_TYPE_LIST 1
-#define GRECS_TYPE_ARRAY 2
+#define ARGOT_TYPE_STRING 0
+#define ARGOT_TYPE_LIST 1
+#define ARGOT_TYPE_ARRAY 2
-typedef struct grecs_value {
+typedef struct argot_value {
int type;
- grecs_locus_t locus;
+ argot_locus_t locus;
union {
- grecs_list_ptr_t list;
+ argot_list_ptr_t list;
char *string;
struct {
size_t c;
- struct grecs_value **v;
+ struct argot_value **v;
} arg;
} v;
-} grecs_value_t;
+} argot_value_t;
-#define GRECS_VALUE_EMPTY_P(val) \
+#define ARGOT_VALUE_EMPTY_P(val) \
(!(val) || \
- ((val)->type == GRECS_TYPE_STRING && (val)->v.string == NULL))
+ ((val)->type == ARGOT_TYPE_STRING && (val)->v.string == NULL))
-void grecs_value_free(struct grecs_value *val);
-void grecs_value_free_content(struct grecs_value *val);
-grecs_value_t *grecs_value_ptr_from_static(grecs_value_t *input);
+void argot_value_free(struct argot_value *val);
+void argot_value_free_content(struct argot_value *val);
+argot_value_t *argot_value_ptr_from_static(argot_value_t *input);
-int grecs_value_eq(struct grecs_value *a, struct grecs_value *b);
-int grecs_value_match(struct grecs_value *pat, struct grecs_value *b,
+int argot_value_eq(struct argot_value *a, struct argot_value *b);
+int argot_value_match(struct argot_value *pat, struct argot_value *b,
int flags);
#endif
diff --git a/include/grecs/version.h b/include/argot/version.h
index f37adc6..bfbcd97 100644
--- a/include/grecs/version.h
+++ b/include/argot/version.h
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
+/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -14,10 +14,10 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef _GRECS_VERSION_H
-#define _GRECS_VERSION_H
+#ifndef _ARGOT_VERSION_H
+#define _ARGOT_VERSION_H
-struct grecs_version_info {
+struct argot_version_info {
const char *package;
const char *version;
const char *id;
@@ -28,13 +28,13 @@ struct grecs_version_info {
char *buffer;
};
-struct grecs_version_info *grecs_version(void);
-int grecs_version_cmp(const char *, const char *, int *);
-int grecs_version_ok(const char *);
-void grecs_version_info_free(struct grecs_version_info *);
-struct grecs_version_info *grecs_version_split(const char *);
-int grecs_version_info_cmp(struct grecs_version_info *,
- struct grecs_version_info *,
+struct argot_version_info *argot_version(void);
+int argot_version_cmp(const char *, const char *, int *);
+int argot_version_ok(const char *);
+void argot_version_info_free(struct argot_version_info *);
+struct argot_version_info *argot_version_split(const char *);
+int argot_version_info_cmp(struct argot_version_info *,
+ struct argot_version_info *,
int *);
#endif
diff --git a/include/grecs/Makefile.am b/include/grecs/Makefile.am
deleted file mode 100644
index e81bd21..0000000
--- a/include/grecs/Makefile.am
+++ b/dev/null
@@ -1,43 +0,0 @@
-GRECS_PKG_HDR =\
- doc.h\
- error.h\
- format.h\
- lex.h\
- list.h\
- locus.h\
- mem.h\
- node.h\
- opt.h\
- parser.h\
- preproc.h\
- sockaddr.h\
- symtab.h\
- table.h\
- tree.h\
- txtacc.h\
- types.h\
- util.h\
- value.h\
- version.h
-
-if GRECS_COND_JSON
- GRECS_PKG_HDR += json.h
-endif
-
-if GRECS_COND_BUILD_INSTALL
- grecsincludedir = @GRECS_INCLUDE_DIR@
- grecsinclude_HEADERS = $(GRECS_PKG_HDR)
-endif
-
-if GRECS_COND_BUILD_SHARED
-if GRECS_COND_INSTALLHEADERS
- grecsincludedir = @GRECS_INCLUDE_DIR@
- grecsinclude_HEADERS = $(GRECS_PKG_HDR)
-else
- noinst_HEADERS = $(GRECS_PKG_HDR)
-endif
-endif
-
-if GRECS_COND_BUILD_STATIC
- noinst_HEADERS = $(GRECS_PKG_HDR)
-endif
diff --git a/include/grecs/format.h b/include/grecs/format.h
deleted file mode 100644
index 7ac8458..0000000
--- a/include/grecs/format.h
+++ b/dev/null
@@ -1,62 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_FORMAT_H
-#define _GRECS_FORMAT_H
-
-#include <grecs/value.h>
-#include <grecs/locus.h>
-#include <grecs/node.h>
-#include <grecs/txtacc.h>
-
-struct grecs_format_closure {
- int (*fmtfun)(const char *, void *);
- void *data;
-};
-
-void grecs_format_locus(grecs_locus_t *locus, struct grecs_format_closure *fp);
-void grecs_format_node_path(struct grecs_node *node, int flag,
- struct grecs_format_closure *fp);
-void grecs_format_value(struct grecs_value *val, int flags,
- struct grecs_format_closure *fp);
-
-#define GRECS_NODE_FLAG_PATH 0x00100
-#define GRECS_NODE_FLAG_VALUE 0x00200
-#define GRECS_NODE_FLAG_DESCEND 0x01000
-#define GRECS_NODE_FLAG_LOCUS 0x02000
-#define GRECS_NODE_FLAG_QUOTE 0x04000
-#define GRECS_NODE_FLAG_NOQUOTE 0x08000
-#define GRECS_NODE_FLAG_QUOTE_HEX 0x10000
-
-#define _GRECS_NODE_MASK_DELIM 0x000ff
-#define _GRECS_NODE_MASK_OUTPUT 0x00f00
-
-#define GRECS_NODE_FLAG_DEFAULT \
- (GRECS_NODE_FLAG_PATH|GRECS_NODE_FLAG_VALUE|\
- GRECS_NODE_FLAG_DESCEND|GRECS_NODE_FLAG_QUOTE)
-int grecs_format_node(struct grecs_node *node, int flags,
- struct grecs_format_closure *fp);
-
-void grecs_print_locus(grecs_locus_t *locus, FILE *fp);
-void grecs_print_node_path(struct grecs_node *node, int flag, FILE *fp);
-void grecs_print_value(struct grecs_value *val, int flags, FILE *fp);
-
-int grecs_print_node(struct grecs_node *node, int flags, FILE *fp);
-
-void grecs_txtacc_format_value(struct grecs_value *val, int flags,
- grecs_txtacc_t acc);
-
-#endif
diff --git a/include/grecs/lex.h b/include/grecs/lex.h
deleted file mode 100644
index ecd9a5b..0000000
--- a/include/grecs/lex.h
+++ b/dev/null
@@ -1,52 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_LEX_H
-#define _GRECS_LEX_H
-
-int grecs_lex_begin(const char*, int);
-void grecs_lex_end(int err);
-
-char *grecs_install_text(const char *str);
-void grecs_destroy_text(void);
-struct grecs_symtab *grecs_text_table(void);
-
-void grecs_parse_line_directive(char *text, grecs_locus_t *ploc,
- struct grecs_locus_point *ppoint,
- size_t *pxlines);
-void grecs_parse_line_directive_cpp(char *text, grecs_locus_t *ploc,
- struct grecs_locus_point *ppoint,
- size_t *pxlines);
-
-void grecs_line_acc_create(void);
-void grecs_line_acc_free(void);
-void grecs_line_acc_grow_char(int c);
-int grecs_line_acc_grow_char_unescape(int c);
-void grecs_line_acc_grow(const char *text, size_t len);
-void grecs_line_acc_grow_unescape_last(char *text, size_t len,
- grecs_locus_t const *loc);
-
-void grecs_line_begin(void);
-#define grecs_line_add grecs_line_acc_grow
-char *grecs_line_finish(void);
-
-int grecs_str_is_ipv4(const char *addr);
-int grecs_str_is_num(const char *s);
-int grecs_str_is_ipv6(const char *addr);
-int grecs_str_is_num(const char *s);
-int grecs_str_is_ipaddr(const char *addr);
-
-#endif
diff --git a/include/grecs/list.h b/include/grecs/list.h
deleted file mode 100644
index a5840db..0000000
--- a/include/grecs/list.h
+++ b/dev/null
@@ -1,54 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_LIST_H
-#define _GRECS_LIST_H
-
-typedef struct grecs_list_entry *grecs_list_entry_ptr_t;
-typedef struct grecs_list *grecs_list_ptr_t;
-
-struct grecs_list_entry {
- struct grecs_list_entry *next, *prev;
- void *data;
-};
-
-struct grecs_list {
- struct grecs_list_entry *head, *tail;
- size_t count;
- int (*cmp)(const void *, const void *);
- void (*free_entry)(void *);
-};
-
-grecs_list_ptr_t grecs_list_create(void);
-size_t grecs_list_size(grecs_list_ptr_t);
-void grecs_list_append(grecs_list_ptr_t, void *);
-void grecs_list_push(grecs_list_ptr_t, void *);
-void *grecs_list_pop(grecs_list_ptr_t);
-void *grecs_list_locate(grecs_list_ptr_t, void *);
-void *grecs_list_index(grecs_list_ptr_t, size_t);
-void *grecs_list_remove_tail(grecs_list_ptr_t);
-void grecs_list_remove_entry(grecs_list_ptr_t, grecs_list_entry_ptr_t);
-void grecs_list_clear(grecs_list_ptr_t);
-void grecs_list_free(grecs_list_ptr_t);
-void grecs_list_add(grecs_list_ptr_t, grecs_list_ptr_t);
-int grecs_list_compare(grecs_list_ptr_t, grecs_list_ptr_t);
-
-/* FIXME */
-struct grecs_list *_grecs_simple_list_create(int dispose);
-struct grecs_list *grecs_value_list_create(void);
-
-
-#endif
diff --git a/include/grecs/node.h b/include/grecs/node.h
deleted file mode 100644
index 2d879ad..0000000
--- a/include/grecs/node.h
+++ b/dev/null
@@ -1,62 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_NODE_H
-#define _GRECS_NODE_H
-
-#include <grecs/locus.h>
-#include <grecs/symtab.h>
-#include <grecs/value.h>
-
-enum grecs_node_type {
- grecs_node_root,
- grecs_node_stmt,
- grecs_node_block
-};
-
-typedef struct grecs_node {
- enum grecs_node_type type;
- grecs_locus_t locus;
- struct grecs_node *up;
- struct grecs_node *down;
- struct grecs_node *next;
- struct grecs_node *prev;
- char *ident;
- grecs_locus_t idloc;
- union {
- grecs_value_t *value;
- grecs_symtab_ptr_t texttab;
- } v;
-} grecs_node_t;
-
-void grecs_node_free(struct grecs_node *node);
-struct grecs_node *grecs_node_create(enum grecs_node_type type,
- grecs_locus_t *loc);
-struct grecs_node *grecs_node_create_points(enum grecs_node_type type,
- struct grecs_locus_point beg,
- struct grecs_locus_point end);
-void grecs_node_bind(struct grecs_node *master, struct grecs_node *node,
- int dn);
-int grecs_node_eq(struct grecs_node *a, struct grecs_node *b);
-int grecs_node_unlink(struct grecs_node *node);
-
-struct grecs_node *grecs_node_from_path(const char *path, const char *value);
-struct grecs_node *grecs_node_from_path_locus(const char *path,
- const char *value,
- grecs_locus_t *locus,
- grecs_locus_t *vallocus);
-
-#endif
diff --git a/include/grecs/parser.h b/include/grecs/parser.h
deleted file mode 100644
index 41b3ae4..0000000
--- a/include/grecs/parser.h
+++ b/dev/null
@@ -1,56 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_PARSER_H
-#define _GRECS_PARSER_H
-
-typedef struct grecs_node *(*grecs_parser_t)(const char *name, int trace);
-
-#define GRECS_TRACE_GRAM 0x01
-#define GRECS_TRACE_LEX 0x02
-
-extern int grecs_trace_flags;
-extern grecs_parser_t grecs_parser_fun;
-extern int grecs_default_port;
-
-extern struct grecs_locus_point grecs_current_locus_point;
-extern grecs_locus_t grecs_locus;
-extern int grecs_error_count;
-
-#define GRECS_OPTION_ADJUST_STRING_LOCATIONS 0x01
-#define GRECS_OPTION_QUOTED_STRING_CONCAT 0x02
-extern int grecs_parser_options;
-
-/* Main entry point */
-struct grecs_node *grecs_parse(const char *name);
-void grecs_gram_trace(int n);
-void grecs_lex_trace(int n);
-
-/* Parsers: */
-struct grecs_node *grecs_grecs_parser(const char *name, int traceflags);
-struct grecs_node *grecs_meta1_parser(const char *name, int traceflags);
-struct grecs_node *grecs_bind_parser(const char *name, int traceflags);
-struct grecs_node *grecs_dhcpd_parser(const char *name, int traceflags);
-struct grecs_node *grecs_git_parser(const char *name, int traceflags);
-struct grecs_node *grecs_path_parser(const char *name, int traceflags);
-
-
-/* Parser database */
-int grecs_enumerate_parsers(int (*fun)(const char *, grecs_parser_t, void *),
- void *);
-grecs_parser_t grecs_get_parser_by_type(const char *type);
-
-#endif
diff --git a/include/grecs/preproc.h b/include/grecs/preproc.h
deleted file mode 100644
index 798e879..0000000
--- a/include/grecs/preproc.h
+++ b/dev/null
@@ -1,46 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_PREPROC_H
-#define _GRECS_PREPROC_H
-
-#include <sys/types.h>
-
-extern const char *grecs_preprocessor;
-
-size_t grecs_preproc_fill_buffer(char *buf, size_t size);
-void grecs_preproc_add_include_dir(char *dir);
-int grecs_preproc_init(const char *name);
-void grecs_preproc_done(void);
-int grecs_preproc_run(const char *config_file, const char *extpp);
-
-#define GRECS_STD_INCLUDE 0x01
-#define GRECS_USR_INCLUDE 0x02
-
-size_t grecs_include_path_count(int flag);
-int grecs_foreach_include_dir(int flag, int (*fun)(int, const char *, void *),
- void *data);
-
-char *grecs_find_include_file(const char *name, int allow_cwd);
-
-FILE *grecs_preproc_extrn_start(const char *file, pid_t *ppid);
-void grecs_preproc_extrn_shutdown(pid_t pid);
-
-void grecs_include_path_clear(void);
-void grecs_include_path_setup(const char *dir, ...);
-void grecs_include_path_setup_v(char **dirs);
-
-#endif
diff --git a/include/grecs/sockaddr.h b/include/grecs/sockaddr.h
deleted file mode 100644
index c8a3de2..0000000
--- a/include/grecs/sockaddr.h
+++ b/dev/null
@@ -1,66 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_SOCKADDR_H
-#define _GRECS_SOCKADDR_H
-
-struct grecs_sockaddr {
-#if GRECS_SOCKADDR_LIST
- struct grecs_sockaddr *next;
-#endif
- int len;
- struct sockaddr *sa;
-};
-
-#if GRECS_SOCKADDR_LIST
-
-#define GRECS_AH_PASSIVE 0x01
-#define GRECS_HINT_SERVICE 0x02
-#define GRECS_HINT_PORT 0x04
-
-struct grecs_sockaddr_hints {
- int flags;
- char *service;
- unsigned short port;
-};
-
-extern struct grecs_sockaddr_hints *grecs_sockaddr_hints;
-
-struct grecs_sockaddr *grecs_sockaddr_new(size_t s);
-void grecs_sockaddr_free(struct grecs_sockaddr *p);
-
-int grecs_str_to_sockaddr(struct grecs_sockaddr **sap,
- const char *arg, struct grecs_sockaddr_hints *gh,
- grecs_locus_t const *locus);
-#endif
-
-#define GRECS_INADDR_BYTES 16
-
-struct grecs_cidr
-{
- int family;
- int len;
- unsigned char address[GRECS_INADDR_BYTES];
- unsigned char netmask[GRECS_INADDR_BYTES];
-};
-
-int grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
- grecs_locus_t const *locus);
-
-int grecs_sockaddr_to_cidr(struct grecs_cidr *cidr, const struct sockaddr *sa);
-int grecs_sockadd_cidr_match(struct sockaddr *sa, struct grecs_cidr *cidr);
-
-#endif
diff --git a/include/grecs/symtab.h b/include/grecs/symtab.h
deleted file mode 100644
index 3008b17..0000000
--- a/include/grecs/symtab.h
+++ b/dev/null
@@ -1,53 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_SYMTAB_H
-#define _GRECS_SYMTAB_H
-
-typedef struct grecs_symtab *grecs_symtab_ptr_t;
-typedef struct grecs_syment *grecs_syment_ptr_t;
-
-struct grecs_syment {
- char *name;
-};
-
-typedef int (*grecs_symtab_enumerator_t)(void *sym, void *data);
-
-const char *grecs_symtab_strerror(int rc);
-
-void *grecs_symtab_lookup_or_install(grecs_symtab_ptr_t st,
- void *key, int *install);
-void grecs_symtab_clear(grecs_symtab_ptr_t st);
-grecs_symtab_ptr_t grecs_symtab_create(size_t elsize,
- unsigned (*hash_fun)(void *, unsigned long),
- int (*cmp_fun)(const void *, const void *),
- int (*copy_fun)(void *, void *),
- void *(*alloc_fun)(size_t),
- void (*free_fun)(void *));
-grecs_symtab_ptr_t grecs_symtab_create_default(size_t elsize);
-
-void grecs_symtab_free(grecs_symtab_ptr_t pst);
-int grecs_symtab_remove(grecs_symtab_ptr_t st, void *elt);
-int grecs_symtab_replace(grecs_symtab_ptr_t st, void *ent, void **old_ent);
-int grecs_symtab_enumerate(grecs_symtab_ptr_t st,
- grecs_symtab_enumerator_t fun, void *data);
-
-size_t grecs_symtab_count_entries(grecs_symtab_ptr_t st);
-
-unsigned grecs_hash_string(const char *name, unsigned long hashsize);
-unsigned grecs_hash_string_ci(const char *name, unsigned long hashsize);
-
-#endif
diff --git a/include/grecs/table.h b/include/grecs/table.h
deleted file mode 100644
index d7d0a8c..0000000
--- a/include/grecs/table.h
+++ b/dev/null
@@ -1,102 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_TABLE_H
-#define _GRECS_TABLE_H
-
-#include <grecs/node.h>
-
-enum grecs_data_type {
- grecs_type_void,
- grecs_type_string,
- grecs_type_short,
- grecs_type_ushort,
- grecs_type_int,
- grecs_type_uint,
- grecs_type_long,
- grecs_type_ulong,
- grecs_type_size,
-/* grecs_type_off,*/
- grecs_type_time,
- grecs_type_bool,
- grecs_type_ipv4,
- grecs_type_cidr,
- grecs_type_host,
- grecs_type_sockaddr,
- grecs_type_section,
- grecs_type_null
-};
-
-#define GRECS_DFLT 0x00 /* Default keyword flags */
-#define GRECS_AGGR 0x01 /* Multiple entries aggregate */
-#define GRECS_MULT 0x02 /* Statement can appear multiple times */
-#define GRECS_INAC 0x04 /* Inactive keyword */
-#define GRECS_LIST 0x08 /* Value is a list of declared type */
-#define GRECS_HIDDEN 0x10 /* Hidden keyword: don't display in help output */
-#define GRECS_CONST 0x20 /* For string types: initial value is constant,
- don't try to free it before assigning new value.
- This flag is cleared after the first assignment.
- */
-
-enum grecs_callback_command {
- grecs_callback_section_begin,
- grecs_callback_section_end,
- grecs_callback_set_value
-};
-
-typedef int (*grecs_callback_fn)(
-#if GRECS_TREE_API
- enum grecs_callback_command cmd,
- grecs_node_t * /* node */,
- void * /* varptr */,
- void * /* cb_data */
-#else
- enum grecs_callback_command cmd,
- grecs_locus_t * /* locus */,
- void * /* varptr */,
- grecs_value_t * /* value */,
- void * /* cb_data */
-#endif
- );
-
-struct grecs_keyword {
- const char *ident;
- const char *argname;
- const char *docstring;
- enum grecs_data_type type;
- int flags;
- void *varptr;
- size_t offset;
- grecs_callback_fn callback;
- void *callback_data;
- struct grecs_keyword *kwd;
-};
-
-extern int grecs_string_convert(void *target, enum grecs_data_type type,
- const char *string,
- grecs_locus_t const *locus);
-extern void grecs_process_ident(struct grecs_keyword *kwp,
- grecs_value_t *value,
- void *base,
- grecs_locus_t *locus);
-
-const char *grecs_data_type_string(enum grecs_data_type type);
-
-int grecs_tree_process(struct grecs_node *node, struct grecs_keyword *kwd);
-int grecs_tree_reduce(struct grecs_node *node, struct grecs_keyword *kwd,
- int flags);
-
-#endif
diff --git a/include/grecs/tree.h b/include/grecs/tree.h
deleted file mode 100644
index 2fb26dd..0000000
--- a/include/grecs/tree.h
+++ b/dev/null
@@ -1,71 +0,0 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*-
- 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 of the License, 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef _GRECS_TREE_H
-#define _GRECS_TREE_H
-
-#include <grecs/node.h>
-
-int grecs_tree_free(struct grecs_node *node);
-void grecs_tree_sort(struct grecs_node *node,
- int (*compare)(struct grecs_node const *,
- struct grecs_node const *));
-struct grecs_node *grecs_tree_first_node(struct grecs_node *tree);
-struct grecs_node *grecs_next_node(struct grecs_node *node);
-
-struct grecs_node *grecs_find_node(struct grecs_node *node, const char *path);
-
-enum grecs_tree_recurse_op {
- grecs_tree_recurse_set,
- grecs_tree_recurse_pre,
- grecs_tree_recurse_post
-};
-
-enum grecs_tree_recurse_res {
- grecs_tree_recurse_ok,
- grecs_tree_recurse_fail,
- grecs_tree_recurse_skip,
- grecs_tree_recurse_stop
-};
-
-typedef enum grecs_tree_recurse_res
- (*grecs_tree_recursor_t)(enum grecs_tree_recurse_op,
- struct grecs_node *, void *);
-
-int grecs_tree_recurse(struct grecs_node *node, grecs_tree_recursor_t recfun,
- void *data);
-int grecs_tree_join(struct grecs_node *dst, struct grecs_node *src);
-
-enum grecs_tree_recurse_res grecs_node_exact_match(
- enum grecs_tree_recurse_op op,
- struct grecs_node *node, void *data);
-
-typedef struct grecs_match_buf *grecs_match_buf_t;
-struct grecs_node *grecs_match_first(struct grecs_node *tree,
- const char *pattern,
- grecs_match_buf_t *buf);
-struct grecs_node *grecs_match_next(struct grecs_match_buf *buf);
-void grecs_match_buf_free(struct grecs_match_buf *buf);
-grecs_match_buf_t grecs_match_buf_create(int argc, char **argv,
- struct grecs_value **labelv);
-struct grecs_node *grecs_match_buf_first(struct grecs_match_buf *buf,
- struct grecs_node *tree);
-struct grecs_node *grecs_match_buf_get_node(grecs_match_buf_t buf);
-size_t grecs_match_buf_get_args(grecs_match_buf_t buf, char ***argv);
-struct grecs_node *grecs_match_buf_get_root(grecs_match_buf_t buf);
-void grecs_match_buf_set_root(grecs_match_buf_t buf, struct grecs_node *root);
-
-#endif
diff --git a/src/.gitignore b/src/.gitignore
index 11738ff..a9f3828 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -2,10 +2,10 @@ dhcpd-gram.c
dhcpd-gram.h
dhcpd-gram.output
dhcpd-lex.c
-grecs-gram.c
-grecs-gram.h
-grecs-gram.output
-grecs-lex.c
+argot-gram.c
+argot-gram.h
+argot-gram.output
+argot-lex.c
meta1-gram.c
meta1-gram.h
meta1-gram.output
@@ -14,7 +14,7 @@ bind-gram.c
bind-gram.h
bind-gram.output
bind-lex.c
-grecs.h
+argot.h
Make-inst.in
Make-shared.in
Make-static.in
diff --git a/src/Make-inst.am b/src/Make-inst.am
index a4b6aea..97c1f3c 100644
--- a/src/Make-inst.am
+++ b/src/Make-inst.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,7 +15,7 @@
# along with Grecs. If not, see <http://www.gnu.org/licenses/>.
include Make.am
-lib_LTLIBRARIES=libgrecs.la
-libgrecs_la_SOURCES = $(GRECS_SRC)
+lib_LTLIBRARIES=libargot.la
+libargot_la_SOURCES = $(ARGOT_SRC)
m4datadir = $(datadir)/aclocal
-dist_m4data_DATA = libgrecs.m4
+dist_m4data_DATA = libargot.m4
diff --git a/src/Make-shared.am b/src/Make-shared.am
index 9a762a4..c36b670 100644
--- a/src/Make-shared.am
+++ b/src/Make-shared.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
@@ -14,6 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with Grecs. If not, see <http://www.gnu.org/licenses/>.
include Make.am
-noinst_LTLIBRARIES=libgrecs.la
-libgrecs_la_SOURCES = $(GRECS_SRC)
+noinst_LTLIBRARIES=libargot.la
+libargot_la_SOURCES = $(ARGOT_SRC)
diff --git a/src/Make-static.am b/src/Make-static.am
index 2688b40..1648117 100644
--- a/src/Make-static.am
+++ b/src/Make-static.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
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with Grecs. If not, see <http://www.gnu.org/licenses/>.
include Make.am
-noinst_LIBRARIES=libgrecs.a
-libgrecs_a_SOURCES = $(GRECS_SRC)
+noinst_LIBRARIES=libargot.a
+libargot_a_SOURCES = $(ARGOT_SRC)
diff --git a/src/Make.am b/src/Make.am
index 227973e..51d3429 100644
--- a/src/Make.am
+++ b/src/Make.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
@@ -16,41 +16,41 @@
PARSER_DEFS =
-if GRECS_COND_META1_PARSER
- GRECS_PARSER_META1 = meta1-gram.y meta1-lex.l
- GRECS_EXTRA_META1 = meta1-gram.h
+if ARGOT_COND_META1_PARSER
+ ARGOT_PARSER_META1 = meta1-gram.y meta1-lex.l
+ ARGOT_EXTRA_META1 = meta1-gram.h
PARSER_DEFS += -DENABLE_META1_PARSER
endif
-if GRECS_COND_BIND_PARSER
- GRECS_PARSER_BIND = bind-gram.y bind-lex.l
- GRECS_EXTRA_BIND = bind-gram.h
+if ARGOT_COND_BIND_PARSER
+ ARGOT_PARSER_BIND = bind-gram.y bind-lex.l
+ ARGOT_EXTRA_BIND = bind-gram.h
PARSER_DEFS += -DENABLE_BIND_PARSER
endif
-if GRECS_COND_DHCPD_PARSER
- GRECS_PARSER_DHCPD = dhcpd-gram.y dhcpd-lex.l
- GRECS_EXTRA_DHCPD = dhcpd-gram.h
+if ARGOT_COND_DHCPD_PARSER
+ ARGOT_PARSER_DHCPD = dhcpd-gram.y dhcpd-lex.l
+ ARGOT_EXTRA_DHCPD = dhcpd-gram.h
PARSER_DEFS += -DENABLE_DHCPD_PARSER
endif
-if GRECS_COND_GIT_PARSER
- GRECS_PARSER_GIT = git-parser.c
+if ARGOT_COND_GIT_PARSER
+ ARGOT_PARSER_GIT = git-parser.c
PARSER_DEFS += -DENABLE_GIT_PARSER
endif
-if GRECS_COND_JSON
- GRECS_JSON = json-gram.y json-lex.l jsonfmt.c
- GRECS_EXTRA_JSON = json-gram.h
+if ARGOT_COND_JSON
+ ARGOT_JSON = json-gram.y json-lex.l jsonfmt.c
+ ARGOT_EXTRA_JSON = json-gram.h
endif
-GRECS_SRC = \
+ARGOT_SRC = \
asprintf.c\
cidr.c\
diag.c\
format.c\
- grecs-gram.y\
- grecs-lex.l\
+ argot-gram.y\
+ argot-lex.l\
ipstr.c\
join.c\
lineacc.c\
@@ -69,30 +69,30 @@ GRECS_SRC = \
txtacc.c\
version.c\
wordsplit.c\
- $(GRECS_JSON)\
- $(GRECS_PARSER_BIND)\
- $(GRECS_PARSER_DHCPD)\
- $(GRECS_PARSER_GIT)\
- $(GRECS_PARSER_META1)
+ $(ARGOT_JSON)\
+ $(ARGOT_PARSER_BIND)\
+ $(ARGOT_PARSER_DHCPD)\
+ $(ARGOT_PARSER_GIT)\
+ $(ARGOT_PARSER_META1)
-if GRECS_COND_SOCKADDR_LIST
- GRECS_SRC += sockaddr.c
+if ARGOT_COND_SOCKADDR_LIST
+ ARGOT_SRC += sockaddr.c
endif
EXTRA_DIST=\
- grecs-gram.h\
- $(GRECS_EXTRA_BIND)\
- $(GRECS_EXTRA_DHCPD)\
- $(GRECS_EXTRA_JSON)\
- $(GRECS_EXTRA_META1)\
+ argot-gram.h\
+ $(ARGOT_EXTRA_BIND)\
+ $(ARGOT_EXTRA_DHCPD)\
+ $(ARGOT_EXTRA_JSON)\
+ $(ARGOT_EXTRA_META1)\
$(PP_SETUP_FILE)\
Make.am Make-inst.am Make-shared.am Make-static.am
AM_CPPFLAGS = \
-I$(srcdir)\
- -I$(top_srcdir)/@GRECS_SUBDIR@\
- @GRECS_INCLUDES@\
- @GRECS_HOST_PROJECT_INCLUDES@\
+ -I$(top_srcdir)/@ARGOT_SUBDIR@\
+ @ARGOT_INCLUDES@\
+ @ARGOT_HOST_PROJECT_INCLUDES@\
$(PARSER_DEFS)
AM_YFLAGS = -dtv
AM_LFLAGS = -d
@@ -100,8 +100,8 @@ AM_LFLAGS = -d
incdir=$(pkgdatadir)/$(VERSION)/include
inc_DATA = $(PP_SETUP_FILE)
-LEXCOMPILE = $(top_srcdir)/@GRECS_SUBDIR@/build-aux/yyrename '$(LEX) $(LFLAGS) $(AM_LFLAGS)'
-YACCCOMPILE = $(top_srcdir)/@GRECS_SUBDIR@/build-aux/yyrename '$(YACC) $(YFLAGS) $(AM_YFLAGS)'
+LEXCOMPILE = $(top_srcdir)/@ARGOT_SUBDIR@/build-aux/yyrename '$(LEX) $(LFLAGS) $(AM_LFLAGS)'
+YACCCOMPILE = $(top_srcdir)/@ARGOT_SUBDIR@/build-aux/yyrename '$(YACC) $(YFLAGS) $(AM_YFLAGS)'
diff --git a/src/grecs-gram.y b/src/argot-gram.y
index 05ed2f5..b92794c 100644
--- a/src/grecs-gram.y
+++ b/src/argot-gram.y
@@ -1,5 +1,5 @@
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -18,8 +18,8 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
-#include <grecs-gram.h>
+#include <argot.h>
+#include <argot-gram.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
@@ -28,7 +28,7 @@
int yylex(void);
int yyerror(char const *s);
-static struct grecs_node *parse_tree;
+static struct argot_node *parse_tree;
%}
%error-verbose
@@ -36,11 +36,11 @@ static struct grecs_node *parse_tree;
%union {
char *string;
- grecs_value_t svalue, *pvalue;
- struct grecs_list *list;
- struct grecs_node *node;
- grecs_locus_t locus;
- struct { struct grecs_node *head, *tail; } node_list;
+ argot_value_t svalue, *pvalue;
+ struct argot_list *list;
+ struct argot_node *node;
+ argot_locus_t locus;
+ struct { struct argot_node *head, *tail; } node_list;
}
%token <string> STRING QSTRING MSTRING IDENT
@@ -56,9 +56,9 @@ static struct grecs_node *parse_tree;
input : maybe_stmtlist
{
- parse_tree = grecs_node_create(grecs_node_root, &@1);
- parse_tree->v.texttab = grecs_text_table();
- grecs_node_bind(parse_tree, $1, 1);
+ parse_tree = argot_node_create(argot_node_root, &@1);
+ parse_tree->v.texttab = argot_text_table();
+ argot_node_bind(parse_tree, $1, 1);
}
;
@@ -79,7 +79,7 @@ stmtlist: stmt
}
| stmtlist stmt
{
- grecs_node_bind($1.tail, $2, 0);
+ argot_node_bind($1.tail, $2, 0);
}
;
@@ -89,7 +89,7 @@ stmt : simple
simple : IDENT vallist ';'
{
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @2.end);
$$->ident = $1;
$$->idloc = @1;
@@ -97,7 +97,7 @@ simple : IDENT vallist ';'
}
| IDENT ';'
{
- $$ = grecs_node_create(grecs_node_stmt, &@1);
+ $$ = argot_node_create(argot_node_stmt, &@1);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = NULL;
@@ -106,12 +106,12 @@ simple : IDENT vallist ';'
block : IDENT tag '{' stmtlist '}' opt_sc
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @5.end);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = $2;
- grecs_node_bind($$, $4.head, 1);
+ argot_node_bind($$, $4.head, 1);
}
;
@@ -126,52 +126,52 @@ vallist : vlist
{
size_t n;
- if ((n = grecs_list_size($1)) == 1) {
- $$ = grecs_list_index($1, 0);
+ if ((n = argot_list_size($1)) == 1) {
+ $$ = argot_list_index($1, 0);
} else {
size_t i;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_ARRAY;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_ARRAY;
$$->locus = @1;
$$->v.arg.c = n;
- $$->v.arg.v = grecs_calloc(n,
+ $$->v.arg.v = argot_calloc(n,
sizeof($$->v.arg.v[0]));
for (i = 0, ep = $1->head; ep; i++, ep = ep->next)
$$->v.arg.v[i] = ep->data;
}
$1->free_entry = NULL;
- grecs_list_free($1);
+ argot_list_free($1);
}
;
vlist : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, grecs_value_ptr_from_static(&$1));
+ $$ = argot_value_list_create();
+ argot_list_append($$, argot_value_ptr_from_static(&$1));
}
| vlist value
{
- grecs_list_append($1, grecs_value_ptr_from_static(&$2));
+ argot_list_append($1, argot_value_ptr_from_static(&$2));
}
;
value : string
{
- $$.type = GRECS_TYPE_STRING;
+ $$.type = ARGOT_TYPE_STRING;
$$.locus = @1;
$$.v.string = $1;
}
| list
{
- $$.type = GRECS_TYPE_LIST;
+ $$.type = ARGOT_TYPE_LIST;
$$.locus = @1;
$$.v.list = $1;
}
| MSTRING
{
- $$.type = GRECS_TYPE_STRING;
+ $$.type = ARGOT_TYPE_STRING;
$$.locus = @1;
$$.v.string = $1;
}
@@ -184,27 +184,27 @@ string : STRING
slist : slist0
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- grecs_line_begin();
+ argot_line_begin();
for (ep = $1->head; ep; ep = ep->next) {
- grecs_line_add(ep->data, strlen(ep->data));
+ argot_line_add(ep->data, strlen(ep->data));
free(ep->data);
ep->data = NULL;
}
- $$ = grecs_line_finish();
- grecs_list_free($1);
+ $$ = argot_line_finish();
+ argot_list_free($1);
}
;
slist0 : QSTRING
{
- $$ = grecs_list_create();
- grecs_list_append($$, $1);
+ $$ = argot_list_create();
+ argot_list_append($$, $1);
}
| slist0 QSTRING
{
- grecs_list_append($1, $2);
+ argot_list_append($1, $2);
$$ = $1;
}
;
@@ -225,12 +225,12 @@ list : '(' ')'
values : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, grecs_value_ptr_from_static(&$1));
+ $$ = argot_value_list_create();
+ argot_list_append($$, argot_value_ptr_from_static(&$1));
}
| values ',' value
{
- grecs_list_append($1, grecs_value_ptr_from_static(&$3));
+ argot_list_append($1, argot_value_ptr_from_static(&$3));
$$ = $1;
}
;
@@ -244,24 +244,24 @@ opt_sc : /* empty */
int
yyerror(char const *s)
{
- grecs_error(&yylloc, 0, "%s", s);
+ argot_error(&yylloc, 0, "%s", s);
return 0;
}
-struct grecs_node *
-grecs_grecs_parser(const char *name, int traceflags)
+struct argot_node *
+argot_argot_parser(const char *name, int traceflags)
{
int rc;
- if (grecs_lex_begin(name, traceflags & GRECS_TRACE_LEX))
+ if (argot_lex_begin(name, traceflags & ARGOT_TRACE_LEX))
return NULL;
- yydebug = traceflags & GRECS_TRACE_GRAM;
+ yydebug = traceflags & ARGOT_TRACE_GRAM;
parse_tree = NULL;
rc = yyparse();
- if (grecs_error_count)
+ if (argot_error_count)
rc = 1;
- grecs_lex_end(rc);
+ argot_lex_end(rc);
if (rc) {
- grecs_tree_free(parse_tree);
+ argot_tree_free(parse_tree);
parse_tree = NULL;
}
return parse_tree;
diff --git a/src/grecs-lex.l b/src/argot-lex.l
index f7be62f..c0ffc7e 100644
--- a/src/grecs-lex.l
+++ b/src/argot-lex.l
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*- */
+/* argot - Gray's Extensible Configuration System -*- c -*- */
%option nounput
%option noinput
%top {
@@ -7,7 +7,7 @@
#endif
}
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#include <grecs.h>
-#include <grecs-gram.h>
+#include <argot.h>
+#include <argot-gram.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
@@ -39,7 +39,7 @@ static int multiline_unescape; /* Unescape here-document contents */
static int (*char_to_strip)(char); /* Strip matching characters of each
here-document line */
-struct grecs_locus_point grecs_current_locus_point; /* Input file location */
+struct argot_locus_point argot_current_locus_point; /* Input file location */
/* Line correction. Equals to the number of #line directives inserted into
the input by the preprocessor instance. The external preprocessor, if
any, counts these as input lines and therefore the line numbers in *its*
@@ -57,25 +57,25 @@ static int isemptystr(int off);
static void qstring_locus_fixup(void);
#define qstring() \
- ((grecs_parser_options & GRECS_OPTION_QUOTED_STRING_CONCAT) \
+ ((argot_parser_options & ARGOT_OPTION_QUOTED_STRING_CONCAT) \
? QSTRING : STRING)
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
do { \
- if (grecs_preprocessor) \
+ if (argot_preprocessor) \
result = fread(buf, 1, max_size, yyin); \
else \
- result = grecs_preproc_fill_buffer(buf, max_size); \
+ result = argot_preproc_fill_buffer(buf, max_size); \
} while(0)
#define YY_USER_ACTION do { \
if (YYSTATE == 0) { \
- yylloc.beg = grecs_current_locus_point; \
+ yylloc.beg = argot_current_locus_point; \
yylloc.beg.col++; \
} \
- grecs_current_locus_point.col += yyleng; \
- yylloc.end = grecs_current_locus_point; \
+ argot_current_locus_point.col += yyleng; \
+ yylloc.end = argot_current_locus_point; \
} while (0);
%}
@@ -91,56 +91,56 @@ P [1-9][0-9]*
"/*" BEGIN(COMMENT);
<COMMENT>[^*\n]* /* eat anything that's not a '*' */
<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
-<COMMENT>\n grecs_locus_point_advance_line(grecs_current_locus_point);
+<COMMENT>\n argot_locus_point_advance_line(argot_current_locus_point);
<COMMENT>"*"+"/" BEGIN(INITIAL);
/* Line directive */
-^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { grecs_parse_line_directive_cpp(yytext,
+^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { argot_parse_line_directive_cpp(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
&xlines); }
-^[ \t]*#[ \t]*line[ \t].*\n { grecs_parse_line_directive(yytext,
+^[ \t]*#[ \t]*line[ \t].*\n { argot_parse_line_directive(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
&xlines); }
/* End-of-line comments */
-#.*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+#.*\n { argot_locus_point_advance_line(argot_current_locus_point); }
#.* /* end-of-file comment */;
-"//".*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+"//".*\n { argot_locus_point_advance_line(argot_current_locus_point); }
"//".* /* end-of-file comment */;
/* Identifiers */
<INITIAL>{ID} return ident();
/* Strings */
[a-zA-Z0-9_\.\*/:@\[\]-]([a-zA-Z0-9_\./:@\[\]-][a-zA-Z0-9_\.\*/:@\[\]-]*)? {
- grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+ argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return STRING; }
/* Quoted strings */
-\"[^\\"\n]*\" { grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 2);
- yylval.string = grecs_line_finish();
+\"[^\\"\n]*\" { argot_line_begin();
+ argot_line_add(yytext + 1, yyleng - 2);
+ yylval.string = argot_line_finish();
qstring_locus_fixup();
return qstring(); }
\"[^\\"\n]*\\\n { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow_unescape_last(yytext + 1,
+ argot_line_begin();
+ argot_line_acc_grow_unescape_last(yytext + 1,
yyleng - 1,
&yylloc);
- grecs_locus_point_advance_line(grecs_current_locus_point); }
+ argot_locus_point_advance_line(argot_current_locus_point); }
\"[^\\"\n]*\\. { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow_unescape_last(yytext + 1,
+ argot_line_begin();
+ argot_line_acc_grow_unescape_last(yytext + 1,
yyleng - 1,
&yylloc); }
-<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+<STR>\"[^\\"\n]*\\\n { argot_line_acc_grow_unescape_last(yytext, yyleng,
&yylloc);
- grecs_locus_point_advance_line(grecs_current_locus_point); }
-<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+ argot_locus_point_advance_line(argot_current_locus_point); }
+<STR>[^\\"\n]*\\. { argot_line_acc_grow_unescape_last(yytext, yyleng,
&yylloc); }
<STR>[^\\"\n]*\" { BEGIN(INITIAL);
if (yyleng > 1)
- grecs_line_add(yytext, yyleng - 1);
- yylval.string = grecs_line_finish();
+ argot_line_add(yytext, yyleng - 1);
+ yylval.string = argot_line_finish();
qstring_locus_fixup();
return qstring(); }
/* Multiline strings */
@@ -154,16 +154,16 @@ P [1-9][0-9]*
multiline_begin(yytext+2); }
/* Ignore m4 line statements */
<ML>^"#line ".*\n {
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
}
<ML>.*\n { char *p = multiline_strip_tabs(yytext);
if (!strncmp(p, multiline_delimiter, multiline_delimiter_len)
&& isemptystr(p + multiline_delimiter_len - yytext)) {
- grecs_free(multiline_delimiter);
+ argot_free(multiline_delimiter);
multiline_delimiter = NULL;
BEGIN(INITIAL);
- yylval.string = grecs_line_finish();
+ yylval.string = argot_line_finish();
/* Update end pos */
yylloc.end.line--;
@@ -175,69 +175,69 @@ P [1-9][0-9]*
yylloc.end.col = 1;
return MSTRING;
}
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
multiline_add(p); }
{WS} ;
/* Other tokens */
-\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+\n { argot_locus_point_advance_line(argot_current_locus_point); }
[,;{}()] return yytext[0];
. { if (isascii(yytext[0]) && isprint(yytext[0]))
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("stray character %c"), yytext[0]);
else
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("stray character \\%03o"),
(unsigned char) yytext[0]); }
%%
-pid_t grecs_preproc_pid;
+pid_t argot_preproc_pid;
int
yywrap()
{
- if (grecs_preprocessor) {
- grecs_preproc_extrn_shutdown(grecs_preproc_pid);
+ if (argot_preprocessor) {
+ argot_preproc_extrn_shutdown(argot_preproc_pid);
fclose(yyin);
} else
- grecs_preproc_done();
- grecs_current_locus_point.file = NULL;
+ argot_preproc_done();
+ argot_current_locus_point.file = NULL;
return 1;
}
int
-grecs_lex_begin(const char *name, int trace)
+argot_lex_begin(const char *name, int trace)
{
yy_flex_debug = trace;
- grecs_line_acc_create();
+ argot_line_acc_create();
- if (grecs_preprocessor) {
+ if (argot_preprocessor) {
int fd;
fd = open(name, O_RDONLY);
if (fd == -1) {
- grecs_error(NULL, errno, _("Cannot open `%s'"), name);
+ argot_error(NULL, errno, _("Cannot open `%s'"), name);
return 1;
}
close(fd);
- yyin = grecs_preproc_extrn_start(name, &grecs_preproc_pid);
+ yyin = argot_preproc_extrn_start(name, &argot_preproc_pid);
if (!yyin) {
- grecs_error(NULL, errno,
+ argot_error(NULL, errno,
_("Unable to start external preprocessor `%s'"),
- grecs_preprocessor);
+ argot_preprocessor);
return 1;
}
} else
- return grecs_preproc_init(name);
+ return argot_preproc_init(name);
return 0;
}
void
-grecs_lex_end(int err)
+argot_lex_end(int err)
{
- grecs_line_acc_free();
+ argot_line_acc_free();
}
static int
@@ -271,13 +271,13 @@ multiline_add(char *s)
if (multiline_unescape) {
for (; *s; s++) {
if (*s == '\\') {
- grecs_line_acc_grow_char_unescape(s[1]);
+ argot_line_acc_grow_char_unescape(s[1]);
++s;
} else
- grecs_line_acc_grow_char(*s);
+ argot_line_acc_grow_char(*s);
}
} else
- grecs_line_add(s, strlen(s));
+ argot_line_add(s, strlen(s));
}
static int
@@ -321,14 +321,14 @@ multiline_begin(char *p)
/* Remove trailing newline */
multiline_delimiter_len--;
- multiline_delimiter = grecs_malloc(multiline_delimiter_len + 1);
+ multiline_delimiter = argot_malloc(multiline_delimiter_len + 1);
memcpy(multiline_delimiter, p, multiline_delimiter_len);
multiline_delimiter[multiline_delimiter_len] = 0;
- grecs_line_begin();
+ argot_line_begin();
/* Update locus */
- grecs_locus_point_advance_line(grecs_current_locus_point);
- yylloc.beg = grecs_current_locus_point;
+ argot_locus_point_advance_line(argot_current_locus_point);
+ yylloc.beg = argot_current_locus_point;
yylloc.beg.col++;
}
@@ -343,7 +343,7 @@ ident()
;
len = strlen(p);
- str = grecs_malloc(len + 1);
+ str = argot_malloc(len + 1);
strcpy(str, p);
yylval.string = str;
return IDENT;
@@ -352,23 +352,23 @@ ident()
static void
qstring_locus_fixup()
{
- if (grecs_parser_options & GRECS_OPTION_ADJUST_STRING_LOCATIONS) {
+ if (argot_parser_options & ARGOT_OPTION_ADJUST_STRING_LOCATIONS) {
yylloc.beg.col++;
yylloc.end.col--;
}
}
-grecs_value_t *
-grecs_value_ptr_from_static(grecs_value_t *input)
+argot_value_t *
+argot_value_ptr_from_static(argot_value_t *input)
{
- grecs_value_t *ptr = grecs_malloc(sizeof(*ptr));
+ argot_value_t *ptr = argot_malloc(sizeof(*ptr));
*ptr = *input;
return ptr;
}
static int
-assign_locus(struct grecs_locus_point *ploc,
+assign_locus(struct argot_locus_point *ploc,
char *name, char *line, size_t *pxlines)
{
char *p;
@@ -376,7 +376,7 @@ assign_locus(struct grecs_locus_point *ploc,
if (name) {
if (pxlines && (!ploc->file || strcmp(name, ploc->file)))
*pxlines = 0;
- ploc->file = grecs_install_text(name);
+ ploc->file = argot_install_text(name);
}
ploc->line = strtoul(line, &p, 10) - (pxlines ? *pxlines : 0);
ploc->col = 0;
@@ -384,14 +384,14 @@ assign_locus(struct grecs_locus_point *ploc,
}
void
-grecs_parse_line_directive(char *text, grecs_locus_t *ploc,
- struct grecs_locus_point *ppoint, size_t *pxlines)
+argot_parse_line_directive(char *text, argot_locus_t *ploc,
+ struct argot_locus_point *ppoint, size_t *pxlines)
{
int rc = 1;
struct wordsplit ws;
if (wordsplit(text, &ws, WRDSF_DEFFLAGS))
- grecs_error(ploc, 0, _("cannot parse #line line: %s"),
+ argot_error(ploc, 0, _("cannot parse #line line: %s"),
wordsplit_strerror(&ws));
else {
if (ws.ws_wordc == 2)
@@ -412,31 +412,31 @@ grecs_parse_line_directive(char *text, grecs_locus_t *ploc,
*pxlines = x;
}
} else
- grecs_error(ploc, 0, _("invalid #line statement"));
+ argot_error(ploc, 0, _("invalid #line statement"));
if (rc)
- grecs_error(ploc, 0, _("malformed #line statement"));
+ argot_error(ploc, 0, _("malformed #line statement"));
wordsplit_free(&ws);
}
}
void
-grecs_parse_line_directive_cpp(char *text, grecs_locus_t *ploc,
- struct grecs_locus_point *ppoint,
+argot_parse_line_directive_cpp(char *text, argot_locus_t *ploc,
+ struct argot_locus_point *ppoint,
size_t *pxlines)
{
struct wordsplit ws;
if (wordsplit(text, &ws, WRDSF_DEFFLAGS)) {
- grecs_error(ploc, 0, _("cannot parse #line line: %s"),
+ argot_error(ploc, 0, _("cannot parse #line line: %s"),
wordsplit_strerror(&ws));
return;
} else if (ws.ws_wordc < 3)
- grecs_error(ploc, 0, _("invalid #line statement"));
+ argot_error(ploc, 0, _("invalid #line statement"));
else {
if (assign_locus(ppoint, ws.ws_wordv[2],
ws.ws_wordv[1], pxlines))
- grecs_error(ploc, 0, _("malformed #line statement"));
+ argot_error(ploc, 0, _("malformed #line statement"));
}
wordsplit_free(&ws);
}
diff --git a/src/asprintf.c b/src/asprintf.c
index a92b88a..2ae61e0 100644
--- a/src/asprintf.c
+++ b/src/asprintf.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,10 +20,10 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "grecs.h"
+#include "argot.h"
int
-grecs_vasprintf(char **pbuf, size_t *psize, const char *fmt, va_list ap)
+argot_vasprintf(char **pbuf, size_t *psize, const char *fmt, va_list ap)
{
char *buf = *pbuf;
size_t buflen = *psize;
@@ -78,13 +78,13 @@ grecs_vasprintf(char **pbuf, size_t *psize, const char *fmt, va_list ap)
}
int
-grecs_asprintf(char **pbuf, size_t *psize, const char *fmt, ...)
+argot_asprintf(char **pbuf, size_t *psize, const char *fmt, ...)
{
int rc;
va_list ap;
va_start(ap, fmt);
- rc = grecs_vasprintf(pbuf, psize, fmt, ap);
+ rc = argot_vasprintf(pbuf, psize, fmt, ap);
va_end(ap);
return rc;
}
diff --git a/src/bind-gram.y b/src/bind-gram.y
index 18deb0d..becb8d6 100644
--- a/src/bind-gram.y
+++ b/src/bind-gram.y
@@ -1,5 +1,5 @@
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -18,7 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <bind-gram.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -28,12 +28,12 @@
int yylex(void);
int yyerror(char const *s);
-static struct grecs_node *parse_tree;
+static struct argot_node *parse_tree;
extern int yy_flex_debug;
-extern int grecs_bind_new_source(const char *name, grecs_locus_t *loc);
-extern void grecs_bind_close_sources(void);
+extern int argot_bind_new_source(const char *name, argot_locus_t *loc);
+extern void argot_bind_close_sources(void);
-static struct grecs_value *stmtlist_to_value(struct grecs_node *node);
+static struct argot_value *stmtlist_to_value(struct argot_node *node);
%}
%error-verbose
@@ -41,11 +41,11 @@ static struct grecs_value *stmtlist_to_value(struct grecs_node *node);
%union {
char *string;
- grecs_value_t svalue, *pvalue;
- struct grecs_list *list;
- struct grecs_node *node;
- grecs_locus_t locus;
- struct { struct grecs_node *head, *tail; } node_list;
+ argot_value_t svalue, *pvalue;
+ struct argot_list *list;
+ struct argot_node *node;
+ argot_locus_t locus;
+ struct { struct argot_node *head, *tail; } node_list;
}
%token <string> BIND_STRING BIND_IDENT BIND_CONTROLS
@@ -60,9 +60,9 @@ static struct grecs_value *stmtlist_to_value(struct grecs_node *node);
input : maybe_stmtlist
{
- parse_tree = grecs_node_create(grecs_node_root, &@1);
- parse_tree->v.texttab = grecs_text_table();
- grecs_node_bind(parse_tree, $1, 1);
+ parse_tree = argot_node_create(argot_node_root, &@1);
+ parse_tree->v.texttab = argot_text_table();
+ argot_node_bind(parse_tree, $1, 1);
}
;
@@ -87,7 +87,7 @@ stmtlist: stmt
if (!$1.head)
$1.head = $1.tail = $2;
else
- grecs_node_bind($1.tail, $2, 0);
+ argot_node_bind($1.tail, $2, 0);
}
$$ = $1;
}
@@ -100,11 +100,11 @@ stmt : simple
simple : BIND_IDENT vallist ';'
{
if (strcmp($1, "include") == 0 &&
- $2->type == GRECS_TYPE_STRING) {
- grecs_bind_new_source($2->v.string, &@1);
+ $2->type == ARGOT_TYPE_STRING) {
+ argot_bind_new_source($2->v.string, &@1);
$$ = NULL;
} else {
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @2.end);
$$->ident = $1;
$$->idloc = @1;
@@ -113,19 +113,19 @@ simple : BIND_IDENT vallist ';'
}
| string ';'
{
- $$ = grecs_node_create(grecs_node_stmt, &@1);
+ $$ = argot_node_create(argot_node_stmt, &@1);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = NULL;
}
| '!' string ';'
{
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @2.end);
- $$->ident = grecs_strdup("!");
+ $$->ident = argot_strdup("!");
$$->idloc = @1;
- $$->v.value = grecs_malloc(sizeof($$->v.value[0]));
- $$->v.value->type = GRECS_TYPE_STRING;
+ $$->v.value = argot_malloc(sizeof($$->v.value[0]));
+ $$->v.value->type = ARGOT_TYPE_STRING;
$$->v.value->locus = @2;
$$->v.value->v.string = $2;
}
@@ -133,12 +133,12 @@ simple : BIND_IDENT vallist ';'
block : BIND_IDENT tag '{' maybe_stmtlist '}' ';'
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @5.end);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = $2;
- grecs_node_bind($$, $4, 1);
+ argot_node_bind($$, $4, 1);
}
| BIND_CONTROLS '{' ctlsub '}' ';'
/* Special case:
@@ -154,11 +154,11 @@ block : BIND_IDENT tag '{' maybe_stmtlist '}' ';'
(127.0.0.1, 127.0.0.2), keys, (rndc-key))
*/
{
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @4.end);
$$->ident = $1;
$$->idloc = @1;
- $$->v.value = grecs_value_ptr_from_static(&$3);
+ $$->v.value = argot_value_ptr_from_static(&$3);
}
;
@@ -173,40 +173,40 @@ vallist : vlist
{
size_t n;
- if ((n = grecs_list_size($1)) == 1) {
- $$ = grecs_list_index($1, 0);
+ if ((n = argot_list_size($1)) == 1) {
+ $$ = argot_list_index($1, 0);
} else {
size_t i;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_ARRAY;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_ARRAY;
$$->locus = @1;
$$->v.arg.c = n;
- $$->v.arg.v = grecs_calloc(n,
+ $$->v.arg.v = argot_calloc(n,
sizeof($$->v.arg.v[0]));
for (i = 0, ep = $1->head; ep; i++, ep = ep->next)
$$->v.arg.v[i] = ep->data;
}
$1->free_entry = NULL;
- grecs_list_free($1);
+ argot_list_free($1);
}
;
vlist : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, grecs_value_ptr_from_static(&$1));
+ $$ = argot_value_list_create();
+ argot_list_append($$, argot_value_ptr_from_static(&$1));
}
| vlist value
{
- grecs_list_append($1, grecs_value_ptr_from_static(&$2));
+ argot_list_append($1, argot_value_ptr_from_static(&$2));
}
;
value : string
{
- $$.type = GRECS_TYPE_STRING;
+ $$.type = ARGOT_TYPE_STRING;
$$.locus = @1;
$$.v.string = $1;
}
@@ -218,7 +218,7 @@ string : BIND_STRING
ctlsub : ctllist ';'
{
- $$.type = GRECS_TYPE_LIST;
+ $$.type = ARGOT_TYPE_LIST;
$$.locus = @1;
$$.v.list = $1;
}
@@ -226,16 +226,16 @@ ctlsub : ctllist ';'
ctllist : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, grecs_value_ptr_from_static(&$1));
+ $$ = argot_value_list_create();
+ argot_list_append($$, argot_value_ptr_from_static(&$1));
}
| ctllist value
{
- grecs_list_append($1, grecs_value_ptr_from_static(&$2));
+ argot_list_append($1, argot_value_ptr_from_static(&$2));
}
| ctllist '{' stmtlist '}'
{
- grecs_list_append($1, stmtlist_to_value($3.head));
+ argot_list_append($1, stmtlist_to_value($3.head));
/* FIXME: Free $3 */
}
;
@@ -245,79 +245,79 @@ ctllist : value
int
yyerror(char const *s)
{
- grecs_error(&yylloc, 0, "%s", s);
+ argot_error(&yylloc, 0, "%s", s);
return 0;
}
-struct grecs_node *
-grecs_bind_parser(const char *name, int traceflags)
+struct argot_node *
+argot_bind_parser(const char *name, int traceflags)
{
int rc;
- if (grecs_bind_new_source(name, NULL))
+ if (argot_bind_new_source(name, NULL))
return NULL;
- yy_flex_debug = traceflags & GRECS_TRACE_LEX;
- yydebug = traceflags & GRECS_TRACE_GRAM;
+ yy_flex_debug = traceflags & ARGOT_TRACE_LEX;
+ yydebug = traceflags & ARGOT_TRACE_GRAM;
parse_tree = NULL;
- grecs_line_acc_create();
+ argot_line_acc_create();
rc = yyparse();
- grecs_bind_close_sources();
- if (grecs_error_count)
+ argot_bind_close_sources();
+ if (argot_error_count)
rc = 1;
- grecs_line_acc_free();
+ argot_line_acc_free();
if (rc) {
- grecs_tree_free(parse_tree);
+ argot_tree_free(parse_tree);
parse_tree = NULL;
}
return parse_tree;
}
-static struct grecs_value *
-node_to_value(struct grecs_node *node, struct grecs_txtacc *acc)
+static struct argot_value *
+node_to_value(struct argot_node *node, struct argot_txtacc *acc)
{
- struct grecs_value *val = grecs_malloc(sizeof(*val));
+ struct argot_value *val = argot_malloc(sizeof(*val));
int delim = 0;
if (node->ident) {
- grecs_txtacc_grow(acc, node->ident, strlen(node->ident));
+ argot_txtacc_grow(acc, node->ident, strlen(node->ident));
delim = 1;
}
if (node->v.value) {
if (delim)
- grecs_txtacc_grow_char(acc, ' ');
- grecs_txtacc_format_value(node->v.value, 0, acc);
+ argot_txtacc_grow_char(acc, ' ');
+ argot_txtacc_format_value(node->v.value, 0, acc);
delim = 1;
}
- if (node->type == grecs_node_stmt) {
- val->type = GRECS_TYPE_STRING;
- grecs_txtacc_grow_char(acc, 0);
- val->v.string = grecs_txtacc_finish(acc, 1);
+ if (node->type == argot_node_stmt) {
+ val->type = ARGOT_TYPE_STRING;
+ argot_txtacc_grow_char(acc, 0);
+ val->v.string = argot_txtacc_finish(acc, 1);
} else if (node->down) {
- struct grecs_list *list = grecs_value_list_create();
- struct grecs_node *np;
+ struct argot_list *list = argot_value_list_create();
+ struct argot_node *np;
if (delim)
- grecs_txtacc_grow_char(acc, ' ');
+ argot_txtacc_grow_char(acc, ' ');
for (np = node->down; np; np = np->next)
- grecs_list_append(list, node_to_value(np, acc));
- val->type = GRECS_TYPE_LIST;
+ argot_list_append(list, node_to_value(np, acc));
+ val->type = ARGOT_TYPE_LIST;
val->v.list = list;
}
return val;
}
-static struct grecs_value *
-stmtlist_to_value(struct grecs_node *node)
+static struct argot_value *
+stmtlist_to_value(struct argot_node *node)
{
- struct grecs_txtacc *acc = grecs_txtacc_create();
- struct grecs_value *val;
- struct grecs_node parent;
+ struct argot_txtacc *acc = argot_txtacc_create();
+ struct argot_value *val;
+ struct argot_node parent;
memset(&parent, 0, sizeof(parent));
- parent.type = grecs_node_block;
+ parent.type = argot_node_block;
parent.down = node;
val = node_to_value(&parent, acc);
- grecs_txtacc_free(acc);
+ argot_txtacc_free(acc);
return val;
}
diff --git a/src/bind-lex.l b/src/bind-lex.l
index e0659e7..9c04345 100644
--- a/src/bind-lex.l
+++ b/src/bind-lex.l
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*- */
+/* argot - Gray's Extensible Configuration System -*- c -*- */
%option noinput
%option nounput
%top {
@@ -7,7 +7,7 @@
#endif
}
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#include <grecs.h>
+#include <argot.h>
#include <bind-gram.h>
#include <unistd.h>
#include <fcntl.h>
@@ -36,11 +36,11 @@
#define YY_USER_ACTION do { \
if (YYSTATE == 0) { \
- yylloc.beg = grecs_current_locus_point; \
+ yylloc.beg = argot_current_locus_point; \
yylloc.beg.col++; \
} \
- grecs_current_locus_point.col += yyleng; \
- yylloc.end = grecs_current_locus_point; \
+ argot_current_locus_point.col += yyleng; \
+ yylloc.end = argot_current_locus_point; \
} while (0);
%}
@@ -55,81 +55,81 @@ P [1-9][0-9]*
"/*" BEGIN(COMMENT);
<COMMENT>[^*\n]* /* eat anything that's not a '*' */
<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
-<COMMENT>\n grecs_locus_point_advance_line(grecs_current_locus_point);
+<COMMENT>\n argot_locus_point_advance_line(argot_current_locus_point);
<COMMENT>"*"+"/" BEGIN(INITIAL);
/* Line directive */
-^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { grecs_parse_line_directive_cpp(yytext,
+^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { argot_parse_line_directive_cpp(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
NULL); }
-^[ \t]*#[ \t]*line[ \t].*\n { grecs_parse_line_directive(yytext,
+^[ \t]*#[ \t]*line[ \t].*\n { argot_parse_line_directive(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
NULL); }
/* End-of-line comments */
-#.*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+#.*\n { argot_locus_point_advance_line(argot_current_locus_point); }
#.* /* end-of-file comment */;
-"//".*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+"//".*\n { argot_locus_point_advance_line(argot_current_locus_point); }
"//".* /* end-of-file comment */;
/* Identifiers */
-{ID} { grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+{ID} { argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return strcmp(yylval.string, "controls") == 0 ?
BIND_CONTROLS : BIND_IDENT;
}
/* Strings */
[a-zA-Z0-9_\.\*/:@-]([a-zA-Z0-9_\./:@-][a-zA-Z0-9_\.\*/:@-]*)? {
- grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+ argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return BIND_STRING; }
/* Quoted strings */
-\"[^\\"\n]*\" { grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 2);
- yylval.string = grecs_line_finish();
+\"[^\\"\n]*\" { argot_line_begin();
+ argot_line_add(yytext + 1, yyleng - 2);
+ yylval.string = argot_line_finish();
return BIND_STRING; }
\"[^\\"\n]*\\. |
\"[^\\"\n]*\\\n { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow_unescape_last(yytext + 1,
+ argot_line_begin();
+ argot_line_acc_grow_unescape_last(yytext + 1,
yyleng - 1,
&yylloc); }
\"[^\\"\n]*\n { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow(yytext + 1, yyleng - 1); }
+ argot_line_begin();
+ argot_line_acc_grow(yytext + 1, yyleng - 1); }
<STR>[^\\"\n]*\\. |
-<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+<STR>\"[^\\"\n]*\\\n { argot_line_acc_grow_unescape_last(yytext, yyleng,
&yylloc); }
<STR>[^\\"\n]*\n |
-<STR>\"[^\\"\n]*\n { grecs_line_acc_grow(yytext, yyleng); }
+<STR>\"[^\\"\n]*\n { argot_line_acc_grow(yytext, yyleng); }
<STR>[^\\"\n]*\" { BEGIN(INITIAL);
if (yyleng > 1)
- grecs_line_add(yytext, yyleng - 1);
- yylval.string = grecs_line_finish();
+ argot_line_add(yytext, yyleng - 1);
+ yylval.string = argot_line_finish();
return BIND_STRING; }
{WS} ;
/* Other tokens */
-\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+\n { argot_locus_point_advance_line(argot_current_locus_point); }
[,;{}()!] return yytext[0];
. { if (isascii(yytext[0]) && isprint(yytext[0]))
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("stray character %c"), yytext[0]);
else
- grecs_error(&yylloc, 0, _("stray character \\%03o"),
+ argot_error(&yylloc, 0, _("stray character \\%03o"),
(unsigned char) yytext[0]); }
%%
struct bind_input_context {
ino_t i_node;
dev_t i_dev;
- struct grecs_locus_point point;
- grecs_locus_t locus; /* Current input location */
+ struct argot_locus_point point;
+ argot_locus_t locus; /* Current input location */
YY_BUFFER_STATE state;
FILE *input;
};
-static struct grecs_list *input_stack;
+static struct argot_list *input_stack;
static ino_t i_node;
static dev_t i_dev;
@@ -149,37 +149,37 @@ cmp_context(const void *a, const void *b)
}
static int
-_push_context(const char *name, ino_t i_node, dev_t i_dev, grecs_locus_t *loc)
+_push_context(const char *name, ino_t i_node, dev_t i_dev, argot_locus_t *loc)
{
struct bind_input_context ctx, *pctx;
if (!input_stack) {
- input_stack = grecs_list_create();
+ input_stack = argot_list_create();
input_stack->free_entry = free_context;
input_stack->cmp = cmp_context;
} else {
ctx.i_dev = i_dev;
ctx.i_node = i_node;
- pctx = grecs_list_locate(input_stack, &ctx);
+ pctx = argot_list_locate(input_stack, &ctx);
if (pctx) {
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("%s has already been included"), name);
- grecs_error(&pctx->locus, 0,
+ argot_error(&pctx->locus, 0,
_("this is where the previous inclusion occurred"));
return 1;
}
- pctx = grecs_malloc(sizeof(*pctx));
+ pctx = argot_malloc(sizeof(*pctx));
pctx->i_node = i_node;
pctx->i_dev = i_dev;
if (loc)
pctx->locus = *loc;
else
memset(&pctx->locus, 0, sizeof(pctx->locus)); /* FIXME */
- pctx->point = grecs_current_locus_point;
+ pctx->point = argot_current_locus_point;
pctx->state = YY_CURRENT_BUFFER;
pctx->input = yyin;
- grecs_list_push(input_stack, pctx);
+ argot_list_push(input_stack, pctx);
}
return 0;
}
@@ -191,22 +191,22 @@ _pop_context()
if (!yyin)
return 1;
- if (grecs_preprocessor)
+ if (argot_preprocessor)
pclose(yyin);
else
fclose(yyin);
- pctx = grecs_list_pop(input_stack);
+ pctx = argot_list_pop(input_stack);
if (!pctx) {
yyin = NULL;
return 1;
}
i_node = pctx->i_node;
i_dev = pctx->i_dev;
- grecs_current_locus_point = pctx->point;
+ argot_current_locus_point = pctx->point;
yyin = pctx->input;
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(pctx->state);
- grecs_free(pctx);
+ argot_free(pctx);
return 0;
}
@@ -217,48 +217,48 @@ yywrap()
}
int
-grecs_bind_new_source(const char *name, grecs_locus_t *loc)
+argot_bind_new_source(const char *name, argot_locus_t *loc)
{
struct stat st;
FILE *fp;
if (access(name, F_OK)) {
int ec = errno;
- char *tmp = grecs_find_include_file(name, 0);
+ char *tmp = argot_find_include_file(name, 0);
if (!tmp) {
- grecs_error(loc, ec, _("cannot open `%s'"), name);
+ argot_error(loc, ec, _("cannot open `%s'"), name);
return 1;
}
- name = grecs_install_text(tmp);
+ name = argot_install_text(tmp);
free(tmp);
}
fp = fopen(name, "r");
if (!fp) {
- grecs_error(loc, errno, _("cannot open `%s'"), name);
+ argot_error(loc, errno, _("cannot open `%s'"), name);
return 1;
}
if (fstat(fileno(fp), &st)) {
- grecs_error(loc, errno, _("can't state %s"), name);
+ argot_error(loc, errno, _("can't state %s"), name);
fclose(fp);
return 1;
}
- if (grecs_preprocessor) {
+ if (argot_preprocessor) {
char *cmd = NULL;
size_t size = 0;
fclose(fp);
- if (grecs_asprintf(&cmd, &size, "%s \"%s\"",
- grecs_preprocessor, name))
- grecs_alloc_die();
+ if (argot_asprintf(&cmd, &size, "%s \"%s\"",
+ argot_preprocessor, name))
+ argot_alloc_die();
fp = popen(cmd, "r");
if (!fp) {
- grecs_error(loc, errno, _("cannot open `%s'"), cmd);
- grecs_free(cmd);
+ argot_error(loc, errno, _("cannot open `%s'"), cmd);
+ argot_free(cmd);
return 1;
}
- grecs_free(cmd);
+ argot_free(cmd);
}
if (_push_context(name, st.st_ino, st.st_dev, loc)) {
@@ -268,17 +268,17 @@ grecs_bind_new_source(const char *name, grecs_locus_t *loc)
i_dev = st.st_dev;
yyin = fp;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- grecs_current_locus_point.file = grecs_install_text(name);
- grecs_current_locus_point.line = 1;
- grecs_current_locus_point.col = 0;
+ argot_current_locus_point.file = argot_install_text(name);
+ argot_current_locus_point.line = 1;
+ argot_current_locus_point.col = 0;
return 0;
}
void
-grecs_bind_close_sources()
+argot_bind_close_sources()
{
while (!_pop_context())
;
- grecs_list_free(input_stack);
+ argot_list_free(input_stack);
input_stack = NULL;
}
diff --git a/src/cidr.c b/src/cidr.c
index 7566fa6..32c7905 100644
--- a/src/cidr.c
+++ b/src/cidr.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
static void
uint32_to_bytes (unsigned char *bytes, uint32_t u)
@@ -37,7 +37,7 @@ uint32_to_bytes (unsigned char *bytes, uint32_t u)
}
int
-grecs_inaddr_to_bytes(int af, void *buf, unsigned char *bytes)
+argot_inaddr_to_bytes(int af, void *buf, unsigned char *bytes)
{
uint32_t u;
@@ -55,7 +55,7 @@ grecs_inaddr_to_bytes(int af, void *buf, unsigned char *bytes)
}
int
-grecs_sockaddr_to_bytes(unsigned char *bytes, struct sockaddr const *sa)
+argot_sockaddr_to_bytes(unsigned char *bytes, struct sockaddr const *sa)
{
switch (sa->sa_family) {
case AF_INET:
@@ -71,19 +71,19 @@ grecs_sockaddr_to_bytes(unsigned char *bytes, struct sockaddr const *sa)
}
int
-grecs_sockaddr_to_cidr(struct grecs_cidr *cidr, const struct sockaddr *sa)
+argot_sockaddr_to_cidr(struct argot_cidr *cidr, const struct sockaddr *sa)
{
- unsigned char address[GRECS_INADDR_BYTES];
+ unsigned char address[ARGOT_INADDR_BYTES];
int len;
int i;
- len = grecs_sockaddr_to_bytes(address, sa);
+ len = argot_sockaddr_to_bytes(address, sa);
if (len == 0)
return -1;
cidr->family = sa->sa_family;
cidr->len = len;
memcpy(cidr->address, address, sizeof(cidr->address));
- for (i = 0; i < GRECS_INADDR_BYTES; i++)
+ for (i = 0; i < ARGOT_INADDR_BYTES; i++)
cidr->netmask[i] = 0xff;
return 0;
}
@@ -96,21 +96,21 @@ masklen_to_netmask(unsigned char *buf, size_t len, size_t masklen)
cnt = masklen / 8;
for (i = 0; i < cnt; i++)
buf[i] = 0xff;
- if (i == GRECS_INADDR_BYTES)
+ if (i == ARGOT_INADDR_BYTES)
return;
cnt = 8 - masklen % 8;
buf[i++] = (0xff >> cnt) << cnt;
- for (; i < GRECS_INADDR_BYTES; i++)
+ for (; i < ARGOT_INADDR_BYTES; i++)
buf[i] = 0;
}
int
-grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
- grecs_locus_t const *locus)
+argot_str_to_cidr(struct argot_cidr *pcidr, const char *str,
+ argot_locus_t const *locus)
{
int rc;
char ipbuf[41];
- struct grecs_cidr cidr;
+ struct argot_cidr cidr;
char *p;
size_t len;
union {
@@ -125,7 +125,7 @@ grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
len = strlen(str);
if (len > sizeof(ipbuf)) {
- grecs_error(locus, 0, _("invalid network mask: %s"),
+ argot_error(locus, 0, _("invalid network mask: %s"),
str);
return -1;
}
@@ -133,30 +133,30 @@ grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
memcpy(ipbuf, str, len);
ipbuf[len] = 0;
- if (grecs_str_is_ipv4(ipbuf))
+ if (argot_str_is_ipv4(ipbuf))
cidr.family = AF_INET;
- else if (grecs_str_is_ipv6(ipbuf))
+ else if (argot_str_is_ipv6(ipbuf))
cidr.family = AF_INET6;
else {
- grecs_error(locus, 0, _("unrecognized address family: %s"),
+ argot_error(locus, 0, _("unrecognized address family: %s"),
str);
return -1;
}
rc = inet_pton(cidr.family, ipbuf, &inaddr);
if (rc == -1) {
- grecs_error(locus, 0, _("unrecognized address family: %s"),
+ argot_error(locus, 0, _("unrecognized address family: %s"),
str);
return -1;
} else if (rc != 1) {
- grecs_error(locus, 0, _("invalid network address: %s"),
+ argot_error(locus, 0, _("invalid network address: %s"),
str);
return -1;
}
- cidr.len = grecs_inaddr_to_bytes(cidr.family, &inaddr, cidr.address);
+ cidr.len = argot_inaddr_to_bytes(cidr.family, &inaddr, cidr.address);
if (cidr.len == 0) {
- grecs_error(locus, 0, _("unrecognized address family: %s"),
+ argot_error(locus, 0, _("unrecognized address family: %s"),
str);
return -1;
}
@@ -170,19 +170,19 @@ grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
masklen = strtoul(p, &end, 10);
if (*end == 0)
masklen_to_netmask(cidr.netmask, cidr.len, masklen);
- else if ((cidr.family == AF_INET && grecs_str_is_ipv4(p))
+ else if ((cidr.family == AF_INET && argot_str_is_ipv4(p))
|| (cidr.family == AF_INET6
- && grecs_str_is_ipv6(ipbuf))) {
+ && argot_str_is_ipv6(ipbuf))) {
rc = inet_pton(cidr.family, p, &inaddr);
if (rc != 1) {
- grecs_error(locus, 0, _("invalid network mask: %s"),
+ argot_error(locus, 0, _("invalid network mask: %s"),
str);
return -1;
}
- grecs_inaddr_to_bytes(cidr.family, &inaddr,
+ argot_inaddr_to_bytes(cidr.family, &inaddr,
cidr.netmask);
} else {
- grecs_error(locus, 0, _("invalid network mask: %s"),
+ argot_error(locus, 0, _("invalid network mask: %s"),
str);
return -1;
}
@@ -194,7 +194,7 @@ grecs_str_to_cidr(struct grecs_cidr *pcidr, const char *str,
}
int
-grecs_cidr_match(struct grecs_cidr *a, struct grecs_cidr *b)
+argot_cidr_match(struct argot_cidr *a, struct argot_cidr *b)
{
int i;
@@ -208,10 +208,10 @@ grecs_cidr_match(struct grecs_cidr *a, struct grecs_cidr *b)
}
int
-grecs_sockadd_cidr_match(struct sockaddr *sa, struct grecs_cidr *cidr)
+argot_sockadd_cidr_match(struct sockaddr *sa, struct argot_cidr *cidr)
{
- struct grecs_cidr t;
- if (grecs_sockaddr_to_cidr(&t, sa))
+ struct argot_cidr t;
+ if (argot_sockaddr_to_cidr(&t, sa))
return 1;
- return grecs_cidr_match(cidr, &t);
+ return argot_cidr_match(cidr, &t);
}
diff --git a/src/dhcpd-gram.y b/src/dhcpd-gram.y
index 11dd1b2..ec285c4 100644
--- a/src/dhcpd-gram.y
+++ b/src/dhcpd-gram.y
@@ -1,5 +1,5 @@
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -18,7 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <dhcpd-gram.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -28,21 +28,21 @@
int yylex(void);
int yyerror(char const *s);
-static struct grecs_node *parse_tree;
+static struct argot_node *parse_tree;
extern int yy_flex_debug;
-extern int grecs_dhcpd_new_source(const char *name, grecs_locus_t *loc);
-extern void grecs_dhcpd_close_sources(void);
+extern int argot_dhcpd_new_source(const char *name, argot_locus_t *loc);
+extern void argot_dhcpd_close_sources(void);
-extern void grecs_dhcpd_begin_bool(void);
-extern void grecs_dhcpd_begin_expr(void);
+extern void argot_dhcpd_begin_bool(void);
+extern void argot_dhcpd_begin_expr(void);
/* NOTE: STRING must be allocated */
-static grecs_value_t *
+static argot_value_t *
make_string_value(char *string)
{
- grecs_value_t *val;
- val = grecs_malloc(sizeof(val[0]));
- val->type = GRECS_TYPE_STRING;
+ argot_value_t *val;
+ val = argot_malloc(sizeof(val[0]));
+ val->type = ARGOT_TYPE_STRING;
val->v.string = string;
return val;
}
@@ -54,11 +54,11 @@ make_string_value(char *string)
%union {
char *string;
- grecs_value_t svalue, *pvalue;
- struct grecs_list *list;
- struct grecs_node *node;
- grecs_locus_t locus;
- struct { struct grecs_node *head, *tail; } node_list;
+ argot_value_t svalue, *pvalue;
+ struct argot_list *list;
+ struct argot_node *node;
+ argot_locus_t locus;
+ struct { struct argot_node *head, *tail; } node_list;
}
%token <string> DHCPD_IF DHCPD_ELSIF DHCPD_EXPR
@@ -76,9 +76,9 @@ make_string_value(char *string)
input : maybe_stmtlist
{
- parse_tree = grecs_node_create(grecs_node_root, &@1);
- parse_tree->v.texttab = grecs_text_table();
- grecs_node_bind(parse_tree, $1, 1);
+ parse_tree = argot_node_create(argot_node_root, &@1);
+ parse_tree->v.texttab = argot_text_table();
+ argot_node_bind(parse_tree, $1, 1);
}
;
@@ -103,7 +103,7 @@ stmtlist: stmt
if (!$1.head)
$1.head = $1.tail = $2;
else
- grecs_node_bind($1.tail, $2, 0);
+ argot_node_bind($1.tail, $2, 0);
}
$$ = $1;
}
@@ -117,20 +117,20 @@ stmt : simple
simple : DHCPD_IDENT vallist ';'
{
if (strcmp($1, "include") == 0 &&
- $2->type == GRECS_TYPE_STRING) {
- grecs_dhcpd_new_source($2->v.string, &@1);
+ $2->type == ARGOT_TYPE_STRING) {
+ argot_dhcpd_new_source($2->v.string, &@1);
$$ = NULL;
} else {
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @2.end);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = $2;
}
}
- | DHCPD_IDENT '=' { grecs_dhcpd_begin_expr(); } DHCPD_EXPR ';'
+ | DHCPD_IDENT '=' { argot_dhcpd_begin_expr(); } DHCPD_EXPR ';'
{
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @5.end);
$$->ident = $1;
$$->idloc = @1;
@@ -138,7 +138,7 @@ simple : DHCPD_IDENT vallist ';'
}
| string ';'
{
- $$ = grecs_node_create(grecs_node_stmt, &@1);
+ $$ = argot_node_create(argot_node_stmt, &@1);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = NULL;
@@ -147,12 +147,12 @@ simple : DHCPD_IDENT vallist ';'
block : DHCPD_IDENT tag '{' maybe_stmtlist '}' opt_semi
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @5.end);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = $2;
- grecs_node_bind($$, $4, 1);
+ argot_node_bind($$, $4, 1);
}
;
@@ -171,46 +171,46 @@ vallist : vlist
{
size_t n;
- if ((n = grecs_list_size($1)) == 1) {
- $$ = grecs_list_index($1, 0);
+ if ((n = argot_list_size($1)) == 1) {
+ $$ = argot_list_index($1, 0);
} else {
size_t i;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_ARRAY;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_ARRAY;
$$->locus = @1;
$$->v.arg.c = n;
- $$->v.arg.v = grecs_calloc(n,
+ $$->v.arg.v = argot_calloc(n,
sizeof($$->v.arg.v[0]));
for (i = 0, ep = $1->head; ep; i++, ep = ep->next)
$$->v.arg.v[i] = ep->data;
}
$1->free_entry = NULL;
- grecs_list_free($1);
+ argot_list_free($1);
}
;
vlist : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, grecs_value_ptr_from_static(&$1));
+ $$ = argot_value_list_create();
+ argot_list_append($$, argot_value_ptr_from_static(&$1));
}
| vlist value
{
- grecs_list_append($1, grecs_value_ptr_from_static(&$2));
+ argot_list_append($1, argot_value_ptr_from_static(&$2));
}
;
value : string
{
- $$.type = GRECS_TYPE_STRING;
+ $$.type = ARGOT_TYPE_STRING;
$$.locus = @1;
$$.v.string = $1;
}
| strlist
{
- $$.type = GRECS_TYPE_LIST;
+ $$.type = ARGOT_TYPE_LIST;
$$.locus = @1;
$$.v.list = $1;
}
@@ -222,61 +222,61 @@ string : DHCPD_STRING
strlist : DHCPD_STRING ',' DHCPD_STRING
{
- grecs_value_t val;
+ argot_value_t val;
- $$ = grecs_value_list_create();
+ $$ = argot_value_list_create();
- val.type = GRECS_TYPE_STRING;
+ val.type = ARGOT_TYPE_STRING;
val.locus = @1;
val.v.string = $1;
- grecs_list_append($$, grecs_value_ptr_from_static(&val));
+ argot_list_append($$, argot_value_ptr_from_static(&val));
- val.type = GRECS_TYPE_STRING;
+ val.type = ARGOT_TYPE_STRING;
val.locus = @3;
val.v.string = $3;
- grecs_list_append($$, grecs_value_ptr_from_static(&val));
+ argot_list_append($$, argot_value_ptr_from_static(&val));
}
| strlist ',' DHCPD_STRING
{
- grecs_value_t val;
+ argot_value_t val;
- val.type = GRECS_TYPE_STRING;
+ val.type = ARGOT_TYPE_STRING;
val.locus = @3;
val.v.string = $3;
- grecs_list_append($1, grecs_value_ptr_from_static(&val));
+ argot_list_append($1, argot_value_ptr_from_static(&val));
}
;
cond : if DHCPD_EXPR '{' maybe_stmtlist '}' opt_elsifchain opt_elsecond
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @7.end);
- grecs_line_begin();
- grecs_line_add("if", 2);
+ argot_line_begin();
+ argot_line_add("if", 2);
- $$->ident = grecs_line_finish();
+ $$->ident = argot_line_finish();
$$->idloc = @1;
$$->v.value = make_string_value ($2);
- grecs_node_bind($$, $4, 1);
+ argot_node_bind($$, $4, 1);
if ($6.head) {
- grecs_node_bind($6.tail, $7, 0);
- grecs_node_bind($$, $6.head, 0);
+ argot_node_bind($6.tail, $7, 0);
+ argot_node_bind($$, $6.head, 0);
}
}
;
if : DHCPD_IF
{
- grecs_dhcpd_begin_bool();
+ argot_dhcpd_begin_bool();
}
;
elsif : DHCPD_ELSIF
{
- grecs_dhcpd_begin_bool();
+ argot_dhcpd_begin_bool();
}
;
@@ -297,7 +297,7 @@ elsifchain: elsifcond
if (!$1.head)
$1.head = $1.tail = $2;
else
- grecs_node_bind($1.tail, $2, 0);
+ argot_node_bind($1.tail, $2, 0);
}
$$ = $1;
}
@@ -305,16 +305,16 @@ elsifchain: elsifcond
elsifcond: elsif DHCPD_EXPR '{' maybe_stmtlist '}'
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @5.end);
- grecs_line_begin();
- grecs_line_add("elsif", 5);
+ argot_line_begin();
+ argot_line_add("elsif", 5);
- $$->ident = grecs_line_finish();
+ $$->ident = argot_line_finish();
$$->idloc = @1;
$$->v.value = make_string_value ($2);
- grecs_node_bind($$, $4, 1);
+ argot_node_bind($$, $4, 1);
}
;
@@ -327,16 +327,16 @@ opt_elsecond: /* empty */
elsecond: DHCPD_ELSE '{' maybe_stmtlist '}'
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @4.end);
- grecs_line_begin();
- grecs_line_add("else", 4);
+ argot_line_begin();
+ argot_line_add("else", 4);
- $$->ident = grecs_line_finish();
+ $$->ident = argot_line_finish();
$$->idloc = @1;
$$->v.value = NULL;
- grecs_node_bind($$, $3, 1);
+ argot_node_bind($$, $3, 1);
}
;
@@ -345,28 +345,28 @@ elsecond: DHCPD_ELSE '{' maybe_stmtlist '}'
int
yyerror(char const *s)
{
- grecs_error(&yylloc, 0, "%s", s);
+ argot_error(&yylloc, 0, "%s", s);
return 0;
}
-struct grecs_node *
-grecs_dhcpd_parser(const char *name, int traceflags)
+struct argot_node *
+argot_dhcpd_parser(const char *name, int traceflags)
{
int rc;
- if (grecs_dhcpd_new_source(name, NULL))
+ if (argot_dhcpd_new_source(name, NULL))
return NULL;
- yy_flex_debug = traceflags & GRECS_TRACE_LEX;
- yydebug = traceflags & GRECS_TRACE_GRAM;
+ yy_flex_debug = traceflags & ARGOT_TRACE_LEX;
+ yydebug = traceflags & ARGOT_TRACE_GRAM;
parse_tree = NULL;
- grecs_line_acc_create();
+ argot_line_acc_create();
rc = yyparse();
- grecs_dhcpd_close_sources();
- if (grecs_error_count)
+ argot_dhcpd_close_sources();
+ if (argot_error_count)
rc = 1;
- grecs_line_acc_free();
+ argot_line_acc_free();
if (rc) {
- grecs_tree_free(parse_tree);
+ argot_tree_free(parse_tree);
parse_tree = NULL;
}
return parse_tree;
diff --git a/src/dhcpd-lex.l b/src/dhcpd-lex.l
index 79c7274..e1d8257 100644
--- a/src/dhcpd-lex.l
+++ b/src/dhcpd-lex.l
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System -*- c -*- */
+/* argot - Gray's Extensible Configuration System -*- c -*- */
%option noinput
%top {
#ifdef HAVE_CONFIG_H
@@ -6,7 +6,7 @@
#endif
}
%{
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#include <grecs.h>
+#include <argot.h>
#include <dhcpd-gram.h>
#include <unistd.h>
#include <fcntl.h>
@@ -35,11 +35,11 @@
#define YY_USER_ACTION do { \
if (YYSTATE == 0) { \
- yylloc.beg = grecs_current_locus_point; \
+ yylloc.beg = argot_current_locus_point; \
yylloc.beg.col++; \
} \
- grecs_current_locus_point.col += yyleng; \
- yylloc.end = grecs_current_locus_point; \
+ argot_current_locus_point.col += yyleng; \
+ yylloc.end = argot_current_locus_point; \
} while (0);
#define ISWS(c) ((c)==' '||(c)=='\t')
@@ -54,18 +54,18 @@ P [1-9][0-9]*
%%
/* Line directive */
-^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { grecs_parse_line_directive_cpp(yytext,
+^[ \t]*#[ \t]*{P}[ \t]+\".*\".*\n { argot_parse_line_directive_cpp(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
NULL); }
-^[ \t]*#[ \t]*line[ \t].*\n { grecs_parse_line_directive(yytext,
+^[ \t]*#[ \t]*line[ \t].*\n { argot_parse_line_directive(yytext,
&yylloc,
- &grecs_current_locus_point,
+ &argot_current_locus_point,
NULL); }
/* End-of-line comments */
-#.*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+#.*\n { argot_locus_point_advance_line(argot_current_locus_point); }
#.* /* end-of-file comment */;
-"//".*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+"//".*\n { argot_locus_point_advance_line(argot_current_locus_point); }
"//".* /* end-of-file comment */;
"if" return DHCPD_IF;
"elsif" return DHCPD_ELSIF;
@@ -77,10 +77,10 @@ P [1-9][0-9]*
for (p = yytext, len = yyleng - 1; ISWS(*p) && len > 0; p++, len--)
;
if (len) {
- grecs_line_add(p, len);
- grecs_line_add(" ", 1);
+ argot_line_add(p, len);
+ argot_line_add(" ", 1);
}
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
}
<BOOL>[^\{\n]*\{ {
char *p;
@@ -91,9 +91,9 @@ P [1-9][0-9]*
;
for (; len > 0 && ISWS(p[len-1]); len--)
;
- grecs_line_add(p, len);
+ argot_line_add(p, len);
BEGIN(INITIAL);
- yylval.string = grecs_line_finish();
+ yylval.string = argot_line_finish();
return DHCPD_EXPR;
}
@@ -103,10 +103,10 @@ P [1-9][0-9]*
for (p = yytext, len = yyleng - 1; ISWS(*p) && len > 0; p++, len--)
;
if (len) {
- grecs_line_add(p, len);
- grecs_line_add(" ", 1);
+ argot_line_add(p, len);
+ argot_line_add(" ", 1);
}
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
}
<EXPR>[^;\n]*; {
char *p;
@@ -117,67 +117,67 @@ P [1-9][0-9]*
;
for (; len > 0 && ISWS(p[len-1]); len--)
;
- grecs_line_add(p, len);
+ argot_line_add(p, len);
BEGIN(INITIAL);
- yylval.string = grecs_line_finish();
+ yylval.string = argot_line_finish();
return DHCPD_EXPR;
}
/* Identifiers */
-{ID} { grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+{ID} { argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return DHCPD_IDENT;
}
/* Strings */
[a-zA-Z0-9_\.\*/:@-]([a-zA-Z0-9_\./:@-][a-zA-Z0-9_\.\*/:@-]*)? {
- grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+ argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return DHCPD_STRING; }
/* Quoted strings */
-\"[^\\"\n]*\" { grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 2);
- yylval.string = grecs_line_finish();
+\"[^\\"\n]*\" { argot_line_begin();
+ argot_line_add(yytext + 1, yyleng - 2);
+ yylval.string = argot_line_finish();
return DHCPD_STRING; }
\"[^\\"\n]*\\. |
\"[^\\"\n]*\\\n { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow_unescape_last(yytext + 1,
+ argot_line_begin();
+ argot_line_acc_grow_unescape_last(yytext + 1,
yyleng - 1,
&yylloc); }
\"[^\\"\n]*\n { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow(yytext + 1, yyleng - 1); }
+ argot_line_begin();
+ argot_line_acc_grow(yytext + 1, yyleng - 1); }
<STR>[^\\"\n]*\\. |
-<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+<STR>\"[^\\"\n]*\\\n { argot_line_acc_grow_unescape_last(yytext, yyleng,
&yylloc); }
<STR>[^\\"\n]*\n |
-<STR>\"[^\\"\n]*\n { grecs_line_acc_grow(yytext, yyleng); }
+<STR>\"[^\\"\n]*\n { argot_line_acc_grow(yytext, yyleng); }
<STR>[^\\"\n]*\" { BEGIN(INITIAL);
if (yyleng > 1)
- grecs_line_add(yytext, yyleng - 1);
- yylval.string = grecs_line_finish();
+ argot_line_add(yytext, yyleng - 1);
+ yylval.string = argot_line_finish();
return DHCPD_STRING; }
{WS} ;
/* Other tokens */
-\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+\n { argot_locus_point_advance_line(argot_current_locus_point); }
[,;{}()!=] return yytext[0];
. { if (isascii(yytext[0]) && isprint(yytext[0]))
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("stray character %c"), yytext[0]);
else
- grecs_error(&yylloc, 0, _("stray character \\%03o"),
+ argot_error(&yylloc, 0, _("stray character \\%03o"),
(unsigned char) yytext[0]); }
%%
void
-grecs_dhcpd_begin_bool(void)
+argot_dhcpd_begin_bool(void)
{
BEGIN(BOOL);
}
void
-grecs_dhcpd_begin_expr(void)
+argot_dhcpd_begin_expr(void)
{
BEGIN(EXPR);
}
@@ -185,13 +185,13 @@ grecs_dhcpd_begin_expr(void)
struct dhcpd_input_context {
ino_t i_node;
dev_t i_dev;
- struct grecs_locus_point point;
- grecs_locus_t locus; /* Current input location */
+ struct argot_locus_point point;
+ argot_locus_t locus; /* Current input location */
YY_BUFFER_STATE state;
FILE *input;
};
-static struct grecs_list *input_stack;
+static struct argot_list *input_stack;
static ino_t i_node;
static dev_t i_dev;
@@ -211,37 +211,37 @@ cmp_context(const void *a, const void *b)
}
static int
-_push_context(const char *name, ino_t i_node, dev_t i_dev, grecs_locus_t *loc)
+_push_context(const char *name, ino_t i_node, dev_t i_dev, argot_locus_t *loc)
{
struct dhcpd_input_context ctx, *pctx;
if (!input_stack) {
- input_stack = grecs_list_create();
+ input_stack = argot_list_create();
input_stack->free_entry = free_context;
input_stack->cmp = cmp_context;
} else {
ctx.i_dev = i_dev;
ctx.i_node = i_node;
- pctx = grecs_list_locate(input_stack, &ctx);
+ pctx = argot_list_locate(input_stack, &ctx);
if (pctx) {
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("%s has already been included"), name);
- grecs_error(&pctx->locus, 0,
+ argot_error(&pctx->locus, 0,
_("this is where the previous inclusion occurred"));
return 1;
}
- pctx = grecs_malloc(sizeof(*pctx));
+ pctx = argot_malloc(sizeof(*pctx));
pctx->i_node = i_node;
pctx->i_dev = i_dev;
if (loc)
pctx->locus = *loc;
else
memset(&pctx->locus, 0, sizeof(pctx->locus)); /* FIXME */
- pctx->point = grecs_current_locus_point;
+ pctx->point = argot_current_locus_point;
pctx->state = YY_CURRENT_BUFFER;
pctx->input = yyin;
- grecs_list_push(input_stack, pctx);
+ argot_list_push(input_stack, pctx);
}
return 0;
}
@@ -253,22 +253,22 @@ _pop_context()
if (!yyin)
return 1;
- if (grecs_preprocessor)
+ if (argot_preprocessor)
pclose(yyin);
else
fclose(yyin);
- pctx = grecs_list_pop(input_stack);
+ pctx = argot_list_pop(input_stack);
if (!pctx) {
yyin = NULL;
return 1;
}
i_node = pctx->i_node;
i_dev = pctx->i_dev;
- grecs_current_locus_point = pctx->point;
+ argot_current_locus_point = pctx->point;
yyin = pctx->input;
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(pctx->state);
- grecs_free(pctx);
+ argot_free(pctx);
return 0;
}
@@ -279,48 +279,48 @@ yywrap()
}
int
-grecs_dhcpd_new_source(const char *name, grecs_locus_t *loc)
+argot_dhcpd_new_source(const char *name, argot_locus_t *loc)
{
struct stat st;
FILE *fp;
if (access(name, F_OK)) {
int ec = errno;
- char *tmp = grecs_find_include_file(name, 0);
+ char *tmp = argot_find_include_file(name, 0);
if (!tmp) {
- grecs_error(loc, ec, _("cannot open `%s'"), name);
+ argot_error(loc, ec, _("cannot open `%s'"), name);
return 1;
}
- name = grecs_install_text(tmp);
+ name = argot_install_text(tmp);
free(tmp);
}
fp = fopen(name, "r");
if (!fp) {
- grecs_error(loc, errno, _("cannot open `%s'"), name);
+ argot_error(loc, errno, _("cannot open `%s'"), name);
return 1;
}
if (fstat(fileno(fp), &st)) {
- grecs_error(loc, errno, _("can't state %s"), name);
+ argot_error(loc, errno, _("can't state %s"), name);
fclose(fp);
return 1;
}
- if (grecs_preprocessor) {
+ if (argot_preprocessor) {
char *cmd = NULL;
size_t size = 0;
fclose(fp);
- if (grecs_asprintf(&cmd, &size, "%s \"%s\"",
- grecs_preprocessor, name))
- grecs_alloc_die();
+ if (argot_asprintf(&cmd, &size, "%s \"%s\"",
+ argot_preprocessor, name))
+ argot_alloc_die();
fp = popen(cmd, "r");
if (!fp) {
- grecs_error(loc, errno, _("cannot open `%s'"), cmd);
- grecs_free(cmd);
+ argot_error(loc, errno, _("cannot open `%s'"), cmd);
+ argot_free(cmd);
return 1;
}
- grecs_free(cmd);
+ argot_free(cmd);
}
if (_push_context(name, st.st_ino, st.st_dev, loc)) {
@@ -330,17 +330,17 @@ grecs_dhcpd_new_source(const char *name, grecs_locus_t *loc)
i_dev = st.st_dev;
yyin = fp;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- grecs_current_locus_point.file = grecs_install_text(name);
- grecs_current_locus_point.line = 1;
- grecs_current_locus_point.col = 0;
+ argot_current_locus_point.file = argot_install_text(name);
+ argot_current_locus_point.line = 1;
+ argot_current_locus_point.col = 0;
return 0;
}
void
-grecs_dhcpd_close_sources()
+argot_dhcpd_close_sources()
{
while (!_pop_context())
;
- grecs_list_free(input_stack);
+ argot_list_free(input_stack);
input_stack = NULL;
}
diff --git a/src/diag.c b/src/diag.c
index bdbb407..86affa9 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,14 +17,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
static void
-default_print_diag(grecs_locus_t const *locus, int err, int errcode,
+default_print_diag(argot_locus_t const *locus, int err, int errcode,
const char *msg)
{
fflush(stdout);
@@ -41,63 +41,63 @@ default_print_diag(grecs_locus_t const *locus, int err, int errcode,
fputc('\n', stderr);
}
-void (*grecs_print_diag_fun)(grecs_locus_t const *, int, int,
+void (*argot_print_diag_fun)(argot_locus_t const *, int, int,
const char *msg) =
default_print_diag;
void
-grecs_warning(grecs_locus_t const *locus, int errcode, const char *fmt, ...)
+argot_warning(argot_locus_t const *locus, int errcode, const char *fmt, ...)
{
va_list ap;
char *buf = NULL;
size_t size = 0;
va_start(ap, fmt);
- if (grecs_vasprintf(&buf, &size, fmt, ap))
- grecs_alloc_die();
+ if (argot_vasprintf(&buf, &size, fmt, ap))
+ argot_alloc_die();
va_end(ap);
- grecs_print_diag_fun(locus, 0, errcode, buf);
+ argot_print_diag_fun(locus, 0, errcode, buf);
free(buf);
}
void
-grecs_error(grecs_locus_t const *locus, int errcode, const char *fmt, ...)
+argot_error(argot_locus_t const *locus, int errcode, const char *fmt, ...)
{
va_list ap;
char *buf = NULL;
size_t size = 0;
va_start(ap, fmt);
- if (grecs_vasprintf(&buf, &size, fmt, ap))
- grecs_alloc_die();
+ if (argot_vasprintf(&buf, &size, fmt, ap))
+ argot_alloc_die();
va_end(ap);
- grecs_print_diag_fun(locus, 1, errcode, buf);
+ argot_print_diag_fun(locus, 1, errcode, buf);
free(buf);
- grecs_error_count++;
+ argot_error_count++;
}
int
-grecs_asprint_locus(char **locstr, size_t *size, grecs_locus_t const *locus)
+argot_asprint_locus(char **locstr, size_t *size, argot_locus_t const *locus)
{
int rc;
if (locus->beg.col == 0)
- rc = grecs_asprintf(locstr, size, "%s:%u",
+ rc = argot_asprintf(locstr, size, "%s:%u",
locus->beg.file,
locus->beg.line);
else if (strcmp(locus->beg.file, locus->end.file))
- rc = grecs_asprintf(locstr, size, "%s:%u.%u-%s:%u.%u",
+ rc = argot_asprintf(locstr, size, "%s:%u.%u-%s:%u.%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.file,
locus->end.line, locus->end.col);
else if (locus->beg.line != locus->end.line)
- rc = grecs_asprintf(locstr, size, "%s:%u.%u-%u.%u",
+ rc = argot_asprintf(locstr, size, "%s:%u.%u-%u.%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.line, locus->end.col);
else
- rc = grecs_asprintf(locstr, size, "%s:%u.%u-%u",
+ rc = argot_asprintf(locstr, size, "%s:%u.%u-%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.col);
diff --git a/src/format.c b/src/format.c
index af87329..7870ef2 100644
--- a/src/format.c
+++ b/src/format.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <wordsplit.h>
#include <stdio.h>
#include <stdlib.h>
@@ -26,47 +26,47 @@
#include <errno.h>
const char *
-grecs_data_type_string(enum grecs_data_type type)
+argot_data_type_string(enum argot_data_type type)
{
switch (type) {
- case grecs_type_void:
+ case argot_type_void:
return "void";
- case grecs_type_string:
+ case argot_type_string:
return "string";
- case grecs_type_short:
- case grecs_type_ushort:
- case grecs_type_int:
- case grecs_type_uint:
- case grecs_type_long:
- case grecs_type_ulong:
- case grecs_type_size:
- /*FIXME case grecs_type_off:*/
+ case argot_type_short:
+ case argot_type_ushort:
+ case argot_type_int:
+ case argot_type_uint:
+ case argot_type_long:
+ case argot_type_ulong:
+ case argot_type_size:
+ /*FIXME case argot_type_off:*/
return "number";
- case grecs_type_time:
+ case argot_type_time:
return "time";
- case grecs_type_bool:
+ case argot_type_bool:
return "boolean";
- case grecs_type_ipv4:
+ case argot_type_ipv4:
return "IPv4";
- case grecs_type_cidr:
+ case argot_type_cidr:
return "CIDR";
- case grecs_type_host:
+ case argot_type_host:
return "hostname";
- case grecs_type_sockaddr:
+ case argot_type_sockaddr:
return "sockaddr";
- case grecs_type_section:
+ case argot_type_section:
return "section";
- case grecs_type_null:
+ case argot_type_null:
return "null";
}
return "UNKNOWN?";
@@ -80,7 +80,7 @@ format_level(unsigned level, FILE *stream)
}
void
-grecs_print_docstring(const char *docstring, unsigned level, FILE *stream)
+argot_print_docstring(const char *docstring, unsigned level, FILE *stream)
{
size_t len = strlen(docstring);
int width = 78 - level * 2;
@@ -124,15 +124,15 @@ grecs_print_docstring(const char *docstring, unsigned level, FILE *stream)
}
void
-grecs_print_simple_statement(struct grecs_keyword *kwp, unsigned level,
+argot_print_simple_statement(struct argot_keyword *kwp, unsigned level,
FILE *stream)
{
const char *argstr;
- if (kwp->flags & GRECS_INAC)
- grecs_print_docstring(N_("Disabled;"), level, stream);
+ if (kwp->flags & ARGOT_INAC)
+ argot_print_docstring(N_("Disabled;"), level, stream);
if (kwp->docstring)
- grecs_print_docstring(kwp->docstring, level, stream);
+ argot_print_docstring(kwp->docstring, level, stream);
format_level(level, stream);
if (kwp->argname)
@@ -148,22 +148,22 @@ grecs_print_simple_statement(struct grecs_keyword *kwp, unsigned level,
fprintf(stream, "%s <%s>;\n", kwp->ident, gettext(argstr));
else {
fprintf(stream, "%s <%s: ", kwp->ident, gettext(argstr));
- if (kwp->flags & GRECS_LIST)
+ if (kwp->flags & ARGOT_LIST)
fprintf(stream, "list of %s",
- gettext(grecs_data_type_string(kwp->type)));
+ gettext(argot_data_type_string(kwp->type)));
else
fprintf(stream, "%s",
- gettext(grecs_data_type_string(kwp->type)));
+ gettext(argot_data_type_string(kwp->type)));
fprintf(stream, ">;\n");
}
}
void
-grecs_print_block_statement(struct grecs_keyword *kwp, unsigned level,
+argot_print_block_statement(struct argot_keyword *kwp, unsigned level,
FILE *stream)
{
if (kwp->docstring)
- grecs_print_docstring(kwp->docstring, level, stream);
+ argot_print_docstring(kwp->docstring, level, stream);
format_level(level, stream);
fprintf(stream, "%s", kwp->ident);
if (kwp->argname) {
@@ -173,13 +173,13 @@ grecs_print_block_statement(struct grecs_keyword *kwp, unsigned level,
fprintf(stream, " <%s>", gettext(kwp->argname));
}
fprintf(stream, " {\n");
- grecs_print_statement_array(kwp->kwd, 0, level + 1, stream);
+ argot_print_statement_array(kwp->kwd, 0, level + 1, stream);
format_level(level, stream);
fprintf(stream, "}\n");
}
void
-grecs_print_statement_array(struct grecs_keyword *kwp,
+argot_print_statement_array(struct argot_keyword *kwp,
unsigned n,
unsigned level,
FILE *stream)
@@ -188,47 +188,47 @@ grecs_print_statement_array(struct grecs_keyword *kwp,
return;
}
for (; kwp->ident; kwp++, n++) {
- if (kwp->flags & GRECS_HIDDEN)
+ if (kwp->flags & ARGOT_HIDDEN)
continue;
if (n)
fputc('\n', stream);
- if (kwp->type == grecs_type_section)
- grecs_print_block_statement(kwp, level, stream);
+ if (kwp->type == argot_type_section)
+ argot_print_block_statement(kwp, level, stream);
else
- grecs_print_simple_statement(kwp, level, stream);
+ argot_print_simple_statement(kwp, level, stream);
}
}
void
-grecs_format_locus(grecs_locus_t *locus, struct grecs_format_closure *clos)
+argot_format_locus(argot_locus_t *locus, struct argot_format_closure *clos)
{
if (locus) {
char *str = NULL;
size_t size = 0;
if (locus->beg.col == 0)
- grecs_asprintf(&str, &size, "%s:%u",
+ argot_asprintf(&str, &size, "%s:%u",
locus->beg.file,
locus->beg.line);
else if (strcmp(locus->beg.file, locus->end.file))
- grecs_asprintf(&str, &size, "%s:%u.%u-%s:%u.%u",
+ argot_asprintf(&str, &size, "%s:%u.%u-%s:%u.%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.file,
locus->end.line, locus->end.col);
else if (locus->beg.line != locus->end.line)
- grecs_asprintf(&str, &size, "%s:%u.%u-%u.%u",
+ argot_asprintf(&str, &size, "%s:%u.%u-%u.%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.line, locus->end.col);
else if (locus->beg.col != locus->end.col)
- grecs_asprintf(&str, &size, "%s:%u.%u-%u",
+ argot_asprintf(&str, &size, "%s:%u.%u-%u",
locus->beg.file,
locus->beg.line, locus->beg.col,
locus->end.col);
else
- grecs_asprintf(&str, &size, "%s:%u.%u",
+ argot_asprintf(&str, &size, "%s:%u.%u",
locus->beg.file,
locus->beg.line,
locus->beg.col);
@@ -239,8 +239,8 @@ grecs_format_locus(grecs_locus_t *locus, struct grecs_format_closure *clos)
}
void
-grecs_format_node_path(struct grecs_node *node, int flags,
- struct grecs_format_closure *clos)
+argot_format_node_path(struct argot_node *node, int flags,
+ struct argot_format_closure *clos)
{
char delim[2] = ".";
@@ -250,80 +250,80 @@ grecs_format_node_path(struct grecs_node *node, int flags,
}
if (node->up)
- grecs_format_node_path(node->up, flags, clos);
- if (node->type == grecs_node_root)
+ argot_format_node_path(node->up, flags, clos);
+ if (node->type == argot_node_root)
return;
- if (flags & _GRECS_NODE_MASK_DELIM)
- delim[0] = flags & _GRECS_NODE_MASK_DELIM;
+ if (flags & _ARGOT_NODE_MASK_DELIM)
+ delim[0] = flags & _ARGOT_NODE_MASK_DELIM;
clos->fmtfun(delim, clos->data);
clos->fmtfun(node->ident, clos->data);
- if (node->type == grecs_node_block &&
- !GRECS_VALUE_EMPTY_P(node->v.value)) {
+ if (node->type == argot_node_block &&
+ !ARGOT_VALUE_EMPTY_P(node->v.value)) {
clos->fmtfun("=", clos->data);
- grecs_format_value(node->v.value, flags|GRECS_NODE_FLAG_QUOTE,
+ argot_format_value(node->v.value, flags|ARGOT_NODE_FLAG_QUOTE,
clos);
}
}
void
-grecs_format_value(struct grecs_value *val, int flags,
- struct grecs_format_closure *clos)
+argot_format_value(struct argot_value *val, int flags,
+ struct argot_format_closure *clos)
{
int i;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
size_t clen;
int need_quote;
if (!val)
return;
switch (val->type) {
- case GRECS_TYPE_STRING:
+ case ARGOT_TYPE_STRING:
clen = wordsplit_c_quoted_length(val->v.string,
- flags & GRECS_NODE_FLAG_QUOTE_HEX,
+ flags & ARGOT_NODE_FLAG_QUOTE_HEX,
&need_quote);
- if (flags & GRECS_NODE_FLAG_QUOTE)
+ if (flags & ARGOT_NODE_FLAG_QUOTE)
need_quote = 1;
- else if (flags & GRECS_NODE_FLAG_NOQUOTE)
+ else if (flags & ARGOT_NODE_FLAG_NOQUOTE)
need_quote = 0;
if (need_quote) {
- char *cbuf = grecs_malloc(clen + 1);
+ char *cbuf = argot_malloc(clen + 1);
wordsplit_c_quote_copy(cbuf, val->v.string,
- flags & GRECS_NODE_FLAG_QUOTE_HEX);
+ flags & ARGOT_NODE_FLAG_QUOTE_HEX);
cbuf[clen] = 0;
clos->fmtfun("\"", clos->data);
clos->fmtfun(cbuf, clos->data);
clos->fmtfun("\"", clos->data);
- grecs_free(cbuf);
+ argot_free(cbuf);
} else
clos->fmtfun(val->v.string, clos->data);
break;
- case GRECS_TYPE_LIST:
+ case ARGOT_TYPE_LIST:
clos->fmtfun("(", clos->data);
for (ep = val->v.list->head; ep; ep = ep->next) {
- grecs_format_value(ep->data, flags, clos);
+ argot_format_value(ep->data, flags, clos);
if (ep->next)
clos->fmtfun(", ", clos->data);
}
clos->fmtfun(")", clos->data);
break;
- case GRECS_TYPE_ARRAY:
+ case ARGOT_TYPE_ARRAY:
for (i = 0; i < val->v.arg.c; i++) {
if (i)
clos->fmtfun(" ", clos->data);
- grecs_format_value(val->v.arg.v[i], flags, clos);
+ argot_format_value(val->v.arg.v[i], flags, clos);
}
}
}
int
-grecs_format_node(struct grecs_node *node, int flags,
- struct grecs_format_closure *clos)
+argot_format_node(struct argot_node *node, int flags,
+ struct argot_format_closure *clos)
{
const char *delim_str = NULL;
- if (!(flags & _GRECS_NODE_MASK_OUTPUT)) {
+ if (!(flags & _ARGOT_NODE_MASK_OUTPUT)) {
errno = EINVAL;
return 1;
}
@@ -334,43 +334,43 @@ grecs_format_node(struct grecs_node *node, int flags,
}
switch (node->type) {
- case grecs_node_root:
- case grecs_node_block:
- if (flags & GRECS_NODE_FLAG_DESCEND) {
+ case argot_node_root:
+ case argot_node_block:
+ if (flags & ARGOT_NODE_FLAG_DESCEND) {
for (node = node->down; node; node = node->next) {
- grecs_format_node(node, flags, clos);
+ argot_format_node(node, flags, clos);
if (node->next)
clos->fmtfun("\n", clos->data);
}
break;
}
- case grecs_node_stmt:
- if (flags & GRECS_NODE_FLAG_LOCUS) {
- grecs_locus_t *locus;
+ case argot_node_stmt:
+ if (flags & ARGOT_NODE_FLAG_LOCUS) {
+ argot_locus_t *locus;
- if (flags & GRECS_NODE_FLAG_PATH) {
- if (flags & GRECS_NODE_FLAG_VALUE)
+ if (flags & ARGOT_NODE_FLAG_PATH) {
+ if (flags & ARGOT_NODE_FLAG_VALUE)
locus = &node->locus;
else
locus = &node->idloc;
- } else if (flags & GRECS_NODE_FLAG_VALUE)
+ } else if (flags & ARGOT_NODE_FLAG_VALUE)
locus = &node->v.value->locus;
else
locus = &node->locus;
- grecs_format_locus(locus, clos);
+ argot_format_locus(locus, clos);
delim_str = ": ";
}
- if (flags & GRECS_NODE_FLAG_PATH) {
+ if (flags & ARGOT_NODE_FLAG_PATH) {
if (delim_str)
clos->fmtfun(delim_str, clos->data);
- grecs_format_node_path(node, flags, clos);
+ argot_format_node_path(node, flags, clos);
delim_str = ": ";
}
- if (flags & GRECS_NODE_FLAG_VALUE) {
+ if (flags & ARGOT_NODE_FLAG_VALUE) {
if (delim_str)
clos->fmtfun(delim_str, clos->data);
- grecs_format_value(node->v.value, flags, clos);
+ argot_format_value(node->v.value, flags, clos);
}
}
return 0;
@@ -380,17 +380,17 @@ grecs_format_node(struct grecs_node *node, int flags,
static int
txtacc_fmt(const char *str, void *data)
{
- struct grecs_txtacc *acc = data;
- grecs_txtacc_grow(acc, str, strlen(str));
+ struct argot_txtacc *acc = data;
+ argot_txtacc_grow(acc, str, strlen(str));
return 0;
}
void
-grecs_txtacc_format_value(struct grecs_value *val, int flags,
- struct grecs_txtacc *acc)
+argot_txtacc_format_value(struct argot_value *val, int flags,
+ struct argot_txtacc *acc)
{
- struct grecs_format_closure clos = { txtacc_fmt, acc };
- grecs_format_value(val, flags, &clos);
+ struct argot_format_closure clos = { txtacc_fmt, acc };
+ argot_format_value(val, flags, &clos);
}
@@ -402,29 +402,29 @@ file_fmt(const char *str, void *data)
}
void
-grecs_print_locus(grecs_locus_t *locus, FILE *fp)
+argot_print_locus(argot_locus_t *locus, FILE *fp)
{
- struct grecs_format_closure clos = { file_fmt, fp };
- grecs_format_locus(locus, &clos);
+ struct argot_format_closure clos = { file_fmt, fp };
+ argot_format_locus(locus, &clos);
}
void
-grecs_print_node_path(struct grecs_node *node, int flag, FILE *fp)
+argot_print_node_path(struct argot_node *node, int flag, FILE *fp)
{
- struct grecs_format_closure clos = { file_fmt, fp };
- grecs_format_node_path(node, flag, &clos);
+ struct argot_format_closure clos = { file_fmt, fp };
+ argot_format_node_path(node, flag, &clos);
}
void
-grecs_print_value(struct grecs_value *val, int flags, FILE *fp)
+argot_print_value(struct argot_value *val, int flags, FILE *fp)
{
- struct grecs_format_closure clos = { file_fmt, fp };
- grecs_format_value(val, flags, &clos);
+ struct argot_format_closure clos = { file_fmt, fp };
+ argot_format_value(val, flags, &clos);
}
int
-grecs_print_node(struct grecs_node *node, int flags, FILE *fp)
+argot_print_node(struct argot_node *node, int flags, FILE *fp)
{
- struct grecs_format_closure clos = { file_fmt, fp };
- return grecs_format_node(node, flags, &clos);
+ struct argot_format_closure clos = { file_fmt, fp };
+ return argot_format_node(node, flags, &clos);
}
diff --git a/src/git-parser.c b/src/git-parser.c
index d1c7600..aae2884 100644
--- a/src/git-parser.c
+++ b/src/git-parser.c
@@ -21,11 +21,11 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
-#include <grecs.h>
+#include <argot.h>
static FILE *infile;
static int input_char;
-static struct grecs_txtacc *acc;
+static struct argot_txtacc *acc;
#define TOK_EOF 0
#define TOK_EQ '='
@@ -39,8 +39,8 @@ struct token {
char *buf;
char chbuf[2];
int putback;
- struct grecs_list *path;
- grecs_locus_t loc;
+ struct argot_list *path;
+ argot_locus_t loc;
unsigned prev_col;
} tok;
@@ -55,12 +55,12 @@ rawinput()
return input_char = 0;
input_char = fgetc(infile);
if (input_char == '\n') {
- tok.prev_col = grecs_current_locus_point.col;
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ tok.prev_col = argot_current_locus_point.col;
+ argot_locus_point_advance_line(argot_current_locus_point);
} else if (input_char < 0)
input_char = 0;
else
- grecs_current_locus_point.col++;
+ argot_current_locus_point.col++;
return input_char;
}
@@ -81,10 +81,10 @@ unput()
if (!input_char)
return;
if (input_char == '\n') {
- grecs_current_locus_point.line--;
- grecs_current_locus_point.col = tok.prev_col;
+ argot_current_locus_point.line--;
+ argot_current_locus_point.col = tok.prev_col;
} else
- grecs_current_locus_point.col--;
+ argot_current_locus_point.col--;
ungetc(input_char, infile);
}
@@ -100,7 +100,7 @@ static void
collect_unquoted()
{
do
- grecs_txtacc_grow_char(acc, input_char);
+ argot_txtacc_grow_char(acc, input_char);
while (input() &&
!(ISSPACE(input_char) || input_char == ']'));
@@ -110,7 +110,7 @@ static void
collect_subsection_name()
{
do
- grecs_txtacc_grow_char(acc, input_char);
+ argot_txtacc_grow_char(acc, input_char);
while (input() &&
(isalnum(input_char) || input_char == '_' ||
input_char == '-'));
@@ -122,7 +122,7 @@ collect_substring()
while (rawinput()) {
if (input_char == '\\') {
if (!input()) {
- grecs_error(&tok.loc, 0,
+ argot_error(&tok.loc, 0,
"unexpected EOF in string");
break;
}
@@ -138,12 +138,12 @@ collect_substring()
}
} else if (input_char == '"')
break;
- grecs_txtacc_grow_char(acc, input_char);
+ argot_txtacc_grow_char(acc, input_char);
}
}
#define endpoint(t,adj) do { \
- (t).loc.end = grecs_current_locus_point; \
+ (t).loc.end = argot_current_locus_point; \
if (adj) { \
if (input_char == '\n') \
(t).loc.end.col = (t).prev_col; \
@@ -159,9 +159,9 @@ gettoken(void)
tok.putback = 0;
if (putback) {
if (putback == '\n')
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
else
- grecs_current_locus_point.col++;
+ argot_current_locus_point.col++;
return;
}
@@ -170,7 +170,7 @@ gettoken(void)
while (input() && ISSPACE(input_char))
;
- tok.loc.beg = grecs_current_locus_point;
+ tok.loc.beg = argot_current_locus_point;
if (input_char <= 0) {
tok.type = TOK_EOF;
@@ -182,7 +182,7 @@ gettoken(void)
int dot_delimited = -1;
tok.type = TOK_SECTION;
- grecs_list_clear(tok.path);
+ argot_list_clear(tok.path);
input();
for (;;) {
char *p;
@@ -199,7 +199,7 @@ gettoken(void)
if (input_char == TOK_EOF) {
endpoint(tok, 0);
- grecs_error(&tok.loc, 0,
+ argot_error(&tok.loc, 0,
"unexpected EOF in section header");
tok.type = TOK_ERR;
return;
@@ -208,7 +208,7 @@ gettoken(void)
break;
if (input_char == '\n') {
endpoint(tok, 1);
- grecs_error(&tok.loc, 0,
+ argot_error(&tok.loc, 0,
"unexpect newline in in section header");
tok.type = TOK_ERR;
return;
@@ -227,20 +227,20 @@ gettoken(void)
else if (dot_delimited == 1) {
if (input_char != '.' && input_char != ']') {
endpoint(tok, 1);
- grecs_error(&tok.loc, 0,
+ argot_error(&tok.loc, 0,
"unexpected character in section header");
tok.type = TOK_ERR;
return;
}
}
- grecs_txtacc_grow_char(acc, 0);
- p = grecs_txtacc_finish(acc, 0);
- grecs_list_append(tok.path, p);
+ argot_txtacc_grow_char(acc, 0);
+ p = argot_txtacc_finish(acc, 0);
+ argot_list_append(tok.path, p);
}
endpoint(tok, 1);
- if (grecs_list_size(tok.path) == 0) {
- grecs_error(&tok.loc, 0, "empty section header");
+ if (argot_list_size(tok.path) == 0) {
+ argot_error(&tok.loc, 0, "empty section header");
tok.type = TOK_ERR;
return;
}
@@ -252,11 +252,11 @@ gettoken(void)
if (ISINITIAL(input_char)) {
tok.type = TOK_KEYWORD;
do
- grecs_txtacc_grow_char(acc, input_char);
+ argot_txtacc_grow_char(acc, input_char);
while (input() && ISIDENT(input_char));
unput();
- grecs_txtacc_grow_char(acc, 0);
- tok.buf = grecs_txtacc_finish(acc, 0);
+ argot_txtacc_grow_char(acc, 0);
+ tok.buf = argot_txtacc_finish(acc, 0);
endpoint(tok, 0);
return;
}
@@ -293,42 +293,42 @@ collect_value()
input_char = '\b';
}
}
- grecs_txtacc_grow_char(acc, input_char);
+ argot_txtacc_grow_char(acc, input_char);
} while (input() && input_char != '\n');
}
-static struct grecs_value *
+static struct argot_value *
getvalue()
{
int len;
- struct grecs_value *val = grecs_malloc(sizeof(*val));
+ struct argot_value *val = argot_malloc(sizeof(*val));
while (input() && ISSPACE(input_char) && input_char != '\n')
;
- val->locus.beg = grecs_current_locus_point;
+ val->locus.beg = argot_current_locus_point;
if (input_char != '\n')
collect_value();
- val->locus.end = grecs_current_locus_point;
+ val->locus.end = argot_current_locus_point;
val->locus.end.line--;
val->locus.end.col = tok.prev_col;
- grecs_txtacc_grow_char(acc, 0);
+ argot_txtacc_grow_char(acc, 0);
tok.type = TOK_VALUE;
- tok.buf = grecs_txtacc_finish(acc, 1);
+ tok.buf = argot_txtacc_finish(acc, 1);
len = strlen(tok.buf);
while (len > 0 && ISSPACE(tok.buf[len-1]))
tok.buf[--len] = 0;
- val->type = GRECS_TYPE_STRING;
+ val->type = ARGOT_TYPE_STRING;
val->v.string = tok.buf;
return val;
}
static int
-read_statement(struct grecs_node *parent)
+read_statement(struct argot_node *parent)
{
- struct grecs_node *node;
+ struct argot_node *node;
gettoken();
if (tok.type == TOK_EOF || tok.type == TOK_SECTION) {
@@ -336,54 +336,54 @@ read_statement(struct grecs_node *parent)
return 0;
}
if (tok.type != TOK_KEYWORD) {
- grecs_error(&tok.loc, 0, "syntax error");
+ argot_error(&tok.loc, 0, "syntax error");
error_recovery();
return 1;
}
- node = grecs_node_create(grecs_node_stmt, &tok.loc);
- node->ident = grecs_strdup(tok.buf);
+ node = argot_node_create(argot_node_stmt, &tok.loc);
+ node->ident = argot_strdup(tok.buf);
node->idloc = tok.loc;
gettoken();
if (tok.type == TOK_EOF) {
- grecs_error(&tok.loc, 0, "unexpected EOF");
- grecs_node_free(node);
+ argot_error(&tok.loc, 0, "unexpected EOF");
+ argot_node_free(node);
return 0;
}
if (tok.type != TOK_EQ) {
- grecs_error(&tok.loc, 0,
+ argot_error(&tok.loc, 0,
"expected `=', but found `%s'", tok.buf);
error_recovery();
- grecs_node_free(node);
+ argot_node_free(node);
return 1;
}
node->v.value = getvalue();
node->locus.end = node->v.value->locus.end;
- grecs_node_bind(parent, node, 1);
+ argot_node_bind(parent, node, 1);
return 1;
}
static void
-read_statement_list(struct grecs_node *parent)
+read_statement_list(struct argot_node *parent)
{
while (read_statement(parent))
;
}
-struct grecs_node *
-create_subsection_node(struct grecs_node *root)
+struct argot_node *
+create_subsection_node(struct argot_node *root)
{
- struct grecs_list_entry *ep;
- struct grecs_node *p;
+ struct argot_list_entry *ep;
+ struct argot_node *p;
for (ep = tok.path->head; ep; ep = ep->next) {
char *ident = ep->data;
- p = grecs_find_node(root, ident);
+ p = argot_find_node(root, ident);
if (!p) {
- p = grecs_node_create(grecs_node_block, &tok.loc);
- p->ident = grecs_strdup(ident);
- grecs_node_bind(root, p, 1);
+ p = argot_node_create(argot_node_block, &tok.loc);
+ p->ident = argot_strdup(ident);
+ argot_node_bind(root, p, 1);
}
root = p;
}
@@ -391,50 +391,50 @@ create_subsection_node(struct grecs_node *root)
}
static int
-read_section(struct grecs_node *parent)
+read_section(struct argot_node *parent)
{
gettoken();
if (tok.type == TOK_EOF)
return 0;
else if (tok.type == TOK_SECTION) {
- struct grecs_node *node = create_subsection_node(parent);
+ struct argot_node *node = create_subsection_node(parent);
read_statement_list(node);
} else if (tok.type == TOK_KEYWORD) {
read_statement(parent);
} else {
- grecs_error(&tok.loc, 0, "syntax error");
+ argot_error(&tok.loc, 0, "syntax error");
error_recovery();
}
return 1;
}
/* FIXME: traceflags not used */
-struct grecs_node *
-grecs_git_parser(const char *name, int traceflags)
+struct argot_node *
+argot_git_parser(const char *name, int traceflags)
{
- struct grecs_node *root;
+ struct argot_node *root;
infile = fopen(name, "r");
if (!infile) {
- grecs_error(NULL, errno, _("cannot open `%s'"), name);
+ argot_error(NULL, errno, _("cannot open `%s'"), name);
return NULL;
}
- grecs_current_locus_point.file = grecs_install_text(name);
- grecs_current_locus_point.line = 1;
- grecs_current_locus_point.col = 0;
+ argot_current_locus_point.file = argot_install_text(name);
+ argot_current_locus_point.line = 1;
+ argot_current_locus_point.col = 0;
- acc = grecs_txtacc_create();
- tok.path = grecs_list_create();
- root = grecs_node_create(grecs_node_root, &tok.loc);
+ acc = argot_txtacc_create();
+ tok.path = argot_list_create();
+ root = argot_node_create(argot_node_root, &tok.loc);
while (read_section(root))
;
- root->locus.end = grecs_current_locus_point;
+ root->locus.end = argot_current_locus_point;
fclose(infile);
- grecs_txtacc_free(acc);
- grecs_list_free(tok.path);
- if (grecs_error_count) {
- grecs_tree_free(root);
+ argot_txtacc_free(acc);
+ argot_list_free(tok.path);
+ if (argot_error_count) {
+ argot_tree_free(root);
root = NULL;
}
return root;
diff --git a/src/ipstr.c b/src/ipstr.c
index 2787016..90b4cab 100644
--- a/src/ipstr.c
+++ b/src/ipstr.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -19,10 +19,10 @@
#endif
#include <string.h>
#include <ctype.h>
-#include "grecs.h"
+#include "argot.h"
int
-grecs_str_is_ipv4(const char *addr)
+argot_str_is_ipv4(const char *addr)
{
int dot_count = 0;
int digit_count = 0;
@@ -42,7 +42,7 @@ grecs_str_is_ipv4(const char *addr)
}
int
-grecs_str_is_ipv6(const char *addr)
+argot_str_is_ipv6(const char *addr)
{
int col_count = 0; /* Number of colons */
int dcol = 0; /* Did we encounter a double-colon? */
@@ -68,7 +68,7 @@ grecs_str_is_ipv6(const char *addr)
}
int
-grecs_str_is_num(const char *s)
+argot_str_is_num(const char *s)
{
for (; *s; ++s)
if (!isdigit(*s))
@@ -77,12 +77,12 @@ grecs_str_is_num(const char *s)
}
int
-grecs_str_is_ipaddr(const char *addr)
+argot_str_is_ipaddr(const char *addr)
{
if (strchr (addr, '.'))
- return grecs_str_is_ipv4(addr);
+ return argot_str_is_ipv4(addr);
else if (strchr (addr, ':'))
- return grecs_str_is_ipv6(addr);
+ return argot_str_is_ipv6(addr);
return 0;
}
diff --git a/src/join.c b/src/join.c
index d3bbe0e..9261d05 100644
--- a/src/join.c
+++ b/src/join.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -19,55 +19,55 @@
#endif
#include <stdlib.h>
#include <errno.h>
-#include "grecs.h"
+#include "argot.h"
static void
-reset_point(struct grecs_locus_point *point, struct grecs_symtab *st)
+reset_point(struct argot_locus_point *point, struct argot_symtab *st)
{
- struct grecs_syment *ent, key;
+ struct argot_syment *ent, key;
int install = 1;
if (!point->file)
return;
key.name = (char*) point->file;
- ent = grecs_symtab_lookup_or_install(st, &key, &install);
+ ent = argot_symtab_lookup_or_install(st, &key, &install);
if (!ent)
- grecs_alloc_die();
+ argot_alloc_die();
point->file = ent->name;
}
-static enum grecs_tree_recurse_res
-reset_locus(enum grecs_tree_recurse_op op, struct grecs_node *node, void *data)
+static enum argot_tree_recurse_res
+reset_locus(enum argot_tree_recurse_op op, struct argot_node *node, void *data)
{
- struct grecs_symtab *st = data;
+ struct argot_symtab *st = data;
switch (op) {
- case grecs_tree_recurse_set:
- case grecs_tree_recurse_pre:
+ case argot_tree_recurse_set:
+ case argot_tree_recurse_pre:
reset_point(&node->locus.beg, st);
reset_point(&node->locus.end, st);
break;
default:
break;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
int
-grecs_tree_join(struct grecs_node *dst, struct grecs_node *src)
+argot_tree_join(struct argot_node *dst, struct argot_node *src)
{
- struct grecs_node *p;
+ struct argot_node *p;
- if (dst->type != grecs_node_root || src->type != grecs_node_root)
+ if (dst->type != argot_node_root || src->type != argot_node_root)
return 1;
- grecs_node_bind(dst, src->down, 1);
+ argot_node_bind(dst, src->down, 1);
for (p = src->down; p; p = p->next)
p->up = dst;
if (!src->v.texttab) {
dst->v.texttab = src->v.texttab;
} else {
- grecs_tree_recurse(src->down, reset_locus, dst->v.texttab);
- grecs_symtab_free(src->v.texttab);
+ argot_tree_recurse(src->down, reset_locus, dst->v.texttab);
+ argot_symtab_free(src->v.texttab);
}
src->v.texttab = NULL;
src->down = NULL;
diff --git a/src/json-gram.y b/src/json-gram.y
index fe8996b..4f7da29 100644
--- a/src/json-gram.y
+++ b/src/json-gram.y
@@ -18,12 +18,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include "grecs.h"
+#include "argot.h"
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include "json-gram.h"
-#include "grecs/json.h"
+#include "argot/json.h"
struct json_value *json_return_obj;
@@ -34,7 +34,7 @@ static void
pairfree(void *ptr)
{
struct json_pair *p = ptr;
- grecs_free(p->k);
+ argot_free(p->k);
json_value_free(p->v);
free(p);
}
@@ -65,9 +65,9 @@ objfree(void *ptr)
int b;
double n;
char *s;
- struct grecs_symtab *o;
+ struct argot_symtab *o;
struct json_value *obj;
- struct grecs_list *list;
+ struct argot_list *list;
struct json_pair *p;
}
%%
@@ -121,32 +121,32 @@ objects : /* empty */
objlist : object
{
- $$ = grecs_list_create();
- grecs_list_append($$, $1);
+ $$ = argot_list_create();
+ argot_list_append($$, $1);
}
| objlist ',' object
{
- grecs_list_append($1, $3);
+ argot_list_append($1, $3);
}
;
assoc : '{' pairs '}'
{
- struct grecs_symtab *s;
+ struct argot_symtab *s;
s = json_assoc_create();
if ($2) {
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
for (ep = $2->head; ep; ep = ep->next) {
struct json_pair *p = ep->data;
int install = 1;
- grecs_symtab_lookup_or_install(s, p, &install);
+ argot_symtab_lookup_or_install(s, p, &install);
if (install) {
p->k = NULL;
p->v = NULL;
}
}
- grecs_list_free($2);
+ argot_list_free($2);
}
$$ = s;
}
@@ -161,19 +161,19 @@ pairs : /* empty */
pairlist: pair
{
- $$ = grecs_list_create();
+ $$ = argot_list_create();
$$->free_entry = pairfree;
- grecs_list_append($$, $1);
+ argot_list_append($$, $1);
}
| pairlist ',' pair
{
- grecs_list_append($1, $3);
+ argot_list_append($1, $3);
}
;
pair : T_STRING ':' object
{
- struct json_pair *p = grecs_malloc(sizeof(*p));
+ struct json_pair *p = argot_malloc(sizeof(*p));
p->k = $1;
p->v = $3;
$$ = p;
@@ -191,7 +191,7 @@ yyerror(char const *s)
struct json_value *
json_value_create(int type)
{
- struct json_value *obj = grecs_zalloc(sizeof(*obj));
+ struct json_value *obj = argot_zalloc(sizeof(*obj));
obj->type = type;
return obj;
}
@@ -210,20 +210,20 @@ json_value_free(struct json_value *obj)
case json_number:
break;
case json_string:
- grecs_free(obj->v.s);
+ argot_free(obj->v.s);
break;
case json_arr:
for (i = 0; i < obj->v.a->oc; i++)
json_value_free(obj->v.a->ov[i]);
- grecs_free (obj->v.a->ov);
+ argot_free (obj->v.a->ov);
if (obj->v.a->ol) {
obj->v.a->ol->free_entry = objfree;
- grecs_list_free(obj->v.a->ol);
+ argot_list_free(obj->v.a->ol);
}
- grecs_free(obj->v.a);
+ argot_free(obj->v.a);
break;
case json_object:
- grecs_symtab_free(obj->v.o);
+ argot_symtab_free(obj->v.o);
}
free(obj);
}
@@ -232,7 +232,7 @@ static unsigned
json_st_hash(void *data, unsigned long n_buckets)
{
struct json_pair *p = data;
- return grecs_hash_string(p->k, n_buckets);
+ return argot_hash_string(p->k, n_buckets);
}
static int
@@ -261,10 +261,10 @@ json_st_free(void *ptr)
free(p);
}
-struct grecs_symtab *
+struct argot_symtab *
json_assoc_create()
{
- return grecs_symtab_create(sizeof(struct json_pair),
+ return argot_symtab_create(sizeof(struct json_pair),
json_st_hash,
json_st_cmp,
json_st_copy,
@@ -303,7 +303,7 @@ json_value_lookup(struct json_value *obj, const char *ident)
l = p - ident + 1;
if (l > qlen) {
qlen = l;
- qbuf = grecs_realloc(qbuf, qlen);
+ qbuf = argot_realloc(qbuf, qlen);
}
q = qbuf;
while (*ident) {
@@ -349,7 +349,7 @@ struct json_value *
json_new_string(char const *str)
{
struct json_value *j = json_value_create(json_string);
- j->v.s = grecs_strdup(str);
+ j->v.s = argot_strdup(str);
return j;
}
@@ -395,9 +395,9 @@ json_object_set(struct json_value *obj, char const *name,
}
pair.k = (char*) name;
pair.v = NULL;
- ret = grecs_symtab_lookup_or_install(obj->v.o, &pair, &install);
+ ret = argot_symtab_lookup_or_install(obj->v.o, &pair, &install);
if (install)
- ret->k = grecs_strdup(ret->k);
+ ret->k = argot_strdup(ret->k);
ret->v = val;
return 0;
}
@@ -413,7 +413,7 @@ json_object_get(struct json_value *obj, char const *name,
}
pair.k = (char*) name;
pair.v = NULL;
- ret = grecs_symtab_lookup_or_install(obj->v.o, &pair, NULL);
+ ret = argot_symtab_lookup_or_install(obj->v.o, &pair, NULL);
if (ret) {
*retval = ret->v;
return 0;
@@ -425,7 +425,7 @@ struct json_value *
json_new_array(void)
{
struct json_value *j = json_value_create(json_arr);
- j->v.a = grecs_malloc(sizeof(*j->v.a));
+ j->v.a = argot_malloc(sizeof(*j->v.a));
j->v.a->oc = 0;
j->v.a->ov = NULL;
j->v.a->ol = NULL;
@@ -439,27 +439,27 @@ json_array_size(struct json_value *j)
errno = EINVAL;
return 0;
}
- return j->v.a->oc + grecs_list_size(j->v.a->ol);
+ return j->v.a->oc + argot_list_size(j->v.a->ol);
}
void
json_array_flatten(struct json_value *j)
{
size_t size, i;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- size = grecs_list_size(j->v.a->ol);
+ size = argot_list_size(j->v.a->ol);
if (size == 0)
return;
- j->v.a->ov = grecs_realloc(j->v.a->ov,
+ j->v.a->ov = argot_realloc(j->v.a->ov,
(j->v.a->oc + size) * sizeof(j->v.a->ov[0]));
for (ep = j->v.a->ol->head, i = j->v.a->oc; ep; ep = ep->next, i++)
j->v.a->ov[i] = ep->data;
j->v.a->oc = i;
- grecs_list_clear(j->v.a->ol);
+ argot_list_clear(j->v.a->ol);
}
int
@@ -492,8 +492,8 @@ json_array_append(struct json_value *j, struct json_value *v)
}
if (!j->v.a->ol)
- j->v.a->ol = grecs_list_create();
- grecs_list_append(j->v.a->ol, v);
+ j->v.a->ol = argot_list_create();
+ argot_list_append(j->v.a->ol, v);
return 0;
}
diff --git a/src/json-lex.l b/src/json-lex.l
index 169cf32..1068404 100644
--- a/src/json-lex.l
+++ b/src/json-lex.l
@@ -22,16 +22,16 @@
You should have received a copy of the GNU General Public License
along with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-#include "grecs.h"
+#include "argot.h"
#include "json-gram.h"
-#include "grecs/json.h"
+#include "argot/json.h"
static char const *input_ptr;
static size_t input_size;
-struct grecs_locus_point json_current_locus_point; /* Input location */
+struct argot_locus_point json_current_locus_point; /* Input location */
char const *json_err_diag;
-struct grecs_locus json_err_locus;
+struct argot_locus json_err_locus;
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
@@ -122,7 +122,7 @@ utf8_wctomb(char *u)
case 1:
r[0] = wc;
}
- grecs_line_acc_grow(r, count);
+ argot_line_acc_grow(r, count);
return count;
}
@@ -148,13 +148,13 @@ yywrap()
return 1;
}
-static struct grecs_txtacc *json_line_acc;
+static struct argot_txtacc *json_line_acc;
static void
json_line_begin()
{
if (!json_line_acc)
- json_line_acc = grecs_txtacc_create();
+ json_line_acc = argot_txtacc_create();
}
static char *
@@ -162,8 +162,8 @@ json_line_finish()
{
if (json_line_acc) {
char nil = 0;
- grecs_txtacc_grow(json_line_acc, &nil, 1);
- return grecs_txtacc_finish(json_line_acc, 1);
+ argot_txtacc_grow(json_line_acc, &nil, 1);
+ return argot_txtacc_finish(json_line_acc, 1);
}
return NULL;
}
@@ -171,7 +171,7 @@ json_line_finish()
static void
json_line_grow(char const *text, size_t len)
{
- grecs_txtacc_grow(json_line_acc, text, len);
+ argot_txtacc_grow(json_line_acc, text, len);
}
%}
D [0-9]
@@ -224,6 +224,6 @@ true { yylval.b = 1; return T_BOOL; }
false { yylval.b = 0; return T_BOOL; }
"{"|"}"|"["|"]"|":"|"," return yytext[0];
[ \t]* ;
-\n grecs_locus_point_advance_line(json_current_locus_point);
+\n argot_locus_point_advance_line(json_current_locus_point);
. { jsonlex_diag("bogus character");
return T_ERR; }
diff --git a/src/jsonfmt.c b/src/jsonfmt.c
index 9ccac37..86a9389 100644
--- a/src/jsonfmt.c
+++ b/src/jsonfmt.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -19,8 +19,8 @@
#endif
#include <string.h>
#include <stdlib.h>
-#include "grecs.h"
-#include "grecs/json.h"
+#include "argot.h"
+#include "argot/json.h"
static void
json_writez(struct json_format *fmt, char const *str)
@@ -90,9 +90,9 @@ json_format_number(struct json_format *fmt, double n)
char *buffer = NULL;
size_t size = 0;
if (fmt->precision == -1)
- grecs_asprintf(&buffer, &size, "%e", n);
+ argot_asprintf(&buffer, &size, "%e", n);
else
- grecs_asprintf(&buffer, &size, "%.*f", fmt->precision, n);
+ argot_asprintf(&buffer, &size, "%.*f", fmt->precision, n);
json_writez(fmt, buffer);
free(buffer);
}
@@ -124,10 +124,10 @@ json_format_obj(struct json_format *fmt, struct json_value *obj, size_t level)
size_t count, i;
struct json_pair **keypairs, **kp;
- count = grecs_symtab_count_entries(obj->v.o);
- keypairs = grecs_calloc(count, sizeof(*keypairs));
+ count = argot_symtab_count_entries(obj->v.o);
+ keypairs = argot_calloc(count, sizeof(*keypairs));
kp = keypairs;
- grecs_symtab_enumerate(obj->v.o, collect_keypairs, &kp);
+ argot_symtab_enumerate(obj->v.o, collect_keypairs, &kp);
qsort(keypairs, count, sizeof(*keypairs), keypair_cmp_name);
json_writec(fmt, '{');
@@ -148,7 +148,7 @@ json_format_obj(struct json_format *fmt, struct json_value *obj, size_t level)
}
}
json_writec(fmt, '}');
- grecs_free(keypairs);
+ argot_free(keypairs);
}
static void
diff --git a/src/libgrecs.m4 b/src/libargot.m4
index 774c1a0..3fd51f9 100644
--- a/src/libgrecs.m4
+++ b/src/libargot.m4
@@ -1,4 +1,4 @@
-# libgrecs.m4 serial 1
+# libargot.m4 serial 1
dnl This file is part of Grecs
dnl Copyright (C) 2007-2016 Sergey Poznyakoff
dnl
@@ -15,27 +15,27 @@ dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Grecs. If not, see <http://www.gnu.org/licenses/>.
-dnl AM_LIBGRECS([minversion],[if-found],[if-notfound])
-AC_DEFUN([AM_LIBGRECS],[
- cv_libgrecs=no
+dnl AM_LIBARGOT([minversion],[if-found],[if-notfound])
+AC_DEFUN([AM_LIBARGOT],[
+ cv_libargot=no
save_LIBS=$LIBS
- AC_CHECK_LIB([grecs],[grecs_parse],
- [AC_CHECK_HEADER([grecs.h], [cv_libgrecs=yes])])
- if test "$cv_libgrecs" = "yes"; then
- LIBS="$save_LIBS -lgrecs"
+ AC_CHECK_LIB([argot],[argot_parse],
+ [AC_CHECK_HEADER([argot.h], [cv_libargot=yes])])
+ if test "$cv_libargot" = "yes"; then
+ LIBS="$save_LIBS -largot"
m4_if($1,,,[
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
- #include <grecs.h>
+ #include <argot.h>
]],
- [exit(grecs_version_ok("[libgrecs ]$1"));])],
+ [exit(argot_version_ok("[libargot ]$1"));])],
[],
- [cv_libgrecs=no])])
- if test "$cv_libgrecs" = "yes"; then
+ [cv_libargot=no])])
+ if test "$cv_libargot" = "yes"; then
m4_if($2,,[
- AC_DEFINE([HAVE_GRECS_H],[1],
- [Define if <grecs.h> is available])
- AC_DEFINE([HAVE_LIBGRECS],[1],
- [Define if libgrecs is available])
+ AC_DEFINE([HAVE_ARGOT_H],[1],
+ [Define if <argot.h> is available])
+ AC_DEFINE([HAVE_LIBARGOT],[1],
+ [Define if libargot is available])
save_LIBS=$LIBS
],[
$2])
diff --git a/src/lineacc.c b/src/lineacc.c
index c5b4759..84dd719 100644
--- a/src/lineacc.c
+++ b/src/lineacc.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,72 +17,72 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <wordsplit.h>
-static struct grecs_txtacc *line_acc;
+static struct argot_txtacc *line_acc;
void
-grecs_line_acc_create()
+argot_line_acc_create()
{
- line_acc = grecs_txtacc_create();
+ line_acc = argot_txtacc_create();
}
void
-grecs_line_acc_free()
+argot_line_acc_free()
{
- grecs_txtacc_free(line_acc);
+ argot_txtacc_free(line_acc);
line_acc = NULL;
}
void
-grecs_line_acc_grow_char(int c)
+argot_line_acc_grow_char(int c)
{
char t = c;
- grecs_txtacc_grow(line_acc, &t, 1);
+ argot_txtacc_grow(line_acc, &t, 1);
}
int
-grecs_line_acc_grow_char_unescape(int c)
+argot_line_acc_grow_char_unescape(int c)
{
if (c != '\n') {
int uc = wordsplit_c_unquote_char(c);
- grecs_line_acc_grow_char(uc ? uc : c);
+ argot_line_acc_grow_char(uc ? uc : c);
return !uc;
}
return 0;
}
void
-grecs_line_acc_grow(const char *text, size_t len)
+argot_line_acc_grow(const char *text, size_t len)
{
- grecs_txtacc_grow(line_acc, text, len);
+ argot_txtacc_grow(line_acc, text, len);
}
/* Same, but unescapes the last character from text */
void
-grecs_line_acc_grow_unescape_last(char *text, size_t len,
- grecs_locus_t const *loc)
+argot_line_acc_grow_unescape_last(char *text, size_t len,
+ argot_locus_t const *loc)
{
- grecs_txtacc_grow(line_acc, text, len - 2);
- if (grecs_line_acc_grow_char_unescape(text[len - 1]) && loc)
- grecs_warning(loc, 0,
+ argot_txtacc_grow(line_acc, text, len - 2);
+ if (argot_line_acc_grow_char_unescape(text[len - 1]) && loc)
+ argot_warning(loc, 0,
_("unknown escape sequence: '\\%c'"),
text[len - 1]);
}
void
-grecs_line_begin()
+argot_line_begin()
{
if (!line_acc)
- grecs_line_acc_create();
+ argot_line_acc_create();
}
char *
-grecs_line_finish()
+argot_line_finish()
{
- grecs_line_acc_grow_char(0);
- return grecs_txtacc_finish(line_acc, 1);
+ argot_line_acc_grow_char(0);
+ return argot_txtacc_finish(line_acc, 1);
}
diff --git a/src/list.c b/src/list.c
index b2d9f13..a2628d2 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,31 +17,31 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
-#include <grecs-gram.h>
+#include <argot.h>
+#include <argot-gram.h>
#include <stdlib.h>
#include <string.h>
-struct grecs_list *
-grecs_list_create()
+struct argot_list *
+argot_list_create()
{
- struct grecs_list *lp = grecs_malloc(sizeof(*lp));
+ struct argot_list *lp = argot_malloc(sizeof(*lp));
memset(lp, 0, sizeof(*lp));
return lp;
}
size_t
-grecs_list_size(struct grecs_list *lp)
+argot_list_size(struct argot_list *lp)
{
return lp ? lp->count : 0;
}
void
-grecs_list_insert_entry(struct grecs_list *lp,
- struct grecs_list_entry *anchor,
- struct grecs_list_entry *ent, int before)
+argot_list_insert_entry(struct argot_list *lp,
+ struct argot_list_entry *anchor,
+ struct argot_list_entry *ent, int before)
{
- struct grecs_list_entry *p;
+ struct argot_list_entry *p;
if (!anchor) {
ent->prev = NULL;
@@ -56,7 +56,7 @@ grecs_list_insert_entry(struct grecs_list *lp,
}
if (before) {
- grecs_list_insert_entry(lp, anchor->prev, ent, 0);
+ argot_list_insert_entry(lp, anchor->prev, ent, 0);
return;
}
@@ -71,9 +71,9 @@ grecs_list_insert_entry(struct grecs_list *lp,
}
void
-grecs_list_remove_entry(struct grecs_list *lp, struct grecs_list_entry *ent)
+argot_list_remove_entry(struct argot_list *lp, struct argot_list_entry *ent)
{
- struct grecs_list_entry *p;
+ struct argot_list_entry *p;
if ((p = ent->prev))
p->next = ent->next;
else
@@ -82,20 +82,20 @@ grecs_list_remove_entry(struct grecs_list *lp, struct grecs_list_entry *ent)
p->prev = ent->prev;
else
lp->tail = ent->prev;
- grecs_free(ent);
+ argot_free(ent);
lp->count--;
}
void
-grecs_list_append(struct grecs_list *lp, void *val)
+argot_list_append(struct argot_list *lp, void *val)
{
- struct grecs_list_entry *ep = grecs_malloc(sizeof(*ep));
+ struct argot_list_entry *ep = argot_malloc(sizeof(*ep));
ep->data = val;
- grecs_list_insert_entry(lp, lp->tail, ep, 0);
+ argot_list_insert_entry(lp, lp->tail, ep, 0);
}
void
-grecs_list_add(struct grecs_list *dst, struct grecs_list *src)
+argot_list_add(struct argot_list *dst, struct argot_list *src)
{
if (!src->head)
return;
@@ -112,50 +112,50 @@ grecs_list_add(struct grecs_list *dst, struct grecs_list *src)
}
void
-grecs_list_push(struct grecs_list *lp, void *val)
+argot_list_push(struct argot_list *lp, void *val)
{
- struct grecs_list_entry *ep = grecs_malloc(sizeof(*ep));
+ struct argot_list_entry *ep = argot_malloc(sizeof(*ep));
ep->data = val;
- grecs_list_insert_entry(lp, NULL, ep, 0);
+ argot_list_insert_entry(lp, NULL, ep, 0);
}
void *
-grecs_list_pop(struct grecs_list *lp)
+argot_list_pop(struct argot_list *lp)
{
void *data;
- struct grecs_list_entry *ep = lp->head;
+ struct argot_list_entry *ep = lp->head;
if (ep) {
data = ep->data;
- grecs_list_remove_entry(lp, ep);
+ argot_list_remove_entry(lp, ep);
} else
data = NULL;
return data;
}
void *
-grecs_list_remove_tail(struct grecs_list *lp)
+argot_list_remove_tail(struct argot_list *lp)
{
void *data;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
if (!lp->tail)
return NULL;
ep = lp->tail;
data = lp->tail->data;
- grecs_list_remove_entry(lp, ep);
+ argot_list_remove_entry(lp, ep);
return data;
}
void
-grecs_list_clear(struct grecs_list *lp)
+argot_list_clear(struct argot_list *lp)
{
- struct grecs_list_entry *ep = lp->head;
+ struct argot_list_entry *ep = lp->head;
while (ep) {
- struct grecs_list_entry *next = ep->next;
+ struct argot_list_entry *next = ep->next;
if (lp->free_entry)
lp->free_entry(ep->data);
- grecs_free(ep);
+ argot_free(ep);
ep = next;
}
lp->head = lp->tail = NULL;
@@ -163,11 +163,11 @@ grecs_list_clear(struct grecs_list *lp)
}
void
-grecs_list_free(struct grecs_list *lp)
+argot_list_free(struct argot_list *lp)
{
if (lp) {
- grecs_list_clear(lp);
- grecs_free(lp);
+ argot_list_clear(lp);
+ argot_free(lp);
}
}
@@ -178,9 +178,9 @@ _ptrcmp(const void *a, const void *b)
}
void *
-grecs_list_locate(struct grecs_list *lp, void *data)
+argot_list_locate(struct argot_list *lp, void *data)
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
int (*cmp)(const void *, const void *) = lp->cmp ? lp->cmp : _ptrcmp;
for (ep = lp->head; ep; ep = ep->next) {
@@ -191,9 +191,9 @@ grecs_list_locate(struct grecs_list *lp, void *data)
}
void *
-grecs_list_index(struct grecs_list *lp, size_t idx)
+argot_list_index(struct argot_list *lp, size_t idx)
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
for (ep = lp->head; ep && idx; ep = ep->next, idx--)
;
@@ -201,9 +201,9 @@ grecs_list_index(struct grecs_list *lp, size_t idx)
}
int
-grecs_list_compare(struct grecs_list *a, struct grecs_list *b)
+argot_list_compare(struct argot_list *a, struct argot_list *b)
{
- struct grecs_list_entry *ap, *bp;
+ struct argot_list_entry *ap, *bp;
int (*cmp)(const void *, const void *);
if (!a)
@@ -211,7 +211,7 @@ grecs_list_compare(struct grecs_list *a, struct grecs_list *b)
else if (!b)
return 1;
- if (grecs_list_size(a) != grecs_list_size(b))
+ if (argot_list_size(a) != argot_list_size(b))
return 1;
if (a->cmp != b->cmp)
return 1;
diff --git a/src/lookup.c b/src/lookup.c
index 7cb95df..8c0df3f 100644
--- a/src/lookup.c
+++ b/src/lookup.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,16 +20,16 @@
#include <string.h>
#include <errno.h>
#include <ctype.h>
-#include "grecs.h"
+#include "argot.h"
#include "wordsplit.h"
#include <fnmatch.h>
#include <stdlib.h>
static int
-_grecs_list_eq(struct grecs_value *a, struct grecs_value *b)
+_argot_list_eq(struct argot_value *a, struct argot_value *b)
{
- struct grecs_list_entry *aent, *bent;
- if (grecs_list_size(a->v.list) != grecs_list_size(b->v.list))
+ struct argot_list_entry *aent, *bent;
+ if (argot_list_size(a->v.list) != argot_list_size(b->v.list))
return 0;
for (aent = a->v.list->head, bent = b->v.list->head;;
@@ -38,7 +38,7 @@ _grecs_list_eq(struct grecs_value *a, struct grecs_value *b)
return bent == NULL;
if (!bent)
return 0;
- if (!grecs_value_eq(aent->data, bent->data))
+ if (!argot_value_eq(aent->data, bent->data))
return 0;
}
/*notreached*/
@@ -46,7 +46,7 @@ _grecs_list_eq(struct grecs_value *a, struct grecs_value *b)
}
static int
-_grecs_array_eq(struct grecs_value *a, struct grecs_value *b)
+_argot_array_eq(struct argot_value *a, struct argot_value *b)
{
size_t i;
@@ -54,39 +54,39 @@ _grecs_array_eq(struct grecs_value *a, struct grecs_value *b)
return 0;
for (i = 0; i < a->v.arg.c; i++)
- if (!grecs_value_eq(a->v.arg.v[i], b->v.arg.v[i]))
+ if (!argot_value_eq(a->v.arg.v[i], b->v.arg.v[i]))
return 0;
return 1;
}
/* Return 1 if configuration value A equals B */
int
-grecs_value_eq(struct grecs_value *a, struct grecs_value *b)
+argot_value_eq(struct argot_value *a, struct argot_value *b)
{
if (a == 0 || b == 0)
return a == b;
if (a->type != b->type)
return 0;
switch (a->type) {
- case GRECS_TYPE_STRING:
+ case ARGOT_TYPE_STRING:
if (a->v.string == NULL)
return b->v.string == NULL;
return strcmp(a->v.string, b->v.string) == 0;
- case GRECS_TYPE_LIST:
- return _grecs_list_eq(a, b);
+ case ARGOT_TYPE_LIST:
+ return _argot_list_eq(a, b);
- case GRECS_TYPE_ARRAY:
- return _grecs_array_eq(a, b);
+ case ARGOT_TYPE_ARRAY:
+ return _argot_array_eq(a, b);
}
return 0;
}
static int
-_grecs_list_match(struct grecs_value *pat, struct grecs_value *b, int flags)
+_argot_list_match(struct argot_value *pat, struct argot_value *b, int flags)
{
- struct grecs_list_entry *aent, *bent;
- if (grecs_list_size(pat->v.list) != grecs_list_size(b->v.list))
+ struct argot_list_entry *aent, *bent;
+ if (argot_list_size(pat->v.list) != argot_list_size(b->v.list))
return 0;
for (aent = pat->v.list->head, bent = b->v.list->head;;
@@ -95,7 +95,7 @@ _grecs_list_match(struct grecs_value *pat, struct grecs_value *b, int flags)
return bent == NULL;
if (!bent)
return 0;
- if (!grecs_value_match(aent->data, bent->data, flags))
+ if (!argot_value_match(aent->data, bent->data, flags))
return 0;
}
/*notreached*/
@@ -103,7 +103,7 @@ _grecs_list_match(struct grecs_value *pat, struct grecs_value *b, int flags)
}
static int
-_grecs_array_match(struct grecs_value *pat, struct grecs_value *b, int flags)
+_argot_array_match(struct argot_value *pat, struct argot_value *b, int flags)
{
size_t i;
@@ -111,61 +111,61 @@ _grecs_array_match(struct grecs_value *pat, struct grecs_value *b, int flags)
return 0;
for (i = 0; i < pat->v.arg.c; i++)
- if (!grecs_value_match(pat->v.arg.v[i], b->v.arg.v[i], flags))
+ if (!argot_value_match(pat->v.arg.v[i], b->v.arg.v[i], flags))
return 0;
return 1;
}
int
-grecs_value_match(struct grecs_value *pat, struct grecs_value *b, int flags)
+argot_value_match(struct argot_value *pat, struct argot_value *b, int flags)
{
if (pat == 0 || b == 0)
return pat == b;
if (pat->type != b->type) {
- if (pat->type != GRECS_TYPE_STRING)
+ if (pat->type != ARGOT_TYPE_STRING)
return 0;
switch (b->type) {
- case GRECS_TYPE_LIST:
- b = grecs_list_index(b->v.list, 0);
+ case ARGOT_TYPE_LIST:
+ b = argot_list_index(b->v.list, 0);
break;
- case GRECS_TYPE_ARRAY:
+ case ARGOT_TYPE_ARRAY:
b = b->v.arg.v[0];
}
}
switch (pat->type) {
- case GRECS_TYPE_STRING:
+ case ARGOT_TYPE_STRING:
if (pat->v.string == NULL)
return b->v.string == NULL;
return fnmatch(pat->v.string, b->v.string, flags) == 0;
- case GRECS_TYPE_LIST:
- return _grecs_list_match(pat, b, flags);
+ case ARGOT_TYPE_LIST:
+ return _argot_list_match(pat, b, flags);
- case GRECS_TYPE_ARRAY:
- return _grecs_array_match(pat, b, flags);
+ case ARGOT_TYPE_ARRAY:
+ return _argot_array_match(pat, b, flags);
}
return 0;
}
-struct grecs_match_buf {
+struct argot_match_buf {
int argc; /* number of path components */
char **argv; /* array of path components */
int argi; /* Index of the current component */
- struct grecs_value **labelv; /* Component labels */
- struct grecs_node *root; /* Root node */
- struct grecs_node *node; /* Last found node */
+ struct argot_value **labelv; /* Component labels */
+ struct argot_node *root; /* Root node */
+ struct argot_node *node; /* Last found node */
};
#define ISWC(c,w) ((c)[0] == (w) && (c)[1] == 0)
-grecs_match_buf_t
-grecs_match_buf_create(int argc, char **argv, struct grecs_value **labelv)
+argot_match_buf_t
+argot_match_buf_create(int argc, char **argv, struct argot_value **labelv)
{
int i;
- struct grecs_match_buf *buf = grecs_zalloc(sizeof(*buf));
+ struct argot_match_buf *buf = argot_zalloc(sizeof(*buf));
buf->argc = argc;
buf->argv = argv;
@@ -179,7 +179,7 @@ grecs_match_buf_create(int argc, char **argv, struct grecs_value **labelv)
for (j = i + 1;
j < buf->argc && ISWC(buf->argv[j], '*'); j++) {
free(buf->argv[j]);
- grecs_value_free_content(buf->labelv[i]);
+ argot_value_free_content(buf->labelv[i]);
}
j -= i;
if (j > 1) {
@@ -198,63 +198,63 @@ grecs_match_buf_create(int argc, char **argv, struct grecs_value **labelv)
}
size_t
-grecs_match_buf_get_args(grecs_match_buf_t buf, char ***argv)
+argot_match_buf_get_args(argot_match_buf_t buf, char ***argv)
{
if (argv)
*argv = buf->argv;
return buf->argc;
}
-struct grecs_node *
-grecs_match_buf_get_node(grecs_match_buf_t buf)
+struct argot_node *
+argot_match_buf_get_node(argot_match_buf_t buf)
{
return buf->node;
}
-struct grecs_node *
-grecs_match_buf_get_root(grecs_match_buf_t buf)
+struct argot_node *
+argot_match_buf_get_root(argot_match_buf_t buf)
{
return buf->root;
}
void
-grecs_match_buf_set_root(grecs_match_buf_t buf, struct grecs_node *root)
+argot_match_buf_set_root(argot_match_buf_t buf, struct argot_node *root)
{
buf->root = root;
}
static void
-grecs_match_buf_free_contents(struct grecs_match_buf *buf)
+argot_match_buf_free_contents(struct argot_match_buf *buf)
{
size_t i;
for (i = 0; i < buf->argc; i++) {
free(buf->argv[i]);
- grecs_value_free(buf->labelv[i]);
+ argot_value_free(buf->labelv[i]);
}
free(buf->argv);
free(buf->labelv);
}
void
-grecs_match_buf_free(struct grecs_match_buf *buf)
+argot_match_buf_free(struct argot_match_buf *buf)
{
if (buf) {
- grecs_match_buf_free_contents(buf);
+ argot_match_buf_free_contents(buf);
free(buf);
}
}
-static struct grecs_value *
+static struct argot_value *
parse_label(const char *str)
{
- struct grecs_value *val = NULL;
+ struct argot_value *val = NULL;
size_t i;
struct wordsplit ws;
size_t len = strlen (str);
if (len > 1 && str[0] == '(' && str[len-1] == ')') {
- struct grecs_list *lst;
+ struct argot_list *lst;
ws.ws_delim = ",";
if (wordsplit_len (str + 1, len - 2, &ws,
@@ -263,32 +263,32 @@ parse_label(const char *str)
return NULL;
}
- lst = grecs_value_list_create();
+ lst = argot_value_list_create();
for (i = 0; i < ws.ws_wordc; i++) {
- struct grecs_value *p = grecs_zalloc(sizeof(*p));
- p->type = GRECS_TYPE_STRING;
+ struct argot_value *p = argot_zalloc(sizeof(*p));
+ p->type = ARGOT_TYPE_STRING;
p->v.string = ws.ws_wordv[i];
- grecs_list_append(lst, p);
+ argot_list_append(lst, p);
}
- val = grecs_malloc(sizeof(*val));
- val->type = GRECS_TYPE_LIST;
+ val = argot_malloc(sizeof(*val));
+ val->type = ARGOT_TYPE_LIST;
val->v.list = lst;
} else {
if (wordsplit(str, &ws, WRDSF_DEFFLAGS))
return NULL;
- val = grecs_zalloc(sizeof(*val));
+ val = argot_zalloc(sizeof(*val));
if (ws.ws_wordc == 1) {
- val->type = GRECS_TYPE_STRING;
+ val->type = ARGOT_TYPE_STRING;
val->v.string = ws.ws_wordv[0];
} else {
- val->type = GRECS_TYPE_ARRAY;
+ val->type = ARGOT_TYPE_ARRAY;
val->v.arg.c = ws.ws_wordc;
- val->v.arg.v = grecs_calloc(ws.ws_wordc,
+ val->v.arg.v = argot_calloc(ws.ws_wordc,
sizeof(val->v.arg.v[0]));
for (i = 0; i < ws.ws_wordc; i++) {
val->v.arg.v[i] =
- grecs_zalloc(sizeof(*val->v.arg.v[0]));
- val->v.arg.v[i]->type = GRECS_TYPE_STRING;
+ argot_zalloc(sizeof(*val->v.arg.v[0]));
+ val->v.arg.v[i]->type = ARGOT_TYPE_STRING;
val->v.arg.v[i]->v.string = ws.ws_wordv[i];
}
}
@@ -300,7 +300,7 @@ parse_label(const char *str)
static int
split_cfg_path(const char *path, int *pargc, char ***pargv,
- grecs_value_t ***pvalv)
+ argot_value_t ***pvalv)
{
int argc;
char **argv;
@@ -344,9 +344,9 @@ split_cfg_path(const char *path, int *pargc, char ***pargv,
*pargc = argc;
if (pvalv) {
int i;
- grecs_value_t **valv;
+ argot_value_t **valv;
- valv = grecs_calloc(argc, sizeof(valv[0]));
+ valv = argot_calloc(argc, sizeof(valv[0]));
for (i = 0; i < argc; i++) {
char *p = strchr(argv[i], '=');
if (p) {
@@ -360,50 +360,50 @@ split_cfg_path(const char *path, int *pargc, char ***pargv,
}
-enum grecs_tree_recurse_res
-grecs_node_exact_match(enum grecs_tree_recurse_op op,
- struct grecs_node *node, void *data)
+enum argot_tree_recurse_res
+argot_node_exact_match(enum argot_tree_recurse_op op,
+ struct argot_node *node, void *data)
{
int match = 0;
- struct grecs_match_buf *buf = data;
+ struct argot_match_buf *buf = data;
- if (node->type == grecs_node_root)
- return grecs_tree_recurse_ok;
- if (op == grecs_tree_recurse_post) {
+ if (node->type == argot_node_root)
+ return argot_tree_recurse_ok;
+ if (op == argot_tree_recurse_post) {
if (buf->argi == 0)
- return grecs_tree_recurse_stop;
+ return argot_tree_recurse_stop;
--buf->argi;
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
if (strcmp(buf->argv[buf->argi], node->ident) == 0
&& (!buf->labelv[buf->argi] ||
- grecs_value_eq(buf->labelv[buf->argi], node->v.value))) {
+ argot_value_eq(buf->labelv[buf->argi], node->v.value))) {
if (buf->argi + 1 == buf->argc) {
buf->node = node;
- return grecs_tree_recurse_stop;
+ return argot_tree_recurse_stop;
}
match = 1;
}
if (match) {
- if (op == grecs_tree_recurse_pre) {
+ if (op == argot_tree_recurse_pre) {
if (buf->argi + 1 == buf->argc)
- return grecs_tree_recurse_skip;
+ return argot_tree_recurse_skip;
buf->argi++;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
- return node->type == grecs_node_block ?
- grecs_tree_recurse_skip : grecs_tree_recurse_ok;
+ return node->type == argot_node_block ?
+ argot_tree_recurse_skip : argot_tree_recurse_ok;
}
-struct grecs_node *
-grecs_find_node(struct grecs_node *node, const char *path)
+struct argot_node *
+argot_find_node(struct argot_node *node, const char *path)
{
int rc;
- struct grecs_match_buf buf;
+ struct argot_match_buf buf;
if (strcmp(path, ".") == 0)
return node;
@@ -412,18 +412,18 @@ grecs_find_node(struct grecs_node *node, const char *path)
return NULL;
buf.argi = 0;
buf.node = NULL;
- grecs_tree_recurse(node, grecs_node_exact_match, &buf);
- grecs_match_buf_free_contents(&buf);
+ argot_tree_recurse(node, argot_node_exact_match, &buf);
+ argot_match_buf_free_contents(&buf);
return buf.node;
}
static void
-fixup_loci(struct grecs_node *node,
- grecs_locus_t const *plocus,
- struct grecs_locus_point const *endp)
+fixup_loci(struct argot_node *node,
+ argot_locus_t const *plocus,
+ struct argot_locus_point const *endp)
{
- grecs_locus_t loc = *plocus;
+ argot_locus_t loc = *plocus;
for (; node; node = node->down) {
node->idloc = loc;
@@ -434,24 +434,24 @@ fixup_loci(struct grecs_node *node,
}
}
-struct grecs_node *
-grecs_node_from_path_locus(const char *path, const char *value,
- grecs_locus_t *plocus, grecs_locus_t *vallocus)
+struct argot_node *
+argot_node_from_path_locus(const char *path, const char *value,
+ argot_locus_t *plocus, argot_locus_t *vallocus)
{
int rc;
int i;
int argc;
char **argv;
- struct grecs_node *dn = NULL;
+ struct argot_node *dn = NULL;
rc = split_cfg_path(path, &argc, &argv, NULL);
if (rc)
return NULL;
- dn = grecs_node_create(grecs_node_stmt, NULL);
+ dn = argot_node_create(argot_node_stmt, NULL);
dn->ident = argv[argc - 1];
if (value) {
- struct grecs_value *gval = parse_label(value);
+ struct argot_value *gval = parse_label(value);
if (vallocus)
gval->locus = *vallocus;
dn->v.value = gval;
@@ -459,8 +459,8 @@ grecs_node_from_path_locus(const char *path, const char *value,
dn->v.value = NULL;
for (i = argc - 2; i >= 0; i--) {
- struct grecs_value *label = NULL;
- struct grecs_node *node;
+ struct argot_value *label = NULL;
+ struct argot_node *node;
char *p, *q = argv[i];
do {
@@ -475,7 +475,7 @@ grecs_node_from_path_locus(const char *path, const char *value,
break;
} while (*q);
- node = grecs_node_create(grecs_node_block, plocus);
+ node = argot_node_create(argot_node_block, plocus);
node->ident = argv[i];
if (label)
node->v.value = label;
@@ -494,23 +494,23 @@ grecs_node_from_path_locus(const char *path, const char *value,
return dn;
}
-struct grecs_node *
-grecs_node_from_path(const char *path, const char *value)
+struct argot_node *
+argot_node_from_path(const char *path, const char *value)
{
- return grecs_node_from_path_locus(path, value, NULL, NULL);
+ return argot_node_from_path_locus(path, value, NULL, NULL);
}
static int
-is_root(struct grecs_match_buf *buf, struct grecs_node *node)
+is_root(struct argot_match_buf *buf, struct argot_node *node)
{
- return (buf->root == node || node->type == grecs_node_root);
+ return (buf->root == node || node->type == argot_node_root);
}
static int
-grecs_match(struct grecs_match_buf *buf)
+argot_match(struct argot_match_buf *buf)
{
- struct grecs_node *node;
+ struct argot_node *node;
int wcard = 0;
buf->argi = buf->argc - 1;
@@ -528,7 +528,7 @@ grecs_match(struct grecs_match_buf *buf)
strcmp(buf->argv[buf->argi], node->ident) == 0)
/* FIXME: */
&& (!buf->labelv[buf->argi] ||
- grecs_value_match(buf->labelv[buf->argi],
+ argot_value_match(buf->labelv[buf->argi],
node->v.value, 0))) {
wcard = 0;
node = node->up;
@@ -544,56 +544,56 @@ grecs_match(struct grecs_match_buf *buf)
return 0;
}
-struct grecs_node *
-grecs_match_next(struct grecs_match_buf *buf)
+struct argot_node *
+argot_match_next(struct argot_match_buf *buf)
{
if (!buf)
return NULL;
- while ((buf->node = grecs_next_node(buf->node)))
- if (grecs_match(buf))
+ while ((buf->node = argot_next_node(buf->node)))
+ if (argot_match(buf))
break;
return buf->node;
}
-struct grecs_node *
-grecs_match_buf_first(struct grecs_match_buf *buf, struct grecs_node *tree)
+struct argot_node *
+argot_match_buf_first(struct argot_match_buf *buf, struct argot_node *tree)
{
- struct grecs_node *node;
+ struct argot_node *node;
buf->argi = 0;
buf->root = tree;
- buf->node = grecs_tree_first_node(tree);
+ buf->node = argot_tree_first_node(tree);
if (!buf->node)
return NULL;
- if (grecs_match(buf))
+ if (argot_match(buf))
node = buf->node;
else
- node = grecs_match_next(buf);
+ node = argot_match_next(buf);
return node;
}
-struct grecs_node *
-grecs_match_first(struct grecs_node *tree, const char *pattern,
- struct grecs_match_buf **pbuf)
+struct argot_node *
+argot_match_first(struct argot_node *tree, const char *pattern,
+ struct argot_match_buf **pbuf)
{
- struct grecs_node *node;
- struct grecs_match_buf *buf;
+ struct argot_node *node;
+ struct argot_match_buf *buf;
if (strcmp(pattern, ".") == 0) {
*pbuf = NULL;
return tree;
}
- buf = grecs_zalloc(sizeof(*buf));
+ buf = argot_zalloc(sizeof(*buf));
if (split_cfg_path(pattern, &buf->argc, &buf->argv, &buf->labelv)) {
free(buf);
return NULL;
}
- node = grecs_match_buf_first(buf, tree);
+ node = argot_match_buf_first(buf, tree);
if (node)
*pbuf = buf;
else {
- grecs_match_buf_free(buf);
+ argot_match_buf_free(buf);
*pbuf = NULL;
}
return node;
diff --git a/src/mem.c b/src/mem.c
index e4d2935..a735d91 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -40,61 +40,61 @@ def_free_fun(void *ptr)
free(ptr);
}
-void *(*grecs_malloc_fun)(size_t size) = def_malloc_fun;
-void *(*grecs_realloc_fun)(void *ptr, size_t size) = def_realloc_fun;
-void (*grecs_alloc_die_fun)(void);
-void (*grecs_free_fun)(void *) = def_free_fun;
+void *(*argot_malloc_fun)(size_t size) = def_malloc_fun;
+void *(*argot_realloc_fun)(void *ptr, size_t size) = def_realloc_fun;
+void (*argot_alloc_die_fun)(void);
+void (*argot_free_fun)(void *) = def_free_fun;
void
-grecs_free(void *ptr)
+argot_free(void *ptr)
{
- grecs_free_fun(ptr);
+ argot_free_fun(ptr);
}
void *
-grecs_malloc(size_t size)
+argot_malloc(size_t size)
{
- void *ptr = grecs_malloc_fun(size);
+ void *ptr = argot_malloc_fun(size);
if (!ptr)
- grecs_alloc_die();
+ argot_alloc_die();
return ptr;
}
void *
-grecs_zalloc(size_t size)
+argot_zalloc(size_t size)
{
- void *ptr = grecs_malloc(size);
+ void *ptr = argot_malloc(size);
memset(ptr, 0, size);
return ptr;
}
void *
-grecs_calloc(size_t nmemb, size_t size)
+argot_calloc(size_t nmemb, size_t size)
{
- return grecs_zalloc(nmemb * size);
+ return argot_zalloc(nmemb * size);
}
void *
-grecs_realloc(void *ptr, size_t size)
+argot_realloc(void *ptr, size_t size)
{
- void *newptr = grecs_realloc_fun(ptr, size);
+ void *newptr = argot_realloc_fun(ptr, size);
if (!newptr)
- grecs_alloc_die();
+ argot_alloc_die();
return newptr;
}
char *
-grecs_strdup(const char *str)
+argot_strdup(const char *str)
{
- char *newstr = grecs_malloc(strlen(str) + 1);
+ char *newstr = argot_malloc(strlen(str) + 1);
return strcpy(newstr, str);
}
void
-grecs_alloc_die(void)
+argot_alloc_die(void)
{
- if (grecs_alloc_die_fun)
- grecs_alloc_die_fun();
- grecs_error(NULL, ENOMEM, "fatal error");
+ if (argot_alloc_die_fun)
+ argot_alloc_die_fun();
+ argot_error(NULL, ENOMEM, "fatal error");
exit(70); /* EX_SOFTWARE */
}
diff --git a/src/meta1-gram.y b/src/meta1-gram.y
index 3b9ca63..280f89c 100644
--- a/src/meta1-gram.y
+++ b/src/meta1-gram.y
@@ -20,12 +20,12 @@
#endif
#include <errno.h>
#include <string.h>
-#include "grecs.h"
+#include "argot.h"
int yylex(void);
int yyerror(char const *s);
-static struct grecs_node *parse_tree;
+static struct argot_node *parse_tree;
extern int yy_flex_debug;
extern void yyset_in(FILE *);
%}
@@ -35,10 +35,10 @@ extern void yyset_in(FILE *);
%union {
char *string;
- grecs_value_t svalue, *pvalue;
- struct grecs_list *list;
- struct { struct grecs_node *head, *tail; } node_list;
- struct grecs_node *node;
+ argot_value_t svalue, *pvalue;
+ struct argot_list *list;
+ struct { struct argot_node *head, *tail; } node_list;
+ struct argot_node *node;
}
%token <string> META1_STRING META1_IDENT
@@ -52,9 +52,9 @@ extern void yyset_in(FILE *);
input : maybe_stmtlist
{
- parse_tree = grecs_node_create(grecs_node_root, &@1);
- parse_tree->v.texttab = grecs_text_table();
- grecs_node_bind(parse_tree, $1, 1);
+ parse_tree = argot_node_create(argot_node_root, &@1);
+ parse_tree->v.texttab = argot_text_table();
+ argot_node_bind(parse_tree, $1, 1);
}
;
@@ -75,7 +75,7 @@ stmtlist: stmt
}
| stmtlist stmt
{
- grecs_node_bind($1.tail, $2, 0);
+ argot_node_bind($1.tail, $2, 0);
}
;
@@ -85,7 +85,7 @@ stmt : simple
simple : META1_IDENT '=' value opt_sc
{
- $$ = grecs_node_create_points(grecs_node_stmt,
+ $$ = argot_node_create_points(argot_node_stmt,
@1.beg, @3.end);
$$->ident = $1;
$$->idloc = @1;
@@ -95,12 +95,12 @@ simple : META1_IDENT '=' value opt_sc
block : META1_IDENT tag '{' stmtlist '}' opt_sc
{
- $$ = grecs_node_create_points(grecs_node_block,
+ $$ = argot_node_create_points(argot_node_block,
@1.beg, @5.end);
$$->ident = $1;
$$->idloc = @1;
$$->v.value = $2;
- grecs_node_bind($$, $4.head, 1);
+ argot_node_bind($$, $4.head, 1);
}
;
@@ -110,23 +110,23 @@ tag : /* empty */
}
| META1_IDENT
{
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_STRING;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_STRING;
$$->v.string = $1;
}
;
value : string
{
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_STRING;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_STRING;
$$->locus = @1;
$$->v.string = $1;
}
| list
{
- $$ = grecs_malloc(sizeof($$[0]));
- $$->type = GRECS_TYPE_LIST;
+ $$ = argot_malloc(sizeof($$[0]));
+ $$->type = ARGOT_TYPE_LIST;
$$->locus = @1;
$$->v.list = $1;
}
@@ -138,26 +138,26 @@ string : META1_IDENT
slist : slist0
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
- grecs_line_begin();
+ argot_line_begin();
for (ep = $1->head; ep; ep = ep->next) {
- grecs_line_add(ep->data, strlen(ep->data));
+ argot_line_add(ep->data, strlen(ep->data));
free(ep->data);
ep->data = NULL;
}
- $$ = grecs_line_finish();
- grecs_list_free($1);
+ $$ = argot_line_finish();
+ argot_list_free($1);
}
slist0 : META1_STRING
{
- $$ = grecs_list_create();
- grecs_list_append($$, $1);
+ $$ = argot_list_create();
+ argot_list_append($$, $1);
}
| slist0 META1_STRING
{
- grecs_list_append($1, $2);
+ argot_list_append($1, $2);
$$ = $1;
}
;
@@ -174,12 +174,12 @@ list : '{' values '}'
values : value
{
- $$ = grecs_value_list_create();
- grecs_list_append($$, $1);
+ $$ = argot_value_list_create();
+ argot_list_append($$, $1);
}
| values ',' value
{
- grecs_list_append($1, $3);
+ argot_list_append($1, $3);
$$ = $1;
}
;
@@ -192,33 +192,33 @@ opt_sc : /* empty */
int
yyerror(char const *s)
{
- grecs_error(&yylloc, 0, "%s", s);
+ argot_error(&yylloc, 0, "%s", s);
return 0;
}
-struct grecs_node *
-grecs_meta1_parser(const char *name, int traceflags)
+struct argot_node *
+argot_meta1_parser(const char *name, int traceflags)
{
int rc;
FILE *fp;
fp = fopen(name, "r");
if (!fp) {
- grecs_error(NULL, errno, _("Cannot open `%s'"), name);
+ argot_error(NULL, errno, _("Cannot open `%s'"), name);
return NULL;
}
yyset_in(fp);
- yy_flex_debug = traceflags & GRECS_TRACE_LEX;
- yydebug = traceflags & GRECS_TRACE_GRAM;
+ yy_flex_debug = traceflags & ARGOT_TRACE_LEX;
+ yydebug = traceflags & ARGOT_TRACE_GRAM;
parse_tree = NULL;
- grecs_line_acc_create();
+ argot_line_acc_create();
rc = yyparse();
fclose(fp);
- if (grecs_error_count)
+ if (argot_error_count)
rc = 1;
- grecs_line_acc_free();
+ argot_line_acc_free();
if (rc) {
- grecs_tree_free(parse_tree);
+ argot_tree_free(parse_tree);
parse_tree = NULL;
}
return parse_tree;
diff --git a/src/meta1-lex.l b/src/meta1-lex.l
index a5f873b..34bb905 100644
--- a/src/meta1-lex.l
+++ b/src/meta1-lex.l
@@ -24,7 +24,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include "grecs.h"
+#include "argot.h"
#include "meta1-gram.h"
#include <ctype.h>
}
@@ -35,11 +35,11 @@ static void meta1_line_add_unescape_hex(const char *text, size_t len);
#define YY_USER_ACTION do { \
if (YYSTATE == 0) { \
- yylloc.beg = grecs_current_locus_point; \
+ yylloc.beg = argot_current_locus_point; \
yylloc.beg.col++; \
} \
- grecs_current_locus_point.col += yyleng; \
- yylloc.end = grecs_current_locus_point; \
+ argot_current_locus_point.col += yyleng; \
+ yylloc.end = argot_current_locus_point; \
} while (0);
%}
@@ -50,56 +50,56 @@ X [0-9a-fA-F]
"/*" BEGIN (COMMENT);
<COMMENT>[^*\n]* /* eat anything that's not a '*' */
<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
-<COMMENT>\n grecs_locus_point_advance_line(grecs_current_locus_point);
+<COMMENT>\n argot_locus_point_advance_line(argot_current_locus_point);
<COMMENT>"*"+"/" BEGIN (INITIAL);
/* End-of-line comments */
-#.*\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+#.*\n { argot_locus_point_advance_line(argot_current_locus_point); }
#.* /* end-of-file comment */;
/* Number */
0[xX]{X}+ |
0[0-7]+ |
-[1-9][0-9]+ { grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+[1-9][0-9]+ { argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return META1_STRING; }
/* Identifiers (unquoted strings) */
-[a-zA-Z0-9_\./:\*-]+ { grecs_line_begin();
- grecs_line_add(yytext, yyleng);
- yylval.string = grecs_line_finish();
+[a-zA-Z0-9_\./:\*-]+ { argot_line_begin();
+ argot_line_add(yytext, yyleng);
+ yylval.string = argot_line_finish();
return META1_IDENT; }
/* Quoted strings */
-\"[^\\"\n]*\" { grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 2);
- yylval.string = grecs_line_finish();
+\"[^\\"\n]*\" { argot_line_begin();
+ argot_line_add(yytext + 1, yyleng - 2);
+ yylval.string = argot_line_finish();
return META1_STRING; }
\"[^\\"\n]*\\x{X}{1,2} { BEGIN(STR);
- grecs_line_begin();
+ argot_line_begin();
meta1_line_add_unescape_hex(yytext + 1, yyleng - 1);
}
\"[^\\"\n]*\\. { BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow_unescape_last(yytext + 1,
+ argot_line_begin();
+ argot_line_acc_grow_unescape_last(yytext + 1,
yyleng - 1,
&yylloc); }
<STR>[^\\"\n]*\\x{X}{1,2} { meta1_line_add_unescape_hex(yytext, yyleng); }
-<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+<STR>[^\\"\n]*\\. { argot_line_acc_grow_unescape_last(yytext, yyleng,
&yylloc); }
<STR>[^\\"\n]*\" { BEGIN(INITIAL);
if (yyleng > 1)
- grecs_line_add(yytext, yyleng - 1);
- yylval.string = grecs_line_finish();
+ argot_line_add(yytext, yyleng - 1);
+ yylval.string = argot_line_finish();
return META1_STRING; }
<STR>[^\\"\n]*\n { BEGIN(INITIAL);
- grecs_error(&yylloc, 0,
+ argot_error(&yylloc, 0,
_("newline in a string"));
- grecs_line_add(yytext, yyleng - 1);
- yylval.string = grecs_line_finish();
+ argot_line_add(yytext, yyleng - 1);
+ yylval.string = argot_line_finish();
return META1_STRING; }
/* Other tokens */
[ \t\f][ \t\f]* ;
-\n { grecs_locus_point_advance_line(grecs_current_locus_point); }
+\n { argot_locus_point_advance_line(argot_current_locus_point); }
[,;{}=] return yytext[0];
-. { grecs_error(&yylloc, 0,
+. { argot_error(&yylloc, 0,
(isascii(yytext[0]) && isprint(yytext[0])) ?
_("stray character %c") :
_("stray character \\%03o"),
@@ -117,8 +117,8 @@ meta1_line_add_unescape_hex(const char *text, size_t len)
{
for (; text[len-1] != 'x' && len > 0; len--)
;
- grecs_line_acc_grow(text, len - 2);
- grecs_line_acc_grow_char((char) strtoul (text + len, NULL, 16));
+ argot_line_acc_grow(text, len - 2);
+ argot_line_acc_grow_char((char) strtoul (text + len, NULL, 16));
}
diff --git a/src/opthelp.c b/src/opthelp.c
index c9b7b46..702852a 100644
--- a/src/opthelp.c
+++ b/src/opthelp.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,8 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "grecs.h"
-#include "grecs/opt.h"
+#include "argot.h"
+#include "argot/opt.h"
#include "wordsplit.h"
static void
@@ -60,8 +60,8 @@ print_option_descr(const char *descr, size_t lmargin, size_t rmargin)
static int
optcmp(const void *a, const void *b)
{
- struct grecs_opthelp const *ap = (struct grecs_opthelp const *)a;
- struct grecs_opthelp const *bp = (struct grecs_opthelp const *)b;
+ struct argot_opthelp const *ap = (struct argot_opthelp const *)a;
+ struct argot_opthelp const *bp = (struct argot_opthelp const *)b;
const char *opta, *optb;
size_t alen, blen;
@@ -80,13 +80,13 @@ optcmp(const void *a, const void *b)
}
static void
-sort_options(struct grecs_opthelp *opthelp, int start, int count)
+sort_options(struct argot_opthelp *opthelp, int start, int count)
{
qsort(opthelp + start, count, sizeof(opthelp[0]), optcmp);
}
static int
-sort_group(struct grecs_opthelp *opthelp, size_t optcount, int start)
+sort_group(struct argot_opthelp *opthelp, size_t optcount, int start)
{
int i;
@@ -97,7 +97,7 @@ sort_group(struct grecs_opthelp *opthelp, size_t optcount, int start)
}
static void
-sort_opthelp(struct grecs_opthelp *opthelp, size_t optcount)
+sort_opthelp(struct argot_opthelp *opthelp, size_t optcount)
{
int start;
@@ -112,11 +112,11 @@ sort_opthelp(struct grecs_opthelp *opthelp, size_t optcount)
#define ISEMPTY(s) ((s) == NULL || *(s) == 0)
void
-grecs_print_help(struct grecs_proginfo *pinfo)
+argot_print_help(struct argot_proginfo *pinfo)
{
unsigned i;
int argsused = 0;
- struct grecs_opthelp *opthelp;
+ struct argot_opthelp *opthelp;
size_t optcount;
printf("%s %s ",
@@ -210,8 +210,8 @@ grecs_print_help(struct grecs_proginfo *pinfo)
static int
cmpidx_short(const void *a, const void *b)
{
- struct grecs_opthelp const **opta = (struct grecs_opthelp const **)a;
- struct grecs_opthelp const **optb = (struct grecs_opthelp const **)b;
+ struct argot_opthelp const **opta = (struct argot_opthelp const **)a;
+ struct argot_opthelp const **optb = (struct argot_opthelp const **)b;
return (*opta)->opt[1] - (*optb)->opt[1];
}
@@ -220,8 +220,8 @@ cmpidx_short(const void *a, const void *b)
static int
cmpidx_long(const void *a, const void *b)
{
- struct grecs_opthelp const **ap = (struct grecs_opthelp const **)a;
- struct grecs_opthelp const **bp = (struct grecs_opthelp const **)b;
+ struct argot_opthelp const **ap = (struct argot_opthelp const **)a;
+ struct argot_opthelp const **bp = (struct argot_opthelp const **)b;
char const *opta, *optb;
size_t lena, lenb;
@@ -241,15 +241,15 @@ cmpidx_long(const void *a, const void *b)
#endif
void
-grecs_print_usage(struct grecs_proginfo *pinfo)
+argot_print_usage(struct argot_proginfo *pinfo)
{
unsigned i;
unsigned n;
char *buf;
size_t bufsize;
unsigned nidx;
- struct grecs_opthelp **optidx;
- struct grecs_opthelp *opthelp = pinfo->opthelp;
+ struct argot_opthelp **optidx;
+ struct argot_opthelp *opthelp = pinfo->opthelp;
size_t optcount = pinfo->optcount;
#define FLUSH do { \
@@ -261,10 +261,10 @@ grecs_print_usage(struct grecs_proginfo *pinfo)
#define ADDC(c) \
do { if (n == RMARGIN) FLUSH; buf[n++] = c; } while (0)
- optidx = grecs_calloc(optcount, sizeof(optidx[0]));
+ optidx = argot_calloc(optcount, sizeof(optidx[0]));
bufsize = RMARGIN + 1;
- buf = grecs_malloc(bufsize);
+ buf = argot_malloc(bufsize);
n = snprintf(buf, bufsize, "%s %s ", _("Usage:"), pinfo->progname);
if (pinfo->subcmd)
@@ -302,7 +302,7 @@ grecs_print_usage(struct grecs_proginfo *pinfo)
qsort(optidx, nidx, sizeof(optidx[0]), cmpidx_short);
for (i = 0; i < nidx; i++) {
- struct grecs_opthelp *opt = optidx[i];
+ struct argot_opthelp *opt = optidx[i];
size_t len = 5 + strlen(opt->arg)
+ (opt->is_optional ? 2 : 1);
@@ -338,7 +338,7 @@ grecs_print_usage(struct grecs_proginfo *pinfo)
qsort (optidx, nidx, sizeof(optidx[0]), cmpidx_long);
for (i = 0; i < nidx; i++) {
- struct grecs_opthelp *opt = optidx[i];
+ struct argot_opthelp *opt = optidx[i];
size_t len;
const char *longopt;
@@ -358,7 +358,7 @@ grecs_print_usage(struct grecs_proginfo *pinfo)
the string cannot be split */
if (n + len > bufsize) {
bufsize = n + len;
- buf = grecs_realloc(buf, bufsize);
+ buf = argot_realloc(buf, bufsize);
}
}
buf[n++] = ' ';
@@ -408,7 +408,7 @@ grecs_print_usage(struct grecs_proginfo *pinfo)
split */
if (n + len > bufsize) {
bufsize = n + len;
- buf = grecs_realloc(buf,
+ buf = argot_realloc(buf,
bufsize);
}
}
@@ -442,7 +442,7 @@ const char version_etc_copyright[] =
"Copyright %s %s %s";
void
-grecs_print_version_only(struct grecs_proginfo *pinfo, FILE *stream)
+argot_print_version_only(struct argot_proginfo *pinfo, FILE *stream)
{
fprintf(stream, "%s", pinfo->progname);
if (!ISEMPTY(pinfo->package))
@@ -469,9 +469,9 @@ static const char gplv3[] =
"There is NO WARRANTY, to the extent permitted by law.\n\n");
void
-grecs_print_version(struct grecs_proginfo *pinfo, FILE *stream)
+argot_print_version(struct argot_proginfo *pinfo, FILE *stream)
{
- grecs_print_version_only(pinfo, stream);
+ argot_print_version_only(pinfo, stream);
fputs(gettext(ISEMPTY(pinfo->license) ?
gplv3 : pinfo->license), stream);
if (pinfo->print_version_hook)
diff --git a/src/parser.c b/src/parser.c
index ed99a7a..94ec0d9 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,62 +20,62 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "grecs.h"
+#include "argot.h"
-int grecs_error_count = 0;
-int grecs_default_port = 0;
+int argot_error_count = 0;
+int argot_default_port = 0;
-int grecs_trace_flags = 0;
-int grecs_parser_options = 0;
+int argot_trace_flags = 0;
+int argot_parser_options = 0;
-#ifndef GRECS_DEFAULT_PARSER
-# define GRECS_DEFAULT_PARSER grecs_grecs_parser
+#ifndef ARGOT_DEFAULT_PARSER
+# define ARGOT_DEFAULT_PARSER argot_argot_parser
#endif
-struct grecs_node *(*grecs_parser_fun)(const char *name, int trace) =
- GRECS_DEFAULT_PARSER;
+struct argot_node *(*argot_parser_fun)(const char *name, int trace) =
+ ARGOT_DEFAULT_PARSER;
void
-grecs_gram_trace(int n)
+argot_gram_trace(int n)
{
if (n)
- grecs_trace_flags |= GRECS_TRACE_GRAM;
+ argot_trace_flags |= ARGOT_TRACE_GRAM;
else
- grecs_trace_flags &= ~GRECS_TRACE_GRAM;
+ argot_trace_flags &= ~ARGOT_TRACE_GRAM;
}
void
-grecs_lex_trace(int n)
+argot_lex_trace(int n)
{
if (n)
- grecs_trace_flags |= GRECS_TRACE_LEX;
+ argot_trace_flags |= ARGOT_TRACE_LEX;
else
- grecs_trace_flags &= ~GRECS_TRACE_LEX;
+ argot_trace_flags &= ~ARGOT_TRACE_LEX;
}
-struct grecs_node *
-grecs_parse(const char *name)
+struct argot_node *
+argot_parse(const char *name)
{
- if (!grecs_trace_flags) {
- char *p = getenv("GRECS_DEBUG");
+ if (!argot_trace_flags) {
+ char *p = getenv("ARGOT_DEBUG");
if (p) {
while (*p) {
switch (*p++) {
case 'g':
case 'G':
- grecs_trace_flags |= GRECS_TRACE_GRAM;
+ argot_trace_flags |= ARGOT_TRACE_GRAM;
break;
case 'l':
case 'L':
- grecs_trace_flags |= GRECS_TRACE_LEX;
+ argot_trace_flags |= ARGOT_TRACE_LEX;
break;
}
}
}
}
- grecs_error_count = 0;
- grecs_current_locus_point.file = grecs_install_text(name);
- grecs_current_locus_point.line = 1;
- grecs_current_locus_point.col = 0;
- return grecs_parser_fun(name, grecs_trace_flags);
+ argot_error_count = 0;
+ argot_current_locus_point.file = argot_install_text(name);
+ argot_current_locus_point.line = 1;
+ argot_current_locus_point.col = 0;
+ return argot_parser_fun(name, argot_trace_flags);
}
diff --git a/src/parsertab.c b/src/parsertab.c
index f876401..a3236d5 100644
--- a/src/parsertab.c
+++ b/src/parsertab.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,32 +20,32 @@
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
-#include "grecs.h"
+#include "argot.h"
static struct parser_tab {
const char *name;
- grecs_parser_t parser;
+ argot_parser_t parser;
} parser_tab[] = {
- { "GRECS", grecs_grecs_parser },
- { "PATH", grecs_path_parser },
+ { "ARGOT", argot_argot_parser },
+ { "PATH", argot_path_parser },
#ifdef ENABLE_META1_PARSER
- { "META1", grecs_meta1_parser },
+ { "META1", argot_meta1_parser },
#endif
#ifdef ENABLE_BIND_PARSER
- { "BIND", grecs_bind_parser },
+ { "BIND", argot_bind_parser },
#endif
#ifdef ENABLE_DHCPD_PARSER
- { "DHCPD", grecs_dhcpd_parser },
- { "DHCP", grecs_dhcpd_parser },
+ { "DHCPD", argot_dhcpd_parser },
+ { "DHCP", argot_dhcpd_parser },
#endif
#ifdef ENABLE_GIT_PARSER
- { "GIT", grecs_git_parser },
+ { "GIT", argot_git_parser },
#endif
{ NULL }
};
int
-grecs_enumerate_parsers(int (*fun)(const char *, grecs_parser_t, void *),
+argot_enumerate_parsers(int (*fun)(const char *, argot_parser_t, void *),
void *data)
{
struct parser_tab *pt;
@@ -56,8 +56,8 @@ grecs_enumerate_parsers(int (*fun)(const char *, grecs_parser_t, void *),
return rc;
}
-grecs_parser_t
-grecs_get_parser_by_type(const char *type)
+argot_parser_t
+argot_get_parser_by_type(const char *type)
{
struct parser_tab *pt;
diff --git a/src/path-parser.c b/src/path-parser.c
index 825fafc..e43afb3 100644
--- a/src/path-parser.c
+++ b/src/path-parser.c
@@ -21,22 +21,22 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
-#include <grecs.h>
+#include <argot.h>
static int
next_char(FILE *infile)
{
int c = fgetc(infile);
if (c == '\n')
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
else {
- grecs_current_locus_point.col++;
+ argot_current_locus_point.col++;
if (c == '\\') {
int nc = fgetc(infile);
if (nc == '\n') {
- grecs_locus_point_advance_line(grecs_current_locus_point);
+ argot_locus_point_advance_line(argot_current_locus_point);
c = fgetc(infile);
- grecs_current_locus_point.col++;
+ argot_current_locus_point.col++;
} else
ungetc(nc, infile);
}
@@ -44,14 +44,14 @@ next_char(FILE *infile)
return c;
}
-struct grecs_node *
-grecs_path_parser(const char *name, int traceflags)
+struct argot_node *
+argot_path_parser(const char *name, int traceflags)
{
- struct grecs_node *root, *subtree = NULL, *node;
+ struct argot_node *root, *subtree = NULL, *node;
FILE *infile;
- struct grecs_txtacc *acc = NULL;
+ struct argot_txtacc *acc = NULL;
char *kw, *val;
- grecs_locus_t kwloc, valloc, rootloc;
+ argot_locus_t kwloc, valloc, rootloc;
int inquote;
int lookahead;
int err = 0;
@@ -59,16 +59,16 @@ grecs_path_parser(const char *name, int traceflags)
infile = fopen(name, "r");
if (!infile) {
- grecs_error(NULL, errno, _("cannot open `%s'"), name);
+ argot_error(NULL, errno, _("cannot open `%s'"), name);
return NULL;
}
- grecs_current_locus_point.file = grecs_install_text(name);
- grecs_current_locus_point.line = 1;
- grecs_current_locus_point.col = 0;
- rootloc.beg = grecs_current_locus_point;
+ argot_current_locus_point.file = argot_install_text(name);
+ argot_current_locus_point.line = 1;
+ argot_current_locus_point.col = 0;
+ rootloc.beg = argot_current_locus_point;
rootloc.beg.col++;
- acc = grecs_txtacc_create();
+ acc = argot_txtacc_create();
while ((lookahead = next_char(infile)) > 0) {
while (1) {
@@ -87,7 +87,7 @@ grecs_path_parser(const char *name, int traceflags)
if (lookahead <= 0)
break;
- kwloc.beg = grecs_current_locus_point;
+ kwloc.beg = argot_current_locus_point;
inquote = 0;
for (; lookahead > 0 && lookahead != ':';
@@ -101,46 +101,46 @@ grecs_path_parser(const char *name, int traceflags)
inquote = 0;
} else if (lookahead == '\'' || lookahead == '"')
inquote = lookahead;
- grecs_txtacc_grow_char(acc, lookahead);
+ argot_txtacc_grow_char(acc, lookahead);
}
if (lookahead <= 0) {
- grecs_error(&kwloc, 0, _("unexpected end of file"));
+ argot_error(&kwloc, 0, _("unexpected end of file"));
err = 1;
break;
}
- grecs_txtacc_grow_char(acc, 0);
- kw = grecs_txtacc_finish(acc, 0);
+ argot_txtacc_grow_char(acc, 0);
+ kw = argot_txtacc_finish(acc, 0);
- kwloc.end = grecs_current_locus_point;
+ kwloc.end = argot_current_locus_point;
kwloc.end.col--;
while ((lookahead = next_char(infile)) > 0 &&
(lookahead == ' ' || lookahead == '\t'));
if (lookahead <= 0) {
- grecs_error(&kwloc, 0, _("unexpected end of file"));
+ argot_error(&kwloc, 0, _("unexpected end of file"));
err = 1;
break;
}
- valloc.beg = grecs_current_locus_point;
+ valloc.beg = argot_current_locus_point;
do {
- grecs_txtacc_grow_char(acc, lookahead);
- prev_col = grecs_current_locus_point.col;
+ argot_txtacc_grow_char(acc, lookahead);
+ prev_col = argot_current_locus_point.col;
} while ((lookahead = next_char(infile)) > 0 &&
lookahead != '\n');
- valloc.end = grecs_current_locus_point;
+ valloc.end = argot_current_locus_point;
valloc.end.line--;
valloc.end.col = prev_col;
- grecs_txtacc_grow_char(acc, 0);
- val = grecs_txtacc_finish(acc, 0);
+ argot_txtacc_grow_char(acc, 0);
+ val = argot_txtacc_finish(acc, 0);
- node = grecs_node_from_path_locus(kw, val, &kwloc, &valloc);
+ node = argot_node_from_path_locus(kw, val, &kwloc, &valloc);
if (!node) {
- grecs_error(&kwloc, 0, _("parse error"));
+ argot_error(&kwloc, 0, _("parse error"));
err = 1;
break;
}
@@ -150,23 +150,23 @@ grecs_path_parser(const char *name, int traceflags)
if (!subtree)
subtree = node;
else
- grecs_node_bind(subtree, node, 0);
- grecs_txtacc_free_string(acc, kw);
- grecs_txtacc_free_string(acc, val);
+ argot_node_bind(subtree, node, 0);
+ argot_txtacc_free_string(acc, kw);
+ argot_txtacc_free_string(acc, val);
}
fclose(infile);
- grecs_txtacc_free(acc);
+ argot_txtacc_free(acc);
if (err) {
- grecs_tree_free(subtree);
+ argot_tree_free(subtree);
root = NULL;
} else {
- rootloc.end = grecs_current_locus_point;
- root = grecs_node_create(grecs_node_root, &rootloc);
- root->v.texttab = grecs_text_table();
- grecs_node_bind(root, subtree, 1);
- grecs_tree_reduce(root, NULL, 0);
+ rootloc.end = argot_current_locus_point;
+ root = argot_node_create(argot_node_root, &rootloc);
+ root->v.texttab = argot_text_table();
+ argot_node_bind(root, subtree, 1);
+ argot_tree_reduce(root, NULL, 0);
}
return root;
diff --git a/src/pp-setup b/src/pp-setup
index c689a92..588d48c 100644
--- a/src/pp-setup
+++ b/src/pp-setup
@@ -1,5 +1,5 @@
divert(-1) dnl -*- m4 -*-
-# 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
#
# Grex is free software; you can redistribute it and/or modify
diff --git a/src/preproc.c b/src/preproc.c
index 4d69602..53bea14 100644
--- a/src/preproc.c
+++ b/src/preproc.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <wordsplit.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,8 +33,8 @@
#include <unistd.h>
-int grecs_log_to_stderr = 1;
-void (*grecs_log_setup_hook) () = NULL;
+int argot_log_to_stderr = 1;
+void (*argot_log_setup_hook) () = NULL;
struct input_file_ident {
ino_t i_node;
@@ -43,14 +43,14 @@ struct input_file_ident {
struct buffer_ctx {
struct buffer_ctx *prev; /* Pointer to previous context */
- grecs_locus_t locus; /* Current input location */
+ argot_locus_t locus; /* Current input location */
size_t namelen; /* Length of the file name */
size_t xlines; /* Number of #line directives output so far */
struct input_file_ident id;
FILE *infile;
};
-extern int grecs_grecs__flex_debug;
+extern int argot_argot__flex_debug;
static struct buffer_ctx *context_stack;
static char *linebufbase = NULL;
static size_t linebufsize = 0;
@@ -73,7 +73,7 @@ static int pop_source (void);
static int parse_include (const char *text, int once);
ssize_t
-grecs_getline(char **pbuf, size_t *psize, FILE *fp)
+argot_getline(char **pbuf, size_t *psize, FILE *fp)
{
char *buf = *pbuf;
size_t size = *psize;
@@ -81,15 +81,15 @@ grecs_getline(char **pbuf, size_t *psize, FILE *fp)
if (!buf) {
size = 1;
- buf = grecs_malloc(size);
+ buf = argot_malloc(size);
}
do {
if (off == size - 1) {
size_t nsize = 2 * size;
if (nsize < size)
- grecs_alloc_die();
- buf = grecs_realloc(buf, nsize);
+ argot_alloc_die();
+ buf = argot_realloc(buf, nsize);
size = nsize;
}
if (!fgets(buf + off, size - off, fp)) {
@@ -115,7 +115,7 @@ putback(const char *str)
len = strlen(str) + 1;
if (len > putback_max) {
putback_max = len;
- putback_buffer = grecs_realloc(putback_buffer, putback_max);
+ putback_buffer = argot_realloc(putback_buffer, putback_max);
}
strcpy(putback_buffer, str);
putback_size = len - 1;
@@ -127,18 +127,18 @@ pp_line_stmt()
size_t ls_size;
size_t pb_size;
- if (grecs_asprintf(&linebufbase, &linebufsize,
+ if (argot_asprintf(&linebufbase, &linebufsize,
"#line %lu \"%s\" %lu\n",
(unsigned long) POINT.line,
POINT.file, (unsigned long) context_stack->xlines))
- grecs_alloc_die();
+ argot_alloc_die();
ls_size = strlen(linebufbase);
pb_size = putback_size + ls_size + 1;
if (pb_size > putback_max) {
putback_max = pb_size;
- putback_buffer = grecs_realloc(putback_buffer, putback_max);
+ putback_buffer = argot_realloc(putback_buffer, putback_max);
}
context_stack->xlines++;
@@ -159,7 +159,7 @@ next_line()
if (putback_size) {
if (putback_size + 1 > bufsize) {
bufsize = putback_size + 1;
- linebuf = grecs_realloc(linebuf, bufsize);
+ linebuf = argot_realloc(linebuf, bufsize);
}
strcpy(linebuf, putback_buffer);
rc = putback_size;
@@ -168,13 +168,13 @@ next_line()
else if (!context_stack)
return 0;
else
- rc = grecs_getline(&linebuf, &bufsize, INFILE);
+ rc = argot_getline(&linebuf, &bufsize, INFILE);
} while (rc == -1 && pop_source() == 0);
return rc;
}
size_t
-grecs_preproc_fill_buffer(char *buf, size_t size)
+argot_preproc_fill_buffer(char *buf, size_t size)
{
size_t bufsize = size;
@@ -239,27 +239,27 @@ ctx_lookup(struct stat *st)
return ctx;
}
-const char *grecs_preprocessor = NULL;
-static struct grecs_list *grecs_usr_include_path;
-static struct grecs_list *grecs_std_include_path;
+const char *argot_preprocessor = NULL;
+static struct argot_list *argot_usr_include_path;
+static struct argot_list *argot_std_include_path;
size_t
-grecs_include_path_count(int flag)
+argot_include_path_count(int flag)
{
size_t count = 0;
- if (flag & GRECS_STD_INCLUDE)
- count += grecs_list_size(grecs_std_include_path);
- if (flag & GRECS_USR_INCLUDE)
- count += grecs_list_size(grecs_usr_include_path);
+ if (flag & ARGOT_STD_INCLUDE)
+ count += argot_list_size(argot_std_include_path);
+ if (flag & ARGOT_USR_INCLUDE)
+ count += argot_list_size(argot_usr_include_path);
return count;
}
static int
-foreach_dir(struct grecs_list *list, int flag,
+foreach_dir(struct argot_list *list, int flag,
int (*fun)(int, const char *, void *), void *data)
{
int rc = 0;
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
for (ep = list->head; rc == 0 && ep; ep = ep->next)
rc = fun(flag, ep->data, data);
@@ -267,15 +267,15 @@ foreach_dir(struct grecs_list *list, int flag,
}
int
-grecs_foreach_include_dir(int flag, int (*fun)(int, const char *, void *),
+argot_foreach_include_dir(int flag, int (*fun)(int, const char *, void *),
void *data)
{
int rc = 0;
- if (flag & GRECS_STD_INCLUDE)
- rc = foreach_dir(grecs_std_include_path, GRECS_STD_INCLUDE, fun, data);
- if (rc == 0 && (flag & GRECS_USR_INCLUDE))
- rc = foreach_dir(grecs_usr_include_path, GRECS_USR_INCLUDE, fun, data);
+ if (flag & ARGOT_STD_INCLUDE)
+ rc = foreach_dir(argot_std_include_path, ARGOT_STD_INCLUDE, fun, data);
+ if (rc == 0 && (flag & ARGOT_USR_INCLUDE))
+ rc = foreach_dir(argot_usr_include_path, ARGOT_USR_INCLUDE, fun, data);
return rc;
}
@@ -289,9 +289,9 @@ struct file_data {
};
static int
-pp_list_find(struct grecs_list *list, struct file_data *dptr)
+pp_list_find(struct argot_list *list, struct file_data *dptr)
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
if (!list)
return 0;
@@ -300,7 +300,7 @@ pp_list_find(struct grecs_list *list, struct file_data *dptr)
size_t size = strlen (dir) + 1 + dptr->namelen + 1;
if (size > dptr->buflen) {
dptr->buflen = size;
- dptr->buf = grecs_realloc(dptr->buf, dptr->buflen);
+ dptr->buf = argot_realloc(dptr->buf, dptr->buflen);
}
strcpy(dptr->buf, dir);
strcat(dptr->buf, "/");
@@ -313,38 +313,38 @@ pp_list_find(struct grecs_list *list, struct file_data *dptr)
static void
incl_free(void *data)
{
- grecs_free(data);
+ argot_free(data);
}
void
-grecs_include_path_clear()
+argot_include_path_clear()
{
- if (grecs_usr_include_path)
- grecs_list_clear(grecs_usr_include_path);
- if (grecs_std_include_path)
- grecs_list_clear(grecs_std_include_path);
+ if (argot_usr_include_path)
+ argot_list_clear(argot_usr_include_path);
+ if (argot_std_include_path)
+ argot_list_clear(argot_std_include_path);
}
void
-grecs_include_path_setup_v(char **dirs)
+argot_include_path_setup_v(char **dirs)
{
- if (!grecs_usr_include_path) {
- grecs_usr_include_path = grecs_list_create();
- grecs_usr_include_path->free_entry = incl_free;
+ if (!argot_usr_include_path) {
+ argot_usr_include_path = argot_list_create();
+ argot_usr_include_path->free_entry = incl_free;
}
- grecs_std_include_path = grecs_list_create();
- grecs_std_include_path->free_entry = incl_free;
+ argot_std_include_path = argot_list_create();
+ argot_std_include_path->free_entry = incl_free;
if (dirs) {
int i;
for (i = 0; dirs[i]; i++)
/* FIXME: Element never freed */
- grecs_list_append(grecs_std_include_path,
- grecs_strdup(dirs[i]));
+ argot_list_append(argot_std_include_path,
+ argot_strdup(dirs[i]));
}
}
void
-grecs_include_path_setup(const char *dir, ...)
+argot_include_path_setup(const char *dir, ...)
{
const char *p;
char **argv = NULL;
@@ -360,29 +360,29 @@ grecs_include_path_setup(const char *dir, ...)
argc = 16;
else
argc += 16;
- argv = grecs_realloc(argv, argc * sizeof(argv[0]));
+ argv = argot_realloc(argv, argc * sizeof(argv[0]));
}
argv[argi++] = (char*) p;
if (!p)
break;
p = va_arg(ap, const char*);
}
- grecs_include_path_setup_v(argv);
- grecs_free(argv);
+ argot_include_path_setup_v(argv);
+ argot_free(argv);
va_end(ap);
}
void
-grecs_preproc_add_include_dir(char *dir)
+argot_preproc_add_include_dir(char *dir)
{
- if (!grecs_usr_include_path) {
- grecs_usr_include_path = grecs_list_create();
- grecs_usr_include_path->free_entry = incl_free;
+ if (!argot_usr_include_path) {
+ argot_usr_include_path = argot_list_create();
+ argot_usr_include_path->free_entry = incl_free;
}
- grecs_list_append(grecs_usr_include_path, grecs_strdup(dir));
+ argot_list_append(argot_usr_include_path, argot_strdup(dir));
}
-static struct grecs_symtab *incl_sources;
+static struct argot_symtab *incl_sources;
/* Calculate the hash of a struct input_file_ident. */
static unsigned
@@ -415,7 +415,7 @@ source_lookup(struct stat *st)
int install = 1;
if (!incl_sources) {
- incl_sources = grecs_symtab_create(
+ incl_sources = argot_symtab_create(
sizeof(struct input_file_ident),
incl_hasher,
incl_compare,
@@ -423,13 +423,13 @@ source_lookup(struct stat *st)
NULL,/*FIXME: alloc*/
NULL);
if (!incl_sources)
- grecs_alloc_die();
+ argot_alloc_die();
}
key.i_node = st->st_ino;
key.device = st->st_dev;
- if (!grecs_symtab_lookup_or_install(incl_sources, &key, &install))
- grecs_alloc_die();
+ if (!argot_symtab_lookup_or_install(incl_sources, &key, &install))
+ argot_alloc_die();
return !install;
}
@@ -444,30 +444,30 @@ push_source(const char *name, int once)
if (context_stack) {
if (rc) {
- grecs_error(&LOCUS, errno,
+ argot_error(&LOCUS, errno,
_("Cannot stat `%s'"), name);
return 1;
}
if (POINT.file && STAT_ID_EQ(st, context_stack->id)) {
- grecs_error(&LOCUS, 0, _("Recursive inclusion"));
+ argot_error(&LOCUS, 0, _("Recursive inclusion"));
return 1;
}
if ((ctx = ctx_lookup(&st))) {
- grecs_error(&LOCUS, 0, _("Recursive inclusion"));
+ argot_error(&LOCUS, 0, _("Recursive inclusion"));
if (ctx->prev)
- grecs_error(&ctx->prev->locus, 0,
+ argot_error(&ctx->prev->locus, 0,
_("`%s' already included here"),
name);
else
- grecs_error(&LOCUS, 0,
+ argot_error(&LOCUS, 0,
_("`%s' already included at top level"),
name);
return 1;
}
} else if (rc) {
- grecs_error(NULL, errno, _("Cannot stat `%s'"), name);
+ argot_error(NULL, errno, _("Cannot stat `%s'"), name);
return 1;
}
@@ -476,14 +476,14 @@ push_source(const char *name, int once)
fp = fopen(name, "r");
if (!fp) {
- grecs_error(context_stack ? &LOCUS : NULL, errno,
+ argot_error(context_stack ? &LOCUS : NULL, errno,
_("Cannot open `%s'"), name);
return 1;
}
/* Push current context */
- ctx = grecs_malloc(sizeof(*ctx));
- ctx->locus.beg.file = grecs_install_text(name);
+ ctx = argot_malloc(sizeof(*ctx));
+ ctx->locus.beg.file = argot_install_text(name);
ctx->locus.beg.line = 1;
ctx->locus.beg.col = 0;
ctx->locus.end.file = NULL;
@@ -496,7 +496,7 @@ push_source(const char *name, int once)
ctx->prev = context_stack;
context_stack = ctx;
- if (grecs_grecs__flex_debug)
+ if (argot_argot__flex_debug)
fprintf (stderr, "Processing file `%s'\n", name);
pp_line_stmt();
@@ -516,7 +516,7 @@ pop_source()
/* Restore previous context */
ctx = context_stack->prev;
- grecs_free(context_stack);
+ argot_free(context_stack);
context_stack = ctx;
if (include_pos < include_glob.gl_pathc) {
@@ -528,14 +528,14 @@ pop_source()
}
if (!context_stack) {
- if (grecs_grecs__flex_debug)
+ if (argot_argot__flex_debug)
fprintf(stderr, "End of input\n");
return 1;
}
POINT.line++;
- if (grecs_grecs__flex_debug)
+ if (argot_argot__flex_debug)
fprintf(stderr, "Resuming file `%s' at line %lu\n",
POINT.file, (unsigned long) POINT.line);
@@ -545,7 +545,7 @@ pop_source()
}
char *
-grecs_find_include_file(const char *name, int allow_cwd)
+argot_find_include_file(const char *name, int allow_cwd)
{
static char *cwd = ".";
struct file_data fd;
@@ -556,17 +556,17 @@ grecs_find_include_file(const char *name, int allow_cwd)
fd.buflen = 0;
fd.found = 0;
- if (!grecs_usr_include_path)
- grecs_include_path_setup(NULL);
+ if (!argot_usr_include_path)
+ argot_include_path_setup(NULL);
if (allow_cwd) {
- grecs_list_append(grecs_usr_include_path, cwd);
- pp_list_find(grecs_usr_include_path, &fd);
- grecs_list_remove_tail(grecs_usr_include_path);
+ argot_list_append(argot_usr_include_path, cwd);
+ pp_list_find(argot_usr_include_path, &fd);
+ argot_list_remove_tail(argot_usr_include_path);
} else
- pp_list_find(grecs_usr_include_path, &fd);
+ pp_list_find(argot_usr_include_path, &fd);
if (!fd.found) {
- pp_list_find(grecs_std_include_path, &fd);
+ pp_list_find(argot_std_include_path, &fd);
if (!fd.found)
return NULL;
}
@@ -592,10 +592,10 @@ parse_include(const char *text, int once)
int rc = 1;
if (wordsplit(text, &ws, WRDSF_DEFFLAGS))
- grecs_error(&LOCUS, 0, _("Cannot parse include line"));
+ argot_error(&LOCUS, 0, _("Cannot parse include line"));
else if (ws.ws_wordc != 2) {
wordsplit_free(&ws);
- grecs_error(&LOCUS, 0, _("invalid include statement"));
+ argot_error(&LOCUS, 0, _("invalid include statement"));
} else {
size_t len;
int allow_cwd;
@@ -617,18 +617,18 @@ parse_include(const char *text, int once)
include_once = once;
break;
case GLOB_NOSPACE:
- grecs_alloc_die();
+ argot_alloc_die();
case GLOB_NOMATCH:
break;
default:
- grecs_error(&LOCUS, 0, _("read error"));
+ argot_error(&LOCUS, 0, _("read error"));
}
p = NULL;
} else if (p[0] != '/') {
char *q = p;
- p = grecs_find_include_file(q, allow_cwd);
+ p = argot_find_include_file(q, allow_cwd);
if (!p)
- grecs_error(&LOCUS, 0,
+ argot_error(&LOCUS, 0,
_("%s: No such file or directory"),
q);
}
@@ -639,28 +639,28 @@ parse_include(const char *text, int once)
else if (include_pos < include_glob.gl_pathc)
rc = push_source(include_glob.gl_pathv[include_pos++], once);
- grecs_free(tmp);
+ argot_free(tmp);
wordsplit_free(&ws);
return rc;
}
int
-grecs_preproc_init(const char *name)
+argot_preproc_init(const char *name)
{
return push_source(name, 0);
}
void
-grecs_preproc_done()
+argot_preproc_done()
{
- grecs_symtab_free(incl_sources);
+ argot_symtab_free(incl_sources);
incl_sources = NULL;
- grecs_free(linebuf);
+ argot_free(linebuf);
linebuf = NULL;
bufsize = 0;
- grecs_free(putback_buffer);
+ argot_free(putback_buffer);
putback_buffer = NULL;
putback_size = putback_max = 0;
@@ -670,51 +670,51 @@ grecs_preproc_done()
}
int
-grecs_preproc_run(const char *config_file, const char *extpp)
+argot_preproc_run(const char *config_file, const char *extpp)
{
size_t i;
char buffer[512];
- if (grecs_preproc_init(config_file))
+ if (argot_preproc_init(config_file))
return 1;
if (extpp) {
FILE *outfile;
char *setup_file;
char *cmd = NULL;
- setup_file = grecs_find_include_file("pp-setup", 1);
+ setup_file = argot_find_include_file("pp-setup", 1);
if (setup_file) {
size_t size = 0;
- if (grecs_asprintf(&cmd, &size,
+ if (argot_asprintf(&cmd, &size,
"%s %s -", extpp, setup_file))
- grecs_alloc_die();
- grecs_free(setup_file);
+ argot_alloc_die();
+ argot_free(setup_file);
} else
- cmd = grecs_strdup(extpp);
+ cmd = argot_strdup(extpp);
/*FIXME_DEBUG_F1 (2, "Running preprocessor: `%s'", cmd);*/
outfile = popen(cmd, "w");
if (!outfile) {
- grecs_error(NULL, errno,
+ argot_error(NULL, errno,
_("Unable to start external preprocessor `%s'"),
cmd);
- grecs_free(cmd);
+ argot_free(cmd);
return 1;
}
- while ((i = grecs_preproc_fill_buffer(buffer, sizeof buffer)))
+ while ((i = argot_preproc_fill_buffer(buffer, sizeof buffer)))
fwrite(buffer, 1, i, outfile);
pclose(outfile);
- grecs_free(cmd);
+ argot_free(cmd);
} else {
- while ((i = grecs_preproc_fill_buffer(buffer, sizeof buffer)))
+ while ((i = argot_preproc_fill_buffer(buffer, sizeof buffer)))
fwrite(buffer, 1, i, stdout);
}
- grecs_preproc_done();
+ argot_preproc_done();
return 0;
}
FILE *
-grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
+argot_preproc_extrn_start(const char *file_name, pid_t *ppid)
{
int pout[2];
pid_t pid;
@@ -724,7 +724,7 @@ grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
/*FIXME_DEBUG_F1 (2, "Running preprocessor: `%s'", ppcmd);*/
if (pipe(pout)) {
- grecs_error(NULL, errno, "pipe");
+ argot_error(NULL, errno, "pipe");
return NULL;
}
switch (pid = fork()) {
@@ -732,7 +732,7 @@ grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
case 0:
if (pout[1] != 1) {
if (dup2(pout[1], 1) == -1) {
- grecs_error(NULL, errno, "dup2");
+ argot_error(NULL, errno, "dup2");
exit(127);
}
}
@@ -741,7 +741,7 @@ grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
for (i = getdtablesize(); i > 2; i--)
close(i);
- if (!grecs_log_to_stderr) {
+ if (!argot_log_to_stderr) {
int p[2];
char *buf = NULL;
size_t size = 0;
@@ -749,49 +749,49 @@ grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
signal(SIGCHLD, SIG_DFL);
if (pipe(p)) {
- grecs_error(NULL, errno, "pipe");
+ argot_error(NULL, errno, "pipe");
exit(127);
}
switch (pid = fork()) {
/* Grandchild */
case 0:
if (p[1] != 2 && dup2(p[1], 2) == -1) {
- grecs_error(NULL, errno, "dup2");
+ argot_error(NULL, errno, "dup2");
exit(127);
}
close(p[0]);
- if (grecs_preproc_run(file_name,
- grecs_preprocessor))
+ if (argot_preproc_run(file_name,
+ argot_preprocessor))
exit(127);
exit(0);
case -1:
/* Fork failed */
- if (grecs_log_setup_hook)
- grecs_log_setup_hook();
- grecs_error(NULL, errno, _("Cannot run `%s'"),
- grecs_preprocessor);
+ if (argot_log_setup_hook)
+ argot_log_setup_hook();
+ argot_error(NULL, errno, _("Cannot run `%s'"),
+ argot_preprocessor);
exit(127);
default:
/* Sub-master */
close (p[1]);
fp = fdopen(p[0], "r");
- if (grecs_log_setup_hook)
- grecs_log_setup_hook();
- while (grecs_getline(&buf, &size, fp) > 0)
- grecs_error(NULL, 0, "%s", buf);
+ if (argot_log_setup_hook)
+ argot_log_setup_hook();
+ while (argot_getline(&buf, &size, fp) > 0)
+ argot_error(NULL, 0, "%s", buf);
}
} else {
- grecs_preproc_run(file_name, grecs_preprocessor);
+ argot_preproc_run(file_name, argot_preprocessor);
}
exit (0);
case -1:
/* Fork failed */
- grecs_error(NULL, errno, _("Cannot run `%s'"),
- grecs_preprocessor);
+ argot_error(NULL, errno, _("Cannot run `%s'"),
+ argot_preprocessor);
break;
default:
@@ -804,7 +804,7 @@ grecs_preproc_extrn_start(const char *file_name, pid_t *ppid)
}
void
-grecs_preproc_extrn_shutdown(pid_t pid)
+argot_preproc_extrn_shutdown(pid_t pid)
{
int status;
waitpid(pid, &status, 0);
diff --git a/src/sockaddr.c b/src/sockaddr.c
index 8cd790d..8d9ed40 100644
--- a/src/sockaddr.c
+++ b/src/sockaddr.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -29,23 +29,23 @@
#include <netdb.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
-struct grecs_sockaddr *
-grecs_sockaddr_new(size_t s)
+struct argot_sockaddr *
+argot_sockaddr_new(size_t s)
{
- struct grecs_sockaddr *sp = grecs_malloc(sizeof(*sp));
+ struct argot_sockaddr *sp = argot_malloc(sizeof(*sp));
sp->next = NULL;
- sp->sa = grecs_zalloc(s);
+ sp->sa = argot_zalloc(s);
sp->len = s;
return sp;
}
void
-grecs_sockaddr_free(struct grecs_sockaddr *p)
+argot_sockaddr_free(struct argot_sockaddr *p)
{
while (p) {
- struct grecs_sockaddr *next = p->next;
+ struct argot_sockaddr *next = p->next;
free(p->sa);
free(p);
p = next;
@@ -53,19 +53,19 @@ grecs_sockaddr_free(struct grecs_sockaddr *p)
}
static int
-parse_unix(struct grecs_sockaddr **ret, const char *arg, const char *addrstr,
- struct grecs_sockaddr_hints *gh, grecs_locus_t const *locus)
+parse_unix(struct argot_sockaddr **ret, const char *arg, const char *addrstr,
+ struct argot_sockaddr_hints *gh, argot_locus_t const *locus)
{
struct sockaddr_un *s_un;
size_t slen = strlen(addrstr);
- struct grecs_sockaddr *sp;
+ struct argot_sockaddr *sp;
if (slen >= sizeof s_un->sun_path) {
- grecs_error(locus, 0, _("socket path name too long: %s"), arg);
+ argot_error(locus, 0, _("socket path name too long: %s"), arg);
return -1;
}
- sp = grecs_sockaddr_new(sizeof(s_un[0]));
+ sp = argot_sockaddr_new(sizeof(s_un[0]));
s_un = (struct sockaddr_un *) sp->sa;
s_un->sun_family = AF_UNIX;
strcpy(s_un->sun_path, addrstr);
@@ -75,9 +75,9 @@ parse_unix(struct grecs_sockaddr **ret, const char *arg, const char *addrstr,
}
static int
-parse_inet(struct grecs_sockaddr **ret,
+parse_inet(struct argot_sockaddr **ret,
int family, const char *arg, const char *addrstr,
- struct grecs_sockaddr_hints *gh, grecs_locus_t const *locus)
+ struct argot_sockaddr_hints *gh, argot_locus_t const *locus)
{
int rc;
struct addrinfo hints;
@@ -85,7 +85,7 @@ parse_inet(struct grecs_sockaddr **ret,
const char *node = NULL;
char *nodebuf = NULL;
const char *service = NULL;
- struct grecs_sockaddr *head = NULL, *tail = NULL;
+ struct argot_sockaddr *head = NULL, *tail = NULL;
char portbuf[64];
memset(&hints, 0, sizeof(hints));
@@ -100,7 +100,7 @@ parse_inet(struct grecs_sockaddr **ret,
addrstr++;
len = p - addrstr;
- nodebuf = grecs_malloc(len + 1);
+ nodebuf = argot_malloc(len + 1);
memcpy(nodebuf, addrstr, len);
nodebuf[len] = 0;
node = nodebuf;
@@ -113,7 +113,7 @@ parse_inet(struct grecs_sockaddr **ret,
if (service && *service) {
if (*service != ':') {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: garbage near %s"), arg, service);
return -1;
}
@@ -127,15 +127,15 @@ parse_inet(struct grecs_sockaddr **ret,
if (len == 0)
node = NULL;
else {
- nodebuf = grecs_malloc(len + 1);
+ nodebuf = argot_malloc(len + 1);
memcpy(nodebuf, addrstr, len);
nodebuf[len] = 0;
node = nodebuf;
}
} else {
- if (grecs_str_is_ipaddr(addrstr))
+ if (argot_str_is_ipaddr(addrstr))
node = addrstr;
- else if (grecs_str_is_num(addrstr)) {
+ else if (argot_str_is_num(addrstr)) {
service = addrstr;
hints.ai_flags |= AI_NUMERICSERV;
}
@@ -145,21 +145,21 @@ parse_inet(struct grecs_sockaddr **ret,
if (!service || !*service) {
if (!node && addrstr[0])
node = addrstr;
- if (gh->flags & GRECS_HINT_SERVICE) {
+ if (gh->flags & ARGOT_HINT_SERVICE) {
service = gh->service;
- } else if (gh->flags & GRECS_HINT_PORT) {
+ } else if (gh->flags & ARGOT_HINT_PORT) {
snprintf(portbuf, sizeof portbuf, "%hu", gh->port);
service = portbuf;
hints.ai_flags |= AI_NUMERICSERV;
- } else if (!(gh->flags & GRECS_AH_PASSIVE)) {
- grecs_error(locus, 0,
+ } else if (!(gh->flags & ARGOT_AH_PASSIVE)) {
+ argot_error(locus, 0,
_("service not specified: %s"), arg);
return -1;
}
}
if (!node) {
- if (gh->flags & GRECS_AH_PASSIVE)
+ if (gh->flags & ARGOT_AH_PASSIVE)
hints.ai_flags |= AI_PASSIVE;
}
@@ -169,28 +169,28 @@ parse_inet(struct grecs_sockaddr **ret,
case 0:
break;
case EAI_SYSTEM:
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: cannot parse address: %s"),
arg, strerror(errno));
break;
case EAI_BADFLAGS:
case EAI_SOCKTYPE:
- grecs_error(locus, 0,
+ argot_error(locus, 0,
"%s:%d: internal error converting %s",
__FILE__,__LINE__,arg);
break;
case EAI_MEMORY:
- grecs_alloc_die();
+ argot_alloc_die();
default:
- grecs_error(locus, 0,
+ argot_error(locus, 0,
"%s: %s", arg, gai_strerror(rc));
return -1;
}
for (ap = res; ap; ap = ap->ai_next) {
if (family == AF_UNSPEC || ap->ai_addr->sa_family == family) {
- struct grecs_sockaddr *sp =
- grecs_sockaddr_new(ap->ai_addrlen);
+ struct argot_sockaddr *sp =
+ argot_sockaddr_new(ap->ai_addrlen);
memcpy(sp->sa, ap->ai_addr, ap->ai_addrlen);
sp->len = ap->ai_addrlen;
if (!head)
@@ -206,15 +206,15 @@ parse_inet(struct grecs_sockaddr **ret,
}
static int
-parse_inet4(struct grecs_sockaddr **ret, const char *arg, const char *addrstr,
- struct grecs_sockaddr_hints *gh, grecs_locus_t const *locus)
+parse_inet4(struct argot_sockaddr **ret, const char *arg, const char *addrstr,
+ struct argot_sockaddr_hints *gh, argot_locus_t const *locus)
{
return parse_inet(ret, AF_INET, arg, addrstr, gh, locus);
}
static int
-parse_inet6(struct grecs_sockaddr **ret, const char *arg, const char *addrstr,
- struct grecs_sockaddr_hints *gh, grecs_locus_t const *locus)
+parse_inet6(struct argot_sockaddr **ret, const char *arg, const char *addrstr,
+ struct argot_sockaddr_hints *gh, argot_locus_t const *locus)
{
return parse_inet(ret, AF_INET6, arg, addrstr, gh, locus);
}
@@ -222,10 +222,10 @@ parse_inet6(struct grecs_sockaddr **ret, const char *arg, const char *addrstr,
struct schemetab {
const char *scheme;
size_t len;
- int (*parser)(struct grecs_sockaddr **ret,
+ int (*parser)(struct argot_sockaddr **ret,
const char *arg, const char *addr,
- struct grecs_sockaddr_hints *gh,
- grecs_locus_t const *locus);
+ struct argot_sockaddr_hints *gh,
+ argot_locus_t const *locus);
};
struct schemetab schemetab[] = {
@@ -237,18 +237,18 @@ struct schemetab schemetab[] = {
};
int
-grecs_str_to_sockaddr(struct grecs_sockaddr **sap,
- const char *arg, struct grecs_sockaddr_hints *gh,
- grecs_locus_t const *locus)
+argot_str_to_sockaddr(struct argot_sockaddr **sap,
+ const char *arg, struct argot_sockaddr_hints *gh,
+ argot_locus_t const *locus)
{
char *p;
- struct grecs_sockaddr_hints ghints;
+ struct argot_sockaddr_hints ghints;
if (!gh) {
memset(&ghints, 0, sizeof(ghints));
- if (grecs_default_port) {
- ghints.flags = GRECS_HINT_PORT;
- ghints.port = ntohs(grecs_default_port);
+ if (argot_default_port) {
+ ghints.flags = ARGOT_HINT_PORT;
+ ghints.port = ntohs(argot_default_port);
}
gh = &ghints;
}
@@ -262,7 +262,7 @@ grecs_str_to_sockaddr(struct grecs_sockaddr **sap,
if (len == sp->len &&
memcmp(arg, sp->scheme, len) == 0)
return sp->parser(sap, arg, p + 3, gh, locus);
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("unknown or unsupported scheme: %s"), arg);
return -1;
}
@@ -271,7 +271,7 @@ grecs_str_to_sockaddr(struct grecs_sockaddr **sap,
return parse_unix(sap, arg, arg, gh, locus);
else if (strlen(arg) > 5 && memcmp(arg, "unix:", 5) == 0) {
if (arg[5] != '/')
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: UNIX socket must be an absolute file name"),
arg);
return parse_unix(sap, arg, arg + 5, gh, locus);
diff --git a/src/sort.c b/src/sort.c
index c82fe01..6a9c5ed 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -18,14 +18,14 @@
# include <config.h>
#endif
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
struct node_list {
- struct grecs_node *head, *tail;
+ struct argot_node *head, *tail;
};
static void
-node_list_init(struct node_list *list, struct grecs_node *node)
+node_list_init(struct node_list *list, struct argot_node *node)
{
if (node) {
list->head = node;
@@ -37,7 +37,7 @@ node_list_init(struct node_list *list, struct grecs_node *node)
}
static void
-node_list_add(struct node_list *list, struct grecs_node *node)
+node_list_add(struct node_list *list, struct argot_node *node)
{
node->next = NULL;
node->prev = list->tail;
@@ -63,10 +63,10 @@ node_list_join(struct node_list *a, struct node_list *b)
static void
_qsort_nodelist(struct node_list *list,
- int (*compare)(struct grecs_node const *,
- struct grecs_node const *))
+ int (*compare)(struct argot_node const *,
+ struct argot_node const *))
{
- struct grecs_node *cur, *middle;
+ struct argot_node *cur, *middle;
struct node_list high_list, low_list;
int rc;
@@ -86,7 +86,7 @@ _qsort_nodelist(struct node_list *list,
node_list_init(&low_list, NULL);
node_list_init(&high_list, NULL);
for (cur = list->head; cur; ) {
- struct grecs_node *next = cur->next;
+ struct argot_node *next = cur->next;
cur->next = NULL;
if (compare(middle, cur) < 0)
node_list_add(&high_list, cur);
@@ -109,10 +109,10 @@ _qsort_nodelist(struct node_list *list,
list->tail = low_list.tail;
}
-struct grecs_node *
-grecs_nodelist_sort(struct grecs_node *node,
- int (*compare)(struct grecs_node const *,
- struct grecs_node const *))
+struct argot_node *
+argot_nodelist_sort(struct argot_node *node,
+ int (*compare)(struct argot_node const *,
+ struct argot_node const *))
{
struct node_list list;
node_list_init(&list, node);
@@ -121,14 +121,14 @@ grecs_nodelist_sort(struct grecs_node *node,
}
void
-grecs_tree_sort(struct grecs_node *node,
- int (*compare)(struct grecs_node const *,
- struct grecs_node const *))
+argot_tree_sort(struct argot_node *node,
+ int (*compare)(struct argot_node const *,
+ struct argot_node const *))
{
if (node && node->down) {
- node->down = grecs_nodelist_sort(node->down, compare);
+ node->down = argot_nodelist_sort(node->down, compare);
for (node = node->down; node; node = node->next)
- grecs_tree_sort(node, compare);
+ argot_tree_sort(node, compare);
}
}
diff --git a/src/symtab.c b/src/symtab.c
index 540ea0f..43469a4 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
@@ -33,11 +33,11 @@ static unsigned int hash_size[] = {
/* |max_rehash| keeps the number of entries in |hash_size| table. */
static unsigned int max_rehash = sizeof(hash_size) / sizeof(hash_size[0]);
-struct grecs_symtab {
+struct argot_symtab {
int flags;
unsigned int hash_num; /* Index to hash_size table */
size_t elsize; /* Size of an element */
- struct grecs_syment **tab;
+ struct argot_syment **tab;
unsigned (*hash_fun)(void *, unsigned long hash_num);
int (*cmp_fun)(const void *, const void *);
int (*copy_fun)(void *, void *);
@@ -46,7 +46,7 @@ struct grecs_symtab {
};
static void
-syment_free(struct grecs_symtab *st, void *ptr)
+syment_free(struct argot_symtab *st, void *ptr)
{
if (st->syment_free_fun)
st->syment_free_fun(ptr);
@@ -54,10 +54,10 @@ syment_free(struct grecs_symtab *st, void *ptr)
free(ptr);
}
-static struct grecs_syment *
-syment_alloc(struct grecs_symtab *st, void *key)
+static struct argot_syment *
+syment_alloc(struct argot_symtab *st, void *key)
{
- struct grecs_syment *ent;
+ struct argot_syment *ent;
ent = st->syment_alloc_fun ?
st->syment_alloc_fun(st->elsize) : malloc(st->elsize);
@@ -75,7 +75,7 @@ syment_alloc(struct grecs_symtab *st, void *key)
unsigned
-grecs_hash_string(const char *name, unsigned long hashsize)
+argot_hash_string(const char *name, unsigned long hashsize)
{
unsigned i;
@@ -87,7 +87,7 @@ grecs_hash_string(const char *name, unsigned long hashsize)
}
unsigned
-grecs_hash_string_ci(const char *name, unsigned long hashsize)
+argot_hash_string_ci(const char *name, unsigned long hashsize)
{
unsigned i;
@@ -101,15 +101,15 @@ grecs_hash_string_ci(const char *name, unsigned long hashsize)
static unsigned
def_hash(void *data, unsigned long hashsize)
{
- struct grecs_syment *sym = data;
- return grecs_hash_string(sym->name, hashsize);
+ struct argot_syment *sym = data;
+ return argot_hash_string(sym->name, hashsize);
}
static int
def_cmp(const void *a, const void *b)
{
- struct grecs_syment const *syma = a;
- struct grecs_syment const *symb = b;
+ struct argot_syment const *syma = a;
+ struct argot_syment const *symb = b;
return strcmp(syma->name, symb->name);
}
@@ -117,8 +117,8 @@ def_cmp(const void *a, const void *b)
static int
def_copy(void *a, void *b)
{
- struct grecs_syment *syma = a;
- struct grecs_syment *symb = b;
+ struct argot_syment *syma = a;
+ struct argot_syment *symb = b;
syma->name = strdup(symb->name);
return syma->name == NULL;
@@ -127,7 +127,7 @@ def_copy(void *a, void *b)
static void
def_free_fun(void *p)
{
- struct grecs_syment *sym = p;
+ struct argot_syment *sym = p;
free(sym->name);
free(sym);
}
@@ -135,7 +135,7 @@ def_free_fun(void *p)
static unsigned
-symtab_insert_pos(struct grecs_symtab *st, void *elt)
+symtab_insert_pos(struct argot_symtab *st, void *elt)
{
unsigned i;
unsigned pos = st->hash_fun(elt, hash_size[st->hash_num]);
@@ -151,9 +151,9 @@ symtab_insert_pos(struct grecs_symtab *st, void *elt)
}
int
-grecs_symtab_replace(struct grecs_symtab *st, void *ent, void **old_ent)
+argot_symtab_replace(struct argot_symtab *st, void *ent, void **old_ent)
{
- struct grecs_syment *entry;
+ struct argot_syment *entry;
unsigned i, pos = st->hash_fun(ent, hash_size[st->hash_num]);
for (i = pos; (entry = st->tab[i]);) {
if (st->cmp_fun(entry, ent) == 0)
@@ -170,10 +170,10 @@ grecs_symtab_replace(struct grecs_symtab *st, void *ent, void **old_ent)
}
static int
-symtab_rehash(struct grecs_symtab *st)
+symtab_rehash(struct argot_symtab *st)
{
- struct grecs_syment **old_tab = st->tab;
- struct grecs_syment **new_tab;
+ struct argot_syment **old_tab = st->tab;
+ struct argot_syment **new_tab;
unsigned int i;
unsigned int hash_num = st->hash_num + 1;
@@ -187,7 +187,7 @@ symtab_rehash(struct grecs_symtab *st)
if (old_tab) {
st->hash_num = hash_num;
for (i = 0; i < hash_size[hash_num-1]; i++) {
- struct grecs_syment *elt = old_tab[i];
+ struct argot_syment *elt = old_tab[i];
if (elt->name) {
unsigned n = symtab_insert_pos(st, elt);
new_tab[n] = elt;
@@ -199,7 +199,7 @@ symtab_rehash(struct grecs_symtab *st)
}
const char *
-grecs_symtab_strerror(int rc)
+argot_symtab_strerror(int rc)
{
switch (rc) {
case ENOENT:
@@ -213,10 +213,10 @@ grecs_symtab_strerror(int rc)
}
int
-grecs_symtab_remove(struct grecs_symtab *st, void *elt)
+argot_symtab_remove(struct argot_symtab *st, void *elt)
{
unsigned int pos, i, j, r;
- struct grecs_syment *entry;
+ struct argot_syment *entry;
pos = st->hash_fun(elt, hash_size[st->hash_num]);
for (i = pos; (entry = st->tab[i]);) {
@@ -252,12 +252,12 @@ grecs_symtab_remove(struct grecs_symtab *st, void *elt)
}
int
-grecs_symtab_get_index(unsigned *idx, struct grecs_symtab *st,
+argot_symtab_get_index(unsigned *idx, struct argot_symtab *st,
void *key, int *install)
{
int rc;
unsigned i, pos;
- struct grecs_syment *elem;
+ struct argot_syment *elem;
if (!st->tab) {
if (install) {
@@ -296,18 +296,18 @@ grecs_symtab_get_index(unsigned *idx, struct grecs_symtab *st,
if ((rc = symtab_rehash(st)) != 0)
return rc;
- return grecs_symtab_get_index(idx, st, key, install);
+ return argot_symtab_get_index(idx, st, key, install);
}
void *
-grecs_symtab_lookup_or_install(struct grecs_symtab *st, void *key,
+argot_symtab_lookup_or_install(struct argot_symtab *st, void *key,
int *install)
{
unsigned i;
- int rc = grecs_symtab_get_index(&i, st, key, install);
+ int rc = argot_symtab_get_index(&i, st, key, install);
if (rc == 0) {
if (install && *install == 1) {
- struct grecs_syment *ent = syment_alloc(st, key);
+ struct argot_syment *ent = syment_alloc(st, key);
if (!ent) {
errno = ENOMEM;
return NULL;
@@ -322,7 +322,7 @@ grecs_symtab_lookup_or_install(struct grecs_symtab *st, void *key,
}
void
-grecs_symtab_clear(struct grecs_symtab *st)
+argot_symtab_clear(struct argot_symtab *st)
{
unsigned i, hs;
@@ -331,7 +331,7 @@ grecs_symtab_clear(struct grecs_symtab *st)
hs = hash_size[st->hash_num];
for (i = 0; i < hs; i++) {
- struct grecs_syment *elem = st->tab[i];
+ struct argot_syment *elem = st->tab[i];
if (elem) {
syment_free(st, elem);
st->tab[i] = NULL;
@@ -339,14 +339,14 @@ grecs_symtab_clear(struct grecs_symtab *st)
}
}
-struct grecs_symtab *
-grecs_symtab_create(size_t elsize,
+struct argot_symtab *
+argot_symtab_create(size_t elsize,
unsigned (*hash_fun)(void *, unsigned long),
int (*cmp_fun)(const void *, const void *),
int (*copy_fun)(void *, void *),
void *(*alloc_fun)(size_t), void (*free_fun)(void *))
{
- struct grecs_symtab *st = malloc(sizeof(*st));
+ struct argot_symtab *st = malloc(sizeof(*st));
if (st) {
memset(st, 0, sizeof(*st));
st->elsize = elsize;
@@ -369,25 +369,25 @@ grecs_symtab_create(size_t elsize,
return st;
}
-struct grecs_symtab *
-grecs_symtab_create_default(size_t elsize)
+struct argot_symtab *
+argot_symtab_create_default(size_t elsize)
{
- return grecs_symtab_create(elsize,
+ return argot_symtab_create(elsize,
NULL, NULL, NULL, NULL, NULL);
}
void
-grecs_symtab_free(struct grecs_symtab *st)
+argot_symtab_free(struct argot_symtab *st)
{
if (st) {
- grecs_symtab_clear(st);
+ argot_symtab_clear(st);
free(st->tab);
free(st);
}
}
size_t
-grecs_symtab_count_entries(struct grecs_symtab *st)
+argot_symtab_count_entries(struct argot_symtab *st)
{
unsigned i;
size_t count = 0;
@@ -399,7 +399,7 @@ grecs_symtab_count_entries(struct grecs_symtab *st)
}
int
-grecs_symtab_enumerate(struct grecs_symtab *st, grecs_symtab_enumerator_t fun,
+argot_symtab_enumerate(struct argot_symtab *st, argot_symtab_enumerator_t fun,
void *data)
{
unsigned i;
@@ -407,7 +407,7 @@ grecs_symtab_enumerate(struct grecs_symtab *st, grecs_symtab_enumerator_t fun,
if (!st)
return 0;
for (i = 0; i < hash_size[st->hash_num]; i++) {
- struct grecs_syment *ep = st->tab[i];
+ struct argot_syment *ep = st->tab[i];
if (ep) {
int rc = fun(ep, data);
if (rc)
diff --git a/src/text.c b/src/text.c
index 089a05c..b0fef92 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,43 +17,43 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <string.h>
-static struct grecs_symtab *text_table;
+static struct argot_symtab *text_table;
/* Lookup a text. If it does not exist, create it. */
char *
-grecs_install_text(const char *str)
+argot_install_text(const char *str)
{
- struct grecs_syment key;
- struct grecs_syment *ent;
+ struct argot_syment key;
+ struct argot_syment *ent;
int install = 1;
if (!text_table) {
- text_table = grecs_symtab_create_default(
- sizeof(struct grecs_syment));
+ text_table = argot_symtab_create_default(
+ sizeof(struct argot_syment));
if (!text_table)
- grecs_alloc_die();
+ argot_alloc_die();
}
key.name = (char*) str;
- ent = grecs_symtab_lookup_or_install(text_table, &key, &install);
+ ent = argot_symtab_lookup_or_install(text_table, &key, &install);
if (!ent)
- grecs_alloc_die();
+ argot_alloc_die();
return ent->name;
}
void
-grecs_destroy_text()
+argot_destroy_text()
{
- grecs_symtab_free(text_table);
+ argot_symtab_free(text_table);
}
-struct grecs_symtab *
-grecs_text_table()
+struct argot_symtab *
+argot_text_table()
{
- struct grecs_symtab *tmp = text_table;
+ struct argot_symtab *tmp = text_table;
text_table = NULL;
return tmp;
}
diff --git a/src/tree.c b/src/tree.c
index 5826abf..14cfa22 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -28,66 +28,66 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
-#include "grecs.h"
+#include "argot.h"
-struct grecs_sockaddr_hints *grecs_sockaddr_hints;
+struct argot_sockaddr_hints *argot_sockaddr_hints;
void
-grecs_value_free_content(struct grecs_value *val)
+argot_value_free_content(struct argot_value *val)
{
int i;
if (!val)
return;
switch (val->type) {
- case GRECS_TYPE_STRING:
- grecs_free(val->v.string);
+ case ARGOT_TYPE_STRING:
+ argot_free(val->v.string);
break;
- case GRECS_TYPE_LIST:
- grecs_list_free(val->v.list);
+ case ARGOT_TYPE_LIST:
+ argot_list_free(val->v.list);
break;
- case GRECS_TYPE_ARRAY:
+ case ARGOT_TYPE_ARRAY:
for (i = 0; i < val->v.arg.c; i++)
- grecs_value_free(val->v.arg.v[i]);
+ argot_value_free(val->v.arg.v[i]);
free(val->v.arg.v);
}
}
void
-grecs_value_free(struct grecs_value *val)
+argot_value_free(struct argot_value *val)
{
- grecs_value_free_content(val);
- grecs_free(val);
+ argot_value_free_content(val);
+ argot_free(val);
}
-struct grecs_node *
-grecs_node_create(enum grecs_node_type type, grecs_locus_t *loc)
+struct argot_node *
+argot_node_create(enum argot_node_type type, argot_locus_t *loc)
{
- struct grecs_node *np = grecs_zalloc(sizeof(*np));
+ struct argot_node *np = argot_zalloc(sizeof(*np));
np->type = type;
if (loc)
np->locus = *loc;
return np;
}
-struct grecs_node *
-grecs_node_create_points(enum grecs_node_type type,
- struct grecs_locus_point beg,
- struct grecs_locus_point end)
+struct argot_node *
+argot_node_create_points(enum argot_node_type type,
+ struct argot_locus_point beg,
+ struct argot_locus_point end)
{
- grecs_locus_t loc;
+ argot_locus_t loc;
loc.beg = beg;
loc.end = end;
- return grecs_node_create(type, &loc);
+ return argot_node_create(type, &loc);
}
void
-grecs_node_bind(struct grecs_node *master, struct grecs_node *node, int dn)
+argot_node_bind(struct argot_node *master, struct argot_node *node, int dn)
{
- struct grecs_node *np;
+ struct argot_node *np;
if (!node)
return;
@@ -118,7 +118,7 @@ grecs_node_bind(struct grecs_node *master, struct grecs_node *node, int dn)
}
int
-grecs_node_unlink(struct grecs_node *node)
+argot_node_unlink(struct argot_node *node)
{
if (node->prev)
node->prev->next = node->next;
@@ -135,13 +135,13 @@ grecs_node_unlink(struct grecs_node *node)
static void
listel_dispose(void *el)
{
- grecs_free(el);
+ argot_free(el);
}
-struct grecs_list *
-_grecs_simple_list_create(int dispose)
+struct argot_list *
+_argot_simple_list_create(int dispose)
{
- struct grecs_list *lp = grecs_list_create();
+ struct argot_list *lp = argot_list_create();
if (dispose)
lp->free_entry = listel_dispose;
return lp;
@@ -150,55 +150,55 @@ _grecs_simple_list_create(int dispose)
-static enum grecs_tree_recurse_res
-_tree_recurse(struct grecs_node *node, grecs_tree_recursor_t recfun,
+static enum argot_tree_recurse_res
+_tree_recurse(struct argot_node *node, argot_tree_recursor_t recfun,
void *data)
{
- enum grecs_tree_recurse_res res;
+ enum argot_tree_recurse_res res;
#define CKRES() \
switch (res) { \
- case grecs_tree_recurse_fail: \
- case grecs_tree_recurse_stop: \
+ case argot_tree_recurse_fail: \
+ case argot_tree_recurse_stop: \
return res; \
default: \
break; \
}
while (node) {
- struct grecs_node *next = node->next;
- if (node->type == grecs_node_stmt) {
- res = recfun(grecs_tree_recurse_set, node, data);
+ struct argot_node *next = node->next;
+ if (node->type == argot_node_stmt) {
+ res = recfun(argot_tree_recurse_set, node, data);
CKRES();
} else {
- switch (recfun(grecs_tree_recurse_pre, node, data)) {
- case grecs_tree_recurse_ok:
+ switch (recfun(argot_tree_recurse_pre, node, data)) {
+ case argot_tree_recurse_ok:
res = _tree_recurse(node->down, recfun, data);
CKRES();
- res = recfun(grecs_tree_recurse_post, node,
+ res = recfun(argot_tree_recurse_post, node,
data);
CKRES();
break;
- case grecs_tree_recurse_fail:
- return grecs_tree_recurse_fail;
- case grecs_tree_recurse_stop:
- return grecs_tree_recurse_stop;
- case grecs_tree_recurse_skip:
+ case argot_tree_recurse_fail:
+ return argot_tree_recurse_fail;
+ case argot_tree_recurse_stop:
+ return argot_tree_recurse_stop;
+ case argot_tree_recurse_skip:
break;
}
}
node = next;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
#undef CKRES
}
int
-grecs_tree_recurse(struct grecs_node *node, grecs_tree_recursor_t recfun,
+argot_tree_recurse(struct argot_node *node, argot_tree_recursor_t recfun,
void *data)
{
switch (_tree_recurse(node, recfun, data)) {
- case grecs_tree_recurse_ok:
- case grecs_tree_recurse_stop:
+ case argot_tree_recurse_ok:
+ case argot_tree_recurse_stop:
return 0;
default:
break;
@@ -207,47 +207,47 @@ grecs_tree_recurse(struct grecs_node *node, grecs_tree_recursor_t recfun,
}
void
-grecs_node_free(struct grecs_node *node)
+argot_node_free(struct argot_node *node)
{
if (!node)
return;
switch (node->type) {
- case grecs_node_root:
- grecs_symtab_free(node->v.texttab);
+ case argot_node_root:
+ argot_symtab_free(node->v.texttab);
break;
default:
- grecs_value_free(node->v.value);
+ argot_value_free(node->v.value);
}
- grecs_free(node->ident);
- grecs_free(node);
+ argot_free(node->ident);
+ argot_free(node);
}
-static enum grecs_tree_recurse_res
-freeproc(enum grecs_tree_recurse_op op, struct grecs_node *node, void *data)
+static enum argot_tree_recurse_res
+freeproc(enum argot_tree_recurse_op op, struct argot_node *node, void *data)
{
switch (op) {
- case grecs_tree_recurse_set:
- case grecs_tree_recurse_post:
- grecs_node_unlink(node);
- grecs_node_free(node);
+ case argot_tree_recurse_set:
+ case argot_tree_recurse_post:
+ argot_node_unlink(node);
+ argot_node_free(node);
break;
- case grecs_tree_recurse_pre:
+ case argot_tree_recurse_pre:
/* descend into the subtree */
break;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
int
-grecs_tree_free(struct grecs_node *node)
+argot_tree_free(struct argot_node *node)
{
if (!node)
return 0;
- if (node->type != grecs_node_root) {
+ if (node->type != argot_node_root) {
errno = EINVAL;
return 1;
}
- grecs_tree_recurse(node, freeproc, NULL);
+ argot_tree_recurse(node, freeproc, NULL);
return 0;
}
@@ -255,16 +255,16 @@ grecs_tree_free(struct grecs_node *node)
static int
fake_callback(
-#if GRECS_TREE_API
- enum grecs_callback_command cmd,
- grecs_node_t *node,
+#if ARGOT_TREE_API
+ enum argot_callback_command cmd,
+ argot_node_t *node,
void *varptr,
void *cb_data
#else
- enum grecs_callback_command cmd,
- grecs_locus_t *locus,
+ enum argot_callback_command cmd,
+ argot_locus_t *locus,
void *varptr,
- grecs_value_t *value,
+ argot_value_t *value,
void *cb_data
#endif
)
@@ -272,12 +272,12 @@ fake_callback(
return 0;
}
-static struct grecs_keyword fake = {
+static struct argot_keyword fake = {
"*",
NULL,
NULL,
- grecs_type_void,
- GRECS_DFLT,
+ argot_type_void,
+ ARGOT_DFLT,
NULL,
0,
fake_callback,
@@ -285,10 +285,10 @@ static struct grecs_keyword fake = {
&fake
};
-static struct grecs_keyword *
-find_keyword(struct grecs_keyword *cursect, const char *ident)
+static struct argot_keyword *
+find_keyword(struct argot_keyword *cursect, const char *ident)
{
- struct grecs_keyword *kwp;
+ struct argot_keyword *kwp;
if (cursect && cursect->kwd && cursect != &fake) {
for (kwp = cursect->kwd; kwp->ident; kwp++)
@@ -301,7 +301,7 @@ find_keyword(struct grecs_keyword *cursect, const char *ident)
}
static void *
-target_ptr(struct grecs_keyword *kwp, char *base)
+target_ptr(struct argot_keyword *kwp, char *base)
{
if (kwp->varptr)
base = (char*) kwp->varptr + kwp->offset;
@@ -312,7 +312,7 @@ target_ptr(struct grecs_keyword *kwp, char *base)
}
static int
-string_to_bool(const char *string, int *pval, grecs_locus_t const *locus)
+string_to_bool(const char *string, int *pval, argot_locus_t const *locus)
{
if (strcmp(string, "yes") == 0
|| strcmp(string, "true") == 0
@@ -325,7 +325,7 @@ string_to_bool(const char *string, int *pval, grecs_locus_t const *locus)
|| strcmp(string, "0") == 0)
*pval = 0;
else {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: not a valid boolean value"),
string);
return 1;
@@ -335,7 +335,7 @@ string_to_bool(const char *string, int *pval, grecs_locus_t const *locus)
static int
string_to_host(struct in_addr *in, const char *string,
- grecs_locus_t const *locus)
+ argot_locus_t const *locus)
{
if (inet_aton(string, in) == 0) {
struct hostent *hp;
@@ -348,15 +348,15 @@ string_to_host(struct in_addr *in, const char *string,
return 0;
}
-#if !GRECS_SOCKADDR_LIST
+#if !ARGOT_SOCKADDR_LIST
static int
-string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
- grecs_locus_t const *locus)
+string_to_sockaddr(struct argot_sockaddr *sp, const char *string,
+ argot_locus_t const *locus)
{
if (string[0] == '/') {
struct sockaddr_un s_un;
if (strlen(string) >= sizeof(s_un.sun_path)) {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: UNIX socket name too long"),
string);
return 1;
@@ -364,7 +364,7 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
s_un.sun_family = AF_UNIX;
strcpy(s_un.sun_path, string);
sp->len = sizeof(s_un);
- sp->sa = grecs_malloc(sp->len);
+ sp->sa = argot_malloc(sp->len);
memcpy(sp->sa, &s_un, sp->len);
} else {
char *p = strchr(string, ':');
@@ -380,18 +380,18 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
if (len == 0)
sa.sin_addr.s_addr = INADDR_ANY;
else {
- char *host = grecs_malloc(len + 1);
+ char *host = argot_malloc(len + 1);
memcpy(host, string, len);
host[len] = 0;
if (string_to_host(&sa.sin_addr, host, locus)) {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: not a valid IP address or hostname"),
host);
- grecs_free(host);
+ argot_free(host);
return 1;
}
- grecs_free(host);
+ argot_free(host);
}
if (p) {
@@ -409,20 +409,20 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
l = strtoul(p, &q, 0);
if (*q || l > USHRT_MAX) {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: not a valid port number"), p);
return 1;
}
sa.sin_port = htons(l);
}
- } else if (grecs_default_port)
- sa.sin_port = grecs_default_port;
+ } else if (argot_default_port)
+ sa.sin_port = argot_default_port;
else {
- grecs_error(locus, 0, _("missing port number"));
+ argot_error(locus, 0, _("missing port number"));
return 1;
}
sp->len = sizeof(sa);
- sp->sa = grecs_malloc(sp->len);
+ sp->sa = argot_malloc(sp->len);
memcpy(sp->sa, &sa, sp->len);
}
return 0;
@@ -467,12 +467,12 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
break; \
if (x <= sum) \
{ \
- grecs_error(loc, 0, _("numeric overflow")); \
+ argot_error(loc, 0, _("numeric overflow")); \
return 1; \
} \
else if (limit && x > limit) \
{ \
- grecs_error(loc, 0, _("value out of allowed range")); \
+ argot_error(loc, 0, _("value out of allowed range")); \
return 1; \
} \
sum = x; \
@@ -507,7 +507,7 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
STRxTONUM(s, type, tmpres, 0, loc); \
if (*s) \
{ \
- grecs_error(loc, 0, _("not a number (stopped near `%s')"), \
+ argot_error(loc, 0, _("not a number (stopped near `%s')"), \
s); \
return 1; \
} \
@@ -537,7 +537,7 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
STRxTONUM(s, unsigned type, tmpres, limit, loc); \
if (*s) \
{ \
- grecs_error(loc, 0, _("not a number (stopped near `%s')"), s); \
+ argot_error(loc, 0, _("not a number (stopped near `%s')"), s); \
return 1; \
} \
res = sign ? - tmpres : tmpres; \
@@ -545,99 +545,99 @@ string_to_sockaddr(struct grecs_sockaddr *sp, const char *string,
int
-grecs_string_convert(void *target, enum grecs_data_type type,
- const char *string, grecs_locus_t const *locus)
+argot_string_convert(void *target, enum argot_data_type type,
+ const char *string, argot_locus_t const *locus)
{
switch (type) {
- case grecs_type_void:
+ case argot_type_void:
abort();
- case grecs_type_null:
+ case argot_type_null:
break;
- case grecs_type_string:
- *(char**)target = grecs_strdup(string);
+ case argot_type_string:
+ *(char**)target = argot_strdup(string);
break;
- case grecs_type_short:
+ case argot_type_short:
GETUNUM(string, short, *(short*)target, locus);
break;
- case grecs_type_ushort:
+ case argot_type_ushort:
GETUNUM(string, unsigned short, *(unsigned short*)target, locus);
break;
- case grecs_type_bool:
+ case argot_type_bool:
return string_to_bool(string, (int*)target, locus);
- case grecs_type_int:
+ case argot_type_int:
GETSNUM(string, int, *(int*)target, locus);
break;
- case grecs_type_uint:
+ case argot_type_uint:
GETUNUM(string, unsigned int, *(unsigned int*)target, locus);
break;
- case grecs_type_long:
+ case argot_type_long:
GETSNUM(string, long, *(long*)target, locus);
break;
- case grecs_type_ulong:
+ case argot_type_ulong:
GETUNUM(string, unsigned long, *(unsigned long*)target, locus);
break;
- case grecs_type_size:
+ case argot_type_size:
GETUNUM(string, size_t, *(size_t*)target, locus);
break;
/*FIXME
- case grecs_type_off:
+ case argot_type_off:
GETSNUM(string, off_t, *(off_t*)target, locus);
break;
*/
- case grecs_type_time:
+ case argot_type_time:
/*FIXME: Use getdate */
GETUNUM(string, time_t, *(time_t*)target, locus);
break;
- case grecs_type_ipv4:
+ case argot_type_ipv4:
if (inet_aton(string, (struct in_addr *)target)) {
- grecs_error(locus, 0, _("%s: not a valid IP address"),
+ argot_error(locus, 0, _("%s: not a valid IP address"),
string);
return 1;
}
break;
- case grecs_type_host:
+ case argot_type_host:
if (string_to_host((struct in_addr *)target, string, locus)) {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("%s: not a valid IP address or hostname"),
string);
return 1;
}
break;
- case grecs_type_sockaddr:
-#if GRECS_SOCKADDR_LIST
- return grecs_str_to_sockaddr((struct grecs_sockaddr **)target,
- string, grecs_sockaddr_hints,
+ case argot_type_sockaddr:
+#if ARGOT_SOCKADDR_LIST
+ return argot_str_to_sockaddr((struct argot_sockaddr **)target,
+ string, argot_sockaddr_hints,
locus);
#else
- return string_to_sockaddr((struct grecs_sockaddr *)target, string,
+ return string_to_sockaddr((struct argot_sockaddr *)target, string,
locus);
#endif
- case grecs_type_cidr:
- return grecs_str_to_cidr((struct grecs_cidr *)target, string, locus);
+ case argot_type_cidr:
+ return argot_str_to_cidr((struct argot_cidr *)target, string, locus);
- case grecs_type_section:
- grecs_error(locus, 0,
+ case argot_type_section:
+ argot_error(locus, 0,
_("invalid use of block statement"));
return 1;
}
return 0;
}
-struct grecs_prop
+struct argot_prop
{
size_t size;
int (*cmp)(const void *, const void *);
@@ -649,8 +649,8 @@ string_cmp(const void *elt1, const void *elt2)
return strcmp((const char *)elt1,(const char *)elt2);
}
-#define __grecs_name_cat__(a,b) a ## b
-#define NUMCMP(type) __grecs_name_cat__(type,_cmp)
+#define __argot_name_cat__(a,b) a ## b
+#define NUMCMP(type) __argot_name_cat__(type,_cmp)
#define __DECL_NUMCMP(type,ctype) \
static int \
NUMCMP(type)(const void *elt1, const void *elt2) \
@@ -666,48 +666,48 @@ DECL_NUMCMP(size_t)
/*FIXME DECL_NUMCMP(off_t)*/
DECL_NUMCMP(time_t)
__DECL_NUMCMP(in_addr, struct in_addr)
-__DECL_NUMCMP(grecs_sockaddr, struct grecs_sockaddr)
+__DECL_NUMCMP(argot_sockaddr, struct argot_sockaddr)
static int
cidr_cmp(const void *elt1, const void *elt2)
{
- struct grecs_cidr const *cp1 = elt1, *cp2 = elt2;
+ struct argot_cidr const *cp1 = elt1, *cp2 = elt2;
return !(cp1->family == cp2->family
&& cp1->len == cp2->len
&& memcmp(cp1->address, cp2->address, cp1->len) == 0
&& memcmp(cp1->netmask, cp2->netmask, cp1->len) == 0);
}
-struct grecs_prop grecs_prop_tab[] = {
- { 0, NULL }, /* grecs_type_void */
- { sizeof(char*), string_cmp }, /* grecs_type_string */
- { sizeof(short), NUMCMP(short) }, /* grecs_type_short */
- { sizeof(unsigned short), NUMCMP(short) }, /* grecs_type_ushort */
- { sizeof(int), NUMCMP(int) }, /* grecs_type_int */
- { sizeof(unsigned int), NUMCMP(int) }, /* grecs_type_uint */
- { sizeof(long), NUMCMP(long) }, /* grecs_type_long */
- { sizeof(unsigned long), NUMCMP(long) }, /* grecs_type_ulong */
- { sizeof(size_t), NUMCMP(size_t) }, /* grecs_type_size */
+struct argot_prop argot_prop_tab[] = {
+ { 0, NULL }, /* argot_type_void */
+ { sizeof(char*), string_cmp }, /* argot_type_string */
+ { sizeof(short), NUMCMP(short) }, /* argot_type_short */
+ { sizeof(unsigned short), NUMCMP(short) }, /* argot_type_ushort */
+ { sizeof(int), NUMCMP(int) }, /* argot_type_int */
+ { sizeof(unsigned int), NUMCMP(int) }, /* argot_type_uint */
+ { sizeof(long), NUMCMP(long) }, /* argot_type_long */
+ { sizeof(unsigned long), NUMCMP(long) }, /* argot_type_ulong */
+ { sizeof(size_t), NUMCMP(size_t) }, /* argot_type_size */
#if 0
FIXME
- { sizeof(off_t), NUMCMP(off_t) }, /* grecs_type_off */
+ { sizeof(off_t), NUMCMP(off_t) }, /* argot_type_off */
#endif
- { sizeof(time_t), NUMCMP(time_t) }, /* grecs_type_time */
- { sizeof(int), NUMCMP(int) }, /* grecs_type_bool */
- { sizeof(struct in_addr), NUMCMP(in_addr) }, /* grecs_type_ipv4 */
- { sizeof(struct grecs_cidr), cidr_cmp }, /* grecs_type_cidr */
- { sizeof(struct in_addr), NUMCMP(in_addr) }, /* grecs_type_host */
- { sizeof(struct grecs_sockaddr), NUMCMP(grecs_sockaddr) },
- /* grecs_type_sockaddr */
- { 0, NULL }, /* grecs_type_section */
- { 0, NULL } /* grecs_type_null */
+ { sizeof(time_t), NUMCMP(time_t) }, /* argot_type_time */
+ { sizeof(int), NUMCMP(int) }, /* argot_type_bool */
+ { sizeof(struct in_addr), NUMCMP(in_addr) }, /* argot_type_ipv4 */
+ { sizeof(struct argot_cidr), cidr_cmp }, /* argot_type_cidr */
+ { sizeof(struct in_addr), NUMCMP(in_addr) }, /* argot_type_host */
+ { sizeof(struct argot_sockaddr), NUMCMP(argot_sockaddr) },
+ /* argot_type_sockaddr */
+ { 0, NULL }, /* argot_type_section */
+ { 0, NULL } /* argot_type_null */
};
-#define grecs_prop_count \
- (sizeof(grecs_prop_tab) / sizeof(grecs_prop_tab[0]))
+#define argot_prop_count \
+ (sizeof(argot_prop_tab) / sizeof(argot_prop_tab[0]))
void
-grecs_process_ident(struct grecs_keyword *kwp, grecs_value_t *value,
- void *base, grecs_locus_t *locus)
+argot_process_ident(struct argot_keyword *kwp, argot_value_t *value,
+ void *base, argot_locus_t *locus)
{
void *target;
@@ -717,128 +717,128 @@ grecs_process_ident(struct grecs_keyword *kwp, grecs_value_t *value,
target = target_ptr(kwp, (char *) base);
if (kwp->callback) {
-#if GRECS_TREE_API
- struct grecs_node node = { 0 };
+#if ARGOT_TREE_API
+ struct argot_node node = { 0 };
node.locus = *locus;
node.v.value = value;
node.ident = (char*) kwp->ident;
- kwp->callback(grecs_callback_set_value,
+ kwp->callback(argot_callback_set_value,
&node,
target,
&kwp->callback_data);
#else
- kwp->callback(grecs_callback_set_value,
+ kwp->callback(argot_callback_set_value,
locus,
target,
value,
&kwp->callback_data);
#endif
- } else if (kwp->type == grecs_type_void || target == NULL)
+ } else if (kwp->type == argot_type_void || target == NULL)
return;
else if (!value) {
- grecs_error(locus, 0, "%s has no value", kwp->ident);
+ argot_error(locus, 0, "%s has no value", kwp->ident);
return;
- } else if (value->type == GRECS_TYPE_ARRAY) {
- grecs_error(locus, 0,
+ } else if (value->type == ARGOT_TYPE_ARRAY) {
+ argot_error(locus, 0,
_("too many arguments to `%s'; missing semicolon?"),
kwp->ident);
return;
- } else if (value->type == GRECS_TYPE_LIST) {
- if (kwp->flags & GRECS_LIST) {
- struct grecs_list_entry *ep;
- enum grecs_data_type type = kwp->type;
+ } else if (value->type == ARGOT_TYPE_LIST) {
+ if (kwp->flags & ARGOT_LIST) {
+ struct argot_list_entry *ep;
+ enum argot_data_type type = kwp->type;
int num = 1;
- struct grecs_list *list;
+ struct argot_list *list;
size_t size;
- if (type >= grecs_prop_count
- || (size = grecs_prop_tab[type].size) == 0) {
- grecs_error(locus, 0,
+ if (type >= argot_prop_count
+ || (size = argot_prop_tab[type].size) == 0) {
+ argot_error(locus, 0,
_("INTERNAL ERROR at %s:%d: "
"unhandled data type %d"),
__FILE__, __LINE__, type);
abort();
}
- list = _grecs_simple_list_create(
- type == grecs_type_string);
- list->cmp = grecs_prop_tab[type].cmp;
+ list = _argot_simple_list_create(
+ type == argot_type_string);
+ list->cmp = argot_prop_tab[type].cmp;
for (ep = value->v.list->head; ep; ep = ep->next) {
- const grecs_value_t *vp = ep->data;
+ const argot_value_t *vp = ep->data;
- if (vp->type != GRECS_TYPE_STRING)
- grecs_error(&vp->locus, 0,
+ if (vp->type != ARGOT_TYPE_STRING)
+ argot_error(&vp->locus, 0,
_("%s: incompatible data type in list item #%d"),
kwp->ident, num);
- else if (type == grecs_type_string)
- grecs_list_append(list,
- grecs_strdup(vp->v.string));
+ else if (type == argot_type_string)
+ argot_list_append(list,
+ argot_strdup(vp->v.string));
else {
- void *ptr = grecs_malloc(size);
- if (grecs_string_convert(ptr,
+ void *ptr = argot_malloc(size);
+ if (argot_string_convert(ptr,
type,
vp->v.string,
&vp->locus)
== 0)
- grecs_list_append(list, ptr);
+ argot_list_append(list, ptr);
else
- grecs_free(ptr);
+ argot_free(ptr);
}
}
- *(struct grecs_list**)target = list;
+ *(struct argot_list**)target = list;
} else {
- grecs_error(locus, 0,
+ argot_error(locus, 0,
_("incompatible data type for `%s'"),
kwp->ident);
return;
}
- } else if (kwp->flags & GRECS_LIST) {
- struct grecs_list *list;
- enum grecs_data_type type = kwp->type;
+ } else if (kwp->flags & ARGOT_LIST) {
+ struct argot_list *list;
+ enum argot_data_type type = kwp->type;
size_t size;
void *ptr;
- if (type >= grecs_prop_count
- || (size = grecs_prop_tab[type].size) == 0) {
- grecs_error(locus, 0,
+ if (type >= argot_prop_count
+ || (size = argot_prop_tab[type].size) == 0) {
+ argot_error(locus, 0,
_("INTERNAL ERROR at %s:%d: unhandled data type %d"),
__FILE__, __LINE__, type);
abort();
}
- list = _grecs_simple_list_create(1);
- list->cmp = grecs_prop_tab[type].cmp;
- if (type == grecs_type_string)
- grecs_list_append(list,
- grecs_strdup(value->v.string));
+ list = _argot_simple_list_create(1);
+ list->cmp = argot_prop_tab[type].cmp;
+ if (type == argot_type_string)
+ argot_list_append(list,
+ argot_strdup(value->v.string));
else {
- ptr = grecs_malloc(size);
- if (grecs_string_convert(ptr, type,
+ ptr = argot_malloc(size);
+ if (argot_string_convert(ptr, type,
value->v.string,
&value->locus)) {
- grecs_free(ptr);
- grecs_list_free(list);
+ argot_free(ptr);
+ argot_list_free(list);
return;
}
- grecs_list_append(list, ptr);
+ argot_list_append(list, ptr);
}
- *(struct grecs_list**)target = list;
+ *(struct argot_list**)target = list;
} else {
- if (kwp->type == grecs_type_string
- && !(kwp->flags & GRECS_CONST))
+ if (kwp->type == argot_type_string
+ && !(kwp->flags & ARGOT_CONST))
free(*(char**)target);
- grecs_string_convert(target, kwp->type,
+ argot_string_convert(target, kwp->type,
value->v.string,
&value->locus);
}
- kwp->flags &= ~GRECS_CONST;
+ kwp->flags &= ~ARGOT_CONST;
}
struct nodeproc_closure {
- struct grecs_keyword *cursect;
- struct grecs_list *sections;
+ struct argot_keyword *cursect;
+ struct argot_list *sections;
int flags;
};
#define CURRENT_BASE(clos) \
@@ -846,22 +846,22 @@ struct nodeproc_closure {
static void
stmt_begin(struct nodeproc_closure *clos,
- struct grecs_keyword *kwp, struct grecs_node *node)
+ struct argot_keyword *kwp, struct argot_node *node)
{
void *target;
- grecs_list_push(clos->sections, clos->cursect);
+ argot_list_push(clos->sections, clos->cursect);
if (kwp) {
target = target_ptr(kwp, CURRENT_BASE(clos));
clos->cursect = kwp;
if (kwp->callback) {
-#if GRECS_TREE_API
- if (kwp->callback(grecs_callback_section_begin,
+#if ARGOT_TREE_API
+ if (kwp->callback(argot_callback_section_begin,
node,
target,
&kwp->callback_data))
#else
- if (kwp->callback(grecs_callback_section_begin,
+ if (kwp->callback(argot_callback_section_begin,
&node->locus,
target,
node->v.value,
@@ -876,28 +876,28 @@ stmt_begin(struct nodeproc_closure *clos,
}
static void
-stmt_end(struct nodeproc_closure *clos, struct grecs_node *node)
+stmt_end(struct nodeproc_closure *clos, struct argot_node *node)
{
- grecs_callback_fn callback = NULL;
+ argot_callback_fn callback = NULL;
void *dataptr = NULL;
- struct grecs_keyword *kwp = clos->cursect;
+ struct argot_keyword *kwp = clos->cursect;
if (clos->cursect && clos->cursect->callback) {
callback = clos->cursect->callback;
dataptr = &clos->cursect->callback_data;
}
- clos->cursect = (struct grecs_keyword *)grecs_list_pop(clos->sections);
+ clos->cursect = (struct argot_keyword *)argot_list_pop(clos->sections);
if (!clos->cursect)
abort();
if (callback)
-#if GRECS_TREE_API
- callback(grecs_callback_section_end,
+#if ARGOT_TREE_API
+ callback(argot_callback_section_end,
node,
kwp ? target_ptr(kwp, CURRENT_BASE(clos)) : NULL,
dataptr);
#else
- callback(grecs_callback_section_end,
+ callback(argot_callback_section_end,
&node->locus,
kwp ? target_ptr(kwp, CURRENT_BASE(clos)) : NULL,
NULL,
@@ -907,69 +907,69 @@ stmt_end(struct nodeproc_closure *clos, struct grecs_node *node)
kwp->callback_data = NULL;
}
-static enum grecs_tree_recurse_res
-nodeproc(enum grecs_tree_recurse_op op, struct grecs_node *node, void *data)
+static enum argot_tree_recurse_res
+nodeproc(enum argot_tree_recurse_op op, struct argot_node *node, void *data)
{
struct nodeproc_closure *clos = data;
- struct grecs_keyword *kwp;
+ struct argot_keyword *kwp;
switch (op) {
- case grecs_tree_recurse_set:
+ case argot_tree_recurse_set:
kwp = find_keyword(clos->cursect, node->ident);
if (!kwp) {
- grecs_error(&node->idloc, 0, _("Unknown keyword"));
- return grecs_tree_recurse_skip;
+ argot_error(&node->idloc, 0, _("Unknown keyword"));
+ return argot_tree_recurse_skip;
}
- grecs_process_ident(kwp, node->v.value, CURRENT_BASE(clos),
+ argot_process_ident(kwp, node->v.value, CURRENT_BASE(clos),
&node->idloc);
break;
- case grecs_tree_recurse_pre:
+ case argot_tree_recurse_pre:
kwp = find_keyword(clos->cursect, node->ident);
if (!kwp) {
- grecs_error(&node->locus, 0, _("Unknown keyword"));
- return grecs_tree_recurse_skip;
+ argot_error(&node->locus, 0, _("Unknown keyword"));
+ return argot_tree_recurse_skip;
}
stmt_begin(clos, kwp, node);
break;
- case grecs_tree_recurse_post:
+ case argot_tree_recurse_post:
stmt_end(clos, node);
break;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
int
-grecs_tree_process(struct grecs_node *node, struct grecs_keyword *kwd)
+argot_tree_process(struct argot_node *node, struct argot_keyword *kwd)
{
int rc;
struct nodeproc_closure clos;
- struct grecs_keyword config_keywords;
+ struct argot_keyword config_keywords;
memset(&config_keywords, 0, sizeof(config_keywords));
config_keywords.kwd = kwd;
clos.cursect = &config_keywords;
- clos.sections = grecs_list_create();
- if (node->type == grecs_node_root)
+ clos.sections = argot_list_create();
+ if (node->type == argot_node_root)
node = node->down;
- rc = grecs_tree_recurse(node, nodeproc, &clos);
- grecs_list_free(clos.sections);
+ rc = argot_tree_recurse(node, nodeproc, &clos);
+ argot_list_free(clos.sections);
return rc;
}
int
-grecs_node_eq(struct grecs_node *a, struct grecs_node *b)
+argot_node_eq(struct argot_node *a, struct argot_node *b)
{
if (a->type != b->type)
return 1;
- if (a->type == grecs_node_root)
+ if (a->type == argot_node_root)
return 0;
if (strcmp(a->ident, b->ident))
return 1;
- if (a->type == grecs_node_block &&
- !grecs_value_eq(a->v.value, b->v.value))
+ if (a->type == argot_node_block &&
+ !argot_value_eq(a->v.value, b->v.value))
return 1;
return 0;
}
@@ -977,80 +977,80 @@ grecs_node_eq(struct grecs_node *a, struct grecs_node *b)
static void
free_value_entry(void *ptr)
{
- struct grecs_value *v = ptr;
- grecs_value_free(v);
+ struct argot_value *v = ptr;
+ argot_value_free(v);
}
-struct grecs_list *
-grecs_value_list_create()
+struct argot_list *
+argot_value_list_create()
{
- struct grecs_list *list = grecs_list_create();
+ struct argot_list *list = argot_list_create();
list->free_entry = free_value_entry;
return list;
}
static void
-value_to_list(struct grecs_value *val)
+value_to_list(struct argot_value *val)
{
- struct grecs_list *list;
+ struct argot_list *list;
int i;
- if (val->type == GRECS_TYPE_LIST)
+ if (val->type == ARGOT_TYPE_LIST)
return;
- list = grecs_value_list_create();
+ list = argot_value_list_create();
switch (val->type) {
- case GRECS_TYPE_STRING:
- grecs_list_append(list, grecs_value_ptr_from_static(val));
+ case ARGOT_TYPE_STRING:
+ argot_list_append(list, argot_value_ptr_from_static(val));
break;
- case GRECS_TYPE_ARRAY:
+ case ARGOT_TYPE_ARRAY:
for (i = 0; i < val->v.arg.c; i++)
- grecs_list_append(list, val->v.arg.v[i]);
+ argot_list_append(list, val->v.arg.v[i]);
}
- val->type = GRECS_TYPE_LIST;
+ val->type = ARGOT_TYPE_LIST;
val->v.list = list;
}
static void
-value_to_array(struct grecs_value *val)
+value_to_array(struct argot_value *val)
{
- if (val->type == GRECS_TYPE_ARRAY)
+ if (val->type == ARGOT_TYPE_ARRAY)
return;
else {
- struct grecs_value **vp;
- vp = grecs_calloc(1, sizeof(*vp));
- vp[0] = grecs_value_ptr_from_static(val);
- val->type = GRECS_TYPE_ARRAY;
+ struct argot_value **vp;
+ vp = argot_calloc(1, sizeof(*vp));
+ vp[0] = argot_value_ptr_from_static(val);
+ val->type = ARGOT_TYPE_ARRAY;
val->v.arg.c = 1;
val->v.arg.v = vp;
}
}
static void
-array_add(struct grecs_value *vx, struct grecs_value *vy)
+array_add(struct argot_value *vx, struct argot_value *vy)
{
size_t i;
- vx->v.arg.v = grecs_realloc(vx->v.arg.v,
+ vx->v.arg.v = argot_realloc(vx->v.arg.v,
(vx->v.arg.c + vy->v.arg.c) *
sizeof(vx->v.arg.v[0]));
for (i = 0; i < vy->v.arg.c; i++)
vx->v.arg.v[i + vy->v.arg.c] = vy->v.arg.v[i];
- grecs_free(vy->v.arg.v);
+ argot_free(vy->v.arg.v);
vy->v.arg.v = NULL;
vy->v.arg.c = 0;
}
static void
-node_aggregate_stmt(struct grecs_node *dst, struct grecs_node *src, int islist)
+node_aggregate_stmt(struct argot_node *dst, struct argot_node *src, int islist)
{
if (islist) {
- struct grecs_list *t;
+ struct argot_list *t;
/* Coerce both arguments to lists */
value_to_list(dst->v.value);
value_to_list(src->v.value);
/* Aggregate two lists in order */
- grecs_list_add(src->v.value->v.list, dst->v.value->v.list);
+ argot_list_add(src->v.value->v.list, dst->v.value->v.list);
/* Swap them */
t = dst->v.value->v.list;
dst->v.value->v.list = src->v.value->v.list;
@@ -1063,25 +1063,25 @@ node_aggregate_stmt(struct grecs_node *dst, struct grecs_node *src, int islist)
}
static void
-node_merge_stmt(struct grecs_node *to_node, struct grecs_node *from_node,
- struct grecs_keyword *kwp, int flags)
+node_merge_stmt(struct argot_node *to_node, struct argot_node *from_node,
+ struct argot_keyword *kwp, int flags)
{
if (kwp &&
- (flags & GRECS_AGGR) ^ (kwp->flags & GRECS_AGGR) &&
- ((kwp->flags & GRECS_LIST) || kwp->callback))
+ (flags & ARGOT_AGGR) ^ (kwp->flags & ARGOT_AGGR) &&
+ ((kwp->flags & ARGOT_LIST) || kwp->callback))
node_aggregate_stmt(to_node, from_node,
- kwp->flags & GRECS_LIST);
+ kwp->flags & ARGOT_LIST);
else {
- grecs_value_free(from_node->v.value);
+ argot_value_free(from_node->v.value);
from_node->v.value = NULL;
}
}
static void
-node_merge_block(struct grecs_node *to_node, struct grecs_node *from_node,
- struct grecs_keyword *kwp)
+node_merge_block(struct argot_node *to_node, struct argot_node *from_node,
+ struct argot_keyword *kwp)
{
- struct grecs_node *sp;
+ struct argot_node *sp;
if (!from_node->down)
return;
@@ -1096,99 +1096,99 @@ node_merge_block(struct grecs_node *to_node, struct grecs_node *from_node,
}
static int
-node_reduce(struct grecs_node *node, struct grecs_keyword *kwp, int flags)
+node_reduce(struct argot_node *node, struct argot_keyword *kwp, int flags)
{
- struct grecs_node *p;
+ struct argot_node *p;
for (p = node->next; p; p = p->next)
- if (grecs_node_eq(p, node) == 0)
+ if (argot_node_eq(p, node) == 0)
break;
if (p) {
switch (node->type) {
- case grecs_node_root:
+ case argot_node_root:
return 0;
- case grecs_node_stmt:
+ case argot_node_stmt:
node_merge_stmt(p, node, kwp, flags);
break;
- case grecs_node_block:
+ case argot_node_block:
node_merge_block(p, node, kwp);
break;
}
- grecs_node_unlink(node);
- grecs_node_free(node);
+ argot_node_unlink(node);
+ argot_node_free(node);
return 1;
}
return 0;
}
-static enum grecs_tree_recurse_res
-reduceproc(enum grecs_tree_recurse_op op, struct grecs_node *node, void *data)
+static enum argot_tree_recurse_res
+reduceproc(enum argot_tree_recurse_op op, struct argot_node *node, void *data)
{
struct nodeproc_closure *clos = data;
- if (op == grecs_tree_recurse_post) {
+ if (op == argot_tree_recurse_post) {
if (clos->sections)
- clos->cursect = (struct grecs_keyword *)
- grecs_list_pop(clos->sections);
+ clos->cursect = (struct argot_keyword *)
+ argot_list_pop(clos->sections);
} else {
- struct grecs_keyword *kwp = NULL;
+ struct argot_keyword *kwp = NULL;
if (clos->cursect) {
kwp = find_keyword(clos->cursect, node->ident);
if (!kwp) {
- grecs_error(&node->locus, 0,
+ argot_error(&node->locus, 0,
_("%s: unknown keyword"),
node->ident);
- return grecs_tree_recurse_skip;
+ return argot_tree_recurse_skip;
}
- if (kwp->flags & GRECS_INAC)
- return grecs_tree_recurse_skip;
- if (!(kwp->flags & GRECS_MULT) &&
+ if (kwp->flags & ARGOT_INAC)
+ return argot_tree_recurse_skip;
+ if (!(kwp->flags & ARGOT_MULT) &&
node_reduce(node, kwp, clos->flags))
- return grecs_tree_recurse_skip;
- if (op == grecs_tree_recurse_pre) {
- grecs_list_push(clos->sections, clos->cursect);
+ return argot_tree_recurse_skip;
+ if (op == argot_tree_recurse_pre) {
+ argot_list_push(clos->sections, clos->cursect);
clos->cursect = kwp;
}
} else if (node_reduce(node, kwp, clos->flags))
- return grecs_tree_recurse_skip;
+ return argot_tree_recurse_skip;
}
- return grecs_tree_recurse_ok;
+ return argot_tree_recurse_ok;
}
int
-grecs_tree_reduce(struct grecs_node *node, struct grecs_keyword *kwd,
+argot_tree_reduce(struct argot_node *node, struct argot_keyword *kwd,
int flags)
{
int rc;
struct nodeproc_closure clos;
- struct grecs_keyword config_keywords;
+ struct argot_keyword config_keywords;
memset(&config_keywords, 0, sizeof(config_keywords));
config_keywords.kwd = kwd;
if (kwd) {
clos.cursect = &config_keywords;
- clos.sections = grecs_list_create();
+ clos.sections = argot_list_create();
} else {
clos.cursect = NULL;
clos.sections = NULL;
}
clos.flags = flags;
- rc = grecs_tree_recurse(node->down, reduceproc, &clos);
- grecs_list_free(clos.sections);
+ rc = argot_tree_recurse(node->down, reduceproc, &clos);
+ argot_list_free(clos.sections);
return rc;
}
-struct grecs_node *
-grecs_tree_first_node(struct grecs_node *tree)
+struct argot_node *
+argot_tree_first_node(struct argot_node *tree)
{
- if (tree->type == grecs_node_root)
+ if (tree->type == argot_node_root)
return tree->down;
return tree;
}
-struct grecs_node *
-grecs_next_node(struct grecs_node *node)
+struct argot_node *
+argot_next_node(struct argot_node *node)
{
if (!node)
return NULL;
@@ -1196,7 +1196,7 @@ grecs_next_node(struct grecs_node *node)
return node->down;
while (!node->next) {
node = node->up;
- if (!node || node->type == grecs_node_root)
+ if (!node || node->type == argot_node_root)
return NULL;
}
return node->next;
diff --git a/src/txtacc.c b/src/txtacc.c
index 5b9a197..c753f21 100644
--- a/src/txtacc.c
+++ b/src/txtacc.c
@@ -19,51 +19,51 @@
#endif
#include <string.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
-struct grecs_txtacc_entry
+struct argot_txtacc_entry
{
char *buf; /* Text buffer */
size_t size; /* Buffer size */
size_t len; /* Actual number of bytes in buffer */
};
#define TXTACC_BUFSIZE 1024
-#define grecs_txtacc_entry_freesize(e) ((e)->size - (e)->len)
+#define argot_txtacc_entry_freesize(e) ((e)->size - (e)->len)
-struct grecs_txtacc
+struct argot_txtacc
{
- struct grecs_list *cur; /* Current build list */
- struct grecs_list *mem; /* List of already allocated elements */
+ struct argot_list *cur; /* Current build list */
+ struct argot_list *mem; /* List of already allocated elements */
};
-static struct grecs_txtacc_entry *
-grecs_txtacc_alloc_entry(struct grecs_list *list, size_t size)
+static struct argot_txtacc_entry *
+argot_txtacc_alloc_entry(struct argot_list *list, size_t size)
{
- struct grecs_txtacc_entry *p = grecs_malloc(sizeof (*p));
- p->buf = grecs_malloc(size);
+ struct argot_txtacc_entry *p = argot_malloc(sizeof (*p));
+ p->buf = argot_malloc(size);
p->size = size;
p->len = 0;
- grecs_list_append(list, p);
+ argot_list_append(list, p);
return p;
}
-static struct grecs_txtacc_entry *
-grecs_txtacc_cur_entry(struct grecs_txtacc *acc)
+static struct argot_txtacc_entry *
+argot_txtacc_cur_entry(struct argot_txtacc *acc)
{
- struct grecs_txtacc_entry *ent;
+ struct argot_txtacc_entry *ent;
- if (grecs_list_size(acc->cur) == 0)
- return grecs_txtacc_alloc_entry(acc->cur,
- GRECS_TXTACC_BUFSIZE);
+ if (argot_list_size(acc->cur) == 0)
+ return argot_txtacc_alloc_entry(acc->cur,
+ ARGOT_TXTACC_BUFSIZE);
ent = acc->cur->tail->data;
- if (grecs_txtacc_entry_freesize(ent) == 0)
- ent = grecs_txtacc_alloc_entry(acc->cur,
- GRECS_TXTACC_BUFSIZE);
+ if (argot_txtacc_entry_freesize(ent) == 0)
+ ent = argot_txtacc_alloc_entry(acc->cur,
+ ARGOT_TXTACC_BUFSIZE);
return ent;
}
static void
-grecs_txtacc_entry_append(struct grecs_txtacc_entry *ent,
+argot_txtacc_entry_append(struct argot_txtacc_entry *ent,
const char *p, size_t size)
{
memcpy(ent->buf + ent->len, p, size);
@@ -71,10 +71,10 @@ grecs_txtacc_entry_append(struct grecs_txtacc_entry *ent,
}
static void
-grecs_txtacc_entry_tailor(struct grecs_txtacc_entry *ent)
+argot_txtacc_entry_tailor(struct argot_txtacc_entry *ent)
{
if (ent->size > ent->len) {
- char *p = grecs_realloc(ent->buf, ent->len);
+ char *p = argot_realloc(ent->buf, ent->len);
if (!p)
return;
ent->buf = p;
@@ -83,83 +83,83 @@ grecs_txtacc_entry_tailor(struct grecs_txtacc_entry *ent)
}
static void
-grecs_txtacc_entry_free(void *p)
+argot_txtacc_entry_free(void *p)
{
if (p) {
- struct grecs_txtacc_entry *ent = p;
+ struct argot_txtacc_entry *ent = p;
free(ent->buf);
free(ent);
}
}
-struct grecs_txtacc *
-grecs_txtacc_create()
+struct argot_txtacc *
+argot_txtacc_create()
{
- struct grecs_txtacc *acc = grecs_malloc(sizeof (*acc));
- acc->cur = grecs_list_create();
- acc->cur->free_entry = grecs_txtacc_entry_free;
- acc->mem = grecs_list_create();
- acc->mem->free_entry = grecs_txtacc_entry_free;
+ struct argot_txtacc *acc = argot_malloc(sizeof (*acc));
+ acc->cur = argot_list_create();
+ acc->cur->free_entry = argot_txtacc_entry_free;
+ acc->mem = argot_list_create();
+ acc->mem->free_entry = argot_txtacc_entry_free;
return acc;
}
void
-grecs_txtacc_free(struct grecs_txtacc *acc)
+argot_txtacc_free(struct argot_txtacc *acc)
{
if (acc) {
- grecs_list_free(acc->cur);
- grecs_list_free(acc->mem);
+ argot_list_free(acc->cur);
+ argot_list_free(acc->mem);
free(acc);
}
}
void
-grecs_txtacc_grow(struct grecs_txtacc *acc, const char *buf, size_t size)
+argot_txtacc_grow(struct argot_txtacc *acc, const char *buf, size_t size)
{
while (size) {
- struct grecs_txtacc_entry *ent = grecs_txtacc_cur_entry(acc);
- size_t rest = grecs_txtacc_entry_freesize(ent);
+ struct argot_txtacc_entry *ent = argot_txtacc_cur_entry(acc);
+ size_t rest = argot_txtacc_entry_freesize(ent);
if (rest > size)
rest = size;
- grecs_txtacc_entry_append(ent, buf, rest);
+ argot_txtacc_entry_append(ent, buf, rest);
buf += rest;
size -= rest;
}
}
void
-grecs_txtacc_grow_string(struct grecs_txtacc *acc, const char *buf)
+argot_txtacc_grow_string(struct argot_txtacc *acc, const char *buf)
{
- grecs_txtacc_grow(acc, buf, strlen(buf));
+ argot_txtacc_grow(acc, buf, strlen(buf));
}
void
-grecs_txtacc_grow_string_escape(struct grecs_txtacc *acc, const char *buf)
+argot_txtacc_grow_string_escape(struct argot_txtacc *acc, const char *buf)
{
for (; *buf; buf++) {
if (strchr(" \t\n\"\'\\", *buf))
- grecs_txtacc_grow_char(acc, '\\');
- grecs_txtacc_grow_char(acc, *buf);
+ argot_txtacc_grow_char(acc, '\\');
+ argot_txtacc_grow_char(acc, *buf);
}
}
char *
-grecs_txtacc_finish(struct grecs_txtacc *acc, int steal)
+argot_txtacc_finish(struct argot_txtacc *acc, int steal)
{
- struct grecs_list_entry *ep;
- struct grecs_txtacc_entry *txtent;
+ struct argot_list_entry *ep;
+ struct argot_txtacc_entry *txtent;
size_t size;
char *p;
- switch (grecs_list_size(acc->cur)) {
+ switch (argot_list_size(acc->cur)) {
case 0:
return NULL;
case 1:
txtent = acc->cur->head->data;
acc->cur->head->data = NULL;
- grecs_txtacc_entry_tailor(txtent);
- grecs_list_append(acc->mem, txtent);
+ argot_txtacc_entry_tailor(txtent);
+ argot_list_append(acc->mem, txtent);
break;
default:
@@ -169,38 +169,38 @@ grecs_txtacc_finish(struct grecs_txtacc *acc, int steal)
size += txtent->len;
}
- txtent = grecs_txtacc_alloc_entry(acc->mem, size);
+ txtent = argot_txtacc_alloc_entry(acc->mem, size);
for (ep = acc->cur->head; ep; ep = ep->next) {
- struct grecs_txtacc_entry *tp = ep->data;
- grecs_txtacc_entry_append(txtent, tp->buf, tp->len);
+ struct argot_txtacc_entry *tp = ep->data;
+ argot_txtacc_entry_append(txtent, tp->buf, tp->len);
}
}
- grecs_list_clear(acc->cur);
+ argot_list_clear(acc->cur);
p = txtent->buf;
if (steal) {
- grecs_list_remove_tail(acc->mem);
+ argot_list_remove_tail(acc->mem);
free(txtent);
}
return p;
}
void
-grecs_txtacc_free_string(struct grecs_txtacc *acc, char *str)
+argot_txtacc_free_string(struct argot_txtacc *acc, char *str)
{
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
for (ep = acc->mem->head; ep; ep = ep->next) {
- struct grecs_txtacc_entry *tp = ep->data;
+ struct argot_txtacc_entry *tp = ep->data;
if (tp->buf == str) {
- grecs_list_remove_entry(acc->mem, ep);
- grecs_txtacc_entry_free(tp);
+ argot_list_remove_entry(acc->mem, ep);
+ argot_txtacc_entry_free(tp);
return;
}
}
}
void
-grecs_txtacc_clear(struct grecs_txtacc *acc)
+argot_txtacc_clear(struct argot_txtacc *acc)
{
- grecs_list_clear(acc->cur);
+ argot_list_clear(acc->cur);
}
diff --git a/src/version.c b/src/version.c
index e769e31..4b3a535 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -17,22 +17,22 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <grecs.h>
+#include <argot.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "gitid.h"
-const char *grecs_vcs_id = "$Id: " GRECS_GIT_ID " $";
+const char *argot_vcs_id = "$Id: " ARGOT_GIT_ID " $";
-struct grecs_version_info *
-grecs_version_split(const char *vstr)
+struct argot_version_info *
+argot_version_split(const char *vstr)
{
char *p;
size_t len;
- struct grecs_version_info *pv = grecs_zalloc(sizeof(*pv));
+ struct argot_version_info *pv = argot_zalloc(sizeof(*pv));
- pv->buffer = grecs_strdup(vstr);
+ pv->buffer = argot_strdup(vstr);
len = strcspn(pv->buffer, " \t");
if (pv->buffer[len]) {
pv->package = pv->buffer;
@@ -67,62 +67,62 @@ grecs_version_split(const char *vstr)
}
void
-grecs_version_info_free(struct grecs_version_info *pv)
+argot_version_info_free(struct argot_version_info *pv)
{
if (pv) {
if (pv->buffer)
- grecs_free(pv->buffer);
+ argot_free(pv->buffer);
free(pv);
}
}
-struct grecs_version_info *
-grecs_version(void)
+struct argot_version_info *
+argot_version(void)
{
- struct grecs_version_info *pv = grecs_zalloc(sizeof(*pv));
+ struct argot_version_info *pv = argot_zalloc(sizeof(*pv));
size_t size = 0;
pv->package = PACKAGE_NAME;
-#ifdef GRECS_VERSION_PATCHLEVEL
-# ifdef GRECS_VERSION_SUFFIX
- grecs_asprintf(&pv->buffer, &size,
+#ifdef ARGOT_VERSION_PATCHLEVEL
+# ifdef ARGOT_VERSION_SUFFIX
+ argot_asprintf(&pv->buffer, &size,
"%d.%d.%d%s",
- GRECS_VERSION_MAJOR, GRECS_VERSION_MINOR,
- GRECS_VERSION_PATCHLEVEL, GRECS_VERSION_SUFFIX);
+ ARGOT_VERSION_MAJOR, ARGOT_VERSION_MINOR,
+ ARGOT_VERSION_PATCHLEVEL, ARGOT_VERSION_SUFFIX);
# else
- grecs_asprintf(&pv->buffer, &size,
+ argot_asprintf(&pv->buffer, &size,
"%d.%d.%d",
- GRECS_VERSION_MAJOR, GRECS_VERSION_MINOR,
- GRECS_VERSION_PATCHLEVEL);
+ ARGOT_VERSION_MAJOR, ARGOT_VERSION_MINOR,
+ ARGOT_VERSION_PATCHLEVEL);
# endif
#else
-# ifdef GRECS_VERSION_SUFFIX
- grecs_asprintf(&pv->buffer, &size,
+# ifdef ARGOT_VERSION_SUFFIX
+ argot_asprintf(&pv->buffer, &size,
"%d.%d%s",
- GRECS_VERSION_MAJOR, GRECS_VERSION_MINOR,
- GRECS_VERSION_SUFFIX);
+ ARGOT_VERSION_MAJOR, ARGOT_VERSION_MINOR,
+ ARGOT_VERSION_SUFFIX);
# else
- grecs_asprintf(&pv->buffer, &size,
+ argot_asprintf(&pv->buffer, &size,
"%d.%d",
- GRECS_VERSION_MAJOR, GRECS_VERSION_MINOR);
+ ARGOT_VERSION_MAJOR, ARGOT_VERSION_MINOR);
# endif
#endif
pv->version = pv->buffer;
- pv->major = GRECS_VERSION_MAJOR;
- pv->minor = GRECS_VERSION_MINOR;
-#ifdef GRECS_VERSION_PATCHLEVEL
- pv->patch = GRECS_VERSION_PATCHLEVEL;
+ pv->major = ARGOT_VERSION_MAJOR;
+ pv->minor = ARGOT_VERSION_MINOR;
+#ifdef ARGOT_VERSION_PATCHLEVEL
+ pv->patch = ARGOT_VERSION_PATCHLEVEL;
#endif
-#ifdef GRECS_VERSION_SUFFIX
- pv->suffix = GRECS_VERSION_SUFFIX;
+#ifdef ARGOT_VERSION_SUFFIX
+ pv->suffix = ARGOT_VERSION_SUFFIX;
#endif
- pv->id = GRECS_GIT_ID;
+ pv->id = ARGOT_GIT_ID;
return pv;
}
int
-grecs_version_info_cmp(struct grecs_version_info *vx,
- struct grecs_version_info *vy,
+argot_version_info_cmp(struct argot_version_info *vx,
+ struct argot_version_info *vy,
int *pres)
{
if (vx->package && vy->package && strcmp(vx->package, vy->package))
@@ -147,43 +147,43 @@ grecs_version_info_cmp(struct grecs_version_info *vx,
}
int
-grecs_version_cmp(const char *vstr1, const char *vstr2, int *pres)
+argot_version_cmp(const char *vstr1, const char *vstr2, int *pres)
{
- struct grecs_version_info *v1, *v2;
+ struct argot_version_info *v1, *v2;
int rc;
if (!vstr1 || !vstr2)
return -1;
- v1 = grecs_version_split(vstr1);
+ v1 = argot_version_split(vstr1);
if (!v1)
return -1;
- v2 = grecs_version_split(vstr2);
+ v2 = argot_version_split(vstr2);
if (!v2) {
- grecs_version_info_free(v1);
+ argot_version_info_free(v1);
return -1;
}
- rc = grecs_version_info_cmp(v1, v2, pres);
- grecs_version_info_free(v1);
- grecs_version_info_free(v2);
+ rc = argot_version_info_cmp(v1, v2, pres);
+ argot_version_info_free(v1);
+ argot_version_info_free(v2);
return rc;
}
int
-grecs_version_ok(const char *vstr)
+argot_version_ok(const char *vstr)
{
- struct grecs_version_info *vmy, *vreq;
+ struct argot_version_info *vmy, *vreq;
int rc, res;
if (!vstr)
return -1;
- vreq = grecs_version_split(vstr);
+ vreq = argot_version_split(vstr);
if (!vreq)
return -1;
- vmy = grecs_version();
+ vmy = argot_version();
if (vreq->suffix && !vmy->suffix)
vmy->suffix = "";
- rc = grecs_version_info_cmp(vmy, vreq, &res);
- grecs_version_info_free(vmy);
- grecs_version_info_free(vreq);
+ rc = argot_version_info_cmp(vmy, vreq, &res);
+ argot_version_info_free(vmy);
+ argot_version_info_free(vreq);
return rc == 0 && res >= 0;
}
diff --git a/src/yytrans b/src/yytrans
index 21d60b5..98fd2b0 100644
--- a/src/yytrans
+++ b/src/yytrans
@@ -16,7 +16,7 @@
#
# See build-aux/yyrename for a description of this file.
-grecs grecs_grecs_
-meta1 grecs_meta1_
-bind grecs_bind_
-json grecs_json_ \ No newline at end of file
+argot argot_argot_
+meta1 argot_meta1_
+bind argot_bind_
+json argot_json_ \ No newline at end of file
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 65f590a..2e9db19 100644
--- a/tests/Makefile.am
+++ b/tests/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
@@ -33,23 +33,23 @@ MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
PARSER_DEFS =
-if GRECS_COND_META1_PARSER
+if ARGOT_COND_META1_PARSER
PARSER_DEFS += ENABLE_META1_PARSER
endif
-if GRECS_COND_BIND_PARSER
+if ARGOT_COND_BIND_PARSER
PARSER_DEFS += ENABLE_BIND_PARSER
endif
-if GRECS_COND_DHCPD_PARSER
+if ARGOT_COND_DHCPD_PARSER
PARSER_DEFS += ENABLE_DHCPD_PARSER
endif
-if GRECS_COND_GIT_PARSER
+if ARGOT_COND_GIT_PARSER
PARSER_DEFS += ENABLE_GIT_PARSER
endif
-if GRECS_COND_JSON
+if ARGOT_COND_JSON
PARSER_DEFS += ENABLE_JSON
endif
@@ -57,7 +57,7 @@ endif
## package.m4. ##
## ------------ ##
-$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@GRECS_SUBDIR@/am/grecs.m4
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@ARGOT_SUBDIR@/am/argot.m4
$(AM_V_GEN){ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
@@ -65,7 +65,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@GRECS_SUBDIR@/am
echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
- echo 'm4_define([GRECS_DISTCK_AT], [@GRECS_DISTCK_AT@])'; \
+ echo 'm4_define([ARGOT_DISTCK_AT], [@ARGOT_DISTCK_AT@])'; \
for var in $(PARSER_DEFS); do \
echo "m4_define([$$var],1)"; \
done; \
@@ -90,7 +90,7 @@ TESTSUITE_AT = \
glob03.at\
glob04.at\
glob05.at\
- grecs00.at\
+ argot00.at\
enum.at\
incl00.at\
incl01.at\
@@ -126,7 +126,7 @@ TESTSUITE_AT = \
testsuite.at\
vercmp.at\
wordsplit.at\
- @GRECS_DISTCK_AT@
+ @ARGOT_DISTCK_AT@
TESTSUITE = $(srcdir)/testsuite
M4=m4
@@ -158,12 +158,12 @@ noinst_PROGRAMS = \
gcfver\
wsp
-if GRECS_COND_JSON
+if ARGOT_COND_JSON
noinst_PROGRAMS += json
endif
-LDADD = @GRECS_LDADD@ $(LIBINTL)
-AM_CPPFLAGS = @GRECS_INCLUDES@ @GRECS_HOST_PROJECT_INCLUDES@
+LDADD = @ARGOT_LDADD@ $(LIBINTL)
+AM_CPPFLAGS = @ARGOT_INCLUDES@ @ARGOT_HOST_PROJECT_INCLUDES@
diff --git a/tests/grecs00.at b/tests/argot00.at
index 82a70e0..b372cf5 100644
--- a/tests/grecs00.at
+++ b/tests/argot00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with Grecs. If not, see <http://www.gnu.org/licenses/>.
-AT_SETUP([C comments in GRECS-style parser])
-AT_KEYWORDS([parser grecs grecs00])
+AT_SETUP([C comments in ARGOT-style parser])
+AT_KEYWORDS([parser argot argot00])
-GRECS_TEST([
+ARGOT_TEST([
zone "foo" {
type delegation-only;
};
diff --git a/tests/bind00.at b/tests/bind00.at
index 71520b7..3dedef6 100644
--- a/tests/bind00.at
+++ b/tests/bind00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([C comments in BIND-style parser])
AT_KEYWORDS([parser bind bind00])
-GRECS_TEST([
+ARGOT_TEST([
zone "foo" {
type delegation-only;
};
diff --git a/tests/cfhelp.at b/tests/cfhelp.at
index 2674cab..3cf236c 100644
--- a/tests/cfhelp.at
+++ b/tests/cfhelp.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/distck.at b/tests/distck.at
index 74a8451..d94b5d2 100644
--- a/tests/distck.at
+++ b/tests/distck.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/distck.c b/tests/distck.c
index ee066f5..745c59e 100644
--- a/tests/distck.c
+++ b/tests/distck.c
@@ -1,17 +1,17 @@
#include <config.h>
-#include "grecs.h"
+#include "argot.h"
int
main(int argc, char **argv)
{
int res;
- struct grecs_version_info *packver, *libver;
+ struct argot_version_info *packver, *libver;
- packver = grecs_version_split(PACKAGE_STRING);
- libver = grecs_version();
- if (!(grecs_version_info_cmp(packver, libver, &res) == 0 &&
+ packver = argot_version_split(PACKAGE_STRING);
+ libver = argot_version();
+ if (!(argot_version_info_cmp(packver, libver, &res) == 0 &&
res == 0)) {
- fprintf(stderr, "grecs.h does not match package number\n");
+ fprintf(stderr, "argot.h does not match package number\n");
return 1;
}
return 0;
diff --git a/tests/empty.at b/tests/empty.at
index 7663c91..794ba59 100644
--- a/tests/empty.at
+++ b/tests/empty.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,34 +17,34 @@
AT_SETUP([Empty input file])
AT_KEYWORDS([parser empty])
-GRECS_TEST([],
+ARGOT_TEST([],
[gcffmt],
[0],
[
])
m4_ifdef([ENABLE_BIND_PARSER],[
-GRECS_TEST([],
+ARGOT_TEST([],
[gcffmt -type=bind],
[0],
[
])])
m4_ifdef([ENABLE_META1_PARSER],[
-GRECS_TEST([],
+ARGOT_TEST([],
[gcffmt -type=meta1],
[0],
[
])])
-GRECS_TEST([],
+ARGOT_TEST([],
[gcffmt -type=path],
[0],
[
])
m4_ifdef([ENABLE_GIT_PARSER],[
-GRECS_TEST([],
+ARGOT_TEST([],
[gcffmt -type=git],
[0],
[
diff --git a/tests/enum.at b/tests/enum.at
index 8a69139..da04de1 100644
--- a/tests/enum.at
+++ b/tests/enum.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/format00.at b/tests/format00.at
index 4ede241..9762222 100644
--- a/tests/format00.at
+++ b/tests/format00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/format01.at b/tests/format01.at
index cd1aa94..282d473 100644
--- a/tests/format01.at
+++ b/tests/format01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/format02.at b/tests/format02.at
index 5ae774e..07f5d15 100644
--- a/tests/format02.at
+++ b/tests/format02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/gcf1.conf b/tests/gcf1.conf
index 7f77dea..9cc103b 100644
--- a/tests/gcf1.conf
+++ b/tests/gcf1.conf
@@ -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
diff --git a/tests/gcfenum.c b/tests/gcfenum.c
index e36dbac..e0eac48 100644
--- a/tests/gcfenum.c
+++ b/tests/gcfenum.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,7 +20,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
static void
usage(const char *arg, FILE *fp, int code)
@@ -36,15 +36,15 @@ main(int argc, char **argv)
{
char *progname = argv[0];
char *file = NULL;
- struct grecs_node *tree, *node;
- int flags = GRECS_NODE_FLAG_QUOTE|
- GRECS_NODE_FLAG_PATH;
+ struct argot_node *tree, *node;
+ int flags = ARGOT_NODE_FLAG_QUOTE|
+ ARGOT_NODE_FLAG_PATH;
int reduce = 0;
while (--argc) {
char *arg = *++argv;
if (strcmp(arg, "-locus") == 0)
- flags |= GRECS_NODE_FLAG_LOCUS;
+ flags |= ARGOT_NODE_FLAG_LOCUS;
else if (strncmp(arg, "-delim=", 7) == 0)
flags |= arg[7];
else if (strcmp(arg, "-reduce") == 0)
@@ -60,18 +60,18 @@ main(int argc, char **argv)
if (!file || argc)
usage(progname, stderr, 1);
- tree = grecs_parse(file);
+ tree = argot_parse(file);
if (!tree)
exit(1);
if (reduce)
- grecs_tree_reduce(tree, NULL, 0);
+ argot_tree_reduce(tree, NULL, 0);
- for (node = grecs_tree_first_node(tree); node;
- node = grecs_next_node(node)) {
- grecs_print_node(node, flags, stdout);
+ for (node = argot_tree_first_node(tree); node;
+ node = argot_next_node(node)) {
+ argot_print_node(node, flags, stdout);
fputc('\n', stdout);
}
- grecs_tree_free(tree);
+ argot_tree_free(tree);
exit(0);
}
diff --git a/tests/gcffmt.c b/tests/gcffmt.c
index 170f788..a11aba5 100644
--- a/tests/gcffmt.c
+++ b/tests/gcffmt.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,7 +20,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
struct list_helper {
FILE *file;
@@ -28,7 +28,7 @@ struct list_helper {
};
static int
-list_parser_types(const char *name, grecs_parser_t parser, void *data)
+list_parser_types(const char *name, argot_parser_t parser, void *data)
{
struct list_helper *p = data;
fprintf(p->file, "%c%s", p->delim, name);
@@ -48,26 +48,26 @@ usage(const char *arg, FILE *fp, int code)
fprintf(fp, " [-nopath] [-novalue] [-type");
lh.file = fp;
lh.delim = '=';
- grecs_enumerate_parsers(list_parser_types, &lh);
+ argot_enumerate_parsers(list_parser_types, &lh);
fprintf(fp, "] [-Idir] [-include=dir] file [file...]\n");
exit(code);
}
static int
-node_ident_cmp(struct grecs_node const *a, struct grecs_node const *b)
+node_ident_cmp(struct argot_node const *a, struct argot_node const *b)
{
return strcmp(a->ident, b->ident);
}
int
-list_parser(const char *name, grecs_parser_t parser, void *data)
+list_parser(const char *name, argot_parser_t parser, void *data)
{
printf("%s\n", name);
return 0;
}
int
-find_parser(const char *name, grecs_parser_t parser, void *data)
+find_parser(const char *name, argot_parser_t parser, void *data)
{
if (strcasecmp(name, (char*)data) == 0)
exit(0);
@@ -77,9 +77,9 @@ find_parser(const char *name, grecs_parser_t parser, void *data)
int
set_parser(const char *arg)
{
- grecs_parser_t p = grecs_get_parser_by_type(arg);
+ argot_parser_t p = argot_get_parser_by_type(arg);
if (p) {
- grecs_parser_fun = p;
+ argot_parser_fun = p;
return 0;
}
return 1;
@@ -90,20 +90,20 @@ main(int argc, char **argv)
{
char *progname = argv[0];
char *file = NULL;
- struct grecs_node *tree;
- int flags = GRECS_NODE_FLAG_DEFAULT;
+ struct argot_node *tree;
+ int flags = ARGOT_NODE_FLAG_DEFAULT;
int reduce = 0;
int sort = 0;
- grecs_parser_options = 0;
+ argot_parser_options = 0;
while (--argc) {
char *arg = *++argv;
if (strcmp(arg, "-locus") == 0)
- flags |= GRECS_NODE_FLAG_LOCUS;
+ flags |= ARGOT_NODE_FLAG_LOCUS;
else if (strcmp(arg, "-nopath") == 0)
- flags &= ~GRECS_NODE_FLAG_PATH;
+ flags &= ~ARGOT_NODE_FLAG_PATH;
else if (strcmp(arg, "-novalue") == 0)
- flags &= ~GRECS_NODE_FLAG_VALUE;
+ flags &= ~ARGOT_NODE_FLAG_VALUE;
else if (strncmp(arg, "-delim=", 7) == 0)
flags |= arg[7];
else if (strcmp(arg, "-reduce") == 0)
@@ -113,26 +113,26 @@ main(int argc, char **argv)
else if (strcmp(arg, "-h") == 0)
usage(progname, stdout, 0);
else if (strcmp(arg, "-list") == 0) {
- grecs_enumerate_parsers(list_parser, NULL);
+ argot_enumerate_parsers(list_parser, NULL);
exit(0);
} else if (strncmp(arg, "-list=", 6) == 0) {
- grecs_enumerate_parsers(find_parser, arg + 6);
+ argot_enumerate_parsers(find_parser, arg + 6);
exit(2);
} else if (strncmp(arg, "-type=", 6) == 0) {
if (set_parser(arg + 6))
usage(progname, stderr, 1);
} else if (strncmp(arg, "-I", 2) == 0)
- grecs_preproc_add_include_dir(arg+2);
+ argot_preproc_add_include_dir(arg+2);
else if (strncmp(arg, "-include=", 9) == 0)
- grecs_preproc_add_include_dir(arg+9);
+ argot_preproc_add_include_dir(arg+9);
else if (strcmp(arg, "-x") == 0)
- grecs_gram_trace(1);
+ argot_gram_trace(1);
else if (strcmp(arg, "-X") == 0)
- grecs_lex_trace(1);
+ argot_lex_trace(1);
else if (strcmp(arg, "-strcat") == 0)
- grecs_parser_options |= GRECS_OPTION_QUOTED_STRING_CONCAT;
+ argot_parser_options |= ARGOT_OPTION_QUOTED_STRING_CONCAT;
else if (strcmp(arg, "-stradj") == 0)
- grecs_parser_options |= GRECS_OPTION_ADJUST_STRING_LOCATIONS;
+ argot_parser_options |= ARGOT_OPTION_ADJUST_STRING_LOCATIONS;
else if (arg[0] == '-')
usage(progname, stderr, 1);
else {
@@ -142,7 +142,7 @@ main(int argc, char **argv)
}
}
- if (!grecs_parser_fun) {
+ if (!argot_parser_fun) {
fprintf(stderr, "%s: requested type not supported", progname);
exit(2);
}
@@ -150,28 +150,28 @@ main(int argc, char **argv)
if (!file)
usage(progname, stderr, 1);
- tree = grecs_parse(file);
+ tree = argot_parse(file);
if (!tree)
exit(1);
for (; argc; argc--) {
char *arg = *++argv;
- struct grecs_node *node = grecs_parse(arg);
+ struct argot_node *node = argot_parse(arg);
if (!node)
exit(1);
- if (grecs_tree_join(tree, node)) {
+ if (argot_tree_join(tree, node)) {
fprintf(stderr, "join failed\n");
exit(1);
}
- grecs_tree_free(node);
+ argot_tree_free(node);
}
if (reduce)
- grecs_tree_reduce(tree, NULL, 0);
+ argot_tree_reduce(tree, NULL, 0);
if (sort)
- grecs_tree_sort(tree, node_ident_cmp);
- grecs_print_node(tree, flags, stdout);
+ argot_tree_sort(tree, node_ident_cmp);
+ argot_print_node(tree, flags, stdout);
fputc('\n', stdout);
- grecs_tree_free(tree);
+ argot_tree_free(tree);
exit(0);
}
diff --git a/tests/gcfpeek.c b/tests/gcfpeek.c
index 3dbd12b..fcd621b 100644
--- a/tests/gcfpeek.c
+++ b/tests/gcfpeek.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -20,7 +20,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
static void
usage(const char *arg, FILE *fp, int code)
@@ -34,9 +34,9 @@ usage(const char *arg, FILE *fp, int code)
int
set_parser(const char *arg)
{
- grecs_parser_t p = grecs_get_parser_by_type(arg);
+ argot_parser_t p = argot_get_parser_by_type(arg);
if (p) {
- grecs_parser_fun = p;
+ argot_parser_fun = p;
return 0;
}
return 1;
@@ -48,8 +48,8 @@ main(int argc, char **argv)
char *progname = argv[0];
char *path = NULL;
char *file = NULL;
- struct grecs_node *tree, *root, *node;
- int flags = GRECS_NODE_FLAG_DEFAULT;
+ struct argot_node *tree, *root, *node;
+ int flags = ARGOT_NODE_FLAG_DEFAULT;
int rc = 2;
int reduce = 0;
int match = 0;
@@ -58,7 +58,7 @@ main(int argc, char **argv)
while (--argc) {
char *arg = *++argv;
if (strcmp(arg, "-locus") == 0)
- flags |= GRECS_NODE_FLAG_LOCUS;
+ flags |= ARGOT_NODE_FLAG_LOCUS;
else if (strncmp(arg, "-delim=", 7) == 0)
flags |= arg[7];
else if (strcmp(arg, "-reduce") == 0)
@@ -66,18 +66,18 @@ main(int argc, char **argv)
else if (strcmp(arg, "-match") == 0)
match = 1;
else if (strcmp(arg, "-nodesc") == 0)
- flags &= ~GRECS_NODE_FLAG_DESCEND;
+ flags &= ~ARGOT_NODE_FLAG_DESCEND;
else if (strcmp(arg, "-nopath") == 0)
- flags &= ~GRECS_NODE_FLAG_PATH;
+ flags &= ~ARGOT_NODE_FLAG_PATH;
else if (strncmp(arg, "-type=", 6) == 0) {
if (set_parser(arg + 6))
usage(progname, stderr, 1);
} else if (strncmp(arg, "-root=", 6) == 0)
root_path = arg + 6;
else if (strcmp(arg, "-strcat") == 0)
- grecs_parser_options |= GRECS_OPTION_QUOTED_STRING_CONCAT;
+ argot_parser_options |= ARGOT_OPTION_QUOTED_STRING_CONCAT;
else if (strcmp(arg, "-stradj") == 0)
- grecs_parser_options |= GRECS_OPTION_ADJUST_STRING_LOCATIONS;
+ argot_parser_options |= ARGOT_OPTION_ADJUST_STRING_LOCATIONS;
else if (strcmp(arg, "-h") == 0)
usage(progname, stdout, 0);
else if (arg[0] == '-')
@@ -94,14 +94,14 @@ main(int argc, char **argv)
if (!file || !path || argc)
usage(progname, stderr, 1);
- tree = grecs_parse(file);
+ tree = argot_parse(file);
if (!tree)
exit(1);
if (reduce)
- grecs_tree_reduce(tree, NULL, 0);
+ argot_tree_reduce(tree, NULL, 0);
if (root_path) {
- root = grecs_find_node(tree, root_path);
+ root = argot_find_node(tree, root_path);
if (!root) {
fprintf(stderr, "%s: node %s not found\n",
progname, root_path);
@@ -111,26 +111,26 @@ main(int argc, char **argv)
root = tree;
if (match) {
- grecs_match_buf_t match_buf;
+ argot_match_buf_t match_buf;
- for (node = grecs_match_first(root, path, &match_buf);
+ for (node = argot_match_first(root, path, &match_buf);
node;
- node = grecs_match_next(match_buf)) {
+ node = argot_match_next(match_buf)) {
rc = 0;
- grecs_print_node(node, flags, stdout);
+ argot_print_node(node, flags, stdout);
fputc('\n', stdout);
}
- grecs_match_buf_free(match_buf);
+ argot_match_buf_free(match_buf);
} else {
for (node = root; node; node = node->next) {
- node = grecs_find_node(node, path);
+ node = argot_find_node(node, path);
if (!node)
break;
rc = 0;
- grecs_print_node(node, flags, stdout);
+ argot_print_node(node, flags, stdout);
fputc('\n', stdout);
}
}
- grecs_tree_free(tree);
+ argot_tree_free(tree);
exit(rc);
}
diff --git a/tests/gcfset.c b/tests/gcfset.c
index f241738..6c2cb06 100644
--- a/tests/gcfset.c
+++ b/tests/gcfset.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
struct logging_setup {
int use_syslog;
@@ -34,136 +34,136 @@ struct logging_setup logging_setup;
char *scalar_string;
char *mailbox_pattern;
char *mailbox_type;
-struct grecs_list *listvar;
+struct argot_list *listvar;
struct program {
char *name;
struct logging_setup logging_setup;
char *scalar_string;
- grecs_locus_t locus;
+ argot_locus_t locus;
struct program *next;
};
-struct grecs_list *proglist;
+struct argot_list *proglist;
-#if GRECS_TREE_API
-# define GRECS_CB_ARGS \
- enum grecs_callback_command cmd,\
- grecs_node_t *node,\
+#if ARGOT_TREE_API
+# define ARGOT_CB_ARGS \
+ enum argot_callback_command cmd,\
+ argot_node_t *node,\
void *varptr,\
void *cb_data
-# define GRECS_CB_AUTO \
- grecs_locus_t *locus = &node->locus;\
- grecs_value_t *value = node->v.value;
+# define ARGOT_CB_AUTO \
+ argot_locus_t *locus = &node->locus;\
+ argot_value_t *value = node->v.value;
#else
-# define GRECS_CB_ARGS \
- enum grecs_callback_command cmd,\
- grecs_locus_t *locus,\
+# define ARGOT_CB_ARGS \
+ enum argot_callback_command cmd,\
+ argot_locus_t *locus,\
void *varptr,\
- grecs_value_t *value,\
+ argot_value_t *value,\
void *cb_data
-# define GRECS_CB_AUTO
+# define ARGOT_CB_AUTO
#endif
static int
-cb_logging_facility(GRECS_CB_ARGS)
+cb_logging_facility(ARGOT_CB_ARGS)
{
- GRECS_CB_AUTO
+ ARGOT_CB_AUTO
- if (cmd != grecs_callback_set_value) {
- grecs_error(locus, 0, "Unexpected block statement");
+ if (cmd != argot_callback_set_value) {
+ argot_error(locus, 0, "Unexpected block statement");
return 1;
}
- if (!value || value->type != GRECS_TYPE_STRING) {
- grecs_error(locus, 0, "expected string argument");
+ if (!value || value->type != ARGOT_TYPE_STRING) {
+ argot_error(locus, 0, "expected string argument");
return 1;
}
- *(char**)varptr = grecs_strdup(value->v.string);
+ *(char**)varptr = argot_strdup(value->v.string);
return 0;
}
-static struct grecs_keyword logging_kwtab[] = {
+static struct argot_keyword logging_kwtab[] = {
{ "syslog", NULL, "Send to syslog",
- grecs_type_bool, GRECS_DFLT, NULL,
+ argot_type_bool, ARGOT_DFLT, NULL,
offsetof(struct logging_setup, use_syslog) },
{ "facility", "name", "Set logging facility",
- grecs_type_string, GRECS_AGGR, NULL,
+ argot_type_string, ARGOT_AGGR, NULL,
offsetof(struct logging_setup, facility), cb_logging_facility },
{ "tag", "label", "Tag logging messages with this string",
- grecs_type_string, GRECS_DFLT, NULL,
+ argot_type_string, ARGOT_DFLT, NULL,
offsetof(struct logging_setup, tag) },
{ "print-priority", NULL, "Prefix each message with its priority",
- grecs_type_bool, GRECS_DFLT, NULL,
+ argot_type_bool, ARGOT_DFLT, NULL,
offsetof(struct logging_setup, print_priority) },
{ NULL },
};
-static struct grecs_keyword mailbox_kwtab[] = {
+static struct argot_keyword mailbox_kwtab[] = {
{ "mailbox-pattern", NULL, "Default mailbox pattern",
- grecs_type_string, GRECS_DFLT, &mailbox_pattern },
+ argot_type_string, ARGOT_DFLT, &mailbox_pattern },
{ "mailbox-type", NULL, "Default mailbox type",
- grecs_type_string, GRECS_DFLT, &mailbox_type },
+ argot_type_string, ARGOT_DFLT, &mailbox_type },
{ NULL },
};
-static struct grecs_keyword program_kwtab[] = {
+static struct argot_keyword program_kwtab[] = {
{ "scalar", "label", "Scalar string",
- grecs_type_string, GRECS_DFLT,
+ argot_type_string, ARGOT_DFLT,
NULL, offsetof(struct program,scalar_string) },
{ "logging", NULL, "Configure logging logging",
- grecs_type_section, GRECS_DFLT,
+ argot_type_section, ARGOT_DFLT,
NULL, offsetof(struct program,logging_setup),
NULL, NULL, logging_kwtab },
{ NULL }
};
static int
-cb_program(GRECS_CB_ARGS)
+cb_program(ARGOT_CB_ARGS)
{
struct program *prog;
void **pdata = cb_data;
- GRECS_CB_AUTO
+ ARGOT_CB_AUTO
switch (cmd) {
- case grecs_callback_section_begin:
- if (!value || value->type != GRECS_TYPE_STRING) {
- grecs_error(locus, 0, "tag must be a string");
+ case argot_callback_section_begin:
+ if (!value || value->type != ARGOT_TYPE_STRING) {
+ argot_error(locus, 0, "tag must be a string");
return 0;
}
- prog = grecs_zalloc(sizeof(*prog));
- prog->name = grecs_strdup(value->v.string);
+ prog = argot_zalloc(sizeof(*prog));
+ prog->name = argot_strdup(value->v.string);
prog->locus = *locus;
*pdata = prog;
break;
- case grecs_callback_section_end:
+ case argot_callback_section_end:
prog = *pdata;
if (!proglist)
- proglist = grecs_list_create();
- grecs_list_append(proglist, prog);
+ proglist = argot_list_create();
+ argot_list_append(proglist, prog);
break;
- case grecs_callback_set_value:
- grecs_error(locus, 0, "invalid use of block statement");
+ case argot_callback_set_value:
+ argot_error(locus, 0, "invalid use of block statement");
}
return 0;
}
-static struct grecs_keyword main_kwtab[] = {
+static struct argot_keyword main_kwtab[] = {
{ "scalar", "label", "Scalar string",
- grecs_type_string, GRECS_DFLT, &scalar_string },
+ argot_type_string, ARGOT_DFLT, &scalar_string },
{ "logging", NULL, "Configure logging logging",
- grecs_type_section, GRECS_DFLT, &logging_setup, 0, NULL,
+ argot_type_section, ARGOT_DFLT, &logging_setup, 0, NULL,
NULL, logging_kwtab },
{ "mailbox", NULL, "Mailbox configuration",
- grecs_type_section, GRECS_DFLT, NULL, 0, NULL, NULL, mailbox_kwtab },
+ argot_type_section, ARGOT_DFLT, NULL, 0, NULL, NULL, mailbox_kwtab },
{ "program", "name: string", "Subprogram configuration",
- grecs_type_section, GRECS_DFLT,
+ argot_type_section, ARGOT_DFLT,
NULL, 0, cb_program, NULL, program_kwtab },
{ "listvar", NULL, "list variable",
- grecs_type_string, GRECS_LIST, &listvar },
+ argot_type_string, ARGOT_LIST, &listvar },
{ NULL }
};
@@ -186,7 +186,7 @@ print_program(struct program *prog)
}
static int
-node_ident_cmp(struct grecs_node const *a, struct grecs_node const *b)
+node_ident_cmp(struct argot_node const *a, struct argot_node const *b)
{
return strcmp(a->ident, b->ident);
}
@@ -203,12 +203,12 @@ main(int argc, char **argv)
{
char *progname = argv[0];
const char *file = NULL;
- struct grecs_node *tree;
+ struct argot_node *tree;
int cfhelp = 0;
int reduce = 0;
int print = 0;
int sort = 0;
- int flags = GRECS_NODE_FLAG_DEFAULT;
+ int flags = ARGOT_NODE_FLAG_DEFAULT;
int dontset = 0;
while (--argc) {
@@ -222,7 +222,7 @@ main(int argc, char **argv)
else if (strcmp(arg, "-print") == 0)
print = 1;
else if (strcmp(arg, "-locus") == 0)
- flags |= GRECS_NODE_FLAG_LOCUS;
+ flags |= ARGOT_NODE_FLAG_LOCUS;
else if (strncmp(arg, "-delim=", 7) == 0)
flags |= arg[7];
else if (strcmp(arg, "-sort") == 0)
@@ -243,32 +243,32 @@ main(int argc, char **argv)
if (cfhelp) {
static char docstring[] =
"Sample configuration file structure.\n";
- grecs_print_docstring(docstring, 0, stdout);
- grecs_print_statement_array(main_kwtab, 1, 0, stdout);
+ argot_print_docstring(docstring, 0, stdout);
+ argot_print_statement_array(main_kwtab, 1, 0, stdout);
exit(0);
}
- tree = grecs_parse(file);
+ tree = argot_parse(file);
if (!tree)
exit(2);
if (reduce)
- grecs_tree_reduce(tree, main_kwtab, GRECS_AGGR);
+ argot_tree_reduce(tree, main_kwtab, ARGOT_AGGR);
if (sort)
- grecs_tree_sort(tree, node_ident_cmp);
+ argot_tree_sort(tree, node_ident_cmp);
if (print) {
- grecs_print_node(tree, flags, stdout);
+ argot_print_node(tree, flags, stdout);
fputc('\n', stdout);
}
if (dontset)
exit(0);
- if (grecs_tree_process(tree, main_kwtab))
+ if (argot_tree_process(tree, main_kwtab))
exit(2);
- grecs_tree_free(tree);
+ argot_tree_free(tree);
printf("Global settings:\n");
printf("scalar = %s\n", S(scalar_string));
if (listvar) {
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
printf("listvar =");
for (ep = listvar->head; ep; ep = ep->next)
printf(" \"%s\"", (char*)ep->data);
@@ -278,10 +278,10 @@ main(int argc, char **argv)
print_logging_setup(&logging_setup);
if (proglist) {
- struct grecs_list_entry *ep;
+ struct argot_list_entry *ep;
printf("Programs configured: %lu\n",
- (unsigned long) grecs_list_size(proglist));
+ (unsigned long) argot_list_size(proglist));
for (ep = proglist->head; ep; ep = ep->next)
print_program(ep->data);
}
diff --git a/tests/gcfver.c b/tests/gcfver.c
index b5c9bab..65b01d3 100644
--- a/tests/gcfver.c
+++ b/tests/gcfver.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -18,12 +18,12 @@
# include <config.h>
#endif
#include <stdlib.h>
-#include "grecs.h"
+#include "argot.h"
int
main(int argc, char **argv)
{
- struct grecs_version_info *vinfo;
+ struct argot_version_info *vinfo;
int res;
if (argc > 3) {
@@ -31,12 +31,12 @@ main(int argc, char **argv)
exit(1);
}
if (argc == 2)
- exit(!grecs_version_ok(argv[1]));
+ exit(!argot_version_ok(argv[1]));
if (argc == 3)
- exit(grecs_version_cmp(argv[1], argv[2], &res) ? 1 :
+ exit(argot_version_cmp(argv[1], argv[2], &res) ? 1 :
res == 0 ? 0 : res < 0 ? 2 : 3);
/* Default action: */
- vinfo = grecs_version();
+ vinfo = argot_version();
printf("package: %s\n", vinfo->package);
printf("version: %s\n", vinfo->version);
printf("major: %d\n", vinfo->major);
@@ -46,7 +46,7 @@ main(int argc, char **argv)
if (vinfo->suffix && vinfo->suffix[0])
printf(" %s", vinfo->suffix);
putchar('\n');
- grecs_version_info_free(vinfo);
+ argot_version_info_free(vinfo);
exit(0);
}
diff --git a/tests/git.conf b/tests/git.conf
index d61a8d3..9a97b16 100644
--- a/tests/git.conf
+++ b/tests/git.conf
@@ -7,7 +7,7 @@
logallrefupdates = true
[remote.origin]
fetch = +refs/heads/*:refs/remotes/origin/*
- url = ssh://git.gnu.org.ua/gitroot/grecs.git
+ url = ssh://git.gnu.org.ua/gitroot/argot.git
[branch "master"]
remote = origin
merge = refs/heads/master
diff --git a/tests/glob00.at b/tests/glob00.at
index a37707d..2dc8bb8 100644
--- a/tests/glob00.at
+++ b/tests/glob00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/glob01.at b/tests/glob01.at
index d1d8c0a..b4f9e0f 100644
--- a/tests/glob01.at
+++ b/tests/glob01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/glob02.at b/tests/glob02.at
index 60bed32..20f8282 100644
--- a/tests/glob02.at
+++ b/tests/glob02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/glob03.at b/tests/glob03.at
index 0a0b7fd..491af1f 100644
--- a/tests/glob03.at
+++ b/tests/glob03.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/glob04.at b/tests/glob04.at
index d13b093..a1d52a4 100644
--- a/tests/glob04.at
+++ b/tests/glob04.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2012-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/glob05.at b/tests/glob05.at
index 07d1064..18292b9 100644
--- a/tests/glob05.at
+++ b/tests/glob05.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2012-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/incl00.at b/tests/incl00.at
index 2d4d3c7..29aeda4 100644
--- a/tests/incl00.at
+++ b/tests/incl00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/incl01.at b/tests/incl01.at
index 9b0ec98..0e29e3d 100644
--- a/tests/incl01.at
+++ b/tests/incl01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/incl02.at b/tests/incl02.at
index 4c4f73d..df69960 100644
--- a/tests/incl02.at
+++ b/tests/incl02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/incl03.at b/tests/incl03.at
index 19d8437..a0c8496 100644
--- a/tests/incl03.at
+++ b/tests/incl03.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/join.at b/tests/join.at
index 7c88379..5897b4a 100644
--- a/tests/join.at
+++ b/tests/join.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/json.c b/tests/json.c
index 0166c1a..a213302 100644
--- a/tests/json.c
+++ b/tests/json.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "grecs.h"
-#include "grecs/json.h"
+#include "argot.h"
+#include "argot/json.h"
static void
printer(void *d, char const *buf, size_t size)
@@ -90,7 +90,7 @@ main(int argc, char **argv)
size = (size_t) st.st_size;
if (size != st.st_size)
abort();
- input = grecs_malloc(size + 1);
+ input = argot_malloc(size + 1);
n = read(fd, input, size);
if (n == -1) {
perror("read");
@@ -115,7 +115,7 @@ main(int argc, char **argv)
if (!obj) {
json_err_locus.beg.file = json_err_locus.end.file =
file ? file : "input";
- grecs_error(&json_err_locus, 0, "%s", json_err_diag);
+ argot_error(&json_err_locus, 0, "%s", json_err_diag);
return 3;
}
if (key) {
diff --git a/tests/locus-bind.at b/tests/locus-bind.at
index 64b990d..7998a0d 100644
--- a/tests/locus-bind.at
+++ b/tests/locus-bind.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/locus-git.at b/tests/locus-git.at
index a34a8f5..0c77e48 100644
--- a/tests/locus-git.at
+++ b/tests/locus-git.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@ AT_DATA([test.cf],[[[core]]
bare = false
logallrefupdates = true
[[remote "origin"]]
- url = ssh://git.gnu.org.ua/gitroot/grecs.git
+ url = ssh://git.gnu.org.ua/gitroot/argot.git
fetch = +refs/heads/*:refs/remotes/origin/*
])
@@ -33,7 +33,7 @@ AT_CHECK([gcffmt -type=GIT -locus test.cf],
test.cf:3.9-23: .core.filemode: "true"
test.cf:4.9-20: .core.bare: "false"
test.cf:5.9-31: .core.logallrefupdates: "true"
-test.cf:7.9-52: .remote.origin.url: "ssh://git.gnu.org.ua/gitroot/grecs.git"
+test.cf:7.9-52: .remote.origin.url: "ssh://git.gnu.org.ua/gitroot/argot.git"
test.cf:8.9-51: .remote.origin.fetch: "+refs/heads/*:refs/remotes/origin/*"
])
@@ -53,7 +53,7 @@ AT_CHECK([gcffmt -type=GIT -nopath -locus test.cf],
test.cf:3.20-23: "true"
test.cf:4.16-20: "false"
test.cf:5.28-31: "true"
-test.cf:7.15-52: "ssh://git.gnu.org.ua/gitroot/grecs.git"
+test.cf:7.15-52: "ssh://git.gnu.org.ua/gitroot/argot.git"
test.cf:8.17-51: "+refs/heads/*:refs/remotes/origin/*"
])
diff --git a/tests/locus-meta1.at b/tests/locus-meta1.at
index 2be6112..2d23b1c 100644
--- a/tests/locus-meta1.at
+++ b/tests/locus-meta1.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/locus00.at b/tests/locus00.at
index bf25298..c95bea0 100644
--- a/tests/locus00.at
+++ b/tests/locus00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/locus01.at b/tests/locus01.at
index 4192d96..a9b9d5c 100644
--- a/tests/locus01.at
+++ b/tests/locus01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/locus02.at b/tests/locus02.at
index 4587be0..97eefaa 100644
--- a/tests/locus02.at
+++ b/tests/locus02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/parser-bind.at b/tests/parser-bind.at
index 0a05ad9..a839b4a 100644
--- a/tests/parser-bind.at
+++ b/tests/parser-bind.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/parser-dhcpd.at b/tests/parser-dhcpd.at
index 1a05147..1c7d4ed 100644
--- a/tests/parser-dhcpd.at
+++ b/tests/parser-dhcpd.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2012, 2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/parser-git.at b/tests/parser-git.at
index fa6e12b..ef8cbd0 100644
--- a/tests/parser-git.at
+++ b/tests/parser-git.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@ AT_CHECK([gcffmt -type=git $abs_srcdir/git.conf],
.core.bare: "false"
.core.logallrefupdates: "true"
.remote.origin.fetch: "+refs/heads/*:refs/remotes/origin/*"
-.remote.origin.url: "ssh://git.gnu.org.ua/gitroot/grecs.git"
+.remote.origin.url: "ssh://git.gnu.org.ua/gitroot/argot.git"
.branch.master.remote: "origin"
.branch.master.merge: "refs/heads/master"
])
diff --git a/tests/parser-meta1.at b/tests/parser-meta1.at
index e720ac4..919b72c 100644
--- a/tests/parser-meta1.at
+++ b/tests/parser-meta1.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/path-locus.at b/tests/path-locus.at
index deff6dc..6086b2b 100644
--- a/tests/path-locus.at
+++ b/tests/path-locus.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2011-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/peek00.at b/tests/peek00.at
index 6d2f5a6..fb1b6db 100644
--- a/tests/peek00.at
+++ b/tests/peek00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/peek01.at b/tests/peek01.at
index 8d6a1ad..2e84848 100644
--- a/tests/peek01.at
+++ b/tests/peek01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/peek02.at b/tests/peek02.at
index 00a9e61..30fa219 100644
--- a/tests/peek02.at
+++ b/tests/peek02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/peek03.at b/tests/peek03.at
index 3f559ad..edcd72a 100644
--- a/tests/peek03.at
+++ b/tests/peek03.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/reduce00.at b/tests/reduce00.at
index 1ff8ebc..448f1ac 100644
--- a/tests/reduce00.at
+++ b/tests/reduce00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Simple statement])
AT_KEYWORDS([reduce reduce00])
-GRECS_TEST([scalar a;
+ARGOT_TEST([scalar a;
scalar b;
],
[gcffmt -reduce],
diff --git a/tests/reduce01.at b/tests/reduce01.at
index 21d7633..11fea27 100644
--- a/tests/reduce01.at
+++ b/tests/reduce01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Block statement])
AT_KEYWORDS([reduce reduce01])
-GRECS_TEST([
+ARGOT_TEST([
block "a" {
scalar a;
foo 1;
diff --git a/tests/reduce02.at b/tests/reduce02.at
index 7120d3f..7be2b6d 100644
--- a/tests/reduce02.at
+++ b/tests/reduce02.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Nested block statement])
AT_KEYWORDS([reduce reduce02])
-GRECS_TEST([
+ARGOT_TEST([
block "a" {
scalar a;
foo 1;
diff --git a/tests/reduce03.at b/tests/reduce03.at
index 191cacf..700fbc5 100644
--- a/tests/reduce03.at
+++ b/tests/reduce03.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Table driven reduction])
AT_KEYWORDS([reduce reduce03])
-GRECS_TEST([
+ARGOT_TEST([
scalar bar;
listvar (1, 2);
listvar foo;
diff --git a/tests/set.at b/tests/set.at
index 7daad18..3de9098 100644
--- a/tests/set.at
+++ b/tests/set.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/sort00.at b/tests/sort00.at
index bce04cc..c42356d 100644
--- a/tests/sort00.at
+++ b/tests/sort00.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Sort])
AT_KEYWORDS([sort sort00])
-GRECS_TEST([b 1;
+ARGOT_TEST([b 1;
a {
x 5;
b 4;
diff --git a/tests/sort01.at b/tests/sort01.at
index 3dd8f7c..1a120b9 100644
--- a/tests/sort01.at
+++ b/tests/sort01.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
AT_SETUP([Stable sort])
AT_KEYWORDS([sort sort01])
-GRECS_TEST([a 10;
+ARGOT_TEST([a 10;
a 2;
a 31;
a 4;
diff --git a/tests/stradj.at b/tests/stradj.at
index 186078a..8593412 100644
--- a/tests/stradj.at
+++ b/tests/stradj.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/strcat.at b/tests/strcat.at
index b5f703a..426608b 100644
--- a/tests/strcat.at
+++ b/tests/strcat.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/testsuite.at b/tests/testsuite.at
index cb7f1a5..144019e 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,4 +1,4 @@
-# This file is part of grecs - Gray's Extensible Configuration System -*- Autotest -*-
+# This file is part of argot - Gray's Extensible Configuration System -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
@@ -37,15 +37,15 @@ m4_define([EX_CONFIG], 78) dnl configuration error
m4_define([AT_SKIP_TEST],[exit 77])
-dnl GRECS_TEST([config],[cmd],[status],[stdout],[stderr])
-m4_define([GRECS_TEST],[
+dnl ARGOT_TEST([config],[cmd],[status],[stdout],[stderr])
+m4_define([ARGOT_TEST],[
AT_DATA([test.cf],[$1])
AT_CHECK([$2 ./test.cf],m4_shift(m4_shift($@)))])
dnl # Begin tests
AT_INIT
-m4_if(GRECS_DISTCK_AT,,,[m4_include(GRECS_DISTCK_AT)])
+m4_if(ARGOT_DISTCK_AT,,,[m4_include(ARGOT_DISTCK_AT)])
m4_include([wordsplit.at])
@@ -120,7 +120,7 @@ m4_include([join.at])
m4_include([cfhelp.at])
m4_include([set.at])
m4_include([vercmp.at])
-m4_include([grecs00.at])
+m4_include([argot00.at])
m4_include([empty.at])
AT_BANNER([Locations])
diff --git a/tests/vercmp.at b/tests/vercmp.at
index 36930b2..df684d4 100644
--- a/tests/vercmp.at
+++ b/tests/vercmp.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2007-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/wordsplit.at b/tests/wordsplit.at
index 895a392..944bb9f 100644
--- a/tests/wordsplit.at
+++ b/tests/wordsplit.at
@@ -1,4 +1,4 @@
-# This file is part of grecs -*- Autotest -*-
+# This file is part of argot -*- Autotest -*-
# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Grecs is free software; you can redistribute it and/or modify
diff --git a/tests/wsp.c b/tests/wsp.c
index e8eb9c6..09eb6ba 100644
--- a/tests/wsp.c
+++ b/tests/wsp.c
@@ -1,4 +1,4 @@
-/* grecs - Gray's Extensible Configuration System
+/* argot - Gray's Extensible Configuration System
Copyright (C) 2014-2016 Sergey Poznyakoff
Grecs is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
#include <string.h>
#include <assert.h>
#include <errno.h>
-#include "grecs.h"
+#include "argot.h"
#include "wordsplit.h"
extern char **environ;
@@ -223,7 +223,7 @@ wsp_runcmd (char **ret, const char *str, size_t len, char **argv, void *closure)
{
size_t size = 0;
ret = NULL;
- if (grecs_asprintf (ret, &size, "can't run %s: %s",
+ if (argot_asprintf (ret, &size, "can't run %s: %s",
cmd, strerror (errno)))
return WRDSE_NOSPACE;
else

Return to:

Send suggestions and report system problems to the System administrator.