From 65c37b17f39210ff32ba3ec1415d5f5a3f8e86ff Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 25 Jan 2010 12:30:04 +0000 Subject: texk/web2c/luatexdir: compiler warnings git-svn-id: svn://tug.org/texlive/trunk@16817 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ChangeLog | 4 + Build/source/texk/web2c/Makefile.in | 166 +++++++-------------- Build/source/texk/web2c/lib/ChangeLog | 10 ++ Build/source/texk/web2c/lib/texmfmp.c | 18 ++- Build/source/texk/web2c/luatexdir/ChangeLog | 89 +++++++++++ Build/source/texk/web2c/luatexdir/am/libluatex.am | 7 +- Build/source/texk/web2c/luatexdir/am/luatex.am | 4 +- Build/source/texk/web2c/luatexdir/font/dofont.c | 8 +- Build/source/texk/web2c/luatexdir/font/luafont.c | 69 +++++---- .../source/texk/web2c/luatexdir/font/luatexfont.h | 4 +- Build/source/texk/web2c/luatexdir/font/macnames.c | 2 +- Build/source/texk/web2c/luatexdir/font/mapfile.c | 14 +- Build/source/texk/web2c/luatexdir/font/texfont.c | 33 ++-- Build/source/texk/web2c/luatexdir/font/texfont.h | 10 +- Build/source/texk/web2c/luatexdir/font/tfmofm.c | 4 +- Build/source/texk/web2c/luatexdir/font/tt_glyf.c | 6 +- Build/source/texk/web2c/luatexdir/font/vfovf.c | 15 +- Build/source/texk/web2c/luatexdir/font/vfpacket.c | 4 +- Build/source/texk/web2c/luatexdir/font/writecff.c | 16 +- Build/source/texk/web2c/luatexdir/font/writecff.h | 6 +- Build/source/texk/web2c/luatexdir/font/writeenc.c | 15 +- Build/source/texk/web2c/luatexdir/font/writefont.c | 36 ++--- Build/source/texk/web2c/luatexdir/font/writet1.c | 20 +-- Build/source/texk/web2c/luatexdir/font/writettf.c | 6 +- .../source/texk/web2c/luatexdir/font/writetype2.c | 2 +- Build/source/texk/web2c/luatexdir/hyphen.h | 2 +- Build/source/texk/web2c/luatexdir/image/epdf.c | 1 + Build/source/texk/web2c/luatexdir/image/epdf.h | 5 +- Build/source/texk/web2c/luatexdir/image/writeimg.c | 14 +- Build/source/texk/web2c/luatexdir/image/writeimg.h | 4 +- .../source/texk/web2c/luatexdir/image/writejbig2.c | 6 +- .../source/texk/web2c/luatexdir/image/writejbig2.h | 2 +- Build/source/texk/web2c/luatexdir/image/writejpg.c | 1 + Build/source/texk/web2c/luatexdir/image/writepng.c | 1 + Build/source/texk/web2c/luatexdir/inc-epdf.h | 8 + Build/source/texk/web2c/luatexdir/inc-vfovf.h | 2 + Build/source/texk/web2c/luatexdir/lang/hnjalloc.c | 2 + Build/source/texk/web2c/luatexdir/lang/hyphen.c | 20 +-- Build/source/texk/web2c/luatexdir/lang/texlang.c | 47 +++--- .../source/texk/web2c/luatexdir/lua/lcallbacklib.c | 34 ++--- Build/source/texk/web2c/luatexdir/lua/lfontlib.c | 12 +- Build/source/texk/web2c/luatexdir/lua/limglib.c | 22 +-- Build/source/texk/web2c/luatexdir/lua/lkpselib.c | 10 +- Build/source/texk/web2c/luatexdir/lua/llanglib.c | 6 +- Build/source/texk/web2c/luatexdir/lua/llualib.c | 22 ++- Build/source/texk/web2c/luatexdir/lua/lnodelib.c | 38 ++--- Build/source/texk/web2c/luatexdir/lua/loslibext.c | 31 ++-- Build/source/texk/web2c/luatexdir/lua/lpdflib.c | 8 +- Build/source/texk/web2c/luatexdir/lua/lstatslib.c | 18 +-- Build/source/texk/web2c/luatexdir/lua/ltexiolib.c | 12 +- Build/source/texk/web2c/luatexdir/lua/ltexlib.c | 113 +++++++------- Build/source/texk/web2c/luatexdir/lua/ltokenlib.c | 16 +- Build/source/texk/web2c/luatexdir/lua/luainit.c | 35 +++-- Build/source/texk/web2c/luatexdir/lua/luanode.c | 14 +- Build/source/texk/web2c/luatexdir/lua/luastuff.c | 14 +- Build/source/texk/web2c/luatexdir/lua/luatex.c | 2 +- Build/source/texk/web2c/luatexdir/lua/luatoken.c | 14 +- Build/source/texk/web2c/luatexdir/lua/texluac.c | 2 + Build/source/texk/web2c/luatexdir/luatex-api.h | 16 +- Build/source/texk/web2c/luatexdir/luatex.ch | 8 +- Build/source/texk/web2c/luatexdir/luatex.h | 16 +- Build/source/texk/web2c/luatexdir/mathcodes.c | 20 +-- Build/source/texk/web2c/luatexdir/nodes.h | 4 +- Build/source/texk/web2c/luatexdir/pdf/pagetree.c | 8 +- Build/source/texk/web2c/luatexdir/pdf/pagetree.h | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfpage.c | 8 +- Build/source/texk/web2c/luatexdir/pdf/pdfpage.h | 6 +- Build/source/texk/web2c/luatexdir/primitive.h | 2 +- Build/source/texk/web2c/luatexdir/ptexlib.h | 42 +++--- Build/source/texk/web2c/luatexdir/tex/filename.c | 4 +- Build/source/texk/web2c/luatexdir/tex/linebreak.c | 14 +- Build/source/texk/web2c/luatexdir/tex/math.c | 58 +++---- Build/source/texk/web2c/luatexdir/tex/mlist.c | 96 ++++++------ Build/source/texk/web2c/luatexdir/tex/primitive.c | 14 +- Build/source/texk/web2c/luatexdir/tex/texdeffont.c | 8 +- Build/source/texk/web2c/luatexdir/tex/texnodes.c | 156 +++++++++---------- Build/source/texk/web2c/luatexdir/tex/textoken.c | 28 ++-- Build/source/texk/web2c/luatexdir/textcodes.c | 4 +- Build/source/texk/web2c/luatexdir/utils/avl.c | 6 +- Build/source/texk/web2c/luatexdir/utils/avlstuff.c | 2 +- Build/source/texk/web2c/luatexdir/utils/avlstuff.h | 2 +- Build/source/texk/web2c/luatexdir/utils/synctex.c | 8 +- Build/source/texk/web2c/luatexdir/utils/utils.c | 49 +++--- Build/source/texk/web2c/luatexdir/utils/utils.h | 32 ++-- Build/source/texk/web2c/mplibdir/ChangeLog | 8 + Build/source/texk/web2c/mplibdir/lmplib.c | 22 +-- Build/source/texk/web2c/mplibdir/mp.w | 8 +- Build/source/texk/web2c/synctexdir/ChangeLog | 4 +- Build/source/texk/web2c/texmfmp.h | 4 +- 89 files changed, 935 insertions(+), 830 deletions(-) create mode 100644 Build/source/texk/web2c/luatexdir/inc-epdf.h create mode 100644 Build/source/texk/web2c/luatexdir/inc-vfovf.h (limited to 'Build/source/texk') diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index c2fefdd938d..aa07d56040c 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,7 @@ +2010-01-24 Peter Breitenlohner + + * texmfmp.h (mk_shellcmdlist): Declare string param as const. + 2010-01-22 Peter Breitenlohner * dvitype.ch (open_dvi_file): Skip use of cur_name. diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index bc97eee3388..af4fa10ae24 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -1620,8 +1620,8 @@ luatex_CPPFLAGS = $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(XPDF_INCLUDES) \ $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 -Iluatexdir \ -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 \ -I$(srcdir)/mplibdir -Dextra_version_info=`date +-%Y%m%d%H` -luatex_CFLAGS = # $(WARNING_CFLAGS) -luatex_CXXFLAGS = # $(WARNING_CXXFLAGS) +luatex_CFLAGS = $(WARNING_CFLAGS) +luatex_CXXFLAGS = $(WARNING_CXXFLAGS) luatex_ldadd = libluatex.a libff.a libluamisc.a libzzip.a \ libluasocket.a liblua51.a $(LIBPNG_LIBS) $(ZLIB_LIBS) \ $(XPDF_LIBS) $(OBSDCOMPAT_LIBS) libmd5.a libmplib.a @@ -1912,115 +1912,61 @@ libluatex_a_CPPFLAGS = $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) \ $(XPDF_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 \ -Iluatexdir -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 \ -DpdfTeX -libluatex_a_CFLAGS = # $(WARNING_CFLAGS) +libluatex_a_CFLAGS = $(WARNING_CFLAGS) libluatex_a_CXXFLAGS = # $(WARNING_CXXFLAGS) -libluatex_a_SOURCES = \ - luatexdir/commands.h \ - luatexdir/font/dofont.c \ - luatexdir/font/luatexfont.h \ - luatexdir/font/luafont.c \ - luatexdir/font/mapfile.c \ - luatexdir/font/mapfile.h \ - luatexdir/font/pkin.c \ - luatexdir/font/sfnt.c \ - luatexdir/font/sfnt.h \ - luatexdir/font/subfont.c \ - luatexdir/font/texfont.c \ - luatexdir/font/texfont.h \ - luatexdir/font/tfmofm.c \ - luatexdir/font/tounicode.c \ - luatexdir/font/tt_glyf.c \ - luatexdir/font/tt_glyf.h \ - luatexdir/font/tt_table.c \ - luatexdir/font/tt_table.h \ - luatexdir/font/vfovf.c \ - luatexdir/font/vfpacket.c \ - luatexdir/font/writecff.c \ - luatexdir/font/writecff.h \ - luatexdir/font/writeenc.c \ - luatexdir/font/writefont.c \ - luatexdir/font/writet1.c \ - luatexdir/font/writet3.c \ - luatexdir/font/writettf.c \ - luatexdir/font/writettf.h \ - luatexdir/font/writetype0.c \ - luatexdir/font/writetype2.c \ - luatexdir/get_svnversion.sh \ - luatexdir/hyphen.h \ - luatexdir/image/epdf.c \ - luatexdir/image/epdf.h \ - luatexdir/image/image.h \ - luatexdir/image/pdftoepdf.cc \ - luatexdir/image/pdftoepdf.h \ - luatexdir/image/writeimg.c \ - luatexdir/image/writeimg.h \ - luatexdir/image/writejbig2.c \ - luatexdir/image/writejbig2.h \ - luatexdir/image/writejpg.c \ - luatexdir/image/writejpg.h \ - luatexdir/image/writepng.c \ - luatexdir/image/writepng.h \ - luatexdir/lang/hnjalloc.c \ - luatexdir/lang/hnjalloc.h \ - luatexdir/lang/hyphen.c \ - luatexdir/lang/texlang.c \ - luatexdir/lua/lcallbacklib.c \ - luatexdir/lua/lfontlib.c \ - luatexdir/lua/limglib.c \ - luatexdir/lua/lkpselib.c \ - luatexdir/lua/llanglib.c \ - luatexdir/lua/llualib.c \ - luatexdir/lua/lnodelib.c \ - luatexdir/lua/loslibext.c \ - luatexdir/lua/liolib.c \ - luatexdir/lua/lpdflib.c \ - luatexdir/lua/lstatslib.c \ - luatexdir/lua/ltexiolib.c \ - luatexdir/lua/ltexlib.c \ - luatexdir/lua/ltokenlib.c \ - luatexdir/lua/luainit.c \ - luatexdir/lua/luanode.c \ - luatexdir/lua/luastuff.c \ - luatexdir/lua/luatex.c \ - luatexdir/lua/luatoken.c \ - luatexdir/lua/texluac.c \ - luatexdir/luatex-api.h \ - luatexdir/luatex.h \ - luatexdir/makecpool.c \ - luatexdir/managed-sa.c \ - luatexdir/managed-sa.h \ - luatexdir/mathcodes.c \ - luatexdir/nodes.h \ - luatexdir/pdf/pagetree.c \ - luatexdir/pdf/pagetree.h \ - luatexdir/pdf/pdfpage.c \ - luatexdir/pdf/pdfpage.h \ - luatexdir/primitive.h \ - luatexdir/ptexmac.h \ - luatexdir/tex/filename.c \ - luatexdir/tex/linebreak.c \ - luatexdir/tex/math.c \ - luatexdir/tex/mlist.c \ - luatexdir/tex/postlinebreak.c \ - luatexdir/tex/primitive.c \ - luatexdir/tex/texdeffont.c \ - luatexdir/tex/texnodes.c \ - luatexdir/tex/texpdf.c \ - luatexdir/tex/textoken.c \ - luatexdir/texmath.h \ - luatexdir/textcodes.c \ - luatexdir/tokens.h \ - luatexdir/utils/avl.c \ - luatexdir/utils/avl.h \ - luatexdir/utils/avlstuff.c \ - luatexdir/utils/avlstuff.h \ - luatexdir/utils/synctex.h \ - luatexdir/utils/synctex.c \ - luatexdir/utils/utils.c \ - luatexdir/utils/utils.h \ - luatexdir/utils/writezip.c \ - mplibdir/lmplib.c - +libluatex_a_SOURCES = luatexdir/commands.h luatexdir/font/dofont.c \ + luatexdir/font/luatexfont.h luatexdir/font/luafont.c \ + luatexdir/font/mapfile.c luatexdir/font/mapfile.h \ + luatexdir/font/pkin.c luatexdir/font/sfnt.c \ + luatexdir/font/sfnt.h luatexdir/font/subfont.c \ + luatexdir/font/texfont.c luatexdir/font/texfont.h \ + luatexdir/font/tfmofm.c luatexdir/font/tounicode.c \ + luatexdir/font/tt_glyf.c luatexdir/font/tt_glyf.h \ + luatexdir/font/tt_table.c luatexdir/font/tt_table.h \ + luatexdir/font/vfovf.c luatexdir/font/vfpacket.c \ + luatexdir/font/writecff.c luatexdir/font/writecff.h \ + luatexdir/font/writeenc.c luatexdir/font/writefont.c \ + luatexdir/font/writet1.c luatexdir/font/writet3.c \ + luatexdir/font/writettf.c luatexdir/font/writettf.h \ + luatexdir/font/writetype0.c luatexdir/font/writetype2.c \ + luatexdir/get_svnversion.sh luatexdir/hyphen.h \ + luatexdir/image/epdf.c luatexdir/image/epdf.h \ + luatexdir/image/image.h luatexdir/image/pdftoepdf.cc \ + luatexdir/image/pdftoepdf.h luatexdir/image/writeimg.c \ + luatexdir/image/writeimg.h luatexdir/image/writejbig2.c \ + luatexdir/image/writejbig2.h luatexdir/image/writejpg.c \ + luatexdir/image/writejpg.h luatexdir/image/writepng.c \ + luatexdir/image/writepng.h luatexdir/lang/hnjalloc.c \ + luatexdir/lang/hnjalloc.h luatexdir/lang/hyphen.c \ + luatexdir/lang/texlang.c luatexdir/lua/lcallbacklib.c \ + luatexdir/lua/lfontlib.c luatexdir/lua/limglib.c \ + luatexdir/lua/lkpselib.c luatexdir/lua/llanglib.c \ + luatexdir/lua/llualib.c luatexdir/lua/lnodelib.c \ + luatexdir/lua/loslibext.c luatexdir/lua/liolib.c \ + luatexdir/lua/lpdflib.c luatexdir/lua/lstatslib.c \ + luatexdir/lua/ltexiolib.c luatexdir/lua/ltexlib.c \ + luatexdir/lua/ltokenlib.c luatexdir/lua/luainit.c \ + luatexdir/lua/luanode.c luatexdir/lua/luastuff.c \ + luatexdir/lua/luatex.c luatexdir/lua/luatoken.c \ + luatexdir/lua/texluac.c luatexdir/luatex-api.h \ + luatexdir/luatex.h luatexdir/makecpool.c \ + luatexdir/managed-sa.c luatexdir/managed-sa.h \ + luatexdir/mathcodes.c luatexdir/nodes.h \ + luatexdir/pdf/pagetree.c luatexdir/pdf/pagetree.h \ + luatexdir/pdf/pdfpage.c luatexdir/pdf/pdfpage.h \ + luatexdir/primitive.h luatexdir/ptexmac.h \ + luatexdir/tex/filename.c luatexdir/tex/linebreak.c \ + luatexdir/tex/math.c luatexdir/tex/mlist.c \ + luatexdir/tex/postlinebreak.c luatexdir/tex/primitive.c \ + luatexdir/tex/texdeffont.c luatexdir/tex/texnodes.c \ + luatexdir/tex/texpdf.c luatexdir/tex/textoken.c \ + luatexdir/texmath.h luatexdir/textcodes.c luatexdir/tokens.h \ + luatexdir/utils/avl.c luatexdir/utils/avl.h \ + luatexdir/utils/avlstuff.c luatexdir/utils/avlstuff.h \ + luatexdir/utils/synctex.h luatexdir/utils/synctex.c \ + luatexdir/utils/utils.c luatexdir/utils/utils.h \ + luatexdir/utils/writezip.c mplibdir/lmplib.c \ + luatexdir/inc-epdf.h luatexdir/inc-vfovf.h EXTRA_libluatex_a_SOURCES = luatexdir/font/macnames.c # Force Automake to use CXXLD for linking diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 6f13ddd94db..bf3cfd722b9 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,13 @@ +2010-01-24 Peter Breitenlohner + + * texmfmp.c (mk_shellcmdlist): Declare string param as const. + +2010-01-22 Peter Breitenlohner + + * texmfmp.c (maininit) [__SyncTeX__]: omit warning about no + SyncTeX for luaTeX. + (gettexstring): Declare as static for luaTeX. + 2010-01-16 Karl Berry * texmfmp.c (do_dump, do_undump): give full name of file diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index bca3631909a..5b2468ead76 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -136,10 +136,11 @@ static char **cmdlist = NULL; void -mk_shellcmdlist (char *v) +mk_shellcmdlist (const char *v) { char **p; - char *q, *r; + const char *q, *r1; + char *r; int n; q = v; @@ -148,10 +149,10 @@ mk_shellcmdlist (char *v) /* analyze the variable shell_escape_commands = foo,bar,... spaces before and after (,) are not allowed. */ - while ((r = strchr (q, ',')) != 0) { + while ((r1 = strchr (q, ',')) != 0) { n++; - r++; - q = r; + r1++; + q = r1; } if (*q) n++; @@ -203,7 +204,7 @@ init_shell_escape (void) if (shellenabledp && restrictedshell == 1) { char *v2 = kpse_var_value ("shell_escape_commands"); if (v2) { - mk_shellcmdlist (v2); + mk_shellcmdlist ((const char *)v2); free (v2); } } @@ -616,7 +617,7 @@ maininit (int ac, string *av) synctexoption = SYNCTEX_NO_OPTION; #else # /* Omit warning for Aleph and non-TeX. */ -# if defined(TeX) && !defined(Aleph) +# if defined(TeX) && !defined(Aleph) && !defined(luaTeX) # warning SyncTeX: -synctex command line option NOT available # endif #endif @@ -2364,6 +2365,9 @@ gettexstring (strnumber s) #else +#ifdef luaTeX +static +#endif string gettexstring (strnumber s) { diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 2f666b8039c..1861a9af65e 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,92 @@ +2010-01-25 Peter Breitenlohner + + * am/luatex (luatex_CFLAGS, luatex_CXXFLAGS), + am/libluatex.am (libluatex_a_CFLAGS): Enable compiler warnings. + + Avoid most compiler warnings: + + * font/luatexfont.h, luatexdir/hyphen.h, image/writeimg.h, + image/writejbig2.h, luatex.h, pdf/pagetree.h, pdf/pdfpage.h, + utils/avlstuff.h, utils/utils.h: ANSI C function prototypes. + * font/mapfile.c, font/writeenc.c, font/writefont.c, + font/writet1.c, font/writettf.c, image/writeimg.c, + image/writejbig2.c, lang/hyphen.c, pdf/pagetree.c, + pdf/pdfpage.c, utils/avlstuff.c, utils/utils.c: ANSI C function + definitions. + + * font/luafont.c, lang/texlang.c, lua/lcallbacklib.c, + lua/lfontlib.c, lua/limglib.c, lua/lkpselib.c, lua/llualib.c, + lua/lnodelib.c, lua/loslibext.c, lua/lpdflib.c, lua/lstatslib.c, + lua/ltexiolib.c, lua/ltexlib.c, lua/ltokenlib.c, lua/luanode.c, + lua/luatoken.c: Remove 'char *' or 'unsigned char *' casts of + Lua strings. + + * font/texfont.h, font/writecff.h, luatex-api.h, luatex.h, + nodes.h, primitive.h, ptexlib.h, utils/utils.h, font/dofont.c, + font/luafont.c, font/tfmofm.c, font/vfovf.c, font/writecff.c, + font/writefont.c, font/writet1.c, lang/hyphen.c, lang/texlang.c, + lua/lcallbacklib.c, lua/lfontlib.c, lua/limglib.c, + lua/lkpselib.c, lua/llualib.c, lua/lnodelib.c, lua/loslibext.c, + lua/lpdflib.c, lua/lstatslib.c, lua/ltexiolib.c, lua/ltexlib.c, + lua/ltokenlib.c, lua/luainit.c, lua/luanode.c, lua/luastuff.c, + lua/luatex.c, lua/luatoken.c, luatex.ch, tex/filename.c, + tex/linebreak.c, tex/math.c, tex/mlist.c, tex/primitive.c, + tex/texdeffont.c, tex/texnodes.c, tex/textoken.c, utils/utils.c: + Declare various function params and args, local and global vars, + and struct members as const. + + * font/luafont.c, font/texfont.c, font/tfmofm.c, font/vfovf.c, + font/writeenc.c, font/writefont.c, font/writet1.c, + font/vfpacket.c, font/writettf.c, font/writetype2.c, + image/writeimg.c, lang/hyphen.c, lang/texlang.c, lua/limglib.c, + lua/llualib.c, lua/lnodelib.c, lua/loslibext.c, lua/lpdflib.c, + lua/lstatslib.c, lua/ltexlib.c, lua/luainit.c, lua/luanode.c, + lua/luastuff.c, mathcodes.c, tex/linebreak.c, tex/math.c, + tex/mlist.c, tex/primitive.c, tex/texdeffont.c, tex/texnodes.c, + tex/textoken.c, utils/synctex.c, utils/utils.c: + Declare functions and global vars as static. + + * font/texfont.c: #include "luatexfont.h" and remove externs. + * image/writejpg.c: #include "writejpg.h". + * image/writepng.c: #include "writepng.h". + * lang/hnjalloc.c: #include "hnjalloc.h". + * lua/texluac.c: #include "luatex-api.h". + * utils/synctex.c: #include "synctex.h". + * utils/utils.c: #include "utils.h". + + * ptexlib.h: Add prototype for get_command_id() ... + * lua/ltokenlib.c: ... removed from here. + * inc-epdf.h: New file with prototypes for epdf_mark_glyphs(), + epdf_create_fontdescriptor(), and epdf_write_enc() ... + * image/epdf.h: ... removed from here. + * image/epdf.h, font/writeenc.c: #include inc-epdf.h. + * inc-vfovf.h: New file with prototype for make_vf_table() ... + * lua/lfontlib.c: ... removed from here. + * font/vfovf.c, lua/lfontlib.c: #include inc-vfovf.h. + * am/libluatex.am (libluatex_a_SOURCES): Add the new files. + + * font/texfont.c (lua_char_exists_callback), + font/vfovf.c (is_letterspaced_font), + font/vfpacket.c (packet_command_names), + font/writet1.c (free_glyph_names), + image/writeimg.c (image_group_ref), + lua/ltexlib.c (get_something_internal), + tex/texnodes.c (print_free_chain), + textcodes.c (clearcatcodestack): + Skip unused static funcs and vars (via #if 0 ... #endif). + + * lua/luainit.c (lua_initialize): Replace string constant + arguments of putenv() by non-const static string variables. + + * utils/avl.c (avl_delete): Don't reuse const input param for + non-const return value. + + * utils/synctex.c: Rename synctexchar => synctex_char and + synctexnode => synctex_node as declared in utils/synctex.h. + + * font/luatexfont.h, font/macnames.c: Declare notdef as + non-const to avoid cast warnings. FIXME? + 2010-01-22 Peter Breitenlohner * luatangle.ch: Declare web_name, chg_name, pascal_name, and diff --git a/Build/source/texk/web2c/luatexdir/am/libluatex.am b/Build/source/texk/web2c/luatexdir/am/libluatex.am index 13a2fea4410..e582aa467a4 100644 --- a/Build/source/texk/web2c/luatexdir/am/libluatex.am +++ b/Build/source/texk/web2c/luatexdir/am/libluatex.am @@ -13,7 +13,7 @@ libluatex_a_CPPFLAGS = $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(XPDF_INCLUDES) libluatex_a_CPPFLAGS += $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 libluatex_a_CPPFLAGS += -Iluatexdir -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 libluatex_a_CPPFLAGS += -DpdfTeX -libluatex_a_CFLAGS = # $(WARNING_CFLAGS) +libluatex_a_CFLAGS = $(WARNING_CFLAGS) libluatex_a_CXXFLAGS = # $(WARNING_CXXFLAGS) libluatex_a_SOURCES = \ @@ -123,6 +123,11 @@ libluatex_a_SOURCES = \ luatexdir/utils/writezip.c \ mplibdir/lmplib.c +## FIXME: temporary additional headers: +libluatex_a_SOURCES += \ + luatexdir/inc-epdf.h \ + luatexdir/inc-vfovf.h + ## included by luatexdir/font/writettf.c EXTRA_libluatex_a_SOURCES = luatexdir/font/macnames.c diff --git a/Build/source/texk/web2c/luatexdir/am/luatex.am b/Build/source/texk/web2c/luatexdir/am/luatex.am index 19975de2574..a2e3522f25e 100644 --- a/Build/source/texk/web2c/luatexdir/am/luatex.am +++ b/Build/source/texk/web2c/luatexdir/am/luatex.am @@ -19,8 +19,8 @@ luatex_CPPFLAGS = $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(XPDF_INCLUDES) luatex_CPPFLAGS += $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 luatex_CPPFLAGS += -Iluatexdir -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 -I$(srcdir)/mplibdir luatex_CPPFLAGS += -Dextra_version_info=`date +-%Y%m%d%H` -luatex_CFLAGS = # $(WARNING_CFLAGS) -luatex_CXXFLAGS = # $(WARNING_CXXFLAGS) +luatex_CFLAGS = $(WARNING_CFLAGS) +luatex_CXXFLAGS = $(WARNING_CXXFLAGS) luatex_ldadd = libluatex.a libff.a libluamisc.a libzzip.a libluasocket.a liblua51.a luatex_ldadd += $(LIBPNG_LIBS) $(ZLIB_LIBS) $(XPDF_LIBS) diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.c b/Build/source/texk/web2c/luatexdir/font/dofont.c index 61b6b27528b..4e026f339a3 100644 --- a/Build/source/texk/web2c/luatexdir/font/dofont.c +++ b/Build/source/texk/web2c/luatexdir/font/dofont.c @@ -37,7 +37,7 @@ static char *font_error_message(pointer u, char *nom, scaled s) { char *str = xmalloc(256); char *c = makecstring(zget_cs_text(u)); - char *extra = "metric data not found or bad"; + const char *extra = "metric data not found or bad"; if (s >= 0) { snprintf(str, 255, "Font \\%s=%s at %gpt not loadable: %s", c, nom, (double) s / 65536, extra); @@ -50,7 +50,7 @@ static char *font_error_message(pointer u, char *nom, scaled s) return str; } -static int do_define_font(integer f, char *cnom, scaled s, integer natural_dir) +static int do_define_font(integer f, const char *cnom, scaled s, integer natural_dir) { boolean res; /* was the callback successful? */ @@ -146,7 +146,7 @@ int read_font_info(pointer u, str_number nom, scaled s, integer natural_dir) free(cnom); return f; } else { - char *help[] = { "I wasn't able to read the size data for this font,", + const char *help[] = { "I wasn't able to read the size data for this font,", "so I will ignore the font specification.", "[Wizards can fix TFM files using TFtoPL/PLtoTF.]", "You might try inserting a different font spec;", @@ -167,7 +167,7 @@ int read_font_info(pointer u, str_number nom, scaled s, integer natural_dir) the |font_tables| array, and we could attempt to reuse those */ -int find_font_id(char *nom, scaled s) +int find_font_id(const char *nom, scaled s) { integer f; f = new_font(); diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.c b/Build/source/texk/web2c/luatexdir/font/luafont.c index be784b0fd20..11bafd8b1ec 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.c +++ b/Build/source/texk/web2c/luatexdir/font/luafont.c @@ -27,11 +27,11 @@ static const char _svn_version[] = #define noVERBOSE -char *font_type_strings[] = { "unknown", "virtual", "real", NULL }; -char *font_format_strings[] = +const char *font_type_strings[] = { "unknown", "virtual", "real", NULL }; +const char *font_format_strings[] = { "unknown", "type1", "type3", "truetype", "opentype", NULL }; -char *font_embedding_strings[] = { "unknown", "no", "subset", "full", NULL }; -char *ligature_type_strings[] = +const char *font_embedding_strings[] = { "unknown", "no", "subset", "full", NULL }; +const char *ligature_type_strings[] = { "=:", "=:|", "|=:", "|=:|", "", "=:|>", "|=:>", "|=:|>", "", "", "", "|=:|>>", NULL }; @@ -99,7 +99,7 @@ const char *MATH_param_names[] = { NULL, }; -static void dump_intfield(lua_State * L, char *n, int c) +static void dump_intfield(lua_State * L, const char *n, int c) { lua_pushstring(L, n); lua_pushnumber(L, c); @@ -107,7 +107,7 @@ static void dump_intfield(lua_State * L, char *n, int c) } -void dump_math_kerns(lua_State * L, charinfo * co, int l, int id) +static void dump_math_kerns(lua_State * L, charinfo * co, int l, int id) { int i; for (i = 0; i < l; i++) { @@ -132,7 +132,7 @@ void dump_math_kerns(lua_State * L, charinfo * co, int l, int id) } -void font_char_to_lua(lua_State * L, internalfontnumber f, charinfo * co) +static void font_char_to_lua(lua_State * L, internalfontnumber f, charinfo * co) { int i, j; liginfo *l; @@ -556,7 +556,7 @@ static int count_hash_items(lua_State * L, int name_index) #define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5) -static int numeric_field(lua_State * L, char *name, int dflt) +static int numeric_field(lua_State * L, const char *name, int dflt) { int i = dflt; lua_pushstring(L, name); @@ -581,17 +581,17 @@ static int n_numeric_field(lua_State * L, int name_index, int dflt) } -static int enum_field(lua_State * L, char *name, int dflt, char **values) +static int enum_field(lua_State * L, const char *name, int dflt, const char **values) { int k; - char *s; + const char *s; int i = dflt; lua_pushstring(L, name); lua_rawget(L, -2); if (lua_isnumber(L, -1)) { i = lua_tonumber(L, -1); } else if (lua_isstring(L, -1)) { - s = (char *) lua_tostring(L, -1); + s = lua_tostring(L, -1); k = 0; while (values[k] != NULL) { if (strcmp(values[k], s) == 0) { @@ -605,7 +605,7 @@ static int enum_field(lua_State * L, char *name, int dflt, char **values) return i; } -static int boolean_field(lua_State * L, char *name, int dflt) +static int boolean_field(lua_State * L, const char *name, int dflt) { int i = dflt; lua_pushstring(L, name); @@ -630,7 +630,7 @@ static int n_boolean_field(lua_State * L, int name_index, int dflt) } -static char *string_field(lua_State * L, char *name, char *dflt) +static char *string_field(lua_State * L, const char *name, const char *dflt) { char *i; lua_pushstring(L, name); @@ -646,7 +646,7 @@ static char *string_field(lua_State * L, char *name, char *dflt) return i; } -static char *n_string_field(lua_State * L, int name_index, char *dflt) +static char *n_string_field(lua_State * L, int name_index, const char *dflt) { char *i; lua_rawgeti(L, LUA_REGISTRYINDEX, name_index); /* fetch the stringptr */ @@ -664,13 +664,13 @@ static char *n_string_field(lua_State * L, int name_index, char *dflt) #define init_luaS_index(a) do { \ lua_pushliteral(L,#a); \ - luaS_##a##_ptr = (char *)lua_tostring(L,-1); \ + luaS_##a##_ptr = lua_tostring(L,-1); \ luaS_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ } while (0) #define make_luaS_index(a) \ static int luaS_##a##_index = 0; \ - static char * luaS_##a##_ptr = NULL + static const char * luaS_##a##_ptr = NULL #define luaS_index(a) luaS_##a##_index @@ -729,7 +729,7 @@ make_luaS_index(vert_variants); make_luaS_index(mathkern); make_luaS_index(commands); -void init_font_string_pointers(lua_State * L) +static void init_font_string_pointers(lua_State * L) { init_luaS_index(width); init_luaS_index(height); @@ -800,7 +800,7 @@ static int count_char_packet_bytes(lua_State * L) if (lua_istable(L, -1)) { lua_rawgeti(L, -1, 1); if (lua_isstring(L, -1)) { - char *s = (char *) lua_tostring(L, -1); + const char *s = lua_tostring(L, -1); if (luaS_ptr_eq(s, font)) { l += 5; ff = 1; @@ -846,7 +846,7 @@ static int count_char_packet_bytes(lua_State * L) -scaled sp_to_dvi(halfword sp, halfword atsize) +static scaled sp_to_dvi(halfword sp, halfword atsize) { double result, mult; mult = (double) (atsize / 65536.0); @@ -861,7 +861,7 @@ read_char_packets(lua_State * L, integer * l_fonts, charinfo * co, int atsize) int i, n, m; size_t l; int cmd; - char *s; + const char *s; real_eight_bits *cpackets; int ff = 0; int np = 0; @@ -881,7 +881,7 @@ read_char_packets(lua_State * L, integer * l_fonts, charinfo * co, int atsize) /* fetch the command code */ lua_rawgeti(L, -1, 1); if (lua_isstring(L, -1)) { - s = (char *) lua_tostring(L, -1); + s = lua_tostring(L, -1); cmd = 0; if (luaS_ptr_eq(s, font)) { cmd = packet_font_code; @@ -972,7 +972,7 @@ read_char_packets(lua_State * L, integer * l_fonts, charinfo * co, int atsize) case packet_special_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - s = (char *) lua_tolstring(L, -1, &l); + s = lua_tolstring(L, -1, &l); if (l > 0) { do_store_four(l); m = (int) l; @@ -1043,7 +1043,7 @@ static void read_lua_cidinfo(lua_State * L, int f) static void read_lua_parameters(lua_State * L, int f) { int i, n; - char *s; + const char *s; lua_getfield(L, -1, "parameters"); if (lua_istable(L, -1)) { /* the number of parameters is the max(IntegerKeys(L)),7) */ @@ -1077,7 +1077,7 @@ static void read_lua_parameters(lua_State * L, int f) set_font_param(f, i, n); } } else if (lua_isstring(L, -2)) { - s = (char *) lua_tostring(L, -2); + s = lua_tostring(L, -2); n = (lua_isnumber(L, -1) ? lua_roundnumber(L, -1) : 0); if (luaS_ptr_eq(s, slant)) { set_font_param(f, slant_code, n); @@ -1157,7 +1157,7 @@ static void store_math_kerns(lua_State * L, charinfo * co, int id) } } -void +static void font_char_from_lua(lua_State * L, internal_font_number f, integer i, integer * l_fonts) { @@ -1320,8 +1320,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i, if (k < 0) k = non_boundarychar; } else if (lua_isstring(L, -2)) { - s = (char *) lua_tostring(L, -2); - if (luaS_ptr_eq(s, right_boundary)) { + if (luaS_ptr_eq(lua_tostring(L, -2), right_boundary)) { k = right_boundarychar; if (!has_right_boundary(f)) set_right_boundary(f, @@ -1383,8 +1382,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i, k = non_boundarychar; } } else if (lua_isstring(L, -2)) { - s = (char *) lua_tostring(L, -2); - if (luaS_ptr_eq(s, right_boundary)) { + if (luaS_ptr_eq(lua_tostring(L, -2), right_boundary)) { k = right_boundarychar; if (!has_right_boundary(f)) set_right_boundary(f, @@ -1525,6 +1523,7 @@ int font_from_lua(lua_State * L, int f) /* now fetch the base fonts, if needed */ n = count_hash_items(L, luaS_index(fonts)); if (n > 0) { + const char *cs; l_fonts = xmalloc((n + 2) * sizeof(integer)); memset(l_fonts, 0, (n + 2) * sizeof(integer)); lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(fonts)); @@ -1540,15 +1539,15 @@ int font_from_lua(lua_State * L, int f) } lua_pop(L, 1); /* pop id */ }; - s = NULL; + cs = NULL; if (lua_istable(L, -1)) { lua_getfield(L, -1, "name"); if (lua_isstring(L, -1)) { - s = (char *) lua_tostring(L, -1); + cs = lua_tostring(L, -1); } lua_pop(L, 1); /* pop name */ } - if (s != NULL) { + if (cs != NULL) { lua_getfield(L, -1, "size"); t = (lua_isnumber(L, -1) ? lua_roundnumber(L, -1) : -1000); lua_pop(L, 1); @@ -1620,10 +1619,10 @@ int font_from_lua(lua_State * L, int f) font_char_from_lua(L, f, i, l_fonts); } } else if (lua_isstring(L, -2)) { - s = (char *) lua_tostring(L, -2); - if (luaS_ptr_eq(s, left_boundary)) { + const char *cs = lua_tostring(L, -2); + if (luaS_ptr_eq(cs, left_boundary)) { font_char_from_lua(L, f, left_boundarychar, l_fonts); - } else if (luaS_ptr_eq(s, right_boundary)) { + } else if (luaS_ptr_eq(cs, right_boundary)) { font_char_from_lua(L, f, right_boundarychar, l_fonts); } } diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h index 554c981b1a8..8da0d77099b 100644 --- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h +++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.h @@ -161,7 +161,7 @@ void writetype0(fd_entry * fd); void do_pdf_font(integer, internalfontnumber); fd_entry *lookup_fd_entry(char *, integer, integer); fd_entry *new_fd_entry(void); -void write_fontstuff(); +void write_fontstuff(void); integer get_fd_objnum(fd_entry * fd); integer get_fn_objnum(fd_entry * fd); void embed_whole_font(fd_entry * fd); @@ -200,7 +200,7 @@ extern integer ttf_length; int readchar(boolean, chardesc *); /* macnames.c */ -extern const char notdef[]; +extern char notdef[]; /* vfovf.c */ void vf_expand_local_fonts(internal_font_number f); diff --git a/Build/source/texk/web2c/luatexdir/font/macnames.c b/Build/source/texk/web2c/luatexdir/font/macnames.c index a62de50edcb..56bce90264e 100644 --- a/Build/source/texk/web2c/luatexdir/font/macnames.c +++ b/Build/source/texk/web2c/luatexdir/font/macnames.c @@ -21,7 +21,7 @@ static const char __svn_version[] = "$Id: macnames.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/font/macnames.c $"; -const char notdef[] = ".notdef"; +char notdef[] = ".notdef"; const char *mac_glyph_names[] = { /* 0x00 */ diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.c b/Build/source/texk/web2c/luatexdir/font/mapfile.c index 7784c5b3881..fe5155da23e 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.c +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.c @@ -121,7 +121,7 @@ static void delete_ff_entry(ff_entry * ff) xfree(ff); } -static fm_entry *dummy_fm_entry() +static fm_entry *dummy_fm_entry(void) { static const fm_entry const_fm_entry; return (fm_entry *) & const_fm_entry; @@ -167,7 +167,7 @@ static int comp_ff_entry(const void *pa, const void *pb, void *p) ((const ff_entry *) pb)->ff_name); } -static void create_avl_trees() +static void create_avl_trees(void) { assert(tfm_tree == NULL); tfm_tree = avl_create(comp_fm_entry_tfm, NULL, &avl_xallocator); @@ -271,7 +271,7 @@ int avl_do_entry(fm_entry * fm, int mode) /* add the encoding name to an AVL tree. this has nothing to do with writeenc.c */ -char *add_encname(char *s) +static char *add_encname(char *s) { char *p; void **aa; @@ -288,7 +288,7 @@ char *add_encname(char *s) /**********************************************************************/ /* consistency check for map entry, with warn flag */ -int check_fm_entry(fm_entry * fm, boolean warn) +static int check_fm_entry(fm_entry * fm, boolean warn) { int a = 0; assert(fm != NULL); @@ -414,7 +414,7 @@ int check_std_t1font(char *s) /**********************************************************************/ -static void fm_scan_line() +static void fm_scan_line(void) { int a, b, c, j, u = 0, v = 0; float d; @@ -575,7 +575,7 @@ static void fm_scan_line() /**********************************************************************/ -void fm_read_info() +void fm_read_info(void) { int callback_id; int file_opened = 0; @@ -821,7 +821,7 @@ fm_entry *lookup_fontmap(char *ps_name) * ignored. */ -void process_map_item(char *s, int type) +static void process_map_item(char *s, int type) { char *p; int mode; diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.c b/Build/source/texk/web2c/luatexdir/font/texfont.c index c6df4cf6d7a..6e64053aa9a 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.c +++ b/Build/source/texk/web2c/luatexdir/font/texfont.c @@ -33,6 +33,7 @@ #include "ptexlib.h" #include "luatex-api.h" +#include "luatexfont.h" #define noDEBUG @@ -48,14 +49,6 @@ texfont **font_tables = NULL; static integer font_arr_max = 0; static integer font_id_maxval = 0; -extern extinfo *get_charinfo_vert_variants(charinfo * ci); -extern extinfo *get_charinfo_hor_variants(charinfo * ci); -extern void set_charinfo_hor_variants(charinfo * ci, extinfo * ext); -extern void set_charinfo_vert_variants(charinfo * ci, extinfo * ext); - -extern extinfo *copy_variants(extinfo * o); - - static void grow_font_table(integer id) { int j; @@ -177,7 +170,7 @@ charinfo *get_charinfo(internal_font_number f, integer c) return &(font_tables[f]->charinfo[0]); } -void set_charinfo(internal_font_number f, integer c, charinfo * ci) +static void set_charinfo(internal_font_number f, integer c, charinfo * ci) { sa_tree_item glyph; if (proper_char_index(c)) { @@ -348,7 +341,8 @@ integer char_exists(internal_font_number f, integer c) return 0; } -int lua_char_exists_callback(internal_font_number f, integer c) +#if 0 /* unused */ +static int lua_char_exists_callback(internal_font_number f, integer c) { integer callback_id; lua_State *L = Luas; @@ -371,6 +365,7 @@ int lua_char_exists_callback(internal_font_number f, integer c) } return ret; } +#endif extinfo *new_variant(int glyph, int startconnect, int endconnect, @@ -388,7 +383,7 @@ extinfo *new_variant(int glyph, int startconnect, int endconnect, } -extinfo *copy_variant(extinfo * old) +static extinfo *copy_variant(extinfo * old) { extinfo *ext; ext = xmalloc(sizeof(extinfo)); @@ -401,7 +396,7 @@ extinfo *copy_variant(extinfo * old) return ext; } -void dump_variant(extinfo * ext) +static void dump_variant(extinfo * ext) { dump_int(ext->glyph); dump_int(ext->start_overlap); @@ -412,7 +407,7 @@ void dump_variant(extinfo * ext) } -extinfo *undump_variant(void) +static extinfo *undump_variant(void) { integer x; extinfo *ext; @@ -476,7 +471,7 @@ extinfo *copy_variants(extinfo * o) } -void dump_charinfo_variants(extinfo * o) +static void dump_charinfo_variants(extinfo * o) { while (o != NULL) { dump_variant(o); @@ -486,7 +481,7 @@ void dump_charinfo_variants(extinfo * o) return; } -extinfo *undump_charinfo_variants(void) +static extinfo *undump_charinfo_variants(void) { extinfo *c, *t, *h = NULL; c = undump_variant(); @@ -1427,7 +1422,7 @@ scaled get_kern(internal_font_number f, integer lc, integer rc) x = 0; dump_int(x); \ } -void dump_charinfo(int f, int c) +static void dump_charinfo(int f, int c) { charinfo *co; integer x; @@ -1490,7 +1485,7 @@ void dump_charinfo(int f, int c) dump_math_kerns(co); } -void dump_font_entry(texfont * f) +static void dump_font_entry(texfont * f) { dump_int(f->_font_size); dump_int(f->_font_dsize); @@ -1567,7 +1562,7 @@ void dump_font(int f) } } -int undump_charinfo(int f) +static int undump_charinfo(int f) { charinfo *co; integer x, i; @@ -1662,7 +1657,7 @@ int undump_charinfo(int f) a(f,s); } -void undump_font_entry(texfont * f) +static void undump_font_entry(texfont * f) { integer x = 0; /* *INDENT-OFF* */ diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h index 35e6dde9963..4963f71cad2 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.h +++ b/Build/source/texk/web2c/luatexdir/font/texfont.h @@ -198,9 +198,9 @@ typedef enum { full_embedding, } font_embedding_option; -extern char *font_type_strings[]; -extern char *font_format_strings[]; -extern char *font_embedding_strings[]; +extern const char *font_type_strings[]; +extern const char *font_format_strings[]; +extern const char *font_embedding_strings[]; # define font_checksum(a) font_tables[a]->_font_checksum @@ -572,13 +572,13 @@ extern void set_lp_code(internal_font_number f, integer c, integer i); extern void set_rp_code(internal_font_number f, integer c, integer i); extern void set_ef_code(internal_font_number f, integer c, integer i); -int read_tfm_info(internal_font_number f, char *nom, scaled s); +int read_tfm_info(internal_font_number f, const char *nom, scaled s); /* from dofont.c */ extern int read_font_info(pointer u, str_number nom, scaled s, integer ndir); -extern int find_font_id(char *nom, scaled s); +extern int find_font_id(const char *nom, scaled s); /* for and from vfpacket.c */ diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.c b/Build/source/texk/web2c/luatexdir/font/tfmofm.c index 411018162eb..6c99a9dd498 100644 --- a/Build/source/texk/web2c/luatexdir/font/tfmofm.c +++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.c @@ -375,7 +375,7 @@ additional parameter information, which is explained later. xfree(xligs); xfree(xkerns); return 1; } -int open_tfm_file(char *nom, unsigned char **tfm_buf, integer * tfm_siz) +static int open_tfm_file(const char *nom, unsigned char **tfm_buf, integer * tfm_siz) { boolean res; /* was the callback successful? */ boolean opened; /* was |tfm_file| successfully opened? */ @@ -575,7 +575,7 @@ typedef struct tfmcharacterinfo { unsigned char _tag; } tfmcharacterinfo; -int read_tfm_info(internalfontnumber f, char *cnom, scaled s) +int read_tfm_info(internalfontnumber f, const char *cnom, scaled s) { integer k; /* index into |font_info| */ halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np, slh; /* sizes of subfiles */ diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.c b/Build/source/texk/web2c/luatexdir/font/tt_glyf.c index 1a7b1427430..1ca35e8800f 100644 --- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.c +++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.c @@ -158,10 +158,10 @@ void tt_build_finish(struct tt_glyphs *g) static int glyf_cmp(const void *v1, const void *v2) { int cmp = 0; - struct tt_glyph_desc *sv1, *sv2; + const struct tt_glyph_desc *sv1, *sv2; - sv1 = (struct tt_glyph_desc *) v1; - sv2 = (struct tt_glyph_desc *) v2; + sv1 = (const struct tt_glyph_desc *) v1; + sv2 = (const struct tt_glyph_desc *) v2; if (sv1->gid == sv2->gid) cmp = 0; diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.c b/Build/source/texk/web2c/luatexdir/font/vfovf.c index eb5fb665544..407076c215e 100644 --- a/Build/source/texk/web2c/luatexdir/font/vfovf.c +++ b/Build/source/texk/web2c/luatexdir/font/vfovf.c @@ -21,6 +21,7 @@ #include "ptexlib.h" #include "luatex-api.h" #include "luatexfont.h" +#include "inc-vfovf.h" static const char _svn_version[] = "$Id: vfovf.c 2448 2009-06-08 07:43:50Z taco $ " @@ -186,7 +187,7 @@ void pdf_check_vf_cur_val(void) } static void -vf_local_font_warning(internal_font_number f, internal_font_number k, char *s, +vf_local_font_warning(internal_font_number f, internal_font_number k, const char *s, integer a, integer b) { print_nlp(); @@ -205,7 +206,7 @@ vf_local_font_warning(internal_font_number f, internal_font_number k, char *s, /* process a local font in \.{VF} file */ -internal_font_number +static internal_font_number vf_def_font(internal_font_number f, unsigned char *vf_buffer, integer * vf_cr) { internal_font_number k; @@ -286,7 +287,7 @@ vf_def_font(internal_font_number f, unsigned char *vf_buffer, integer * vf_cr) } -int open_vf_file(char *fn, unsigned char **vbuffer, integer * vsize) +static int open_vf_file(const char *fn, unsigned char **vbuffer, integer * vsize) { boolean res; /* was the callback successful? */ integer callback_id; @@ -393,7 +394,7 @@ int open_vf_file(char *fn, unsigned char **vbuffer, integer * vsize) } \ } -int count_packet_bytes(real_eight_bits * vf_buf, int cur_bute, int count) +static int count_packet_bytes(real_eight_bits * vf_buf, int cur_bute, int count) { int k = 0; int ff = 0; @@ -1049,7 +1050,7 @@ void do_vf(internal_font_number f) K++; } -int make_vf_table(lua_State * L, char *cnom, scaled atsize) +int make_vf_table(lua_State * L, const char *cnom, scaled atsize) { integer cmd, k, i; integer cc, cmd_length, packet_length; @@ -1603,7 +1604,8 @@ letter_space_font(halfword u, internal_font_number f, integer e) /* the fontname has [+-]\d+ls at the end */ -boolean is_letterspaced_font(internal_font_number f) +#if 0 /* unused */ +static boolean is_letterspaced_font(internal_font_number f) { char *i, *j; if (font_type(f) != virtual_font_type) @@ -1624,6 +1626,7 @@ boolean is_letterspaced_font(internal_font_number f) return false; return true; } +#endif /* TODO */ diff --git a/Build/source/texk/web2c/luatexdir/font/vfpacket.c b/Build/source/texk/web2c/luatexdir/font/vfpacket.c index 6e971bb9fd2..161330469e3 100644 --- a/Build/source/texk/web2c/luatexdir/font/vfpacket.c +++ b/Build/source/texk/web2c/luatexdir/font/vfpacket.c @@ -117,10 +117,12 @@ int vf_packet_bytes(charinfo * co) /* typeset the \.{DVI} commands in the character packet for character |c| in current font |f| */ -char *packet_command_names[] = { +#if 0 /* unused */ +static char *packet_command_names[] = { "char", "font", "pop", "push", "special", "image", "right", "down", "rule", "node", "nop", "end", NULL }; +#endif void do_vf_packet(internal_font_number vf_f, integer c) diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.c b/Build/source/texk/web2c/luatexdir/font/writecff.c index caec0103ccd..98b8a8bc9d5 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.c +++ b/Build/source/texk/web2c/luatexdir/font/writecff.c @@ -754,7 +754,7 @@ static void add_dict(cff_dict * dict, } (dict->entries)[dict->count].id = id; - (dict->entries)[dict->count].key = (char *) dict_operator[id].opname; + (dict->entries)[dict->count].key = dict_operator[id].opname; if (argtype == CFF_TYPE_NUMBER || argtype == CFF_TYPE_BOOLEAN || argtype == CFF_TYPE_SID || argtype == CFF_TYPE_OFFSET) { @@ -1439,7 +1439,7 @@ void cff_dict_add(cff_dict * dict, const char *key, int count) } (dict->entries)[dict->count].id = id; - (dict->entries)[dict->count].key = (char *) dict_operator[id].opname; + (dict->entries)[dict->count].key = dict_operator[id].opname; (dict->entries)[dict->count].count = count; if (count > 0) { (dict->entries)[dict->count].values = xcalloc(count, sizeof(double)); @@ -1512,7 +1512,7 @@ char *cff_get_string(cff_font * cff, s_SID id) return result; } -long cff_get_sid(cff_font * cff, char *str) +long cff_get_sid(cff_font * cff, const char *str) { card16 i; @@ -1550,7 +1550,7 @@ void cff_update_string(cff_font * cff) } -s_SID cff_add_string(cff_font * cff, char *str) +s_SID cff_add_string(cff_font * cff, const char *str) { card16 idx; cff_index *strings; @@ -3116,8 +3116,8 @@ void write_cff(cff_font * cffont, fd_entry * fd) cff_dict_remove((cffont->private)[0], "Subrs"); /* no Subrs */ } - cff_add_string(cffont, (char *) "Adobe"); - cff_add_string(cffont, (char *) "Identity"); + cff_add_string(cffont, "Adobe"); + cff_add_string(cffont, "Identity"); cff_dict_update(cffont->topdict, cffont); cff_dict_update(cffont->private[0], cffont); @@ -3126,9 +3126,9 @@ void write_cff(cff_font * cffont, fd_entry * fd) /* CFF code need to be rewrote... */ cff_dict_add(cffont->topdict, "ROS", 3); cff_dict_set(cffont->topdict, "ROS", 0, - (double) cff_get_sid(cffont, (char *) "Adobe")); + (double) cff_get_sid(cffont, "Adobe")); cff_dict_set(cffont->topdict, "ROS", 1, - (double) cff_get_sid(cffont, (char *) "Identity")); + (double) cff_get_sid(cffont, "Identity")); cff_dict_set(cffont->topdict, "ROS", 2, 0.0); write_fontfile(cffont, fullname); diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.h b/Build/source/texk/web2c/luatexdir/font/writecff.h index 8f3fdac675a..bec0add205b 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.h +++ b/Build/source/texk/web2c/luatexdir/font/writecff.h @@ -87,7 +87,7 @@ typedef struct { /* Dictionary */ typedef struct { int id; /* encoded data value (as card8 or card16) */ - char *key; /* opname */ + const char *key; /* opname */ int count; /* number of values */ double *values; /* values */ } cff_dict_entry; @@ -280,8 +280,8 @@ extern long cff_read_private(cff_font * cff); /* String */ extern int cff_match_string(cff_font * cff, const char *str, s_SID sid); extern char *cff_get_string(cff_font * cff, s_SID id); -extern long cff_get_sid(cff_font * cff, char *str); -extern s_SID cff_add_string(cff_font * cff, char *str); +extern long cff_get_sid(cff_font * cff, const char *str); +extern s_SID cff_add_string(cff_font * cff, const char *str); extern void cff_update_string(cff_font * cff); # define cff_is_stdstr(s) (cff_get_sid(NULL, (s)) >= 0) diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.c b/Build/source/texk/web2c/luatexdir/font/writeenc.c index 1aa54c882f5..e0cd7bc43a0 100644 --- a/Build/source/texk/web2c/luatexdir/font/writeenc.c +++ b/Build/source/texk/web2c/luatexdir/font/writeenc.c @@ -19,6 +19,7 @@ with LuaTeX; if not, see . */ #include "ptexlib.h" +#include "inc-epdf.h" static const char _svn_version[] = "$Id: writeenc.c 2448 2009-06-08 07:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/font/writeenc.c $"; @@ -36,7 +37,7 @@ static int comp_fe_entry(const void *pa, const void *pb, void *p) return strcmp(((const fe_entry *) pa)->name, ((const fe_entry *) pb)->name); } -fe_entry *new_fe_entry() +static fe_entry *new_fe_entry(void) { fe_entry *fe; fe = xtalloc(1, fe_entry); @@ -47,7 +48,7 @@ fe_entry *new_fe_entry() return fe; } -fe_entry *lookup_fe_entry(char *s) +static fe_entry *lookup_fe_entry(char *s) { fe_entry fe; assert(s != NULL); @@ -59,7 +60,7 @@ fe_entry *lookup_fe_entry(char *s) return (fe_entry *) avl_find(fe_tree, &fe); } -void register_fe_entry(fe_entry * fe) +static void register_fe_entry(fe_entry * fe) { void **aa; if (fe_tree == NULL) { @@ -112,7 +113,7 @@ void epdf_write_enc(char **glyph_names, integer fe_objnum) pdf_end_dict(); } -void write_enc(char **glyph_names, struct avl_table *tx_tree, integer fe_objnum) +static void write_enc(char **glyph_names, struct avl_table *tx_tree, integer fe_objnum) { int i_old, *p; struct avl_traverser t; @@ -139,13 +140,13 @@ void write_enc(char **glyph_names, struct avl_table *tx_tree, integer fe_objnum) pdf_end_dict(); } -void write_fontencoding(fe_entry * fe) +static void write_fontencoding(fe_entry * fe) { assert(fe != NULL); write_enc(fe->glyph_names, fe->tx_tree, fe->fe_objnum); } -void write_fontencodings() +void write_fontencodings(void) { fe_entry *fe; struct avl_traverser t; @@ -176,7 +177,7 @@ static void destroy_fe_entry(void *pa, void *pb) xfree(p); } -void enc_free() +void enc_free(void) { if (fe_tree != NULL) avl_destroy(fe_tree, destroy_fe_entry); diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.c b/Build/source/texk/web2c/luatexdir/font/writefont.c index 32b1cd4ef9f..5dd861f88ee 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.c +++ b/Build/source/texk/web2c/luatexdir/font/writefont.c @@ -72,7 +72,7 @@ static int comp_fd_entry(const void *pa, const void *pb, void *p) /**********************************************************************/ /* initialize data structure for /Type /Font */ -fo_entry *new_fo_entry(void) +static fo_entry *new_fo_entry(void) { fo_entry *fo; fo = xtalloc(1, fo_entry); @@ -207,7 +207,7 @@ static void preset_fontname(fo_entry * fo) fo->fd->fontname = xstrdup(fo->fm->tfm_name); } -static void write_fontname(fd_entry * fd, char *key) +static void write_fontname(fd_entry * fd, const char *key) { assert(fd->fontname != NULL); pdf_puts("/"); @@ -244,7 +244,7 @@ fd_entry *lookup_fd_entry(char *s, integer slant, integer extend) return (fd_entry *) avl_find(fd_tree, &fd); } -fd_entry *lookup_fontdescriptor(fo_entry * fo) +static fd_entry *lookup_fontdescriptor(fo_entry * fo) { assert(fo != NULL); assert(fo->fm != NULL); @@ -265,7 +265,7 @@ void register_fd_entry(fd_entry * fd) assert(aa != NULL); } -void create_fontdescriptor(fo_entry * fo, internalfontnumber f) +static void create_fontdescriptor(fo_entry * fo, internalfontnumber f) { assert(fo != NULL); assert(fo->fm != NULL); @@ -304,7 +304,7 @@ void embed_whole_font(fd_entry * fd) * tree gl_tree of font descriptor fd referenced by font dictionary fo. */ -void mark_reenc_glyphs(fo_entry * fo, internalfontnumber f) +static void mark_reenc_glyphs(fo_entry * fo, internalfontnumber f) { int i; char **g; @@ -330,7 +330,7 @@ void mark_reenc_glyphs(fo_entry * fo, internalfontnumber f) * 2. Mark encoding pairs used by TeX to optimize encoding vector. */ -struct avl_table *mark_chars(fo_entry * fo, struct avl_table *tx_tree, +static struct avl_table *mark_chars(fo_entry * fo, struct avl_table *tx_tree, internalfontnumber f) { int i, *j; @@ -352,7 +352,7 @@ struct avl_table *mark_chars(fo_entry * fo, struct avl_table *tx_tree, /**********************************************************************/ -void get_char_range(fo_entry * fo, internalfontnumber f) +static void get_char_range(fo_entry * fo, internalfontnumber f) { int i; assert(fo != NULL); @@ -420,7 +420,7 @@ static void write_charwidth_array(fo_entry * fo, internalfontnumber f) * into fo_tree; they are individually written out. */ -fo_entry *lookup_fo_entry(char *s) +static fo_entry *lookup_fo_entry(char *s) { fo_entry fo; fm_entry fm; @@ -434,7 +434,7 @@ fo_entry *lookup_fo_entry(char *s) return (fo_entry *) avl_find(fo_tree, &fo); } -void register_fo_entry(fo_entry * fo) +static void register_fo_entry(fo_entry * fo) { void **aa; if (fo_tree == NULL) { @@ -597,7 +597,7 @@ static void write_fontdescriptor(fd_entry * fd) pdf_end_dict(); } -void write_fontdescriptors() +static void write_fontdescriptors(void) { fd_entry *fd; struct avl_traverser t; @@ -611,7 +611,7 @@ void write_fontdescriptors() /**********************************************************************/ -void write_fontdictionary(fo_entry * fo) +static void write_fontdictionary(fo_entry * fo) { assert(fo != NULL); assert(fo->fm != NULL); @@ -658,7 +658,7 @@ void write_fontdictionary(fo_entry * fo) pdf_end_dict(); } -void write_fontdictionaries() +static void write_fontdictionaries(void) { fo_entry *fo; struct avl_traverser t; @@ -676,7 +676,7 @@ void write_fontdictionaries() * @= in pdftex.web. */ -void write_fontstuff() +void write_fontstuff(void) { write_fontdescriptors(); write_fontencodings(); /* see writeenc.c */ @@ -685,7 +685,7 @@ void write_fontstuff() /**********************************************************************/ -void create_fontdictionary(fm_entry * fm, integer font_objnum, +static void create_fontdictionary(fm_entry * fm, integer font_objnum, internalfontnumber f) { fo_entry *fo = new_fo_entry(); @@ -839,17 +839,17 @@ void do_pdf_font(integer font_objnum, internalfontnumber f) at this point in the program. */ -int comp_glw_entry(const void *pa, const void *pb, void *p) +static int comp_glw_entry(const void *pa, const void *pb, void *p) { unsigned short i, j; (void) p; - i = (*(glw_entry *) pa).id; - j = (*(glw_entry *) pb).id; + i = (*(const glw_entry *) pa).id; + j = (*(const glw_entry *) pb).id; cmp_return(i, j); return 0; } -void create_cid_fontdescriptor(fo_entry * fo, internalfontnumber f) +static void create_cid_fontdescriptor(fo_entry * fo, internalfontnumber f) { assert(fo != NULL); assert(fo->fm != NULL); diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.c b/Build/source/texk/web2c/luatexdir/font/writet1.c index c9c2dacc3d8..251f6702244 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.c +++ b/Build/source/texk/web2c/luatexdir/font/writet1.c @@ -365,7 +365,8 @@ char **load_enc_file(char *enc_name) return glyph_names; } -void free_glyph_names(char **glyph_names) +#if 0 /* unused */ +static void free_glyph_names(char **glyph_names) { int i; assert(glyph_names != NULL); @@ -374,6 +375,7 @@ void free_glyph_names(char **glyph_names) xfree(glyph_names[i]); xfree(glyph_names); } +#endif static void t1_check_pfa(void) @@ -758,7 +760,7 @@ static void t1_scan_keys(void) { int i, k; char *p, *q, *r; - key_entry *key; + const key_entry *key; if (fm_extend(fd_cur->fm) != 0 || fm_slant(fd_cur->fm) != 0) { if (t1_prefix("/FontMatrix")) { t1_modify_fm(); @@ -775,7 +777,7 @@ static void t1_scan_keys(void) pdftex_fail("Type%d fonts unsupported by pdfTeX", i); return; } - for (key = (key_entry *) font_key; key - font_key < FONT_KEYS_NUM; key++) { + for (key = font_key; key - font_key < FONT_KEYS_NUM; key++) { if (key->t1name[0] != '\0' && str_prefix(t1_line_array + 1, key->t1name)) break; @@ -855,7 +857,7 @@ static void copy_glyph_names(char **glyph_names, int a, int b) /* read encoding from Type1 font file, return glyph_names array, or pdffail() */ -char **t1_builtin_enc(void) +static char **t1_builtin_enc(void) { int i, a, b, c, counter = 0; char *r, *p, **glyph_names; @@ -1071,7 +1073,7 @@ static void t1_include(void) if (subr >= subr_size || subr < 0) \ pdftex_fail("Subrs array: entry index out of range (%i)", subr); -static const char **check_cs_token_pair() +static const char **check_cs_token_pair(void) { const char **p = (const char **) cs_token_pairs_list; for (; p[0] != NULL; ++p) @@ -1406,10 +1408,10 @@ static void cs_mark(const char *cs_name, int subr) static int comp_t1_glyphs(const void *pa, const void *pb, void *p) { (void) p; - return strcmp(*((const char **) pa), *((const char **) pb)); + return strcmp(*((const char * const *) pa), *((const char * const *) pb)); } -struct avl_table *create_t1_glyph_tree(char **glyph_names) +static struct avl_table *create_t1_glyph_tree(char **glyph_names) { int i; void **aa; @@ -1427,7 +1429,7 @@ struct avl_table *create_t1_glyph_tree(char **glyph_names) return gl_tree; } -void destroy_t1_glyph_tree(struct avl_table *gl_tree) +static void destroy_t1_glyph_tree(struct avl_table *gl_tree) { assert(gl_tree != NULL); avl_destroy(gl_tree, NULL); @@ -1806,7 +1808,7 @@ void writet1(fd_entry * fd) xfree(t1_buffer); } -void t1_free() +void t1_free(void) { xfree(t1_line_array); xfree(t1_buf_array); diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.c b/Build/source/texk/web2c/luatexdir/font/writettf.c index 0200520672f..eb615ad82ac 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.c +++ b/Build/source/texk/web2c/luatexdir/font/writettf.c @@ -118,7 +118,7 @@ static const char *newtabnames[] = { "prep" }; -ttf_cmap_entry *new_ttf_cmap_entry(void) +static ttf_cmap_entry *new_ttf_cmap_entry(void) { ttf_cmap_entry *e; e = xtalloc(1, ttf_cmap_entry); @@ -1129,7 +1129,7 @@ static void ttf_reindex_glyphs(void) } } -static void ttf_write_head() +static void ttf_write_head(void) { dirtab_entry *tab; tab = ttf_seek_tab("head", 0); @@ -1419,7 +1419,7 @@ void writettf(fd_entry * fd) cur_file_name = NULL; } -void do_writeotf(fd_entry * fd) +static void do_writeotf(fd_entry * fd) { long i; dirtab_entry *tab; diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.c b/Build/source/texk/web2c/luatexdir/font/writetype2.c index c410e1e1808..2b5a9894875 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype2.c +++ b/Build/source/texk/web2c/luatexdir/font/writetype2.c @@ -248,7 +248,7 @@ static struct { }; -unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx) +static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx) { long version; unsigned long offset = 0; diff --git a/Build/source/texk/web2c/luatexdir/hyphen.h b/Build/source/texk/web2c/luatexdir/hyphen.h index fa54e8db245..842049e263c 100644 --- a/Build/source/texk/web2c/luatexdir/hyphen.h +++ b/Build/source/texk/web2c/luatexdir/hyphen.h @@ -45,7 +45,7 @@ extern "C" { # include "ptexlib.h" # include "nodes.h" - HyphenDict *hnj_hyphen_new(); + HyphenDict *hnj_hyphen_new(void); void hnj_hyphen_load(HyphenDict * dict, const unsigned char *fn); void hnj_hyphen_free(HyphenDict * dict); void hnj_hyphen_clear(HyphenDict * dict); diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.c b/Build/source/texk/web2c/luatexdir/image/epdf.c index 585b0fa8bfc..cf86a38fa34 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.c +++ b/Build/source/texk/web2c/luatexdir/image/epdf.c @@ -19,6 +19,7 @@ with LuaTeX; if not, see . */ #include "ptexlib.h" +#include "inc-epdf.h" #include diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index 639b2640af1..c619b20f08f 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.h @@ -102,13 +102,10 @@ extern "C" { extern void zpdf_os_get_os_buf(integer); /* epdf.c */ - extern void epdf_mark_glyphs(struct fd_entry *, char *); - extern struct fd_entry *epdf_create_fontdescriptor(struct fm_entry *, int); extern int get_fd_objnum(struct fd_entry *); extern int get_fn_objnum(struct fd_entry *); -/* write_enc.c */ - extern void epdf_write_enc(char **, integer); +#include "../inc-epdf.h" /* utils.c */ extern char *convertStringToPDFString(char *in, int len); diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.c b/Build/source/texk/web2c/luatexdir/image/writeimg.c index 9688e6e2613..f570fd46996 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.c +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.c @@ -196,7 +196,7 @@ void init_image(image * p) img_dictref(p) = LUA_NOREF; } -image *new_image() +image *new_image(void) { image *p = xtalloc(1, image); init_image(p); @@ -237,14 +237,14 @@ void init_image_dict(image_dict * p) img_png_ptr(p) = NULL; /* union */ } -image_dict *new_image_dict() +image_dict *new_image_dict(void) { image_dict *p = xtalloc(1, image_dict); init_image_dict(p); return p; } -void free_dict_strings(image_dict * p) +static void free_dict_strings(image_dict * p) { if (img_filename(p) != NULL) xfree(img_filename(p)); @@ -297,7 +297,7 @@ void free_image_dict(image_dict * p) /**********************************************************************/ -void pdf_print_resname_prefix() +void pdf_print_resname_prefix(void) { if (pdf_resname_prefix != 0) pdf_printf(makecstring(pdf_resname_prefix)); @@ -457,7 +457,7 @@ void scale_img(image * img) img_set_scaled(img); } -void out_img(image * img, pdfstructure * p, scaledpos * pos) +static void out_img(image * img, pdfstructure * p, scaledpos * pos) { float a[6]; /* transformation matrix */ float xoff, yoff, tmp; @@ -874,10 +874,12 @@ integer image_colordepth(integer ref) return img_colordepth(img_dict(img_array[ref])); } -integer image_group_ref(integer ref) +#if 0 /* unused */ +static integer image_group_ref(integer ref) { return img_group_ref(img_dict(img_array[ref])); } +#endif /* The following five functions are for \pdfximagebbox */ diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.h b/Build/source/texk/web2c/luatexdir/image/writeimg.h index 3f3937658b9..bee82acaa97 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.h +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.h @@ -30,8 +30,8 @@ boolean check_image_c(integer); boolean check_image_i(integer); boolean is_pdf_image(integer); boolean is_png_image(integer); -image_dict *new_image_dict(); -image *new_image(); +image_dict *new_image_dict(void); +image *new_image(void); integer epdf_orig_x(integer i); integer epdf_orig_y(integer i); integer epdf_xsize(integer i); diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.c b/Build/source/texk/web2c/luatexdir/image/writejbig2.c index ef4169aa51f..c22c27e11b6 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.c +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.c @@ -247,7 +247,7 @@ static LIST *litem_append(LIST * lp) /**********************************************************************/ -static FILEINFO *new_fileinfo() +static FILEINFO *new_fileinfo(void) { FILEINFO *fip; fip = xtalloc(1, FILEINFO); @@ -265,7 +265,7 @@ static FILEINFO *new_fileinfo() return fip; } -static PAGEINFO *new_pageinfo() +static PAGEINFO *new_pageinfo(void) { PAGEINFO *pip; pip = xtalloc(1, PAGEINFO); @@ -835,7 +835,7 @@ void write_jbig2(image_dict * idict) img_file(idict) = NULL; } -void flush_jbig2_page0_objects() +void flush_jbig2_page0_objects(void) { FILEINFO *fip; struct avl_traverser t; diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.h b/Build/source/texk/web2c/luatexdir/image/writejbig2.h index cb43e7f200f..f28e91281fe 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.h +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.h @@ -25,7 +25,7 @@ # include "image.h" -void flush_jbig2_page0_objects(); +void flush_jbig2_page0_objects(void); void read_jbig2_info(image_dict *); void write_jbig2(image_dict *); diff --git a/Build/source/texk/web2c/luatexdir/image/writejpg.c b/Build/source/texk/web2c/luatexdir/image/writejpg.c index 245512c5e38..187c55ea6c2 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejpg.c +++ b/Build/source/texk/web2c/luatexdir/image/writejpg.c @@ -21,6 +21,7 @@ #include #include "ptexlib.h" #include "image.h" +#include "writejpg.h" static const char _svn_version[] = "$Id: writejpg.c 2320 2009-04-18 08:52:30Z hhenkel $ " diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.c b/Build/source/texk/web2c/luatexdir/image/writepng.c index 999f277b60c..154a8a351c2 100644 --- a/Build/source/texk/web2c/luatexdir/image/writepng.c +++ b/Build/source/texk/web2c/luatexdir/image/writepng.c @@ -21,6 +21,7 @@ #include #include "ptexlib.h" #include "image.h" +#include "writepng.h" static const char _svn_version[] = "$Id: writepng.c 2317 2009-04-18 00:12:18Z hhenkel $ " diff --git a/Build/source/texk/web2c/luatexdir/inc-epdf.h b/Build/source/texk/web2c/luatexdir/inc-epdf.h new file mode 100644 index 00000000000..b59a2e1be9f --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/inc-epdf.h @@ -0,0 +1,8 @@ +/* prototypes used in image/pdftoepdf.cc and in C code */ + +/* image/epdf.c */ + extern void epdf_mark_glyphs(fd_entry *, char *); + extern fd_entry *epdf_create_fontdescriptor(fm_entry *, int); + +/* font/writeenc.c */ + extern void epdf_write_enc(char **, integer); diff --git a/Build/source/texk/web2c/luatexdir/inc-vfovf.h b/Build/source/texk/web2c/luatexdir/inc-vfovf.h new file mode 100644 index 00000000000..eb624f9519c --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/inc-vfovf.h @@ -0,0 +1,2 @@ +/* this function is in vfovf.c for the moment */ +extern int make_vf_table(lua_State * L, const char *name, scaled s); diff --git a/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c b/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c index 59d62e2aabb..6072152f4f5 100644 --- a/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c +++ b/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c @@ -38,6 +38,8 @@ #include #include +#include "hnjalloc.h" + void * hnj_malloc (int size) { diff --git a/Build/source/texk/web2c/luatexdir/lang/hyphen.c b/Build/source/texk/web2c/luatexdir/lang/hyphen.c index 56d745809ae..edcad69adff 100644 --- a/Build/source/texk/web2c/luatexdir/lang/hyphen.c +++ b/Build/source/texk/web2c/luatexdir/lang/hyphen.c @@ -63,7 +63,7 @@ static unsigned char * hnj_strdup( unsigned char *new; int l; - l = strlen ((char*)s); + l = strlen ((const char*)s); new = hnj_malloc (l + 1); memcpy (new, s, l); new[l] = 0; @@ -173,7 +173,7 @@ static char *combine( * -------------------------------------------------------------------- */ -HashIter* new_HashIter( +static HashIter* new_HashIter( HashTab* h ) { HashIter* i = hnj_malloc(sizeof(HashIter)); @@ -184,7 +184,7 @@ HashIter* new_HashIter( } -int nextHashStealPattern( +static int nextHashStealPattern( HashIter*i, unsigned char**word, char **pattern @@ -201,7 +201,7 @@ int nextHashStealPattern( } -int nextHash( +static int nextHash( HashIter*i, unsigned char**word ) { @@ -215,7 +215,7 @@ int nextHash( } -int eachHash( +static int eachHash( HashIter*i, unsigned char**word, char**pattern @@ -231,7 +231,7 @@ int eachHash( } -void delete_HashIter( +static void delete_HashIter( HashIter*i ) { hnj_free(i); @@ -318,7 +318,7 @@ static int state_lookup( i = hnj_string_hash (key) % HASH_SIZE; for (e = hashtab->entries[i]; e; e = e->next) { - if (!strcmp ((char*)key, (char*)e->key)) { + if (!strcmp ((const char*)key, (const char*)e->key)) { return e->u.state; } } @@ -335,7 +335,7 @@ static char* hyppat_lookup( int i; HashEntry *e; unsigned char key[128]; /* should be ample*/ - strncpy((char*)key,(char*)chars,l); key[l]=0; + strncpy((char*)key,(const char*)chars,l); key[l]=0; i = hnj_string_hash (key) % HASH_SIZE; for (e = hashtab->entries[i]; e; e = e->next) { if (!strcmp ((char*)key, (char*)e->key)) { @@ -526,7 +526,7 @@ static void clear_dict( -HyphenDict* hnj_hyphen_new() { +HyphenDict* hnj_hyphen_new(void) { HyphenDict* dict = hnj_malloc (sizeof(HyphenDict)); init_dict(dict); return dict; @@ -695,7 +695,7 @@ void hnj_hyphen_load( delete_HashIter(v); init_hash(&dict->state_num); - state_insert(dict->state_num, hnj_strdup((unsigned char*)""), 0); + state_insert(dict->state_num, hnj_strdup((const unsigned char*)""), 0); v = new_HashIter(dict->merged); while (nextHashStealPattern(v,&word,&pattern)) { static unsigned char mask[] = {0x3F,0x1F,0xF,0x7}; diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.c b/Build/source/texk/web2c/luatexdir/lang/texlang.c index 6550b16a8c9..c315e4e05d8 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.c +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.c @@ -221,9 +221,9 @@ integer get_post_exhyphen_char(integer n) return (integer) l->post_exhyphen_char; } -void load_patterns(struct tex_language *lang, unsigned char *buffer) +void load_patterns(struct tex_language *lang, const unsigned char *buffer) { - if (lang == NULL || buffer == NULL || strlen((char *) buffer) == 0) + if (lang == NULL || buffer == NULL || strlen((const char *) buffer) == 0) return; if (lang->patterns == NULL) { lang->patterns = hnj_hyphen_new(); @@ -243,7 +243,7 @@ void clear_patterns(struct tex_language *lang) void load_tex_patterns(int curlang, halfword head) { char *s = tokenlist_to_cstring(head, 1, NULL); - load_patterns(get_language(curlang), (unsigned char *) s); + load_patterns(get_language(curlang), (const unsigned char *) s); } @@ -254,12 +254,12 @@ void load_tex_patterns(int curlang, halfword head) /* todo change this! */ -char *clean_hyphenation(char *buffer, char **cleaned) +const char *clean_hyphenation(const char *buffer, char **cleaned) { int items; unsigned char word[MAX_WORD_LEN + 1]; int w = 0; - char *s = buffer; + const char *s = buffer; while (*s && !isspace(*s)) { if (*s == '-') { /* skip */ } else if (*s == '=') { @@ -310,9 +310,10 @@ char *clean_hyphenation(char *buffer, char **cleaned) return s; } -void load_hyphenation(struct tex_language *lang, unsigned char *buffer) +void load_hyphenation(struct tex_language *lang, const unsigned char *buffer) { - char *s, *value, *cleaned; + const char *s, *value; + char *cleaned; lua_State *L = Luas; if (lang == NULL) return; @@ -321,7 +322,7 @@ void load_hyphenation(struct tex_language *lang, unsigned char *buffer) lang->exceptions = luaL_ref(L, LUA_REGISTRYINDEX); } lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions); - s = (char *) buffer; + s = (const char *) buffer; while (*s) { while (isspace(*s)) s++; @@ -359,7 +360,7 @@ void clear_hyphenation(struct tex_language *lang) void load_tex_hyphenation(int curlang, halfword head) { char *s = tokenlist_to_cstring(head, 1, NULL); - load_hyphenation(get_language(curlang), (unsigned char *) s); + load_hyphenation(get_language(curlang), (const unsigned char *) s); } /* TODO: clean this up. The delete_attribute_ref() statements are not very @@ -511,7 +512,7 @@ void set_disc_field(halfword f, halfword t) -char *hyphenation_exception(int exceptions, char *w) +static char *hyphenation_exception(int exceptions, char *w) { char *ret = NULL; lua_State *L = Luas; @@ -521,7 +522,7 @@ char *hyphenation_exception(int exceptions, char *w) lua_pushstring(L, w); /* word table */ lua_rawget(L, -2); if (lua_isstring(L, -1)) { - ret = xstrdup((char *) lua_tostring(L, -1)); + ret = xstrdup(lua_tostring(L, -1)); } lua_pop(L, 2); } else { @@ -533,7 +534,7 @@ char *hyphenation_exception(int exceptions, char *w) char *exception_strings(struct tex_language *lang) { - char *value; + const char *value; size_t size = 0, current = 0; size_t l = 0; char *ret = NULL; @@ -546,7 +547,7 @@ char *exception_strings(struct tex_language *lang) /* iterate and join */ lua_pushnil(L); /* first key */ while (lua_next(L, -2) != 0) { - value = (char *) lua_tolstring(L, -1, &l); + value = lua_tolstring(L, -1, &l); if (current + 2 + l > size) { ret = xrealloc(ret, (1.2 * size) + current + l + 1024); size = (1.2 * size) + current + l + 1024; @@ -564,7 +565,7 @@ char *exception_strings(struct tex_language *lang) /* the sequence from |wordstart| to |r| can contain only normal characters */ /* it could be faster to modify a halfword pointer and return an integer */ -halfword find_exception_part(unsigned int *j, int *uword, int len) +static halfword find_exception_part(unsigned int *j, int *uword, int len) { halfword g = null, gg = null; register int i = *j; @@ -584,7 +585,7 @@ halfword find_exception_part(unsigned int *j, int *uword, int len) return gg; } -int count_exception_part(unsigned int *j, int *uword, int len) +static int count_exception_part(unsigned int *j, int *uword, int len) { int ret = 0; register int i = *j; @@ -598,13 +599,13 @@ int count_exception_part(unsigned int *j, int *uword, int len) } -static char *PAT_ERROR[] = { +static const char *PAT_ERROR[] = { "Exception discretionaries should contain three pairs of braced items.", "No intervening spaces are allowed.", NULL }; -void do_exception(halfword wordstart, halfword r, char *replacement) +static void do_exception(halfword wordstart, halfword r, char *replacement) { unsigned i; halfword t; @@ -741,7 +742,7 @@ using an algorithm due to Frank~M. Liang. * prohibiting hyphenation there was not the best idea ever. */ -halfword find_next_wordstart(halfword r) +static halfword find_next_wordstart(halfword r) { register int l; register int start_ok = 1; @@ -781,7 +782,7 @@ halfword find_next_wordstart(halfword r) return r; } -int valid_wordend(halfword s) +static int valid_wordend(halfword s) { register halfword r = s; register int clang = char_lang(s); @@ -946,7 +947,7 @@ void new_hyphenation(halfword head, halfword tail) } -void dump_one_language(int i) +static void dump_one_language(int i) { char *s = NULL; integer x = 0; @@ -989,7 +990,7 @@ void dump_language_data(void) } -void undump_one_language(int i) +static void undump_one_language(int i) { char *s = NULL; integer x = 0; @@ -1009,7 +1010,7 @@ void undump_one_language(int i) if (x > 0) { s = xmalloc(x); undump_things(*s, x); - load_patterns(lang, (unsigned char *) s); + load_patterns(lang, (const unsigned char *) s); free(s); } /* exceptions */ @@ -1017,7 +1018,7 @@ void undump_one_language(int i) if (x > 0) { s = xmalloc(x); undump_things(*s, x); - load_hyphenation(lang, (unsigned char *) s); + load_hyphenation(lang, (const unsigned char *) s); free(s); } } diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 89d233e15b6..6b350a1249b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -23,7 +23,7 @@ static const char _svn_version[] = "$Id: lcallbacklib.c 2448 2009-06-08 07:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; -extern int do_run_callback(int special, char *values, va_list vl); +static int do_run_callback(int special, const char *values, va_list vl); extern int lua_traceback(lua_State * L); int callback_count = 0; @@ -71,7 +71,7 @@ static const char *const callbacknames[] = { int callback_callbacks_id = 0; -void get_lua_boolean(char *table, char *name, boolean * target) +void get_lua_boolean(const char *table, const char *name, boolean * target) { int stacktop; stacktop = lua_gettop(Luas); @@ -89,7 +89,7 @@ void get_lua_boolean(char *table, char *name, boolean * target) return; } -void get_saved_lua_boolean(int r, char *name, boolean * target) +void get_saved_lua_boolean(int r, const char *name, boolean * target) { int stacktop; stacktop = lua_gettop(Luas); @@ -107,7 +107,7 @@ void get_saved_lua_boolean(int r, char *name, boolean * target) return; } -void get_lua_number(char *table, char *name, integer * target) +void get_lua_number(const char *table, const char *name, integer * target) { int stacktop; stacktop = lua_gettop(Luas); @@ -123,7 +123,7 @@ void get_lua_number(char *table, char *name, integer * target) return; } -void get_saved_lua_number(int r, char *name, integer * target) +void get_saved_lua_number(int r, const char *name, integer * target) { int stacktop; stacktop = lua_gettop(Luas); @@ -140,7 +140,7 @@ void get_saved_lua_number(int r, char *name, integer * target) } -void get_lua_string(char *table, char *name, char **target) +void get_lua_string(const char *table, const char *name, const char **target) { int stacktop; stacktop = lua_gettop(Luas); @@ -149,14 +149,14 @@ void get_lua_string(char *table, char *name, char **target) if (lua_istable(Luas, -1)) { lua_getfield(Luas, -1, name); if (lua_isstring(Luas, -1)) { - *target = (char *) lua_tostring(Luas, -1); + *target = lua_tostring(Luas, -1); } } lua_settop(Luas, stacktop); return; } -void get_saved_lua_string(int r, char *name, char **target) +void get_saved_lua_string(int r, const char *name, const char **target) { int stacktop; stacktop = lua_gettop(Luas); @@ -165,7 +165,7 @@ void get_saved_lua_string(int r, char *name, char **target) if (lua_istable(Luas, -1)) { lua_getfield(Luas, -1, name); if (lua_isstring(Luas, -1)) { - *target = (char *) lua_tostring(Luas, -1); + *target = lua_tostring(Luas, -1); } } lua_settop(Luas, stacktop); @@ -181,7 +181,7 @@ void get_saved_lua_string(int r, char *name, char **target) #define CALLBACK_CHARNUM 'c' -int run_saved_callback(int r, char *name, char *values, ...) +int run_saved_callback(int r, const char *name, const char *values, ...) { va_list args; int ret = 0; @@ -216,7 +216,7 @@ boolean get_callback(lua_State * L, int i) } } -int run_and_save_callback(int i, char *values, ...) +int run_and_save_callback(int i, const char *values, ...) { va_list args; int ret = 0; @@ -235,7 +235,7 @@ int run_and_save_callback(int i, char *values, ...) } -int run_callback(int i, char *values, ...) +int run_callback(int i, const char *values, ...) { va_list args; int ret = 0; @@ -250,7 +250,7 @@ int run_callback(int i, char *values, ...) return ret; } -int do_run_callback(int special, char *values, va_list vl) +int do_run_callback(int special, const char *values, va_list vl) { int ret; size_t len; @@ -429,7 +429,7 @@ void destroy_saved_callback(int i) static int callback_register(lua_State * L) { int cb; - char *s; + const char *s; if (!lua_isstring(L, 1) || ((!lua_isfunction(L, 2)) && (!lua_isnil(L, 2)) && @@ -438,7 +438,7 @@ static int callback_register(lua_State * L) lua_pushstring(L, "Invalid arguments to callback.register."); return 2; } - s = (char *) lua_tostring(L, 1); + s = lua_tostring(L, 1); for (cb = 0; cb < total_callbacks; cb++) { if (strcmp(callbacknames[cb], s) == 0) break; @@ -467,13 +467,13 @@ static int callback_register(lua_State * L) static int callback_find(lua_State * L) { int cb; - char *s; + const char *s; if (!lua_isstring(L, 1)) { lua_pushnil(L); lua_pushstring(L, "Invalid arguments to callback.find."); return 2; } - s = (char *) lua_tostring(L, 1); + s = lua_tostring(L, 1); for (cb = 0; cb < total_callbacks; cb++) { if (strcmp(callbacknames[cb], s) == 0) break; diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c index 418d8439318..c07da9d0717 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c @@ -30,9 +30,7 @@ static const char _svn_version[] = # include #endif - -/* this function is in vfovf.c for the moment */ -extern int make_vf_table(lua_State * L, char *name, scaled s); +#include "inc-vfovf.h" static int get_fontid(void) { @@ -47,9 +45,9 @@ static int font_read_tfm(lua_State * L) internalfontnumber f; scaled s; int k; - char *cnom; + const char *cnom; if (lua_isstring(L, 1)) { - cnom = (char *) lua_tostring(L, 1); + cnom = lua_tostring(L, 1); if (lua_isnumber(L, 2)) { s = (integer) lua_tonumber(L, 2); if (strlen(cnom)) { @@ -82,9 +80,9 @@ static int font_read_tfm(lua_State * L) static int font_read_vf(lua_State * L) { scaled s; - char *cnom; + const char *cnom; if (lua_isstring(L, 1)) { - cnom = (char *) lua_tostring(L, 1); + cnom = lua_tostring(L, 1); if (strlen(cnom)) { if (lua_isnumber(L, 2)) { s = lua_tonumber(L, 2); diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index c72f14fe572..090f3d43d82 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -291,7 +291,7 @@ static void lua_to_image(lua_State * L, image * a) else if (lua_type(L, -1) == LUA_TNUMBER) img_width(a) = lua_tointeger(L, -1); else if (lua_type(L, -1) == LUA_TSTRING) - img_width(a) = dimen_to_number(L, (char *) lua_tostring(L, -1)); + img_width(a) = dimen_to_number(L, lua_tostring(L, -1)); else luaL_error(L, "image.width needs integer or nil value or dimension string"); @@ -305,7 +305,7 @@ static void lua_to_image(lua_State * L, image * a) else if (lua_type(L, -1) == LUA_TNUMBER) img_height(a) = lua_tointeger(L, -1); else if (lua_type(L, -1) == LUA_TSTRING) - img_height(a) = dimen_to_number(L, (char *) lua_tostring(L, -1)); + img_height(a) = dimen_to_number(L, lua_tostring(L, -1)); else luaL_error(L, "image.height needs integer or nil value or dimension string"); @@ -319,7 +319,7 @@ static void lua_to_image(lua_State * L, image * a) else if (lua_type(L, -1) == LUA_TNUMBER) img_depth(a) = lua_tointeger(L, -1); else if (lua_type(L, -1) == LUA_TSTRING) - img_depth(a) = dimen_to_number(L, (char *) lua_tostring(L, -1)); + img_depth(a) = dimen_to_number(L, lua_tostring(L, -1)); else luaL_error(L, "image.depth needs integer or nil value or dimension string"); @@ -408,7 +408,7 @@ static void lua_to_image(lua_State * L, image * a) img_bbox(d)[i - 1] = lua_tointeger(L, -1); else if (lua_type(L, -1) == LUA_TSTRING) img_bbox(d)[i - 1] = - dimen_to_number(L, (char *) lua_tostring(L, -1)); + dimen_to_number(L, lua_tostring(L, -1)); else luaL_error(L, "image.bbox table needs integer value or dimension string elements"); @@ -450,7 +450,7 @@ static void lua_to_image(lua_State * L, image * a) /**********************************************************************/ -void fix_image_size(lua_State * L, image * a) +static void fix_image_size(lua_State * L, image * a) { if (!img_is_scaled(a) || is_wd_running(a) || is_ht_running(a) || is_dp_running(a)) { @@ -460,7 +460,7 @@ void fix_image_size(lua_State * L, image * a) } } -void copy_image(lua_State * L, lua_Number scale) +static void copy_image(lua_State * L, lua_Number scale) { image *a, **aa, *b, **bb; if (lua_gettop(L) != 1) @@ -679,11 +679,11 @@ static int l_image_keys(lua_State * L) static int l_image_types(lua_State * L) { int i; - char **p; + const char **p; if (lua_gettop(L) != 0) luaL_error(L, "img.types() goes without argument"); lua_newtable(L); /* t */ - for (i = 1, p = (char **) (imgtype_s + 1); *p != NULL; p++, i++) { + for (i = 1, p = (const char **) (imgtype_s + 1); *p != NULL; p++, i++) { lua_pushinteger(L, (int) i); /* k t */ lua_pushstring(L, *p); /* v k t */ lua_settable(L, -3); /* t */ @@ -694,11 +694,11 @@ static int l_image_types(lua_State * L) static int l_image_boxes(lua_State * L) { int i; - char **p; + const char **p; if (lua_gettop(L) != 0) luaL_error(L, "img.boxes() goes without argument"); lua_newtable(L); /* t */ - for (i = 1, p = (char **) (pdfboxspec_s + 1); *p != NULL; p++, i++) { + for (i = 1, p = (const char **) (pdfboxspec_s + 1); *p != NULL; p++, i++) { lua_pushinteger(L, (int) i); /* k t */ lua_pushstring(L, *p); /* v k t */ lua_settable(L, -3); /* t */ @@ -828,7 +828,7 @@ static const struct luaL_Reg img_dict_m[] = { /**********************************************************************/ -void preset_environment(lua_State * L, const parm_struct * p) +static void preset_environment(lua_State * L, const parm_struct * p) { int i; lua_newtable(L); /* t */ diff --git a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c index 437f118942b..d4af0600dde 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c @@ -163,7 +163,7 @@ int program_name_set = 0; static int find_file(lua_State * L) { int i; - char *st; + const char *st; int ftype = kpse_tex_format; int mexist = 0; TEST_PROGRAM_NAME_SET; @@ -171,7 +171,7 @@ static int find_file(lua_State * L) lua_pushstring(L, "not a file name"); lua_error(L); } - st = (char *) lua_tostring(L, 1); + st = lua_tostring(L, 1); i = lua_gettop(L); while (i > 1) { if (lua_isboolean(L, i)) { @@ -206,7 +206,7 @@ static int lua_kpathsea_find_file(lua_State * L) int ftype = kpse_tex_format; int mexist = 0; kpathsea *kp = (kpathsea *) luaL_checkudata(L, 1, KPATHSEA_METATABLE); - char *st = (char *) luaL_checkstring(L, 2); + const char *st = luaL_checkstring(L, 2); i = lua_gettop(L); while (i > 2) { if (lua_isboolean(L, i)) { @@ -403,8 +403,8 @@ static int lua_kpathsea_new(lua_State * L) { kpathsea kpse = NULL; kpathsea *kp = NULL; - char *argv = (char *) luaL_checkstring(L, 1); - char *liar = (char *) luaL_optstring(L, 2, argv); + const char *argv = luaL_checkstring(L, 1); + const char *liar = luaL_optstring(L, 2, argv); kpse = kpathsea_new(); kpathsea_set_program_name(kpse, argv, liar); kp = (kpathsea *) lua_newuserdata(L, sizeof(kpathsea *)); diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c index 73737f24922..e71565f94b4 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llanglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llanglib.c @@ -73,7 +73,7 @@ static int lang_patterns(lua_State * L) lua_pushstring(L, "lang.patterns(): argument should be a string"); return lua_error(L); } - load_patterns(*lang_ptr, (unsigned char *) lua_tostring(L, 2)); + load_patterns(*lang_ptr, (const unsigned char *) lua_tostring(L, 2)); return 0; } else { if ((*lang_ptr)->patterns != NULL) { @@ -104,7 +104,7 @@ static int lang_hyphenation(lua_State * L) "lang.hyphenation(): argument should be a string"); return lua_error(L); } - load_hyphenation(*lang_ptr, (unsigned char *) lua_tostring(L, 2)); + load_hyphenation(*lang_ptr, (const unsigned char *) lua_tostring(L, 2)); return 0; } else { if ((*lang_ptr)->exceptions != 0) { @@ -206,7 +206,7 @@ static int do_lang_clean(lua_State * L) lua_pushstring(L, "lang.clean(): argument should be a string"); return lua_error(L); } - (void) clean_hyphenation((char *) lua_tostring(L, 1), &cleaned); + (void) clean_hyphenation(lua_tostring(L, 1), &cleaned); lua_pushstring(L, cleaned); return 1; } diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c index 67debd8c5fa..fb1fe305a55 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llualib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c @@ -38,9 +38,7 @@ static bytecode *lua_bytecode_registers = NULL; integer luabytecode_max = -1; unsigned int luabytecode_bytes = 0; -char *luanames[65536] = { NULL }; - -extern char *luanames[]; +static char *luanames[65536] = { NULL }; char *get_lua_name(int i) { @@ -159,7 +157,7 @@ static int bytecode_register_shadow_get(lua_State * L, int k) } -int writer(lua_State * L, const void *b, size_t size, void *B) +static int writer(lua_State * L, const void *b, size_t size, void *B) { bytecode *buf = (bytecode *) B; (void) L; /* for -Wunused */ @@ -173,7 +171,7 @@ int writer(lua_State * L, const void *b, size_t size, void *B) return 0; } -const char *reader(lua_State * L, void *ud, size_t * size) +static const char *reader(lua_State * L, void *ud, size_t * size) { bytecode *buf = (bytecode *) ud; (void) L; /* for -Wunused */ @@ -187,7 +185,7 @@ const char *reader(lua_State * L, void *ud, size_t * size) return (const char *) buf->buf; } -int get_bytecode(lua_State * L) +static int get_bytecode(lua_State * L) { int k; k = (int) luaL_checkinteger(L, -1); @@ -211,7 +209,7 @@ int get_bytecode(lua_State * L) return 1; } -int set_bytecode(lua_State * L) +static int set_bytecode(lua_State * L) { int k, ltype; unsigned int i; @@ -265,10 +263,10 @@ int set_bytecode(lua_State * L) } -int set_luaname(lua_State * L) +static int set_luaname(lua_State * L) { int k; - char *s; + const char *s; if (lua_gettop(L) == 3) { k = (int) luaL_checkinteger(L, 2); if (k > 65535 || k < 0) { @@ -279,7 +277,7 @@ int set_luaname(lua_State * L) luanames[k] = NULL; } if (lua_isstring(L, 3)) { - s = (char *) lua_tostring(L, 3); + s = lua_tostring(L, 3); if (s != NULL) luanames[k] = xstrdup(s); } @@ -288,7 +286,7 @@ int set_luaname(lua_State * L) return 0; } -int get_luaname(lua_State * L) +static int get_luaname(lua_State * L) { int k; k = (int) luaL_checkinteger(L, 2); @@ -316,7 +314,7 @@ static const struct luaL_reg lualib[] = { {NULL, NULL} /* sentinel */ }; -int luaopen_lua(lua_State * L, char *fname) +int luaopen_lua(lua_State * L, const char *fname) { luaL_register(L, "lua", lualib); make_table(L, "bytecode", "getbytecode", "setbytecode"); diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 76c6c72ab20..d78fea95d8c 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -29,13 +29,13 @@ static const char _svn_version[] = #define init_luaS_index(a) do { \ lua_pushliteral(L,#a); \ - luaS_##a##_ptr = (char *)lua_tostring(L,-1); \ + luaS_##a##_ptr = lua_tostring(L,-1); \ luaS_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ } while (0) #define make_luaS_index(a) \ static int luaS_##a##_index = 0; \ - static char * luaS_##a##_ptr = NULL + static const char * luaS_##a##_ptr = NULL #define luaS_index(a) luaS_##a##_index @@ -70,7 +70,7 @@ int do_get_node_type_id(lua_State * L, int n, node_info * data) { register int j; if (lua_type(L, n) == LUA_TSTRING) { - char *s = (char *) lua_tostring(L, n); + const char *s = lua_tostring(L, n); for (j = 0; data[j].id != -1; j++) { if (strcmp(s, data[j].name) == 0) return j; @@ -95,7 +95,7 @@ int get_valid_node_type_id(lua_State * L, int n) if (i == -1) { if (lua_type(L, n) == LUA_TSTRING) { lua_pushfstring(L, "Invalid node type id: %s", - (char *) lua_tostring(L, n)); + (const char *) lua_tostring(L, n)); } else { lua_pushfstring(L, "Invalid node type id: %d", (int) lua_tonumber(L, n)); @@ -112,7 +112,7 @@ int get_valid_node_subtype_id(lua_State * L, int n) if (i == -1) { if (lua_type(L, n) == LUA_TSTRING) { lua_pushfstring(L, "Invalid whatsit node id: %s", - (char *) lua_tostring(L, n)); + (const char *) lua_tostring(L, n)); } else { lua_pushfstring(L, "Invalid whatsit node id: %d", (int) lua_tonumber(L, n)); @@ -476,7 +476,7 @@ static int lua_nodelib_last_node(lua_State * L) static int lua_nodelib_hpack(lua_State * L) { halfword n, p; - char *s; + const char *s; integer w = 0; int m = 1; n = *(check_isnode(L, 1)); @@ -484,7 +484,7 @@ static int lua_nodelib_hpack(lua_State * L) w = lua_tointeger(L, 2); if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { - s = (char *) lua_tostring(L, 3); + s = lua_tostring(L, 3); if (strcmp(s, "additional") == 0) m = 1; else if (strcmp(s, "exactly") == 0) @@ -513,7 +513,7 @@ static int lua_nodelib_hpack(lua_State * L) static int lua_nodelib_vpack(lua_State * L) { halfword n, p; - char *s; + const char *s; integer w = 0; int m = 1; n = *(check_isnode(L, 1)); @@ -521,7 +521,7 @@ static int lua_nodelib_vpack(lua_State * L) w = lua_tointeger(L, 2); if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { - s = (char *) lua_tostring(L, 3); + s = lua_tostring(L, 3); if (strcmp(s, "additional") == 0) m = 1; else if (strcmp(s, "exactly") == 0) @@ -606,7 +606,7 @@ make_luaS_index(xoffset); make_luaS_index(yoffset); -void initialize_luaS_indexes(lua_State * L) +static void initialize_luaS_indexes(lua_State * L) { init_luaS_index(id); init_luaS_index(next); @@ -627,7 +627,7 @@ void initialize_luaS_indexes(lua_State * L) static int get_node_field_id(lua_State * L, int n, int node) { register int t = type(node); - register char *s = (char *) lua_tostring(L, n); + register const char *s = lua_tostring(L, n); if (luaS_ptr_eq(s, next)) { return 0; } else if (luaS_ptr_eq(s, id)) { @@ -664,7 +664,7 @@ static int get_node_field_id(lua_State * L, int n, int node) return 2; } else { int j; - char **fields = node_data[t].fields; + const char **fields = node_data[t].fields; if (t == whatsit_node) fields = whatsit_node_data[subtype(node)].fields; for (j = 0; fields[j] != NULL; j++) { @@ -681,7 +681,7 @@ static int get_valid_node_field_id(lua_State * L, int n, int node) { int i = get_node_field_id(L, n, node); if (i == -2) { - char *s = (char *) lua_tostring(L, n); + const char *s = lua_tostring(L, n); lua_pushfstring(L, "Invalid field id %s for node type %s (%d)", s, node_data[type(node)].name, subtype(node)); lua_error(L); @@ -729,7 +729,7 @@ static int lua_nodelib_whatsits(lua_State * L) static int lua_nodelib_fields(lua_State * L) { int i = -1; - char **fields; + const char **fields; int t = get_valid_node_type_id(L, 1); if (t == whatsit_node) { t = get_valid_node_subtype_id(L, 2); @@ -1971,11 +1971,11 @@ static int nodelib_getlist(lua_State * L, int n) static int nodelib_getdir(lua_State * L, int n) { - char *s = NULL; + const char *s = NULL; int d = 32; /* invalid number */ int a = -1, b = -1, c = -1; if (lua_type(L, n) == LUA_TSTRING) { - s = (char *) lua_tostring(L, n); + s = lua_tostring(L, n); if (strlen(s) == 3) { d = 0; } @@ -2021,7 +2021,7 @@ static int nodelib_getdir(lua_State * L, int n) if ((d > 31) || (d < -64) || (d < 0 && (d + 64) > 31)) { d = 0; lua_pushfstring(L, "Bad direction specifier %s", - (char *) lua_tostring(L, n)); + (const char *) lua_tostring(L, n)); lua_error(L); } return d; @@ -2035,7 +2035,7 @@ static int nodelib_getdir(lua_State * L, int n) static str_number nodelib_getstring(lua_State * L, int a) { size_t k; - char *s = (char *) lua_tolstring(L, a, &k); + const char *s = lua_tolstring(L, a, &k); return maketexlstring(s, k); } @@ -3177,7 +3177,7 @@ static int lua_nodelib_first_character(lua_State * L) /* this is too simplistic, but it helps Hans to get going */ -halfword do_ligature_n(halfword prev, halfword stop, halfword lig) +static halfword do_ligature_n(halfword prev, halfword stop, halfword lig) { vlink(lig) = vlink(stop); vlink(stop) = null; diff --git a/Build/source/texk/web2c/luatexdir/lua/loslibext.c b/Build/source/texk/web2c/luatexdir/lua/loslibext.c index 95d27a20f37..f79b0f0daf0 100644 --- a/Build/source/texk/web2c/luatexdir/lua/loslibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/loslibext.c @@ -244,10 +244,10 @@ static int spawn_command(const char *file, char *const *argv, char *const *envp) extern char **environ; -static char **do_split_command(char *maincmd) +static char **do_split_command(const char *maincmd) { char *piece, *start_piece; - char *cmd; + const char *cmd; char **cmdline = NULL; unsigned int i, j; int ret = 0; @@ -304,7 +304,7 @@ static char **do_split_command(char *maincmd) static char **do_flatten_command(lua_State * L, char **runcmd) { unsigned int i, j; - char *s; + const char *s; char **cmdline = NULL; *runcmd = NULL; @@ -322,7 +322,7 @@ static char **do_flatten_command(lua_State * L, char **runcmd) for (i = 1; i <= j; i++) { cmdline[i] = NULL; lua_rawgeti(L, -1, i); - if (lua_isnil(L, -1) || (s = (char *) lua_tostring(L, -1)) == NULL) { + if (lua_isnil(L, -1) || (s = lua_tostring(L, -1)) == NULL) { lua_pop(L, 1); if (i == 1) { xfree(cmdline); @@ -338,7 +338,7 @@ static char **do_flatten_command(lua_State * L, char **runcmd) cmdline[i] = NULL; lua_rawgeti(L, -1, 0); - if (lua_isnil(L, -1) || (s = (char *) lua_tostring(L, -1)) == NULL) { + if (lua_isnil(L, -1) || (s = lua_tostring(L, -1)) == NULL) { *runcmd = cmdline[0]; } else { *runcmd = xstrdup(s); @@ -352,7 +352,8 @@ static char **do_flatten_command(lua_State * L, char **runcmd) static int os_exec(lua_State * L) { int allow = 0; - char *maincmd = NULL, *runcmd = NULL; + const char *maincmd = NULL; + char *runcmd = NULL; char *safecmd = NULL, *cmdname = NULL; char **cmdline = NULL; @@ -367,7 +368,7 @@ static int os_exec(lua_State * L) return 2; } if (lua_type(L, 1) == LUA_TSTRING) { - maincmd = (char *) lua_tostring(L, 1); + maincmd = lua_tostring(L, 1); cmdline = do_split_command(maincmd); runcmd = cmdline[0]; } else if (lua_type(L, 1) == LUA_TTABLE) { @@ -430,7 +431,8 @@ static int os_exec(lua_State * L) static int os_spawn(lua_State * L) { int allow = 0; - char *maincmd = NULL, *runcmd = NULL; + const char *maincmd = NULL; + char *runcmd = NULL; char *safecmd = NULL, *cmdname = NULL; char **cmdline = NULL; int i; @@ -446,7 +448,7 @@ static int os_spawn(lua_State * L) return 2; } if (lua_type(L, 1) == LUA_TSTRING) { - maincmd = (char *) lua_tostring(L, 1); + maincmd = lua_tostring(L, 1); cmdline = do_split_command(maincmd); runcmd = cmdline[0]; } else if (lua_type(L, 1) == LUA_TTABLE) { @@ -516,9 +518,10 @@ static int os_spawn(lua_State * L) static int os_setenv(lua_State * L) { - char *value, *key, *val; - key = (char *) luaL_optstring(L, 1, NULL); - val = (char *) luaL_optstring(L, 2, NULL); + char *value; + const char *key, *val; + key = luaL_optstring(L, 1, NULL); + val = luaL_optstring(L, 2, NULL); if (key) { if (val) { value = xmalloc(strlen(key) + strlen(val) + 2); @@ -543,7 +546,7 @@ static int os_setenv(lua_State * L) } -void find_env(lua_State * L) +static void find_env(lua_State * L) { char *envitem, *envitem_orig; char *envkey; @@ -854,7 +857,7 @@ static char *do_mkdtemp(char *tmpl) static int os_tmpdir(lua_State * L) { char *s, *tempdir; - char *tmp = (char *) luaL_optstring(L, 1, "luatex.XXXXXX"); + const char *tmp = luaL_optstring(L, 1, "luatex.XXXXXX"); if (tmp == NULL || strlen(tmp) < 6 || (strcmp(tmp + strlen(tmp) - 6, "XXXXXX") != 0)) { lua_pushnil(L); diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 4592df64e3d..6de1ae112a9 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -40,7 +40,7 @@ static int findcurh(lua_State * L) return 1; } -int luapdfprint(lua_State * L) +static int luapdfprint(lua_State * L) { int n; unsigned i; @@ -58,7 +58,7 @@ int luapdfprint(lua_State * L) lua_pushstring(L, "invalid argument for print literal mode"); lua_error(L); } else { - outputstr = (char *) lua_tostring(L, -2); + outputstr = lua_tostring(L, -2); if (strcmp(outputstr, "direct") == 0) literal_mode = direct_always; else if (strcmp(outputstr, "page") == 0) @@ -123,9 +123,9 @@ static int l_immediateobj(lua_State * L) static int getpdf(lua_State * L) { - char *st; + const char *st; if (lua_isstring(L, 2)) { - st = (char *) lua_tostring(L, 2); + st = lua_tostring(L, 2); if (st && *st) { if (*st == 'h') return findcurh(L); diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index efc4a2e8e96..f3866f4878f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -32,16 +32,16 @@ typedef struct statistic { extern void lua_nodelib_push_fast(lua_State * L, halfword n); -typedef char *(*charfunc) (void); +typedef const char *(*charfunc) (void); typedef integer(*intfunc) (void); -char *getbanner(void) +static const char *getbanner(void) { return ptexbanner; } /* hack, I really should implement the makecstring */ -char *getfilename(void) +static char *getfilename(void) { integer t; t = get_current_name(); @@ -51,12 +51,12 @@ char *getfilename(void) return xstrdup(""); } -char *getlasterror(void) +static char *getlasterror(void) { return makecstring(last_error); } -char *luatexrevision(void) +static char *luatexrevision(void) { return makecstring(get_luatexrevision()); } @@ -144,7 +144,7 @@ static struct statistic stats[] = { }; -static int stats_name_to_id(char *name) +static int stats_name_to_id(const char *name) { int i; for (i = 0; stats[i].name != NULL; i++) { @@ -157,7 +157,7 @@ static int stats_name_to_id(char *name) static int do_getstat(lua_State * L, int i) { int t; - char *st; + const char *st; charfunc f; intfunc g; int str; @@ -204,10 +204,10 @@ static int do_getstat(lua_State * L, int i) static int getstats(lua_State * L) { - char *st; + const char *st; int i; if (lua_isstring(L, -1)) { - st = (char *) lua_tostring(L, -1); + st = lua_tostring(L, -1); i = stats_name_to_id(st); if (i > 0) { return do_getstat(L, i); diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c index 2ec99e6f6c5..458b4e240bc 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c @@ -31,7 +31,7 @@ static boolean get_selector_value(lua_State * L, int i, char *l) { boolean r = false; if (lua_isstring(L, i)) { - char *s = (char *) lua_tostring(L, i); + const char *s = lua_tostring(L, i); if (strcmp(s, "log") == 0) { *l = log_only; r = true; @@ -52,7 +52,7 @@ static boolean get_selector_value(lua_State * L, int i, char *l) static int do_texio_print(lua_State * L, texio_printer printfunction) { str_number texs; - char *s; + const char *s; size_t k; int i = 1; str_number u = 0; @@ -75,7 +75,7 @@ static int do_texio_print(lua_State * L, texio_printer printfunction) u = make_string(); for (; i <= n; i++) { if (lua_isstring(L, i)) { - s = (char *) lua_tolstring(L, i, &k); + s = lua_tolstring(L, i, &k); texs = maketexlstring(s, k); printfunction(texs); flush_str(texs); @@ -90,9 +90,9 @@ static int do_texio_print(lua_State * L, texio_printer printfunction) return 0; } -static void do_texio_ini_print(lua_State * L, char *extra) +static void do_texio_ini_print(lua_State * L, const char *extra) { - char *s; + const char *s; int i = 1; char l = term_and_log; int n = lua_gettop(L); @@ -102,7 +102,7 @@ static void do_texio_ini_print(lua_State * L, char *extra) } for (; i <= n; i++) { if (lua_isstring(L, i)) { - s = (char *) lua_tostring(L, i); + s = lua_tostring(L, i); if (l == term_and_log || l == term_only) fprintf(stdout, "%s%s", extra, s); if (l == log_only || l == term_and_log) { diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index b853515702e..8d64219dae2 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -55,10 +55,11 @@ static int spindle_index = 0; static void luac_store(lua_State * L, int i, int partial, integer cattable) { - char *st, *sttemp; + char *st; + const char *sttemp; size_t tsize; rope *rn = NULL; - sttemp = (char *) lua_tolstring(L, i, &tsize); + sttemp = lua_tolstring(L, i, &tsize); st = xmalloc((tsize + 1)); memcpy(st, sttemp, (tsize + 1)); if (st) { @@ -115,17 +116,17 @@ static int do_luacprint(lua_State * L, int partial, int deftable) return 0; } -int luacwrite(lua_State * L) +static int luacwrite(lua_State * L) { return do_luacprint(L, FULL_LINE, NO_CAT_TABLE); } -int luacprint(lua_State * L) +static int luacprint(lua_State * L) { return do_luacprint(L, FULL_LINE, DEFAULT_CAT_TABLE); } -int luacsprint(lua_State * L) +static int luacsprint(lua_State * L) { return do_luacprint(L, PARTIAL_LINE, DEFAULT_CAT_TABLE); } @@ -233,7 +234,7 @@ void luacstring_close(int n) lua_error(L); } -int dimen_to_number(lua_State * L, char *s) +int dimen_to_number(lua_State * L, const char *s) { double v; char *d; @@ -270,14 +271,14 @@ int dimen_to_number(lua_State * L, char *s) } -integer get_item_index(lua_State * L, int i, integer base) +static integer get_item_index(lua_State * L, int i, integer base) { size_t kk; integer k; int cur_cs; - char *s; + const char *s; if (lua_type(L, i) == LUA_TSTRING) { - s = (char *) lua_tolstring(L, i, &kk); + s = lua_tolstring(L, i, &kk); cur_cs = string_lookup(s, kk); if (cur_cs == static_undefined_control_sequence || is_undefined_cs(cur_cs)) { @@ -304,7 +305,7 @@ static int vsetdimen(lua_State * L, int is_global) /* find the value */ if (!lua_isnumber(L, i)) if (lua_isstring(L, i)) { - j = dimen_to_number(L, (char *) lua_tostring(L, i)); + j = dimen_to_number(L, lua_tostring(L, i)); } else { lua_pushstring(L, "unsupported value type"); lua_error(L); @@ -326,7 +327,7 @@ static int setdimen(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -370,14 +371,14 @@ static int setskip(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } return vsetskip(L, isglobal); } -int getskip(lua_State * L) +static int getskip(lua_State * L) { halfword j; integer k; @@ -415,7 +416,7 @@ static int setcount(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -459,7 +460,7 @@ static int setattribute(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -477,12 +478,12 @@ static int getattribute(lua_State * L) return 1; } -int vsettoks(lua_State * L, int is_global) +static int vsettoks(lua_State * L, int is_global) { int i, j, err; size_t len; integer k; - char *st; + const char *st; integer save_global_defs = int_par(param_global_defs_code); if (is_global) int_par(param_global_defs_code) = 1; @@ -491,7 +492,7 @@ int vsettoks(lua_State * L, int is_global) lua_pushstring(L, "unsupported value type"); lua_error(L); } - st = (char *) lua_tolstring(L, i, &len); + st = lua_tolstring(L, i, &len); k = get_item_index(L, (i - 1), get_toks_base()); check_index_range(k, "settoks"); j = maketexlstring(st, len); @@ -510,7 +511,7 @@ static int settoks(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -531,12 +532,12 @@ static int gettoks(lua_State * L) static int get_box_id(lua_State * L, int i) { - char *s; + const char *s; integer cur_cs, cur_cmd; size_t k = 0; int j = -1; if (lua_type(L, i) == LUA_TSTRING) { - s = (char *) lua_tolstring(L, i, &k); + s = lua_tolstring(L, i, &k); cur_cs = string_lookup(s, k); cur_cmd = zget_eq_type(cur_cs); if (cur_cmd == char_given_cmd || @@ -591,7 +592,7 @@ static int setbox(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -621,17 +622,17 @@ static int getboxdim(lua_State * L, int whichdim) return 1; } -int getboxwd(lua_State * L) +static int getboxwd(lua_State * L) { return getboxdim(L, width_offset); } -int getboxht(lua_State * L) +static int getboxht(lua_State * L) { return getboxdim(L, height_offset); } -int getboxdp(lua_State * L) +static int getboxdp(lua_State * L) { return getboxdim(L, depth_offset); } @@ -644,7 +645,7 @@ static int vsetboxdim(lua_State * L, int whichdim, int is_global) int_par(param_global_defs_code) = 1; i = lua_gettop(L); if (!lua_isnumber(L, i)) { - j = dimen_to_number(L, (char *) lua_tostring(L, i)); + j = dimen_to_number(L, lua_tostring(L, i)); } else { j = (int) lua_tonumber(L, i); } @@ -678,7 +679,7 @@ static int setboxwd(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -690,7 +691,7 @@ static int setboxht(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -702,16 +703,16 @@ static int setboxdp(lua_State * L) int isglobal = 0; int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } return vsetboxdim(L, depth_offset, isglobal); } -int settex(lua_State * L) +static int settex(lua_State * L) { - char *st; + const char *st; int i, j, texstr; size_t k; int cur_cs, cur_cmd; @@ -719,11 +720,11 @@ int settex(lua_State * L) j = 0; i = lua_gettop(L); if (lua_isstring(L, (i - 1))) { - st = (char *) lua_tolstring(L, (i - 1), &k); + st = lua_tolstring(L, (i - 1), &k); texstr = maketexlstring(st, k); if (is_primitive(texstr)) { if (i == 3 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) isglobal = 1; } @@ -742,7 +743,7 @@ int settex(lua_State * L) } else if (is_dim_assign(cur_cmd)) { if (!lua_isnumber(L, i)) { if (lua_isstring(L, i)) { - j = dimen_to_number(L, (char *) lua_tostring(L, i)); + j = dimen_to_number(L, lua_tostring(L, i)); } else { lua_pushstring(L, "unsupported value type"); lua_error(L); @@ -765,7 +766,8 @@ int settex(lua_State * L) return 0; } -char *get_something_internal(int cur_cmd, int cur_code) +#if 0 /* unused */ +static char *get_something_internal(int cur_cmd, int cur_code) { int texstr; char *str; @@ -780,8 +782,9 @@ char *get_something_internal(int cur_cmd, int cur_code) flush_str(texstr); return str; } +#endif -int do_convert(lua_State * L, int cur_code) +static int do_convert(lua_State * L, int cur_code) { int texstr; integer i = -1; @@ -830,7 +833,7 @@ int do_convert(lua_State * L, int cur_code) } -int do_scan_internal(lua_State * L, int cur_cmd, int cur_code) +static int do_scan_internal(lua_State * L, int cur_cmd, int cur_code) { int texstr; char *str = NULL; @@ -858,7 +861,7 @@ int do_scan_internal(lua_State * L, int cur_cmd, int cur_code) return 1; } -int do_lastitem(lua_State * L, int cur_code) +static int do_lastitem(lua_State * L, int cur_code) { int retval = 1; switch (cur_code) { @@ -945,7 +948,7 @@ static int tex_setmathparm(lua_State * L) if ((n == 3) || (n == 4)) { if (n == 4 && lua_isstring(L, 1)) { - char *s = (char *) lua_tostring(L, 1); + const char *s = lua_tostring(L, 1); if (strcmp(s, "global") == 0) l = 1; } @@ -1021,7 +1024,7 @@ static int getpdfxformname(lua_State * L) } -int get_parshape(lua_State * L) +static int get_parshape(lua_State * L) { int n; halfword par_shape_ptr = get_par_shape_ptr(); @@ -1045,7 +1048,7 @@ int get_parshape(lua_State * L) } -int gettex(lua_State * L) +static int gettex(lua_State * L) { int cur_cs = -1; int retval = 1; /* default is to return nil */ @@ -1053,7 +1056,7 @@ int gettex(lua_State * L) if (lua_isstring(L, 2)) { /* 1 == 'tex' */ int texstr; size_t k; - char *st = (char *) lua_tolstring(L, 2, &k); + const char *st = lua_tolstring(L, 2, &k); texstr = maketexlstring(st, k); cur_cs = prim_lookup(texstr); /* not found == relax == 0 */ flush_str(texstr); @@ -1099,11 +1102,11 @@ int gettex(lua_State * L) } -int getlist(lua_State * L) +static int getlist(lua_State * L) { - char *str; + const char *str; if (lua_isstring(L, 2)) { - str = (char *) lua_tostring(L, 2); + str = lua_tostring(L, 2); if (strcmp(str, "page_ins_head") == 0) { if (vlink(page_ins_head) == page_ins_head) lua_pushnumber(L, null); @@ -1147,13 +1150,13 @@ int getlist(lua_State * L) return 1; } -int setlist(lua_State * L) +static int setlist(lua_State * L) { halfword *n_ptr; - char *str; + const char *str; halfword n = 0; if (lua_isstring(L, 2)) { - str = (char *) lua_tostring(L, 2); + str = lua_tostring(L, 2); if (strcmp(str, "best_size") == 0) { best_size = lua_tointeger(L, 3); } else if (strcmp(str, "least_page_cost") == 0) { @@ -1207,7 +1210,7 @@ int setlist(lua_State * L) static int do_integer_error(double m) { - char *help[] = { "I can only go up to 2147483647='17777777777=" "7FFFFFFF,", + const char *help[] = { "I can only go up to 2147483647='17777777777=" "7FFFFFFF,", "so I'm using that number instead of yours.", NULL }; @@ -1261,14 +1264,14 @@ static int tex_scaletable(lua_State * L) static int tex_definefont(lua_State * L) { - char *csname; + const char *csname; int f, u; str_number t; size_t l; int i = 1; int a = 0; if (!no_new_control_sequence) { - char *help[] = + const char *help[] = { "You can't create a new font inside a \\csname\\endcsname pair", NULL }; @@ -1278,7 +1281,7 @@ static int tex_definefont(lua_State * L) a = lua_toboolean(L, 1); i = 2; } - csname = (char *) luaL_checklstring(L, i, &l); + csname = luaL_checklstring(L, i, &l); f = luaL_checkinteger(L, (i + 1)); t = maketexlstring(csname, l); no_new_control_sequence = 0; @@ -1347,7 +1350,7 @@ static int tex_extraprimitives(lua_State * L) } else { for (i = 1; i <= n; i++) { if (lua_isstring(L, i)) { - char *s = (char *) lua_tostring(L, i); + const char *s = lua_tostring(L, i); if (strcmp(s, "etex") == 0) { mask |= etex_command; } else if (strcmp(s, "tex") == 0) { @@ -1390,7 +1393,7 @@ static int tex_enableprimitives(lua_State * L) } else { size_t l; int i; - char *pre = (char *) luaL_checklstring(L, 1, &l); + const char *pre = luaL_checklstring(L, 1, &l); if (lua_istable(L, 2)) { int nncs = no_new_control_sequence; no_new_control_sequence = true; @@ -1398,7 +1401,7 @@ static int tex_enableprimitives(lua_State * L) while (1) { lua_rawgeti(L, 2, i); if (lua_isstring(L, 3)) { - char *prim = (char *) lua_tostring(L, 3); + const char *prim = lua_tostring(L, 3); str_number s = maketexstring(prim); halfword prim_val = prim_lookup(s); if (prim_val != undefined_primitive) { diff --git a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c index 947c6ceab8c..1ba1e609aef 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c @@ -24,8 +24,6 @@ static const char _svn_version[] = "$Id: ltokenlib.c 2448 2009-06-08 07:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/ltokenlib.c $"; -extern int get_command_id(char *); - static int max_command = 0; static int null_cs = 0; @@ -46,7 +44,7 @@ static int test_expandable(lua_State * L) if (lua_isnumber(L, -1)) { cmd = lua_tointeger(L, -1); } else if (lua_isstring(L, -1)) { - cmd = get_command_id((char *) lua_tostring(L, -1)); + cmd = get_command_id(lua_tostring(L, -1)); } if (cmd > max_command) { lua_pushboolean(L, 1); @@ -68,7 +66,7 @@ static int test_protected(lua_State * L) if (lua_isnumber(L, -1)) { chr = lua_tointeger(L, -1); } else if (lua_isstring(L, -1)) { - chr = get_command_id((char *) lua_tostring(L, -1)); + chr = get_command_id(lua_tostring(L, -1)); } if (fixmem[fixmem[chr].hhrh].hhlh == protected_token) { lua_pushboolean(L, 1); @@ -160,7 +158,7 @@ static int run_get_command_id(lua_State * L) { int cs = -1; if (lua_isstring(L, -1)) { - cs = get_command_id((char *) lua_tostring(L, -1)); + cs = get_command_id(lua_tostring(L, -1)); } lua_pushnumber(L, cs); return 1; @@ -169,10 +167,10 @@ static int run_get_command_id(lua_State * L) static int run_get_csname_id(lua_State * L) { - char *s; + const char *s; size_t k, cs = 0; if (lua_isstring(L, -1)) { - s = (char *) lua_tolstring(L, -1, &k); + s = lua_tolstring(L, -1, &k); cs = string_lookup(s, k); } lua_pushnumber(L, cs); @@ -212,12 +210,12 @@ static int run_expand(lua_State * L) static int run_lookup(lua_State * L) { - char *s; + const char *s; size_t l; integer cs, cmd, chr; int save_nncs; if (lua_isstring(L, -1)) { - s = (char *) lua_tolstring(L, -1, &l); + s = lua_tolstring(L, -1, &l); if (l > 0) { save_nncs = no_new_control_sequence; no_new_control_sequence = true; diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.c b/Build/source/texk/web2c/luatexdir/lua/luainit.c index 2f7f3bc5ccb..baa40d3cfe9 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.c +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.c @@ -77,7 +77,7 @@ const_string LUATEX_IHELP[] = { NULL }; -char *ex_selfdir(char *argv0) +static char *ex_selfdir(char *argv0) { #if defined(WIN32) char short_path[PATH_MAX], path[PATH_MAX], *fp; @@ -119,7 +119,7 @@ prepare_cmdline(lua_State * L, char **argv, int argc, int zero_offset) return; } -string input_name = NULL; +const_string input_name = NULL; static const_string user_progname = NULL; @@ -129,7 +129,7 @@ extern int program_name_set; /* in lkpselib.c */ extern char **argv; extern int argc; -char *startup_filename = NULL; +const char *startup_filename = NULL; int lua_only = 0; int lua_offset = 0; @@ -378,7 +378,7 @@ static void parse_options(int argc, char **argv) #define is_readable(a) (stat(a,&finfo)==0) && S_ISREG(finfo.st_mode) && \ (f=fopen(a,"r")) != NULL && !fclose(f) -char *find_filename(char *name, char *envkey) +static const char *find_filename(const char *name, const char *envkey) { struct stat finfo; char *dirname = NULL; @@ -406,7 +406,7 @@ char *find_filename(char *name, char *envkey) } -char *cleaned_invocation_name(char *arg) +static char *cleaned_invocation_name(char *arg) { char *ret, *dot; const char *start = xbasename(arg); @@ -418,7 +418,7 @@ char *cleaned_invocation_name(char *arg) return ret; } -void init_kpse(void) +static void init_kpse(void) { if (!user_progname) { @@ -447,7 +447,7 @@ void init_kpse(void) program_name_set = 1; } -void fix_dumpname(void) +static void fix_dumpname(void) { int dist; if (dump_name) { @@ -474,6 +474,11 @@ void lua_initialize(int ac, char **av) int pdf_table_id; int token_table_id; int node_table_id; + /* Non-const initialized variables for putenv(). */ + static char LC_CTYPE_C[] = "LC_CTYPE=C"; + static char LC_COLLATE_C[] = "LC_COLLATE=C"; + static char LC_NUMERIC_C[] = "LC_NUMERIC=C"; + static char engine_luatex[] = "engine=luatex"; /* Save to pass along to topenin. */ argc = ac; argv = av; @@ -507,12 +512,12 @@ void lua_initialize(int ac, char **av) shellenabledp = true; /* make sure that the locale is 'sane' (for lua) */ - putenv("LC_CTYPE=C"); - putenv("LC_COLLATE=C"); - putenv("LC_NUMERIC=C"); + putenv(LC_CTYPE_C); + putenv(LC_COLLATE_C); + putenv(LC_NUMERIC_C); /* this is sometimes needed */ - putenv("engine=luatex"); + putenv(engine_luatex); luainterpreter(); @@ -524,7 +529,7 @@ void lua_initialize(int ac, char **av) } /* now run the file */ if (startup_filename != NULL) { - char *v1; + const char *v1; /* hide the 'tex' and 'pdf' table */ tex_table_id = hide_lua_table(Luas, "tex"); token_table_id = hide_lua_table(Luas, "token"); @@ -544,9 +549,7 @@ void lua_initialize(int ac, char **av) get_lua_string("texconfig", "jobname", &input_name); } if (!dump_name) { - string temp; - get_lua_string("texconfig", "formatname", &temp); - dump_name = temp; + get_lua_string("texconfig", "formatname", &dump_name); } if ((lua_only) || ((!input_name) && (!dump_name))) { if (given_file) @@ -641,7 +644,7 @@ void check_texconfig_init(void) } } -void write_svnversion(char *v) +void write_svnversion(const char *v) { char *a_head, *n; char *a = strdup(v); diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.c b/Build/source/texk/web2c/luatexdir/lua/luanode.c index b35ca96c028..a9daa106920 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luanode.c +++ b/Build/source/texk/web2c/luatexdir/lua/luanode.c @@ -28,7 +28,7 @@ static const char _svn_version[] = #define info(a) fixmem[(a)].hhlh #define link(a) fixmem[(a)].hhrh -static char *group_code_names[] = { +static const char *group_code_names[] = { "", "simple", "hbox", @@ -54,10 +54,10 @@ static char *group_code_names[] = { "fin_row" }; -char *pack_type_name[] = { "exactly", "additional" }; +static const char *pack_type_name[] = { "exactly", "additional" }; -void lua_node_filter_s(int filterid, char *extrainfo) +void lua_node_filter_s(int filterid, const char *extrainfo) { lua_State *L = Luas; int s_top = lua_gettop(L); @@ -86,7 +86,7 @@ lua_node_filter(int filterid, int xextrainfo, halfword head_node, halfword ret; int a; lua_State *L = Luas; - char *extrainfo = group_code_names[xextrainfo]; + const char *extrainfo = group_code_names[xextrainfo]; int callback_id = callback_defined(filterid); if (head_node == null || vlink(head_node) == null || callback_id <= 0) return; @@ -269,10 +269,10 @@ int visible_last_node_type(int n) void lua_pdf_literal(int i) { - char *s = NULL; + const char *s; size_t l = 0; lua_rawgeti(Luas, LUA_REGISTRYINDEX, i); - s = (char *) lua_tolstring(Luas, -1, &l); + s = lua_tolstring(Luas, -1, &l); while (l--) { pdf_room(1); pdf_buf[pdf_ptr++] = *s++; @@ -324,7 +324,7 @@ void show_pdf_literal(pointer p) print_mark(pdf_literal_data(p)); } else { lua_rawgeti(Luas, LUA_REGISTRYINDEX, pdf_literal_data(p)); - tprint((char *) lua_tostring(Luas, -1)); + tprint(lua_tostring(Luas, -1)); lua_pop(Luas, 1); } } diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.c b/Build/source/texk/web2c/luatexdir/lua/luastuff.c index bcd64389856..44148f30928 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luastuff.c +++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.c @@ -25,7 +25,7 @@ static const char _svn_version[] = lua_State *Luas = NULL; -extern char *startup_filename; +extern const char *startup_filename; extern int safer_option; extern int nosocket_option; @@ -33,7 +33,7 @@ int luastate_bytes = 0; int lua_active = 0; -void make_table(lua_State * L, char *tab, char *getfunc, char *setfunc) +void make_table(lua_State * L, const char *tab, const char *getfunc, const char *setfunc) { /* make the table *//* [{}] */ lua_pushstring(L, tab); /* [{},"dimen"] */ @@ -68,7 +68,7 @@ const char *getS(lua_State * L, void *ud, size_t * size) return ls->s; } -void *my_luaalloc(void *ud, void *ptr, size_t osize, size_t nsize) +static void *my_luaalloc(void *ud, void *ptr, size_t osize, size_t nsize) { void *ret = NULL; (void) ud; /* for -Wunused */ @@ -213,7 +213,7 @@ void luainterpreter(void) Luas = L; } -int hide_lua_table(lua_State * L, char *name) +int hide_lua_table(lua_State * L, const char *name) { int r = 0; lua_getglobal(L, name); @@ -225,14 +225,14 @@ int hide_lua_table(lua_State * L, char *name) return r; } -void unhide_lua_table(lua_State * L, char *name, int r) +void unhide_lua_table(lua_State * L, const char *name, int r) { lua_rawgeti(L, LUA_REGISTRYINDEX, r); lua_setglobal(L, name); luaL_unref(L, LUA_REGISTRYINDEX, r); } -int hide_lua_value(lua_State * L, char *name, char *item) +int hide_lua_value(lua_State * L, const char *name, const char *item) { int r = 0; lua_getglobal(L, name); @@ -245,7 +245,7 @@ int hide_lua_value(lua_State * L, char *name, char *item) return r; } -void unhide_lua_value(lua_State * L, char *name, char *item, int r) +void unhide_lua_value(lua_State * L, const char *name, const char *item, int r) { lua_getglobal(L, name); if (lua_istable(L, -1)) { diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex.c b/Build/source/texk/web2c/luatexdir/lua/luatex.c index d2e8d88a839..4db4660540e 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex.c +++ b/Build/source/texk/web2c/luatexdir/lua/luatex.c @@ -331,7 +331,7 @@ void zwclose(FILE * f) /* create the dvi or pdf file */ -int open_outfile(FILE ** f, char *name, char *mode) +int open_outfile(FILE ** f, const char *name, const char *mode) { FILE *res; res = fopen(name, mode); diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.c b/Build/source/texk/web2c/luatexdir/lua/luatoken.c index bc1af10a3f6..628dbf21478 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatoken.c +++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.c @@ -177,7 +177,7 @@ command_item command_names[] = { }; -int get_command_id(char *s) +int get_command_id(const char *s) { int i; int cmd = -1; @@ -242,7 +242,7 @@ static int token_from_lua(lua_State * L) static int get_cur_cs(lua_State * L) { - char *s; + const char *s; unsigned j; size_t l; integer cs; @@ -252,7 +252,7 @@ static int get_cur_cs(lua_State * L) cur_cs = 0; lua_getfield(L, -1, "name"); if (lua_isstring(L, -1)) { - s = (char *) lua_tolstring(L, -1, &l); + s = lua_tolstring(L, -1, &l); if (l > 0) { if ((int) (last + l) > buf_size) check_buffer_overflow(last + l); @@ -307,7 +307,7 @@ static int get_cur_cs(lua_State * L) #define Print_esc(b) { \ - char *v = b; \ + const char *v = b; \ if (e>0 && e #include <../lua51/lundump.h> +#include "luatex-api.h" + static const char _svn_version[] = "$Id: texluac.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/texluac.c $"; diff --git a/Build/source/texk/web2c/luatexdir/luatex-api.h b/Build/source/texk/web2c/luatexdir/luatex-api.h index 8cb7363e216..8131eb54979 100644 --- a/Build/source/texk/web2c/luatexdir/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/luatex-api.h @@ -34,7 +34,7 @@ typedef struct LoadS { extern lua_State *Luas; -extern void make_table(lua_State * L, char *tab, char *getfunc, char *setfunc); +extern void make_table(lua_State * L, const char *tab, const char *getfunc, const char *setfunc); extern int luac_main(int argc, char *argv[]); @@ -84,7 +84,7 @@ extern int luaopen_kpse(lua_State * L); extern int luaopen_callback(lua_State * L); -extern int luaopen_lua(lua_State * L, char *fname); +extern int luaopen_lua(lua_State * L, const char *fname); extern int luaopen_stats(lua_State * L); @@ -103,21 +103,21 @@ extern int luaopen_node(lua_State * L); extern void nodelist_to_lua(lua_State * L, int n); extern int nodelist_from_lua(lua_State * L); -extern int dimen_to_number(lua_State * L, char *s); +extern int dimen_to_number(lua_State * L, const char *s); extern void dump_luac_registers(void); extern void undump_luac_registers(void); -extern void unhide_lua_table(lua_State * lua, char *name, int r); -extern int hide_lua_table(lua_State * lua, char *name); +extern void unhide_lua_table(lua_State * lua, const char *name, int r); +extern int hide_lua_table(lua_State * lua, const char *name); -extern void unhide_lua_value(lua_State * lua, char *name, char *item, int r); -extern int hide_lua_value(lua_State * lua, char *name, char *item); +extern void unhide_lua_value(lua_State * lua, const char *name, const char *item, int r); +extern int hide_lua_value(lua_State * lua, const char *name, const char *item); typedef struct command_item_ { - char *cmd_name; + const char *cmd_name; int command_offset; char **commands; } command_item; diff --git a/Build/source/texk/web2c/luatexdir/luatex.ch b/Build/source/texk/web2c/luatexdir/luatex.ch index fc099bf570e..7dd56dcb85f 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.ch +++ b/Build/source/texk/web2c/luatexdir/luatex.ch @@ -354,7 +354,7 @@ We define |input_ln| in C, for efficiency. Nevertheless we quote the module tini@/ @# @!bound_default:integer; {temporary for setup} -@!bound_name:^char; {temporary for setup} +@!bound_name:constcstring; {temporary for setup} @# @!error_line:integer; {width of context lines on terminal error messages} @!half_error_line:integer; {width of first lines of contexts in terminal @@ -1032,7 +1032,7 @@ nameoffile[namelength+1]:=0; @x @!months:packed array [1..36] of char; {abbreviations of month names} @y -@!months:^char; +@!months:constcstring; @z @x @@ -1353,7 +1353,7 @@ dump_int(@"57325458); {Web2C \TeX's magic constant: "W2TX"} {Align engine to 4 bytes with one or more trailing NUL} x:=strlen(engine_name); format_engine:=xmallocarray(packed_ASCII_code,x+4); -strcpy(stringcast(format_engine), stringcast(engine_name)); +strcpy(stringcast(format_engine), conststringcast(engine_name)); for k:=x to x+3 do format_engine[k]:=0; x:=x+4-(x mod 4); dump_int(x);dump_things(format_engine[0], x); @@ -1380,7 +1380,7 @@ if (x<0) or (x>256) then goto bad_fmt; {corrupted format file} format_engine:=xmallocarray(packed_ASCII_code, x); undump_things(format_engine[0], x); format_engine[x-1]:=0; {force string termination, just in case} -if strcmp(stringcast(engine_name), stringcast(format_engine)) then +if strcmp(conststringcast(engine_name), stringcast(format_engine)) then begin wake_up_terminal; wterm_ln('---! ', stringcast(nameoffile+1), ' was written by ', format_engine); libcfree(format_engine); diff --git a/Build/source/texk/web2c/luatexdir/luatex.h b/Build/source/texk/web2c/luatexdir/luatex.h index 2ee976b478e..0d2d84eb8da 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.h +++ b/Build/source/texk/web2c/luatexdir/luatex.h @@ -32,12 +32,12 @@ extern int readbinfile(FILE * f, unsigned char **b, integer * s); extern int **ocp_tables; -extern void allocate_ocp_table(); -extern void dump_ocp_table(); -extern void undump_ocp_table(); +extern void allocate_ocp_table(int ocp_number, int ocp_size); +extern void dump_ocp_table(int ocp_number); +extern void undump_ocp_table(int ocp_number); -extern void run_external_ocp(); -extern void b_test_in(); +extern void run_external_ocp(string external_ocp_name); +extern void b_test_in(void); /* Additions to texmfmp.h for pdfTeX */ @@ -59,10 +59,10 @@ extern void b_test_in(); #define vf_b_open_in(f) \ open_input (&(f), kpse_vf_format, FOPEN_RBIN_MODE) -extern int open_outfile(FILE ** f, char *name, char *mode); +extern int open_outfile(FILE ** f, const char *name, const char *mode); -#define do_a_open_out(f) open_outfile(&(f),(char *)(nameoffile+1),FOPEN_W_MODE) -#define do_b_open_out(f) open_outfile(&(f),(char *)(nameoffile+1),FOPEN_WBIN_MODE) +#define do_a_open_out(f) open_outfile(&(f),(const char *)(nameoffile+1),FOPEN_W_MODE) +#define do_b_open_out(f) open_outfile(&(f),(const char *)(nameoffile+1),FOPEN_WBIN_MODE) #define pdfassert assert #define voidcast(a) (void *)(a) diff --git a/Build/source/texk/web2c/luatexdir/mathcodes.c b/Build/source/texk/web2c/luatexdir/mathcodes.c index 019e38cfe13..baf51aa9be6 100644 --- a/Build/source/texk/web2c/luatexdir/mathcodes.c +++ b/Build/source/texk/web2c/luatexdir/mathcodes.c @@ -106,7 +106,7 @@ void show_mathcode_value(mathcodeval c) } -void show_mathcode(integer n) +static void show_mathcode(integer n) { mathcodeval c = get_math_code(n); if (c.origin_value == aleph_mathcode) { @@ -123,7 +123,7 @@ void show_mathcode(integer n) show_mathcode_value(c); } -void unsavemathcode(quarterword gl) +static void unsavemathcode(quarterword gl) { sa_stack_item st; if (mathcode_head->stack == NULL) @@ -214,13 +214,13 @@ integer get_math_code_num(integer n) return 0; } -void initializemathcode(void) +static void initializemathcode(void) { mathcode_head = new_sa_tree(MATHCODESTACK, MATHCODEDEFAULT); mathcode_heap = Mxmalloc_array(mathcodeval, MATHCODEHEAP); } -void dumpmathcode(void) +static void dumpmathcode(void) { integer k; mathcodeval d; @@ -236,7 +236,7 @@ void dumpmathcode(void) } } -void undumpmathcode(void) +static void undumpmathcode(void) { integer k, x; mathcodeval d; @@ -265,7 +265,7 @@ void undumpmathcode(void) } -void show_delcode(integer n) +static void show_delcode(integer n) { delcodeval c; c = get_del_code(n); @@ -313,7 +313,7 @@ void show_delcode(integer n) /* TODO: clean up the heap */ -void unsavedelcode(quarterword gl) +static void unsavedelcode(quarterword gl) { sa_stack_item st; if (delcode_head->stack == NULL) @@ -390,13 +390,13 @@ delcodeval get_del_code(integer n) } } -void initializedelcode(void) +static void initializedelcode(void) { delcode_head = new_sa_tree(DELCODESTACK, DELCODEDEFAULT); delcode_heap = Mxmalloc_array(delcodeval, DELCODEHEAP); } -void dumpdelcode(void) +static void dumpdelcode(void) { integer k; delcodeval d; @@ -414,7 +414,7 @@ void dumpdelcode(void) } } -void undumpdelcode(void) +static void undumpdelcode(void) { integer k; delcodeval d; diff --git a/Build/source/texk/web2c/luatexdir/nodes.h b/Build/source/texk/web2c/luatexdir/nodes.h index 6c74123a9f0..dc50e90d59a 100644 --- a/Build/source/texk/web2c/luatexdir/nodes.h +++ b/Build/source/texk/web2c/luatexdir/nodes.h @@ -722,8 +722,8 @@ extern pointer actual_box_width(pointer r, scaled base_width); typedef struct _node_info { int id; int size; - char **fields; - char *name; + const char **fields; + const char *name; } node_info; extern node_info node_data[]; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pagetree.c b/Build/source/texk/web2c/luatexdir/pdf/pagetree.c index fed3106a0ad..5e738695043 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pagetree.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pagetree.c @@ -69,7 +69,7 @@ static int comp_divert_list_entry(const void *pa, const void *pb, void *p) return 0; } -static pages_entry *new_pages_entry() +static pages_entry *new_pages_entry(void) { pages_entry *p; int i; @@ -83,7 +83,7 @@ static pages_entry *new_pages_entry() return p; } -static divert_list_entry *new_divert_list_entry() +static divert_list_entry *new_divert_list_entry(void) { divert_list_entry *d; d = xtalloc(1, divert_list_entry); @@ -91,7 +91,7 @@ static divert_list_entry *new_divert_list_entry() return d; } -static void ensure_list_tree() +static void ensure_list_tree(void) { if (divert_list_tree == NULL) { divert_list_tree = @@ -257,7 +257,7 @@ static integer output_pages_list(pages_entry * pe) return output_pages_list(r); /* recurse through next higher level */ } -integer output_pages_tree() +integer output_pages_tree(void) { divert_list_entry *d; pdf_do_page_undivert(0, 0); /* concatenate all diversions into diversion 0 */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pagetree.h b/Build/source/texk/web2c/luatexdir/pdf/pagetree.h index 18c8d806b6f..488c0cd129b 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pagetree.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pagetree.h @@ -22,7 +22,7 @@ #ifndef PAGETREE_H # define PAGETREE_H -integer output_pages_tree(); +integer output_pages_tree(void); integer pdf_do_page_divert(integer, integer); void pdf_do_page_undivert(integer, integer); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.c b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.c index 58700f0c3ed..cde4f128c4e 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.c @@ -45,7 +45,7 @@ static long *exp10_arr = NULL; /**********************************************************************/ -static pdfstructure *new_pdfstructure() +static pdfstructure *new_pdfstructure(void) { return xmalloc(sizeof(pdfstructure)); } @@ -65,7 +65,7 @@ static void calc_k2(pdfstructure * p) pdf2double(p->tm[0])); } -void pdf_page_init() +void pdf_page_init(void) { pdfstructure *p; int i, decimal_digits = fixed_decimal_digits; @@ -350,7 +350,7 @@ static void end_chararray(pdfstructure * p) p->mode = PMODE_TEXT; } -void pdf_end_string_nl() +void pdf_end_string_nl(void) { if (is_charmode(pstruct)) end_charmode(pstruct); @@ -374,7 +374,7 @@ static void goto_pagemode(pdfstructure * p) } } -void pdf_goto_pagemode() +void pdf_goto_pagemode(void) { goto_pagemode(pstruct); } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h index dce2c76ff6f..1c9ccb02569 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h @@ -75,9 +75,9 @@ extern pdfstructure *pstruct; /**********************************************************************/ boolean calc_pdfpos(pdfstructure * p, scaledpos * pos); -void pdf_end_string_nl(); -void pdf_goto_pagemode(); -void pdf_page_init(); +void pdf_end_string_nl(void); +void pdf_goto_pagemode(void); +void pdf_page_init(void); void pdf_place_form(scaled h, scaled v, integer i); void pdf_place_glyph(internal_font_number f, integer c); void pdf_place_rule(scaled h, scaled v, scaled wd, scaled ht); diff --git a/Build/source/texk/web2c/luatexdir/primitive.h b/Build/source/texk/web2c/luatexdir/primitive.h index 74d1cea4b04..75e6b3cffe5 100644 --- a/Build/source/texk/web2c/luatexdir/primitive.h +++ b/Build/source/texk/web2c/luatexdir/primitive.h @@ -75,7 +75,7 @@ extern void primitive(str_number ss, quarterword c, halfword o, halfword off, extern void primitive_def(char *s, size_t l, quarterword c, halfword o); extern void print_cmd_chr(quarterword cmd, halfword chr_code); -extern pointer string_lookup(char *s, size_t l); +extern pointer string_lookup(const char *s, size_t l); extern pointer id_lookup(integer j, integer l); diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index c05c6952cb6..77f8e1318f2 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -62,13 +62,13 @@ int loadpoolstrings(integer spare_size); /* tex/filename.c */ extern void scan_file_name(void); -extern void pack_job_name(char *s); -extern void prompt_file_name(char *s, char *e); +extern void pack_job_name(const char *s); +extern void prompt_file_name(const char *s, const char *e); extern str_number make_name_string(void); extern void print_file_name(str_number, str_number, str_number); /* lua/luainit.c */ -extern void write_svnversion(char *a); +extern void write_svnversion(const char *a); /* utils/writezip.c */ extern void write_zip(boolean); @@ -110,14 +110,14 @@ struct tex_language { extern struct tex_language *new_language(int n); extern struct tex_language *get_language(int n); -extern void load_patterns(struct tex_language *lang, unsigned char *buf); -extern void load_hyphenation(struct tex_language *lang, unsigned char *buf); +extern void load_patterns(struct tex_language *lang, const unsigned char *buf); +extern void load_hyphenation(struct tex_language *lang, const unsigned char *buf); extern int hyphenate_string(struct tex_language *lang, char *w, char **ret); extern void new_hyphenation(halfword h, halfword t); extern void clear_patterns(struct tex_language *lang); extern void clear_hyphenation(struct tex_language *lang); -extern char *clean_hyphenation(char *buffer, char **cleaned); +extern const char *clean_hyphenation(const char *buffer, char **cleaned); extern void hnj_hyphenation(halfword head, halfword tail); extern void set_pre_hyphen_char(integer lan, integer val); @@ -236,7 +236,7 @@ void lua_node_filter(int filterid, int extrainfo, halfword head_node, halfword * tail_node); halfword lua_vpack_filter(halfword head_node, scaled size, int pack_type, scaled maxd, int extrainfo); -void lua_node_filter_s(int filterid, char *extrainfo); +void lua_node_filter_s(int filterid, const char *extrainfo); int lua_linebreak_callback(int is_broken, halfword head_node, halfword * new_head); @@ -376,10 +376,10 @@ void pdf_print_real(integer m, integer d); # define NO_CAT_TABLE -2 # define DEFAULT_CAT_TABLE -1 -extern boolean str_eq_cstr(str_number, char *, size_t); +extern boolean str_eq_cstr(str_number, const char *, size_t); void get_next(void); extern void check_outer_validity(void); -boolean scan_keyword(char *); +boolean scan_keyword(const char *); void scan_direction(void); halfword active_to_cs(int, int); void get_token_lua(void); @@ -389,7 +389,11 @@ int get_char_cat_code(int); void tex_def_font(small_number a); -/* lcallbacklib.c */ +/* lua/ltokenlib.c */ + +extern int get_command_id(const char *); + +/* lua/lcallbacklib.c */ # include <../lua51/lua.h> @@ -435,19 +439,19 @@ extern int lua_active; # define callback_defined(a) callback_set[a] -extern int run_callback(int i, char *values, ...); -extern int run_saved_callback(int i, char *name, char *values, ...); -extern int run_and_save_callback(int i, char *values, ...); +extern int run_callback(int i, const char *values, ...); +extern int run_saved_callback(int i, const char *name, const char *values, ...); +extern int run_and_save_callback(int i, const char *values, ...); extern void destroy_saved_callback(int i); extern boolean get_callback(lua_State * L, int i); -extern void get_saved_lua_boolean(int i, char *name, boolean * target); -extern void get_saved_lua_number(int i, char *name, integer * target); -extern void get_saved_lua_string(int i, char *name, char **target); +extern void get_saved_lua_boolean(int i, const char *name, boolean * target); +extern void get_saved_lua_number(int i, const char *name, integer * target); +extern void get_saved_lua_string(int i, const char *name, const char **target); -extern void get_lua_boolean(char *table, char *name, boolean * target); -extern void get_lua_number(char *table, char *name, integer * target); -extern void get_lua_string(char *table, char *name, char **target); +extern void get_lua_boolean(const char *table, const char *name, boolean * target); +extern void get_lua_number(const char *table, const char *name, integer * target); +extern void get_lua_string(const char *table, const char *name, const char **target); extern char *get_lua_name(int i); diff --git a/Build/source/texk/web2c/luatexdir/tex/filename.c b/Build/source/texk/web2c/luatexdir/tex/filename.c index 673508384b6..271c8417fec 100644 --- a/Build/source/texk/web2c/luatexdir/tex/filename.c +++ b/Build/source/texk/web2c/luatexdir/tex/filename.c @@ -194,7 +194,7 @@ void scan_file_name(void) #define pack_cur_name() pack_file_name(cur_name,cur_area,cur_ext) -void pack_job_name(char *s) +void pack_job_name(const char *s) { /* |s = ".log"|, |".dvi"|, or |format_extension| */ cur_area = get_nullstr(); cur_ext = maketexstring(s); @@ -210,7 +210,7 @@ void pack_job_name(char *s) ready for another attempt at file opening. */ -void prompt_file_name(char *s, char *e) +void prompt_file_name(const char *s, const char *e) { int k; /* index into |buffer| */ str_number saved_cur_name; /* to catch empty terminal input */ diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.c b/Build/source/texk/web2c/luatexdir/tex/linebreak.c index 56d72233521..5cd5509389d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.c +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.c @@ -38,10 +38,10 @@ static const char _svn_version[] = static boolean no_shrink_error_yet; /*have we complained about infinite shrinkage? */ -halfword finite_shrink(halfword p) +static halfword finite_shrink(halfword p) { /* recovers from infinite shrinkage */ halfword q; /*new glue specification */ - char *hlp[] = { + const char *hlp[] = { "The paragraph just ended includes some glue that has", "infinite shrinkability, e.g., `\\hskip 0pt minus 1fil'.", "Such glue doesn't belong there---it allows a paragraph", @@ -127,14 +127,14 @@ static halfword hlist_stack[max_hlist_stack]; /* fill level for |hlist_stack| */ static short hlist_stack_level = 0; -void push_node(halfword p) +static void push_node(halfword p) { if (hlist_stack_level >= max_hlist_stack) pdf_error(maketexstring("push_node"), maketexstring("stack overflow")); hlist_stack[hlist_stack_level++] = p; } -halfword pop_node(void) +static halfword pop_node(void) { if (hlist_stack_level <= 0) /* would point to some bug */ pdf_error(maketexstring("pop_node"), @@ -149,7 +149,7 @@ static integer max_shrink_ratio = 0; /*maximal shrink ratio of expanded fonts static integer cur_font_step = 0; /*the current step of expanded fonts */ -boolean check_expand_pars(internal_font_number f) +static boolean check_expand_pars(internal_font_number f) { internal_font_number k; @@ -606,7 +606,7 @@ static scaled best_pl_glue[4]; /*corresponding glue stretch or shrink */ * only character nodes, kern nodes, and box or rule nodes. */ -void add_to_widths(halfword s, integer line_break_dir, +static void add_to_widths(halfword s, integer line_break_dir, integer pdf_adjust_spacing, scaled * widths) { while (s != null) { @@ -656,7 +656,7 @@ void add_to_widths(halfword s, integer line_break_dir, * with the |add_to_widths| function. */ -void sub_from_widths(halfword s, integer line_break_dir, +static void sub_from_widths(halfword s, integer line_break_dir, integer pdf_adjust_spacing, scaled * widths) { while (s != null) { diff --git a/Build/source/texk/web2c/luatexdir/tex/math.c b/Build/source/texk/web2c/luatexdir/tex/math.c index e8345a6160c..7ffd789063c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/math.c +++ b/Build/source/texk/web2c/luatexdir/tex/math.c @@ -166,7 +166,7 @@ will be added). */ -void unsave_math(void) +static void unsave_math(void) { unsave(); decr(save_ptr); @@ -220,7 +220,7 @@ void def_fam_fnt(integer fam_id, integer size_id, integer f, integer lvl) } } -void unsave_math_fam_data(integer gl) +static void unsave_math_fam_data(integer gl) { sa_stack_item st; if (math_fam_head->stack == NULL) @@ -283,7 +283,7 @@ scaled get_math_param(int param_id, int style_id) } -void unsave_math_param_data(integer gl) +static void unsave_math_param_data(integer gl) { sa_stack_item st; if (math_param_head->stack == NULL) @@ -516,7 +516,7 @@ and |script_script_mlist| pointing to the mlists for each style. */ -pointer new_choice(void) +static pointer new_choice(void) { /* create a choice node */ return new_node(choice_node, 0); /* the |subtype| is not used */ } @@ -584,7 +584,7 @@ void show_math_node(pointer p) /* Here are some simple routines used in the display of noads. */ -void print_fam_and_char(pointer p) +static void print_fam_and_char(pointer p) { /* prints family and character */ tprint_esc("fam"); print_int(math_fam(p)); @@ -592,7 +592,7 @@ void print_fam_and_char(pointer p) print(math_character(p)); } -void print_delimiter(pointer p) +static void print_delimiter(pointer p) { integer a; if (small_fam(p) < 0) { @@ -627,7 +627,7 @@ distinguished from a missing field, because these are not equivalent */ -void print_subsidiary_data(pointer p, ASCII_code c) +static void print_subsidiary_data(pointer p, ASCII_code c) { /* display a noad field */ if (cur_length >= depth_threshold) { if (p != null) @@ -796,7 +796,7 @@ Here is a little routine that needs to be done whenever a subformula is about to be processed. The parameter is a code like |math_group|. */ -void new_save_level_math(group_code c) +static void new_save_level_math(group_code c) { saved(0) = text_dir_ptr; text_dir_ptr = new_dir(math_direction); @@ -808,7 +808,7 @@ void new_save_level_math(group_code c) eq_word_define(static_int_base + param_level_local_dir_code, cur_level); } -void push_math(group_code c, int mstyle) +static void push_math(group_code c, int mstyle) { if (math_direction != text_direction) dir_math_save = true; @@ -819,7 +819,7 @@ void push_math(group_code c, int mstyle) new_save_level_math(c); } -void enter_ordinary_math(void) +static void enter_ordinary_math(void) { push_math(math_shift_group, text_style); eq_word_define(static_int_base + param_cur_fam_code, -1); @@ -827,7 +827,7 @@ void enter_ordinary_math(void) begin_token_list(every_math, every_math_text); } -void enter_display_math(void); +static void enter_display_math(void); /* We get into math mode from horizontal mode when a `\.\$' (i.e., a |math_shift| character) is scanned. We must check to see whether this @@ -908,7 +908,7 @@ display. Then we can set the proper values of |display_width| and */ -void enter_display_math(void) +static void enter_display_math(void) { scaled w; /* new or partial |pre_display_size| */ scaled l; /* new |display_width| */ @@ -971,9 +971,9 @@ void enter_display_math(void) #define fam_in_range ((cur_fam>=0)&&(cur_fam<256)) -delcodeval do_scan_extdef_del_code(int extcode, boolean doclass) +static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass) { - char *hlp[] = { + const char *hlp[] = { "I'm going to use 0 instead of that illegal code value.", NULL }; @@ -1076,7 +1076,7 @@ void scan_extdef_del_code(int level, int extcode) mathcodeval scan_mathchar(int extcode) { - char *hlp[] = { + const char *hlp[] = { "I'm going to use 0 instead of that illegal code value.", NULL }; @@ -1378,7 +1378,7 @@ void math_math_comp(void) void math_limit_switch(void) { - char *hlp[] = { + const char *hlp[] = { "I'm ignoring this misplaced \\limits or \\nolimits command.", NULL }; @@ -1399,7 +1399,7 @@ delimiter is to be placed; the second tells if this delimiter follows */ -void scan_delimiter(pointer p, integer r) +static void scan_delimiter(pointer p, integer r) { delcodeval dval; if (r == tex_mathcode) { /* \radical */ @@ -1435,7 +1435,7 @@ void scan_delimiter(pointer p, integer r) if (p == null) return; if (dval.small_family_value < 0) { - char *hlp[] = { + const char *hlp[] = { "I was expecting to see something like `(' or `\\{' or", "`\\}' here. If you typed, e.g., `{' instead of `\\{', you", "should probably delete the `{' by typing `1' now, so that", @@ -1512,7 +1512,7 @@ void math_ac(void) b.character_value = 0; b.family_value = 0; if (cur_cmd == accent_cmd) { - char *hlp[] = { + const char *hlp[] = { "I'm changing \\accent to \\mathaccent here; wish me luck.", "(Accents are not the same in formulas as they are in text.)", NULL @@ -1624,7 +1624,7 @@ void sub_sup(void) } if (cur_cmd == sup_mark_cmd || cur_chr == sup_mark_cmd) { /* super_sub_script */ if (supscr(tail) != null) { - char *hlp[] = { + const char *hlp[] = { "I treat `x^1^2' essentially like `x^1{}^2'.", NULL }; tail_append(new_noad()); @@ -1637,7 +1637,7 @@ void sub_sup(void) (void) scan_math(supscr(tail), sup_style(m_style)); } else if (cur_cmd == sub_mark_cmd || cur_chr == sub_mark_cmd) { if (subscr(tail) != null) { - char *hlp[] = { + const char *hlp[] = { "I treat `x_1_2' essentially like `x_1{}_2'.", NULL }; tail_append(new_noad()); @@ -1667,7 +1667,7 @@ void math_fraction(void) pointer q; c = cur_chr; if (incompleat_noad != null) { - char *hlp[] = { + const char *hlp[] = { "I'm ignoring this fraction specification, since I don't", "know whether a construction like `x \\over y \\over z'", "means `{x \\over y} \\over z' or `x \\over {y \\over z}'.", @@ -1835,13 +1835,13 @@ void math_left_right(void) if (cur_group == math_shift_group) { scan_delimiter(null, no_mathcode); if (t == middle_noad_side) { - char *hlp[] = { + const char *hlp[] = { "I'm ignoring a \\middle that had no matching \\left.", NULL }; tex_error("Extra \\middle", hlp); } else { - char *hlp[] = { + const char *hlp[] = { "I'm ignoring a \\right that had no matching \\left.", NULL }; @@ -1887,7 +1887,7 @@ static void check_second_math_shift(void) { get_x_token(); if (cur_cmd != math_shift_cmd) { - char *hlp[] = { + const char *hlp[] = { "The `$' that I just saw supposedly matches a previous `$$'.", "So I shall assume that you typed `$$' both times.", NULL @@ -1899,7 +1899,7 @@ static void check_second_math_shift(void) static void check_display_math_end(void) { if (cur_chr != cramped_display_style) { - char *hlp[] = { + const char *hlp[] = { "I shall assume that you typed that.", NULL }; @@ -1910,7 +1910,7 @@ static void check_display_math_end(void) static void check_inline_math_end(void) { if (cur_chr != cramped_text_style) { - char *hlp[] = { + const char *hlp[] = { "I shall assume that you typed that.", NULL }; @@ -1991,7 +1991,7 @@ void after_math(void) } -void resume_after_display(void) +static void resume_after_display(void) { if (cur_group != math_shift_group) tconfusion("display"); @@ -2163,7 +2163,7 @@ void finish_display_alignment(pointer p, pointer q, memory_word aux_save) { do_assignments(); if (cur_cmd != math_shift_cmd) { - char *hlp[] = { + const char *hlp[] = { "Displays can use special alignments (like \\eqalignno)", "only if nothing but the alignment itself is between $$'s.", NULL diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.c b/Build/source/texk/web2c/luatexdir/tex/mlist.c index 57143fa3c87..a1a07e4bee7 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.c +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.c @@ -166,10 +166,10 @@ Also still TODO for OpenType Math: /* this is not really a math parameter at all */ -void math_param_error(char *param, int style) +static void math_param_error(const char *param, int style) { char s[256]; - char *hlp[] = { + const char *hlp[] = { "Sorry, but I can't typeset math unless various parameters have", "been set. This is normally done by loading special math fonts", "into the math family slots. Your font set is lacking at least", @@ -1178,7 +1178,7 @@ void fixup_math_parameters(integer fam_id, integer size_id, integer f, } /* this needs to be called just at the start of |mlist_to_hlist| */ -void finalize_math_parameters(void) +static void finalize_math_parameters(void) { integer saved_trace = int_par(param_tracing_assigns_code); int_par(param_tracing_assigns_code) = 0; @@ -1218,7 +1218,7 @@ larger as the type gets smaller.) */ -char *math_size_string(integer s) +static const char *math_size_string(integer s) { if (s == text_size) return "textfont"; @@ -1246,7 +1246,7 @@ char *math_size_string(integer s) /* a simple routine that creates a flat copy of a nucleus */ -pointer math_clone(pointer q) +static pointer math_clone(pointer q) { pointer x; if (q == null) @@ -1271,7 +1271,7 @@ pointer math_clone(pointer q) that eventually contains it. */ -pointer do_fraction_rule(scaled t, pointer att) +static pointer do_fraction_rule(scaled t, pointer att) { pointer p; /* the new node */ p = new_rule(); @@ -1288,7 +1288,7 @@ pointer do_fraction_rule(scaled t, pointer att) fraction rule of thickness |t| under additional space of height |ht|. */ -pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att) +static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att) { pointer p, q; /* nodes being constructed */ p = new_kern(k); @@ -1332,7 +1332,7 @@ static pointer char_box(internal_font_number f, integer c, pointer bb) a given character: */ -scaled height_plus_depth(internal_font_number f, integer c) +static scaled height_plus_depth(internal_font_number f, integer c) { return (char_height(f, c) + char_depth(f, c)); } @@ -1344,7 +1344,7 @@ scaled height_plus_depth(internal_font_number f, integer c) of the characters already in box |b|: */ -scaled stack_into_box(pointer b, internal_font_number f, integer c) +static scaled stack_into_box(pointer b, internal_font_number f, integer c) { pointer p; /* new node placed into |b| */ p = char_box(f, c, node_attr(b)); @@ -1355,7 +1355,7 @@ scaled stack_into_box(pointer b, internal_font_number f, integer c) } -scaled stack_into_hbox(pointer b, internal_font_number f, integer c) +static scaled stack_into_hbox(pointer b, internal_font_number f, integer c) { pointer p, q; /* new node placed into |b| */ p = char_box(f, c, node_attr(b)); @@ -1376,7 +1376,7 @@ scaled stack_into_hbox(pointer b, internal_font_number f, integer c) -void add_delim_kern(pointer b, scaled s) +static void add_delim_kern(pointer b, scaled s) { pointer p; /* new node placed into |b| */ p = new_kern(s); @@ -1385,7 +1385,7 @@ void add_delim_kern(pointer b, scaled s) list_ptr(b) = p; } -void add_delim_hkern(pointer b, scaled s) +static void add_delim_hkern(pointer b, scaled s) { pointer p, q; /* new node placed into |b| */ p = new_kern(s); @@ -1404,7 +1404,7 @@ void add_delim_hkern(pointer b, scaled s) /* */ -pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, +static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, pointer att, int boxtype) { pointer b; @@ -1431,7 +1431,7 @@ pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, cur = ext; while (cur != NULL) { if (!char_exists(f, cur->glyph)) { - char *hlp[] = { + const char *hlp[] = { "Each glyph part in an extensible item should exist in the font.", "I will give up trying to find a suitable size for now. Fix your font!", NULL @@ -1446,7 +1446,7 @@ pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, num_normal++; /* no negative overlaps or advances are allowed */ if (cur->start_overlap < 0 || cur->end_overlap < 0 || cur->advance < 0) { - char *hlp[] = { + const char *hlp[] = { "All measurements in extensible items should be positive.", "To get around this problem, I have changed the font metrics.", "Fix your font!", @@ -1463,7 +1463,7 @@ pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, cur = cur->next; } if (num_normal == 0) { - char *hlp[] = { + const char *hlp[] = { "Each extensible recipe should have at least one non-repeatable part.", "To get around this problem, I have changed the first part to be", "non-repeatable. Fix your font!", @@ -1732,13 +1732,13 @@ pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v, return b; } -pointer get_delim_vbox(extinfo * ext, internal_font_number f, scaled v, +static pointer get_delim_vbox(extinfo * ext, internal_font_number f, scaled v, pointer att) { return get_delim_box(ext, f, v, att, vlist_node); } -pointer get_delim_hbox(extinfo * ext, internal_font_number f, scaled v, +static pointer get_delim_hbox(extinfo * ext, internal_font_number f, scaled v, pointer att) { return get_delim_box(ext, f, v, att, hlist_node); @@ -1763,10 +1763,10 @@ pointer get_delim_hbox(extinfo * ext, internal_font_number f, scaled v, will be the height of its topmost component. */ -void endless_loop_error(internal_font_number g, integer y) +static void endless_loop_error(internal_font_number g, integer y) { char s[256]; - char *hlp[] = { + const char *hlp[] = { "You managed to create a seemingly endless charlist chain in the current", "font. I have counted until 10000 already and still have not escaped, so" "I will jump out of the loop all by myself now. Fix your font!", @@ -1777,7 +1777,7 @@ void endless_loop_error(internal_font_number g, integer y) tex_error(s, hlp); } -pointer var_delimiter(pointer d, integer s, scaled v) +static pointer var_delimiter(pointer d, integer s, scaled v) { /* label found,continue; */ pointer b; /* the box that will be constructed */ @@ -1869,7 +1869,7 @@ pointer var_delimiter(pointer d, integer s, scaled v) return b; } -pointer flat_var_delimiter(pointer d, integer s, scaled v) +static pointer flat_var_delimiter(pointer d, integer s, scaled v) { /* label found,continue; */ pointer b; /* the box that will be constructed */ @@ -1977,7 +1977,7 @@ has been added to the width of the box; in this case a compensating kern is inserted. */ -pointer rebox(pointer b, scaled w) +static pointer rebox(pointer b, scaled w) { pointer p, q, r, att; /* temporary registers for list manipulation */ internal_font_number f; /* font in a one-character box */ @@ -2028,7 +2028,7 @@ one that is expressed in `\.{mu}', given the value of the math unit. #define mu_mult(A) mult_and_add(n,(A),xn_over_d((A),f,unity),max_dimen) -pointer math_glue(pointer g, scaled m) +static pointer math_glue(pointer g, scaled m) { pointer p; /* the new glue specification */ integer n; /* integer part of |m| */ @@ -2059,7 +2059,7 @@ The |math_kern| subroutine removes |mu_glue| from a kern node, given the value of the math unit. */ -void math_kern(pointer p, scaled m) +static void math_kern(pointer p, scaled m) { integer n; /* integer part of |m| */ scaled f; /* fraction part of |m| */ @@ -2150,7 +2150,7 @@ The box returned by |clean_box| is ``clean'' in the sense that its |shift_amount| is zero. */ -pointer clean_box(pointer p, integer s) +static pointer clean_box(pointer p, integer s) { pointer q; /* beginning of a list to be boxed */ integer save_style; /* |cur_style| to be restored */ @@ -2222,13 +2222,13 @@ after |fetch| has acted, and the field will also have been reset to |null|. internal_font_number cur_f; /* the |font| field of a |math_char| */ integer cur_c; /* the |character| field of a |math_char| */ -void fetch(pointer a) +static void fetch(pointer a) { /* unpack the |math_char| field |a| */ cur_c = math_character(a); cur_f = fam_fnt(math_fam(a), cur_size); if (cur_f == null_font) { char *msg; - char *hlp[] = { + const char *hlp[] = { "Somewhere in the math formula just ended, you used the", "stated character from an undefined font family. For example,", "plain TeX doesn't allow \\it or \\sl in subscripts. Proceed,", @@ -2266,7 +2266,7 @@ The second pass eliminates all noads and inserts the correct glue and penalties between nodes. */ -void assign_new_hlist(pointer q, pointer r) +static void assign_new_hlist(pointer q, pointer r) { switch (type(q)) { case fraction_noad: @@ -2300,7 +2300,7 @@ the general setup of such procedures, let's begin with a couple of simple ones. */ -void make_over(pointer q) +static void make_over(pointer q) { pointer p; p = overbar(clean_box(nucleus(q), cramped_style(cur_style)), @@ -2311,7 +2311,7 @@ void make_over(pointer q) type(nucleus(q)) = sub_box_node; } -void make_under(pointer q) +static void make_under(pointer q) { pointer p, x, y, r; /* temporary registers for box construction */ scaled delta; /* overall height plus depth */ @@ -2331,7 +2331,7 @@ void make_under(pointer q) type(nucleus(q)) = sub_box_node; } -void make_vcenter(pointer q) +static void make_vcenter(pointer q) { pointer v; /* the box that should be centered vertically */ scaled delta; /* its height plus depth */ @@ -2354,7 +2354,7 @@ of the nucleus plus a certain minimum clearance~|psi|. The symbol will be placed so that the actual clearance is |psi| plus half the excess. */ -void make_radical(pointer q) +static void make_radical(pointer q) { pointer x, y, p; /* temporary registers for box construction */ scaled delta, clr, theta, h; /* dimensions involved in the calculation */ @@ -2441,7 +2441,7 @@ wrapup_delimiter(pointer x, pointer y, pointer q, /* this has the |nucleus| box |x| as a limit above an extensible delimiter |y| */ -void make_over_delimiter(pointer q) +static void make_over_delimiter(pointer q) { pointer x, y, v; /* temporary registers for box construction */ scaled shift_up, shift_down, clr, delta; @@ -2464,7 +2464,7 @@ void make_over_delimiter(pointer q) /* this has the extensible delimiter |x| as a limit above |nucleus| box |y| */ -void make_delimiter_over(pointer q) +static void make_delimiter_over(pointer q) { pointer x, y, v; /* temporary registers for box construction */ scaled shift_up, shift_down, clr, delta; @@ -2490,7 +2490,7 @@ void make_delimiter_over(pointer q) /* this has the extensible delimiter |y| as a limit below a |nucleus| box |x| */ -void make_delimiter_under(pointer q) +static void make_delimiter_under(pointer q) { pointer x, y, v; /* temporary registers for box construction */ scaled shift_up, shift_down, clr, delta; @@ -2516,7 +2516,7 @@ void make_delimiter_under(pointer q) /* this has the extensible delimiter |x| as a limit below |nucleus| box |y| */ -void make_under_delimiter(pointer q) +static void make_under_delimiter(pointer q) { pointer x, y, v; /* temporary registers for box construction */ scaled shift_up, shift_down, clr, delta; @@ -2547,7 +2547,7 @@ respect to the size of the final box. #define TOP_CODE 1 #define BOT_CODE 2 -void do_make_math_accent(pointer q, internal_font_number f, integer c, +static void do_make_math_accent(pointer q, internal_font_number f, integer c, int top_or_bot) { pointer p, r, x, y; /* temporary registers for box construction */ @@ -2686,7 +2686,7 @@ void do_make_math_accent(pointer q, internal_font_number f, integer c, type(nucleus(q)) = sub_box_node; } -void make_math_accent(pointer q) +static void make_math_accent(pointer q) { if (accent_chr(q) != null) { fetch(accent_chr(q)); @@ -2711,7 +2711,7 @@ The |make_fraction| procedure is a bit different because it sets |new_hlist(q)| directly rather than making a sub-box. */ -void make_fraction(pointer q) +static void make_fraction(pointer q) { pointer p, v, x, y, z; /* temporary registers for box construction */ scaled delta, delta1, delta2, shift_up, shift_down, clr; @@ -2811,7 +2811,7 @@ the limits have been set above and below the operator. In that case, |new_hlist(q)| will already contain the desired final box. */ -scaled make_op(pointer q) +static scaled make_op(pointer q) { scaled delta; /* offset between subscript and superscript */ pointer p, v, x, y, z; /* temporary registers for box construction */ @@ -2957,7 +2957,7 @@ to a math font (i.e., a font with |space=0|). No boundary characters enter into these ligatures. */ -void make_ord(pointer q) +static void make_ord(pointer q) { integer a; /* the left-side character for lig/kern testing */ pointer p, r, s; /* temporary registers for list manipulation */ @@ -3067,7 +3067,7 @@ void make_ord(pointer q) actual images say */ -scaled math_kern_at(internal_font_number f, integer c, int side, int v) +static scaled math_kern_at(internal_font_number f, integer c, int side, int v) { int h, k, numkerns; scaled *kerns_heights; @@ -3111,7 +3111,7 @@ scaled math_kern_at(internal_font_number f, integer c, int side, int v) } -scaled +static scaled find_math_kern(internal_font_number l_f, integer l_c, internal_font_number r_f, integer r_c, int cmd, scaled shift) { @@ -3165,7 +3165,7 @@ find_math_kern(internal_font_number l_f, integer l_c, } /* just a small helper */ -pointer attach_hkern_to_new_hlist(pointer q, scaled delta2) +static pointer attach_hkern_to_new_hlist(pointer q, scaled delta2) { pointer y; pointer z = new_kern(delta2); @@ -3194,7 +3194,7 @@ baseline of subscripts and superscripts based on the given nucleus. */ -void make_scripts(pointer q, pointer p, scaled it) +static void make_scripts(pointer q, pointer p, scaled it) { pointer x, y, z; /* temporary registers for box construction */ scaled shift_up, shift_down, clr; /* dimensions in the calculation */ @@ -3371,7 +3371,7 @@ the required size and returns the value |open_noad| or |close_noad|. The so they will have consistent sizes. */ -small_number make_left_right(pointer q, integer style, scaled max_d, +static small_number make_left_right(pointer q, integer style, scaled max_d, scaled max_hv) { scaled delta, delta1, delta2; /* dimensions used in the calculation */ @@ -3501,7 +3501,7 @@ void initialize_math_spacing(void) #define both_types(A,B) ((A)*16+(B)) -pointer math_spacing_glue(int l_type, int r_type, int mstyle) +static pointer math_spacing_glue(int l_type, int r_type, int mstyle) { int x = -1; pointer z = null; diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.c b/Build/source/texk/web2c/luatexdir/tex/primitive.c index 2cbfddb4409..f98fbcd4e89 100644 --- a/Build/source/texk/web2c/luatexdir/tex/primitive.c +++ b/Build/source/texk/web2c/luatexdir/tex/primitive.c @@ -118,7 +118,7 @@ void ini_init_primitives(void) @^Vitter, Jeffrey Scott@> */ -static halfword compute_hash(char *j, pool_pointer l, halfword prime_number) +static halfword compute_hash(const char *j, pool_pointer l, halfword prime_number) { pool_pointer k; halfword h = (unsigned char) *j; @@ -294,7 +294,7 @@ void primitive_def(char *s, size_t l, quarterword c, halfword o) needed, but it helps catch errors of this kind. */ -void +static void store_primitive_name(str_number s, quarterword c, halfword o, halfword offset) { int idx; @@ -357,10 +357,10 @@ primitive(str_number ss, quarterword c, halfword o, halfword off, * Here is a helper that does the actual hash insertion. */ -static halfword insert_id(halfword p, unsigned char *j, pool_pointer l) +static halfword insert_id(halfword p, const unsigned char *j, pool_pointer l) { integer d; - unsigned char *k; + const unsigned char *k; /* This code far from ideal: the existance of |hash_extra| changes all the potential (short) coalesced lists into a single (long) one. This will create a slowdown. */ @@ -440,7 +440,7 @@ pointer id_lookup(integer j, integer l) */ -pointer string_lookup(char *s, size_t l) +pointer string_lookup(const char *s, size_t l) { /* search the hash table */ integer h; /* hash code */ pointer p; /* index in |hash| array */ @@ -454,7 +454,7 @@ pointer string_lookup(char *s, size_t l) if (no_new_control_sequence) { p = static_undefined_control_sequence; } else { - p = insert_id(p, (unsigned char *) s, l); + p = insert_id(p, (const unsigned char *) s, l); } goto FOUND; } @@ -480,7 +480,7 @@ pointer string_lookup(char *s, size_t l) #define chr_cmd(A) do { tprint(A); print(chr_code); } while (0) -void prim_cmd_chr(quarterword cmd, halfword chr_code) +static void prim_cmd_chr(quarterword cmd, halfword chr_code) { int idx = chr_code - prim_data[cmd].offset; if (cmd <= last_cmd && diff --git a/Build/source/texk/web2c/luatexdir/tex/texdeffont.c b/Build/source/texk/web2c/luatexdir/tex/texdeffont.c index 0c8e553ec70..016f12ab200 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texdeffont.c +++ b/Build/source/texk/web2c/luatexdir/tex/texdeffont.c @@ -31,7 +31,7 @@ static const char _svn_version[] = #define null_cs 1 /* equivalent of \.{\\csname\\endcsname} */ #define scan_normal_dimen() scan_dimen(false,false,false) -char *scaled_to_string(scaled s) +static char *scaled_to_string(scaled s) { /* prints scaled real, rounded to five digits */ static char result[16]; int n, k; @@ -140,7 +140,7 @@ void tex_def_font(small_number a) s = cur_val; if ((s <= 0) || (s >= 01000000000)) { char err[256]; - char *errhelp[] = + const char *errhelp[] = { "I can only handle fonts at positive sizes that are", "less than 2048pt, so I've changed what you said to 10pt.", NULL @@ -155,7 +155,7 @@ void tex_def_font(small_number a) s = -cur_val; if ((cur_val <= 0) || (cur_val > 32768)) { char err[256]; - char *errhelp[] = + const char *errhelp[] = { "The magnification ratio must be between 1 and 32768.", NULL }; @@ -171,7 +171,7 @@ void tex_def_font(small_number a) offset = cur_val; if (cur_val < 0) { char err[256]; - char *errhelp[] = { "The offset must be bigger than 0.", NULL }; + const char *errhelp[] = { "The offset must be bigger than 0.", NULL }; snprintf(err, 255, "Illegal offset has been changed to 0 (%d)", (int) cur_val); tex_error(err, errhelp); diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.c b/Build/source/texk/web2c/luatexdir/tex/texnodes.c index fe642478aaf..ca6af731ef1 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.c +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.c @@ -94,119 +94,119 @@ int copy_error(halfword p); /* define below */ #define variable_node_size 2 -char *node_fields_list[] = { "attr", "width", "depth", "height", "dir", "shift", +const char *node_fields_list[] = { "attr", "width", "depth", "height", "dir", "shift", "glue_order", "glue_sign", "glue_set", "list", NULL }; -char *node_fields_rule[] = { "attr", "width", "depth", "height", "dir", NULL }; -char *node_fields_insert[] = +const char *node_fields_rule[] = { "attr", "width", "depth", "height", "dir", NULL }; +const char *node_fields_insert[] = { "attr", "cost", "depth", "height", "spec", "list", NULL }; -char *node_fields_mark[] = { "attr", "class", "mark", NULL }; -char *node_fields_adjust[] = { "attr", "list", NULL }; -char *node_fields_disc[] = { "attr", "pre", "post", "replace", NULL }; -char *node_fields_math[] = { "attr", "surround", NULL }; -char *node_fields_glue[] = { "attr", "spec", "leader", NULL }; -char *node_fields_kern[] = { "attr", "kern", NULL }; -char *node_fields_penalty[] = { "attr", "penalty", NULL }; -char *node_fields_unset[] = +const char *node_fields_mark[] = { "attr", "class", "mark", NULL }; +const char *node_fields_adjust[] = { "attr", "list", NULL }; +const char *node_fields_disc[] = { "attr", "pre", "post", "replace", NULL }; +const char *node_fields_math[] = { "attr", "surround", NULL }; +const char *node_fields_glue[] = { "attr", "spec", "leader", NULL }; +const char *node_fields_kern[] = { "attr", "kern", NULL }; +const char *node_fields_penalty[] = { "attr", "penalty", NULL }; +const char *node_fields_unset[] = { "attr", "width", "depth", "height", "dir", "shrink", "glue_order", "glue_sign", "stretch", "span", "list", NULL }; -char *node_fields_margin_kern[] = { "attr", "width", "glyph", NULL }; -char *node_fields_glyph[] = +const char *node_fields_margin_kern[] = { "attr", "width", "glyph", NULL }; +const char *node_fields_glyph[] = { "attr", "char", "font", "lang", "left", "right", "uchyph", "components", "xoffset", "yoffset", NULL }; -char *node_fields_style[] = { "attr", "style", NULL }; -char *node_fields_choice[] = +const char *node_fields_style[] = { "attr", "style", NULL }; +const char *node_fields_choice[] = { "attr", "display", "text", "script", "scriptscript", NULL }; -char *node_fields_ord[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_op[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_bin[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_rel[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_open[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_close[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_punct[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_inner[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_under[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_over[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_vcenter[] = { "attr", "nucleus", "sub", "sup", NULL }; -char *node_fields_radical[] = +const char *node_fields_ord[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_op[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_bin[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_rel[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_open[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_close[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_punct[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_inner[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_under[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_over[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_vcenter[] = { "attr", "nucleus", "sub", "sup", NULL }; +const char *node_fields_radical[] = { "attr", "nucleus", "sub", "sup", "left", "degree", NULL }; -char *node_fields_fraction[] = +const char *node_fields_fraction[] = { "attr", "width", "num", "denom", "left", "right", NULL }; -char *node_fields_accent[] = +const char *node_fields_accent[] = { "attr", "nucleus", "sub", "sup", "accent", "bot_accent", NULL }; -char *node_fields_fence[] = { "attr", "delim", NULL }; -char *node_fields_math_char[] = { "attr", "fam", "char", NULL }; -char *node_fields_sub_box[] = { "attr", "list", NULL }; -char *node_fields_sub_mlist[] = { "attr", "list", NULL }; -char *node_fields_math_text_char[] = { "attr", "fam", "char", NULL }; -char *node_fields_delim[] = +const char *node_fields_fence[] = { "attr", "delim", NULL }; +const char *node_fields_math_char[] = { "attr", "fam", "char", NULL }; +const char *node_fields_sub_box[] = { "attr", "list", NULL }; +const char *node_fields_sub_mlist[] = { "attr", "list", NULL }; +const char *node_fields_math_text_char[] = { "attr", "fam", "char", NULL }; +const char *node_fields_delim[] = { "attr", "small_fam", "small_char", "large_fam", "large_char", NULL }; -char *node_fields_inserting[] = +const char *node_fields_inserting[] = { "height", "last_ins_ptr", "best_ins_ptr", NULL }; -char *node_fields_splitup[] = { "height", "last_ins_ptr", "best_ins_ptr", +const char *node_fields_splitup[] = { "height", "last_ins_ptr", "best_ins_ptr", "broken_ptr", "broken_ins", NULL }; -char *node_fields_action[] = { "action_type", "named_id", "action_id", +const char *node_fields_action[] = { "action_type", "named_id", "action_id", "file", "new_window", "data", "ref_count", NULL }; -char *node_fields_attribute[] = { "number", "value", NULL }; -char *node_fields_glue_spec[] = { "width", "stretch", "shrink", +const char *node_fields_attribute[] = { "number", "value", NULL }; +const char *node_fields_glue_spec[] = { "width", "stretch", "shrink", "stretch_order", "shrink_order", "ref_count", NULL }; -char *node_fields_attribute_list[] = { NULL }; +const char *node_fields_attribute_list[] = { NULL }; -char *node_fields_whatsit_open[] = +const char *node_fields_whatsit_open[] = { "attr", "stream", "name", "area", "ext", NULL }; -char *node_fields_whatsit_write[] = { "attr", "stream", "data", NULL }; -char *node_fields_whatsit_close[] = { "attr", "stream", NULL }; -char *node_fields_whatsit_special[] = { "attr", "data", NULL }; +const char *node_fields_whatsit_write[] = { "attr", "stream", "data", NULL }; +const char *node_fields_whatsit_close[] = { "attr", "stream", NULL }; +const char *node_fields_whatsit_special[] = { "attr", "data", NULL }; -char *node_fields_whatsit_local_par[] = +const char *node_fields_whatsit_local_par[] = { "attr", "pen_inter", "pen_broken", "dir", "box_left", "box_left_width", "box_right", "box_right_width", NULL }; -char *node_fields_whatsit_dir[] = +const char *node_fields_whatsit_dir[] = { "attr", "dir", "level", "dvi_ptr", "dvi_h", NULL }; -char *node_fields_whatsit_pdf_literal[] = { "attr", "mode", "data", NULL }; -char *node_fields_whatsit_pdf_refobj[] = { "attr", "objnum", NULL }; -char *node_fields_whatsit_pdf_refxform[] = +const char *node_fields_whatsit_pdf_literal[] = { "attr", "mode", "data", NULL }; +const char *node_fields_whatsit_pdf_refobj[] = { "attr", "objnum", NULL }; +const char *node_fields_whatsit_pdf_refxform[] = { "attr", "width", "height", "depth", "objnum", NULL }; -char *node_fields_whatsit_pdf_refximage[] = +const char *node_fields_whatsit_pdf_refximage[] = { "attr", "width", "height", "depth", "objnum", NULL }; -char *node_fields_whatsit_pdf_annot[] = +const char *node_fields_whatsit_pdf_annot[] = { "attr", "width", "height", "depth", "objnum", "data", NULL }; -char *node_fields_whatsit_pdf_start_link[] = +const char *node_fields_whatsit_pdf_start_link[] = { "attr", "width", "height", "depth", "objnum", "link_attr", "action", NULL }; -char *node_fields_whatsit_pdf_end_link[] = { "attr", NULL }; -char *node_fields_whatsit_pdf_dest[] = { "attr", "width", "height", "depth", +const char *node_fields_whatsit_pdf_end_link[] = { "attr", NULL }; +const char *node_fields_whatsit_pdf_dest[] = { "attr", "width", "height", "depth", "named_id", "dest_id", "dest_type", "xyz_zoom", "objnum", NULL }; -char *node_fields_whatsit_pdf_thread[] = { "attr", "width", "height", "depth", +const char *node_fields_whatsit_pdf_thread[] = { "attr", "width", "height", "depth", "named_id", "thread_id", "thread_attr", NULL }; -char *node_fields_whatsit_pdf_start_thread[] = +const char *node_fields_whatsit_pdf_start_thread[] = { "attr", "width", "height", "depth", "named_id", "thread_id", "thread_attr", NULL }; -char *node_fields_whatsit_pdf_end_thread[] = { "attr", NULL }; -char *node_fields_whatsit_pdf_save_pos[] = { "attr", NULL }; -char *node_fields_whatsit_late_lua[] = { "attr", "reg", "data", "name", NULL }; -char *node_fields_whatsit_close_lua[] = { "attr", "reg", NULL }; -char *node_fields_whatsit_pdf_colorstack[] = +const char *node_fields_whatsit_pdf_end_thread[] = { "attr", NULL }; +const char *node_fields_whatsit_pdf_save_pos[] = { "attr", NULL }; +const char *node_fields_whatsit_late_lua[] = { "attr", "reg", "data", "name", NULL }; +const char *node_fields_whatsit_close_lua[] = { "attr", "reg", NULL }; +const char *node_fields_whatsit_pdf_colorstack[] = { "attr", "stack", "cmd", "data", NULL }; -char *node_fields_whatsit_pdf_setmatrix[] = { "attr", "data", NULL }; -char *node_fields_whatsit_pdf_save[] = { "attr", NULL }; -char *node_fields_whatsit_pdf_restore[] = { "attr", NULL }; -char *node_fields_whatsit_cancel_boundary[] = { "attr", NULL }; -char *node_fields_whatsit_user_defined[] = +const char *node_fields_whatsit_pdf_setmatrix[] = { "attr", "data", NULL }; +const char *node_fields_whatsit_pdf_save[] = { "attr", NULL }; +const char *node_fields_whatsit_pdf_restore[] = { "attr", NULL }; +const char *node_fields_whatsit_cancel_boundary[] = { "attr", NULL }; +const char *node_fields_whatsit_user_defined[] = { "attr", "user_id", "type", "value", NULL }; node_info node_data[] = { @@ -743,7 +743,7 @@ static void do_free_error(halfword p) { halfword r; char errstr[255] = { 0 }; - char *errhlp[] = { + const char *errhlp[] = { "When I tried to free the node mentioned in the error message, it turned", "out it was not (or no longer) actually in use.", "Errors such as these are often caused by Lua node list alteration,", @@ -830,7 +830,7 @@ static void do_free_error(halfword p) #endif } -int free_error(halfword p) +static int free_error(halfword p) { assert(p > my_prealloc); assert(p < var_mem_max); @@ -847,7 +847,7 @@ int free_error(halfword p) static void do_copy_error(halfword p) { char errstr[255] = { 0 }; - char *errhlp[] = { + const char *errhlp[] = { "When I tried to copy the node mentioned in the error message, it turned", "out it was not (or no longer) actually in use.", "Errors such as these are often caused by Lua node list alteration,", @@ -1007,7 +1007,7 @@ void flush_node(halfword p) break; default: { - char *hlp[] = { + const char *hlp[] = { "The type of the value in a user defined whatsit node should be one", "of 'a' (attribute list), 'd' (number), 'n' (node list), 's' (string),", "or 't' (tokenlist). Yours has an unknown type, and therefore I don't", @@ -1330,7 +1330,7 @@ void check_node(halfword p) } } -void check_static_node_mem(void) +static void check_static_node_mem(void) { dotest(zero_glue, width(zero_glue), 0); dotest(zero_glue, type(zero_glue), glue_spec_node); @@ -1430,7 +1430,8 @@ halfword get_node(integer s) return slow_get_node(s); } -void print_free_chain(int c) +#if 0 /* unused */ +static void print_free_chain(int c) { halfword p = free_chain[c]; fprintf(stdout, "\nfree chain[%d] =\n ", c); @@ -1440,6 +1441,7 @@ void print_free_chain(int c) } fprintf(stdout, "null;\n"); } +#endif void free_node(halfword p, integer s) { @@ -1467,7 +1469,7 @@ void free_node(halfword p, integer s) var_used -= s; /* maintain statistics */ } -void free_node_chain(halfword q, integer s) +static void free_node_chain(halfword q, integer s) { register halfword p = q; while (vlink(p) != null) { @@ -2202,7 +2204,7 @@ void print_short_node_contents(halfword p) } -void show_pdftex_whatsit_rule_spec(integer p) +static void show_pdftex_whatsit_rule_spec(integer p) { tprint("("); print_rule_dimen(pdf_height(p)); @@ -2221,7 +2223,7 @@ other extensions might, of course, involve more subtlety here. */ -void print_write_whatsit(char *s, pointer p) +static void print_write_whatsit(const char *s, pointer p) { tprint_esc(s); if (write_stream(p) < 16) @@ -2233,7 +2235,7 @@ void print_write_whatsit(char *s, pointer p) } -void show_whatsit_node(integer p) +static void show_whatsit_node(integer p) { switch (subtype(p)) { case open_node: diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c index f8fdecbaf6c..91d5f6fc87f 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.c +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c @@ -73,7 +73,7 @@ extern void insert_vj_template(void); /* string compare */ -boolean str_eq_cstr(str_number r, char *s, size_t l) +boolean str_eq_cstr(str_number r, const char *s, size_t l) { if (l != (size_t) length(r)) return false; @@ -91,7 +91,7 @@ int get_char_cat_code(int cur_chr) static void invalid_character_error(void) { - char *hlp[] = { "A funny symbol that I can't read has just been input.", + const char *hlp[] = { "A funny symbol that I can't read has just been input.", "Continue, and I'll forget that it ever happened.", NULL }; @@ -114,7 +114,7 @@ static next_line_retval next_line(void); /* below */ static void utf_error(void) { - char *hlp[] = { "A funny symbol that I can't read has just been input.", + const char *hlp[] = { "A funny symbol that I can't read has just been input.", "Just continue, I'll change it to 0xFFFD.", NULL }; @@ -162,7 +162,7 @@ static integer qbuffer_to_unichar(integer * k) /* This is a very basic helper */ -char *u2s(unsigned unic) +static char *u2s(unsigned unic) { char *buf = xmalloc(5); char *pt = buf; @@ -211,11 +211,11 @@ char *u2s(unsigned unic) @^inner loop@> */ -boolean scan_keyword(char *s) +boolean scan_keyword(const char *s) { /* look for a given string */ pointer p; /* tail of the backup list */ pointer q; /* new node being added to the token list via |store_new_token| */ - char *k; /* index into |str_pool| */ + const char *k; /* index into |str_pool| */ pointer save_cur_cs = cur_cs; if (strlen(s) == 1) { /* @; */ @@ -340,9 +340,9 @@ halfword active_to_cs(int curchr, int force) (str_pool[str_start_macro(a)+2] == 0xBF)) -char *cs_to_string(pointer p) +static char *cs_to_string(pointer p) { /* prints a control sequence */ - char *s; + const char *s; int k = 0; static char ret[256] = { 0 }; if (p == null_cs) { @@ -380,7 +380,7 @@ char *cs_to_string(pointer p) /* TODO this is a quick hack, will be solved differently soon */ -char *cmd_chr_to_string(int cmd, int chr) +static char *cmd_chr_to_string(int cmd, int chr) { char *s; str_number str; @@ -429,14 +429,14 @@ void check_outer_validity(void) cur_chr = ' '; /* replace it by a space */ } if (scanner_status > skipping) { - char *errhlp[] = { "I suspect you have forgotten a `}', causing me", + const char *errhlp[] = { "I suspect you have forgotten a `}', causing me", "to read past where you wanted me to stop.", "I'll try to recover; but if the error is serious,", "you'd better type `E' or `X' now and fix your file.", NULL }; char errmsg[256]; - char *startmsg, *scannermsg; + const char *startmsg, *scannermsg; /* @ */ runaway(); /* print a definition, argument, or preamble */ if (cur_cs == 0) { @@ -487,19 +487,19 @@ void check_outer_validity(void) tex_error(errmsg, errhlp); } else { char errmsg[256]; - char *errhlp_no[] = + const char *errhlp_no[] = { "The file ended while I was skipping conditional text.", "This kind of error happens when you say `\\if...' and forget", "the matching `\\fi'. I've inserted a `\\fi'; this might work.", NULL }; - char *errhlp_cs[] = + const char *errhlp_cs[] = { "A forbidden control sequence occurred in skipped text.", "This kind of error happens when you say `\\if...' and forget", "the matching `\\fi'. I've inserted a `\\fi'; this might work.", NULL }; - char **errhlp = (char **) errhlp_no; + const char **errhlp = (const char **) errhlp_no; if (cur_cs != 0) { errhlp = errhlp_cs; cur_cs = 0; diff --git a/Build/source/texk/web2c/luatexdir/textcodes.c b/Build/source/texk/web2c/luatexdir/textcodes.c index 163b53ad67a..e2d8c2c824a 100644 --- a/Build/source/texk/web2c/luatexdir/textcodes.c +++ b/Build/source/texk/web2c/luatexdir/textcodes.c @@ -177,10 +177,12 @@ void unsave_cat_codes(integer h, quarterword gl) } } -void clearcatcodestack(integer h) +#if 0 /* unused */ +static void clearcatcodestack(integer h) { clear_sa_stack(catcode_heads[h]); } +#endif static void initializecatcodes(void) { diff --git a/Build/source/texk/web2c/luatexdir/utils/avl.c b/Build/source/texk/web2c/luatexdir/utils/avl.c index 79c746cd10d..0241ebd3e6b 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avl.c +++ b/Build/source/texk/web2c/luatexdir/utils/avl.c @@ -216,6 +216,8 @@ void *avl_delete(struct avl_table *tree, const void *item) struct avl_node *p; /* Traverses tree to find node to delete. */ int cmp; /* Result of comparison between |item| and |p|. */ + void *res; + assert(tree != NULL && item != NULL); k = 0; @@ -231,7 +233,7 @@ void *avl_delete(struct avl_table *tree, const void *item) if (p == NULL) return NULL; } - item = p->avl_data; + res = p->avl_data; if (p->avl_link[1] == NULL) pa[k - 1]->avl_link[da[k - 1]] = p->avl_link[0]; @@ -347,7 +349,7 @@ void *avl_delete(struct avl_table *tree, const void *item) tree->avl_count--; tree->avl_generation++; - return (void *) item; + return res; } /* Refreshes the stack of parent pointers in |trav| diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.c b/Build/source/texk/web2c/luatexdir/utils/avlstuff.c index 5c01142fd59..c2f2537cbd6 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.c +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.c @@ -166,7 +166,7 @@ static void destroy_oentry(void *pa, void *pb) xfree(p); } -void PdfObjTree_free() +void PdfObjTree_free(void) { int i; diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h index d920aace82b..a7b565c5152 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h @@ -31,6 +31,6 @@ int comp_int_entry(const void *, const void *, void *); int comp_string_entry(const void *, const void *, void *); integer avl_find_obj(integer, integer, integer); void avl_put_obj(integer, integer); -void PdfObjTree_free(); +void PdfObjTree_free(void); #endif /* AVLSTUFF_H */ diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex.c b/Build/source/texk/web2c/luatexdir/utils/synctex.c index b8bd5779e17..de51a4c8ec5 100644 --- a/Build/source/texk/web2c/luatexdir/utils/synctex.c +++ b/Build/source/texk/web2c/luatexdir/utils/synctex.c @@ -222,6 +222,8 @@ Tue Jul 1 15:23:00 UTC 2008 #define __SyncTeX__ 1 +# include "synctex.h" + # if defined(__SyncTeX__) # include @@ -300,7 +302,7 @@ void synctex_init_command(void) /* Free all memory used and close the file, * It is sent locally when there is a problem with synctex output. */ -void synctex_abort(void) +static void synctex_abort(void) { SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG @@ -967,7 +969,7 @@ void synctex_kern(halfword p, halfword this_box) void synctex_char_recorder(halfword p); /* this message is sent whenever a char node ships out */ -void synctexchar(halfword p, halfword this_box) +void synctex_char(halfword p, halfword this_box) { (void)this_box; SYNCTEX_RETURN_IF_DISABLED; @@ -996,7 +998,7 @@ void synctex_node_recorder(halfword p); /* this message should be sent to record information for a node of an unknown type */ -void synctexnode(halfword p, halfword this_box) +void synctex_node(halfword p, halfword this_box) { (void)this_box; SYNCTEX_RETURN_IF_DISABLED; diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.c b/Build/source/texk/web2c/luatexdir/utils/utils.c index 8166e4dca27..b8e715a4a64 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.c +++ b/Build/source/texk/web2c/luatexdir/utils/utils.c @@ -36,6 +36,7 @@ #include /* for DBL_EPSILON */ #include "zlib.h" #include "ptexlib.h" +#include "utils.h" #include "png.h" #ifdef POPPLER_VERSION @@ -137,7 +138,7 @@ void make_subset_tag(fd_entry * fd) for (glyph = (char *) avl_t_first(&t, fd->gl_tree); glyph != NULL; glyph = (char *) avl_t_next(&t)) { md5_append(&pms, (md5_byte_t *) glyph, strlen(glyph)); - md5_append(&pms, (md5_byte_t *) " ", 1); + md5_append(&pms, (const md5_byte_t *) " ", 1); } } md5_append(&pms, (md5_byte_t *) fd->fontname, strlen(fd->fontname)); @@ -198,7 +199,7 @@ str_number maketexlstring(const char *s, size_t l) } /* print a C string through TeX */ -void print_string(char *j) +void print_string(const char *j) { while (*j) { print_char(*j); @@ -207,7 +208,7 @@ void print_string(char *j) } /* append a C string to a TeX string */ -void append_string(char *s) +void append_string(const char *s) { if (s == NULL || *s == 0) return; @@ -298,7 +299,7 @@ void pdftex_warn(const char *fmt, ...) print_ln(); } -void tex_error(char *msg, char **hlp) +void tex_error(const char *msg, const char **hlp) { str_number aa = 0, bb = 0, cc = 0, dd = 0, ee = 0; int k = 0; @@ -548,7 +549,7 @@ scaled ext_xn_over_d(scaled x, scaled n, scaled d) return (scaled) r; } -void libpdffinish() +void libpdffinish(void) { xfree(fb_array); xfree(char_array); @@ -994,7 +995,7 @@ static void makepdftime(time_t t, char *time_str) } } -void init_start_time() +void init_start_time(void) { if (start_time == 0) { start_time = time((time_t *) NULL); @@ -1002,19 +1003,19 @@ void init_start_time() } } -void print_creation_date() +void print_creation_date(void) { init_start_time(); pdf_printf("/CreationDate (%s)\n", start_time_str); } -void print_mod_date() +void print_mod_date(void) { init_start_time(); pdf_printf("/ModDate (%s)\n", start_time_str); } -void getcreationdate() +void getcreationdate(void) { /* put creation date on top of string pool and update pool_ptr */ size_t len = strlen(start_time_str); @@ -1188,7 +1189,7 @@ static int colstacks_used = 0; procedure calls. */ #define init_colorstacks() if (colstacks_size == 0) colstacks_first_init(); -void colstacks_first_init() +static void colstacks_first_init(void) { colstacks_size = STACK_INCREMENT; colstacks = xtalloc(colstacks_size, colstack_type); @@ -1206,7 +1207,7 @@ void colstacks_first_init() colstacks[0].page_start = true; } -int colorstackused() +int colorstackused(void) { init_colorstacks(); return colstacks_used; @@ -1367,7 +1368,7 @@ integer colorstackpop(int colstack_no) return colstack->literal_mode; } -static void colorstackpagestart() +static void colorstackpagestart(void) { int i, j; colstack_type *colstack; @@ -1422,7 +1423,7 @@ static matrix_entry *matrix_stack = 0; static int matrix_stack_size = 0; static int matrix_stack_used = 0; -boolean matrixused() +boolean matrixused(void) { return matrix_stack_used > 0; } @@ -1436,7 +1437,7 @@ static pos_entry *pos_stack = 0; /* the stack */ static int pos_stack_size = 0; /* initially empty */ static int pos_stack_used = 0; /* used entries */ -void matrix_stack_room() +static void matrix_stack_room(void) { matrix_entry *new_stack; @@ -1591,22 +1592,22 @@ static scaled ret_lly; static scaled ret_urx; static scaled ret_ury; -scaled getllx() +scaled getllx(void) { return ret_llx; } -scaled getlly() +scaled getlly(void) { return ret_lly; } -scaled geturx() +scaled geturx(void) { return ret_urx; } -scaled getury() +scaled getury(void) { return ret_ury; } @@ -1620,7 +1621,7 @@ static int last_ury; #define DO_MIN(a, b) ((a < b) ? a : b) #define DO_MAX(a, b) ((a > b) ? a : b) -void do_matrixtransform(scaled x, scaled y, scaled * retx, scaled * rety) +static void do_matrixtransform(scaled x, scaled y, scaled * retx, scaled * rety) { matrix_entry *m = &matrix_stack[matrix_stack_used - 1]; double x_old = x; @@ -1755,14 +1756,14 @@ scaled divide_scaled_n(double sd, double md, double n) /* C print interface */ -void tprint(char *s) +void tprint(const char *s) { - unsigned char *ss = (unsigned char*) s; + const unsigned char *ss = (const unsigned char*) s; while (*ss) print_char(*ss++); } -void tprint_nl(char *s) +void tprint_nl(const char *s) { print_nlp(); tprint(s); @@ -1772,7 +1773,7 @@ void tprint_nl(char *s) #define int_par(a) zeqtb[static_int_base+(a)].cint /* an integer parameter */ #define escape_char int_par(escape_char_code) -void tprint_esc(char *s) +void tprint_esc(const char *s) { /* prints escape character, then |s| */ int c = -1; /* the escape character code */ if (zeqtb != NULL) { @@ -1783,7 +1784,7 @@ void tprint_esc(char *s) tprint(s); } -void tconfusion(char *s) +void tconfusion(const char *s) { confusion(maketexstring(s)); } diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.h b/Build/source/texk/web2c/luatexdir/utils/utils.h index 0e55feb50aa..138913849b2 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.h +++ b/Build/source/texk/web2c/luatexdir/utils/utils.h @@ -35,8 +35,8 @@ __attribute__ ((format(printf, 1, 2))) void pdf_printf(const char *, ...); str_number maketexstring(const char *); str_number maketexlstring(const char *, size_t); -void print_string(char *j); -void append_string(char *s); +void print_string(const char *j); +void append_string(const char *s); __attribute__ ((format(printf, 1, 2))) void tex_printf(const char *, ...); void remove_pdffile(void); @@ -44,7 +44,7 @@ __attribute__ ((noreturn, format(printf, 1, 2))) void pdftex_fail(const char *, ...); __attribute__ ((format(printf, 1, 2))) void pdftex_warn(const char *, ...); -void tex_error(char *msg, char **hlp); +void tex_error(const char *msg, const char **hlp); void garbage_warning(void); char *makecstring(integer); char *makeclstring(integer, size_t *); @@ -64,9 +64,9 @@ void escapename(poolpointer in); void escapehex(poolpointer in); void unescapehex(poolpointer in); void print_ID(str_number); -void init_start_time(); -void print_creation_date(); -void print_mod_date(); +void init_start_time(void); +void print_creation_date(void); +void print_mod_date(void); void getcreationdate(void); char *makecfilename(str_number s); char *stripzeros(char *); @@ -82,7 +82,7 @@ extern size_t last_ptr_index; /* color stack and matrix transformation support */ int newcolorstack(integer s, integer literal_mode, boolean pagestart); -int colorstackused(); +int colorstackused(void); integer colorstackset(int colstack_no, integer s); integer colorstackpush(int colstack_no, integer s); integer colorstackpop(int colstack_no); @@ -93,17 +93,17 @@ void checkpdfrestore(scaledpos pos); void pdfshipoutbegin(boolean shipping_page); void pdfshipoutend(boolean shipping_page); void pdfsetmatrix(poolpointer in, scaledpos pos); -scaled getllx(); -scaled getlly(); -scaled geturx(); -scaled getury(); -void tconfusion(char *s); -void tprint(char *s); -void tprint_nl(char *s); -void tprint_esc(char *s); +scaled getllx(void); +scaled getlly(void); +scaled geturx(void); +scaled getury(void); +void tconfusion(const char *s); +void tprint(const char *s); +void tprint_nl(const char *s); +void tprint_esc(const char *s); void matrixtransformpoint(scaled x, scaled y); void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury); -boolean matrixused(); +boolean matrixused(void); void matrixrecalculate(scaled urx); #endif /* UTILS_H */ diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 1d749252e49..11d1b25e872 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,11 @@ +2010-01-24 Peter Breitenlohner + + * mp.w (mp_execute, mp_get_char_dimension): Declare string params + as const. + * lmplib.c: #include "../luatex-api.h". + Remove 'char *' casts of Lua strings. + Declare various string variables as const. + 2009-12-05 Peter Breitenlohner * mpxout.w: Convert CRLF to native line endings. diff --git a/Build/source/texk/web2c/mplibdir/lmplib.c b/Build/source/texk/web2c/mplibdir/lmplib.c index 40ca908448b..a4fe02dcee8 100644 --- a/Build/source/texk/web2c/mplibdir/lmplib.c +++ b/Build/source/texk/web2c/mplibdir/lmplib.c @@ -32,6 +32,7 @@ # include <../lua51/lauxlib.h> # include <../lua51/lualib.h> #endif +#include "../luatex-api.h" #include "mplib.h" #include "mplibps.h" @@ -54,7 +55,7 @@ #define mplib_init_S(a) do { \ lua_pushliteral(L,#a); \ - mplib_##a##_ptr = (char *)lua_tostring(L,-1); \ + mplib_##a##_ptr = lua_tostring(L,-1); \ mplib_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ } while (0) @@ -62,11 +63,11 @@ lua_rawgeti(L,LUA_REGISTRYINDEX,mplib_##a##_index); \ } while (0) -#define mplib_is_S(a,i) (mplib_##a##_ptr==(char *)lua_tostring(L,i)) +#define mplib_is_S(a,i) (mplib_##a##_ptr==lua_tostring(L,i)) #define mplib_make_S(a) \ static int mplib_##a##_index = 0; \ - static char *mplib_##a##_ptr = NULL + static const char *mplib_##a##_ptr = NULL static int mplib_type_Ses[mp_special_code + 1] = { 0 }; /* [0] is not used */ @@ -235,7 +236,8 @@ static char *mplib_find_file(MP mp, const char *fname, const char *fmode, int ft lua_checkstack(L, 4); lua_getfield(L, LUA_REGISTRYINDEX, "mplib_file_finder"); if (lua_isfunction(L, -1)) { - char *s = NULL, *x = NULL; + char *s = NULL; + const char *x = NULL; lua_pushstring(L, fname); lua_pushstring(L, fmode); if (ftype >= mp_filetype_text) { @@ -245,10 +247,10 @@ static char *mplib_find_file(MP mp, const char *fname, const char *fmode, int ft } if (lua_pcall(L, 3, 1, 0) != 0) { fprintf(stdout, "Error in mp.find_file: %s\n", - (char *) lua_tostring(L, -1)); + lua_tostring(L, -1)); return NULL; } - x = (char *) lua_tostring(L, -1); + x = lua_tostring(L, -1); if (x != NULL) s = strdup(x); lua_pop(L, 1); /* pop the string */ @@ -328,10 +330,10 @@ static int mplib_new(lua_State * L) options->ini_version = lua_toboolean(L, -1); break; case P_MEM_NAME: - options->mem_name = strdup((char *) lua_tostring(L, -1)); + options->mem_name = strdup(lua_tostring(L, -1)); break; case P_JOB_NAME: - options->job_name = strdup((char *) lua_tostring(L, -1)); + options->job_name = strdup(lua_tostring(L, -1)); break; case P_FIND_FILE: if (mplib_find_file_function(L)) { /* error here */ @@ -422,7 +424,7 @@ static int mplib_execute(lua_State * L) MP *mp_ptr = is_mp(L, 1); if (*mp_ptr != NULL && lua_isstring(L, 2)) { size_t l; - char *s = (char *) lua_tolstring(L, 2, &l); + const char *s = lua_tolstring(L, 2, &l); int h = mp_execute(*mp_ptr, s, l); mp_run_data *res = mp_rundata(*mp_ptr); return mplib_wrapresults(L, res, h); @@ -453,7 +455,7 @@ static int mplib_char_dimension(lua_State * L, int t) { MP *mp_ptr = is_mp(L, 1); if (*mp_ptr != NULL) { - char *fname = (char *)luaL_checkstring(L,2); + const char *fname = luaL_checkstring(L,2); int charnum = (int)luaL_checkinteger(L,3); if (charnum<0 || charnum>255) { lua_pushnumber(L, (lua_Number)0); diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index fd3a06b1fef..ab6f770aaf3 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -22882,7 +22882,7 @@ if ( mp->start_sym>0 ) { /* insert the `\&{everyjob}' symbol */ } @ @c -int mp_execute (MP mp, char *s, size_t l) { +int mp_execute (MP mp, const char *s, size_t l) { mp_reset_stream(&(mp->run_data.term_out)); mp_reset_stream(&(mp->run_data.log_out)); mp_reset_stream(&(mp->run_data.error_out)); @@ -22963,7 +22963,7 @@ char * mp_metapost_version (void) { @ @= int mp_run (MP mp); -int mp_execute (MP mp, char *s, size_t l); +int mp_execute (MP mp, const char *s, size_t l); int mp_finish (MP mp); char * mp_metapost_version (void); @@ -25723,7 +25723,7 @@ font_number mp_find_font (MP mp, char *f) { @ This is an interface function for getting the width of character, as a double in ps units -@c double mp_get_char_dimension (MP mp, char *fname, int c, int t) { +@c double mp_get_char_dimension (MP mp, const char *fname, int c, int t) { unsigned n; four_quarters cc; font_number f = 0; @@ -25749,7 +25749,7 @@ as a double in ps units } @ @= -double mp_get_char_dimension (MP mp, char *fname, int n, int t); +double mp_get_char_dimension (MP mp, const char *fname, int n, int t); @ One simple application of |find_font| is the implementation of the |font_size| diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index 6f3dbc92d62..caf99d026ed 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,7 +1,9 @@ 2010-01-22 Peter Breitenlohner - * am/synctex.am: Enable compiler warnings. + * am/synctex.am (synctex_CFLAGS): Enable compiler warnings. + Avoid compiler warnings: + * synctex_main.c: Define _ISOC99_SOURCE to get fmax() prototype FIXME: Linux only? * synctex_parser_utils.h: Move declaration of synctex_io_modes ... diff --git a/Build/source/texk/web2c/texmfmp.h b/Build/source/texk/web2c/texmfmp.h index 4e9956c728f..2e1fcb08c22 100644 --- a/Build/source/texk/web2c/texmfmp.h +++ b/Build/source/texk/web2c/texmfmp.h @@ -108,7 +108,7 @@ extern void close_file_or_pipe (FILE *); #endif /* Executing shell commands. */ -extern void mk_shellcmdlist (char *); +extern void mk_shellcmdlist (const char *); extern void init_shell_escape (void); extern int shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname); extern int runsystem (const char *cmd); @@ -388,7 +388,7 @@ extern boolean open_out_or_pipe (FILE **, const_string fopen_mode); extern void close_file_or_pipe (FILE *); /* Executing shell commands. */ -extern void mk_shellcmdlist (char *); +extern void mk_shellcmdlist (const char *); extern void init_shell_escape (void); extern int shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname); extern int runsystem (const char *cmd); -- cgit v1.2.3