diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-05 14:27:29 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-05 14:27:29 +0000 |
commit | 9a3a1f01b7bac115aa536b3b6062ab703b108c31 (patch) | |
tree | 0722221f2ec49283b46ee65bc20153a05c86455f /Build/source/texk/web2c/lib | |
parent | c1c0af52552e4b0c8a24acb36de9ca4705468da5 (diff) |
gftype: dynamic array allocation
git-svn-id: svn://tug.org/texlive/trunk@17332 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/Makefile.am | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/Makefile.in | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/lib.h | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/setupvar.c | 33 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 25 |
6 files changed, 51 insertions, 28 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 930d8218d8e..c7f6330451a 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,10 @@ +2010-03-05 Peter Breitenlohner <peb@mppmu.mpg.de> + + * texmfmp.c (setupboundvariable): Moved from here ... + * setupvar.c (new): ... to here for use in non-engine programs. + * lib.h (setupboundvariable): Moved from ../texmfmp.h to here. + * Makefile.am (lib_a_SOURCES): Added setupvar.c. + 2010-02-24 Peter Breitenlohner <peb@mppmu.mpg.de> * texmfmp.c (IPC) [WIN32]: #include <winsock2.h> instead of diff --git a/Build/source/texk/web2c/lib/Makefile.am b/Build/source/texk/web2c/lib/Makefile.am index f660f62e55d..2257fd1ad13 100644 --- a/Build/source/texk/web2c/lib/Makefile.am +++ b/Build/source/texk/web2c/lib/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/web2c/lib/ ## -## Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## INCLUDES = -I$(top_builddir)/.. -I$(top_srcdir) $(KPATHSEA_INCLUDES) @@ -25,6 +25,7 @@ lib_a_SOURCES = \ main.c \ openclose.c \ printversion.c \ + setupvar.c \ uexit.c \ usage.c \ version.c \ diff --git a/Build/source/texk/web2c/lib/Makefile.in b/Build/source/texk/web2c/lib/Makefile.in index f2ed27b07d1..4d9d1d52781 100644 --- a/Build/source/texk/web2c/lib/Makefile.in +++ b/Build/source/texk/web2c/lib/Makefile.in @@ -80,8 +80,9 @@ lib_a_LIBADD = am_lib_a_OBJECTS = basechsuffix.$(OBJEXT) chartostring.$(OBJEXT) \ coredump.$(OBJEXT) eofeoln.$(OBJEXT) fprintreal.$(OBJEXT) \ inputint.$(OBJEXT) input2int.$(OBJEXT) main.$(OBJEXT) \ - openclose.$(OBJEXT) printversion.$(OBJEXT) uexit.$(OBJEXT) \ - usage.$(OBJEXT) version.$(OBJEXT) zround.$(OBJEXT) + openclose.$(OBJEXT) printversion.$(OBJEXT) setupvar.$(OBJEXT) \ + uexit.$(OBJEXT) usage.$(OBJEXT) version.$(OBJEXT) \ + zround.$(OBJEXT) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp @@ -302,6 +303,7 @@ lib_a_SOURCES = \ main.c \ openclose.c \ printversion.c \ + setupvar.c \ uexit.c \ usage.c \ version.c \ @@ -366,6 +368,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openclose.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printversion.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupvar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uexit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ diff --git a/Build/source/texk/web2c/lib/lib.h b/Build/source/texk/web2c/lib/lib.h index 4c8bab85a68..a4ff3a7e8c4 100644 --- a/Build/source/texk/web2c/lib/lib.h +++ b/Build/source/texk/web2c/lib/lib.h @@ -52,6 +52,10 @@ extern void printversionandexit (const_string, const_string, const_string, char* extern const char *ptexbanner; #endif +/* setupvar.c */ +/* Set an array size from texmf.cnf. */ +extern void setupboundvariable (integer *, const_string, integer); + /* version.c */ extern const char *versionstring; diff --git a/Build/source/texk/web2c/lib/setupvar.c b/Build/source/texk/web2c/lib/setupvar.c new file mode 100644 index 00000000000..df0d43d79e9 --- /dev/null +++ b/Build/source/texk/web2c/lib/setupvar.c @@ -0,0 +1,33 @@ +/* setupvar.c: Look up a value in texmf.cnf or use default. + + Adapted in 2010 by Peter Breitenlohner. Public domain. + Written in 1995 by Karl Berry. Public domain. */ + +#include "config.h" +#include "lib.h" +#include <kpathsea/variable.h> + +/* Look up VAR_NAME in texmf.cnf; assign either the value found there or + DFLT to *VAR. */ + +void +setupboundvariable (integer *var, const_string var_name, integer dflt) +{ + string expansion = kpse_var_value (var_name); + *var = dflt; + + if (expansion) { + integer conf_val = atoi (expansion); + /* It's ok if the cnf file specifies 0 for extra_mem_{top,bot}, etc. + But negative numbers are always wrong. */ + if (conf_val < 0 || (conf_val == 0 && dflt > 0)) { + fprintf (stderr, + "%s: Bad value (%ld) in texmf.cnf for %s, keeping %ld.\n", + program_invocation_name, + (long) conf_val, var_name + 1, (long) dflt); + } else { + *var = conf_val; /* We'll make further checks later. */ + } + free (expansion); + } +} diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 13f60297a48..a1874356695 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -2215,31 +2215,6 @@ do_undump (char *p, int item_size, int nitems, FILE *in_file) #endif } -/* Look up VAR_NAME in texmf.cnf; assign either the value found there or - DFLT to *VAR. */ - -void -setupboundvariable (integer *var, const_string var_name, integer dflt) -{ - string expansion = kpse_var_value (var_name); - *var = dflt; - - if (expansion) { - integer conf_val = atoi (expansion); - /* It's ok if the cnf file specifies 0 for extra_mem_{top,bot}, etc. - But negative numbers are always wrong. */ - if (conf_val < 0 || (conf_val == 0 && dflt > 0)) { - fprintf (stderr, - "%s: Bad value (%ld) in texmf.cnf for %s, keeping %ld.\n", - program_invocation_name, - (long) conf_val, var_name + 1, (long) dflt); - } else { - *var = conf_val; /* We'll make further checks later. */ - } - free (expansion); - } -} - /* FIXME -- some (most?) of this can/should be moved to the Pascal/WEB side. */ #if defined(TeX) || defined(MF) #if !defined(pdfTeX) && !defined(luaTeX) |