diff options
61 files changed, 1314 insertions, 1230 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index d1290d11cd0..d2db9af1fbb 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2009-04-22 Taco Hoekwater <taco@luatex.org> + + * luatexdir: import of the current state of luatex, 0.40.0. + This affects many files in subdirectories. + 2009-04-16 Taco Hoekwater <taco@luatex.org> * image/image.h: remove the trick that forced a local png.h diff --git a/Build/source/texk/web2c/luatexdir/NEWS b/Build/source/texk/web2c/luatexdir/NEWS index 09adf33455c..8ac0d995e8e 100644 --- a/Build/source/texk/web2c/luatexdir/NEWS +++ b/Build/source/texk/web2c/luatexdir/NEWS @@ -1,4 +1,27 @@ ============================================================== +Luatex beta-0.40.0 was released 20090422 +============================================================== + +* The embedded MPlib is updated to version 1.200. + +* Texlua would crash if run font.read_tfm() was used. + +* Luatex would crash on empty \patterns. + +* Lots of small C code cleanups. + +* \textdir inside a \hbox dir *** was wrong earlier. + +* 0.39.0 introduced a bug that would make luatex crash whenever + font expansion was used. + +* Font tables returned by define_font can now have a key named + 'cache' that controls the internal lua font table caching. + +* There is no longer a need for an explicit --progname if there + is no input file given. + +============================================================== Luatex beta-0.39.0 was released 20090415 ============================================================== diff --git a/Build/source/texk/web2c/luatexdir/am/libluatex.am b/Build/source/texk/web2c/luatexdir/am/libluatex.am index 6c34d554348..515d51ae707 100644 --- a/Build/source/texk/web2c/luatexdir/am/libluatex.am +++ b/Build/source/texk/web2c/luatexdir/am/libluatex.am @@ -50,11 +50,15 @@ libluatex_a_SOURCES = \ 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 \ @@ -112,6 +116,7 @@ libluatex_a_SOURCES = \ luatexdir/utils/synctex.h \ luatexdir/utils/synctex.c \ luatexdir/utils/utils.c \ + luatexdir/utils/utils.h \ luatexdir/utils/writezip.c \ mplibdir/lmplib.c diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.c b/Build/source/texk/web2c/luatexdir/font/dofont.c index 7033dc7be0c..f8a41c90394 100644 --- a/Build/source/texk/web2c/luatexdir/font/dofont.c +++ b/Build/source/texk/web2c/luatexdir/font/dofont.c @@ -22,7 +22,7 @@ #include "luatex-api.h" static const char _svn_version[] = - "$Id: dofont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/dofont.c $"; + "$Id: dofont.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/dofont.c $"; #define TIMERS 0 @@ -51,8 +51,7 @@ static char *font_error_message(pointer u, char *nom, scaled s) } static int -do_define_font(integer f, char *cnom, char *caire, scaled s, - integer natural_dir) +do_define_font(integer f, char *cnom, scaled s, integer natural_dir) { boolean res; /* was the callback successful? */ @@ -68,12 +67,7 @@ do_define_font(integer f, char *cnom, char *caire, scaled s, callback_id = callback_defined(define_font_callback); if (callback_id > 0) { - if (caire == NULL || strlen(caire) == 0) { - cnam = xstrdup(cnom); - } else { - cnam = xmalloc(strlen(cnom) + strlen(caire) + 2); - sprintf(cnam, "%s/%s", caire, cnom); - } + cnam = xstrdup(cnom); #if TIMERS gettimeofday(&tva, NULL); #endif @@ -122,7 +116,7 @@ do_define_font(integer f, char *cnom, char *caire, scaled s, } } } else if (callback_id==0) { - res = read_tfm_info(f, cnom, caire, s); + res = read_tfm_info(f, cnom, s); if (res) { set_hyphen_char(f, get_default_hyphen_char()); set_skew_char(f, get_default_skew_char()); @@ -141,7 +135,7 @@ do_define_font(integer f, char *cnom, char *caire, scaled s, } -int read_font_info(pointer u, strnumber nom, scaled s, integer natural_dir) +int read_font_info(pointer u, str_number nom, scaled s, integer natural_dir) { integer f; char *cnom; @@ -149,7 +143,7 @@ int read_font_info(pointer u, strnumber nom, scaled s, integer natural_dir) cnom = xstrdup(makecstring(nom)); f = new_font(); - if ((f = do_define_font(f, cnom, NULL, s, natural_dir))) { + if ((f = do_define_font(f, cnom, s, natural_dir))) { free(cnom); return f; } else { @@ -174,11 +168,11 @@ int read_font_info(pointer u, strnumber nom, scaled s, integer natural_dir) the |font_tables| array, and we could attempt to reuse those */ -int find_font_id(char *nom, char *aire, scaled s) +int find_font_id(char *nom, scaled s) { integer f; f = new_font(); - if ((f = do_define_font(f, nom, aire, s, -1))) { + if ((f = do_define_font(f, nom, s, -1))) { return f; } else { return 0; diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.c b/Build/source/texk/web2c/luatexdir/font/luafont.c index 0de7725c8dd..c3a8da06b16 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.c +++ b/Build/source/texk/web2c/luatexdir/font/luafont.c @@ -23,12 +23,10 @@ #include "nodes.h" static const char _svn_version[] = - "$Id: luafont.c 2293 2009-04-15 16:55:18Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.c $"; + "$Id: luafont.c 2312 2009-04-17 15:43:13Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.c $"; #define noVERBOSE -#define SAVE_REF 1 - char *font_type_strings[] = { "unknown", "virtual", "real", NULL }; char *font_format_strings[] = { "unknown", "type1", "type3", "truetype", "opentype", NULL }; @@ -380,7 +378,7 @@ int font_to_lua(lua_State * L, int f) { int k; charinfo *co; - if (font_cache_id(f)) { + if (font_cache_id(f)>0) { /* fetch the table from the registry if it was saved there by font_from_lua() */ lua_rawgeti(L, LUA_REGISTRYINDEX, font_cache_id(f)); @@ -510,6 +508,13 @@ int font_to_lua(lua_State * L, int f) } } lua_setfield(L, -2, "characters"); + + if (font_cache_id(f)==0) { /* renew */ + integer r; + lua_pushvalue(L,-1); + r = luaL_ref(Luas, LUA_REGISTRYINDEX); /* pops the table */ + set_font_cache_id(f, r); + } return 1; } @@ -1428,6 +1433,18 @@ int font_from_lua(lua_State * L, int f) int ec; /* last char index */ char *s; integer *l_fonts = NULL; + integer save_ref = 1; /* unneeded, really */ + + /* will we save a cache of the luat table? */ + s = string_field(L, "cache", "yes"); + if (strcmp(s,"yes")==0) + save_ref=1; + else if (strcmp(s,"no")==0) + save_ref=-1; + else if (strcmp(s,"renew")==0) + save_ref=0; + free(s); + /* the table is at stack index -1 */ if (luaS_width_index == 0) @@ -1541,7 +1558,7 @@ int font_from_lua(lua_State * L, int f) if (strcmp(font_name(f), s) == 0) l_fonts[i] = f; else - l_fonts[i] = find_font_id(s, "", t); + l_fonts[i] = find_font_id(s, t); lua_settop(L, s_top); } else { pdftex_fail("Invalid local font in font %s!\n", font_name(f)); @@ -1647,12 +1664,13 @@ int font_from_lua(lua_State * L, int f) font_name(f)); } -#if SAVE_REF - r = luaL_ref(Luas, LUA_REGISTRYINDEX); /* pops the table */ - set_font_cache_id(f, r); -#else - lua_pop(Luas, 1); -#endif + if (save_ref>0) { + r = luaL_ref(Luas, LUA_REGISTRYINDEX); /* pops the table */ + set_font_cache_id(f, r); + } else { + lua_pop(Luas, 1); + set_font_cache_id(f, save_ref); + } } else { /* jikes, no characters */ pdftex_warn("lua-loaded font [%d] (%s) has no character table!", f, font_name(f)); @@ -1854,18 +1872,6 @@ static halfword handle_lig_nest(halfword root, halfword cur) } -static void print_disc(halfword cur) -{ - halfword n; - fprintf (stdout, "cur(%d,%d) {", cur, subtype(cur)); - n = vlink_pre_break(cur); show_node_list(n); - fprintf (stdout, "}{"); - n = vlink_post_break(cur); show_node_list(n); - fprintf (stdout, "}{"); - n = vlink_no_break(cur); show_node_list(n); - fprintf (stdout, "}\n"); -} - static halfword handle_lig_word(halfword cur) { halfword right = null; diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h index c3a9e8aeada..554c981b1a8 100644 --- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h +++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.h @@ -1,5 +1,5 @@ -/* luatexfont.h General font functions - +/* luatexfont.h --- General font definitions + Copyright 2008 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -17,51 +17,215 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: luatexfont.h 2271 2009-04-12 23:42:21Z oneiros $ */ +/* $Id: luatexfont.h 2332 2009-04-18 17:17:56Z hhenkel $ */ #ifndef LUATEXFONT_H -# define LUATEXFONT_H 1 +# define LUATEXFONT_H # include "ptexlib.h" -# include "sfnt.h" - -/* texfont.c */ -extern charinfo *copy_charinfo(charinfo * ci); +# ifndef pdfTeX +# define pdfTeX +# include "sfnt.h" /* which wants that pdfTeX is defined */ +# undef pdfTeX +# else +# include "sfnt.h" +# endif + +/**********************************************************************/ + +# define ASCENT_CODE 0 +# define CAPHEIGHT_CODE 1 +# define DESCENT_CODE 2 +# define ITALIC_ANGLE_CODE 3 +# define STEMV_CODE 4 +# define XHEIGHT_CODE 5 +# define FONTBBOX1_CODE 6 +# define FONTBBOX2_CODE 7 +# define FONTBBOX3_CODE 8 +# define FONTBBOX4_CODE 9 +# define FONTNAME_CODE 10 +# define GEN_KEY_NUM (XHEIGHT_CODE + 1) +# define MAX_KEY_CODE (FONTBBOX1_CODE + 1) +# define INT_KEYS_NUM (FONTBBOX4_CODE + 1) +# define FONT_KEYS_NUM (FONTNAME_CODE + 1) + +# define FD_FLAGS_NOT_SET_IN_MAPLINE -1 +# define FD_FLAGS_DEFAULT_EMBED 4 /* a symbol font */ +# define FD_FLAGS_DEFAULT_NON_EMBED 0x22 + /* a nonsymbolic serif font */ + +/**********************************************************************/ + +typedef struct { + const char *pdfname; + const char *t1name; + boolean valid; +} key_entry; + +extern const key_entry font_key[FONT_KEYS_NUM]; + +typedef struct _subfont_entry { + char *infix; /* infix for this subfont, eg "01" */ + long charcodes[256]; /* the mapping for this subfont as read from sfd */ + struct _subfont_entry *next; +} subfont_entry; + +# include "mapfile.h" + +typedef struct { + char *name; /* sfd name, eg "Unicode" */ + subfont_entry *subfont; /* linked list of subfonts */ +} sfd_entry; + +typedef struct { + int val; /* value */ + boolean set; /* true if parameter has been set */ +} intparm; + +typedef struct { + integer fe_objnum; /* object number */ + char *name; /* encoding file name */ + char **glyph_names; /* array of glyph names */ + struct avl_table *tx_tree; /* tree of encoding positions marked as used by TeX */ +} fe_entry; + +typedef struct fd_entry_ { + integer fd_objnum; /* object number of the font descriptor object */ + char *fontname; /* /FontName (without subset tag) */ + char *subset_tag; /* 6-character subset tag */ + boolean ff_found; + integer ff_objnum; /* object number of the font program stream */ + integer fn_objnum; /* font name object number (embedded PDF) */ + boolean all_glyphs; /* embed all glyphs? */ + boolean write_ttf_glyph_names; + intparm font_dim[FONT_KEYS_NUM]; + fe_entry *fe; /* pointer to encoding structure */ + char **builtin_glyph_names; /* builtin encoding as read from the Type1 font file */ + fm_entry *fm; /* pointer to font map structure */ + struct avl_table *tx_tree; /* tree of non-reencoded TeX characters marked as used */ + struct avl_table *gl_tree; /* tree of all marked glyphs */ +} fd_entry; + +typedef struct fo_entry_ { + integer fo_objnum; /* object number of the font dictionary */ + internalfontnumber tex_font; /* needed only for \pdffontattr{} */ + fm_entry *fm; /* pointer to font map structure for this font dictionary */ + fd_entry *fd; /* pointer to /FontDescriptor object structure */ + fe_entry *fe; /* pointer to encoding structure */ + integer cw_objnum; /* object number of the font program object */ + integer first_char; /* first character used in this font */ + integer last_char; /* last character used in this font */ + struct avl_table *tx_tree; /* tree of non-reencoded TeX characters marked as used */ + integer tounicode_objnum; /* object number of ToUnicode */ +} fo_entry; + +typedef struct { + char *name; /* glyph name */ + long code; /* -1 = undefined; -2 = multiple codes, stored + as string in unicode_seq; otherwise unicode value */ + char *unicode_seq; /* multiple unicode sequence */ +} glyph_unicode_entry; + +typedef struct glw_entry_ { /* subset glyphs for inclusion in CID-based fonts */ + unsigned int id; /* glyph CID */ + signed int wd; /* glyph width in 1/1000 em parts */ +} glw_entry; + +typedef struct { + integer charcode, cwidth, cheight, xoff, yoff, xescape, rastersize; + halfword *raster; +} chardesc; + +/**********************************************************************/ + +# include "texfont.h" /* tounicode.c */ -extern integer write_cid_tounicode(fo_entry * fo, internalfontnumber f); +integer write_cid_tounicode(fo_entry * fo, internalfontnumber f); +void glyph_unicode_free(void); +void def_tounicode(str_number, str_number); +integer write_tounicode(char **, char *); /* vfpacket.c */ -extern void replace_packet_fonts(internal_font_number f, integer * old_fontid, - integer * new_fontid, int count); -extern integer *packet_local_fonts(internal_font_number f, integer * num); +void replace_packet_fonts(internal_font_number f, integer * old_fontid, + integer * new_fontid, int count); +integer *packet_local_fonts(internal_font_number f, integer * num); /* writeccf.c */ -extern void writetype1w(fd_entry * fd); +void writetype1w(fd_entry * fd); /* writetype0.c */ -extern void writetype0(fd_entry * fd); +void writetype0(fd_entry * fd); + +/* writefont.c */ +void do_pdf_font(integer, internalfontnumber); +fd_entry *lookup_fd_entry(char *, integer, integer); +fd_entry *new_fd_entry(void); +void write_fontstuff(); +integer get_fd_objnum(fd_entry * fd); +integer get_fn_objnum(fd_entry * fd); +void embed_whole_font(fd_entry * fd); +void register_fd_entry(fd_entry * fd); + +/* writet1.c */ +boolean t1_subset(char *, char *, unsigned char *); +char **load_enc_file(char *); +void writet1(fd_entry *); +void t1_free(void); +extern integer t1_length1, t1_length2, t1_length3; /* writetype2.c */ -extern void writetype2(fd_entry * fd); +void writetype2(fd_entry * fd); extern unsigned long cidtogid_obj; -extern pdf_obj *pdf_new_stream(void); -extern void pdf_add_stream(pdf_obj * stream, unsigned char *buf, long len); -extern void pdf_release_obj(pdf_obj * stream); +pdf_obj *pdf_new_stream(void); +void pdf_add_stream(pdf_obj * stream, unsigned char *buf, long len); +void pdf_release_obj(pdf_obj * stream); + +/* subfont.c */ +void sfd_free(void); +boolean handle_subfont_fm(fm_entry *, int); + +/* writeenc.c */ +fe_entry *get_fe_entry(char *); +void enc_free(void); +void write_fontencodings(void); + +/* writettf.c */ +void writettf(fd_entry *); +void writeotf(fd_entry *); +void ttf_free(void); +extern integer ttf_length; + +/* pkin.c */ +int readchar(boolean, chardesc *); + +/* macnames.c */ +extern const char notdef[]; + +/* vfovf.c */ +void vf_expand_local_fonts(internal_font_number f); +internal_font_number letter_space_font(halfword u, internal_font_number f, + integer e); +internal_font_number auto_expand_font(internal_font_number f, integer e); +str_number expand_font_name(internal_font_number f, integer e); +void pdf_check_vf_cur_val(void); +internal_font_number copy_font_info(internal_font_number f); /* writet3.c */ extern FILE *t3_file; +void writet3(int, internalfontnumber); +scaled get_pk_char_width(internalfontnumber, scaled); extern unsigned char *t3_buffer; extern integer t3_size; extern integer t3_curbyte; -# define t3_read_file() readbinfile(t3_file,&t3_buffer,&t3_size) +# define t3_read_file() readbinfile(t3_file, &t3_buffer, &t3_size) # define t3_close() xfclose(t3_file, cur_file_name) # define t3_getchar() t3_buffer[t3_curbyte++] -# define t3_eof() (t3_curbyte>t3_size) +# define t3_eof() (t3_curbyte>t3_size) -# define t3_prefix(s) (!strncmp(t3_line_array, s, strlen(s))) -# define t3_putchar(c) pdfout(c) +# define t3_prefix(s) (!strncmp(t3_line_array, s, strlen(s))) +# define t3_putchar(c) pdfout(c) -#endif +#endif /* LUATEXFONT_H */ diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.c b/Build/source/texk/web2c/luatexdir/font/mapfile.c index 551ff59e49e..91ce21d60e3 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.c +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.c @@ -26,7 +26,7 @@ #include "luatex-api.h" static const char _svn_version[] = - "$Id: mapfile.c 2271 2009-04-12 23:42:21Z oneiros $ " + "$Id: mapfile.c 2331 2009-04-18 16:39:50Z hhenkel $ " "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/mapfile.c $"; #define FM_BUF_SIZE 1024 @@ -44,6 +44,8 @@ static integer fm_curbyte = 0; #define fm_close() xfclose(fm_file, cur_file_name) #define fm_getchar() fm_buffer[fm_curbyte++] #define fm_eof() (fm_curbyte>fm_size) +#define is_cfg_comment(c) \ + (c == 10 || c == '*' || c == '#' || c == ';' || c == '%') typedef enum { FM_DUPIGNORE, FM_REPLACE, FM_DELETE } updatemode; typedef enum { MAPFILE, MAPLINE } maptype; @@ -136,6 +138,7 @@ struct avl_table *encname_tree = NULL; static int comp_fm_entry_tfm(const void *pa, const void *pb, void *p) { + (void) p; return strcmp(((const fm_entry *) pa)->tfm_name, ((const fm_entry *) pb)->tfm_name); } @@ -146,6 +149,7 @@ static int comp_fm_entry_ps(const void *pa, const void *pb, void *p) { int i; const fm_entry *p1 = (const fm_entry *) pa, *p2 = (const fm_entry *) pb; + (void) p; assert(p1->ps_name != NULL && p2->ps_name != NULL); if ((i = strcmp(p1->ps_name, p2->ps_name))) return i; @@ -158,6 +162,7 @@ static int comp_fm_entry_ps(const void *pa, const void *pb, void *p) static int comp_ff_entry(const void *pa, const void *pb, void *p) { + (void) p; return strcmp(((const ff_entry *) pa)->ff_name, ((const ff_entry *) pb)->ff_name); } @@ -884,7 +889,6 @@ void pdf_init_map_file(string map_name) mitem->line = map_name; } - /**********************************************************************/ /* * Early check whether a font file exists. Search tree ff_tree is used @@ -939,11 +943,20 @@ ff_entry *check_ff_exist(char *ff_name, boolean is_tt) } /**********************************************************************/ + +int is_subsetable(fm_entry * fm) +{ + assert(is_included(fm)); + return is_subsetted(fm); +} + +/**********************************************************************/ /* cleaning up... */ static void destroy_fm_entry_tfm(void *pa, void *pb) { fm_entry *fm; + (void) pb; fm = (fm_entry *) pa; if (!has_pslink(fm)) delete_fm_entry(fm); @@ -954,6 +967,7 @@ static void destroy_fm_entry_tfm(void *pa, void *pb) static void destroy_fm_entry_ps(void *pa, void *pb) { fm_entry *fm; + (void) pb; fm = (fm_entry *) pa; if (!has_tfmlink(fm)) delete_fm_entry(fm); @@ -964,6 +978,7 @@ static void destroy_fm_entry_ps(void *pa, void *pb) static void destroy_ff_entry(void *pa, void *pb) { ff_entry *ff; + (void) pb; ff = (ff_entry *) pa; delete_ff_entry(ff); } diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.h b/Build/source/texk/web2c/luatexdir/font/mapfile.h index e07c70047ec..e4242a21255 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.h +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.h @@ -17,10 +17,68 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: mapfile.h 2271 2009-04-12 23:42:21Z oneiros $ */ +/* $Id: mapfile.h 2331 2009-04-18 16:39:50Z hhenkel $ */ #ifndef MAPFILE_H # define MAPFILE_H + +# define F_INCLUDED 0x01 +# define F_SUBSETTED 0x02 +# define F_STDT1FONT 0x04 +# define F_SUBFONT 0x08 +# define F_TYPE1 0x10 +# define F_TRUETYPE 0x20 +# define F_OTF 0x40 +# define F_CIDKEYED 0x80 + +# define set_included(fm) ((fm)->type |= F_INCLUDED) +# define set_subsetted(fm) ((fm)->type |= F_SUBSETTED) +# define set_std_t1font(fm) ((fm)->type |= F_STDT1FONT) +# define set_subfont(fm) ((fm)->type |= F_SUBFONT) +# define set_type1(fm) ((fm)->type |= F_TYPE1) +# define set_truetype(fm) ((fm)->type |= F_TRUETYPE) +# define set_opentype(fm) ((fm)->type |= F_OTF) +# define set_subfont(fm) ((fm)->type |= F_SUBFONT) +# define set_cidkeyed(fm) ((fm)->type |= F_CIDKEYED) + +# define unset_included(fm) ((fm)->type &= ~F_INCLUDED) +# define unset_subsetted(fm) ((fm)->type &= ~F_SUBSETTED) +# define unset_std_t1font(fm)((fm)->type &= ~F_STDT1FONT) +# define unset_subfont(fm) ((fm)->type &= ~F_SUBFONT) +# define unset_type1(fm) ((fm)->type &= ~F_TYPE1) +# define unset_truetype(fm) ((fm)->type &= ~F_TRUETYPE) +# define unset_opentype(fm) ((fm)->type &= ~F_OTF) +# define unset_subfont(fm) ((fm)->type &= ~F_SUBFONT) +# define unset_cidkeyed(fm) ((fm)->type &= ~F_CIDKEYED) + +# define is_included(fm) (((fm)->type & F_INCLUDED) != 0) +# define is_subsetted(fm) (((fm)->type & F_SUBSETTED) != 0) +# define is_std_t1font(fm) (((fm)->type & F_STDT1FONT) != 0) +# define is_subfont(fm) (((fm)->type & F_SUBFONT) != 0) +# define is_type1(fm) (((fm)->type & F_TYPE1) != 0) +# define is_truetype(fm) (((fm)->type & F_TRUETYPE) != 0) +# define is_opentype(fm) (((fm)->type & F_OTF) != 0) +# define is_subfont(fm) (((fm)->type & F_SUBFONT) != 0) +# define is_cidkeyed(fm) (((fm)->type & F_CIDKEYED) != 0) + +# define fm_slant(fm) (fm)->slant +# define fm_extend(fm) (fm)->extend +# define fm_fontfile(fm) (fm)->ff_name + +# define is_reencoded(fm) ((fm)->encname != NULL) +# define is_fontfile(fm) (fm_fontfile(fm) != NULL) +# define is_t1fontfile(fm) (is_fontfile(fm) && is_type1(fm)) +# define is_builtin(fm) (!is_fontfile(fm)) + +# define LINK_TFM 0x01 +# define LINK_PS 0x02 +# define set_tfmlink(fm) ((fm)->links |= LINK_TFM) +# define set_pslink(fm) ((fm)->links |= LINK_PS) +# define unset_tfmlink(fm) ((fm)->links &= ~LINK_TFM) +# define unset_pslink(fm) ((fm)->links &= ~LINK_PS) +# define has_tfmlink(fm) ((fm)->links & LINK_TFM) +# define has_pslink(fm) ((fm)->links & LINK_PS) + /**********************************************************************/ typedef struct { @@ -61,6 +119,6 @@ fm_entry *new_fm_entry(void); void delete_fm_entry(fm_entry *); int avl_do_entry(fm_entry *, int); int check_std_t1font(char *s); +int is_subsetable(fm_entry * fm); -/**********************************************************************/ -#endif +#endif /* MAPFILE_H */ diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.c b/Build/source/texk/web2c/luatexdir/font/subfont.c index 33620092321..b7b90f2b01c 100644 --- a/Build/source/texk/web2c/luatexdir/font/subfont.c +++ b/Build/source/texk/web2c/luatexdir/font/subfont.c @@ -22,7 +22,7 @@ #include <string.h> static const char _svn_version[] = - "$Id: subfont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.c $"; + "$Id: subfont.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.c $"; static struct avl_table *sfd_tree = NULL; @@ -69,6 +69,7 @@ static void destroy_sfd_entry(void *pa, void *pb) subfont_entry *p, *q; sfd_entry *sfd; sfd = (sfd_entry *) pa; + (void)pb; p = sfd->subfont; while (p != NULL) { q = p->next; @@ -81,6 +82,7 @@ static void destroy_sfd_entry(void *pa, void *pb) static int comp_sfd_entry(const void *pa, const void *pb, void *p) { + (void)p; return strcmp(((const sfd_entry *) pa)->name, ((const sfd_entry *) pb)->name); } diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.c b/Build/source/texk/web2c/luatexdir/font/texfont.c index 7eac52c7d06..17e4e49f5d1 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.c +++ b/Build/source/texk/web2c/luatexdir/font/texfont.c @@ -35,7 +35,7 @@ #include "luatex-api.h" static const char _svn_version[] = - "$Id: texfont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.c $"; + "$Id: texfont.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.c $"; #define proper_char_index(c) (c<=font_ec(f) && c>=font_bc(f)) #define dxfree(a,b) { xfree(a); a = b ; } @@ -135,10 +135,6 @@ integer new_font(void) return id; } -#define Charinfo_count(a) font_tables[a]->charinfo_count -#define Charinfo_size(a) font_tables[a]->charinfo_size -#define Characters(a) font_tables[a]->characters - #define find_charinfo_id(f,c) get_sa_item(font_tables[f]->characters,c) charinfo *get_charinfo(internal_font_number f, integer c) @@ -146,11 +142,11 @@ charinfo *get_charinfo(internal_font_number f, integer c) sa_tree_item glyph; charinfo *ci; if (proper_char_index(c)) { - glyph = get_sa_item(Characters(f), c); + glyph = get_sa_item(font_tables[f]->characters, c); if (!glyph) { glyph = ++font_tables[f]->charinfo_count; - if (glyph>=font_tables[f]->charinfo_size) { + if (glyph>=(unsigned)font_tables[f]->charinfo_size) { font_bytes += (16*sizeof(charinfo)); do_realloc(font_tables[f]->charinfo, (glyph + 16), charinfo); memset(&(font_tables[f]->charinfo[glyph]), 0, (16*sizeof(charinfo))); @@ -182,7 +178,7 @@ void set_charinfo(internal_font_number f, integer c, charinfo * ci) { sa_tree_item glyph; if (proper_char_index(c)) { - glyph = get_sa_item(Characters(f), c); + glyph = get_sa_item(font_tables[f]->characters, c); if (glyph) { font_tables[f]->charinfo[glyph] = *ci; } else { @@ -1074,11 +1070,11 @@ integer copy_font(integer f) memcpy(math_param_base(k), math_param_base(f), i); } - i = sizeof(charinfo) * (Charinfo_size(f) + 1); + i = sizeof(charinfo) * (font_tables[f]->charinfo_size + 1); font_bytes += i; font_tables[k]->charinfo = xmalloc(i); memset(font_tables[k]->charinfo, 0, i); - for (i = 0; i <= Charinfo_size(k); i++) { + for (i = 0; i < font_tables[k]->charinfo_size; i++) { ci = copy_charinfo(&font_tables[f]->charinfo[i]); font_tables[k]->charinfo[i] = *ci; } @@ -1158,7 +1154,7 @@ boolean is_valid_font(integer id) } /* return 1 == identical */ -boolean cmp_font_name(integer id, strnumber t) +boolean cmp_font_name(integer id, str_number t) { char *tid, *tt; if (!is_valid_font(id)) @@ -1172,7 +1168,7 @@ boolean cmp_font_name(integer id, strnumber t) return 1; } -boolean cmp_font_area(integer id, strnumber t) +boolean cmp_font_area(integer id, str_number t) { char *tt = NULL; char *tid = font_area(id); diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h index 8723364a96c..300135c0f35 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.h +++ b/Build/source/texk/web2c/luatexdir/font/texfont.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: texfont.h 2271 2009-04-12 23:42:21Z oneiros $ */ +/* $Id: texfont.h 2331 2009-04-18 16:39:50Z hhenkel $ */ /* Here we have the interface to LuaTeX's font system, as seen from the main pascal program. There is a companion list in luatex.defines to @@ -28,7 +28,7 @@ */ #ifndef TEXFONT_H -# define TEXFONT_H 1 +# define TEXFONT_H # include "luatexdir/managed-sa.h" @@ -79,10 +79,10 @@ typedef struct charinfo { int top_right_math_kerns; int bottom_right_math_kerns; int bottom_left_math_kerns; - scaled *top_left_math_kern_array; - scaled *top_right_math_kern_array; - scaled *bottom_right_math_kern_array; - scaled *bottom_left_math_kern_array; + scaled *top_left_math_kern_array; + scaled *top_right_math_kern_array; + scaled *bottom_right_math_kern_array; + scaled *bottom_left_math_kern_array; } charinfo; @@ -221,14 +221,14 @@ extern char *font_embedding_strings[]; # define set_font_name(f,b) font_name(f) = b # define tex_font_name(a) maketexstring(font_name(a)) -boolean cmp_font_name(integer, strnumber); +boolean cmp_font_name(integer, str_number); # define font_area(a) font_tables[a]->_font_area # define get_font_area(a) (unsigned char *)font_area(a) # define set_font_area(f,b) font_area(f) = b # define tex_font_area(a) maketexstring(font_area(a)) -boolean cmp_font_area(integer, strnumber); +boolean cmp_font_area(integer, str_number); # define font_reassign(a,b) { if (a!=NULL) free(a); a = b; } @@ -406,7 +406,7 @@ typedef enum { top_right_kern = 1, bottom_right_kern = 2, bottom_left_kern = 3, - top_left_kern = 4 + top_left_kern = 4 } font_math_kern_codes; extern charinfo *get_charinfo(internal_font_number f, integer c); @@ -433,8 +433,9 @@ extern void set_charinfo_ef(charinfo * ci, scaled val); extern void set_charinfo_lp(charinfo * ci, scaled val); extern void set_charinfo_rp(charinfo * ci, scaled val); -extern void add_charinfo_math_kern(charinfo *ci, int type, scaled ht, scaled krn); -extern int get_charinfo_math_kerns(charinfo * ci, int id); +extern void add_charinfo_math_kern(charinfo * ci, int type, scaled ht, + scaled krn); +extern int get_charinfo_math_kerns(charinfo * ci, int id); # define set_char_used(f,a,b) do { \ if (char_exists(f,a)) \ @@ -568,13 +569,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, char *aire, scaled s); +int read_tfm_info(internal_font_number f, char *nom, scaled s); /* from dofont.c */ -extern int read_font_info(pointer u, strnumber nom, scaled s, integer ndir); -extern int find_font_id(char *nom, char *aire, scaled s); +extern int read_font_info(pointer u, str_number nom, scaled s, integer ndir); +extern int find_font_id(char *nom, scaled s); /* for and from vfpacket.c */ @@ -599,4 +600,6 @@ extern scaled sqxfw(scaled sq, integer fw); extern void do_vf_packet(internal_font_number vf_f, integer c); extern int vf_packet_bytes(charinfo * co); -#endif +charinfo *copy_charinfo(charinfo * ci); + +#endif /* TEXFONT_H */ diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.c b/Build/source/texk/web2c/luatexdir/font/tfmofm.c index 2e373e71081..1172b457371 100644 --- a/Build/source/texk/web2c/luatexdir/font/tfmofm.c +++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.c @@ -22,7 +22,7 @@ #include "luatexfont.h" static const char _svn_version[] = - "$Id: tfmofm.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tfmofm.c $"; + "$Id: tfmofm.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tfmofm.c $"; /* Here are some macros that help process ligatures and kerns */ @@ -376,7 +376,7 @@ additional parameter information, which is explained later. int -open_tfm_file(char *nom, char *aire, unsigned char **tfm_buf, integer * tfm_siz) +open_tfm_file(char *nom, unsigned char **tfm_buf, integer * tfm_siz) { boolean res; /* was the callback successful? */ boolean opened; /* was |tfm_file| successfully opened? */ @@ -531,7 +531,7 @@ typedef struct tfmcharacterinfo { unsigned char _tag; } tfmcharacterinfo; -int read_tfm_info(internalfontnumber f, char *cnom, char *caire, scaled s) +int read_tfm_info(internalfontnumber f, 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 */ @@ -578,7 +578,7 @@ int read_tfm_info(internalfontnumber f, char *cnom, char *caire, scaled s) memset(&ci, 0, sizeof(tfmcharacterinfo)); - if (open_tfm_file(cnom, caire, &tfm_buffer, &tfm_size) != 1) + if (open_tfm_file(cnom, &tfm_buffer, &tfm_size) != 1) tfm_abort; /* cnom can be an absolute filename, xbasename() fixes that. */ diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.c b/Build/source/texk/web2c/luatexdir/font/tounicode.c index 31f07c9a253..ab448106e11 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.c +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.c @@ -20,7 +20,7 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: tounicode.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tounicode.c $"; + "$Id: tounicode.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tounicode.c $"; #define isXdigit(c) (isdigit(c) || ('A' <= (c) && (c) <= 'F')) #define UNI_UNDEF -1 @@ -31,6 +31,7 @@ static struct avl_table *glyph_unicode_tree = NULL; static int comp_glyph_unicode_entry(const void *pa, const void *pb, void *p) { + (void)p; return strcmp(((const glyph_unicode_entry *) pa)->name, ((const glyph_unicode_entry *) pb)->name); } @@ -48,6 +49,7 @@ static glyph_unicode_entry *new_glyph_unicode_entry(void) static void destroy_glyph_unicode_entry(void *pa, void *pb) { glyph_unicode_entry *e = (glyph_unicode_entry *) pa; + (void)pb; xfree(e->name); if (e->code == UNI_STRING) { assert(e->unicode_seq != NULL); @@ -61,7 +63,7 @@ void glyph_unicode_free(void) avl_destroy(glyph_unicode_tree, destroy_glyph_unicode_entry); } -void def_tounicode(strnumber glyph, strnumber unistr) +void def_tounicode(str_number glyph, str_number unistr) { char buf[SMALL_BUF_SIZE], *p; char buf2[SMALL_BUF_SIZE], *q; diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.c b/Build/source/texk/web2c/luatexdir/font/writecff.c index d2b038785b0..8480122f6ce 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.c +++ b/Build/source/texk/web2c/luatexdir/font/writecff.c @@ -22,7 +22,8 @@ #include "writecff.h" static const char _svn_version[] = - "$Id: writecff.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.c $"; + "$Id: writecff.c 2331 2009-04-18 16:39:50Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.c $"; #define get_offset(s,n) get_unsigned(s, (n)) #define get_card8(a) a->stream[a->offset++] @@ -46,9 +47,9 @@ static unsigned long get_unsigned(cff_font * cff, int n) } #define CFF_ERROR pdftex_fail +#undef WARN #define WARN pdftex_warn - const char *const cff_stdstr[CFF_STDSTR_MAX] = { ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.c b/Build/source/texk/web2c/luatexdir/font/writeenc.c index 575d5b61c3d..70b6957951c 100644 --- a/Build/source/texk/web2c/luatexdir/font/writeenc.c +++ b/Build/source/texk/web2c/luatexdir/font/writeenc.c @@ -21,7 +21,7 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: writeenc.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writeenc.c $"; + "$Id: writeenc.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writeenc.c $"; /**********************************************************************/ /* All encoding entries go into AVL tree for fast search by name. */ @@ -32,6 +32,7 @@ struct avl_table *fe_tree = NULL; static int comp_fe_entry(const void *pa, const void *pb, void *p) { + (void)p; return strcmp(((const fe_entry *) pa)->name, ((const fe_entry *) pb)->name); } @@ -164,6 +165,7 @@ static void destroy_fe_entry(void *pa, void *pb) { fe_entry *p; int i; + (void)pb; p = (fe_entry *) pa; xfree(p->name); if (p->glyph_names != NULL) diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.c b/Build/source/texk/web2c/luatexdir/font/writefont.c index b15b71489e8..74f1ffeeb14 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.c +++ b/Build/source/texk/web2c/luatexdir/font/writefont.c @@ -22,12 +22,27 @@ #include "luatexfont.h" static const char _svn_version[] = - "$Id: writefont.c 2274 2009-04-13 12:10:20Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.c $"; + "$Id: writefont.c 2331 2009-04-18 16:39:50Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.c $"; void write_cid_fontdictionary(fo_entry * fo, internalfontnumber f); void create_cid_fontdictionary(fm_entry * fm, integer font_objnum, internalfontnumber f); +const key_entry font_key[FONT_KEYS_NUM] = { + {"Ascent", "Ascender", 1} + , {"CapHeight", "CapHeight", 1} + , {"Descent", "Descender", 1} + , {"ItalicAngle", "ItalicAngle", 1} + , {"StemV", "StdVW", 1} + , {"XHeight", "XHeight", 1} + , {"FontBBox", "FontBBox", 1} + , {"", "", 0} + , {"", "", 0} + , {"", "", 0} + , {"FontName", "FontName", 1} +}; + /**********************************************************************/ struct avl_table *fo_tree = NULL; /* tree of font dictionaries */ @@ -35,6 +50,7 @@ struct avl_table *fd_tree = NULL; /* tree of font descriptor objects */ static int comp_fo_entry(const void *pa, const void *pb, void *p) { + (void) p; return strcmp(((const fo_entry *) pa)->fm->tfm_name, ((const fo_entry *) pb)->fm->tfm_name); } @@ -43,6 +59,7 @@ static int comp_fd_entry(const void *pa, const void *pb, void *p) { int i; const fd_entry *p1 = (const fd_entry *) pa, *p2 = (const fd_entry *) pb; + (void) p; assert(p1->fm != NULL && is_fontfile(p1->fm) && p2->fm != NULL && is_fontfile(p2->fm)); if ((i = strcmp(p1->fm->ff_name, p2->fm->ff_name)) != 0) @@ -262,6 +279,24 @@ void create_fontdescriptor(fo_entry * fo, internalfontnumber f) assert(fo->fd->gl_tree != NULL); } +integer get_fd_objnum(fd_entry * fd) +{ + assert(fd->fd_objnum != 0); + return fd->fd_objnum; +} + +integer get_fn_objnum(fd_entry * fd) +{ + if (fd->fn_objnum == 0) + fd->fn_objnum = pdf_new_objnum(); + return fd->fn_objnum; +} + +void embed_whole_font(fd_entry * fd) +{ + fd->all_glyphs = true; +} + /**********************************************************************/ /* * For all used characters of TeX font f, get corresponding glyph names @@ -713,18 +748,18 @@ void create_fontdictionary(fm_entry * fm, integer font_objnum, /**********************************************************************/ -static int has_ttf_outlines(fm_entry *fm) +static int has_ttf_outlines(fm_entry * fm) { - FILE *f = fopen(fm->ff_name,"rb"); - if (f!=NULL) { + FILE *f = fopen(fm->ff_name, "rb"); + if (f != NULL) { int ch1 = getc(f); int ch2 = getc(f); int ch3 = getc(f); int ch4 = getc(f); - fclose (f); - if (ch1=='O' && ch2=='T' && ch3=='T' && ch4=='O') - return 0; - return 1; + fclose(f); + if (ch1 == 'O' && ch2 == 'T' && ch3 == 'T' && ch4 == 'O') + return 0; + return 1; } return 0; } @@ -759,7 +794,7 @@ void do_pdf_font(integer font_objnum, internalfontnumber f) set_truetype(fm); } else { set_opentype(fm); - } + } break; case truetype_format: set_truetype(fm); @@ -807,6 +842,7 @@ void do_pdf_font(integer font_objnum, internalfontnumber f) 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; cmp_return(i, j); diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.c b/Build/source/texk/web2c/luatexdir/font/writet1.c index 46563a6fb76..2832dbfae49 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.c +++ b/Build/source/texk/web2c/luatexdir/font/writet1.c @@ -25,7 +25,7 @@ #include "luatex-api.h" static const char _svn_version[] = - "$Id: writet1.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet1.c $"; + "$Id: writet1.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet1.c $"; #define t1_log(str) if(tracefilenames) tex_printf("%s", str) #define get_length1() t1_length1 = t1_offset() - t1_save_offset @@ -1407,6 +1407,7 @@ 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)); } diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.c b/Build/source/texk/web2c/luatexdir/font/writettf.c index 6a989db833f..7781407c37b 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.c +++ b/Build/source/texk/web2c/luatexdir/font/writettf.c @@ -23,7 +23,7 @@ #include <string.h> static const char _svn_version[] = - "$Id: writettf.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writettf.c $"; + "$Id: writettf.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writettf.c $"; #define DEFAULT_NTABS 14 #define NEW_CMAP_SIZE 2 @@ -130,6 +130,7 @@ ttf_cmap_entry *new_ttf_cmap_entry(void) static void destroy_ttf_cmap_entry(void *pa, void *pb) { ttf_cmap_entry *p; + (void)pb; p = (ttf_cmap_entry *) pa; xfree(p->ttf_name); xfree(p->table); @@ -147,6 +148,7 @@ static int comp_ttf_cmap_entry(const void *pa, const void *pb, void *p) const ttf_cmap_entry *p1 = (const ttf_cmap_entry *) pa, *p2 = (const ttf_cmap_entry *) pb; int i; + (void)p; assert(p1->ttf_name != NULL && p2->ttf_name != NULL); if ((i = strcmp(p1->ttf_name, p2->ttf_name)) != 0) return i; @@ -1421,6 +1423,7 @@ void do_writeotf(fd_entry * fd) { long i; dirtab_entry *tab; + (void)fd; dir_tab = NULL; glyph_tab = NULL; if (tracefilenames) diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.c b/Build/source/texk/web2c/luatexdir/image/epdf.c index dd61a166738..a30b87ebd12 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.c +++ b/Build/source/texk/web2c/luatexdir/image/epdf.c @@ -1,7 +1,7 @@ /* epdf.c - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -25,17 +25,8 @@ #include <string.h> static const char _svn_version[] = - "$Id: epdf.c 1407 2008-07-15 10:49:28Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/epdf.c $"; - -extern void epdf_check_mem(void); -extern void register_fd_entry(fd_entry *); - - -int is_subsetable(fm_entry * fm) -{ - assert(is_included(fm)); - return is_subsetted(fm); -} + "$Id: epdf.c 2331 2009-04-18 16:39:50Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/epdf.c $"; fd_entry *epdf_create_fontdescriptor(fm_entry * fm, int stemV) { @@ -57,19 +48,6 @@ fd_entry *epdf_create_fontdescriptor(fm_entry * fm, int stemV) return fd; } -integer get_fd_objnum(fd_entry * fd) -{ - assert(fd->fd_objnum != 0); - return fd->fd_objnum; -} - -integer get_fn_objnum(fd_entry * fd) -{ - if (fd->fn_objnum == 0) - fd->fn_objnum = pdf_new_objnum(); - return fd->fn_objnum; -} - /*********************************************************************** * Mark glyphs used by embedded PDF file: * 1. build fontdescriptor, if not yet existing @@ -98,11 +76,6 @@ void epdf_mark_glyphs(fd_entry * fd, char *charset) } } -void embed_whole_font(fd_entry * fd) -{ - fd->all_glyphs = true; -} - void epdf_free(void) { epdf_check_mem(); diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index d079c4c98c4..2b384d9ce5e 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.h @@ -1,7 +1,7 @@ /* epdf.h - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: epdf.h 2073 2009-03-21 10:06:50Z hhenkel $ */ +/* $Id: epdf.h 2327 2009-04-18 12:47:21Z hhenkel $ */ extern "C" { @@ -47,7 +47,7 @@ extern "C" { #include "image.h" #include "../utils/avlstuff.h" -/* #-define pdfbufsize pdfbufmax */ + extern void unrefPdfDocument(char *); extern integer epdf_page_box; extern void *epdf_xref; diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h index d619a2f585d..a2d47f6a471 100644 --- a/Build/source/texk/web2c/luatexdir/image/image.h +++ b/Build/source/texk/web2c/luatexdir/image/image.h @@ -1,7 +1,7 @@ /* image.h - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: image.h 2307 2009-04-16 17:37:31Z taco $ */ +/* $Id: image.h 2336 2009-04-19 08:38:24Z hhenkel $ */ #ifndef IMAGE_H # define IMAGE_H @@ -40,8 +40,6 @@ extern integer zround(double); /* from zround.c */ # define TYPE_IMG "image" # define TYPE_IMG_DICT "image-dict" -# define scaled integer - /**********************************************************************/ typedef struct { @@ -199,44 +197,4 @@ typedef struct { # define is_ht_running(N) (img_height(N) == null_flag) # define is_dp_running(N) (img_depth(N) == null_flag) -/**********************************************************************/ - -/* writeimg.c */ - -void new_img_pdfstream_struct(image_dict *); -void check_pdfstream_dict(image_dict *); -void write_pdfstream(image_dict *); -image *new_image(); -image_dict *new_image_dict(); -void init_image(image *); -void init_image_dict(image_dict *); -void scale_img(image *); -integer img_to_array(image *); -void delete_image(image *); -void free_image_dict(image_dict * p); -void read_img(image_dict *, integer, integer); - -/* writepng.c */ - -# ifndef boolean /* TODO: from where to get the original definition? */ -# define boolean int -# endif - -void read_png_info(image_dict *, img_readtype_e); -void read_jpg_info(image_dict *, img_readtype_e); -void read_jbig2_info(image_dict *); -void read_pdf_info(image_dict *, integer, integer); -void write_img(image_dict *); -void write_png(image_dict *); -void write_jpg(image_dict *); -void write_jbig2(image_dict *); -void write_epdf(image_dict *); - -extern void write_additional_epdf_objects(void); -extern void write_additional_png_objects(void); - -/* pdftoepdf.cc */ - -void unrefPdfDocument(char *); - -#endif +#endif /* IMAGE_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc index ff5c48b9e56..41d9fe0caec 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc @@ -45,7 +45,8 @@ #include "epdf.h" static const char _svn_version[] = - "$Id: pdftoepdf.cc 2195 2009-03-31 14:09:50Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/pdftoepdf.cc $"; + "$Id: pdftoepdf.cc 2325 2009-04-18 11:24:38Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/pdftoepdf.cc $"; #define one_hundred_bp 6578176 /* 7227 * 65536 / 72 */ diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h new file mode 100644 index 00000000000..50d89c0a861 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h @@ -0,0 +1,39 @@ +/* pdftoepdf.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> + + 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 <http://www.gnu.org/licenses/>. */ + +/* $Id: pdftoepdf.h 2331 2009-04-18 16:39:50Z hhenkel $ */ + +#ifndef PDFTOEPDF_H +# define PDFTOEPDF_H + +# include "image.h" + +void read_pdf_info(image_dict *, integer, integer); +void unrefPdfDocument(char *); +void write_additional_epdf_objects(void); +void write_epdf(image_dict *); +void epdf_check_mem(void); + +/* epdf.c --- this should go in an own header file */ +extern integer get_fontfile_num(int); +extern integer get_fontname_num(int); +extern void epdf_free(void); + +#endif /* PDFTOEPDF_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.c b/Build/source/texk/web2c/luatexdir/image/writeimg.c index c824bdbe079..35820522bad 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.c +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.c @@ -1,7 +1,7 @@ /* writeimg.c - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -24,18 +24,17 @@ #include <kpathsea/c-memstr.h> #include "image.h" +#include "writejpg.h" +#include "writepng.h" +#include "writejbig2.h" +#include "pdftoepdf.h" #include <../lua51/lua.h> #include <../lua51/lauxlib.h> static const char _svn_version[] = - "$Id: writeimg.c 2019 2009-03-14 00:15:58Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writeimg.c $"; - -extern void pdf_print_real(integer m, integer d); - -extern pdfstructure *pstruct; - -#define obj_aux(A) obj_tab[(A)].int4 + "$Id: writeimg.c 2336 2009-04-19 08:38:24Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writeimg.c $"; /**********************************************************************/ /* @@ -652,8 +651,7 @@ typedef image *img_entry; /* define img_ptr, img_array, & img_limit */ /* avoid use of size_t */ img_entry *img_ptr, *img_array = NULL; -integer img_limit; - +size_t img_limit; integer img_to_array(image * img) { @@ -663,8 +661,6 @@ integer img_to_array(image * img) return img_ptr++ - img_array; /* now img is read-only */ } - - /**********************************************************************/ /* To allow the use of \pdfrefximage inside saved boxes in -ini mode, @@ -683,14 +679,14 @@ integer img_to_array(image * img) /* some of the dumped values are really type int, not integer, * but since the macro falls back to generic_dump anyway, that - * does not matter. + * does not matter. */ #define dumpinteger generic_dump #define undumpinteger generic_undump /* (un)dumping a string means dumping the allocation size, followed - * by the bytes. The trailing \0 is dumped as well, because that + * by the bytes. The trailing \0 is dumped as well, because that * makes the code simpler. */ @@ -717,8 +713,6 @@ integer img_to_array(image * img) } else { s = NULL; } \ } while (0) - - void dumpimagemeta(void) { int cur_image, i; @@ -810,14 +804,11 @@ void undumpimagemeta(integer pdfversion, integer pdfinclusionerrorlevel) } } - - - /**********************************************************************/ /* stuff to be accessible from TeX */ -integer read_image(integer objnum, integer index, strnumber filename, - integer page_num, strnumber page_name, strnumber attr, +integer read_image(integer objnum, integer index, str_number filename, + integer page_num, str_number page_name, str_number attr, integer colorspace, integer page_box, integer pdf_minor_version, integer pdf_inclusion_errorlevel) { @@ -888,7 +879,6 @@ integer image_group_ref(integer ref) return img_group_ref(img_dict(img_array[ref])); } - /* The following five functions are for \pdfximagebbox */ integer epdf_xsize(integer ref) @@ -921,7 +911,6 @@ boolean is_png_image(integer ref) return img_type(img_dict(img_array[ref])) == IMG_TYPE_PNG; } - integer image_objnum(integer ref) { return img_objnum(img_dict(img_array[ref])); diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.h b/Build/source/texk/web2c/luatexdir/image/writeimg.h new file mode 100644 index 00000000000..a2d0c48da48 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.h @@ -0,0 +1,67 @@ +/* writeimg.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> + + 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 <http://www.gnu.org/licenses/>. */ + +/* $Id: writeimg.h 2327 2009-04-18 12:47:21Z hhenkel $ */ + +#ifndef WRITEIMG_H +# define WRITEIMG_H + +# include "image.h" + +boolean check_image_b(integer); +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(); +integer epdf_orig_x(integer i); +integer epdf_orig_y(integer i); +integer epdf_xsize(integer i); +integer epdf_ysize(integer i); +integer image_colordepth(integer img); +integer image_depth(integer); +integer image_height(integer); +integer image_index(integer); +integer image_objnum(integer); +integer image_pages(integer); +integer image_width(integer); +integer img_to_array(image *); +integer read_image(integer, integer, str_number, integer, str_number, str_number, + integer, integer, integer, integer); +void check_pdfstream_dict(image_dict *); +void dumpimagemeta(void); +void free_image_dict(image_dict * p); +void init_image_dict(image_dict *); +void init_image(image *); +void new_img_pdfstream_struct(image_dict *); +void out_image(integer, scaled, scaled); +void pdf_print_resname_prefix(void); +void read_img(image_dict *, integer, integer); +void scale_image(integer); +void scale_img(image *); +void set_image_dimensions(integer, integer, integer, integer); +void undumpimagemeta(integer, integer); +void update_image_procset(integer); +void write_image(integer); +void write_img(image_dict *); +void write_pdfstream(image_dict *); + +#endif /* WRITEIMG_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.c b/Build/source/texk/web2c/luatexdir/image/writejbig2.c index ea3363ef02c..0e65e69bda9 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.c +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.c @@ -1,7 +1,7 @@ /* writejbig2.c - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -80,36 +80,134 @@ object exists, reference it. Else create fresh one. ***********************************************************************/ -#include "writejbig2.h" - static const char _svn_version[] = - "$Id: writejbig2.c 1407 2008-07-15 10:49:28Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejbig2.c $"; + "$Id: writejbig2.c 2315 2009-04-17 23:34:42Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejbig2.c $"; #undef DEBUG +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> +#include "ptexlib.h" +#include "ptexmac.h" +#include "image.h" + +/**********************************************************************/ + +/* 7.3 Segment types */ +#define M_SymbolDictionary 0 +#define M_IntermediateTextRegion 4 +#define M_ImmediateTextRegion 6 +#define M_ImmediateLosslessTextRegion 7 +#define M_PatternDictionary 16 +#define M_IntermediateHalftoneRegion 20 +#define M_ImmediateHalftoneRegion 22 +#define M_ImmediateLosslessHalftoneRegion 23 +#define M_IntermediateGenericRegion 36 +#define M_ImmediateGenericRegion 38 +#define M_ImmediateLosslessGenericRegion 39 +#define M_IntermediateGenericRefinementRegion 40 +#define M_ImmediateGenericRefinementRegion 42 +#define M_ImmediateLosslessGenericRefinementRegion 43 +#define M_PageInformation 48 +#define M_EndOfPage 49 +#define M_EndOfStripe 50 +#define M_EndOfFile 51 +#define M_Profiles 52 +#define M_Tables 53 +#define M_Extension 62 + /**********************************************************************/ -struct avl_table *file_tree = NULL; +typedef enum { INITIAL, HAVEINFO, WRITEPDF } PHASE; + +typedef struct _LITEM { + struct _LITEM *prev; + struct _LITEM *next; + void *d; /* data */ +} LITEM; + +typedef struct _LIST { + LITEM *first; + LITEM *last; + struct avl_table *tree; +} LIST; + +typedef struct _SEGINFO { + unsigned long segnum; + boolean isrefered; + boolean refers; + unsigned int seghdrflags; /* set by readseghdr() */ + boolean pageassocsizeflag; /* set by readseghdr() */ + unsigned int reftosegcount; /* set by readseghdr() */ + unsigned int countofrefered; /* set by readseghdr() */ + unsigned int fieldlen; /* set by readseghdr() */ + unsigned int segnumwidth; /* set by readseghdr() */ + long segpage; /* set by readseghdr() */ + unsigned long segdatalen; /* set by readseghdr() */ + unsigned long hdrstart; /* set by readseghdr() */ + unsigned long hdrend; /* set by readseghdr() */ + unsigned long datastart; + unsigned long dataend; + boolean endofstripeflag; /* set by checkseghdrflags() */ + boolean endofpageflag; /* set by checkseghdrflags() */ + boolean pageinfoflag; /* set by checkseghdrflags() */ + boolean endoffileflag; /* set by checkseghdrflags() */ +} SEGINFO; + +typedef struct _PAGEINFO { + LIST segments; /* segments associated with page */ + unsigned long pagenum; + unsigned int width; + unsigned int height; + unsigned int xres; + unsigned int yres; + unsigned int pagesegmentflags; + unsigned int stripinginfo; + unsigned int stripedheight; +} PAGEINFO; + +typedef struct _FILEINFO { + FILE *file; + char *filepath; + long filesize; + LIST pages; /* not including page0 */ + LIST page0; + unsigned int filehdrflags; /* set by readfilehdr() */ + boolean sequentialaccess; /* set by readfilehdr() */ + unsigned long numofpages; /* set by readfilehdr() */ + unsigned long streamstart; /* set by get_jbig2_info() */ + unsigned long pdfpage0objnum; + PHASE phase; +} FILEINFO; + +/**********************************************************************/ + +static struct avl_table *file_tree = NULL; static int comp_file_entry(const void *pa, const void *pb, void *p) { + (void) p; return strcmp(((const FILEINFO *) pa)->filepath, ((const FILEINFO *) pb)->filepath); } static int comp_page_entry(const void *pa, const void *pb, void *p) { + (void) p; return ((const PAGEINFO *) pa)->pagenum - ((const PAGEINFO *) pb)->pagenum; } static int comp_segment_entry(const void *pa, const void *pb, void *p) { + (void) p; return ((const SEGINFO *) pa)->segnum - ((const SEGINFO *) pb)->segnum; } /**********************************************************************/ -int ygetc(FILE * stream) +static int ygetc(FILE * stream) { int c = getc(stream); if (c < 0) { @@ -123,7 +221,33 @@ int ygetc(FILE * stream) /**********************************************************************/ -FILEINFO *new_fileinfo() +static void initlinkedlist(LIST * lp) +{ + lp->first = NULL; + lp->last = NULL; + lp->tree = NULL; +} + +static LIST *litem_append(LIST * lp) +{ + LITEM *ip; + ip = xtalloc(1, LITEM); + if (lp->first == NULL) { + lp->first = ip; + ip->prev = NULL; + } else { + lp->last->next = ip; + ip->prev = lp->last; + } + lp->last = ip; + ip->next = NULL; + ip->d = NULL; + return lp; +} + +/**********************************************************************/ + +static FILEINFO *new_fileinfo() { FILEINFO *fip; fip = xtalloc(1, FILEINFO); @@ -141,7 +265,7 @@ FILEINFO *new_fileinfo() return fip; } -PAGEINFO *new_pageinfo() +static PAGEINFO *new_pageinfo() { PAGEINFO *pip; pip = xtalloc(1, PAGEINFO); @@ -157,7 +281,7 @@ PAGEINFO *new_pageinfo() return pip; } -void init_seginfo(SEGINFO * sip) +static void init_seginfo(SEGINFO * sip) { sip->segnum = 0; sip->isrefered = false; @@ -182,33 +306,7 @@ void init_seginfo(SEGINFO * sip) /**********************************************************************/ -void initlinkedlist(LIST * lp) -{ - lp->first = NULL; - lp->last = NULL; - lp->tree = NULL; -} - -LIST *litem_append(LIST * lp) -{ - LITEM *ip; - ip = xtalloc(1, LITEM); - if (lp->first == NULL) { - lp->first = ip; - ip->prev = NULL; - } else { - lp->last->next = ip; - ip->prev = lp->last; - } - lp->last = ip; - ip->next = NULL; - ip->d = NULL; - return lp; -} - -/**********************************************************************/ - -void pages_maketree(LIST * plp) +static void pages_maketree(LIST * plp) { LITEM *ip; void **aa; @@ -221,7 +319,7 @@ void pages_maketree(LIST * plp) } } -void segments_maketree(LIST * slp) +static void segments_maketree(LIST * slp) { LITEM *ip; void **aa; @@ -236,7 +334,7 @@ void segments_maketree(LIST * slp) /**********************************************************************/ -PAGEINFO *find_pageinfo(LIST * plp, unsigned long pagenum) +static PAGEINFO *find_pageinfo(LIST * plp, unsigned long pagenum) { PAGEINFO tmp; tmp.pagenum = pagenum; @@ -244,7 +342,7 @@ PAGEINFO *find_pageinfo(LIST * plp, unsigned long pagenum) return (PAGEINFO *) avl_find(plp->tree, &tmp); } -SEGINFO *find_seginfo(LIST * slp, unsigned long segnum) +static SEGINFO *find_seginfo(LIST * slp, unsigned long segnum) { SEGINFO tmp; tmp.segnum = segnum; @@ -254,13 +352,13 @@ SEGINFO *find_seginfo(LIST * slp, unsigned long segnum) /**********************************************************************/ -unsigned int read2bytes(FILE * f) +static unsigned int read2bytes(FILE * f) { unsigned int c = ygetc(f); return (c << 8) + ygetc(f); } -unsigned long read4bytes(FILE * f) +static unsigned long read4bytes(FILE * f) { unsigned int l = read2bytes(f); return (l << 16) + read2bytes(f); @@ -268,7 +366,7 @@ unsigned long read4bytes(FILE * f) /**********************************************************************/ -unsigned long getstreamlen(LITEM * slip, boolean refer) +static unsigned long getstreamlen(LITEM * slip, boolean refer) { SEGINFO *sip; unsigned long len = 0; @@ -282,7 +380,7 @@ unsigned long getstreamlen(LITEM * slip, boolean refer) /**********************************************************************/ -void readfilehdr(FILEINFO * fip) +static void readfilehdr(FILEINFO * fip) { unsigned int i; /* Annex D.4 File header syntax */ @@ -308,13 +406,61 @@ void readfilehdr(FILEINFO * fip) } /**********************************************************************/ + +static void checkseghdrflags(SEGINFO * sip) +{ + sip->endofstripeflag = false; + sip->endofpageflag = false; + sip->pageinfoflag = false; + sip->endoffileflag = false; + /* 7.3 Segment types */ + switch (sip->seghdrflags & 0x3f) { + case M_SymbolDictionary: + case M_IntermediateTextRegion: + case M_ImmediateTextRegion: + case M_ImmediateLosslessTextRegion: + case M_PatternDictionary: + case M_IntermediateHalftoneRegion: + case M_ImmediateHalftoneRegion: + case M_ImmediateLosslessHalftoneRegion: + case M_IntermediateGenericRegion: + case M_ImmediateGenericRegion: + case M_ImmediateLosslessGenericRegion: + case M_IntermediateGenericRefinementRegion: + case M_ImmediateGenericRefinementRegion: + case M_ImmediateLosslessGenericRefinementRegion: + break; + case M_PageInformation: + sip->pageinfoflag = true; + break; + case M_EndOfPage: + sip->endofpageflag = true; + break; + case M_EndOfStripe: + sip->endofstripeflag = true; + break; + case M_EndOfFile: + sip->endoffileflag = true; + break; + case M_Profiles: + case M_Tables: + case M_Extension: + break; + default: + pdftex_fail + ("checkseghdrflags(): unknown segment type in JBIG2 image file"); + break; + } +} + +/**********************************************************************/ /* for first reading of file; return value tells if header been read */ -boolean readseghdr(FILEINFO * fip, SEGINFO * sip) +static boolean readseghdr(FILEINFO * fip, SEGINFO * sip) { unsigned int i; sip->hdrstart = xftell(fip->file, fip->filepath); - if (fip->sequentialaccess && sip->hdrstart == fip->filesize) + if (fip->sequentialaccess && sip->hdrstart == (unsigned) fip->filesize) return false; /* no endoffileflag is ok for sequentialaccess */ #ifdef DEBUG printf("\nhdrstart %d\n", sip->hdrstart); @@ -375,9 +521,26 @@ boolean readseghdr(FILEINFO * fip, SEGINFO * sip) } /**********************************************************************/ + +static void checkseghdr(FILEINFO * fip, SEGINFO * sip); + +static void markpage0seg(FILEINFO * fip, unsigned long referedseg) +{ + PAGEINFO *pip; + SEGINFO *sip; + pip = fip->page0.first->d; + sip = find_seginfo(&(pip->segments), referedseg); + if (sip != NULL) { + if (!sip->refers && sip->countofrefered > 0) + checkseghdr(fip, sip); + sip->isrefered = true; + } +} + +/**********************************************************************/ /* for writing, marks refered page0 segments, sets segpage > 0 to 1 */ -void writeseghdr(FILEINFO * fip, SEGINFO * sip) +static void writeseghdr(FILEINFO * fip, SEGINFO * sip) { unsigned int i; unsigned long referedseg = 0; @@ -428,7 +591,7 @@ void writeseghdr(FILEINFO * fip, SEGINFO * sip) /**********************************************************************/ /* for recursive marking of refered page0 segments */ -void checkseghdr(FILEINFO * fip, SEGINFO * sip) +static void checkseghdr(FILEINFO * fip, SEGINFO * sip) { unsigned int i; unsigned long referedseg = 0; @@ -465,70 +628,7 @@ void checkseghdr(FILEINFO * fip, SEGINFO * sip) /**********************************************************************/ -void checkseghdrflags(SEGINFO * sip) -{ - sip->endofstripeflag = false; - sip->endofpageflag = false; - sip->pageinfoflag = false; - sip->endoffileflag = false; - /* 7.3 Segment types */ - switch (sip->seghdrflags & 0x3f) { - case M_SymbolDictionary: - case M_IntermediateTextRegion: - case M_ImmediateTextRegion: - case M_ImmediateLosslessTextRegion: - case M_PatternDictionary: - case M_IntermediateHalftoneRegion: - case M_ImmediateHalftoneRegion: - case M_ImmediateLosslessHalftoneRegion: - case M_IntermediateGenericRegion: - case M_ImmediateGenericRegion: - case M_ImmediateLosslessGenericRegion: - case M_IntermediateGenericRefinementRegion: - case M_ImmediateGenericRefinementRegion: - case M_ImmediateLosslessGenericRefinementRegion: - break; - case M_PageInformation: - sip->pageinfoflag = true; - break; - case M_EndOfPage: - sip->endofpageflag = true; - break; - case M_EndOfStripe: - sip->endofstripeflag = true; - break; - case M_EndOfFile: - sip->endoffileflag = true; - break; - case M_Profiles: - case M_Tables: - case M_Extension: - break; - default: - pdftex_fail - ("checkseghdrflags(): unknown segment type in JBIG2 image file"); - break; - } -} - -/**********************************************************************/ - -void markpage0seg(FILEINFO * fip, unsigned long referedseg) -{ - PAGEINFO *pip; - SEGINFO *sip; - pip = fip->page0.first->d; - sip = find_seginfo(&(pip->segments), referedseg); - if (sip != NULL) { - if (!sip->refers && sip->countofrefered > 0) - checkseghdr(fip, sip); - sip->isrefered = true; - } -} - -/**********************************************************************/ - -unsigned long findstreamstart(FILEINFO * fip) +static unsigned long findstreamstart(FILEINFO * fip) { SEGINFO tmp; assert(!fip->sequentialaccess); /* D.2 Random-access organisation */ @@ -542,7 +642,7 @@ unsigned long findstreamstart(FILEINFO * fip) /**********************************************************************/ -void rd_jbig2_info(FILEINFO * fip) +static void rd_jbig2_info(FILEINFO * fip) { unsigned long seekdist = 0; /* for sequential-access only */ unsigned long streampos = 0; /* for random-access only */ @@ -564,7 +664,7 @@ void rd_jbig2_info(FILEINFO * fip) if (!readseghdr(fip, sip) || sip->endoffileflag) break; if (sip->segpage > 0) { - if (sip->segpage > currentpage) { + if (sip->segpage > (int) currentpage) { plp = litem_append(&(fip->pages)); plp->last->d = new_pageinfo(); currentpage = sip->segpage; @@ -625,7 +725,7 @@ void rd_jbig2_info(FILEINFO * fip) /**********************************************************************/ -void wr_jbig2(FILEINFO * fip, unsigned long page) +static void wr_jbig2(FILEINFO * fip, unsigned long page) { LITEM *slip; PAGEINFO *pip; @@ -719,8 +819,6 @@ void read_jbig2_info(image_dict * idict) img_colordepth(idict) = 1; } -/**********************************************************************/ - void write_jbig2(image_dict * idict) { FILEINFO *fip, tmp; @@ -737,8 +835,6 @@ void write_jbig2(image_dict * idict) img_file(idict) = NULL; } -/**********************************************************************/ - void flush_jbig2_page0_objects() { FILEINFO *fip; diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.h b/Build/source/texk/web2c/luatexdir/image/writejbig2.h index 5bc91920889..cb43e7f200f 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.h +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.h @@ -1,7 +1,7 @@ /* writejbig2.h - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -18,136 +18,15 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/*********************************************************************** -This is experimental JBIG2 image support to pdfTeX. JBIG2 image decoding -is part of Adobe PDF-1.4, and requires Acroread 5.0 or later. - -$Id: writejbig2.h 1224 2008-05-02 15:26:27Z oneiros $ -***********************************************************************/ - -#include <stdlib.h> -#include <stdio.h> -#include <assert.h> -#include "ptexlib.h" -#include "ptexmac.h" -#include "image.h" - -/* 7.3 Segment types */ -#define M_SymbolDictionary 0 -#define M_IntermediateTextRegion 4 -#define M_ImmediateTextRegion 6 -#define M_ImmediateLosslessTextRegion 7 -#define M_PatternDictionary 16 -#define M_IntermediateHalftoneRegion 20 -#define M_ImmediateHalftoneRegion 22 -#define M_ImmediateLosslessHalftoneRegion 23 -#define M_IntermediateGenericRegion 36 -#define M_ImmediateGenericRegion 38 -#define M_ImmediateLosslessGenericRegion 39 -#define M_IntermediateGenericRefinementRegion 40 -#define M_ImmediateGenericRefinementRegion 42 -#define M_ImmediateLosslessGenericRefinementRegion 43 -#define M_PageInformation 48 -#define M_EndOfPage 49 -#define M_EndOfStripe 50 -#define M_EndOfFile 51 -#define M_Profiles 52 -#define M_Tables 53 -#define M_Extension 62 - -/**********************************************************************/ - -typedef enum { INITIAL, HAVEINFO, WRITEPDF } PHASE; - -typedef struct _LITEM { - struct _LITEM *prev; - struct _LITEM *next; - void *d; /* data */ -} LITEM; - -typedef struct _LIST { - LITEM *first; - LITEM *last; - struct avl_table *tree; -} LIST; - -typedef struct _SEGINFO { - unsigned long segnum; - boolean isrefered; - boolean refers; - unsigned int seghdrflags; /* set by readseghdr() */ - boolean pageassocsizeflag; /* set by readseghdr() */ - unsigned int reftosegcount; /* set by readseghdr() */ - unsigned int countofrefered; /* set by readseghdr() */ - unsigned int fieldlen; /* set by readseghdr() */ - unsigned int segnumwidth; /* set by readseghdr() */ - long segpage; /* set by readseghdr() */ - unsigned long segdatalen; /* set by readseghdr() */ - unsigned long hdrstart; /* set by readseghdr() */ - unsigned long hdrend; /* set by readseghdr() */ - unsigned long datastart; - unsigned long dataend; - boolean endofstripeflag; /* set by checkseghdrflags() */ - boolean endofpageflag; /* set by checkseghdrflags() */ - boolean pageinfoflag; /* set by checkseghdrflags() */ - boolean endoffileflag; /* set by checkseghdrflags() */ -} SEGINFO; - -typedef struct _PAGEINFO { - LIST segments; /* segments associated with page */ - unsigned long pagenum; - unsigned int width; - unsigned int height; - unsigned int xres; - unsigned int yres; - unsigned int pagesegmentflags; - unsigned int stripinginfo; - unsigned int stripedheight; -} PAGEINFO; +/* $Id: writejbig2.h 2327 2009-04-18 12:47:21Z hhenkel $ */ -typedef struct _FILEINFO { - FILE *file; - char *filepath; - long filesize; - LIST pages; /* not including page0 */ - LIST page0; - unsigned int filehdrflags; /* set by readfilehdr() */ - boolean sequentialaccess; /* set by readfilehdr() */ - unsigned long numofpages; /* set by readfilehdr() */ - unsigned long streamstart; /* set by get_jbig2_info() */ - unsigned long pdfpage0objnum; - PHASE phase; -} FILEINFO; +#ifndef WRITEJBIG2_H +# define WRITEJBIG2_H -/**********************************************************************/ +# include "image.h" -static int comp_file_entry(const void *, const void *, void *); -static int comp_page_entry(const void *, const void *, void *); -static int comp_segment_entry(const void *, const void *, void *); -int ygetc(FILE *); -FILEINFO *new_fileinfo(); -PAGEINFO *new_pageinfo(); -void initseginfo(SEGINFO *); -void initlinkedlist(LIST *); -LIST *litem_append(LIST *); -void pages_maketree(LIST *); -void segments_maketree(LIST *); -PAGEINFO *find_pageinfo(LIST *, unsigned long); -SEGINFO *find_seginfo(LIST *, unsigned long); -unsigned int read2bytes(FILE *); -unsigned long read4bytes(FILE *); -unsigned long getstreamlen(LITEM *, boolean); -void readfilehdr(FILEINFO *); -boolean readseghdr(FILEINFO *, SEGINFO *); -void writeseghdr(FILEINFO *, SEGINFO *); -void checkseghdr(FILEINFO *, SEGINFO *); -void checkseghdrflags(SEGINFO * sip); -void markpage0seg(FILEINFO *, unsigned long); -unsigned long findstreamstart(FILEINFO *); -void rd_jbig2_info(FILEINFO *); -void wr_jbig2(FILEINFO *, unsigned long); +void flush_jbig2_page0_objects(); void read_jbig2_info(image_dict *); void write_jbig2(image_dict *); -void flushjbig2page0objects(); -/**********************************************************************/ +#endif /* WRITEJBIG"_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/writejpg.c b/Build/source/texk/web2c/luatexdir/image/writejpg.c index bff9b0ed61a..44bd3549982 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejpg.c +++ b/Build/source/texk/web2c/luatexdir/image/writejpg.c @@ -1,7 +1,7 @@ /* writejpg.c - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -23,11 +23,12 @@ #include "image.h" static const char _svn_version[] = - "$Id: writejpg.c 1224 2008-05-02 15:26:27Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejpg.c $"; + "$Id: writejpg.c 2320 2009-04-18 08:52:30Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejpg.c $"; -#define JPG_GRAY 1 /* Gray color space, use /DeviceGray */ -#define JPG_RGB 3 /* RGB color space, use /DeviceRGB */ -#define JPG_CMYK 4 /* CMYK color space, use /DeviceCMYK */ +#define JPG_GRAY 1 /* Gray color space, use /DeviceGray */ +#define JPG_RGB 3 /* RGB color space, use /DeviceRGB */ +#define JPG_CMYK 4 /* CMYK color space, use /DeviceCMYK */ typedef enum { /* JPEG marker codes */ M_SOF0 = 0xc0, /* baseline DCT */ @@ -102,7 +103,7 @@ static JPG_UINT16 read2bytes(FILE * f) return (c << 8) + xgetc(f); } -void close_and_cleanup_jpg(image_dict * idict) +static void close_and_cleanup_jpg(image_dict * idict) { assert(idict != NULL); assert(img_file(idict) != NULL); diff --git a/Build/source/texk/web2c/luatexdir/image/writejpg.h b/Build/source/texk/web2c/luatexdir/image/writejpg.h new file mode 100644 index 00000000000..bd497c9e114 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/image/writejpg.h @@ -0,0 +1,31 @@ +/* writejpg.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> + + 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 <http://www.gnu.org/licenses/>. */ + +/* $Id: writejpg.h 2327 2009-04-18 12:47:21Z hhenkel $ */ + +#ifndef WRITEJPG_H +# define WRITEJPG_H + +# include "image.h" + +void read_jpg_info(image_dict *, img_readtype_e); +void write_jpg(image_dict *); + +#endif /* WRITEJPG_H */ diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.c b/Build/source/texk/web2c/luatexdir/image/writepng.c index a1f160bf7fa..8fc47a3b35c 100644 --- a/Build/source/texk/web2c/luatexdir/image/writepng.c +++ b/Build/source/texk/web2c/luatexdir/image/writepng.c @@ -1,7 +1,7 @@ /* writepng.c - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -23,11 +23,12 @@ #include "image.h" static const char _svn_version[] = - "$Id: writepng.c 2029 2009-03-14 19:10:25Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writepng.c $"; + "$Id: writepng.c 2317 2009-04-18 00:12:18Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writepng.c $"; static int transparent_page_group = -1; -void close_and_cleanup_png(image_dict * idict) +static void close_and_cleanup_png(image_dict * idict) { assert(idict != NULL); assert(img_file(idict) != NULL); @@ -125,7 +126,6 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) if (j % 2 == 0) pdf_buf[pdf_ptr++] = *r++; \ else smask[smask_ptr++] = *r++ - #define write_rgb_pixel_16(r) \ if (!(j % 8 == 6||j % 8 == 7)) pdf_buf[pdf_ptr++] = *r++; \ else smask[smask_ptr++] = *r++ @@ -137,7 +137,7 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) #define write_simple_pixel(r) pdf_buf[pdf_ptr++] = *r++ #define write_noninterlaced(outmac) \ - for (i = 0; (unsigned) i < (int)info_p->height; i++) { \ + for (i = 0; i < (int)info_p->height; i++) { \ png_read_row(png_p, row, NULL); \ r = row; \ k = info_p->rowbytes; \ @@ -152,7 +152,7 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) } #define write_interlaced(outmac) \ - for (i = 0; (unsigned) i < (int)info_p->height; i++) { \ + for (i = 0; i < (int)info_p->height; i++) { \ row = rows[i]; \ k = info_p->rowbytes; \ while(k > 0) { \ @@ -166,7 +166,7 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) xfree(rows[i]); \ } -void write_png_palette(image_dict * idict) +static void write_png_palette(image_dict * idict) { int i, j, k, l; png_structp png_p = img_png_png_ptr(idict); @@ -211,7 +211,7 @@ void write_png_palette(image_dict * idict) } } -void write_png_gray(image_dict * idict) +static void write_png_gray(image_dict * idict) { int i, j, k, l; png_structp png_p = img_png_png_ptr(idict); @@ -241,7 +241,7 @@ void write_png_gray(image_dict * idict) pdf_end_stream(); } -void write_png_gray_alpha(image_dict * idict) +static void write_png_gray_alpha(image_dict * idict) { int i, j, k, l; png_structp png_p = img_png_png_ptr(idict); @@ -310,7 +310,7 @@ void write_png_gray_alpha(image_dict * idict) xfree(smask); } -void write_png_rgb(image_dict * idict) +static void write_png_rgb(image_dict * idict) { int i, j, k, l; png_structp png_p = img_png_png_ptr(idict); @@ -340,7 +340,7 @@ void write_png_rgb(image_dict * idict) pdf_end_stream(); } -void write_png_rgb_alpha(image_dict * idict) +static void write_png_rgb_alpha(image_dict * idict) { int i, j, k, l; png_structp png_p = img_png_png_ptr(idict); @@ -413,11 +413,11 @@ void write_png_rgb_alpha(image_dict * idict) /**********************************************************************/ /* - * The |copy_png| function is from Hartmut Henkel. The goal is to use + * The |copy_png| function is from Hartmut Henkel. The goal is to use * pdf's native FlateDecode support if that is possible. * * Only a subset of the png files allows this, but when possible it - * greatly improves inclusion speed. + * greatly improves inclusion speed. * * Code cheerfully gleaned from Thomas Merz' PDFlib, * file p_png.c "SPNG - Simple PNG" @@ -434,7 +434,7 @@ static int spng_getint(FILE * fp) #define SPNG_CHUNK_IDAT 0x49444154 #define SPNG_CHUNK_IEND 0x49454E44 -void copy_png(image_dict * idict) +static void copy_png(image_dict * idict) { png_structp png_p; png_infop info_p; @@ -507,7 +507,7 @@ void copy_png(image_dict * idict) } while (endflag == false); } -void reopen_png(image_dict * idict) +static void reopen_png(image_dict * idict) { integer width, height, xres, yres; width = img_xsize(idict); /* do consistency check */ @@ -554,7 +554,7 @@ void write_png(image_dict * idict) (fixed_gamma / 1000.0) * (1000.0 / fixed_image_gamma); } } - /* the switching between |info_p| and |png_p| queries has been trial and error. + /* the switching between |info_p| and |png_p| queries has been trial and error. */ if (fixed_pdf_minor_version > 1 && info_p->interlace_type == PNG_INTERLACE_NONE && (png_p->transformations == 0 || png_p->transformations == 0x2000) /* gamma */ &&!(png_p->color_type == PNG_COLOR_TYPE_GRAY_ALPHA || @@ -648,12 +648,11 @@ void write_png(image_dict * idict) close_and_cleanup_png(idict); } - - static boolean transparent_page_group_was_written = false; /* Called after the xobject generated by write_png has been finished; used to * write out additional objects */ + void write_additional_png_objects(void) { return; /* this interferes with current macro-based usage and cannot be configured */ diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.h b/Build/source/texk/web2c/luatexdir/image/writepng.h new file mode 100644 index 00000000000..4683e694a0c --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/image/writepng.h @@ -0,0 +1,32 @@ +/* writepng.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> + + 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 <http://www.gnu.org/licenses/>. */ + +/* $Id: writepng.h 2327 2009-04-18 12:47:21Z hhenkel $ */ + +#ifndef WRITEPNG_H +# define WRITEPNG_H + +# include "image.h" + +void read_png_info(image_dict *, img_readtype_e); +void write_additional_png_objects(void); +void write_png(image_dict *); + +#endif /* WRITEPNG_H */ diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.c b/Build/source/texk/web2c/luatexdir/lang/texlang.c index d451e302e6b..8678a2615a0 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.c +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.c @@ -27,7 +27,7 @@ #include "hyphen.h" static const char _svn_version[] = - "$Id: texlang.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/lang/texlang.c $"; + "$Id: texlang.c 2338 2009-04-20 06:37:43Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/lang/texlang.c $"; /* functions from the fontforge unicode library */ @@ -223,7 +223,7 @@ integer get_post_exhyphen_char(integer n) void load_patterns(struct tex_language *lang, unsigned char *buffer) { - if (lang == NULL) + if (lang == NULL || buffer == NULL || strlen((char *)buffer) == 0) return; if (lang->patterns == NULL) { lang->patterns = hnj_hyphen_new(); diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c index 266553aef45..78e6aa3bf4b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c @@ -22,7 +22,7 @@ #include "nodes.h" static const char _svn_version[] = - "$Id: lfontlib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lfontlib.c $"; + "$Id: lfontlib.c 2347 2009-04-22 11:51:15Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lfontlib.c $"; #define TIMERS 0 @@ -34,6 +34,14 @@ static const char _svn_version[] = /* this function is in vfovf.c for the moment */ extern int make_vf_table(lua_State * L, char *name, scaled s); +static int get_fontid (void) +{ + if (font_tables==NULL || font_tables[0]==NULL) { + create_null_font(); + } + return new_font(); +} + static int font_read_tfm(lua_State * L) { internalfontnumber f; @@ -45,8 +53,8 @@ static int font_read_tfm(lua_State * L) if (lua_isnumber(L, 2)) { s = (integer) lua_tonumber(L, 2); if (strlen(cnom)) { - f = new_font(); - if (read_tfm_info(f, cnom, "", s)) { + f = get_fontid(); + if (read_tfm_info(f, cnom, s)) { k = font_to_lua(L, f); delete_font(f); return k; @@ -201,7 +209,7 @@ static int deffont(lua_State * L) double tvdiff; #endif luaL_checktype(L, -1, LUA_TTABLE); - i = new_font(); + i = get_fontid(); #if TIMERS gettimeofday(&tva, NULL); #endif @@ -230,7 +238,7 @@ static int deffont(lua_State * L) /* this returns the expected (!) next fontid. */ static int nextfontid(lua_State * L) { - int i = new_font(); + int i = get_fontid(); lua_pushnumber(L, i); delete_font(i); return 1; diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index 1054a03a779..ac93fb4305d 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -23,11 +23,11 @@ #include <../lua51/lua.h> #include <../lua51/lauxlib.h> #include <ptexlib.h> -#include "../image/image.h" #include "../luatex-api.h" static const char _svn_version[] = - "$Id: limglib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/limglib.c $"; + "$Id: limglib.c 2329 2009-04-18 14:25:30Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/limglib.c $"; /**********************************************************************/ @@ -568,11 +568,6 @@ static int l_scan_image(lua_State * L) return 1; /* image */ } -/* DANGER! these should go into some header file... */ -#define obj_type_ximage 7 -#define obj_aux(a) obj_tab[a].int4 /* auxiliary pointer */ -#define obj_data_ptr obj_aux /* pointer to |pdf_mem| */ - static halfword img_to_node(image * a, integer ref) { image_dict *ad; diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index da9f4328a04..ab2761ea13d 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -21,7 +21,8 @@ #include <ptexlib.h> static const char _svn_version[] = - "$Id: lpdflib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lpdflib.c $"; + "$Id: lpdflib.c 2329 2009-04-18 14:25:30Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lpdflib.c $"; static int findcurv(lua_State * L) { @@ -98,9 +99,6 @@ int luapdfprint(lua_State * L) return 0; } -/* DANGER! this should go into some header file */ -#define obj_type_others 0 - static int l_immediateobj(lua_State * L) { unsigned i; diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index d98cfadfcb4..e012a7bcb69 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -22,7 +22,7 @@ static const char _svn_version[] = - "$Id: lstatslib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lstatslib.c $"; + "$Id: lstatslib.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lstatslib.c $"; typedef struct statistic { const char *name; @@ -219,6 +219,7 @@ static int getstats(lua_State * L) static int setstats(lua_State * L) { + (void)L; return 0; } diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c index 28d6a1e1a22..e938c856340 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c @@ -21,9 +21,9 @@ #include <ptexlib.h> static const char _svn_version[] = - "$Id: ltexiolib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexiolib.c $"; + "$Id: ltexiolib.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexiolib.c $"; -typedef void (*texio_printer) (strnumber s); +typedef void (*texio_printer) (str_number s); static char *loggable_info = NULL; @@ -51,11 +51,11 @@ static boolean get_selector_value(lua_State * L, int i, char *l) static int do_texio_print(lua_State * L, texio_printer printfunction) { - strnumber texs; + str_number texs; char *s; size_t k; int i = 1; - strnumber u = 0; + str_number u = 0; char save_selector = selector; int n = lua_gettop(L); if (n == 0 || !lua_isstring(L, -1)) { diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index e7384a40ec2..6326f00c39a 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -24,7 +24,7 @@ #include "tokens.h" static const char _svn_version[] = - "$Id: ltexlib.c 2282 2009-04-14 11:00:47Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; + "$Id: ltexlib.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; extern halfword *check_isnode(lua_State * L, int ud); extern void lua_nodelib_push_fast(lua_State * L, halfword n); @@ -521,7 +521,7 @@ static int settoks (lua_State * L) static int gettoks(lua_State * L) { integer k; - strnumber t; + str_number t; k = get_item_index (L, lua_gettop(L), get_toks_base()); check_index_range(k,"gettoks"); t = get_tex_toks_register(k); diff --git a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c index 06d1f72359f..41df1101814 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c @@ -22,7 +22,7 @@ #include "tokens.h" static const char _svn_version[] = - "$Id: ltokenlib.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltokenlib.c $"; + "$Id: ltokenlib.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltokenlib.c $"; extern int get_command_id(char *); @@ -204,6 +204,7 @@ static int run_get_next(lua_State * L) static int run_expand(lua_State * L) { + (void)L; expand(); return 0; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.c b/Build/source/texk/web2c/luatexdir/lua/luainit.c index 5aecc526921..18db3984e4f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.c +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.c @@ -25,7 +25,7 @@ #include <luatexdir/luatexextra.h> static const char _svn_version[] = - "$Id: luainit.c 2288 2009-04-14 22:56:09Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luainit.c $"; + "$Id: luainit.c 2330 2009-04-18 16:21:21Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luainit.c $"; /* TH: TODO * @@ -438,20 +438,16 @@ void init_kpse(void) if (!user_progname) { if (ini_version) { user_progname = input_name; + if (!user_progname) { + user_progname = cleaned_invocation_name(argv[0]); + } } else { - if (!startup_filename) { - if (!dump_name) { - dump_name = cleaned_invocation_name(argv[0]); - user_progname = dump_name; - } + if (!dump_name) { + dump_name = cleaned_invocation_name(argv[0]); } + user_progname = dump_name; } } - if (!user_progname) { - fprintf(stdout, "kpathsea mode needs a --progname or --fmt switch\n"); - exit(1); - } - kpse_set_program_enabled(kpse_fmt_format, MAKE_TEX_FMT_BY_DEFAULT, kpse_src_compile); @@ -506,7 +502,6 @@ void lua_initialize(int ac, char **av) interactionoption = 4; dump_name = NULL; -#warning SyncTeX: -synctex command line option available /* 0 means "disable Synchronize TeXnology". * synctexoption is a *.web variable. * We initialize it to a weird value to catch the -synctex command line flag @@ -655,16 +650,16 @@ void write_svnversion(char *v) { char *a_head, *n; char *a = strdup(v); - int l = strlen("$Id: luatex.web "); + size_t l = strlen("$Id: luatex.web "); if (a != NULL) { a_head = a; - if (strlen(a)>l) - a+=l; - n = a; - while (*n!='\0' && *n!=' ') - n++; - *n = '\0'; - fprintf(stdout, " luatex.web v%s", a); - free (a_head); + if (strlen(a)>l) + a+=l; + n = a; + while (*n!='\0' && *n!=' ') + n++; + *n = '\0'; + fprintf(stdout, " luatex.web >= v%s", a); + free (a_head); } } diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.c b/Build/source/texk/web2c/luatexdir/lua/luastuff.c index a8ac317b5f1..493e515f7e8 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luastuff.c +++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.c @@ -21,7 +21,7 @@ #include <ptexlib.h> static const char _svn_version[] = - "$Id: luastuff.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luastuff.c $"; + "$Id: luastuff.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luastuff.c $"; lua_State *Luas = NULL; @@ -381,7 +381,7 @@ void luatex_load_init(int s, LoadS * ls) lua_State *luatex_error(lua_State * L, int is_fatal) { - strnumber s; + str_number s; const char *luaerr; size_t len = 0; char *err = NULL; diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex.c b/Build/source/texk/web2c/luatexdir/lua/luatex.c index 41987c681cc..eed9adf27eb 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex.c +++ b/Build/source/texk/web2c/luatexdir/lua/luatex.c @@ -22,7 +22,7 @@ #include <zlib.h> static const char _svn_version[] = - "$Id: luatex.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luatex.c $"; + "$Id: luatex.c 2306 2009-04-16 15:01:45Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luatex.c $"; /* do this aleph stuff here, for now */ @@ -251,6 +251,7 @@ static gzFile gz_fmtfile = NULL; void do_zdump(char *p, int item_size, int nitems, FILE * out_file) { int err; + (void)out_file; if (nitems == 0) return; if (gzwrite(gz_fmtfile, (void *) p, item_size * nitems) != @@ -264,6 +265,7 @@ void do_zdump(char *p, int item_size, int nitems, FILE * out_file) void do_zundump(char *p, int item_size, int nitems, FILE * in_file) { int err; + (void)in_file; if (nitems == 0) return; if (gzread(gz_fmtfile, (void *) p, item_size * nitems) <= 0) { @@ -323,6 +325,7 @@ boolean zopen_w_output(FILE ** f, const_string fopen_mode) void zwclose(FILE * f) { + (void)f; gzclose(gz_fmtfile); } diff --git a/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.c b/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.c index 0f70fba106e..8e94271038e 100644 --- a/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.c +++ b/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.c @@ -122,8 +122,10 @@ int lprofP_callhookOUT(lprofP_STATE* S) { lprofP_STATE* lprofP_init_core_profiler(const char *_out_filename, int isto_printheader, float _function_call_time) { lprofP_STATE* S; char auxs[256]; +#ifdef WIN32 char *s; char *randstr; +#endif const char *out_filename; function_call_time = _function_call_time; @@ -131,6 +133,7 @@ lprofP_STATE* lprofP_init_core_profiler(const char *_out_filename, int isto_prin /* the random string to build the logname is extracted */ /* from 'tmpnam()' (the '/tmp/' part is deleted) */ +#ifdef WIN32 randstr = tmpnam(NULL); for (s = strtok(randstr, "/\\"); s; s = strtok(NULL, "/\\")) { randstr = s; @@ -141,6 +144,10 @@ lprofP_STATE* lprofP_init_core_profiler(const char *_out_filename, int isto_prin sprintf(auxs, out_filename, randstr); outf = fopen(auxs, "a"); +#else + sprintf(auxs,"lprof_XXXXXX"); + outf = fdopen(mkstemp(auxs), "a"); +#endif if (!outf) { return 0; } diff --git a/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.h b/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.h index d066ef3d08b..cae18792f19 100644 --- a/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.h +++ b/Build/source/texk/web2c/luatexdir/luaprofiler/core_profiler.h @@ -29,3 +29,4 @@ int lprofP_callhookOUT(lprofP_STATE* S); /* returns true if the file could be opened */ lprofP_STATE* lprofP_init_core_profiler(const char *_out_filename, int isto_printheader, float _function_call_time); +void lprofP_close_core_profiler(lprofP_STATE* S); diff --git a/Build/source/texk/web2c/luatexdir/luatex.defines b/Build/source/texk/web2c/luatexdir/luatex.defines index 49795fdffd7..82d24044977 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.defines +++ b/Build/source/texk/web2c/luatexdir/luatex.defines @@ -50,7 +50,7 @@ @define function varmemcast(); @define type void; @define procedure init_node_mem(); -@define procedure print_node_mem_stats(); +@define procedure print_node_mem_stats; @define procedure dump_node_mem; @define procedure undump_node_mem; @define function visible_last_node_type(); @@ -455,7 +455,7 @@ @define function make_name_string; @define procedure print_file_name(); -{ functions from utils.c } +{ functions from utils/utils.c } @define procedure escapehex(); @define procedure escapename(); @define procedure escapestring(); @@ -496,10 +496,22 @@ @define function getlly; @define function geturx; @define function getury; + +{functions from pdf/pagetree.c } @define function pdf_do_page_divert(); @define procedure pdf_do_page_undivert(); @define function output_pages_tree; +{ functions from pdf/pdfpage.c } +@define procedure pdf_place_rule(); +@define procedure pdf_place_glyph(); +@define procedure pdf_place_form(); +@define procedure pdf_goto_pagemode; +@define procedure pdf_page_init; +@define procedure pdf_set_pos(); +@define procedure pdf_end_string_nl; +@define procedure pdf_print_charwidth(); + {functions from texpdf.c } @define procedure pdf_print_char(); @@ -524,7 +536,7 @@ { functions from writefont.c } @define procedure do_pdf_font(); -{ functions from writeimg.c } +{ functions from image/writeimg.c } @define function check_image_b(); @define function check_image_c(); @define function check_image_i(); @@ -534,38 +546,24 @@ @define function epdf_orig_y(); @define function image_pages(); @define function image_colordepth(); -@define function image_groupref(); @define function image_index(); @define function image_width(); @define function image_height(); @define function image_depth(); @define function image_objnum(); -@define function image_imgnum(); @define function is_pdf_image(); @define function is_png_image(); @define function read_image(); -@define function new_image_entry; @define procedure update_image_procset(); @define procedure write_image(); @define procedure scale_image(); @define procedure set_image_dimensions(); -@define procedure set_image_index(); @define procedure out_image(); @define procedure dumpimagemeta; @define procedure undumpimagemeta(); -{ functions from limglib.c } - -{ functions from pdfpage.c } -@define procedure pdf_place_rule(); -@define procedure pdf_place_glyph(); -@define procedure pdf_place_form(); -@define procedure pdf_goto_pagemode; -@define procedure pdf_page_init; -@define procedure pdf_set_pos(); -@define procedure pdf_end_string_nl; -@define procedure pdf_print_charwidth(); +{ functions from lua/limglib.c } { functions from writet3.c } @define function get_pk_char_width(); diff --git a/Build/source/texk/web2c/luatexdir/luatex.web b/Build/source/texk/web2c/luatexdir/luatex.web index 5fd9825a867..160a2ea0b11 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.web +++ b/Build/source/texk/web2c/luatexdir/luatex.web @@ -249,9 +249,9 @@ known as `\eTeX'. @d pdftex_revision=="0" { \.{\\pdftexrevision} } @d pdftex_version_string=='-2.00.0' {current \pdfTeX\ version} @# -@d luatex_version==39 { \.{\\luatexversion} } +@d luatex_version==40 { \.{\\luatexversion} } @d luatex_revision=="0" { \.{\\luatexrevision} } -@d luatex_version_string=='snapshot-0.39.0' {current \LuaTeX\ version} +@d luatex_version_string=='beta-0.40.0' {current \LuaTeX\ version} @d luatex_date_info==-extra_version_info { the compile date is negated } @d luatex_svnversion=='$Id$' {for long --version information, as proposed by Peter M\"unster} @@ -2933,7 +2933,7 @@ This section is (almost) straight from MetaPost. I had to change the types (use |integer| instead of |fraction|), but that should not have any influence on the actual calculations (the original comments refer to quantities like |fraction_four| ($2^{30}$), and -that is the same as the numeric representation of |maxdimen|). +that is the same as the numeric representation of |max_dimen|). I've copied the low-level variables and routines that are needed, but only those (e.g. |m_log|), not the accompanying ones like |m_exp|. Most @@ -17048,7 +17048,6 @@ dvi_ptr,dir_ptr,dir_tmp:pointer; @!lx:scaled; {extra space between leader boxes} @!outer_doing_leaders:boolean; {were we doing leaders?} @!edge:scaled; {right edge of sub-box or leader space} -@!border:scaled; {right edge of sub-box or leader space} @!prev_p:pointer; {one step behind |p|} @!glue_temp:real; {glue value before rounding} @!cur_glue:real; {glue seen so far} @@ -26144,7 +26143,7 @@ if log_opened then pool_size-init_pool_ptr:1);@/ wlog_ln(' ',var_mem_max:1,',',fix_mem_max:1,@| ' words of node,token memory allocated');@/ - print_node_mem_stats(tracing_stats, tracing_online); + print_node_mem_stats; wlog_ln(' ',cs_count:1,' multiletter control sequences out of ', hash_size:1);@/ wlog(' ',max_font_id,' font'); diff --git a/Build/source/texk/web2c/luatexdir/makecpool.c b/Build/source/texk/web2c/luatexdir/makecpool.c index dd3d6fab5d1..797f9fde60f 100644 --- a/Build/source/texk/web2c/luatexdir/makecpool.c +++ b/Build/source/texk/web2c/luatexdir/makecpool.c @@ -6,7 +6,7 @@ #include <stdlib.h> static const char __svn_version[] = - "$Id: makecpool.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/makecpool.c $"; + "$Id: makecpool.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/makecpool.c $"; int main(int argc, char *argv[]) { @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) printf(" NULL };\n" "int loadpoolstrings (integer spare_size) {\n" " const char *s;\n" - " strnumber g=0;\n" + " str_number g=0;\n" " int i=0,j=0;\n" " while ((s = poolfilearr[j++])) {\n" " int l = strlen (s);\n" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pagetree.c b/Build/source/texk/web2c/luatexdir/pdf/pagetree.c index 676b657c0af..c0546b5dbb3 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pagetree.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pagetree.c @@ -32,7 +32,7 @@ #endif static const char __svn_version[] = - "$Id: pagetree.c 2143 2009-03-28 10:28:15Z hhenkel $ " + "$Id: pagetree.c 2306 2009-04-16 15:01:45Z taco $ " "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pagetree.c $"; /**********************************************************************/ @@ -62,6 +62,7 @@ typedef struct divert_list_entry_ { static int comp_divert_list_entry(const void *pa, const void *pb, void *p) { + (void)p; if (((const divert_list_entry *) pa)->divnum > ((const divert_list_entry *) pb)->divnum) return 1; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pagetree.h b/Build/source/texk/web2c/luatexdir/pdf/pagetree.h index 84bb41dc600..18c8d806b6f 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pagetree.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pagetree.h @@ -17,15 +17,13 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: pagetree.h 2267 2009-04-12 18:23:21Z oneiros $ */ +/* $Id: pagetree.h 2325 2009-04-18 11:24:38Z hhenkel $ */ #ifndef PAGETREE_H # define PAGETREE_H -/**********************************************************************/ integer output_pages_tree(); integer pdf_do_page_divert(integer, integer); void pdf_do_page_undivert(integer, integer); -/**********************************************************************/ #endif diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h index 5cae6a0f601..c3c8292c45c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h @@ -17,11 +17,10 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: pdfpage.h 2267 2009-04-12 18:23:21Z oneiros $ */ +/* $Id: pdfpage.h 2336 2009-04-19 08:38:24Z hhenkel $ */ #ifndef PDFPAGE_H # define PDFPAGE_H -/**********************************************************************/ typedef struct { long m; /* mantissa (significand) */ @@ -66,6 +65,8 @@ typedef struct { pos_mode mode; /* current positioning mode */ } pdfstructure; +extern pdfstructure *pstruct; + /**********************************************************************/ boolean calc_pdfpos(pdfstructure * p, scaledpos * pos); @@ -81,5 +82,4 @@ void pdf_set_pos(scaled h, scaled v); void pos_finish(pdfstructure * p); void print_pdffloat(pdffloat * f); -/**********************************************************************/ #endif diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index 104e68b2c41..c05c6952cb6 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -1,5 +1,5 @@ /* ptexlib.h - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> @@ -20,8 +20,8 @@ /* $Id$ */ -#ifndef LUATEXLIB -# define LUATEXLIB +#ifndef PTEXLIB_H +# define PTEXLIB_H /* WEB2C macros and prototypes */ # if !defined(LUATEXCOERCE) @@ -43,306 +43,37 @@ extern double rint(double x); # include "utils/synctex.h" # include "utils/avlstuff.h" -# include "image/image.h" - +# include "image/writeimg.h" # include "openbsd-compat.h" - # include "pdf/pagetree.h" # include "pdf/pdfpage.h" - -/* pdftexlib type declarations */ -typedef struct { - const char *pdfname; - const char *t1name; - boolean valid; -} key_entry; - -typedef struct _subfont_entry { - char *infix; /* infix for this subfont, eg "01" */ - long charcodes[256]; /* the mapping for this subfont as read from sfd */ - struct _subfont_entry *next; -} subfont_entry; - -typedef struct { - char *name; /* sfd name, eg "Unicode" */ - subfont_entry *subfont; /* linked list of subfonts */ -} sfd_entry; - +# include "font/luatexfont.h" # include "font/mapfile.h" - -typedef struct { - integer fe_objnum; /* object number */ - char *name; /* encoding file name */ - char **glyph_names; /* array of glyph names */ - struct avl_table *tx_tree; /* tree of encoding positions marked as used by TeX */ -} fe_entry; - -typedef struct { - char *name; /* glyph name */ - long code; /* -1 = undefined; -2 = multiple codes, stored - as string in unicode_seq; otherwise unicode value */ - char *unicode_seq; /* multiple unicode sequence */ -} glyph_unicode_entry; - -# define FD_FLAGS_NOT_SET_IN_MAPLINE -1 -# define FD_FLAGS_DEFAULT_EMBED 4 /* a symbol font */ -# define FD_FLAGS_DEFAULT_NON_EMBED 0x22 - /* a nonsymbolic serif font */ - -typedef struct glw_entry_ { /* subset glyphs for inclusion in CID-based fonts */ - unsigned int id; /* glyph CID */ - signed int wd; /* glyph width in 1/1000 em parts */ -} glw_entry; - -/**********************************************************************/ - -typedef struct { - int val; /* value */ - boolean set; /* true if parameter has been set */ -} intparm; - -typedef struct fd_entry_ { - integer fd_objnum; /* object number of the font descriptor object */ - char *fontname; /* /FontName (without subset tag) */ - char *subset_tag; /* 6-character subset tag */ - boolean ff_found; - integer ff_objnum; /* object number of the font program stream */ - integer fn_objnum; /* font name object number (embedded PDF) */ - boolean all_glyphs; /* embed all glyphs? */ - boolean write_ttf_glyph_names; - intparm font_dim[FONT_KEYS_NUM]; - fe_entry *fe; /* pointer to encoding structure */ - char **builtin_glyph_names; /* builtin encoding as read from the Type1 font file */ - fm_entry *fm; /* pointer to font map structure */ - struct avl_table *tx_tree; /* tree of non-reencoded TeX characters marked as used */ - struct avl_table *gl_tree; /* tree of all marked glyphs */ -} fd_entry; - -typedef struct fo_entry_ { - integer fo_objnum; /* object number of the font dictionary */ - internalfontnumber tex_font; /* needed only for \pdffontattr{} */ - fm_entry *fm; /* pointer to font map structure for this font dictionary */ - fd_entry *fd; /* pointer to /FontDescriptor object structure */ - fe_entry *fe; /* pointer to encoding structure */ - integer cw_objnum; /* object number of the font program object */ - integer first_char; /* first character used in this font */ - integer last_char; /* last character used in this font */ - struct avl_table *tx_tree; /* tree of non-reencoded TeX characters marked as used */ - integer tounicode_objnum; /* object number of ToUnicode */ -} fo_entry; +# include "utils/utils.h" +# include "image/writejbig2.h" +# include "image/pdftoepdf.h" /**********************************************************************/ typedef short shalfword; -typedef struct { - integer charcode, cwidth, cheight, xoff, yoff, xescape, rastersize; - halfword *raster; -} chardesc; - -/* pdftexlib variable declarations */ -extern boolean true_dimen; -extern char **t1_glyph_names, *t1_builtin_glyph_names[]; -extern char *cur_file_name; -extern const char notdef[]; -extern integer t1_length1, t1_length2, t1_length3; -extern integer ttf_length; -extern strnumber last_tex_string; -extern size_t last_ptr_index; /* loadpool.c */ - int loadpoolstrings(integer spare_size); -/* filename.c */ +/* 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 str_number make_name_string(void); extern void print_file_name(str_number, str_number, str_number); -/* luainit.c */ +/* lua/luainit.c */ extern void write_svnversion(char *a); -/* pdftexlib function prototypes */ - -/* epdf.c */ -extern integer get_fontfile_num(int); -extern integer get_fontname_num(int); -extern void epdf_free(void); - -/* papersiz.c */ -extern integer myatodim(char **); -extern integer myatol(char **); - -/* pkin.c */ -extern int readchar(boolean, chardesc *); - -/* subfont.c */ -extern void sfd_free(void); -extern boolean handle_subfont_fm(fm_entry *, int); - -/* tounicode.c */ -extern void glyph_unicode_free(void); -extern void def_tounicode(strnumber, strnumber); -extern integer write_tounicode(char **, char *); - -/* utils.c */ -extern char *makecstring(integer); -extern char *makeclstring(integer, size_t *); -extern void print_string(char *j); -extern void append_string(char *s); -extern void getcreationdate(void); -extern void tconfusion(char *s); -extern void tprint(char *s); -extern void tprint_nl(char *s); -extern void tprint_esc(char *s); -extern char *stripzeros(char *); - -# define overflow_string(a,b) { overflow(maketexstring(a),b); flush_str(last_tex_string); } - -extern int xfflush(FILE *); -extern int xgetc(FILE *); -extern int xputc(int, FILE *); -extern scaled ext_xn_over_d(scaled, scaled, scaled); -extern size_t xfwrite(void *, size_t size, size_t nmemb, FILE *); -extern strnumber get_resname_prefix(void); -extern strnumber maketexstring(const char *); -extern strnumber maketexlstring(const char *, size_t); -extern integer fb_offset(void); -extern void fb_flush(void); -extern void fb_putchar(eight_bits b); -extern void fb_seek(integer); -extern void libpdffinish(void); -extern char *makecfilename(strnumber s); -extern void make_subset_tag(fd_entry *); -__attribute__ ((format(printf, 1, 2))) -extern void pdf_printf(const char *, ...); -extern void pdf_puts(const char *); -__attribute__ ((noreturn, format(printf, 1, 2))) -extern void pdftex_fail(const char *, ...); -__attribute__ ((format(printf, 1, 2))) -extern void pdftex_warn(const char *, ...); -extern void set_job_id(int, int, int, int); -__attribute__ ((format(printf, 1, 2))) -extern void tex_printf(const char *, ...); -extern void write_stream_length(integer, longinteger); -extern char *convertStringToPDFString(const char *in, int len); -extern void print_ID(strnumber); -extern void print_creation_date(); -extern void print_mod_date(); -extern void escapename(poolpointer in); -extern void escapestring(poolpointer in); -extern void escapehex(poolpointer in); -extern void unescapehex(poolpointer in); -extern void make_pdftex_banner(void); -extern void init_start_time(); -extern void remove_pdffile(void); -extern void garbage_warning(void); -extern void initversionstring(char **versions); -extern int newcolorstack(integer s, integer literal_mode, boolean pagestart); -extern int colorstackused(); -extern integer colorstackset(int colstack_no, integer s); -extern integer colorstackpush(int colstack_no, integer s); -extern integer colorstackpop(int colstack_no); -extern integer colorstackcurrent(int colstack_no); -extern integer colorstackskippagestart(int colstack_no); -extern void checkpdfsave(scaledpos pos); -extern void checkpdfrestore(scaledpos pos); -extern void pdfshipoutbegin(boolean shipping_page); -extern void pdfshipoutend(boolean shipping_page); -extern void pdfsetmatrix(poolpointer in, scaledpos pos); -extern void matrixtransformpoint(scaled x, scaled y); -extern void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury); -extern boolean matrixused(); -extern void matrixrecalculate(scaled urx); -extern scaled getllx(); -extern scaled getlly(); -extern scaled geturx(); -extern scaled getury(); - -/* writeenc.c */ -extern fe_entry *get_fe_entry(char *); -extern void enc_free(void); -extern void write_fontencodings(void); - -/* writefont.c */ -extern void do_pdf_font(integer, internalfontnumber); -extern fd_entry *lookup_fd_entry(char *, integer, integer); -extern fd_entry *new_fd_entry(void); -extern void write_fontstuff(); - -/* writeimg.c */ -extern boolean check_image_b(integer); -extern boolean check_image_c(integer); -extern boolean check_image_i(integer); -extern boolean is_pdf_image(integer); -extern boolean is_png_image(integer); -extern integer image_pages(integer); -extern integer image_index(integer); -extern integer image_width(integer); -extern integer image_height(integer); -extern integer image_depth(integer); -extern integer image_objnum(integer); -extern integer image_imgnum(integer); -extern integer new_image_entry(void); -extern integer read_image(integer, integer, strnumber, integer, strnumber, - strnumber, integer, integer, integer, integer); -extern void img_free(void); -extern void update_image_procset(integer); -extern void write_image(integer); -extern integer image_colordepth(integer img); -extern integer image_groupref(integer img); -extern void scale_image(integer); -extern void set_image_dimensions(integer, integer, integer, integer); -extern void set_image_index(integer, integer); -extern void out_image(integer, scaled, scaled); -extern void dumpimagemeta(void); -extern void undumpimagemeta(integer, integer); -extern void pdf_print_resname_prefix(void); - -/* writejbig2.c */ -extern void flush_jbig2_page0_objects(); - -/* writet1.c */ -extern boolean t1_subset(char *, char *, unsigned char *); -extern char **load_enc_file(char *); -extern void writet1(fd_entry *); -extern void t1_free(void); - -/* writet3.c */ -extern void writet3(int, internalfontnumber); -extern scaled get_pk_char_width(internalfontnumber, scaled); - -/* writettf.c */ -extern void writettf(fd_entry *); -extern void writeotf(fd_entry *); -extern void ttf_free(void); - -/* writezip.c */ +/* utils/writezip.c */ extern void write_zip(boolean); extern void zip_free(void); -/* avlstuff.c */ -extern int comp_int_entry(const void *, const void *, void *); -extern int comp_string_entry(const void *, const void *, void *); -extern void avl_put_obj(integer, integer); -extern integer avl_find_obj(integer, integer, integer); - -/**********************************************************************/ -static const key_entry font_key[FONT_KEYS_NUM] = { - {"Ascent", "Ascender", 1} - , {"CapHeight", "CapHeight", 1} - , {"Descent", "Descender", 1} - , {"ItalicAngle", "ItalicAngle", 1} - , {"StemV", "StdVW", 1} - , {"XHeight", "XHeight", 1} - , {"FontBBox", "FontBBox", 1} - , {"", "", 0} - , {"", "", 0} - , {"", "", 0} - , {"FontName", "FontName", 1} -}; - /**********************************************************************/ typedef enum { @@ -354,9 +85,6 @@ typedef enum { new_string = 21 } selector_settings; - -# include "font/texfont.h" - /* language stuff */ typedef struct _lang_variables { @@ -366,7 +94,6 @@ typedef struct _lang_variables { int post_exhyphen_char; } lang_variables; - # include "hyphen.h" struct tex_language { @@ -408,7 +135,7 @@ extern halfword new_ligkern(halfword head, halfword tail); extern halfword handle_ligaturing(halfword head, halfword tail); extern halfword handle_kerning(halfword head, halfword tail); -# define push_dir(a) \ +# define push_dir(a) \ { dir_tmp=new_dir((a)); \ vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ dir_ptr=dir_tmp; \ @@ -423,14 +150,12 @@ extern halfword handle_kerning(halfword head, halfword tail); vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ } -# define pop_dir_node() \ - { dir_tmp=dir_ptr; \ - dir_ptr=vlink(dir_tmp); \ - flush_node(dir_tmp); \ +# define pop_dir_node() \ + { dir_tmp=dir_ptr; \ + dir_ptr=vlink(dir_tmp); \ + flush_node(dir_tmp); \ } - - # define dir_parallel(a,b) (((a) % 2)==((b) % 2)) # define dir_orthogonal(a,b) (((a) % 2)!=((b) % 2)) @@ -571,7 +296,6 @@ mathcodeval scan_delimiter_as_mathchar(int extcode); mathcodeval mathchar_from_integer(integer value, int extcode); void show_mathcode_value(mathcodeval d); - typedef struct delcodeval { integer class_value; integer origin_value; @@ -594,18 +318,18 @@ void initialize_math_codes(void); void dump_math_codes(void); void undump_math_codes(void); -/* texlang.c */ +/* lang/texlang.c */ void dump_language_data(void); void undump_language_data(void); char *exception_strings(struct tex_language *lang); -/* llualib.c */ +/* lua/llualib.c */ void dump_luac_registers(void); void undump_luac_registers(void); -/* ltexlib.c */ +/* lua/ltexlib.c */ void luacstring_start(int n); void luacstring_close(int n); integer luacstring_cattable(void); @@ -613,58 +337,41 @@ int luacstring_input(void); int luacstring_partial(void); int luacstring_final_line(void); -/* luatoken.c */ +/* lua/luatoken.c */ void do_get_token_lua(integer callback_id); -/* luanode.c */ +/* lua/luanode.c */ int visible_last_node_type(int n); -void print_node_mem_stats(int n, int o); - -/* writeimg.c */ -integer epdf_xsize(integer i); -integer epdf_ysize(integer i); -integer epdf_orig_y(integer i); -integer epdf_orig_x(integer i); +void print_node_mem_stats(void); -/* limglib.c */ +/* lua/limglib.c */ void vf_out_image(unsigned i); -/* vfovf.c */ -void vf_expand_local_fonts(internal_font_number f); -internal_font_number letter_space_font(halfword u, internal_font_number f, - integer e); -internal_font_number auto_expand_font(internal_font_number f, integer e); -str_number expand_font_name(internal_font_number f, integer e); -void pdf_check_vf_cur_val(void); -internal_font_number copy_font_info(internal_font_number f); - -/* ltexiolib.c */ +/* lua/ltexiolib.c */ void flush_loggable_info(void); -/* luastuff.c */ +/* lua/luastuff.c */ void luacall(int s, int nameptr); void luatokencall(int p, int nameptr); extern void check_texconfig_init(void); -void tex_error(char *msg, char **hlp); - scaled divide_scaled(scaled s, scaled m, integer dd); scaled divide_scaled_n(double s, double m, double d); -/* mlist.c */ +/* tex/mlist.c */ void run_mlist_to_hlist(pointer p, integer m_style, boolean penalties); void fixup_math_parameters(integer fam_id, integer size_id, integer f, integer lvl); -/* texpdf.c */ +/* tex/texpdf.c */ void pdf_print_char(internal_font_number f, integer c); void pdf_print(str_number n); void pdf_print_str(str_number n); void pdf_print_int(longinteger n); void pdf_print_real(integer m, integer d); -/* textoken.c */ +/* tex/textoken.c */ # define NO_CAT_TABLE -2 # define DEFAULT_CAT_TABLE -1 @@ -678,7 +385,7 @@ halfword active_to_cs(int, int); void get_token_lua(void); int get_char_cat_code(int); -/* texdeffont.c */ +/* tex/texdeffont.c */ void tex_def_font(small_number a); @@ -686,7 +393,6 @@ void tex_def_font(small_number a); # include <../lua51/lua.h> - typedef enum { find_write_file_callback = 1, find_output_file_callback, @@ -748,4 +454,4 @@ extern char *get_lua_name(int i); # include "texmath.h" # include "primitive.h" -#endif /* PDFTEXLIB */ +#endif /* PTEXLIB_H */ diff --git a/Build/source/texk/web2c/luatexdir/ptexmac.h b/Build/source/texk/web2c/luatexdir/ptexmac.h index 99c4f8b4ed1..bd95d71a631 100644 --- a/Build/source/texk/web2c/luatexdir/ptexmac.h +++ b/Build/source/texk/web2c/luatexdir/ptexmac.h @@ -1,5 +1,5 @@ /* ptexmac.h - + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> @@ -20,17 +20,17 @@ /* $Id$ */ -#ifndef PDFTEXMAC -# define PDFTEXMAC +#ifndef PTEXMAC_H +# define PTEXMAC_H /* Not all systems define it. */ # ifndef M_PI # define M_PI 3.14159265358979323846 /* pi */ # define M_PI_2 1.5707963267948966192E0 - /*Hex 2^ 0 * 1.921FB54442D18 */ + /* Hex 2^ 0 * 1.921FB54442D18 */ # define M_PI_4 7.8539816339744830962E-1 - /*Hex 2^-1 * 1.921FB54442D18 */ + /* Hex 2^-1 * 1.921FB54442D18 */ # endif # ifdef WIN32 @@ -42,104 +42,114 @@ # define random() rand() # endif +/**********************************************************************/ /* Pascal WEB macros */ -# define maxinteger 0x7FFFFFFF -# define maxdimen 0x3FFFFFFF - -# define objinfo(n) objtab[n].int0 -# define pdfroom(n) do { \ - if ((unsigned)(n + pdf_ptr) > (unsigned)pdf_buf_size) { \ - if (pdf_os_mode) \ - zpdf_os_get_os_buf(n); \ +# define max_integer 0x7FFFFFFF +# define max_dimen 0x3FFFFFFF + +# define obj_info(a) obj_tab[(a)].int0 +# define obj_link(a) obj_tab[(a)].int1 +# define obj_offset(a) obj_tab[(a)].int2 +# define obj_os_idx(a) obj_tab[(a)].int3 +# define obj_aux(a) obj_tab[(a)].int4 +# define obj_data_ptr obj_aux + +/* types of objects */ +# define obj_type_others 0 /* objects which are not linked in any list */ +# define obj_type_page 1 /* index of linked list of Page objects */ +# define obj_type_font 2 /* index of linked list of Fonts objects */ +# define obj_type_outline 3 /* index of linked list of outline objects */ +# define obj_type_dest 4 /* index of linked list of destination objects */ +# define obj_type_obj 5 /* index of linked list of raw objects */ +# define obj_type_xform 6 /* index of linked list of XObject forms */ +# define obj_type_ximage 7 /* index of linked list of XObject image */ +# define obj_type_thread 8 /* index of linked list of num article threads */ +# define head_tab_max obj_type_thread /* max index of |head_tab| */ + +# define pdfroom(n) do { \ + if ((unsigned)(n + pdf_ptr) > (unsigned)pdf_buf_size) { \ + if (pdf_os_mode) \ + zpdf_os_get_os_buf(n); \ else { \ - if ((unsigned)(n) > (unsigned)pdf_buf_size) \ + if ((unsigned)(n) > (unsigned)pdf_buf_size) \ pdftex_fail("PDF output buffer overflowed"); \ else \ - pdf_flush(); \ + pdf_flush(); \ } \ } \ } while (0) # define pdfout(c) do { \ - pdfroom(1); \ + pdfroom(1); \ pdf_buf[pdf_ptr++] = c; \ } while (0) # define pdfoffset() (pdf_gone + pdf_ptr) -# define MAX_CHAR_CODE 255 +/**********************************************************************/ + # define PRINTF_BUF_SIZE 1024 # define MAX_CSTRING_LEN 1024 * 1024 # define MAX_PSTRING_LEN 1024 # define SMALL_BUF_SIZE 256 # define SMALL_ARRAY_SIZE 256 -# define FONTNAME_BUF_SIZE 128 - /* a PDF name can be maximum 127 chars long */ -# define pdftex_debug tex_printf - -extern void check_buffer_overflow(int wsize); -extern void check_pool_overflow(int wsize); - -# define check_buf(size, buf_size) \ - if ((unsigned)(size) > (unsigned)(buf_size)) \ - pdftex_fail("buffer overflow: %d > %d at file %s, line %d", \ +# define check_buf(size, buf_size) \ + if ((unsigned)(size) > (unsigned)(buf_size)) \ + pdftex_fail("buffer overflow: %d > %d at file %s, line %d", \ (int)(size), (int)(buf_size), __FILE__, __LINE__ ) -# define append_char_to_buf(c, p, buf, buf_size) do { \ - if (c == 9) \ - c = 32; \ - if (c == 13 || c == EOF) \ - c = 10; \ - if (c != ' ' || (p > buf && p[-1] != 32)) { \ - check_buf(p - buf + 1, (buf_size)); \ - *p++ = c; \ - } \ +# define append_char_to_buf(c, p, buf, buf_size) do { \ + if (c == 9) \ + c = 32; \ + if (c == 13 || c == EOF) \ + c = 10; \ + if (c != ' ' || (p > buf && p[-1] != 32)) { \ + check_buf(p - buf + 1, (buf_size)); \ + *p++ = c; \ + } \ } while (0) -# define append_eol(p, buf, buf_size) do { \ - check_buf(p - buf + 2, (buf_size)); \ - if (p - buf > 1 && p[-1] != 10) \ - *p++ = 10; \ - if (p - buf > 2 && p[-2] == 32) { \ - p[-2] = 10; \ - p--; \ - } \ - *p = 0; \ +# define append_eol(p, buf, buf_size) do { \ + check_buf(p - buf + 2, (buf_size)); \ + if (p - buf > 1 && p[-1] != 10) \ + *p++ = 10; \ + if (p - buf > 2 && p[-2] == 32) { \ + p[-2] = 10; \ + p--; \ + } \ + *p = 0; \ } while (0) -# define remove_eol(p, buf) do { \ - p = strend(buf) - 1; \ - if (*p == 10) \ - *p = 0; \ +# define remove_eol(p, buf) do { \ + p = strend(buf) - 1; \ + if (*p == 10) \ + *p = 0; \ } while (0) # define skip(p, c) if (*p == c) p++ -# define alloc_array(T, n, s) do { \ - if (T##_array == NULL) { \ - T##_limit = (s); \ - if ((unsigned)(n) > T##_limit) \ - T##_limit = (n); \ - T##_array = xtalloc(T##_limit, T##_entry); \ - T##_ptr = T##_array; \ - } \ +# define alloc_array(T, n, s) do { \ + if (T##_array == NULL) { \ + T##_limit = (s); \ + if ((unsigned)(n) > T##_limit) \ + T##_limit = (n); \ + T##_array = xtalloc(T##_limit, T##_entry); \ + T##_ptr = T##_array; \ + } \ else if ((unsigned)(T##_ptr - T##_array + (n)) > (unsigned)(T##_limit)) { \ - last_ptr_index = T##_ptr - T##_array; \ - T##_limit *= 2; \ + last_ptr_index = T##_ptr - T##_array; \ + T##_limit *= 2; \ if ((unsigned)(T##_ptr - T##_array + (n)) > (unsigned)(T##_limit)) \ - T##_limit = T##_ptr - T##_array + (n); \ - xretalloc(T##_array, T##_limit, T##_entry); \ - T##_ptr = T##_array + last_ptr_index; \ - } \ + T##_limit = T##_ptr - T##_array + (n); \ + xretalloc(T##_array, T##_limit, T##_entry); \ + T##_ptr = T##_array + last_ptr_index; \ + } \ } while (0) -# define is_cfg_comment(c) \ - (c == 10 || c == '*' || c == '#' || c == ';' || c == '%') - -# define define_array(T) \ -T##_entry *T##_ptr, *T##_array = NULL; \ +# define define_array(T) \ +T##_entry *T##_ptr, *T##_array = NULL; \ size_t T##_limit # define xfree(p) do { if (p != NULL) free(p); p = NULL; } while (0) @@ -147,90 +157,16 @@ size_t T##_limit # define xtalloc XTALLOC # define xretalloc XRETALLOC -# define ASCENT_CODE 0 -# define CAPHEIGHT_CODE 1 -# define DESCENT_CODE 2 -# define ITALIC_ANGLE_CODE 3 -# define STEMV_CODE 4 -# define XHEIGHT_CODE 5 -# define FONTBBOX1_CODE 6 -# define FONTBBOX2_CODE 7 -# define FONTBBOX3_CODE 8 -# define FONTBBOX4_CODE 9 -# define FONTNAME_CODE 10 -# define GEN_KEY_NUM (XHEIGHT_CODE + 1) -# define MAX_KEY_CODE (FONTBBOX1_CODE + 1) -# define INT_KEYS_NUM (FONTBBOX4_CODE + 1) -# define FONT_KEYS_NUM (FONTNAME_CODE + 1) - -# define F_INCLUDED 0x01 -# define F_SUBSETTED 0x02 -# define F_STDT1FONT 0x04 -# define F_SUBFONT 0x08 -# define F_TYPE1 0x10 -# define F_TRUETYPE 0x20 -# define F_OTF 0x40 -# define F_CIDKEYED 0x80 - -# define set_included(fm) ((fm)->type |= F_INCLUDED) -# define set_subsetted(fm) ((fm)->type |= F_SUBSETTED) -# define set_std_t1font(fm) ((fm)->type |= F_STDT1FONT) -# define set_subfont(fm) ((fm)->type |= F_SUBFONT) -# define set_type1(fm) ((fm)->type |= F_TYPE1) -# define set_truetype(fm) ((fm)->type |= F_TRUETYPE) -# define set_opentype(fm) ((fm)->type |= F_OTF) -# define set_subfont(fm) ((fm)->type |= F_SUBFONT) -# define set_cidkeyed(fm) ((fm)->type |= F_CIDKEYED) - -# define unset_included(fm) ((fm)->type &= ~F_INCLUDED) -# define unset_subsetted(fm) ((fm)->type &= ~F_SUBSETTED) -# define unset_std_t1font(fm)((fm)->type &= ~F_STDT1FONT) -# define unset_subfont(fm) ((fm)->type &= ~F_SUBFONT) -# define unset_type1(fm) ((fm)->type &= ~F_TYPE1) -# define unset_truetype(fm) ((fm)->type &= ~F_TRUETYPE) -# define unset_opentype(fm) ((fm)->type &= ~F_OTF) -# define unset_subfont(fm) ((fm)->type &= ~F_SUBFONT) -# define unset_cidkeyed(fm) ((fm)->type &= ~F_CIDKEYED) - -# define is_included(fm) (((fm)->type & F_INCLUDED) != 0) -# define is_subsetted(fm) (((fm)->type & F_SUBSETTED) != 0) -# define is_std_t1font(fm) (((fm)->type & F_STDT1FONT) != 0) -# define is_subfont(fm) (((fm)->type & F_SUBFONT) != 0) -# define is_type1(fm) (((fm)->type & F_TYPE1) != 0) -# define is_truetype(fm) (((fm)->type & F_TRUETYPE) != 0) -# define is_opentype(fm) (((fm)->type & F_OTF) != 0) -# define is_subfont(fm) (((fm)->type & F_SUBFONT) != 0) -# define is_cidkeyed(fm) (((fm)->type & F_CIDKEYED) != 0) - -# define fm_slant(fm) (fm)->slant -# define fm_extend(fm) (fm)->extend -# define fm_fontfile(fm) (fm)->ff_name - -# define is_reencoded(fm) ((fm)->encname != NULL) -# define is_fontfile(fm) (fm_fontfile(fm) != NULL) -# define is_t1fontfile(fm) (is_fontfile(fm) && is_type1(fm)) -# define is_builtin(fm) (!is_fontfile(fm)) - -# define LINK_TFM 0x01 -# define LINK_PS 0x02 -# define set_tfmlink(fm) ((fm)->links |= LINK_TFM) -# define set_pslink(fm) ((fm)->links |= LINK_PS) -# define unset_tfmlink(fm) ((fm)->links &= ~LINK_TFM) -# define unset_pslink(fm) ((fm)->links &= ~LINK_PS) -# define has_tfmlink(fm) ((fm)->links & LINK_TFM) -# define has_pslink(fm) ((fm)->links & LINK_PS) - - -# define set_cur_file_name(s) \ - cur_file_name = s; \ +# define set_cur_file_name(s) \ + cur_file_name = s; \ pack_file_name(maketexstring(cur_file_name), get_nullstr(), get_nullstr()) # define cmp_return(a, b) \ if ((a) > (b)) \ - return 1; \ + return 1; \ if ((a) < (b)) \ return -1 # define str_prefix(s1, s2) (strncmp((s1), (s2), strlen(s2)) == 0) -#endif /* PDFTEXMAC */ +#endif /* PTEXMAC_H */ diff --git a/Build/source/texk/web2c/luatexdir/tex/math.c b/Build/source/texk/web2c/luatexdir/tex/math.c index 79d88c20f39..9ec4aab9b39 100644 --- a/Build/source/texk/web2c/luatexdir/tex/math.c +++ b/Build/source/texk/web2c/luatexdir/tex/math.c @@ -27,7 +27,8 @@ #include "tokens.h" static const char _svn_version[] = - "$Id: math.c 2280 2009-04-14 09:49:01Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/math.c $"; + "$Id: math.c 2314 2009-04-17 20:57:48Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/math.c $"; #define mode cur_list.mode_field #define head cur_list.head_field @@ -53,7 +54,7 @@ static const char _svn_version[] = #define mmode (hmode+max_command_cmd+1) #define cur_fam int_par(param_cur_fam_code) -#define text_direction zeqtb[param_text_direction_code].cint +#define text_direction zeqtb[static_int_base + param_text_direction_code].cint #define scan_normal_dimen() scan_dimen(false,false,false) diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.c b/Build/source/texk/web2c/luatexdir/tex/mlist.c index dd1bf5a1b39..0f211151fbc 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.c +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.c @@ -24,7 +24,7 @@ #include "commands.h" static const char _svn_version[] = - "$Id: mlist.c 2280 2009-04-14 09:49:01Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/mlist.c $"; + "$Id: mlist.c 2323 2009-04-18 09:53:47Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/mlist.c $"; #define delimiter_factor int_par(param_delimiter_factor_code) #define delimiter_shortfall dimen_par(param_delimiter_shortfall_code) @@ -35,6 +35,11 @@ static const char _svn_version[] = #define disable_lig int_par(param_disable_lig_code) #define disable_kern int_par(param_disable_kern_code) +#define level_one 1 +#define thin_mu_skip param_thin_mu_skip_code +#define med_mu_skip param_med_mu_skip_code +#define thick_mu_skip param_thick_mu_skip_code + #define nDEBUG #define reset_attributes(p,newatt) do { \ @@ -224,6 +229,19 @@ static scaled math_axis(int b) return a; } +static scaled get_math_quad_size(int b) +{ + int var; + if (b == script_size) + var = script_style; + else if (b == script_script_size) + var = script_script_style; + else + var = text_style; + return get_math_param(math_param_quad, var); +} + + static scaled minimum_operator_size(int var) { scaled a = get_math_param(math_param_operator_size, var); @@ -1018,6 +1036,25 @@ void fixup_math_parameters(integer fam_id, integer size_id, integer f, DEFINE_DMATH_PARAMETERS(math_param_sup_sub_bottom_max, size_id, (abs(math_x_height(size_id) * 4) / 5), lvl); + /* The display-size radical_vgap is done twice because it needs + values from both the sy and the ex font. */ + DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id, + (default_rule_thickness(size_id) + + (abs(math_x_height(size_id)) / 4)), lvl); + + DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, size_id, + 60, lvl); + DEFINE_DMATH_PARAMETERS(math_param_radical_degree_raise, size_id, + 60, lvl); + DEFINE_MATH_PARAMETERS(math_param_radical_degree_before, size_id, + xn_over_d(get_math_quad_size(size_id), 5, 18), lvl); + DEFINE_DMATH_PARAMETERS(math_param_radical_degree_before, size_id, + xn_over_d(get_math_quad_size(size_id), 5, 18), lvl); + DEFINE_MATH_PARAMETERS(math_param_radical_degree_after,size_id, + (-xn_over_d(get_math_quad_size(size_id), 10, 18)), lvl); + DEFINE_DMATH_PARAMETERS(math_param_radical_degree_after,size_id, + (-xn_over_d(get_math_quad_size(size_id), 10, 18)), lvl); + } else if (fam_id == 3 && is_old_mathfont(f, total_mathex_params)) { /* fix old-style |ex| parameters */ DEFINE_MATH_PARAMETERS(math_param_overbar_kern, size_id, @@ -1048,8 +1085,7 @@ void fixup_math_parameters(integer fam_id, integer size_id, integer f, default_rule_thickness(size_id), lvl); DEFINE_DMATH_PARAMETERS(math_param_radical_kern, size_id, default_rule_thickness(size_id), lvl); - /* The display-size radical_vgap is done in |finalize_math_pamaters| because it needs values from both the - sy and the ex font. */ + DEFINE_MATH_PARAMETERS(math_param_radical_vgap, size_id, (default_rule_thickness(size_id) + (abs(default_rule_thickness(size_id)) / 4)), @@ -1124,7 +1160,11 @@ void fixup_math_parameters(integer fam_id, integer size_id, integer f, DEFINE_DMATH_PARAMETERS(math_param_over_delimiter_bgap, size_id, big_op_spacing3(size_id), lvl); - + /* The display-size radical_vgap is done twice because it needs + values from both the sy and the ex font. */ + DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id, + (default_rule_thickness(size_id) + + (abs(math_x_height(size_id)) / 4)), lvl); } } @@ -1136,97 +1176,21 @@ void finalize_math_parameters(void) if (get_math_param(math_param_space_after_script, display_style) == undefined_math_parameter) { def_math_param(math_param_space_after_script, display_style, - script_space, cur_level); - def_math_param(math_param_space_after_script, text_style, script_space, - cur_level); + script_space, level_one); + def_math_param(math_param_space_after_script, text_style, + script_space, level_one); def_math_param(math_param_space_after_script, script_style, - script_space, cur_level); + script_space, level_one); def_math_param(math_param_space_after_script, script_script_style, - script_space, cur_level); + script_space, level_one); def_math_param(math_param_space_after_script, cramped_display_style, - script_space, cur_level); + script_space, level_one); def_math_param(math_param_space_after_script, cramped_text_style, - script_space, cur_level); + script_space, level_one); def_math_param(math_param_space_after_script, cramped_script_style, - script_space, cur_level); + script_space, level_one); def_math_param(math_param_space_after_script, - cramped_script_script_style, script_space, cur_level); - } - if (get_math_param(math_param_radical_vgap, display_style) == - undefined_math_parameter) { - def_math_param(math_param_radical_vgap, display_style, - (default_rule_thickness(text_size) + - (abs(math_x_height(text_size)) / 4)), cur_level); - def_math_param(math_param_radical_vgap, cramped_display_style, - (default_rule_thickness(text_size) + - (abs(math_x_height(text_size)) / 4)), cur_level); - } - if (get_math_param(math_param_radical_degree_raise, display_style) == - undefined_math_parameter) { - DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, - script_script_size, 60, cur_level); - DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, script_size, 60, - cur_level); - DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, text_size, 60, - cur_level); - DEFINE_DMATH_PARAMETERS(math_param_radical_degree_raise, text_size, 60, - cur_level); - } - if (get_math_param(math_param_radical_degree_before, display_style) == - undefined_math_parameter) { - def_math_param(math_param_radical_degree_before, - cramped_script_script_style, - xn_over_d(get_math_quad(cramped_script_script_style), 5, - 18), cur_level); - def_math_param(math_param_radical_degree_before, script_script_style, - xn_over_d(get_math_quad(script_script_style), 5, 18), - cur_level); - def_math_param(math_param_radical_degree_before, cramped_script_style, - xn_over_d(get_math_quad(cramped_script_style), 5, 18), - cur_level); - def_math_param(math_param_radical_degree_before, script_style, - xn_over_d(get_math_quad(script_style), 5, 18), - cur_level); - def_math_param(math_param_radical_degree_before, cramped_text_style, - xn_over_d(get_math_quad(cramped_text_style), 5, 18), - cur_level); - def_math_param(math_param_radical_degree_before, text_style, - xn_over_d(get_math_quad(text_style), 5, 18), cur_level); - def_math_param(math_param_radical_degree_before, cramped_display_style, - xn_over_d(get_math_quad(cramped_display_style), 5, 18), - cur_level); - def_math_param(math_param_radical_degree_before, display_style, - xn_over_d(get_math_quad(display_style), 5, 18), - cur_level); - } - - if (get_math_param(math_param_radical_degree_after, display_style) == - undefined_math_parameter) { - def_math_param(math_param_radical_degree_after, - cramped_script_script_style, - -xn_over_d(get_math_quad(cramped_script_script_style), - 10, 18), cur_level); - def_math_param(math_param_radical_degree_after, script_script_style, - -xn_over_d(get_math_quad(script_script_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, cramped_script_style, - -xn_over_d(get_math_quad(cramped_script_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, script_style, - -xn_over_d(get_math_quad(script_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, cramped_text_style, - -xn_over_d(get_math_quad(cramped_text_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, text_style, - -xn_over_d(get_math_quad(text_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, cramped_display_style, - -xn_over_d(get_math_quad(cramped_display_style), 10, 18), - cur_level); - def_math_param(math_param_radical_degree_after, display_style, - -xn_over_d(get_math_quad(display_style), 10, 18), - cur_level); + cramped_script_script_style, script_space, level_one); } int_par(param_tracing_assigns_code) = saved_trace; @@ -3421,12 +3385,6 @@ small_number make_left_right(pointer q, integer style, scaled max_d, } -#define level_one 1 -#define thin_mu_skip param_thin_mu_skip_code -#define med_mu_skip param_med_mu_skip_code -#define thick_mu_skip param_thick_mu_skip_code - - #define TEXT_STYLES(A,B) do { \ def_math_param(A,display_style,(B),level_one); \ def_math_param(A,cramped_display_style,(B),level_one); \ diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.c b/Build/source/texk/web2c/luatexdir/tex/texnodes.c index bef21431ecd..dc79a296ac9 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.c +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.c @@ -28,7 +28,7 @@ #define noDEBUG static const char _svn_version[] = - "$Id: texnodes.c 2273 2009-04-13 09:52:04Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texnodes.c $"; + "$Id: texnodes.c 2329 2009-04-18 14:25:30Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texnodes.c $"; #define append_char(A) str_pool[pool_ptr++]=(A) #define cur_length (pool_ptr - str_start_macro(str_ptr)) @@ -51,8 +51,6 @@ typedef enum { } pdf_destination_types; -#define obj_aux(A) obj_tab[(A)].int4 -#define obj_data_ptr obj_aux #define obj_obj_data(A) pdf_mem[obj_data_ptr((A)) + 0] #define obj_obj_is_stream(A) pdf_mem[obj_data_ptr((A)) + 1] #define obj_obj_stream_attr(A) pdf_mem[obj_data_ptr((A)) + 2] @@ -1834,7 +1832,7 @@ halfword list_node_mem_usage(void) return q; } -void print_node_mem_stats(int tracingstats, int tracingonline) +void print_node_mem_stats(void) { int i, b; halfword j; diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c index 216fb1c7381..bafa2bc76fd 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.c +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c @@ -24,7 +24,7 @@ #include "commands.h" static const char _svn_version[] = - "$Id: textoken.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/textoken.c $"; + "$Id: textoken.c 2321 2009-04-18 09:17:13Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/textoken.c $"; #define skipping 1 /* |scanner_status| when passing conditional text */ #define defining 2 /* |scanner_status| when reading a macro definition */ @@ -383,7 +383,7 @@ char *cs_to_string(pointer p) char *cmd_chr_to_string(int cmd, int chr) { char *s; - strnumber str; + str_number str; int sel = selector; selector = new_string; print_cmd_chr(cmd, chr); diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.c b/Build/source/texk/web2c/luatexdir/utils/avlstuff.c index 2afeed93d62..5fb02a667bf 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.c +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.c @@ -1,7 +1,7 @@ /* avlstuff.c Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> - Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -24,20 +24,21 @@ #include "avl.h" static const char __svn_version[] = - "$Id: avlstuff.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/avlstuff.c $"; + "$Id: avlstuff.c 2329 2009-04-18 14:25:30Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/avlstuff.c $"; static struct avl_table **PdfObjTree = NULL; /**********************************************************************/ /* memory management functions for AVL */ -void *avl_xmalloc(struct libavl_allocator *allocator, size_t size) +static void *avl_xmalloc(struct libavl_allocator *allocator, size_t size) { assert(allocator != NULL && size > 0); return xmalloc(size); } -void avl_xfree(struct libavl_allocator *allocator, void *block) +static void avl_xfree(struct libavl_allocator *allocator, void *block) { assert(allocator != NULL && block != NULL); xfree(block); @@ -53,12 +54,14 @@ struct libavl_allocator avl_xallocator = { int comp_int_entry(const void *pa, const void *pb, void *p) { + (void) p; cmp_return(*(const int *) pa, *(const int *) pb); return 0; } int comp_string_entry(const void *pa, const void *pb, void *p) { + (void) p; return strcmp((const char *) pa, (const char *) pb); } @@ -72,11 +75,11 @@ typedef struct oentry_ { /* AVL sort oentry into avl_table[] */ -int compare_info(const void *pa, const void *pb, void *param) +static int compare_info(const void *pa, const void *pb, void *param) { integer a, b; int as, ae, bs, be, al, bl; - + (void) param; a = ((const oentry *) pa)->int0; b = ((const oentry *) pb)->int0; if (a < 0 && b < 0) { /* string comparison */ @@ -129,8 +132,8 @@ void avl_put_obj(integer objptr, integer t) pdftex_fail("avlstuff.c: avl_create() PdfObjTree failed"); } oe = xtalloc(1, oentry); - oe->int0 = obj_tab[objptr].int0; - oe->objptr = objptr; /* allows to relocate objtab */ + oe->int0 = obj_info(objptr); + oe->objptr = objptr; /* allows to relocate obj_tab */ pp = avl_probe(PdfObjTree[t], oe); if (pp == NULL) pdftex_fail("avlstuff.c: avl_probe() out of memory in insertion"); @@ -156,19 +159,11 @@ integer avl_find_obj(integer t, integer i, integer byname) } /**********************************************************************/ - -struct avl_table *mf_tree = NULL; - -typedef struct { - char *tfm_name; - internalfontnumber fontnum; -} mf_entry; - -/**********************************************************************/ /* cleaning up... */ static void destroy_oentry(void *pa, void *pb) { + (void) pb; oentry *p = (oentry *) pa; xfree(p); } @@ -186,5 +181,3 @@ void PdfObjTree_free() xfree(PdfObjTree); PdfObjTree = NULL; } - -/**********************************************************************/ diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h index 5dd90bb5df2..d920aace82b 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h @@ -1,27 +1,36 @@ -/* -Copyright (c) 2004-2007 Han The Thanh, <thanh@pdftex.org> +/* avlstuff.h -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by Free -Software Foundation; either version 2 of the License, or (at your option) -any later version. + Copyright (c) 2004-2007 Han The Thanh, <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> -This file 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 General Public License -for more details. + This file is part of LuaTeX. -You should have received a copy of the GNU General Public License along -with pdfTeX; if not, write to the Free Software Foundation, Inc., 51 -Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + 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. -$Id: avlstuff.h 2271 2009-04-12 23:42:21Z oneiros $ -*/ + 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. -#include "avl.h" + You should have received a copy of the GNU General Public License along + with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* memory management functions for avl */ +/* $Id: avlstuff.h 2328 2009-04-18 12:50:26Z hhenkel $ */ + +#ifndef AVLSTUFF_H +# define AVLSTUFF_H + +# include "avl.h" extern struct libavl_allocator avl_xallocator; -/* end of file avlstuff.h */ +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(); + +#endif /* AVLSTUFF_H */ diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex.c b/Build/source/texk/web2c/luatexdir/utils/synctex.c index 459ef746d85..d4471b4bed7 100644 --- a/Build/source/texk/web2c/luatexdir/utils/synctex.c +++ b/Build/source/texk/web2c/luatexdir/utils/synctex.c @@ -106,7 +106,6 @@ Tue Jul 1 15:23:00 UTC 2008 #define ruleht rule_ht #define ruledp rule_dp #define rulewd rule_wd -#define zmem varmem #define jobname job_name #define totalpages total_pages #define curinput cur_input @@ -124,7 +123,6 @@ Tue Jul 1 15:23:00 UTC 2008 * and *tex.web for details, the synctex_ prefix prevents name conflicts, it * is some kind of namespace */ -# warning These structures MUST be kept in synchronization with the main program /* synctexoption is a global integer variable defined in *tex.web * it is set to 1 by texmfmp.c if the command line has the '-synctex=1' * option. */ @@ -132,13 +130,8 @@ Tue Jul 1 15:23:00 UTC 2008 # define SYNCTEX_NO_OPTION INT_MAX /* if synctex_options is set to SYNCTEX_NO_OPTION, no command line option was provided. */ -/* glue code: really define the main memory, - * this is exactly the same "mem" as in *tex.web. */ -# define mem zmem -/* glue code: synctexoffset is a global integer variable defined in *tex.web - * it is set to the offset where the primitive \synctex reads and writes its - * value. */ -# define SYNCTEX_VALUE zeqtb[synctexoffset].cint +# define SYNCTEX_VALUE int_par(param_synctex_code) + /* if there were a mean to share the value of synctex_code between *tex.web * and this file, it would be great. */ @@ -186,28 +179,14 @@ Tue Jul 1 15:23:00 UTC 2008 /* SYNCTEX_TAG_MODEL and SYNCTEX_LINE_MODEL are used to define * SYNCTEX_TAG and SYNCTEX_LINE in a model independant way * Both are tag and line accessors */ -/*# define box_node_size (7+synchronization_field_size)*/ -/* see: @d box_node_size=... - * There should be an automatic process here because these definitions - * are redundant. However, this process would certainly be overcomplicated - * (building then parsing the *tex.web file would be a pain) */ -# define width_offset 2 -/* see: @d width_offset=... */ -# define depth_offset 3 -/* see: @d depth_offset=... */ -# define height_offset 4 -/* see: @d height_offset=... */ /* Now define the local version of width(##), height(##) and depth(##) macros These only depend on the 3 macros above. */ # define SYNCTEX_TYPE(NODE) type(NODE) -/*# define rule_node 2*/ -/*# define glue_node 10*/ -/*# define kern_node 11*/ # define SYNCTEX_SUBTYPE(NODE) subtype(NODE) -# define SYNCTEX_WIDTH(NODE) mem[NODE+width_offset].cint -# define SYNCTEX_DEPTH(NODE) mem[NODE+depth_offset].cint -# define SYNCTEX_HEIGHT(NODE) mem[NODE+height_offset].cint +# define SYNCTEX_WIDTH(NODE) width(NODE) +# define SYNCTEX_DEPTH(NODE) depth(NODE) +# define SYNCTEX_HEIGHT(NODE) height(NODE) /* When an hlist ships out, it can contain many different kern/glue nodes with * exactly the same sync tag and line. To reduce the size of the .synctex @@ -235,6 +214,8 @@ Tue Jul 1 15:23:00 UTC 2008 # define SYNCTEX_NO_ERROR (0) # include "luatexd.h" +# include "nodes.h" +# include "commands.h" # undef SYNCTEX_OFFSET_IS_PDF # define SYNCTEX_OFFSET_IS_PDF (pdf_output_value>0) # undef SYNCTEX_OUTPUT @@ -518,7 +499,7 @@ void synctex_start_input(void) } /* All the synctex... functions below have the smallest set of parameters. It - * appears to be either the address of a node, or nothing at all. Using zmem, + * appears to be either the address of a node, or nothing at all. Using varmem, * which is the place where all the nodes are stored, one can retrieve every * information about a node. The other information is obtained through the * global context variable. @@ -731,6 +712,7 @@ static inline void synctex_record_void_vlist(halfword p); void synctex_void_vlist(halfword p, halfword this_box) { scaledpos pos; + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexvoidvlist\n"); @@ -808,6 +790,7 @@ static inline void synctex_record_void_hlist(halfword p); void synctex_void_hlist(halfword p, halfword this_box) { scaledpos pos; + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexvoidhlist\n"); @@ -858,6 +841,7 @@ void synctex_math_recorder(halfword p); void synctex_math(halfword p, halfword this_box) { scaledpos pos; + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexmath\n"); @@ -891,6 +875,7 @@ static inline void synctex_record_rule(halfword p); void synctex_horizontal_rule_or_glue(halfword p, halfword this_box) { scaledpos pos; + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexglue\n"); @@ -985,6 +970,7 @@ void synctex_char_recorder(halfword p); /* this message is sent whenever a char node ships out */ void synctexchar(halfword p, halfword this_box) { + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexchar\n"); @@ -1013,6 +999,7 @@ void synctex_node_recorder(halfword p); for a node of an unknown type */ void synctexnode(halfword p, halfword this_box) { + (void)this_box; SYNCTEX_RETURN_IF_DISABLED; #if SYNCTEX_DEBUG printf("\nSynchronize DEBUG: synctexnode\n"); @@ -1049,9 +1036,6 @@ void synctex_current(void) return; } -#pragma mark - -#pragma mark Glue code Recorders - /* Recording the settings */ static inline int synctex_record_settings(void) { @@ -1227,6 +1211,7 @@ static inline void synctex_record_vlist(halfword p) static inline void synctex_record_tsilv(halfword p) { size_t len = 0; + (void)p; #if SYNCTEX_DEBUG > 999 printf("\nSynchronize DEBUG: synctex_record_tsilv\n"); #endif @@ -1243,6 +1228,7 @@ static inline void synctex_record_tsilv(halfword p) static inline void synctex_record_void_hlist(halfword p) { size_t len = 0; + (void)p; #if SYNCTEX_DEBUG > 999 printf("\nSynchronize DEBUG: synctex_record_void_hlist\n"); #endif @@ -1290,6 +1276,7 @@ static inline void synctex_record_hlist(halfword p) static inline void synctex_record_tsilh(halfword p) { size_t len = 0; + (void)p; #if SYNCTEX_DEBUG > 999 printf("\nSynchronize DEBUG: synctex_record_tsilh\n"); #endif @@ -1407,9 +1394,6 @@ static inline void synctex_record_rule(halfword p) } -#pragma mark - -#pragma mark Recorders - /* Recording a "$..." line */ void synctex_math_recorder(halfword p) { @@ -1455,6 +1439,7 @@ void synctex_kern_recorder(halfword p) void synctex_char_recorder(halfword p) { size_t len = 0; + (void)p; #if SYNCTEX_DEBUG > 999 printf("\nSynchronize DEBUG: synctex_char_recorder\n"); #endif @@ -1473,12 +1458,13 @@ void synctex_char_recorder(halfword p) void synctex_node_recorder(halfword p) { size_t len = 0; + (void)p; #if SYNCTEX_DEBUG > 999 printf("\nSynchronize DEBUG: synctex_node_recorder(0x%x)\n",p); #endif len = SYNCTEX_fprintf(SYNCTEX_FILE,"?%i,%i:%i,%i\n", synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT, - mem[p].hh.b0,mem[p].hh.b1); + type(p),subtype(p)); if(len>0) { synctex_ctxt.total_length += len; ++synctex_ctxt.count; diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.c b/Build/source/texk/web2c/luatexdir/utils/utils.c index d743bb240ae..926fef3d34a 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.c +++ b/Build/source/texk/web2c/luatexdir/utils/utils.c @@ -43,14 +43,15 @@ #include "xpdf/config.h" /* just to get the xpdf version */ static const char __svn_version[] = - "$Id: utils.c 2195 2009-03-31 14:09:50Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/utils.c $"; + "$Id: utils.c 2329 2009-04-18 14:25:30Z hhenkel $ " + "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/utils.c $"; #define check_nprintf(size_get, size_want) \ if ((unsigned)(size_get) >= (unsigned)(size_want)) \ pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); char *cur_file_name = NULL; -strnumber last_tex_string; +str_number last_tex_string; static char print_buf[PRINTF_BUF_SIZE]; static char *jobname_cstr = NULL; static char *job_id_string = NULL; @@ -176,14 +177,14 @@ void pdf_printf(const char *fmt, ...) va_end(args); } -strnumber maketexstring(const char *s) +str_number maketexstring(const char *s) { if (s == NULL || *s == 0) return get_nullstr(); return maketexlstring(s, strlen(s)); } -strnumber maketexlstring(const char *s, size_t l) +str_number maketexlstring(const char *s, size_t l) { if (s == NULL || l == 0) return get_nullstr(); @@ -297,7 +298,7 @@ void pdftex_warn(const char *fmt, ...) void tex_error(char *msg, char **hlp) { - strnumber aa = 0, bb = 0, cc = 0, dd = 0, ee = 0; + str_number aa = 0, bb = 0, cc = 0, dd = 0, ee = 0; int k = 0; if (hlp != NULL) { while (hlp[k] != NULL) @@ -471,7 +472,7 @@ void make_pdftex_banner(void) pdftexbanner_init = true; } -strnumber get_resname_prefix(void) +str_number get_resname_prefix(void) { /* static char name_str[] = */ /* "!\"$&'*+,-.0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\" */ @@ -540,7 +541,7 @@ scaled ext_xn_over_d(scaled x, scaled n, scaled d) r += 0.5; else r -= 0.5; - if (r >= (double) maxinteger || r <= -(double) maxinteger) + if (r >= (double) max_integer || r <= -(double) max_integer) pdftex_warn("arithmetic: number too big"); return (scaled) r; } @@ -813,6 +814,7 @@ void unescapehex(poolpointer in) * hexadecimal encoded; * sizeof(out) should be at least lin*2+1. */ + static void convertStringToHexString(const char *in, char *out, int lin) { int i, j, k; @@ -859,7 +861,7 @@ static void convertStringToHexString(const char *in, char *out, int lin) scanning the info dict is also difficult, we start with a simpler implementation using just the first two items. */ -void print_ID(strnumber filename) +void print_ID(str_number filename) { time_t t; size_t size; @@ -1034,7 +1036,7 @@ void getcreationdate() That means, file names that are legal on some operation systems cannot any more be used since pdfTeX version 1.30.4. */ -char *makecfilename(strnumber s) +char *makecfilename(str_number s) { char *name = makecstring(s); char *p = name; @@ -1258,7 +1260,7 @@ int newcolorstack(integer s, integer literal_mode, boolean page_start) #define get_colstack(n) (&colstacks[n]) /* Puts a string on top of the string pool and updates pool_ptr. */ -void put_cstring_on_str_pool(poolpointer start, char *str) +static void put_cstring_on_str_pool(poolpointer start, char *str) { size_t len; @@ -1363,7 +1365,7 @@ integer colorstackpop(int colstack_no) return colstack->literal_mode; } -void colorstackpagestart() +static void colorstackpagestart() { int i, j; colstack_type *colstack; diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.h b/Build/source/texk/web2c/luatexdir/utils/utils.h new file mode 100644 index 00000000000..0e55feb50aa --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/utils/utils.h @@ -0,0 +1,109 @@ +/* utils.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> + + 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 <http://www.gnu.org/licenses/>. */ + +/* $Id: utils.h 2333 2009-04-18 17:45:46Z hhenkel $ */ + +#ifndef UTILS_H +# define UTILS_H + +# define overflow_string(a,b) { overflow(maketexstring(a),b); flush_str(last_tex_string); } + +integer fb_offset(void); +void fb_flush(void); +void fb_putchar(eight_bits b); +void fb_seek(integer); +void make_subset_tag(fd_entry *); +void pdf_puts(const char *); +__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); +__attribute__ ((format(printf, 1, 2))) +void tex_printf(const char *, ...); +void remove_pdffile(void); +__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 garbage_warning(void); +char *makecstring(integer); +char *makeclstring(integer, size_t *); +void set_job_id(int, int, int, int); +void make_pdftex_banner(void); +str_number get_resname_prefix(void); +size_t xfwrite(void *, size_t size, size_t nmemb, FILE *); +int xfflush(FILE *); +int xgetc(FILE *); +int xputc(int, FILE *); +void write_stream_length(integer, longinteger); +scaled ext_xn_over_d(scaled, scaled, scaled); +void libpdffinish(void); +char *convertStringToPDFString(const char *in, int len); +void escapestring(poolpointer in); +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 getcreationdate(void); +char *makecfilename(str_number s); +char *stripzeros(char *); +void initversionstring(char **versions); +extern void check_buffer_overflow(int wsize); +extern void check_pool_overflow(int wsize); + +extern str_number last_tex_string; +extern char *cur_file_name; +extern size_t last_ptr_index; + +/**********************************************************************/ +/* color stack and matrix transformation support */ + +int newcolorstack(integer s, integer literal_mode, boolean pagestart); +int colorstackused(); +integer colorstackset(int colstack_no, integer s); +integer colorstackpush(int colstack_no, integer s); +integer colorstackpop(int colstack_no); +integer colorstackcurrent(int colstack_no); +integer colorstackskippagestart(int colstack_no); +void checkpdfsave(scaledpos pos); +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); +void matrixtransformpoint(scaled x, scaled y); +void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury); +boolean matrixused(); +void matrixrecalculate(scaled urx); + +#endif /* UTILS_H */ |