diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-06-23 13:50:13 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-06-23 13:50:13 +0000 |
commit | d452c875cf2841085b8240e0a96d2b271f75eb4d (patch) | |
tree | aba6fc817184b18f7a19e6435e2037c5187d5fb3 /Build/source/texk | |
parent | 3b038424f28fe19e6570593aa7ef8b30758af6eb (diff) |
use ANSI C function definitions and prototypes
use <stdarg.h> instead of <kpathsea/c-vararg.h>
git-svn-id: svn://tug.org/texlive/trunk@13917 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 12 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.am | 24 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.in | 22 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/c-proto.h | 77 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/c-vararg.h | 61 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/concatn.c | 6 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/concatn.h | 6 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/kpathsea.h | 52 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.c | 42 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.h | 12 |
10 files changed, 85 insertions, 229 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 43071eb3504..fa7a280c85a 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,15 @@ +2009-06-23 Peter Breitenlohner <peb@mppmu.mpg.de> + + * concatn.[ch], tex-file.[ch]: use ANSI C function declarations + and prototypes instead of PVAR?[CH] macros. + #include <stdarg.h>, not #include <kpathsea/c-vararg.h>. + + * c-vararg.h (removed): no longer used. + * kpathsea.h (removed): no longer distributed. + * Makefile.am: remove c-vararg.h, rebuild kpathsea.h. + + * c-proto.h: assume HAVE_PROTOTYPES. + 2009-06-22 Peter Breitenlohner <peb@mppmu.mpg.de> * getopt.c (_getopt_internal): diff --git a/Build/source/texk/kpathsea/Makefile.am b/Build/source/texk/kpathsea/Makefile.am index 890ce706742..331db788168 100644 --- a/Build/source/texk/kpathsea/Makefile.am +++ b/Build/source/texk/kpathsea/Makefile.am @@ -86,7 +86,7 @@ if MINGW32 libkpathsea_la_SOURCES += mingw32.c endif MINGW32 -$(libkpathsea_la_SOURCES): paths.h +$(libkpathsea_la_OBJECTS): paths.h kpathsea.h EXTRA_DIST += \ putenv.c \ @@ -98,6 +98,7 @@ kpseincludedir = ${includedir}/kpathsea nodist_kpseinclude_HEADERS = \ c-auto.h \ + kpathsea.h \ paths.h kpseinclude_HEADERS = \ @@ -116,7 +117,6 @@ kpseinclude_HEADERS = \ c-stat.h \ c-std.h \ c-unistd.h \ - c-vararg.h \ cnf.h \ concatn.h \ config.h \ @@ -128,7 +128,6 @@ kpseinclude_HEADERS = \ fontmap.h \ getopt.h \ hash.h \ - kpathsea.h \ lib.h \ line.h \ magstep.h \ @@ -152,8 +151,6 @@ kpseinclude_HEADERS = \ xopendir.h \ xstat.h -$(kpseinclude_HEADERS): paths.h - ## First null out comments and leading/trailing whitespace, then remove ## lines that define invalid C identifiers, then remove blank lines and ## lines that define lowercase values (those are never path values). Each @@ -213,9 +210,20 @@ stamp-paths: texmf.cnf cp paths.tmp paths.h; \ fi rm -f paths.tmp - date >stamp-paths - -DISTCLEANFILES = paths.h stamp-paths + date >$@ + +kpathsea.h: paths.h + rm -f $@ + echo '/* This is a generated file */' >$@ + echo '/* collecting all kpathsea headers. */' >>$@ + echo '#include <kpathsea/config.h>' >>$@ + echo '#include <kpathsea/c-auto.h>' >>$@ + echo '#include <kpathsea/paths.h>' >>$@ + (cd $(srcdir) && ls -1 *.h) \ + | grep -v '\(config\|paths\|kpathsea\|mingw32\|win32lib\)\.h' \ + | sed -e 's,^,#include <kpathsea/,' -e s',$$,>,' >>$@ + +DISTCLEANFILES = paths.h stamp-paths kpathsea.h ## The programs bin_PROGRAMS = kpseaccess kpsereadlink kpsestat kpsewhich diff --git a/Build/source/texk/kpathsea/Makefile.in b/Build/source/texk/kpathsea/Makefile.in index e54a4579a00..7ed021875e4 100644 --- a/Build/source/texk/kpathsea/Makefile.in +++ b/Build/source/texk/kpathsea/Makefile.in @@ -374,6 +374,7 @@ libkpathsea_la_SOURCES = tex-file.c absolute.c atou.c cnf.c concat.c \ kpseincludedir = ${includedir}/kpathsea nodist_kpseinclude_HEADERS = \ c-auto.h \ + kpathsea.h \ paths.h kpseinclude_HEADERS = \ @@ -392,7 +393,6 @@ kpseinclude_HEADERS = \ c-stat.h \ c-std.h \ c-unistd.h \ - c-vararg.h \ cnf.h \ concatn.h \ config.h \ @@ -404,7 +404,6 @@ kpseinclude_HEADERS = \ fontmap.h \ getopt.h \ hash.h \ - kpathsea.h \ lib.h \ line.h \ magstep.h \ @@ -428,7 +427,7 @@ kpseinclude_HEADERS = \ xopendir.h \ xstat.h -DISTCLEANFILES = paths.h stamp-paths +DISTCLEANFILES = paths.h stamp-paths kpathsea.h kpseaccess_SOURCES = access.c kpsereadlink_SOURCES = readlink.c kpsewhich_LDADD = libkpathsea.la @@ -1636,9 +1635,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_web2cDATA \ uninstall-nodist_kpseincludeHEADERS -$(libkpathsea_la_SOURCES): paths.h - -$(kpseinclude_HEADERS): paths.h +$(libkpathsea_la_OBJECTS): paths.h kpathsea.h # # @@ -1670,7 +1667,18 @@ stamp-paths: texmf.cnf cp paths.tmp paths.h; \ fi rm -f paths.tmp - date >stamp-paths + date >$@ + +kpathsea.h: paths.h + rm -f $@ + echo '/* This is a generated file */' >$@ + echo '/* collecting all kpathsea headers. */' >>$@ + echo '#include <kpathsea/config.h>' >>$@ + echo '#include <kpathsea/c-auto.h>' >>$@ + echo '#include <kpathsea/paths.h>' >>$@ + (cd $(srcdir) && ls -1 *.h) \ + | grep -v '\(config\|paths\|kpathsea\|mingw32\|win32lib\)\.h' \ + | sed -e 's,^,#include <kpathsea/,' -e s',$$,>,' >>$@ install-exec-hook: @for f in $(dist_noinst_SCRIPTS); do \ diff --git a/Build/source/texk/kpathsea/c-proto.h b/Build/source/texk/kpathsea/c-proto.h index 05eb46794bb..9912a8fef92 100644 --- a/Build/source/texk/kpathsea/c-proto.h +++ b/Build/source/texk/kpathsea/c-proto.h @@ -34,7 +34,8 @@ definitions. Cf. <ansidecl.h> from the GNU C library. P1H(void) also works for definitions of routines which take no args. */ -#ifdef HAVE_PROTOTYPES +/* We now require that the compiler understands prototypes. We keep + these definitions until the macros are not used anymore. */ #define AA(args) args /* For an arbitrary number; ARGS must be in parens. */ @@ -103,78 +104,4 @@ (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, t6 n6, t7 n7, t8 n8, t9 n9, t10 n10, \ t11 n11, t12 n12, t13 n13, t14 n14, t15 n15, t16 n16, t17 n17) -#else /* not HAVE_PROTOTYPES */ - -#define AA(args) () - -#define P1H(p1) () -#define P2H(p1, p2) () -#define P3H(p1, p2, p3) () -#define P4H(p1, p2, p3, p4) () -#define P5H(p1, p2, p3, p4, p5) () -#define P6H(p1, p2, p3, p4, p5, p6) () -#define P7H(p1, p2, p3, p4, p5, p6, p7) () -#define P8H(p1, p2, p3, p4, p5, p6, p7, p8) () -#define P9H(p1, p2, p3, p4, p5, p6, p7, p8, p9) () -#define P10H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) () -#define P11H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) () -#define P12H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12) () -#define P13H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13) () -#define P14H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14) () -#define P15H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15) () -#define P16H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16) () -#define P17H(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17) () - -#define P1C(t1,n1) (n1) t1 n1; -#define P2C(t1,n1, t2,n2) (n1,n2) t1 n1; t2 n2; -#define P3C(t1,n1, t2,n2, t3,n3) (n1,n2,n3) t1 n1; t2 n2; t3 n3; -#define P4C(t1,n1, t2,n2, t3,n3, t4,n4) (n1,n2,n3,n4) \ - t1 n1; t2 n2; t3 n3; t4 n4; -#define P5C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5) (n1,n2,n3,n4,n5) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; -#define P6C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6) (n1,n2,n3,n4,n5,n6) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; -#define P7C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7) \ - (n1,n2,n3,n4,n5,n6,n7) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; -#define P8C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7, t8,n8) \ - (n1,n2,n3,n4,n5,n6,n7,n8) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; -#define P9C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7, t8,n8, t9,n9) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; -#define P10C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; -#define P11C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; -#define P12C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; -#define P13C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12,t13,n13) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; t13 n13; -#define P14C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12,t13,n13,t14,n14) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; t13 n13; t14 n14; -#define P15C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12,t13,n13,t14,n14,t15,n15) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; t13 n13; t14 n14; t15 n15; -#define P16C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12,t13,n13,t14,n14,t15,n15,t16,n16) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; t13 n13; t14 n14; t15 n15; t16 n16; -#define P17C(t1,n1,t2,n2,t3,n3,t4,n4,t5,n5,t6,n6,t7,n7,t8,n8,t9,n9,t10,n10,t11,n11,t12,n12,t13,n13,t14,n14,t15,n15,t16,n16,t17,n17) \ - (n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7; t8 n8; t9 n9; t10 n10; \ - t11 n11; t12 n12; t13 n13; t14 n14; t15 n15; t16 n16; t17 n17; - -#endif /* not HAVE_PROTOTYPES */ - #endif /* not KPATHSEA_C_PROTO_H */ diff --git a/Build/source/texk/kpathsea/c-vararg.h b/Build/source/texk/kpathsea/c-vararg.h deleted file mode 100644 index c704795193b..00000000000 --- a/Build/source/texk/kpathsea/c-vararg.h +++ /dev/null @@ -1,61 +0,0 @@ -/* c-vararg.h: top layer for stdarg and varargs. - - Copyright 1993, 2008 Karl Berry. - Copyright 1998, 2005 Olaf Weber. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. */ - -#ifndef C_VARARG_H -#define C_VARARG_H - -/* See function `init_path' in `kpathsea/tex-file.c' for an example of use. - The idea is to say PVAR1C(type1, parameter1, ap) in the function header, - and then end the function with two }}'s. We do this to avoid having to - specify the argument list (with types) twice -- once in the function - header, and once in a (hypothetical) VA_START1. */ - -#ifdef HAVE_PROTOTYPES -#include <stdarg.h> - -#define PVAR1H(p1) (p1, ...) -#define PVAR2H(p1, p2) (p1, p2, ...) -#define PVAR3H(p1, p2, p3) (p1, p2, p3, ...) - -#define PVAR1C(t1, n1, ap) \ - (t1 n1, ...) { va_list ap; va_start (ap, n1); -#define PVAR2C(t1, n1, t2, n2, ap) \ - (t1 n1, t2 n2, ...) { va_list ap; va_start (ap, n2); -#define PVAR3C(t1, n1, t2, n2, t3, n3, ap) \ - (t1 n1, t2 n2, t3 n3, ...) { va_list ap; va_start (ap, n3); - -#else /* not HAVE_PROTOTYPES */ -#include <varargs.h> - -#define PVAR1H(p1) () -#define PVAR2H(p1, p2) () -#define PVAR3H(p1, p2, p3) () - -#define PVAR1C(t1, n1, ap) \ - (va_alist) va_dcl { t1 n1; va_list ap; va_start (ap); \ - n1 = va_arg (ap, t1); -#define PVAR2C(t1, n1, t2, n2, ap) \ - (va_alist) va_dcl { t1 n1; t2 n2; va_list ap; va_start (ap); \ - n1 = va_arg (ap, t1); n2 = va_arg (ap, t2); -#define PVAR3C(t1, n1, t2, n2, t3, n3, ap) \ - (va_alist) va_dcl { t1 n1; t2 n2; t3 n3; va_list ap; va_start (ap); \ - n1 = va_arg (ap, t1); n2 = va_arg (ap, t2); \ - n3 = va_arg (ap, t3); -#endif /* not HAVE_PROTOTYPES */ - -#endif /* not C_VARARG_H */ diff --git a/Build/source/texk/kpathsea/concatn.c b/Build/source/texk/kpathsea/concatn.c index 216eedfdf7d..eebce152711 100644 --- a/Build/source/texk/kpathsea/concatn.c +++ b/Build/source/texk/kpathsea/concatn.c @@ -25,16 +25,18 @@ and then do the copying ourselves, but I doubt it matters in reality. */ string -concatn PVAR1C(const_string, str1, ap) +concatn (const_string str1, ...) { string arg; string ret; + va_list ap; if (!str1) return NULL; ret = xstrdup (str1); + va_start (ap, str1); while ((arg = va_arg (ap, string)) != NULL) { string temp = concat (ret, arg); @@ -44,7 +46,7 @@ concatn PVAR1C(const_string, str1, ap) va_end (ap); return ret; -}} +} #ifdef TEST int diff --git a/Build/source/texk/kpathsea/concatn.h b/Build/source/texk/kpathsea/concatn.h index b35ce53b7a5..6785cdb492f 100644 --- a/Build/source/texk/kpathsea/concatn.h +++ b/Build/source/texk/kpathsea/concatn.h @@ -1,6 +1,6 @@ /* concatn.h: concatenate a variable number of strings. This is a separate include file only because I don't see the point of - having every source file include <c-vararg.h>. The declarations for + having every source file include <stdarg.h>. The declarations for the other concat routines are in lib.h. Copyright 1993, 1996, 2008 Karl Berry. @@ -23,11 +23,11 @@ #define KPATHSEA_CONCATN_H #include <kpathsea/c-proto.h> -#include <kpathsea/c-vararg.h> +#include <stdarg.h> #include <kpathsea/types.h> /* Concatenate a null-terminated list of strings and return the result in malloc-allocated memory. */ -extern KPSEDLL string concatn PVAR1H(const_string str1); +extern KPSEDLL string concatn(const_string str1, ...); #endif /* not KPATHSEA_CONCATN_H */ diff --git a/Build/source/texk/kpathsea/kpathsea.h b/Build/source/texk/kpathsea/kpathsea.h deleted file mode 100644 index c8189440253..00000000000 --- a/Build/source/texk/kpathsea/kpathsea.h +++ /dev/null @@ -1,52 +0,0 @@ -/* This is a generated file */ -/* collecting all kpathsea headers. */ -#include <kpathsea/config.h> -#include <kpathsea/absolute.h> -#include <kpathsea/c-auto.h> -#include <kpathsea/c-ctype.h> -#include <kpathsea/c-dir.h> -#include <kpathsea/c-errno.h> -#include <kpathsea/c-fopen.h> -#include <kpathsea/c-limits.h> -#include <kpathsea/c-memstr.h> -#include <kpathsea/c-minmax.h> -#include <kpathsea/c-namemx.h> -#include <kpathsea/c-pathch.h> -#include <kpathsea/c-pathmx.h> -#include <kpathsea/c-proto.h> -#include <kpathsea/c-stat.h> -#include <kpathsea/c-std.h> -#include <kpathsea/c-unistd.h> -#include <kpathsea/c-vararg.h> -#include <kpathsea/cnf.h> -#include <kpathsea/concatn.h> -#include <kpathsea/db.h> -#include <kpathsea/debug.h> -#include <kpathsea/default.h> -#include <kpathsea/expand.h> -#include <kpathsea/fn.h> -#include <kpathsea/fontmap.h> -#include <kpathsea/getopt.h> -#include <kpathsea/hash.h> -#include <kpathsea/lib.h> -#include <kpathsea/line.h> -#include <kpathsea/magstep.h> -#include <kpathsea/paths.h> -#include <kpathsea/pathsearch.h> -#include <kpathsea/proginit.h> -#include <kpathsea/progname.h> -#include <kpathsea/readable.h> -#include <kpathsea/recorder.h> -#include <kpathsea/str-list.h> -#include <kpathsea/str-llist.h> -#include <kpathsea/systypes.h> -#include <kpathsea/tex-file.h> -#include <kpathsea/tex-glyph.h> -#include <kpathsea/tex-hush.h> -#include <kpathsea/tex-make.h> -#include <kpathsea/tilde.h> -#include <kpathsea/truncate.h> -#include <kpathsea/types.h> -#include <kpathsea/variable.h> -#include <kpathsea/xopendir.h> -#include <kpathsea/xstat.h> diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 56933985616..1b9ec284f4a 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -20,7 +20,7 @@ #include <kpathsea/c-fopen.h> #include <kpathsea/c-pathch.h> -#include <kpathsea/c-vararg.h> +#include <stdarg.h> #include <kpathsea/cnf.h> #include <kpathsea/concatn.h> #include <kpathsea/default.h> @@ -236,18 +236,20 @@ kpse_maketex_option (const_string fmtname, boolean value) `client_path' member must already be set upon entry. */ static void -init_path PVAR3C(kpathsea, kpse, kpse_format_info_type *, info, const_string, default_path, ap) +init_path (kpathsea kpse, kpse_format_info_type *info, const_string default_path, ...) { string env_name; string env_value = NULL; string var = NULL; + va_list ap; info->default_path = default_path; + va_start (ap, default_path); /* First envvar that's set to a nonempty value will exit the loop. If none are set, we want the first cnf entry that matches. Find the cnf value simultaneously with the envvar value, to avoid having to - go through the envvar list twice -- because of the PVAR?C macro, + go through the envvar list twice, that would mean having to create a str_list and use it twice. */ while ((env_name = va_arg (ap, string)) != NULL) { /* Since sh doesn't like envvar names with `.', check PATH_prog @@ -313,19 +315,20 @@ init_path PVAR3C(kpathsea, kpse, kpse_format_info_type *, info, const_string, de EXPAND_DEFAULT (info->override_path, "application override variable"); info->path = kpathsea_brace_expand (kpse, info->path); -}} +} /* Some file types have more than one suffix, and sometimes it is convenient to modify the list of searched suffixes. */ void -kpathsea_set_suffixes PVAR3C(kpathsea, kpse, kpse_file_format_type, format, - boolean, alternate, ap) +kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format, + boolean alternate, ...) { const_string **list; const_string s; int count = 0; + va_list ap; if (alternate) { list = &(kpse->format_info[format].alt_suffix); @@ -333,6 +336,7 @@ kpathsea_set_suffixes PVAR3C(kpathsea, kpse, kpse_file_format_type, format, list = &(kpse->format_info[format].suffix); } + va_start (ap, alternate); while ((s = va_arg (ap, string)) != NULL) { count++; XRETALLOC (*list, count + 1, const_string); @@ -340,16 +344,19 @@ kpathsea_set_suffixes PVAR3C(kpathsea, kpse, kpse_file_format_type, format, } va_end (ap); (*list)[count] = NULL; -}} +} #if defined (KPSE_COMPAT_API) void -kpse_set_suffixes PVAR2C(kpse_file_format_type, format, - boolean, alternate, ap) +kpse_set_suffixes (kpse_file_format_type format, + boolean alternate, ...) { - kpathsea_set_suffixes (kpse_def, format, alternate, ap); -}} + va_list ap; + va_start (ap, alternate); + kpathsea_set_suffixes (kpse_def, format, alternate, ap); + va_end (ap); +} #endif @@ -374,13 +381,14 @@ kpse_set_suffixes PVAR2C(kpse_file_format_type, format, name to 0 or 1. */ static void -init_maketex PVAR3C(kpathsea, kpse, kpse_file_format_type, fmt, const_string, dflt_prog, ap) +init_maketex (kpathsea kpse, kpse_file_format_type fmt, const_string dflt_prog, ...) { kpse_format_info_type *f = &(kpse->format_info[fmt]); const_string prog = f->program ? f->program : dflt_prog; /* mktexpk */ string PROG = uppercasify (prog); /* MKTEXPK */ string progval = kpathsea_var_value (kpse, PROG); /* ENV/cnf{"MKTEXPK"} */ const_string arg; + va_list ap; /* Doesn't hurt to always set this info. */ f->program = prog; @@ -389,11 +397,13 @@ init_maketex PVAR3C(kpathsea, kpse, kpse_file_format_type, fmt, const_string, d f->argc = 0; f->argv = XTALLOC(2, const_string); f->argv[f->argc++] = dflt_prog; + va_start (ap, dflt_prog); while ((arg = va_arg (ap, string)) != NULL) { f->argc++; XRETALLOC (f->argv, f->argc + 1, const_string); f->argv[f->argc - 1] = arg; } + va_end (ap); f->argv[f->argc] = NULL; if (progval && *progval) { @@ -403,7 +413,7 @@ init_maketex PVAR3C(kpathsea, kpse, kpse_file_format_type, fmt, const_string, d } free (PROG); -}} +} /* We need this twice, so ... */ #define MKTEXPK_ARGS \ @@ -436,16 +446,18 @@ remove_dbonly (const_string path) for nice debugging output. But it's useful. */ static string -concatn_with_spaces PVAR1C(const_string, str1, ap) +concatn_with_spaces (const_string str1, ...) { string arg; string ret; + va_list ap; if (!str1) return NULL; ret = xstrdup (str1); + va_start (ap, str1); while ((arg = va_arg (ap, string)) != NULL) { string temp = concat3 (ret, " ", arg); @@ -455,7 +467,7 @@ concatn_with_spaces PVAR1C(const_string, str1, ap) va_end (ap); return ret; -}} +} /* Initialize everything for FORMAT. */ diff --git a/Build/source/texk/kpathsea/tex-file.h b/Build/source/texk/kpathsea/tex-file.h index 7ced22fee23..a99d049fd10 100644 --- a/Build/source/texk/kpathsea/tex-file.h +++ b/Build/source/texk/kpathsea/tex-file.h @@ -20,7 +20,7 @@ #define KPATHSEA_TEX_FILE_H #include <kpathsea/c-proto.h> -#include <kpathsea/c-vararg.h> +#include <stdarg.h> #include <kpathsea/types.h> @@ -41,9 +41,9 @@ extern KPSEDLL void kpathsea_maketex_option (kpathsea kpse, const_string fmtname /* Change the list of searched suffixes (alternate suffixes if alternate is true). */ -extern KPSEDLL void kpathsea_set_suffixes PVAR3H(kpathsea kpse, - kpse_file_format_type format, - boolean alternate); +extern KPSEDLL void kpathsea_set_suffixes (kpathsea kpse, + kpse_file_format_type format, + boolean alternate, ...); /* Initialize the info for the given format. This is called automatically by `kpse_find_file', but the glyph searching (for @@ -83,8 +83,8 @@ extern KPSEDLL void kpse_set_program_enabled (kpse_file_format_type fmt, extern KPSEDLL void kpse_maketex_option (const_string fmtname, boolean value); -extern KPSEDLL void kpse_set_suffixes PVAR2H(kpse_file_format_type format, - boolean alternate); +extern KPSEDLL void kpse_set_suffixes (kpse_file_format_type format, + boolean alternate, ...); extern KPSEDLL const_string kpse_init_format (kpse_file_format_type); |