OSSP CVS Repository

ossp - Check-in [4974]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4974
Date: 2005-Jan-24 15:18:48 (local)
2005-Jan-24 14:18:48 (UTC)
User:rse
Branch:
Comment: 1. Fix va_list variable passing in cfg_fmt functions. 2. Add Autoconf support for va_copy() detection. 3. Accept new GNU Bison 2.0 as parser generator.
Tickets:
Inspections:
Files:
ossp-pkg/cfg/ChangeLog      added-> 1.31
ossp-pkg/cfg/aclocal.m4      1.6 -> 1.7     109 inserted, 0 deleted
ossp-pkg/cfg/cfg.ac      1.5 -> 1.6     3 inserted, 0 deleted
ossp-pkg/cfg/cfg_fmt.c      1.7 -> 1.8     4 inserted, 3 deleted
ossp-pkg/cfg/cfg_fmt.h      1.6 -> 1.7     1 inserted, 1 deleted
ossp-pkg/cfg/configure.ac      1.13 -> 1.14     1 inserted, 1 deleted

ossp-pkg/cfg/ChangeLog -> 1.31

*** /dev/null    Sat May  4 22:07:51 2024
--- -    Sat May  4 22:08:29 2024
***************
*** 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 <rse@engelschall.com>]
+ 
+    *) Add Autoconf support for va_copy() detection.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Accept new GNU Bison 2.0 as parser generator.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Adjust copyright messages for new year 2005.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+  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 <rse@engelschall.com>]
+ 
+  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 <rse@engelschall.com>]
+ 
+    *) Fix optional DMalloc build support.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) 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 <rse@engelschall.com>]
+ 
+    *) Fix annotational error reporting in scanner/parser.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Escape non-printable characters of input extracts in error messages.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Cleanup and extend buffer handling sub-library (cfg_buf.[ch])
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+  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 <rse@engelschall.com>]
+ 
+    *) Change cfg_node_root() API function to be able to both
+       set and/or get the root node.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) 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 <rse@engelschall.com>]
+ 
+    *) Accept zero-length strings for parsing. Correctly handle
+       end-of-file during plain text token scanning.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Do not let Flex generate the unused yyunput() and yy_top_state()
+       functions in order to shut up compilation warnings.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) 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 <rse@engelschall.com>]
+ 
+    *) Added initial cut for Perl bindings.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+  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 <rse@engelschall.com>]
+ 
+    *) Fixed warnings under GCC 3.4/3.5.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Adjust copyright messages for new year 2004.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) Upgraded build environment to GNU libtool 1.5.10
+       and GNU shtool 2.0.1
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+  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 <thomas@lotterer.net>]
+ 
+   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 <rse@engelschall.com>]
+ 
+   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 <thomas@lotterer.net>]
+ 
+    *) Enhanced test suite by comparing against previously saved output
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 
+    *) 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 <rse@engelschall.com>]
+ 
+    *) Source tree cleanups.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+ 


ossp-pkg/cfg/aclocal.m4 1.6 -> 1.7

--- 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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#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
+])
+


ossp-pkg/cfg/cfg.ac 1.5 -> 1.6

--- 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
 ])
 


ossp-pkg/cfg/cfg_fmt.c 1.7 -> 1.8

--- 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 <string.h>
 #include <ctype.h>
 
+#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;


ossp-pkg/cfg/cfg_fmt.h 1.6 -> 1.7

--- 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 */


ossp-pkg/cfg/configure.ac 1.13 -> 1.14

--- 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)

CVSTrac 2.0.1