aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-04-21 10:34:43 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-04-21 10:34:43 +0300
commit92b663e68d3ded1d4cd6eb8f42a10ced60f85267 (patch)
tree270fd72bbb6c61081f23dc80565288a8b0b9ff71
parent9e8cbcb5be43021aed18ffb92bbbb43379bdb6f2 (diff)
parent3a6373d888021388473bd96c000a8fdab8aedaa5 (diff)
downloadwydawca-92b663e68d3ded1d4cd6eb8f42a10ced60f85267.tar.gz
wydawca-92b663e68d3ded1d4cd6eb8f42a10ced60f85267.tar.bz2
Merge branch 'master' of ssh://git.gnu.org.ua/gitroot/wydawca
-rw-r--r--.gitignore4
-rw-r--r--.gitmodules3
-rw-r--r--Makefile.am22
-rw-r--r--README-hacking35
-rw-r--r--bootstrap.conf7
-rw-r--r--configure.ac46
-rw-r--r--doc/wydawca.texi4
-rw-r--r--gconf/.gitignore4
-rw-r--r--gconf/Makefile.am17
-rw-r--r--gconf/gconf-format.c200
-rw-r--r--gconf/gconf-gram.y891
-rw-r--r--gconf/gconf-lex.l476
-rw-r--r--gconf/gconf-preproc.c728
-rw-r--r--gconf/gconf-text.c73
-rw-r--r--gconf/gconf.h163
-rw-r--r--gconf/gnulib.modules14
-rw-r--r--gconf/wordsplit.c568
-rw-r--r--gconf/wordsplit.h88
m---------grecs0
-rw-r--r--src/Makefile.am4
-rw-r--r--src/cmdline.opt18
-rw-r--r--src/config.c476
-rw-r--r--src/diskio.c8
-rw-r--r--src/tcpwrap.c22
-rw-r--r--src/triplet.c6
-rw-r--r--src/wydawca.c10
-rw-r--r--src/wydawca.h14
-rw-r--r--tests/Makefile.am4
28 files changed, 325 insertions, 3580 deletions
diff --git a/.gitignore b/.gitignore
index 5e9c566..4c9b75d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,10 @@
+*.a
+*.o
*.tar.*
*~
-*.o
-*.a
.bootstrap
.deps
.emacs.desktop
.emacsrc
ABOUT-NLS
ChangeLog
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..fea8f96
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "grecs"]
+ path = grecs
+ url = git://git.gnu.org.ua/grecs.git
diff --git a/Makefile.am b/Makefile.am
index 1eac948..743b2be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,40 +11,22 @@
# 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 wydawca. If not, see <http://www.gnu.org/licenses/>.
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I grecs/am
AUTOMAKE_OPTIONS = gnu 1.8.5
-SUBDIRS=gnu gconf src doc etc tests
+SUBDIRS=gnu grecs src doc etc tests
# We never remove files from the configuration directory
distuninstallcheck_listfiles = \
find $(prefix) -type f -not -path '$(sysconfdir)/*'
gen_start_date = 2009-01-25
-.PHONY: make-ChangeLog
-make-ChangeLog:
- if test -d .git; then \
- $(top_srcdir)/build-aux/gitlog-to-changelog \
- --since=$(gen_start_date) | \
- sed '/<unknown>$$/d' | fmt -s > $(distdir)/cl-t; \
- cat ChangeLog.svn | sed '/^Local Variables:/,/^End:/d' \
- >> $(distdir)/cl-t; \
- echo "Local Variables:" >> $(distdir)/cl-t; \
- echo "mode: change-log" >> $(distdir)/cl-t; \
- echo "version-control: never" >> $(distdir)/cl-t; \
- echo "buffer-read-only: t" >> $(distdir)/cl-t; \
- echo "End:" >> $(distdir)/cl-t; \
- rm -f $(distdir)/ChangeLog; \
- mv $(distdir)/cl-t $(distdir)/ChangeLog; \
- fi
-
-dist-hook: make-ChangeLog
.PHONY: ChangeLog
ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) | \
diff --git a/README-hacking b/README-hacking
index 19b957a..a746607 100644
--- a/README-hacking
+++ b/README-hacking
@@ -1,47 +1,62 @@
-These notes intend to help people working on the SVN version of
+These notes intend to help people working on the Git version of
this package. See end of this file for the copying conditions.
* Requirements
-You need the following packages to build the SVN version of Wydawca. I do
+You need the following packages to build the Git version of Wydawca. I do
not make any efforts to accommodate older versions of these packages,
so please make sure that you have the latest stable version.
- Automake <http://www.gnu.org/software/automake/>
- Autoconf <http://www.gnu.org/software/autoconf/>
- Bison <http://www.gnu.org/software/bison/>
+- Git <http://git.or.cz>
- Gnulib <http://www.gnu.org/software/gnulib/>
+- Grecs <http://puszcza.gnu.org.ua/projects/grecs>
- Flex <http://flex.sourceforge.net/>
- M4 <http://www.gnu.org/software/m4/>
- Mailutils <http://www.gnu.org/software/mailutils/>
-- Subversion <http://subversion.tigris.org/>
- Texinfo <http://www.gnu.org/software/texinfo>
* Bootstrapping
-Obviously, if you are reading these notes, you did manage to check out
-the source tree from SVN. The next step is to create the configuration
-framework:
+Obviously, if you are reading these notes, you did manage to clone
+the source tree from the Git repository. The next step is to create
+the configuration framework:
1. Change to the source tree directory
$ cd wydawca
-2. Run `bootstrap' pointing the --gnulib-srcdir option to the location
-of the local directory where gnulib sources reside, e.g.:
+2. Run `bootstrap':
- ./bootstrap --gnulib-srcdir=/usr/src/gnulib
+ ./bootstrap
Once done, proceed as described in the file README (section
`Installation').
+Normally you will have to run bootstrap only once. However, if you
+intend to hack on Wydawca, you might need to run it again later. In
+this case, you will probably want to save some time and bandwidth by
+avoiding downloading the same files again. If so, create in the Wydawca
+root directory the file named `.bootstrap' with the following
+contents:
+
+ --gnulib-srcdir=$HOME/gnulib
+
+Replace `$HOME/gnulib' with the actual directory where the Gnulib
+sources reside.
+
+For more information about `bootstrap', run `bootstrap --help'.
+
+
* Copyright information
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2009 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/bootstrap.conf b/bootstrap.conf
index 6119189..fde2671 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -18,21 +18,26 @@
source_base=gnu
gnulib_name=libgnu
gnulib_mk=Makefile.am
test -d $source_base || mkdir -p $source_base
+if git config submodule.grecs.url >/dev/null; then : ; else
+ git submodule init || exit $?
+ git submodule update || exit $?
+fi
+
# We don't need these modules, even though gnulib-tool mistakenly
# includes them because of gettext dependencies.
avoided_gnulib_modules='
--avoid=lock
--avoid=size_max
'
# gnulib modules used by this package.
-gnulib_modules="`grep -h '^[^#]' gnulib.modules gconf/gnulib.modules | sort | uniq`"
+gnulib_modules="`grep -h '^[^#]' gnulib.modules grecs/gnulib.modules | sort | uniq`"
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--flag=_:1:pass-c-format\\\
--flag=N_:1:pass-c-format\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
diff --git a/configure.ac b/configure.ac
index 604ccc4..48e1252 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,54 +103,15 @@ if test "$status_tcpwrap" = yes; then
AC_CHECK_HEADERS(tcpd.h,,[status_tcpwrap=no])
fi
fi
if test "$status_tcpwrap" = yes; then
AC_DEFINE_UNQUOTED([WITH_LIBWRAP],1,[Defined if compiling with libwrap])
fi
-
-# **********************
-# Preprocessor
-# **********************
-AC_ARG_WITH([preprocessor],
- AC_HELP_STRING([--without-preprocessor],
- [do not use external preprocessor]),
- [
-case "${withval}" in
-yes) use_ext_pp=yes ;;
-no) use_ext_pp=no ;;
-*) AC_MSG_ERROR(bad value ${withval} for --with-preprocessor) ;;
-esac],[use_ext_pp=yes])
-
-if test $use_ext_pp != no; then
- # Check for default preprocessor
- AC_ARG_VAR([DEFAULT_PREPROCESSOR],
- [Set default preprocessor name])
- if test -z "$DEFAULT_PREPROCESSOR" ; then
- DEFAULT_PREPROCESSOR="m4 -s"
- fi
-
- save_PATH=$PATH
- PREPROC_OPTIONS=`echo $DEFAULT_PREPROCESSOR | sed -n 's/[[^ ]][[^ ]]* //p'`
- case "$DEFAULT_PREPROCESSOR" in
- /*) PATH=`expr $DEFAULT_PREPROCESSOR : '\(.*\)/.*'`:$PATH
- DEFAULT_PREPROCESSOR=`expr $DEFAULT_PREPROCESSOR : '.*/\(.*\)'`;;
- esac
- AC_PATH_PROG(PPBIN, $DEFAULT_PREPROCESSOR)
- DEFAULT_PREPROCESSOR=$PPBIN
- if test -n "$DEFAULT_PREPROCESSOR"; then
- DEFAULT_PREPROCESSOR="$DEFAULT_PREPROCESSOR $PREPROC_OPTIONS"
- case $PPBIN in
- *m4) AC_SUBST(PP_SETUP_FILE,'pp-setup');; # Install default pp-setup
- esac
- fi
- PATH=$save_PATH
- DEFAULT_PREPROCESSOR="\\\"$DEFAULT_PREPROCESSOR\\\""
-else
- DEFAULT_PREPROCESSOR=NULL
-fi
+# Grecs subsystem
+GRECS_SETUP
AH_BOTTOM([
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
@@ -169,11 +130,12 @@ if test -n "$GPG"; then
AC_SUBST(WYDAWCA_GPGFILES, '$(GPGFILES)')
fi
AC_CONFIG_FILES([Makefile
doc/Makefile
gnu/Makefile
- gconf/Makefile
+ grecs/Makefile
+ grecs/src/Makefile
src/Makefile
etc/Makefile])
AC_OUTPUT
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index 5e00dcf..c5eb691 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -1276,14 +1276,14 @@ archive-signatures no;
@cindex source directory, defining
@kwindex source
@kwindex destination
@UNREVISED
A @dfn{distribution spool} defines the location of the source directory
and the corresponding distribution (or @dfn{destination})
-directory. It may also set the archivation type being used for that
-directory, various access methods and notifications, thus overriding
+directory. It may also set archivation type,
+various access methods and notifications for that directory, thus overriding
global settings.
Distribution spool is defined in the configuration file by the
@code{spool} block statement:
@smallexample
diff --git a/gconf/.gitignore b/gconf/.gitignore
deleted file mode 100644
index 42c88b2..0000000
--- a/gconf/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-gconf-gram.c
-gconf-gram.h
-gconf-gram.output
-gconf-lex.c
diff --git a/gconf/Makefile.am b/gconf/Makefile.am
deleted file mode 100644
index afe06b0..0000000
--- a/gconf/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-noinst_LIBRARIES=libgconf.a
-libgconf_a_SOURCES = \
- gconf-format.c\
- gconf-gram.y\
- gconf-lex.l\
- gconf-preproc.c\
- gconf-text.c\
- gconf.h\
- wordsplit.c\
- wordsplit.h
-
-EXTRA_DIST=gconf-gram.h
-
-INCLUDES = -I$(top_srcdir)/gnu -I../gnu
-AM_YFLAGS = -dtv
-AM_LFLAGS = -dvp
-
diff --git a/gconf/gconf-format.c b/gconf/gconf-format.c
deleted file mode 100644
index ea8a808..0000000
--- a/gconf/gconf-format.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* gconf - General purpose configuration parser.
- Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <gconf.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-
-#if ENABLE_NLS
-# include "gettext.h"
-#else
-# define gettext(s) s
-#endif
-
-#define _(s) gettext (s)
-#define N_(s) s
-
-const char *
-gconf_data_type_string (enum gconf_data_type type)
-{
- switch (type)
- {
- case gconf_type_void:
- return "void";
-
- case gconf_type_string:
- return "string";
-
- case gconf_type_short:
- case gconf_type_ushort:
- case gconf_type_int:
- case gconf_type_uint:
- case gconf_type_long:
- case gconf_type_ulong:
- case gconf_type_size:
-/* case gconf_type_off:*/
- case gconf_type_uintmax:
- case gconf_type_intmax:
- return "number";
-
- case gconf_type_time:
- return "time";
-
- case gconf_type_bool:
- return "boolean";
-
- case gconf_type_ipv4:
- return "IPv4";
-
- case gconf_type_cidr:
- return "CIDR";
-
- case gconf_type_host:
- return "hostname";
-
- case gconf_type_sockaddr:
- return "sock-addr";
-
- case gconf_type_section:
- return "section";
- }
- return "UNKNOWN?";
-}
-
-static void
-format_level (FILE *stream, unsigned level)
-{
- while (level--)
- fprintf (stream, " ");
-}
-
-void
-gconf_format_docstring (FILE *stream, const char *docstring, unsigned level)
-{
- size_t len = strlen (docstring);
- int width = 78 - level * 2;
-
- if (width < 0)
- {
- width = 78;
- level = 0;
- }
-
- while (len)
- {
- size_t seglen;
- const char *p;
-
- for (seglen = 0, p = docstring; p < docstring + width && *p; p++)
- {
- if (*p == '\n')
- {
- seglen = p - docstring;
- break;
- }
- if (isspace (*p))
- seglen = p - docstring;
- }
- if (seglen == 0 || *p == 0)
- seglen = p - docstring;
-
- format_level (stream, level);
- fprintf (stream, "# ");
- fwrite (docstring, seglen, 1, stream);
- fputc ('\n', stream);
- len -= seglen;
- docstring += seglen;
- if (*docstring == '\n')
- {
- docstring++;
- len--;
- }
- else
- while (*docstring && isspace (*docstring))
- {
- docstring++;
- len--;
- }
- }
-}
-
-void
-gconf_format_simple_statement (FILE *stream, struct gconf_keyword *kwp,
- unsigned level)
-{
- const char *argstr;
-
- if (kwp->docstring)
- gconf_format_docstring (stream, kwp->docstring, level);
- format_level (stream, level);
-
- if (kwp->argname)
- argstr = kwp->argname;
- else
- argstr = N_("arg");
-
- if (strchr ("<[", argstr[0]))
- fprintf (stream, "%s %s;\n", kwp->ident, gettext (argstr));
- else if (strchr (argstr, ':'))
- fprintf (stream, "%s <%s>;\n", kwp->ident, gettext (argstr));
- else
- {
- fprintf (stream, "%s <%s: ", kwp->ident, gettext (argstr));
- if (GCONF_IS_LIST (kwp->type))
- fprintf (stream, "list of %s",
- gettext (gconf_data_type_string (GCONF_TYPE (kwp->type))));
- else
- fprintf (stream, "%s", gettext (gconf_data_type_string (kwp->type)));
- fprintf (stream, ">;\n");
- }
-}
-
-void
-gconf_format_block_statement (FILE *stream, struct gconf_keyword *kwp,
- unsigned level)
-{
- if (kwp->docstring)
- gconf_format_docstring (stream, kwp->docstring, level);
- format_level (stream, level);
- fprintf (stream, "%s", kwp->ident);
- if (kwp->argname)
- fprintf (stream, " <%s>", gettext (kwp->argname));
- fprintf (stream, " {\n");
- gconf_format_statement_array (stream, kwp->kwd, 0, level + 1);
- format_level (stream, level);
- fprintf (stream, "}\n");
-}
-
-void
-gconf_format_statement_array (FILE *stream, struct gconf_keyword *kwp,
- unsigned n,
- unsigned level)
-{
- for (; kwp->ident; kwp++, n++)
- {
- if (n)
- fputc ('\n', stream);
- if (kwp->type == gconf_type_section)
- gconf_format_block_statement (stream, kwp, level);
- else
- gconf_format_simple_statement (stream, kwp, level);
- }
-}
diff --git a/gconf/gconf-gram.y b/gconf/gconf-gram.y
deleted file mode 100644
index c2d833b..0000000
--- a/gconf/gconf-gram.y
+++ /dev/null
@@ -1,891 +0,0 @@
-%{
-/* gconf - General purpose configuration parser.
- Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <gconf.h>
-#include <gconf-gram.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include <xalloc.h>
-#include <inttypes.h>
-
-#if ENABLE_NLS
-# include "gettext.h"
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) msgid
-#endif
-
-typedef union
-{
- struct sockaddr s;
- struct sockaddr_in s_in;
- struct sockaddr_un s_un;
-} sockaddr_union_t;
-
-static struct gconf_keyword config_keywords;
-static struct gconf_keyword *cursect;
-static gl_list_t sections;
-int gconf_error_count;
-
-int gconf_default_port = 0;
-
-static void *target_ptr(struct gconf_keyword *kwp);
-static void stmt_begin(struct gconf_keyword *kwp, gconf_value_t tag);
-static void stmt_end(struct gconf_keyword *kwp);
-static struct gconf_keyword *find_keyword(const char *ident);
-
-static void process_ident(struct gconf_keyword *kwp, gconf_value_t *value);
-static gl_list_t simple_list_create (bool dispose);
-%}
-
-%union {
- char *string;
- gconf_value_t value;
- gl_list_t list;
- struct gconf_keyword *kw;
-}
-
-%token <string> IDENT STRING QSTRING MSTRING
-%type <string> string slist
-%type <list> slist0
-%type <value> value tag vallist
-%type <list> values list vlist
-%type <kw> ident
-
-%%
-
-input : stmtlist
- ;
-
-stmtlist: stmt
- | stmtlist stmt
- ;
-
-stmt : simple
- | block
- ;
-
-simple : ident vallist ';'
- {
- process_ident($1, &$2);
- }
- ;
-
-block : ident tag { stmt_begin($<kw>1, $<value>2); } '{' stmtlist '}' opt_sc
- {
- stmt_end($1);
- }
- ;
-
-ident : IDENT
- {
- $$ = find_keyword($1);
- if (!$$)
- gconf_error(&gconf_current_locus, 0, _("Unknown keyword"));
- }
- ;
-
-tag : /* empty */
- {
- $$.type = GCONF_TYPE_STRING;
- $$.v.string = NULL;
- }
- | value
- ;
-
-vallist : vlist
- {
- size_t n;
-
- if ((n = gl_list_size ($1)) == 1)
- {
- $$ = *(gconf_value_t *)gl_list_get_at ($1, 0);
- }
- else
- {
- size_t i;
-
- $$.type = GCONF_TYPE_ARRAY;
- $$.v.arg.c = n;
- $$.v.arg.v = xcalloc (n, sizeof ($$.v.arg.v[0]));
- for (i = 0; i < n; i++)
- $$.v.arg.v[i] = *(gconf_value_t *)gl_list_get_at ($1, i);
- }
- gl_list_free ($1);
- }
- ;
-
-vlist : value
- {
- $$ = simple_list_create (false);
- gl_list_add_last ($$, gconf_value_dup (&$1));
- }
- | vlist value
- {
- gl_list_add_last ($1, gconf_value_dup (&$2));
- }
- ;
-
-value : string
- {
- $$.type = GCONF_TYPE_STRING;
- $$.v.string = $1;
- }
- | list
- {
- $$.type = GCONF_TYPE_LIST;
- $$.v.list = $1;
- }
- | MSTRING
- {
- $$.type = GCONF_TYPE_STRING;
- $$.v.string = $1;
- }
- ;
-
-string : STRING
- | IDENT
- | slist
- ;
-
-slist : slist0
- {
- const void *p;
- gl_list_iterator_t itr = gl_list_iterator ($1);
-
- gconf_line_begin ();
- while (gl_list_iterator_next (&itr, &p, NULL))
- gconf_line_add (p, strlen (p));
- $$ = gconf_line_finish ();
- gl_list_iterator_free (&itr);
- gl_list_free ($1);
- }
- ;
-
-slist0 : QSTRING
- {
- $$ = simple_list_create (false);
- gl_list_add_last ($$, $1);
- }
- | slist0 QSTRING
- {
- gl_list_add_last ($1, $2);
- $$ = $1;
- }
- ;
-
-list : '(' ')'
- {
- $$ = NULL;
- }
- | '(' values ')'
- {
- $$ = $2;
- }
- | '(' values ',' ')'
- {
- $$ = $2;
- }
- ;
-
-values : value
- {
- $$ = simple_list_create (true);
- gl_list_add_last ($$, gconf_value_dup (&$1));
- }
- | values ',' value
- {
- gl_list_add_last ($1, gconf_value_dup (&$3));
- $$ = $1;
- }
- ;
-
-opt_sc : /* empty */
- | ';'
- ;
-
-%%
-
-int
-yyerror(char *s)
-{
- gconf_error (&gconf_current_locus, 0, "%s", s);
- return 0;
-}
-
-static void
-listel_dispose(const void *el)
-{
- free((void*)el);
-}
-
-static gl_list_t
-simple_list_create (bool dispose)
-{
- return gl_list_create_empty(&gl_linked_list_implementation,
- NULL,
- NULL,
- dispose ? listel_dispose : NULL,
- false);
-}
-
-
-void
-gconf_warning(gconf_locus_t *locus, int errcode, const char *fmt, ...)
-{
- va_list ap;
- char *buf = NULL;
-
- va_start (ap, fmt);
- vasprintf (&buf, fmt, ap);
- va_end (ap);
- gconf_print_diag (locus, 0, errcode, buf);
- free(buf);
-}
-
-void
-gconf_error (gconf_locus_t *locus, int errcode, const char *fmt, ...)
-{
- va_list ap;
- char *buf = NULL;
-
- va_start (ap, fmt);
- vasprintf (&buf, fmt, ap);
- va_end (ap);
- gconf_print_diag (locus, 1, errcode, buf);
- free (buf);
- gconf_error_count++;
-}
-
-void
-gconf_set_keywords (struct gconf_keyword *kwd)
-{
- config_keywords.kwd = kwd;
-}
-
-int
-gconf_parse (const char *name)
-{
- int rc;
- if (gconf_lex_begin (name))
- return 1;
- cursect = &config_keywords;
- if (sections)
- {
- gl_list_free (sections);
- sections = NULL;
- }
- rc = yyparse ();
- gconf_lex_end ();
- if (gconf_error_count)
- rc = 1;
- return rc;
-}
-
-void
-gconf_gram_trace (int n)
-{
- yydebug = n;
-}
-
-
-
-static void *
-target_ptr (struct gconf_keyword *kwp)
-{
- char *base;
-
- if (kwp->varptr)
- base = (char*) kwp->varptr + kwp->offset;
- else if (cursect && cursect->callback_data)
- base = (char*) cursect->callback_data + kwp->offset;
- else
- base = NULL;
- return base;
-}
-
-static int
-fake_callback (enum gconf_callback_command cmd,
- gconf_locus_t *locus,
- void *varptr,
- gconf_value_t *value,
- void *cb_data)
-{
- return 0;
-}
-
-static struct gconf_keyword fake = {
- "*",
- NULL,
- NULL,
- gconf_type_void,
- NULL,
- 0,
- fake_callback,
- NULL,
- &fake
-};
-
-static void
-stmt_begin (struct gconf_keyword *kwp, gconf_value_t tag)
-{
- void *target;
-
- if (!sections)
- sections = simple_list_create (false);
- gl_list_add_first (sections, cursect);
- if (kwp)
- {
- target = target_ptr (kwp);
- cursect = kwp;
- if (kwp->callback && kwp->callback (gconf_callback_section_begin,
- &gconf_current_locus, /* FIXME */
- target,
- &tag,
- &kwp->callback_data))
- cursect = &fake;
- }
- else
- /* install "ignore-all" section */
- cursect = kwp;
-}
-
-static void
-stmt_end (struct gconf_keyword *kwp)
-{
- gconf_callback_fn callback = NULL;
- void *dataptr = NULL;
-
- if (cursect && cursect->callback)
- {
- callback = cursect->callback;
- dataptr = &cursect->callback_data;
- }
-
- if (gl_list_size (sections) == 0)
- abort ();
- cursect = (struct gconf_keyword *) gl_list_get_at (sections, 0);
- gl_list_remove_at (sections, 0);
- if (callback)
- callback (gconf_callback_section_end,
- &gconf_current_locus, /* FIXME */
- kwp ? target_ptr(kwp) : NULL,
- NULL,
- dataptr);
-
-}
-
-static struct gconf_keyword *
-find_keyword (const char *ident)
-{
- struct gconf_keyword *kwp;
-
- if (cursect && cursect != &fake)
- {
- for (kwp = cursect->kwd; kwp->ident; kwp++)
- if (strcmp (kwp->ident, ident) == 0)
- return kwp;
- }
- else
- {
- return &fake;
- }
- return NULL;
-}
-
-static int
-string_to_signed (intmax_t *sval, const char *string,
- intmax_t minval, intmax_t maxval)
-{
- intmax_t t;
- char *p;
-
- t = strtoimax (string, &p, 0);
- if (*p)
- {
- gconf_error (&gconf_current_locus, 0, _("cannot convert `%s' to number"),
- string);
- return 1;
- }
- else if (t < minval || t > maxval)
- {
- gconf_error (&gconf_current_locus, 0,
- _("%s: value out of allowed range %"PRIiMAX"..%"PRIiMAX),
- string, minval, maxval);
- return 1;
- }
- *sval = t;
- return 0;
-}
-
-static int
-string_to_unsigned (uintmax_t *sval, const char *string, uintmax_t maxval,
- gconf_locus_t *loc)
-{
- uintmax_t t;
- char *p;
-
- t = strtoumax (string, &p, 0);
- if (*p)
- {
- gconf_error (loc, 0, _("cannot convert `%s' to number"),
- string);
- return 1;
- }
- else if (t > maxval)
- {
- gconf_error (loc, 0,
- _("%s: value out of allowed range 0..%"PRIuMAX),
- string, maxval);
- return 1;
- }
- *sval = t;
- return 0;
-}
-
-static int
-string_to_bool (const char *string, int *pval)
-{
- if (strcmp (string, "yes") == 0
- || strcmp (string, "true") == 0
- || strcmp (string, "t") == 0
- || strcmp (string, "1") == 0)
- *pval = 1;
- els