Index: ossp-pkg/cfg/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/cfg/ChangeLog,v co -q -kk -p'1.31' '/v/ossp/cvs/ossp-pkg/cfg/ChangeLog,v' | diff -u /dev/null - -L'ossp-pkg/cfg/ChangeLog' 2>/dev/null --- ossp-pkg/cfg/ChangeLog +++ - 2024-05-18 14:19:44.943614904 +0200 @@ -0,0 +1,134 @@ + _ ___ ____ ____ ____ __ + |_|_ _ / _ \/ ___/ ___|| _ \ ___ / _| __ _ + _|_||_| | | | \___ \___ \| |_) | / __| |_ / _` | + |_||_|_| | |_| |___) |__) | __/ | (__| _| (_| | + |_|_|_| \___/|____/____/|_| \___|_| \__, | + |___/ + OSSP cfg - Configuration Parsing + + CHANGELOG + + Changes between 0.9.7 and 0.9.8 (19-Dec-2004 to 24-Jan-2005): + + *) Fix va_list variable passing in cfg_fmt functions. + [Ralf S. Engelschall ] + + *) Add Autoconf support for va_copy() detection. + [Ralf S. Engelschall ] + + *) Accept new GNU Bison 2.0 as parser generator. + [Ralf S. Engelschall ] + + *) Adjust copyright messages for new year 2005. + [Ralf S. Engelschall ] + + Changes between 0.9.6 and 0.9.7 (04-Dec-2004 to 19-Dec-2004): + + *) Fixed cfg_node_get() function after recent introduction + of LOAN/GIFT/COPY argument passing semantics. This + inbreaks the Perl API's unpack() function. + [Ralf S. Engelschall ] + + Changes between 0.9.5 and 0.9.6 (27-Nov-2004 to 04-Dec-2004): + + *) Plug remaining memory leaks by introducing the usual + LOAN/GIFT/COPY argument passing semantics to cfg_node_{set,get} + and using this to directly pass the allocated tokens from the + scanner through the parser into the node tree. + [Ralf S. Engelschall ] + + *) Fix optional DMalloc build support. + [Ralf S. Engelschall ] + + *) Replace fixed-size token buffer in scanner by a dynamic + buffer (cfg_buf_t). This eliminates the old 1024 size limit + on tokens and makes the scanner more robust. + [Ralf S. Engelschall ] + + *) Fix annotational error reporting in scanner/parser. + [Ralf S. Engelschall ] + + *) Escape non-printable characters of input extracts in error messages. + [Ralf S. Engelschall ] + + *) Cleanup and extend buffer handling sub-library (cfg_buf.[ch]) + [Ralf S. Engelschall ] + + Changes between 0.9.4 and 0.9.5 (31-Oct-2004 to 27-Nov-2004): + + *) Add OSSP:::cfg::simple Perl convenience API which is an + ultra high-level API allowing especially the bi-directional + conversion between the C API node tree representation and a + simplified Perl data structure representation. + [Ralf S. Engelschall ] + + *) Change cfg_node_root() API function to be able to both + set and/or get the root node. + [Ralf S. Engelschall ] + + *) Fixed cfg_test program by correctly passing the used number of + bytes in the buffer instead of the size of the buffer. + [Ralf S. Engelschall ] + + *) Accept zero-length strings for parsing. Correctly handle + end-of-file during plain text token scanning. + [Ralf S. Engelschall ] + + *) Do not let Flex generate the unused yyunput() and yy_top_state() + functions in order to shut up compilation warnings. + [Ralf S. Engelschall ] + + *) Return an empty string instead of NULL from internal + cfg_buf_content() function to not make visible to the caller the + implementation special case of an initial buffer. + [Ralf S. Engelschall ] + + *) Added initial cut for Perl bindings. + [Ralf S. Engelschall ] + + Changes between 0.9.3 and 0.9.4 (23-Apr-2003 to 31-Oct-2004): + + *) Upgrade to GNU bison 1.875d and GNU flex 2.5.31 + [Ralf S. Engelschall ] + + *) Fixed warnings under GCC 3.4/3.5. + [Ralf S. Engelschall ] + + *) Adjust copyright messages for new year 2004. + [Ralf S. Engelschall ] + + *) Upgraded build environment to GNU libtool 1.5.10 + and GNU shtool 2.0.1 + [Ralf S. Engelschall ] + + Changes between 0.9.2 and 0.9.3 (10-Nov-2003 to 23-Apr-2004): + + *) Import change introduced in OSSP l2 0.9.7: + Replace modf(3) calls in cfg_fmt.c with a hand-crafted + inlined cfg_fmt_modf() function to avoid dependency to external + libm on systems where modf(3) is not part of libc, i.e. Tru64 and + QNX. Reported by Karl Vogel. + [Thomas Lotterer ] + + Changes between 0.9.1 and 0.9.2 (10-Nov-2003 to 10-Nov-2003) + + *) Upgraded build environment to GNU libtool 1.5 and + GNU autoconf 2.58. + [Ralf S. Engelschall ] + + Changes between 0.9.0 and 0.9.1 (01-Jul-2002 to 10-Nov-2003) + + *) Added Bison-locations option to scanner, fixing the missing + reentrant "yylloc" with flex 2.5.31. Taken over from OSSP l2. + [Thomas Lotterer ] + + *) Enhanced test suite by comparing against previously saved output + [Ralf S. Engelschall ] + + *) Switch from text-based VERSION file to C-based cfg_vers.c + and use this to provide a cfg_version(3) API function. + [Ralf S. Engelschall ] + + *) Source tree cleanups. + [Ralf S. Engelschall ] + Index: ossp-pkg/cfg/aclocal.m4 RCS File: /v/ossp/cvs/ossp-pkg/cfg/aclocal.m4,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/cfg/aclocal.m4,v' 2>/dev/null --- aclocal.m4 2004/12/31 19:16:25 1.6 +++ aclocal.m4 2005/01/24 14:18:48 1.7 @@ -305,3 +305,112 @@ fi ]) +dnl ## +dnl ## Check for C99 va_copy() implementation +dnl ## (and provide fallback implementation if neccessary) +dnl ## +dnl ## configure.in: +dnl ## AC_CHECK_VA_COPY +dnl ## foo.c: +dnl ## #include "config.h" +dnl ## [...] +dnl ## va_copy(d,s) +dnl ## +dnl ## This check is rather complex: first because we really have to +dnl ## try various possible implementations in sequence and second, we +dnl ## cannot define a macro in config.h with parameters directly. +dnl ## + +dnl # test program for va_copy() implementation +changequote(<<,>>) +m4_define(__va_copy_test, <<[ +#include +#include +#include +#define DO_VA_COPY(d, s) $1 +void test(char *str, ...) +{ + va_list ap, ap2; + int i; + va_start(ap, str); + DO_VA_COPY(ap2, ap); + for (i = 1; i <= 9; i++) { + int k = (int)va_arg(ap, int); + if (k != i) + abort(); + } + DO_VA_COPY(ap, ap2); + for (i = 1; i <= 9; i++) { + int k = (int)va_arg(ap, int); + if (k != i) + abort(); + } + va_end(ap); +} +int main(int argc, char *argv[]) +{ + test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); + exit(0); +} +]>>) +changequote([,]) + +dnl # test driver for va_copy() implementation +m4_define(__va_copy_check, [ + AH_VERBATIM($1, +[/* Predefined possible va_copy() implementation (id: $1) */ +#define __VA_COPY_USE_$1(d, s) $2]) + if test ".$ac_cv_va_copy" = .; then + AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"]) + fi +]) + +dnl # Autoconf check for va_copy() implementation checking +AC_DEFUN(AC_CHECK_VA_COPY,[ + dnl # provide Autoconf display check message + AC_MSG_CHECKING(for va_copy() function) + dnl # check for various implementations in priorized sequence + AC_CACHE_VAL(ac_cv_va_copy, [ + ac_cv_va_copy="" + dnl # 1. check for standardized C99 macro + __va_copy_check(C99, [va_copy((d), (s))]) + dnl # 2. check for alternative/deprecated GCC macro + __va_copy_check(GCM, [VA_COPY((d), (s))]) + dnl # 3. check for internal GCC macro (high-level define) + __va_copy_check(GCH, [__va_copy((d), (s))]) + dnl # 4. check for internal GCC macro (built-in function) + __va_copy_check(GCB, [__builtin_va_copy((d), (s))]) + dnl # 5. check for assignment approach (assuming va_list is a struct) + __va_copy_check(ASS, [do { (d) = (s); } while (0)]) + dnl # 6. check for assignment approach (assuming va_list is a pointer) + __va_copy_check(ASP, [do { *(d) = *(s); } while (0)]) + dnl # 7. check for memory copying approach (assuming va_list is a struct) + __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))]) + dnl # 8. check for memory copying approach (assuming va_list is a pointer) + __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))]) + if test ".$ac_cv_va_copy" = .; then + AC_ERROR([no working implementation found]) + fi + ]) + dnl # optionally activate the fallback implementation + if test ".$ac_cv_va_copy" = ".C99"; then + AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)]) + fi + dnl # declare which fallback implementation to actually use + AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy], + [Define to id of used va_copy() implementation]) + dnl # provide activation hook for fallback implementation + AH_VERBATIM([__VA_COPY_ACTIVATION], +[/* Optional va_copy() implementation activation */ +#ifndef HAVE_VA_COPY +#define va_copy(d, s) __VA_COPY_USE(d, s) +#endif +]) + dnl # provide Autoconf display result message + if test ".$ac_cv_va_copy" = ".C99"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no (using fallback implementation)]) + fi +]) + Index: ossp-pkg/cfg/cfg.ac RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg.ac,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg.ac,v' 2>/dev/null --- cfg.ac 2004/12/31 19:16:25 1.5 +++ cfg.ac 2005/01/24 14:18:48 1.6 @@ -53,5 +53,8 @@ if test ".$ac_cv_with_perl" = ".yes" -a ".$PERL" = ".NA"; then AC_ERROR([required Perl interpreter not found in \$PATH]) fi + + dnl # additional checks + AC_CHECK_VA_COPY ]) Index: ossp-pkg/cfg/cfg_fmt.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.c,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.c,v' 2>/dev/null --- cfg_fmt.c 2004/12/31 19:16:25 1.7 +++ cfg_fmt.c 2005/01/24 14:18:48 1.8 @@ -97,6 +97,7 @@ #include #include +#include "config.h" #include "cfg_fmt.h" /* types which are locally use */ @@ -1040,7 +1041,7 @@ if (vbuff->format != NULL) { vbuff->format(vbuff, &prefix_char, &pad_char, &s, &s_len, - num_buf, NUM_BUF_SIZE, extinfo, *fmt, &ap); + num_buf, NUM_BUF_SIZE, extinfo, *fmt, ap); if (s == NULL) return -1; } @@ -1150,12 +1151,12 @@ char *s; int rv; - apbak = ap; + va_copy(apbak, ap); if ((rv = cfg_fmt_vsprintf(NULL, -1, fmt, ap)) == -1) return NULL; if ((s = malloc(rv+1)) == NULL) return NULL; - ap = apbak; + va_copy(ap, apbak); if ((rv = cfg_fmt_vsprintf(s, rv+1, fmt, ap)) == -1) return NULL; return s; Index: ossp-pkg/cfg/cfg_fmt.h RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.h,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.h,v' 2>/dev/null --- cfg_fmt.h 2004/12/31 19:16:25 1.6 +++ cfg_fmt.h 2005/01/24 14:18:48 1.7 @@ -52,7 +52,7 @@ int num_buf_size, /* input arg: temporary buffer len */ char *extinfo, /* input arg: extension information */ char fmt_char, /* input arg: current formatting character */ - va_list *ap /* in/out arg: variable argument pointer */ + va_list ap /* in/out arg: variable argument pointer */ ); /* arbitrary passed-through application data */ Index: ossp-pkg/cfg/configure.ac RCS File: /v/ossp/cvs/ossp-pkg/cfg/configure.ac,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/cfg/configure.ac,v' 2>/dev/null --- configure.ac 2004/12/31 19:16:25 1.13 +++ configure.ac 2005/01/24 14:18:48 1.14 @@ -41,7 +41,7 @@ sinclude(libtool.m4) AC_PROG_LIBTOOL -AC_CHECK_BISON(BISON, 1.875d, [1.[[8-9]][[0-9]]|1.[[8-9]][[0-9]][[0-9]]]) +AC_CHECK_BISON(BISON, 1.875d, [1.[[8-9]][[0-9]]|1.[[8-9]][[0-9]][[0-9]]]|[2.[[0-9]]]) AC_CHECK_FLEX(FLEX, 2.5.31, [2.5.1[[0-9]]|2.5.[[2-9]][[0-9]]|2.[[6-9]].*]) sinclude(cfg.ac)