From fe3f8b9c55ab825497837f98fad165d9ed75560f Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 7 Oct 2015 13:00:49 +0000 Subject: Lua(JIT)TeX: Simplify the build system git-svn-id: svn://tug.org/texlive/trunk@38577 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/ChangeLog | 6 + Build/source/texk/web2c/luatexdir/am/libluatex.am | 18 +- .../source/texk/web2c/luatexdir/am/luafontforge.am | 38 ++-- Build/source/texk/web2c/luatexdir/am/luatex.am | 2 +- .../texk/web2c/luatexdir/luafontloader/ChangeLog | 6 + .../web2c/luatexdir/luafontloader/src/ffdummies.c | 23 +-- .../web2c/luatexdir/luafontloader/src/ffdummies.h | 54 +++++ .../web2c/luatexdir/luafontloader/src/luafflib.c | 222 ++++++++++----------- 8 files changed, 201 insertions(+), 168 deletions(-) create mode 100644 Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.h (limited to 'Build/source/texk/web2c/luatexdir') diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 2d30d67b1c3..968b230ad78 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,9 @@ +2015-10-07 Peter Breitenlohner + + * am/libluatex.am, am/luafontforge.am: Rearrange to compile the + luafontloader/src/* files as part of liblua(jit)tex.a, such that + there is only one libff.a used for LuaTeX and LuaJITTeX. + 2015-10-07 Akira Kakuto * Sync with the upstream trunk. diff --git a/Build/source/texk/web2c/luatexdir/am/libluatex.am b/Build/source/texk/web2c/luatexdir/am/libluatex.am index 19fc671a3fe..6fffb43de4a 100644 --- a/Build/source/texk/web2c/luatexdir/am/libluatex.am +++ b/Build/source/texk/web2c/luatexdir/am/libluatex.am @@ -13,12 +13,15 @@ LUA_DEPEND = $(LUA52_DEPEND) ## EXTRA_LIBRARIES += libluatex.a libluajittex.a -libluatex_a_DEPENDENCIES = libff.a -libluajittex_a_DEPENDENCIES = libjitff.a +libluatex_a_DEPENDENCIES = libff.a libluamisc.a +libluajittex_a_DEPENDENCIES = libff.a libluajitmisc.a libluatex_a_preflags = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) libluatex_a_preflags += $(POPPLER_INCLUDES) -I$(srcdir)/libmd5 libluatex_a_preflags += -DpdfTeX -I$(srcdir)/luatexdir +libluatex_a_preflags += -I$(srcdir)/luatexdir/unilib +libluatex_a_preflags += -I$(srcdir)/luatexdir/luafontloader/fontforge/inc +libluatex_a_preflags += -DLUA_FF_LIB=1 -I$(srcdir)/luatexdir/luafontloader/fontforge/fontforge libluatex_a_preflags += -DSYNCTEX_ENGINE_H='' -I$(srcdir)/synctexdir libluatex_a_CPPFLAGS = $(libluatex_a_preflags) $(LUA_INCLUDES) @@ -42,8 +45,8 @@ nodist_libluajittex_a_SOURCES = \ $(dist_libluatex_sources) \ $(nodist_libluatex_sources) -$(libluatex_a_OBJECTS): libff.a libmplib.a $(POPPLER_DEPEND) -$(libluajittex_a_OBJECTS): libjitff.a libmplib.a $(POPPLER_DEPEND) +$(libluatex_a_OBJECTS): libff.a libmplib.a libluamisc.a $(POPPLER_DEPEND) +$(libluajittex_a_OBJECTS): libff.a libmplib.a libluajitmisc.a $(POPPLER_DEPEND) ## from luatexdir ## @@ -57,6 +60,13 @@ dist_libluatex_sources = \ luatexdir/luatex-common.h \ luatexdir/ptexlib.h +## from luatexdir/luafontloader/src +## +dist_libluatex_sources += \ + luatexdir/luafontloader/src/ffdummies.c \ + luatexdir/luafontloader/src/ffdummies.h \ + luatexdir/luafontloader/src/luafflib.c + ## from luatexdir/dvi ## luatex_dvi_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/luatexdir/dvi $(ctangle) diff --git a/Build/source/texk/web2c/luatexdir/am/luafontforge.am b/Build/source/texk/web2c/luatexdir/am/luafontforge.am index e629ca20061..3707f894d9b 100644 --- a/Build/source/texk/web2c/luatexdir/am/luafontforge.am +++ b/Build/source/texk/web2c/luatexdir/am/luafontforge.am @@ -1,36 +1,26 @@ ## texk/web2c/luatexdir/am/luafontforge.am: Makefile fragment for libff. ## -## Copyright (C) 2009-2014 Peter Breitenlohner +## Copyright (C) 2009-2015 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## luafontforge ## -EXTRA_LIBRARIES += libff.a libjitff.a +EXTRA_LIBRARIES += libff.a -libff_a_DEPENDENCIES = libunilib.a libluamisc.a -libjitff_a_DEPENDENCIES = libunilib.a libluajitmisc.a +$(libff_a_OBJECTS): libunilib.a -$(libff_a_OBJECTS): $(libff_a_DEPENDENCIES) -$(libjitff_a_OBJECTS): $(libjitff_a_DEPENDENCIES) +libff_a_CPPFLAGS = $(AM_CPPFLAGS) \ + -DLUA_FF_LIB=1 -D_NO_PYTHON=1 -DX_DISPLAY_MISSING=1 -DUSE_OUR_MEMORY=1 \ + -I$(srcdir)/w2c \ + -I$(srcdir)/luatexdir \ + -I$(srcdir)/luatexdir/unilib \ + -I$(srcdir)/luatexdir/luafontloader/fontforge/inc \ + -I$(srcdir)/luatexdir/luafontloader/fontforge/fontforge -libff_a_postflags = -DLUA_FF_LIB=1 -D_NO_PYTHON=1 -DX_DISPLAY_MISSING=1 \ - -DUSE_OUR_MEMORY=1 \ - -I$(top_srcdir)/w2c \ - -I$(top_srcdir)/luatexdir \ - -I$(top_srcdir)/luatexdir/unilib \ - -I$(top_srcdir)/luatexdir/luafontloader/fontforge/inc \ - -I$(top_srcdir)/luatexdir/luafontloader/fontforge/fontforge - -libff_a_CPPFLAGS = $(AM_CPPFLAGS) $(LUA_INCLUDES) $(libff_a_postflags) -libjitff_a_CPPFLAGS = $(AM_CPPFLAGS) $(LUAJIT_INCLUDES) -DLuajitTeX $(libff_a_postflags) libff_a_CFLAGS = # $(WARNING_CFLAGS) -libjitff_a_CFLAGS = # $(WARNING_CFLAGS) - -nodist_libff_a_SOURCES = $(libff_sources) -nodist_libjitff_a_SOURCES = $(libff_sources) -libff_sources = \ +libff_a_SOURCES = \ luatexdir/luafontloader/fontforge/fontforge/PfEd.h \ luatexdir/luafontloader/fontforge/fontforge/autohint.c \ luatexdir/luafontloader/fontforge/fontforge/baseviews.h \ @@ -96,11 +86,7 @@ libff_sources = \ luatexdir/luafontloader/fontforge/inc/basics.h \ luatexdir/luafontloader/fontforge/inc/gfile.h \ luatexdir/luafontloader/fontforge/inc/gimage.h \ - luatexdir/luafontloader/fontforge/inc/intl.h \ - luatexdir/luafontloader/src/ffdummies.c \ - luatexdir/luafontloader/src/luafflib.c - -EXTRA_DIST += $(libff_sources) + luatexdir/luafontloader/fontforge/inc/intl.h ## Not used ## diff --git a/Build/source/texk/web2c/luatexdir/am/luatex.am b/Build/source/texk/web2c/luatexdir/am/luatex.am index ac147077c94..891a11030d5 100644 --- a/Build/source/texk/web2c/luatexdir/am/luatex.am +++ b/Build/source/texk/web2c/luatexdir/am/luatex.am @@ -53,7 +53,7 @@ luatex_postldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS) luatex_postldadd += $(LDADD) libmputil.a libunilib.a libmd5.a $(lua_socketlibs) luatex_LDADD = libluatex.a libff.a libluamisc.a libluasocket.a $(LUA_LIBS) $(luatex_postldadd) -luajittex_LDADD = libluajittex.a libjitff.a libluajitmisc.a libluajitsocket.a $(LUAJIT_LIBS) $(luatex_postldadd) +luajittex_LDADD = libluajittex.a libff.a libluajitmisc.a libluajitsocket.a $(LUAJIT_LIBS) $(luatex_postldadd) luatex_depend = $(proglib) $(KPATHSEA_DEPEND) $(LIBPNG_DEPEND) libmputil.a libmd5.a luatex_DEPENDENCIES = $(luatex_depend) libluatex.a diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/ChangeLog b/Build/source/texk/web2c/luatexdir/luafontloader/ChangeLog index 69b334350ec..59837dcef46 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/luafontloader/ChangeLog @@ -1,3 +1,9 @@ +2015-10-07 Peter Breitenlohner + + * src/ffdummies.h (new): Declare functions and variables. + * src/ffdummies.c, src/luafflib.c: Include src/ffdummies.h for + prototypes, use static functions and const variables. + 2013-11-16 Akira Kakuto * src/luafflib.c: Values of italicangle were inconsistent between diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c index b8006290a1c..1ac523b56eb 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c +++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c @@ -19,20 +19,9 @@ /* some dummy functions and variables so that a few ff source files can be ignored */ -#include "uiinterface.h" -#include "fontforgevw.h" -#include "splinefont.h" -#include -#include -#include -#include - +#include "ffdummies.h" - -/* fix for non-gcc compilation: */ -#if !defined(__GNUC__) || (__GNUC__ < 2) -# define __attribute__(x) -#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ +#include char **gww_errors = NULL; int gww_error_count = 0; @@ -91,7 +80,7 @@ static void LUAUI__LogError(const char *format, va_list ap) /* this is not static because it is used by gwwiconv.c */ __attribute__ ((format(printf, 1, 2))) -void LUAUI_LogError(const char *format, ...) +static void LUAUI_LogError(const char *format, ...) { va_list ap; va_start(ap, format); @@ -158,7 +147,7 @@ static char *LUAUI_ask_string(const char *title, const char *def, (void) title; (void) def; (void) question; - return ((char *) def); + return def ? strdup(def) : NULL; } static char *LUAUI_open_file(const char *title, const char *defaultfile, @@ -282,12 +271,14 @@ void ScriptPrint(FontViewBase * fv, int type, int32 * pointsizes, (void) outputfile; } -int PdfDumpGlyphResources(void *pi, SplineChar * sc) +#if 0 /* unused */ +static int PdfDumpGlyphResources(void *pi, SplineChar * sc) { (void) pi; (void) sc; return 0; } +#endif /* autotrace.c */ int autotrace_ask = 0, mf_ask = 0, mf_clearbackgrounds = 0, mf_showerrors = 0; diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.h b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.h new file mode 100644 index 00000000000..951df818cf1 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.h @@ -0,0 +1,54 @@ +/* ffdummies.c + + Copyright 2015 Taco Hoekwater + + This file is part of LuaTeX. + + LuaTeX is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your + option) any later version. + + LuaTeX is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU General Public License along + with LuaTeX; if not, see . */ + +#ifndef _FFDUMMIES_H +#define _FFDUMMIES_H + +#include "uiinterface.h" +#include "fontforgevw.h" +#include "splinefont.h" +#include +#include +#include + +#include +#ifdef LuajitTeX +#include +#else +#include +#endif +#include +#include + +/* fix for non-gcc compilation: */ +#if !defined(__GNUC__) || (__GNUC__ < 2) +# define __attribute__(x) +#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ + +extern char **gww_errors; +extern int gww_error_count; +extern void gwwv_errors_free(void); +extern struct ui_interface luaui_interface; + +extern int readbinfile(FILE * f, unsigned char **b, int *s); + +extern char *SaveTablesPref; +extern char *coord_sep; + +#endif /* _FFDUMMIES_H */ diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c index 3f2ce922bf7..61a2e79349f 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c +++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c @@ -27,22 +27,8 @@ #include "ustring.h" #include "lib/lib.h" /* web2c's lib, for recorder_record_input */ -#include -#include -#ifdef LuajitTeX -#include -#else -#include -#endif -#include - - -extern char **gww_errors; -extern int gww_error_count; -extern void gwwv_errors_free(void); -extern struct ui_interface luaui_interface; - -extern int readbinfile(FILE * f, unsigned char **b, int *s); +#include "ffdummies.h" +#include "splinefont.h" #define FONT_METATABLE "fontloader.splinefont" #define FONT_SUBFONT_METATABLE "fontloader.splinefont.subfont" @@ -51,7 +37,7 @@ extern int readbinfile(FILE * f, unsigned char **b, int *s); #define LUA_OTF_VERSION "0.4" -static char *possub_type_enum[] = { +static const char *possub_type_enum[] = { "null", "position", "pair", "substitution", "alternate", "multiple", "ligature", "lcaret", "kerning", "vkerning", "anchors", "contextpos", @@ -63,7 +49,7 @@ static char *possub_type_enum[] = { #define eight_nulls() NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -static char *otf_lookup_type_enum[] = { +static const char *otf_lookup_type_enum[] = { "gsub_start", "gsub_single", "gsub_multiple", "gsub_alternate", "gsub_ligature", "gsub_context", "gsub_contextchain", NULL, "gsub_reversecontextchain", NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*0x00F */ @@ -103,21 +89,21 @@ static char *otf_lookup_type_enum[] = { }; -static char *anchor_type_enum[] = { +static const char *anchor_type_enum[] = { "mark", "basechar", "baselig", "basemark", "centry", "cexit", "max", NULL }; #define MAX_ANCHOR_TYPE 7 -static char *anchorclass_type_enum[] = { +static const char *anchorclass_type_enum[] = { "mark", "mkmk", "curs", "mklg", NULL }; -static char *glyph_class_enum[] = { +static const char *glyph_class_enum[] = { "automatic", "none", "base", "ligature", "mark", "component", NULL }; -static char *ttfnames_enum[ttf_namemax] = { +static const char *ttfnames_enum[ttf_namemax] = { "copyright", "family", "subfamily", "uniqueid", "fullname", "version", "postscriptname", "trademark", "manufacturer", "designer", "descriptor", "venderurl", @@ -126,14 +112,14 @@ static char *ttfnames_enum[ttf_namemax] = { "cidfindfontname", "wwsfamily", "wwssubfamily" }; -static char *fpossub_format_enum[] = { +static const char *fpossub_format_enum[] = { "glyphs", "class", "coverage", "reversecoverage", NULL }; -static char *tex_type_enum[4] = { "unset", "text", "math", "mathext" }; +static const char *tex_type_enum[4] = { "unset", "text", "math", "mathext" }; /* has an offset of 1, ui_none = 0. */ -static char *uni_interp_enum[9] = { +static const char *uni_interp_enum[9] = { "unset", "none", "adobe", "greek", "japanese", "trad_chinese", "simp_chinese", "korean", "ams" }; @@ -141,20 +127,16 @@ static char *uni_interp_enum[9] = { #define check_isfont(L,b) (SplineFont **)luaL_checkudata(L,b,FONT_METATABLE) #define check_isglyph(L,b) (struct splinechar **)luaL_checkudata(L,b,FONT_GLYPH_METATABLE) -void handle_generic_pst(lua_State * L, struct generic_pst *pst); /* forward */ -void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst); /* forward */ -void handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name); -void handle_anchorclass(lua_State * L, struct anchorclass *anchor); -void handle_splinefont(lua_State * L, struct splinefont *sf); -void handle_kernpair(lua_State * L, struct kernpair *kp); -void handle_splinecharlist(lua_State * L, struct splinecharlist *scl); -void handle_liglist(lua_State * L, struct liglist *ligofme); -void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor); -void handle_glyphvariants(lua_State * L, struct glyphvariants *vars); -void handle_mathkern(lua_State * L, struct mathkern *mk); -int handle_altuni(lua_State * L, struct altuni *au); - -int is_userdata(lua_State *L, int b, char *utype) +/* forward declarations */ +static void handle_generic_pst(lua_State * L, struct generic_pst *pst); +static void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst); +static void handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name); +static void handle_splinefont(lua_State * L, struct splinefont *sf); +static void handle_kernpair(lua_State * L, struct kernpair *kp); +static void handle_liglist(lua_State * L, struct liglist *ligofme); +static void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor); + +static int is_userdata(lua_State *L, int b, const char *utype) { if (lua_type(L,b) == LUA_TUSERDATA) { lua_getmetatable(L, b); @@ -170,7 +152,7 @@ int is_userdata(lua_State *L, int b, char *utype) -void lua_ff_pushfont(lua_State * L, SplineFont * sf) +static void lua_ff_pushfont(lua_State * L, SplineFont * sf) { SplineFont **a; if (sf == NULL) { @@ -184,7 +166,7 @@ void lua_ff_pushfont(lua_State * L, SplineFont * sf) return; } -void lua_ff_pushsubfont(lua_State * L, SplineFont * sf) +static void lua_ff_pushsubfont(lua_State * L, SplineFont * sf) { SplineFont **a; if (sf == NULL) { @@ -198,7 +180,7 @@ void lua_ff_pushsubfont(lua_State * L, SplineFont * sf) return; } -void lua_ff_pushglyph(lua_State * L, struct splinechar *sc) +static void lua_ff_pushglyph(lua_State * L, struct splinechar *sc) { struct splinechar **a; if (sc == NULL) { @@ -358,7 +340,7 @@ static int ff_apply_afmfile(lua_State * L) -static void dump_intfield(lua_State * L, char *name, long int field) +static void dump_intfield(lua_State * L, const char *name, long int field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -366,7 +348,7 @@ static void dump_intfield(lua_State * L, char *name, long int field) lua_rawset(L, -3); } -static void dump_uintfield(lua_State * L, char *name, unsigned int field) +static void dump_uintfield(lua_State * L, const char *name, unsigned int field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -374,7 +356,7 @@ static void dump_uintfield(lua_State * L, char *name, unsigned int field) lua_rawset(L, -3); } -static void dump_realfield(lua_State * L, char *name, real field) +static void dump_realfield(lua_State * L, const char *name, real field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -386,7 +368,7 @@ static void dump_realfield(lua_State * L, char *name, real field) #define dump_cond_intfield(a,b,c) if ((c)!=0) { dump_intfield ((a),(b),(c)); } -static void dump_stringfield(lua_State * L, char *name, char *field) +static void dump_stringfield(lua_State * L, const char *name, const char *field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -403,7 +385,7 @@ static void dump_char_ref(lua_State * L, struct splinechar *spchar) } -static void dump_lstringfield(lua_State * L, char *name, char *field, int len) +static void dump_lstringfield(lua_State * L, const char *name, char *field, int len) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -411,7 +393,7 @@ static void dump_lstringfield(lua_State * L, char *name, char *field, int len) lua_rawset(L, -3); } -static void dump_enumfield(lua_State * L, char *name, int fid, char **fields) +static void dump_enumfield(lua_State * L, const char *name, int fid, const char **fields) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -419,7 +401,7 @@ static void dump_enumfield(lua_State * L, char *name, int fid, char **fields) lua_rawset(L, -3); } -static void dump_floatfield(lua_State * L, char *name, double field) +static void dump_floatfield(lua_State * L, const char *name, double field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -438,11 +420,8 @@ static char *make_tag_string(unsigned int field) return (char *) tag_string; } -static char featbuf[32] = { 0 }; - - -static void dump_tag(lua_State * L, char *name, unsigned int field) +static void dump_tag(lua_State * L, const char *name, unsigned int field) { lua_checkstack(L, 2); lua_pushstring(L, name); @@ -450,7 +429,7 @@ static void dump_tag(lua_State * L, char *name, unsigned int field) lua_rawset(L, -3); } -void dump_subtable_name(lua_State * L, char *name, struct lookup_subtable *s) +static void dump_subtable_name(lua_State * L, const char *name, struct lookup_subtable *s) { /* this is likely a backref */ if (s == NULL) @@ -501,7 +480,7 @@ void dump_subtable_name(lua_State * L, char *name, struct lookup_subtable *s) } } -void do_handle_scriptlanglist(lua_State * L, struct scriptlanglist *sl) +static void do_handle_scriptlanglist(lua_State * L, struct scriptlanglist *sl) { int k; dump_tag(L, "script", sl->script); @@ -526,13 +505,13 @@ void do_handle_scriptlanglist(lua_State * L, struct scriptlanglist *sl) lua_setfield(L, -2, "langs"); } -void handle_scriptlanglist(lua_State * L, struct scriptlanglist *sll) +static void handle_scriptlanglist(lua_State * L, struct scriptlanglist *sll) { struct scriptlanglist *next; NESTED_TABLE(do_handle_scriptlanglist, sll, 4); } -void +static void do_handle_featurescriptlanglist(lua_State * L, struct featurescriptlanglist *features) { @@ -542,7 +521,7 @@ do_handle_featurescriptlanglist(lua_State * L, lua_setfield(L, -2, "scripts"); } -void +static void handle_featurescriptlanglist(lua_State * L, struct featurescriptlanglist *features) { @@ -550,7 +529,7 @@ handle_featurescriptlanglist(lua_State * L, NESTED_TABLE(do_handle_featurescriptlanglist, features, 3); } -void do_handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable) +static void do_handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable) { dump_stringfield(L, "name", subtable->subtable_name); @@ -583,13 +562,13 @@ void do_handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable) /* int32 *extra_subtables; *//* used by OTF file generation */ } -void handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable) +static void handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable) { struct lookup_subtable *next; NESTED_TABLE(do_handle_lookup_subtable, subtable, 2); } -int do_handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont * sf) +static int do_handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont * sf) { int mc; @@ -656,13 +635,13 @@ int do_handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont * sf) return 1; } -void handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont * sf) +static void handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont * sf) { struct otlookup *next; NESTED_TABLE_SF(do_handle_lookup, lookup, sf, 18); /* 18 is a guess */ } -void do_handle_kernpair(lua_State * L, struct kernpair *kp) +static void do_handle_kernpair(lua_State * L, struct kernpair *kp) { if (kp->sc != NULL) @@ -672,13 +651,13 @@ void do_handle_kernpair(lua_State * L, struct kernpair *kp) dump_subtable_name(L, "lookup", kp->subtable); } -void handle_kernpair(lua_State * L, struct kernpair *kp) +static void handle_kernpair(lua_State * L, struct kernpair *kp) { struct kernpair *next; NESTED_TABLE(do_handle_kernpair, kp, 4); } -void handle_splinecharlist(lua_State * L, struct splinecharlist *scl) +static void handle_splinecharlist(lua_State * L, struct splinecharlist *scl) { struct splinecharlist *next = scl; @@ -706,7 +685,7 @@ void handle_splinecharlist(lua_State * L, struct splinecharlist *scl) /* NOTE: GlyphInfo displays vs==-1 as vs==0, and fixes things up */ -int handle_altuni(lua_State * L, struct altuni *au) +static int handle_altuni(lua_State * L, struct altuni *au) { struct altuni *next = au; int i = 0; @@ -733,7 +712,7 @@ int handle_altuni(lua_State * L, struct altuni *au) #define interesting_vr(a) (((a)->xoff!=0) || ((a)->yoff!=0) || ((a)->h_adv_off!=0) || ((a)->v_adv_off!=0)) -void handle_vr(lua_State * L, struct vr *pos) +static void handle_vr(lua_State * L, struct vr *pos) { dump_cond_intfield(L, "x", pos->xoff); @@ -743,7 +722,7 @@ void handle_vr(lua_State * L, struct vr *pos) } -void do_handle_generic_pst(lua_State * L, struct generic_pst *pst) +static void do_handle_generic_pst(lua_State * L, struct generic_pst *pst) { int k; if (pst->type > LAST_POSSUB_TYPE_ENUM) { @@ -799,7 +778,7 @@ void do_handle_generic_pst(lua_State * L, struct generic_pst *pst) } -void handle_generic_pst(lua_State * L, struct generic_pst *pst) +static void handle_generic_pst(lua_State * L, struct generic_pst *pst) { struct generic_pst *next; int k; @@ -837,7 +816,7 @@ void handle_generic_pst(lua_State * L, struct generic_pst *pst) } } -void do_handle_liglist(lua_State * L, struct liglist *ligofme) +static void do_handle_liglist(lua_State * L, struct liglist *ligofme) { lua_checkstack(L, 2); if (ligofme->lig != NULL) { @@ -855,13 +834,13 @@ void do_handle_liglist(lua_State * L, struct liglist *ligofme) } -void handle_liglist(lua_State * L, struct liglist *ligofme) +static void handle_liglist(lua_State * L, struct liglist *ligofme) { struct liglist *next; NESTED_TABLE(do_handle_liglist, ligofme, 3); } -void do_handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) +static void do_handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) { if (anchor->anchor == NULL) { @@ -921,7 +900,7 @@ void do_handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) } -void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) +static void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) { struct anchorpoint *next; next = anchor; @@ -931,7 +910,7 @@ void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor) } } -void handle_glyphvariants(lua_State * L, struct glyphvariants *vars) +static void handle_glyphvariants(lua_State * L, struct glyphvariants *vars) { int i; dump_stringfield(L, "variants", vars->variants); @@ -949,7 +928,7 @@ void handle_glyphvariants(lua_State * L, struct glyphvariants *vars) lua_setfield(L, -2, "parts"); } -void handle_mathkernvertex(lua_State * L, struct mathkernvertex *mkv) +static void handle_mathkernvertex(lua_State * L, struct mathkernvertex *mkv) { int i; for (i = 0; i < mkv->cnt; i++) { @@ -960,7 +939,7 @@ void handle_mathkernvertex(lua_State * L, struct mathkernvertex *mkv) } } -void handle_mathkern(lua_State * L, struct mathkern *mk) +static void handle_mathkern(lua_State * L, struct mathkern *mk) { lua_newtable(L); handle_mathkernvertex(L, &(mk->top_right)); @@ -978,7 +957,7 @@ void handle_mathkern(lua_State * L, struct mathkern *mk) -void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics) +static void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics) { DBounds bb; if (glyph->xmax == 0 && glyph->ymax == 0 && glyph->xmin == 0 @@ -1144,41 +1123,41 @@ void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics) } } -char *panose_values_0[] = +const char *panose_values_0[] = { "Any", "No Fit", "Text and Display", "Script", "Decorative", "Pictorial" }; -char *panose_values_1[] = +const char *panose_values_1[] = { "Any", "No Fit", "Cove", "Obtuse Cove", "Square Cove", "Obtuse Square Cove", "Square", "Thin", "Bone", "Exaggerated", "Triangle", "Normal Sans", "Obtuse Sans", "Perp Sans", "Flared", "Rounded" }; -char *panose_values_2[] = +const char *panose_values_2[] = { "Any", "No Fit", "Very Light", "Light", "Thin", "Book", "Medium", "Demi", "Bold", "Heavy", "Black", "Nord" }; -char *panose_values_3[] = +const char *panose_values_3[] = { "Any", "No Fit", "Old Style", "Modern", "Even Width", "Expanded", "Condensed", "Very Expanded", "Very Condensed", "Monospaced" }; -char *panose_values_4[] = +const char *panose_values_4[] = { "Any", "No Fit", "None", "Very Low", "Low", "Medium Low", "Medium", "Medium High", "High", "Very High" }; -char *panose_values_5[] = +const char *panose_values_5[] = { "Any", "No Fit", "Gradual/Diagonal", "Gradual/Transitional", "Gradual/Vertical", "Gradual/Horizontal", "Rapid/Vertical", "Rapid/Horizontal", "Instant/Vertical" }; -char *panose_values_6[] = +const char *panose_values_6[] = { "Any", "No Fit", "Straight Arms/Horizontal", "Straight Arms/Wedge", "Straight Arms/Vertical", "Straight Arms/Single Serif", "Straight Arms/Double Serif", @@ -1188,7 +1167,7 @@ char *panose_values_6[] = "Non-Straight Arms/Double Serif" }; -char *panose_values_7[] = +const char *panose_values_7[] = { "Any", "No Fit", "Normal/Contact", "Normal/Weighted", "Normal/Boxed", "Normal/Flattened", "Normal/Rounded", "Normal/Off Center", "Normal/Square", "Oblique/Contact", @@ -1197,7 +1176,7 @@ char *panose_values_7[] = "Oblique/Off Center", "Oblique/Square" }; -char *panose_values_8[] = +const char *panose_values_8[] = { "Any", "No Fit", "Standard/Trimmed", "Standard/Pointed", "Standard/Serifed", "High/Trimmed", "High/Pointed", "High/Serifed", "Constant/Trimmed", "Constant/Pointed", @@ -1205,7 +1184,7 @@ char *panose_values_8[] = "Low/Trimmed", "Low/Pointed", "Low/Serifed" }; -char *panose_values_9[] = +const char *panose_values_9[] = { "Any", "No Fit", "Constant/Small", "Constant/Standard", "Constant/Large", "Ducking/Small", "Ducking/Standard", "Ducking/Large" }; @@ -1223,7 +1202,7 @@ char *panose_values_9[] = #define fix_range(a,b) (b<0 ? 0 : (b>a ? 0 : b)) -void handle_pfminfo(lua_State * L, struct pfminfo pfm) +static void handle_pfminfo(lua_State * L, struct pfminfo pfm) { dump_intfield(L, "pfmset", pfm.pfmset); @@ -1321,7 +1300,7 @@ void handle_pfminfo(lua_State * L, struct pfminfo pfm) } -char *do_handle_enc(lua_State * L, struct enc *enc) +static char *do_handle_enc(lua_State * L, struct enc *enc) { int i; char *ret = enc->enc_name; @@ -1376,13 +1355,15 @@ char *do_handle_enc(lua_State * L, struct enc *enc) return ret; } -void handle_enc(lua_State * L, struct enc *enc) +#if 0 /* unused */ +static void handle_enc(lua_State * L, struct enc *enc) { struct enc *next; NESTED_TABLE(do_handle_enc, enc, 24); } +#endif -void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc) +static void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc) { int i; dump_intfield(L, "enccount", map->enccount); @@ -1453,10 +1434,10 @@ static void handle_psdict(lua_State * L, struct psdict *private) } } -void do_handle_ttflangname(lua_State * L, struct ttflangname *names) +static void do_handle_ttflangname(lua_State * L, struct ttflangname *names) { int k; - dump_stringfield(L, "lang", (char *) MSLangString(names->lang)); + dump_stringfield(L, "lang", MSLangString(names->lang)); lua_checkstack(L, 4); lua_createtable(L, 0, ttf_namemax); for (k = 0; k < ttf_namemax; k++) { @@ -1468,14 +1449,14 @@ void do_handle_ttflangname(lua_State * L, struct ttflangname *names) } -void handle_ttflangname(lua_State * L, struct ttflangname *names) +static void handle_ttflangname(lua_State * L, struct ttflangname *names) { struct ttflangname *next; NESTED_TABLE(do_handle_ttflangname, names, 2); } -void do_handle_anchorclass(lua_State * L, struct anchorclass *anchor) +static void do_handle_anchorclass(lua_State * L, struct anchorclass *anchor) { dump_stringfield(L, "name", anchor->name); @@ -1486,13 +1467,13 @@ void do_handle_anchorclass(lua_State * L, struct anchorclass *anchor) /* uint8 ticked; */ } -void handle_anchorclass(lua_State * L, struct anchorclass *anchor) +static void handle_anchorclass(lua_State * L, struct anchorclass *anchor) { struct anchorclass *next; NESTED_TABLE(do_handle_anchorclass, anchor, 10); } -void do_handle_ttf_table(lua_State * L, struct ttf_table *ttf_tab) +static void do_handle_ttf_table(lua_State * L, struct ttf_table *ttf_tab) { dump_tag(L, "tag", ttf_tab->tag); @@ -1501,13 +1482,13 @@ void do_handle_ttf_table(lua_State * L, struct ttf_table *ttf_tab) dump_lstringfield(L, "data", (char *) ttf_tab->data, ttf_tab->len); } -void handle_ttf_table(lua_State * L, struct ttf_table *ttf_tab) +static void handle_ttf_table(lua_State * L, struct ttf_table *ttf_tab) { struct ttf_table *next; NESTED_TABLE(do_handle_ttf_table, ttf_tab, 4); } -int do_handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name) +static int do_handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name) { int k; int match = 0; @@ -1559,7 +1540,7 @@ int do_handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name return 1; } -void handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name) +static void handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name) { struct kernclass *next; NESTED_TABLE_SF(do_handle_kernclass, kerns, name, 8); @@ -1598,7 +1579,7 @@ void handle_kernclass(lua_State * L, struct kernclass *kerns, const char *name) lua_setfield(L,-2,s); } } -void handle_fpst_rule(lua_State * L, struct fpst_rule *rule, int format) +static void handle_fpst_rule(lua_State * L, struct fpst_rule *rule, int format) { int k; @@ -1667,7 +1648,7 @@ void handle_fpst_rule(lua_State * L, struct fpst_rule *rule, int format) } } -void do_handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) +static void do_handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) { int k; @@ -1702,7 +1683,7 @@ void do_handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) /*dump_intfield (L,"ticked", fpst->ticked); */ } -void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) +static void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) { struct generic_fpst *next; int k = 1; @@ -1732,13 +1713,13 @@ void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst) } } -void do_handle_otfname(lua_State * L, struct otfname *oname) +static void do_handle_otfname(lua_State * L, struct otfname *oname) { dump_intfield(L, "lang", oname->lang); dump_stringfield(L, "name", oname->name); } -void handle_otfname(lua_State * L, struct otfname *oname) +static void handle_otfname(lua_State * L, struct otfname *oname) { struct otfname *next; NESTED_TABLE(do_handle_otfname, oname, 2); @@ -1747,7 +1728,7 @@ void handle_otfname(lua_State * L, struct otfname *oname) -void handle_MATH(lua_State * L, struct MATH *MATH) +static void handle_MATH(lua_State * L, struct MATH *MATH) { dump_intfield(L, "ScriptPercentScaleDown", MATH->ScriptPercentScaleDown); dump_intfield(L, "ScriptScriptPercentScaleDown", @@ -1833,9 +1814,9 @@ void handle_MATH(lua_State * L, struct MATH *MATH) } /* the handling of BASE is untested, no font */ -void handle_baselangextent(lua_State * L, struct baselangextent *ble); +static void handle_baselangextent(lua_State * L, struct baselangextent *ble); -void do_handle_baselangextent(lua_State * L, struct baselangextent *ble) +static void do_handle_baselangextent(lua_State * L, struct baselangextent *ble) { dump_tag(L, "tag", ble->lang); dump_intfield(L, "ascent", ble->ascent); @@ -1846,14 +1827,14 @@ void do_handle_baselangextent(lua_State * L, struct baselangextent *ble) } -void handle_baselangextent(lua_State * L, struct baselangextent *ble) +static void handle_baselangextent(lua_State * L, struct baselangextent *ble) { struct baselangextent *next; NESTED_TABLE(do_handle_baselangextent, ble, 4); } -void handle_base(lua_State * L, struct Base *Base) +static void handle_base(lua_State * L, struct Base *Base) { int i; struct basescript *next = Base->scripts; @@ -1889,7 +1870,7 @@ void handle_base(lua_State * L, struct Base *Base) } -void handle_axismap(lua_State * L, struct axismap *am) +static void handle_axismap(lua_State * L, struct axismap *am) { int i; lua_checkstack(L, 3); @@ -1911,9 +1892,9 @@ void handle_axismap(lua_State * L, struct axismap *am) } -void handle_mmset(lua_State * L, struct mmset *mm) +static void handle_mmset(lua_State * L, struct mmset *mm) { - int i, k; + int i; lua_newtable(L); for (i = 0; i < mm->axis_count; i++) { lua_pushstring(L, mm->axes[i]); @@ -1972,7 +1953,7 @@ void handle_mmset(lua_State * L, struct mmset *mm) -void handle_splinefont(lua_State * L, struct splinefont *sf) +static void handle_splinefont(lua_State * L, struct splinefont *sf) { int k; int fix_notdef = 0; @@ -2299,7 +2280,7 @@ void handle_splinefont(lua_State * L, struct splinefont *sf) dump_intfield(L, "extrema_bound", sf->extrema_bound); } -int ff_make_table(lua_State * L) +static int ff_make_table(lua_State * L) { SplineFont *sf; sf = *(check_isfont(L, 1)); @@ -2312,7 +2293,7 @@ int ff_make_table(lua_State * L) return 1; } -void do_ff_info(lua_State * L, SplineFont * sf) +static void do_ff_info(lua_State * L, SplineFont * sf) { lua_newtable(L); dump_stringfield(L, "familyname", sf->familyname); @@ -3389,17 +3370,16 @@ static const struct luaL_Reg fflib_m[] = { {NULL, NULL} /* sentinel */ }; -extern char *SaveTablesPref; -extern char *coord_sep; - int luaopen_ff(lua_State * L) { + static char coord_sep_string[] = ","; + static char SaveTablesPref_string[] = "VORG,JSTF,acnt,bsln,fdsc,fmtx,hsty,just,trak,Zapf,LINO"; InitSimpleStuff(); setlocale(LC_ALL, "C"); /* undo whatever InitSimpleStuff has caused */ - coord_sep = ","; + coord_sep = coord_sep_string; FF_SetUiInterface(&luaui_interface); default_encoding = FindOrMakeEncoding("ISO8859-1"); - SaveTablesPref = "VORG,JSTF,acnt,bsln,fdsc,fmtx,hsty,just,trak,Zapf,LINO"; + SaveTablesPref = SaveTablesPref_string; luaL_newmetatable(L, FONT_METATABLE); luaL_register(L, NULL, fflib_m); -- cgit v1.2.3