diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-12-10 09:22:25 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-12-10 09:22:25 +0000 |
commit | 70b9e104222eb5ba7a495c6267643c6470fb4667 (patch) | |
tree | 6b540c75177a4ec7d7ad0b607542c0f3620b1d3e /Build/source/texk | |
parent | db2683e88ae12a32ad6620b4e40218761ea14f41 (diff) |
LuaTeX: Sync with https://foundry.supelec.fr/svn/luatex/trunk r5092
git-svn-id: svn://tug.org/texlive/trunk@35779 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
97 files changed, 1272 insertions, 237 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 2d306f53c48..16350bc3d84 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2014-12-10 Peter Breitenlohner <peb@mppmu.mpg.de> + + Sync with https://foundry.supelec.fr/svn/luatex/trunk/source/ + texk/web2c/luatexdir/ r5092. + 2014-11-06 Peter Breitenlohner <peb@mppmu.mpg.de> * luatex.c: Avoid MinGW64 warnings (INVALID_SOCKET => -1). diff --git a/Build/source/texk/web2c/luatexdir/NEWS b/Build/source/texk/web2c/luatexdir/NEWS index 0d1dc49b10b..a1746ea2d5e 100644 --- a/Build/source/texk/web2c/luatexdir/NEWS +++ b/Build/source/texk/web2c/luatexdir/NEWS @@ -2,6 +2,26 @@ This file is in the public domain. ============================================================== +Luatex beta-0.79.2 was released 20141111 (5082) +============================================================== + + +* WARNING: the structure of the format file is changed. + After the Web2C \TeX's magic constant: "W2TX" there is now + a FORMAT_ID, a 32bit field that cannot be between 0 and 256 (included) + so that there are no conflicts with the preexisting structure + of the format. + The value can be seen with --debug-format and currently is + 907 (the sum of the values of the bytes of the ASCII string "don knuth"). + +* There is a new set of lua functions for StructElement and Attribute, + convenient (even if not indispensable) for tagged pdf. + + +* several bugfixes and improvements. + + +============================================================== Luatex beta-0.79.0 was released 20140328 (4960) ============================================================== @@ -2246,7 +2266,7 @@ Other news: we probably introduced new problems as well). * Most (all?) files now have a corrected Copyright header, - and link in $Id: NEWS 4962 2014-03-28 15:23:35Z taco $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file. + and link in $Id: NEWS 5082 2014-11-11 09:58:10Z luigi $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file. * Some unnecessary files were removed from the distribution. diff --git a/Build/source/texk/web2c/luatexdir/dvi/dvigen.w b/Build/source/texk/web2c/luatexdir/dvi/dvigen.w index a2e2e215a1f..97bd38e7d0c 100644 --- a/Build/source/texk/web2c/luatexdir/dvi/dvigen.w +++ b/Build/source/texk/web2c/luatexdir/dvi/dvigen.w @@ -30,7 +30,7 @@ @ Initial identification of this file, and the needed headers. @c static const char _svn_version[] = - "$Id: dvigen.w 4679 2013-12-19 15:47:53Z luigi $" + "$Id: dvigen.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/dvi/dvigen.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.w b/Build/source/texk/web2c/luatexdir/font/dofont.w index bed6850c241..15688fd63e3 100644 --- a/Build/source/texk/web2c/luatexdir/font/dofont.w +++ b/Build/source/texk/web2c/luatexdir/font/dofont.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: dofont.w 4524 2012-12-20 15:38:02Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/dofont.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/dofont.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w index c64f6544ecb..089558c1314 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.w +++ b/Build/source/texk/web2c/luatexdir/font/luafont.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: luafont.w 4847 2014-03-05 18:13:17Z luigi $" + "$Id: luafont.w 5064 2014-10-13 12:47:11Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.w $"; #include "ptexlib.h" @@ -173,18 +173,24 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c lua_pushnumber(L, get_charinfo_depth(co)); lua_rawset(L, -3); - lua_pushstring(L, "italic"); - lua_pushnumber(L, get_charinfo_italic(co)); - lua_rawset(L, -3); - lua_pushstring(L, "top_accent"); - lua_pushnumber(L, get_charinfo_top_accent(co)); - lua_rawset(L, -3); + if (get_charinfo_italic(co) != 0) { + lua_pushstring(L, "italic"); + lua_pushnumber(L, get_charinfo_italic(co)); + lua_rawset(L, -3); + } - lua_pushstring(L, "bot_accent"); - lua_pushnumber(L, get_charinfo_bot_accent(co)); - lua_rawset(L, -3); + if (get_charinfo_top_accent(co) !=0) { + lua_pushstring(L, "top_accent"); + lua_pushnumber(L, get_charinfo_top_accent(co)); + lua_rawset(L, -3); + } + if (get_charinfo_bot_accent(co) != 0) { + lua_pushstring(L, "bot_accent") ; + lua_pushnumber(L, get_charinfo_bot_accent(co)); + lua_rawset(L, -3); + } if (get_charinfo_ef(co) != 0) { lua_pushstring(L, "expansion_factor"); @@ -198,13 +204,12 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c lua_rawset(L, -3); } - if (get_charinfo_lp(co) != 0) { + if (get_charinfo_rp(co) != 0) { lua_pushstring(L, "right_protruding"); lua_pushnumber(L, get_charinfo_rp(co)); lua_rawset(L, -3); } - if (font_encodingbytes(f) == 2) { lua_pushstring(L, "index"); lua_pushnumber(L, get_charinfo_index(co)); @@ -1441,6 +1446,7 @@ int font_from_lua(lua_State * L, int f) i = maketexstring(s); set_pdf_font_attr(f, i); } + free(s); i = n_enum_field(L, lua_key_index(type), unknown_font_type, font_type_strings); set_font_type(f, i); @@ -1480,6 +1486,8 @@ int font_from_lua(lua_State * L, int f) /* } */ /* lua_pop(L, 1); /\* pop name *\/ */ ss = n_string_field(L, lua_key_index(name)); + /* string is anchored */ + lua_pop(L,1); } if (ss != NULL) { /* lua_getfield(L, -1, "size"); */ diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w index ff52ac5e6cc..d94189f4d6a 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.w +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: mapfile.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: mapfile.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/mapfile.w $"; #include "ptexlib.h" @@ -337,7 +337,8 @@ static void fm_scan_line(void) float d; fm_entry *fm; char fm_line[FM_BUF_SIZE], buf[FM_BUF_SIZE]; - char *p, *q, *r, *s; + char *p, *q, *s; + char *r = NULL; switch (mitem->type) { case MAPFILE: p = fm_line; @@ -366,15 +367,15 @@ static void fm_scan_line(void) fm = new_fm_entry(); read_field(r, q, buf); set_field(tfm_name); - if (!isdigit((unsigned char)*r)) { /* 2nd field ps_name may not start with a digit */ + if (!isdigit(*r)) { /* 2nd field ps_name may not start with a digit */ read_field(r, q, buf); set_field(ps_name); } - if (isdigit((unsigned char)*r)) { /* font descriptor /Flags given? */ - for (s = r; isdigit((unsigned char)*s); s++); + if (isdigit(*r)) { /* font descriptor /Flags given? */ + for (s = r; isdigit(*s); s++); if (*s == ' ' || *s == '"' || *s == '<' || *s == '\0') { /* not e. g. 8r.enc */ fm->fd_flags = atoi(r); - while (isdigit((unsigned char)*r)) + while (isdigit(*r)) r++; } } diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.w b/Build/source/texk/web2c/luatexdir/font/subfont.w index 06678c1e195..f35d601547a 100644 --- a/Build/source/texk/web2c/luatexdir/font/subfont.w +++ b/Build/source/texk/web2c/luatexdir/font/subfont.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: subfont.w 4847 2014-03-05 18:13:17Z luigi $" + "$Id: subfont.w 5017 2014-06-05 15:11:19Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.w $"; #include "ptexlib.h" @@ -40,7 +40,7 @@ static int sfd_curbyte = 0; #define sfd_read_file() readbinfile(sfd_file,&sfd_buffer,&sfd_size) #define sfd_getchar() sfd_buffer[sfd_curbyte++] -#define sfd_eof() (sfd_curbyte>sfd_size) +#define sfd_eof() (sfd_curbyte>=sfd_size) static FILE *sfd_file; @@ -102,9 +102,11 @@ static void sfd_getline(boolean expect_eof) char c; restart: if (sfd_eof()) { - if (expect_eof) + if (expect_eof) { + if (*sfd_line == '#') + *sfd_line = 10; return; - else + } else luatex_fail("unexpected end of file"); } p = sfd_line; diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w index 6d2358349d3..65fdc6a332e 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.w +++ b/Build/source/texk/web2c/luatexdir/font/texfont.w @@ -32,7 +32,7 @@ problematic |if 0 != null|. @c static const char _svn_version[] = - "$Id: texfont.w 4847 2014-03-05 18:13:17Z luigi $" + "$Id: texfont.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.w $"; #include "ptexlib.h" @@ -1760,6 +1760,10 @@ void undump_font(int f) undump_things(*math_param_base(f), (font_math_params(f) + 1)); } + font_tables[f]->characters = new_sa_tree(1, 0); /* stack size 1, default item value 0 */ + ci = xcalloc(1, sizeof(charinfo)); + set_charinfo_name(ci, xstrdup(".notdef")); + font_tables[f]->charinfo = ci; undump_int(x); if (x) { i = undump_charinfo(f); @@ -1768,10 +1772,6 @@ void undump_font(int f) if (x) { i = undump_charinfo(f); } /* right boundary */ - font_tables[f]->characters = new_sa_tree(1, 0); /* stack size 1, default item value 0 */ - ci = xcalloc(1, sizeof(charinfo)); - set_charinfo_name(ci, xstrdup(".notdef")); - font_tables[f]->charinfo = ci; i = font_bc(f); while (i < font_ec(f)) { diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w index 1ed589eb1ce..b33bef027a0 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.w +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w @@ -92,7 +92,7 @@ void def_tounicode(str_number glyph, str_number unistr) for (i = 0; i < l; i++) { if (p[i] == ' ') valid_unistr = 2; /* if a space occurs we treat this entry as a string */ - else if (!isXdigit((unsigned char)p[i])) { + else if (!isXdigit(p[i])) { valid_unistr = 0; break; } @@ -151,7 +151,7 @@ static long check_unicode_value(char *s, boolean multiple_value) return UNI_UNDEF; for (i = 0; i < l; i++) { - if (!isXdigit((unsigned char)s[i])) + if (!isXdigit(s[i])) return UNI_UNDEF; if (multiple_value) { if (i % 4 == 3) { diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w index be0bf375b36..21ceba11e14 100644 --- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w +++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w @@ -24,7 +24,7 @@ @ @c static const char _svn_version[] = "$Id: tt_glyf.w 4457 2012-07-13 13:16:19Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/tt_glyf.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tt_glyf.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w index 3c9174d1aae..defe4b6841f 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.w +++ b/Build/source/texk/web2c/luatexdir/font/writecff.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: writecff.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: writecff.w 5041 2014-07-16 16:13:03Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.w $"; #include "ptexlib.h" @@ -169,8 +169,10 @@ cff_index *cff_get_index_header(cff_font * cff) idx->offset = xmalloc((unsigned) (((unsigned) count + 1) * sizeof(l_offset))); - for (i = 0; i < count + 1; i++) { + for (i = 0; i <count + 1 ; i++) { (idx->offset)[i] = get_offset(cff, idx->offsize); + if (i == USHRT_MAX) + break; } if (idx->offset[0] != 1) @@ -3158,7 +3160,7 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd) } /* build the new charstrings entry */ - charstrings = cff_new_index((card16) (cs_count1 + 1)); + charstrings = cff_new_index((card16) (cs_count1==USHRT_MAX?cs_count1: cs_count1 + 1)); max_len = 2 * CS_STR_LEN_MAX; charstrings->data = xcalloc((unsigned) max_len, sizeof(card8)); charstring_len = 0; @@ -3437,7 +3439,7 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd) fdselect->num_entries = 0; fdselect->data.ranges = xcalloc(num_glyphs, sizeof(cff_range3)); - charstrings = cff_new_index((card16) (cs_count1 + 1)); + charstrings = cff_new_index((card16) (cs_count1==USHRT_MAX?cs_count1: cs_count1 + 1)); max_len = 2 * CS_STR_LEN_MAX; charstrings->data = xcalloc((unsigned) max_len, sizeof(card8)); charstring_len = 0; diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.w b/Build/source/texk/web2c/luatexdir/font/writeenc.w index 1f769e667f2..476741e93aa 100644 --- a/Build/source/texk/web2c/luatexdir/font/writeenc.w +++ b/Build/source/texk/web2c/luatexdir/font/writeenc.w @@ -21,7 +21,7 @@ @ @c static const char _svn_version[] = "$Id: writeenc.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/writeenc.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writeenc.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w index ff986bf86fe..3377059f304 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.w +++ b/Build/source/texk/web2c/luatexdir/font/writefont.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writefont.w 4847 2014-03-05 18:13:17Z luigi $" + "$Id: writefont.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.w $"; #include "ptexlib.h" @@ -426,6 +426,9 @@ static void register_fo_entry(fo_entry * fo) static void write_fontfile(PDF pdf, fd_entry * fd) { assert(is_included(fd->fm)); + /* In principle we could replace the pdftex derived ttf.otf inclusion part */ + /* by using the regular code for this and assigning indices and tounicodes */ + /* to the character blobs, but for the moment we keep the current approach */ if (is_cidkeyed(fd->fm)) { if (is_opentype(fd->fm)) writetype0(pdf, fd); diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w index 036c65ad9c3..2e65017d2f8 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.w +++ b/Build/source/texk/web2c/luatexdir/font/writet1.w @@ -456,7 +456,7 @@ static float t1_scan_num(char *p, char **r) luatex_fail("a number expected: `%s'", t1_line_array); } if (r != NULL) { - for (; isdigit((unsigned char)*p) || *p == '.' || + for (; isdigit(*p) || *p == '.' || *p == 'e' || *p == 'E' || *p == '+' || *p == '-'; p++); *r = p; } @@ -1522,7 +1522,7 @@ static void t1_flush_cs(PDF pdf, boolean is_subr) t1_line_ptr = t1_line_array; for (p = start_line; p - start_line < size_pos;) *t1_line_ptr++ = *p++; - while (isdigit((unsigned char)*p)) + while (isdigit(*p)) p++; sprintf(t1_line_ptr, "%u", count); strcat(t1_line_ptr, p); diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w index 169e1c20d81..2cab4b2371c 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.w +++ b/Build/source/texk/web2c/luatexdir/font/writettf.w @@ -622,7 +622,7 @@ static char *strip_spaces_and_delims(char *s, int l) for (i = 0; i < l; s++, i++) { if (*s == '(' || *s == ')' || *s == '<' || *s == '>' || *s == '[' || *s == ']' || *s == '{' || *s == '}' || - *s == '/' || *s == '%' || isspace((unsigned char)*s)) + *s == '/' || *s == '%' || isspace(*s)) continue; *p++ = *s; } diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index 8f806cd005f..4982b6af10c 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.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: epdf.h 4718 2014-01-02 15:35:31Z taco $ */ +/* $Id: epdf.h 5081 2014-11-07 18:38:33Z luigi $ */ // this is the common header file for C++ sources pdftoepdf.cc and lepdflib.cc diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.w b/Build/source/texk/web2c/luatexdir/image/writepng.w index 50eec4636f2..6b2ad9197fc 100644 --- a/Build/source/texk/web2c/luatexdir/image/writepng.w +++ b/Build/source/texk/web2c/luatexdir/image/writepng.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writepng.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: writepng.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writepng.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.h b/Build/source/texk/web2c/luatexdir/lang/texlang.h index dd3a5c3bdfa..3450dd98960 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.h +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.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: texlang.h 3394 2010-01-26 14:20:46Z taco $ */ +/* $Id: texlang.h 4664 2013-12-09 13:43:42Z taco $ */ #ifndef TEXLANG_H # define TEXLANG_H diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w index 97d9f00c682..9ffe9f546a9 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.w +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w @@ -193,7 +193,7 @@ const char *clean_hyphenation(const char *buff, char **cleaned) char *uindex = (char *)word; const char *s = buff; - while (*s && !isspace((unsigned char)*s)) { + while (*s && !isspace(*s)) { word[i++] = (unsigned)*s; s++; if ((s-buff)>MAX_WORD_LEN) { @@ -271,7 +271,7 @@ void load_hyphenation(struct tex_language *lang, const unsigned char *buff) lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions); s = (const char *) buff; while (*s) { - while (isspace((unsigned char)*s)) + while (isspace(*s)) s++; if (*s) { value = s; diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 160fbe3bde6..f8b4360e56b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -21,7 +21,7 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: lcallbacklib.c 4956 2014-03-28 12:12:17Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; + "$Id: lcallbacklib.c 5081 2014-11-07 18:38:33Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; int callback_count = 0; int saved_callback_count = 0; @@ -69,6 +69,7 @@ static const char *const callbacknames[] = { "finish_pdfpage", "pre_dump","start_file", "stop_file", "show_error_message","show_lua_error_hook", + "pdf_stream_filter_callback", NULL }; @@ -188,6 +189,7 @@ void get_saved_lua_string(int r, const char *name, char **target) #define CALLBACK_STRNUMBER 's' #define CALLBACK_STRING 'S' #define CALLBACK_CHARNUM 'c' +#define CALLBACK_LSTRING 'L' int run_saved_callback(int r, const char *name, const char *values, ...) @@ -265,6 +267,7 @@ int do_run_callback(int special, const char *values, va_list vl) size_t len; int narg, nres; const char *s; + lstring *lstr; char cs; int *bufloc; char *ss = NULL; @@ -288,6 +291,10 @@ int do_run_callback(int special, const char *values, va_list vl) s = va_arg(vl, char *); lua_pushstring(L, s); break; + case CALLBACK_LSTRING: /* 'lstring' */ + lstr = va_arg(vl, lstring *); + lua_pushlstring(L, (const char *)lstr->s, lstr->l); + break; case CALLBACK_INTEGER: /* int */ lua_pushnumber(L, va_arg(vl, int)); break; @@ -420,6 +427,26 @@ int do_run_callback(int special, const char *values, va_list vl) *va_arg(vl, char **) = ss; } break; + case CALLBACK_LSTRING: /* lstring */ + if (!lua_isstring(L, nres)) { + if (!lua_isnil(L, nres)) { + fprintf(stderr, "Expected a string for (S), not: %s\n", + lua_typename(L, lua_type(L, nres))); + goto EXIT; + } + } + s = lua_tolstring(L, nres, &len); + + if (s == NULL) /* |len| can be zero */ + *va_arg(vl, int *) = 0; + else { + lstring *ret = xmalloc(sizeof(lstring)); + ret->s = xmalloc((unsigned) (len + 1)); + (void) memcpy(ret->s, s, (len + 1)); + ret->l = len; + *va_arg(vl, lstring **) = ret; + } + break; default: fprintf(stdout, "invalid return value type"); goto EXIT; diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc index 5b4a512a195..1adaa120362 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc @@ -19,11 +19,13 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lepdflib.cc 4847 2014-03-05 18:13:17Z luigi $ " + "$Id: lepdflib.cc 5081 2014-11-07 18:38:33Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lepdflib.cc $"; #include "image/epdf.h" + + // define DEBUG //********************************************************************** @@ -65,6 +67,11 @@ static const char *ErrorCodeNames[] = { "None", "OpenFile", "BadCatalog", #define M_PDFRectangle "epdf.PDFRectangle" #define M_Ref "epdf.Ref" #define M_Stream "epdf.Stream" +#ifdef HAVE_STRUCTTREEROOT_H +#define M_StructElement "epdf.StructElement" +#define M_Attribute "epdf.Attribute" +#define M_TextSpan "epdf.TextSpan" +#endif #define M_StructTreeRoot "epdf.StructTreeRoot" #define M_XRefEntry "epdf.XRefEntry" #define M_XRef "epdf.XRef" @@ -97,6 +104,11 @@ new_poppler_userdata(Page); new_poppler_userdata(PDFRectangle); new_poppler_userdata(Ref); new_poppler_userdata(Stream); +#ifdef HAVE_STRUCTTREEROOT_H +new_poppler_userdata(StructElement); +new_poppler_userdata(Attribute); +new_poppler_userdata(TextSpan); +#endif new_poppler_userdata(StructTreeRoot); new_poppler_userdata(XRef); @@ -124,6 +136,7 @@ static int l_open_PDFDoc(lua_State * L) if (d == NULL) lua_pushnil(L); else { + globalParams = new GlobalParams(); uout = new_PDFDoc_userdata(L); uout->d = d; uout->atype = ALLOC_LEPDF; @@ -147,6 +160,178 @@ static int l_new_Array(lua_State * L) return 1; } +#ifdef HAVE_STRUCTTREEROOT_H +static int l_new_Attribute(lua_State * L) +{ + Attribute::Type t; + const char *n; + int nlen; + udstruct *uobj, *uout; + + if (lua_type(L,1)==LUA_TNUMBER) { + uobj = (udstruct *) luaL_checkudata(L, 2, M_Object); + if (uobj->pd != NULL && uobj->pd->pc != uobj->pc) + pdfdoc_changed_error(L); + t = (Attribute::Type) luaL_checkint(L, 1); + uout = new_Attribute_userdata(L); + uout->d = new Attribute(t, (Object *)uobj->d); + uout->atype = ALLOC_LEPDF; + uout->pc = uobj->pc; + uout->pd = uobj->pd; + + } else if (lua_type(L,1)==LUA_TSTRING) { + n = luaL_checkstring(L,1); + nlen = luaL_checkint(L,2); + uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); + if (uobj->pd != NULL && uobj->pd->pc != uobj->pc) + pdfdoc_changed_error(L); + uout = new_Attribute_userdata(L); + uout->d = new Attribute(n, nlen, (Object *)uobj->d); + uout->atype = ALLOC_LEPDF; + uout->pc = uobj->pc; + uout->pd = uobj->pd; + } else + lua_pushnil(L); + return 1; +} + +#define ATTRIBUTE_TYPE_ENTRY(name) \ + lua_pushstring(L, #name); \ + lua_pushinteger(L, Attribute::name); \ + lua_settable(L,-3) + + +#define STRUCTELEMENT_TYPE_ENTRY(name) \ + lua_pushstring(L, #name); \ + lua_pushinteger(L, StructElement::name); \ + lua_settable(L,-3) + + +static int l_Attribute_Type(lua_State * L) { + lua_createtable (L, 0, 42); + ATTRIBUTE_TYPE_ENTRY(BBox); + ATTRIBUTE_TYPE_ENTRY(BackgroundColor); + ATTRIBUTE_TYPE_ENTRY(BorderColor); + ATTRIBUTE_TYPE_ENTRY(BorderThickness); + ATTRIBUTE_TYPE_ENTRY(Color); + ATTRIBUTE_TYPE_ENTRY(ColumnGap); + ATTRIBUTE_TYPE_ENTRY(ColumnWidths); + ATTRIBUTE_TYPE_ENTRY(Desc); + ATTRIBUTE_TYPE_ENTRY(Role); + ATTRIBUTE_TYPE_ENTRY(TextDecorationColor); + ATTRIBUTE_TYPE_ENTRY(TextDecorationThickness); + ATTRIBUTE_TYPE_ENTRY(BaselineShift); + ATTRIBUTE_TYPE_ENTRY(BlockAlign); + ATTRIBUTE_TYPE_ENTRY(BorderStyle); + ATTRIBUTE_TYPE_ENTRY(ColSpan); + ATTRIBUTE_TYPE_ENTRY(ColumnCount); + ATTRIBUTE_TYPE_ENTRY(EndIndent); + ATTRIBUTE_TYPE_ENTRY(GlyphOrientationVertical); + ATTRIBUTE_TYPE_ENTRY(Headers); + ATTRIBUTE_TYPE_ENTRY(Height); + ATTRIBUTE_TYPE_ENTRY(InlineAlign); + ATTRIBUTE_TYPE_ENTRY(LineHeight); + ATTRIBUTE_TYPE_ENTRY(ListNumbering); + ATTRIBUTE_TYPE_ENTRY(Padding); + ATTRIBUTE_TYPE_ENTRY(Placement); + ATTRIBUTE_TYPE_ENTRY(RowSpan); + ATTRIBUTE_TYPE_ENTRY(RubyAlign); + ATTRIBUTE_TYPE_ENTRY(RubyPosition); + ATTRIBUTE_TYPE_ENTRY(Scope); + ATTRIBUTE_TYPE_ENTRY(SpaceAfter); + ATTRIBUTE_TYPE_ENTRY(SpaceBefore); + ATTRIBUTE_TYPE_ENTRY(StartIndent); + ATTRIBUTE_TYPE_ENTRY(Summary); + ATTRIBUTE_TYPE_ENTRY(TBorderStyle); + ATTRIBUTE_TYPE_ENTRY(TPadding); + ATTRIBUTE_TYPE_ENTRY(TextAlign); + ATTRIBUTE_TYPE_ENTRY(TextDecorationType); + ATTRIBUTE_TYPE_ENTRY(TextIndent); + ATTRIBUTE_TYPE_ENTRY(Width); + ATTRIBUTE_TYPE_ENTRY(WritingMode); + ATTRIBUTE_TYPE_ENTRY(Unknown); + ATTRIBUTE_TYPE_ENTRY(checked); + return 1; +} + +static int l_StructElement_Type(lua_State * L) { + lua_createtable (L, 0, 50); + STRUCTELEMENT_TYPE_ENTRY(Document); + STRUCTELEMENT_TYPE_ENTRY(Part); + STRUCTELEMENT_TYPE_ENTRY(Art); + STRUCTELEMENT_TYPE_ENTRY(Sect); + STRUCTELEMENT_TYPE_ENTRY(Div); + STRUCTELEMENT_TYPE_ENTRY(BlockQuote); + STRUCTELEMENT_TYPE_ENTRY(Caption); + STRUCTELEMENT_TYPE_ENTRY(NonStruct); + STRUCTELEMENT_TYPE_ENTRY(Index); + STRUCTELEMENT_TYPE_ENTRY(Private); + STRUCTELEMENT_TYPE_ENTRY(Span); + STRUCTELEMENT_TYPE_ENTRY(Quote); + STRUCTELEMENT_TYPE_ENTRY(Note); + STRUCTELEMENT_TYPE_ENTRY(Reference); + STRUCTELEMENT_TYPE_ENTRY(BibEntry); + STRUCTELEMENT_TYPE_ENTRY(Code); + STRUCTELEMENT_TYPE_ENTRY(Link); + STRUCTELEMENT_TYPE_ENTRY(Annot); + STRUCTELEMENT_TYPE_ENTRY(Ruby); + STRUCTELEMENT_TYPE_ENTRY(RB); + STRUCTELEMENT_TYPE_ENTRY(RT); + STRUCTELEMENT_TYPE_ENTRY(RP); + STRUCTELEMENT_TYPE_ENTRY(Warichu); + STRUCTELEMENT_TYPE_ENTRY(WT); + STRUCTELEMENT_TYPE_ENTRY(WP); + STRUCTELEMENT_TYPE_ENTRY(P); + STRUCTELEMENT_TYPE_ENTRY(H); + STRUCTELEMENT_TYPE_ENTRY(H1); + STRUCTELEMENT_TYPE_ENTRY(H2); + STRUCTELEMENT_TYPE_ENTRY(H3); + STRUCTELEMENT_TYPE_ENTRY(H4); + STRUCTELEMENT_TYPE_ENTRY(H5); + STRUCTELEMENT_TYPE_ENTRY(H6); + STRUCTELEMENT_TYPE_ENTRY(L); + STRUCTELEMENT_TYPE_ENTRY(LI); + STRUCTELEMENT_TYPE_ENTRY(Lbl); + STRUCTELEMENT_TYPE_ENTRY(LBody); + STRUCTELEMENT_TYPE_ENTRY(Table); + STRUCTELEMENT_TYPE_ENTRY(TR); + STRUCTELEMENT_TYPE_ENTRY(TH); + STRUCTELEMENT_TYPE_ENTRY(TD); + STRUCTELEMENT_TYPE_ENTRY(THead); + STRUCTELEMENT_TYPE_ENTRY(TFoot); + STRUCTELEMENT_TYPE_ENTRY(TBody); + STRUCTELEMENT_TYPE_ENTRY(Figure); + STRUCTELEMENT_TYPE_ENTRY(Formula); + STRUCTELEMENT_TYPE_ENTRY(Form); + STRUCTELEMENT_TYPE_ENTRY(TOC); + STRUCTELEMENT_TYPE_ENTRY(TOCI); + lua_pushstring(L, "Unknown"); + lua_pushinteger(L, 0); + lua_settable(L,-3); + return 1; +} + +static int l_AttributeOwner_Type(lua_State * L) { + lua_createtable (L, 0, 12); + lua_pushstring(L, "XML-1.00"); lua_pushinteger(L, Attribute::XML_1_00); lua_settable(L,-3); + lua_pushstring(L, "HTML-3.20"); lua_pushinteger(L, Attribute::HTML_3_20); lua_settable(L,-3); + lua_pushstring(L, "HTML-4.01"); lua_pushinteger(L, Attribute::HTML_4_01); lua_settable(L,-3); + lua_pushstring(L, "OEB-1.00"); lua_pushinteger(L, Attribute::OEB_1_00); lua_settable(L,-3); + lua_pushstring(L, "RTF-1.05"); lua_pushinteger(L, Attribute::RTF_1_05); lua_settable(L,-3); + lua_pushstring(L, "CSS-1.00"); lua_pushinteger(L, Attribute::CSS_1_00); lua_settable(L,-3); + lua_pushstring(L, "CSS-2.00"); lua_pushinteger(L, Attribute::CSS_2_00); lua_settable(L,-3); + lua_pushstring(L, "Layout"); lua_pushinteger(L, Attribute::Layout); lua_settable(L,-3); + lua_pushstring(L, "PrintField"); lua_pushinteger(L, Attribute::PrintField); lua_settable(L,-3); + lua_pushstring(L, "Table"); lua_pushinteger(L, Attribute::Table); lua_settable(L,-3); + lua_pushstring(L, "List"); lua_pushinteger(L, Attribute::List); lua_settable(L,-3); + lua_pushstring(L, "UserProperties"); lua_pushinteger(L, Attribute::UserProperties);lua_settable(L,-3); + return 1; +} + + +#endif + + static int l_new_Dict(lua_State * L) { udstruct *uxref, *uout; @@ -188,6 +373,12 @@ static int l_new_PDFRectangle(lua_State * L) static const struct luaL_Reg epdflib_f[] = { {"open", l_open_PDFDoc}, {"Array", l_new_Array}, +#ifdef HAVE_STRUCTTREEROOT_H + {"Attribute", l_new_Attribute}, + {"StructElement_Type", l_StructElement_Type}, + {"Attribute_Type", l_Attribute_Type}, + {"AttributeOwner_Type",l_AttributeOwner_Type}, +#endif {"Dict", l_new_Dict}, {"Object", l_new_Object}, {"PDFRectangle", l_new_PDFRectangle}, @@ -242,6 +433,25 @@ static int m_##in##_##function(lua_State * L) \ return 1; \ } + +#define m_poppler_get_GUINT(in, function) \ +static int m_##in##_##function(lua_State * L) \ +{ \ + unsigned int i; \ + udstruct *uin; \ + uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \ + if (uin->pd != NULL && uin->pd->pc != uin->pc) \ + pdfdoc_changed_error(L); \ + i = (unsigned int) ((in *) uin->d)->function(); \ + lua_pushinteger(L, i); \ + return 1; \ +} + +#define m_poppler_get_UINT(in, function) \ +m_poppler_get_GUINT(in, function) + + + #define m_poppler_get_DOUBLE(in, function) \ static int m_##in##_##function(lua_State * L) \ { \ @@ -1875,7 +2085,8 @@ static int m_Object__gc(lua_State * L) printf("\n===== Object GC ===== uin=<%p>\n", uin); #endif if (uin->atype == ALLOC_LEPDF) { - ((Object *) uin->d)->free(); + // free() seems to collide with the lua gc + //((Object *) uin->d)->free(); delete(Object *) uin->d; } return 0; @@ -2532,6 +2743,562 @@ static const struct luaL_Reg Stream_m[] = { {NULL, NULL} // sentinel }; +#ifdef HAVE_STRUCTTREEROOT_H +//********************************************************************** +// TextSpan + +m_poppler_get_GOOSTRING(TextSpan, getText); +m_poppler__tostring(TextSpan); + +static const struct luaL_Reg TextSpan_m[] = { + {"getText", m_TextSpan_getText}, + {"__tostring", m_TextSpan__tostring}, + {NULL, NULL} // sentinel +}; + + + + +//********************************************************************** +// Attribute +m_poppler_get_BOOL(Attribute,isOk); +m_poppler_get_INT(Attribute,getType); +m_poppler_get_INT(Attribute,getOwner); +m_poppler_get_GOOSTRING(Attribute,getName); + +static int m_Attribute_getTypeName(lua_State * L) +{ + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + lua_pushstring(L, ((Attribute *) uin->d)->getTypeName()); + return 1; +} + +static int m_Attribute_getOwnerName(lua_State * L) +{ + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + lua_pushstring(L, ((Attribute *) uin->d)->getOwnerName()); + return 1; +} + +static int m_Attribute_getValue(lua_State * L) +{ + udstruct *uin, *uout; + Object *origin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uout = new_Object_userdata(L); + uout->d = new Object(); + origin = (Object *) (((Attribute *) uin->d)->getValue()); + origin->copy ( ((Object *)uout->d) ); + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + return 1; +} + + +static int m_Attribute_getDefaultValue(lua_State * L) +{ + Attribute::Type t; + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + t = (Attribute::Type) luaL_checkint(L, 2); + uout = new_Object_userdata(L); + uout->d = ((Attribute *)uin->d)->getDefaultValue(t) ; + //uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + return 1; +} + + +m_poppler_get_GUINT(Attribute,getRevision); + +static int m_Attribute_setRevision(lua_State * L) +{ + Guint i; + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (Guint) luaL_checkint(L, 2); + ((Attribute *) uin->d)->setRevision(i); + return 0; +} + +m_poppler_get_BOOL(Attribute, isHidden); + +static int m_Attribute_setHidden(lua_State * L) +{ + GBool i; + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (GBool) lua_toboolean(L, 2); + ((Attribute *) uin->d)->setHidden(i); + return 0; +} + +static int m_Attribute_getFormattedValue(lua_State * L) +{ + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + lua_pushstring(L, ((Attribute *) uin->d)->getFormattedValue()); + return 1; +} + + +static int m_Attribute_setFormattedValue(lua_State * L) +{ + const char *c; + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + c = luaL_checkstring(L, 2); + ((Attribute *) uin->d)->setFormattedValue(c); + return 0; +} + +static int m_Attribute__gc(lua_State * L) +{ + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); +#ifdef DEBUG + printf("\n===== Attribute GC ===== uin=<%p>\n", uin); +#endif + if (uin->atype == ALLOC_LEPDF) { + delete(Attribute *) uin->d; + } + return 0; +} + + +m_poppler__tostring(Attribute); + + +static const struct luaL_Reg Attribute_m[] = { + {"isOk",m_Attribute_isOk}, + {"getType",m_Attribute_getType}, + {"getOwner",m_Attribute_getOwner}, + {"getTypeName",m_Attribute_getTypeName}, + {"getOwnerName",m_Attribute_getOwnerName}, + {"getValue",m_Attribute_getValue}, + {"getDefaultValue",m_Attribute_getDefaultValue}, + {"getName",m_Attribute_getName}, + {"getRevision",m_Attribute_getRevision}, + {"setRevision",m_Attribute_setRevision}, + {"istHidden",m_Attribute_isHidden}, + {"setHidden",m_Attribute_setHidden}, + {"getFormattedValue",m_Attribute_getFormattedValue}, + {"setFormattedValue",m_Attribute_setFormattedValue}, + {"__gc", m_Attribute__gc}, + {"__tostring", m_Attribute__tostring}, + {NULL, NULL} // sentinel +}; + + + + +//********************************************************************** +// StructElement + + +m_poppler_get_INT(StructElement,getType); +m_poppler_get_BOOL(StructElement,isOk); +m_poppler_get_BOOL(StructElement,isBlock); +m_poppler_get_BOOL(StructElement,isInline); +m_poppler_get_BOOL(StructElement,isGrouping); +m_poppler_get_BOOL(StructElement,isContent); +m_poppler_get_BOOL(StructElement,isObjectRef); +m_poppler_get_BOOL(StructElement,hasPageRef); +m_poppler_get_INT(StructElement,getMCID); +m_poppler_get_INT(StructElement, getNumChildren); + +m_poppler_get_GUINT(StructElement,getRevision); +m_poppler_get_UINT(StructElement,getNumAttributes); + +m_poppler_get_GOOSTRING(StructElement, getID); +m_poppler_get_GOOSTRING(StructElement, getLanguage); +m_poppler_get_GOOSTRING(StructElement, getTitle); +m_poppler_get_GOOSTRING(StructElement, getExpandedAbbr); +m_poppler_get_GOOSTRING(StructElement, getAltText); +m_poppler_get_GOOSTRING(StructElement, getActualText); + +m_poppler_get_poppler(StructElement, StructTreeRoot, getStructTreeRoot); +m_poppler__tostring(StructElement); + + +static int m_StructElement_getObjectRef(lua_State * L) +{ + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uout = new_Ref_userdata(L); + uout->d = (Ref *) gmalloc(sizeof(Ref)); + ((Ref *) uout->d)->num = ((StructElement *) uin->d)->getObjectRef().num; + ((Ref *) uout->d)->gen = ((StructElement *) uin->d)->getObjectRef().gen; + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + return 1; +} + + +static int m_StructElement_getParentRef(lua_State * L) +{ + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uout = new_Ref_userdata(L); + uout->d = (Ref *) gmalloc(sizeof(Ref)); + ((Ref *) uout->d)->num = ((StructElement *) uin->d)->getParentRef().num; + ((Ref *) uout->d)->gen = ((StructElement *) uin->d)->getParentRef().gen; + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + return 1; +} + +// Not exactly as the header: +// Ref = StructElement:getPageRef() +// Ref is false if the C++ functione return false +static int m_StructElement_getPageRef(lua_State * L) +{ + GBool b; + Ref *r; + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + r = (Ref *) gmalloc(sizeof(Ref)); + b = ((StructElement *) uin->d)->getPageRef( *r ); + if (b) { + uout = new_Ref_userdata(L); + uout->d = r ; + //uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + } else + lua_pushboolean(L,0); + return 1; +} + + + +static int m_StructElement_getTypeName(lua_State * L) +{ + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + lua_pushstring(L, ((StructElement *) uin->d)->getTypeName()); + return 1; +} + + +static int m_StructElement_setRevision(lua_State * L) +{ + Guint i; + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (Guint) luaL_checkint(L, 2); + ((StructElement *) uin->d)->setRevision(i); + return 0; +} + +static int m_StructElement_getText(lua_State * L) +{ + GBool i; + GooString *gs; + udstruct *uin; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (GBool) lua_toboolean(L, 2); + gs = ((StructElement *) uin->d)->getText(i); + if (gs != NULL) + lua_pushlstring(L, gs->getCString(), gs->getLength()); + else + lua_pushnil(L); + return 1; +} + + +static int m_StructElement_getChild(lua_State * L) +{ + StructElement *c; + int i; + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (int) luaL_checkint(L, 2); + c = ((StructElement *) uin->d)->getChild(i-1); + if (c != NULL) { + uout = new_StructElement_userdata(L); + uout->d = c ; + //uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + } + else + lua_pushnil(L); + return 1; +} + + +static int m_StructElement_appendChild(lua_State * L) +{ + udstruct *uin, *uin1; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uin1 = (udstruct *) luaL_checkudata(L, 2, M_StructElement); + if (uin1->pd != NULL && uin1->pd->pc != uin1->pc) + pdfdoc_changed_error(L); + ((StructElement *) uin->d)->appendChild( (StructElement *)uin1->d ); + return 0; +} + + +static int m_StructElement_getAttribute(lua_State * L) +{ + Attribute *a; + int i; + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (int) luaL_checkint(L, 2); + a = ((StructElement *) uin->d)->getAttribute(i-1); + if (a != NULL) { + uout = new_Attribute_userdata(L); + uout->d = a ; + uout->pc = uin->pc; + uout->pd = uin->pd; + } + else + lua_pushnil(L); + return 1; +} + + + +static int m_StructElement_appendAttribute(lua_State * L) +{ + + udstruct *uin, *uin1; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uin1 = (udstruct *) luaL_checkudata(L, 2, M_Attribute); + if (uin1->pd != NULL && uin1->pd->pc != uin1->pc) + pdfdoc_changed_error(L); + ((StructElement *) uin->d)->appendAttribute( (Attribute *)uin1->d ); + return 0; +} + + +static int m_StructElement_findAttribute(lua_State * L) +{ + Attribute::Type t; + Attribute::Owner o; + GBool g; + udstruct *uin, *uout; + const Attribute *a; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + t = (Attribute::Type) luaL_checkint(L,1); + o = (Attribute::Owner) luaL_checkint(L,2); + g = (GBool) lua_toboolean(L, 3); + a = ((StructElement *) uin->d)->findAttribute(t,g,o); + + if (a!=NULL){ + uout = new_Attribute_userdata(L); + uout->d = new Attribute(a->getType(),a->getValue()); + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + } else + lua_pushnil(L); + return 1; +} + +// This returns a lua table +static int m_StructElement_getTextSpans(lua_State * L) +{ + int i ; + udstruct *uin, *uout; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + + if ((((StructElement *) uin->d)->getTextSpans()).size()>0) { + lua_createtable (L, + (int) (((StructElement *) uin->d)->getTextSpans()).size(), + 0); + for(i=0;i<(int) (((StructElement *) uin->d)->getTextSpans()).size(); i++){ + uout = new_TextSpan_userdata(L); + uout->d = new TextSpan( (((StructElement *) uin->d)->getTextSpans())[i] ); + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + lua_rawseti(L,-2,i+1); + } + } else + lua_pushnil(L); + return 1; +} + + + +static const struct luaL_Reg StructElement_m[] = { + {"getTypeName", m_StructElement_getTypeName}, + {"getType",m_StructElement_getType}, + {"isOk",m_StructElement_isOk}, + {"isBlock",m_StructElement_isBlock}, + {"isInline",m_StructElement_isInline}, + {"isGrouping",m_StructElement_isGrouping}, + {"isContent",m_StructElement_isContent}, + {"isObjectRef",m_StructElement_isObjectRef}, + {"getMCID",m_StructElement_getMCID}, + {"getObjectRef",m_StructElement_getObjectRef}, + {"getParentRef",m_StructElement_getParentRef}, + {"hasPageRef",m_StructElement_hasPageRef}, + {"getPageRef",m_StructElement_getPageRef}, + {"getStructTreeRoot",m_StructElement_getStructTreeRoot}, + {"getID",m_StructElement_getID}, + {"getLanguage",m_StructElement_getLanguage}, + {"getRevision",m_StructElement_getRevision}, + {"setRevision",m_StructElement_setRevision}, + {"getTitle",m_StructElement_getTitle}, + {"getExpandedAbbr",m_StructElement_getExpandedAbbr}, + {"getNumChildren",m_StructElement_getNumChildren}, + {"getChild",m_StructElement_getChild}, + {"appendChild",m_StructElement_appendChild}, + {"getNumAttributes",m_StructElement_getNumAttributes}, + {"getAttribute",m_StructElement_getAttribute}, + {"appendAttribute",m_StructElement_appendAttribute}, + {"findAttribute",m_StructElement_findAttribute}, + {"getAltText",m_StructElement_getAltText}, + {"getActualText",m_StructElement_getActualText}, + {"getText",m_StructElement_getText}, + {"getTextSpans",m_StructElement_getTextSpans}, + {"__tostring", m_StructElement__tostring}, + {NULL, NULL} // sentinel +}; + + +//********************************************************************** +// StructTreeRoot + +m_poppler_get_INT(StructTreeRoot, getNumChildren); +m_poppler_get_poppler(StructTreeRoot, PDFDoc, getDoc); +m_poppler_get_poppler(StructTreeRoot, Dict, getRoleMap); +m_poppler_get_poppler(StructTreeRoot, Dict, getClassMap); +m_poppler__tostring(StructTreeRoot); + +static int m_StructTreeRoot_getChild(lua_State * L) +{ + unsigned int i; + udstruct *uin, *uout; + StructElement *child ; + StructTreeRoot *root ; + + uin = (udstruct *) luaL_checkudata(L, 1, M_StructTreeRoot); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (unsigned) luaL_checkint(L, 2); + root = (StructTreeRoot *) uin->d; + if (i-1 < root->getNumChildren() ){ + child = root->getChild(i-1); + uout = new_StructElement_userdata(L); + uout->d = child; + //uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + } else + lua_pushnil(L); + return 1; +} + +static int m_StructTreeRoot_appendChild(lua_State * L) +{ + udstruct *uin, *uin_child, *uout; + StructElement *child ; + StructTreeRoot *root ; + uin = (udstruct *) luaL_checkudata(L, 1, M_StructTreeRoot); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + uin_child = (udstruct *) luaL_checkudata(L, 2, M_StructElement); + if (uin_child->pd != NULL && uin_child->pd->pc != uin_child->pc) + pdfdoc_changed_error(L); + root = (StructTreeRoot *) uin->d; + child = (StructElement *) uin_child->d; + root->appendChild(child); + return 0; +} + + +static int m_StructTreeRoot_findParentElement(lua_State * L) +{ + unsigned int i; + udstruct *uin, *uout; + const StructElement *parent ; + StructTreeRoot *root ; + + uin = (udstruct *) luaL_checkudata(L, 1, M_StructTreeRoot); + if (uin->pd != NULL && uin->pd->pc != uin->pc) + pdfdoc_changed_error(L); + i = (unsigned) luaL_checkint(L, 2); + root = (StructTreeRoot *) uin->d; + parent = root->findParentElement(i-1); + if (parent != NULL) { + uout = new_StructElement_userdata(L); + uout->d = new StructElement( *parent ); + uout->atype = ALLOC_LEPDF; + uout->pc = uin->pc; + uout->pd = uin->pd; + } else + lua_pushnil(L); + return 1; +} + + +static const struct luaL_Reg StructTreeRoot_m[] = { + {"findParentElement", m_StructTreeRoot_findParentElement}, + {"getDoc",m_StructTreeRoot_getDoc}, + {"getRoleMap",m_StructTreeRoot_getRoleMap}, + {"getClassMap",m_StructTreeRoot_getClassMap}, + {"getNumChildren",m_StructTreeRoot_getNumChildren}, + {"getChild",m_StructTreeRoot_getChild}, + {"appendChild",m_StructTreeRoot_appendChild}, + {"findParentElement",m_StructTreeRoot_findParentElement}, + {"__tostring", m_StructTreeRoot__tostring}, + {NULL, NULL} // sentinel +}; +#endif + //********************************************************************** // XRef @@ -2667,6 +3434,12 @@ int luaopen_epdf(lua_State * L) setfuncs_meta(PDFRectangle); setfuncs_meta(Ref); setfuncs_meta(Stream); +#ifdef HAVE_STRUCTTREEROOT_H + setfuncs_meta(Attribute); + setfuncs_meta(StructElement); + setfuncs_meta(StructTreeRoot); + setfuncs_meta(TextSpan); +#endif setfuncs_meta(XRef); setfuncs_meta(XRefEntry); diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c index b0d2efb5333..e0139d677d5 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llanglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llanglib.c @@ -23,7 +23,7 @@ static const char _svn_version[] = - "$Id: llanglib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/llanglib.c $"; + "$Id: llanglib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/llanglib.c $"; #define LANG_METATABLE "luatex.lang" diff --git a/Build/source/texk/web2c/luatexdir/lua/llfslibext.c b/Build/source/texk/web2c/luatexdir/lua/llfslibext.c index a72369cb66e..78972b53b18 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llfslibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/llfslibext.c @@ -25,7 +25,7 @@ #include <time.h> static const char _svn_version[] = - "$Id: llfslibext.c 4421 2012-05-21 15:20:49Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/llfslibext.c $"; + "$Id: llfslibext.c 4421 2012-05-21 15:20:49Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/llfslibext.c $"; #ifdef _WIN32 # include <windows.h> diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 4f98dc19526..dfe51e26b69 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -96,7 +96,7 @@ */ static const char _svn_version[] = - "$Id: lnodelib.c 4956 2014-03-28 12:12:17Z luigi $ " + "$Id: lnodelib.c 5091 2014-12-09 15:44:36Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lnodelib.c $"; #include "ptexlib.h" @@ -1984,14 +1984,18 @@ static int lua_nodelib_end_of_math(lua_State * L) halfword *n; halfword t; if (lua_isnil(L, 1)) - return 1; /* the nil itself */ + return 0; n = check_isnode(L, 1); t = *n; if (t == null) - return 1; /* the old userdata */ + return 0; + if (type(t)==math_node && (subtype(t)==1)) { + lua_nodelib_push_fast(L, t); + return 1; + } while (vlink(t) != null) { - t = vlink(t); /* skip first node */ - if (t && type(t)==math_node) { + t = vlink(t); + if (t && (type(t)==math_node) && (subtype(t)==1)) { lua_nodelib_push_fast(L, t); return 1; } @@ -2005,19 +2009,23 @@ static int lua_nodelib_direct_end_of_math(lua_State * L) { halfword n; n = (halfword) lua_tonumber(L, 1); - if (n != null) { - while (vlink(n) != null) { - n = vlink(n); /* skip first node */ - if (n && type(n)==math_node) { - lua_pushnumber(L, n); - return 1; - } + if (n == null) + return 0; + if ((type(n)==math_node && (subtype(n)==1))) { + lua_pushnumber(L, n); + return 1; + } + while (vlink(n) != null) { + n = vlink(n); + if (n && (type(n)==math_node) && (subtype(n)==1)) { + lua_pushnumber(L, n); + return 1; } } - lua_pushnil(L); return 0; } + /* node.has_attribute (gets attribute) */ static int lua_nodelib_has_attribute(lua_State * L) @@ -4171,7 +4179,7 @@ static int lua_nodelib_has_glyph(lua_State * L) halfword *a; halfword h = (halfword) *(check_isnode(L,1)) ; while (h != null) { - if (type(h) == glyph_node) { + if ( (type(h) == glyph_node) || (type(h) == disc_node)) { fast_metatable(h); return 1; } else { @@ -4188,7 +4196,7 @@ static int lua_nodelib_direct_has_glyph(lua_State * L) { halfword h = (halfword) lua_tonumber(L,1) ; while (h != null) { - if (type(h) == glyph_node) { + if ((type(h) == glyph_node) || (type(h) == disc_node)) { nodelib_pushdirect(h); return 1; } else { diff --git a/Build/source/texk/web2c/luatexdir/lua/loslibext.c b/Build/source/texk/web2c/luatexdir/lua/loslibext.c index 78f1e4803ab..575202b05db 100644 --- a/Build/source/texk/web2c/luatexdir/lua/loslibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/loslibext.c @@ -25,7 +25,7 @@ #include <time.h> static const char _svn_version[] = - "$Id: loslibext.c 4479 2012-11-07 16:38:55Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/loslibext.c $"; + "$Id: loslibext.c 4479 2012-11-07 16:38:55Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/loslibext.c $"; #if defined(_WIN32) || defined(__NT__) # define MKDIR(a,b) mkdir(a) diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index a93f75a2aa0..1762833b037 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -18,7 +18,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lpdflib.c 4956 2014-03-28 12:12:17Z luigi $ " + "$Id: lpdflib.c 5018 2014-06-06 09:11:09Z taco $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lpdflib.c $"; #include "ptexlib.h" @@ -576,8 +576,10 @@ static int getpdf(lua_State * L) s = lua_tostring(L, -1); if (lua_key_eq(s,h)) { lua_pushnumber(L, static_pdf->posstruct->pos.h); + return 1; } else if (lua_key_eq(s,v)) { lua_pushnumber(L, static_pdf->posstruct->pos.v); + return 1; } else if ( lua_key_eq(s,catalog) || lua_key_eq(s,info) || lua_key_eq(s,trailer) || lua_key_eq(s,names) || lua_key_eq(s,pageattributes) || lua_key_eq(s,pagesattributes) || lua_key_eq(s,pageresources) @@ -587,9 +589,10 @@ static int getpdf(lua_State * L) /* [pdf table] [key] [pdf.data table] */ lua_replace(L, -3); /* [pdf.data table] [key] */ + lua_rawget(L, -2); + return 1; } } - lua_rawget(L, -2); return 0; } diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index 2d301d7369f..acf6895dbf3 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -18,7 +18,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lstatslib.c 4956 2014-03-28 12:12:17Z luigi $ " + "$Id: lstatslib.c 5081 2014-11-07 18:38:33Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lstatslib.c $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index 48c9e6f17ac..df5b4748800 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -27,7 +27,7 @@ setter no prev link is created so we can presume that it's not used later on. */ static const char _svn_version[] = - "$Id: ltexlib.c 4956 2014-03-28 12:12:17Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; + "$Id: ltexlib.c 5081 2014-11-07 18:38:33Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; #define attribute(A) eqtb[attribute_base+(A)].hh.rh #define dimen(A) eqtb[scaled_base+(A)].hh.rh @@ -288,7 +288,7 @@ void luacstring_close(int n) next = next->next; if (t==read_spindle.tail) { read_spindle.tail = NULL; // prevent double-free - } + } free(t); } read_spindle.head = NULL; @@ -2443,7 +2443,7 @@ static int tex_run_boot(lua_State * L) /* tex random generators */ static int tex_init_rand(lua_State * L) -{ +{ int sp; if (!lua_isnumber(L, 1)) { luaL_error(L, "argument must be a number"); @@ -2455,7 +2455,7 @@ static int tex_init_rand(lua_State * L) } static int tex_unif_rand(lua_State * L) -{ +{ int sp; if (!lua_isnumber(L, 1)) { luaL_error(L, "argument must be a number"); @@ -2467,13 +2467,13 @@ static int tex_unif_rand(lua_State * L) } static int tex_norm_rand(lua_State * L) -{ +{ lua_pushnumber(L, norm_rand()); return 1; } /* Same as lua but with tex rng */ -static int lua_math_random (lua_State *L) +static int lua_math_random (lua_State *L) { lua_Number rand_max = 0x7fffffff ; lua_Number r = unif_rand(rand_max) ; @@ -2504,6 +2504,39 @@ static int lua_math_random (lua_State *L) +/* Experimental code can either become permanent or disappear. It is +undocumented and mostly present in the experimental branch but for +practical reasons we also have the setup code in the regular binary. +The experimental_code array is indexed by i with 1<= i <= max_experimental_code, +position 0 is not used */ +int experimental_code[MAX_EXPERIMENTAL_CODE_SIZE] = { 0 }; + + +static int set_experimental_code(lua_State *L) +{ + int e, b, i ; + + if (lua_isboolean(L,1)) { + e = 0 ; + b = lua_toboolean(L,1) ; + } else if (lua_isnumber(L,1) && lua_isboolean(L,2)) { + e = (int) lua_tonumber(L, 1); + b = lua_toboolean(L,2) ; + } else { + return luaL_error(L, "boolean or number and boolean expected"); + } + if (e==0) { + for (i=1;i<=max_experimental_code;i++) { + experimental_code[i] = b; + } + } else if (0<e && e<=max_experimental_code ) { + experimental_code[e] = b; + } else { + return luaL_error(L, "first number out of range"); + } + return 0; +} + static int tex_run_main(lua_State * L) { (void) L; @@ -2609,6 +2642,7 @@ static const struct luaL_Reg texlib[] = { {"normal_rand", tex_norm_rand}, {"lua_math_randomseed", tex_init_rand}, /* syntactic sugar */ {"lua_math_random", lua_math_random}, + {"set_experimental_code",set_experimental_code}, {"show_context", tex_show_context}, {NULL, NULL} /* sentinel */ }; diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index dbf49093516..11d78503e30 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: luainit.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: luainit.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luainit.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index a42b147c301..6e9c5e278e7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.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: luatex-api.h 4956 2014-03-28 12:12:17Z luigi $ */ +/* $Id: luatex-api.h 5081 2014-11-07 18:38:33Z luigi $ */ #ifndef LUATEX_API_H # define LUATEX_API_H 1 @@ -1002,6 +1002,29 @@ init_lua_key_alias(term_and_log,"term and log") } while(0) + + +#ifdef __MINGW32__ +extern FILE *_cairo_win32_tmpfile( void ); +#define tmpfile() _cairo_win32_tmpfile() +#endif /* __MINGW32__ */ + + + +/* +* experimental code (no primitive): + + 0 = all + 1 = retain math nodes + +*/ + +#define max_experimental_code 1 +#define MAX_EXPERIMENTAL_CODE_SIZE max_experimental_code+1 +/* to be indexed by i with 1<= i <=max_experimental_code */ +extern int experimental_code[MAX_EXPERIMENTAL_CODE_SIZE] ; + + #endif /* LUATEX_API_H */ diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h index 208341dd8a7..145f8b85333 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h +++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/configure-pfaedit.h @@ -289,4 +289,13 @@ /* fonts */ #define BACK_LAYER_MAX 256 + + +#ifdef __MINGW32__ +#include <stdio.h> +extern FILE *_cairo_win32_tmpfile( void ); +#define tmpfile() _cairo_win32_tmpfile() +#endif /* __MINGW32__ */ + + #endif diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h index dc06e0e0807..73d0928a5e2 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h +++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/pfaedit.h @@ -77,5 +77,4 @@ extern Encoding *enclist; #define SCRIPT_MENU_MAX 10 - #endif diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c index 59e4b703fe9..7db31c12126 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c +++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c @@ -29,7 +29,7 @@ static const char _svn_version[] = "$Id: ffdummies.c 3738 2010-07-13 10:28:24Z oneiros $ " - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c $"; /* fix for non-gcc compilation: */ diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.c b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.c index e81deee984b..b75ae3a7df8 100644 --- a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.c +++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.c @@ -20,26 +20,25 @@ #include "ptexlib.h" -static const Byte compr[260] = { - 0x78, 0x9c, 0xad, 0x51, 0xc1, 0x4a, 0xc4, 0x30, 0x10, 0xbd, 0xe7, 0x2b, 0xe6, 0xd0, 0x83, 0xc2, - 0x36, 0x49, 0x57, 0x41, 0x5a, 0xd8, 0x0f, 0x10, 0x3c, 0x09, 0x5e, 0xbc, 0xa5, 0xe9, 0xb4, 0x0d, - 0x0d, 0x49, 0x98, 0x24, 0xee, 0x2e, 0xe2, 0xbf, 0x9b, 0x42, 0xd1, 0x55, 0xf1, 0xb6, 0x61, 0x12, - 0x1e, 0xf3, 0x5e, 0xe6, 0x3d, 0x98, 0xba, 0x86, 0xea, 0x71, 0xe8, 0x20, 0x0c, 0xa3, 0xcd, 0x8a, - 0x97, 0x0b, 0x77, 0xed, 0x7d, 0x0b, 0x7b, 0xd9, 0xc8, 0xba, 0x69, 0x6a, 0xf9, 0x00, 0x52, 0x76, - 0xb2, 0xed, 0x9a, 0xf6, 0x15, 0xe6, 0x19, 0xdd, 0x82, 0x16, 0x2a, 0x56, 0x97, 0x6f, 0x2f, 0xcf, - 0x4f, 0x1d, 0xcc, 0x29, 0x85, 0xd8, 0x09, 0x31, 0xfa, 0xec, 0x06, 0x3a, 0xf3, 0x98, 0x03, 0x5a, - 0xd4, 0x7c, 0x24, 0x11, 0xdf, 0x9c, 0x28, 0xf3, 0x12, 0x9e, 0x44, 0x4f, 0xca, 0xe9, 0x19, 0xa3, - 0xc0, 0x53, 0x3d, 0xd9, 0x73, 0x98, 0x45, 0xf4, 0x99, 0x34, 0x8a, 0x42, 0x2e, 0xe2, 0x88, 0xfd, - 0x5e, 0x6f, 0xd2, 0xc1, 0xd0, 0x8a, 0xa2, 0x26, 0x13, 0x52, 0x14, 0x17, 0xb1, 0x2a, 0xb6, 0xba, - 0xa6, 0xd9, 0x44, 0x28, 0x85, 0x8a, 0xec, 0x19, 0x8e, 0x9e, 0x16, 0x30, 0x0e, 0x02, 0xf9, 0x89, - 0x30, 0x46, 0xce, 0xf9, 0xaa, 0xba, 0xce, 0x61, 0xac, 0xc7, 0xc9, 0xb8, 0xa0, 0x26, 0x84, 0x03, - 0x8c, 0xd9, 0xe9, 0x64, 0xbc, 0xbb, 0x51, 0xb7, 0x0c, 0xdd, 0xc0, 0xd6, 0xe7, 0x3f, 0xca, 0xe7, - 0x14, 0x4a, 0x15, 0x36, 0x26, 0xc2, 0x1f, 0x92, 0x4d, 0x71, 0xbd, 0x8c, 0xd6, 0x6b, 0x65, 0xb7, - 0xf5, 0x15, 0xa3, 0x77, 0x06, 0x70, 0x19, 0xfb, 0x0b, 0xef, 0x0a, 0xf1, 0x1d, 0x79, 0x43, 0x6b, - 0xf3, 0x6f, 0xd8, 0x5f, 0x9d, 0x1d, 0xfb, 0x60, 0x8c, 0x30, 0x65, 0x72, 0x9b, 0x0f, 0xfb, 0x04, - 0xb9, 0x50, 0xa4, 0xf0 +static const Byte compr[251] = { + 0x78, 0x9c, 0xad, 0x51, 0xc1, 0x4a, 0xc4, 0x30, 0x14, 0xbc, 0xbf, 0xaf, 0x78, 0x87, 0x1e, 0x14, + 0xb6, 0x49, 0xba, 0x0a, 0xd2, 0x82, 0x1f, 0x20, 0x78, 0x12, 0xbc, 0x78, 0xeb, 0xa6, 0xaf, 0x6d, + 0x68, 0x48, 0xc2, 0x4b, 0xe2, 0xba, 0x88, 0xff, 0x6e, 0x0a, 0x45, 0x57, 0xc5, 0xdb, 0x86, 0x97, + 0x30, 0xcc, 0x4c, 0x32, 0x03, 0xa9, 0x6b, 0xac, 0x1e, 0x86, 0x0e, 0xc3, 0x30, 0xda, 0xdc, 0x8b, + 0xb2, 0xf1, 0xa6, 0xbd, 0x6d, 0x71, 0xaf, 0x1a, 0x55, 0x37, 0x4d, 0xad, 0xee, 0x50, 0xa9, 0x4e, + 0xb5, 0x5d, 0xd3, 0xbe, 0xe0, 0x3c, 0x93, 0x5b, 0xc8, 0x62, 0x05, 0x75, 0xb9, 0xf6, 0xfc, 0xf4, + 0xd8, 0xe1, 0x9c, 0x52, 0x88, 0x9d, 0x94, 0xa3, 0xcf, 0x6e, 0xe0, 0x93, 0x88, 0x39, 0x90, 0x25, + 0x2d, 0x46, 0x96, 0xf1, 0xd5, 0xc9, 0xf2, 0x5e, 0xa2, 0x37, 0x99, 0x38, 0xbb, 0x45, 0x46, 0x9f, + 0x59, 0x93, 0x2c, 0xc4, 0x22, 0x8f, 0x74, 0xd8, 0xeb, 0x4d, 0x1e, 0x0c, 0xaf, 0x28, 0x6a, 0x36, + 0x21, 0x45, 0x79, 0x56, 0xa5, 0x82, 0x35, 0x29, 0xcd, 0x26, 0x62, 0x19, 0xea, 0xd9, 0x9e, 0xf0, + 0xe8, 0x79, 0x41, 0xe3, 0x30, 0xb0, 0x9f, 0x98, 0x62, 0x14, 0x42, 0xac, 0xae, 0xcb, 0x2c, 0x80, + 0x03, 0x4d, 0xc6, 0x85, 0x7e, 0x22, 0xbc, 0xc7, 0x31, 0x3b, 0x9d, 0x8c, 0x77, 0x57, 0xfd, 0x35, + 0x90, 0x1b, 0x60, 0x3d, 0xfe, 0x93, 0x7c, 0x4e, 0xa1, 0x4c, 0x51, 0x63, 0x62, 0xfa, 0x61, 0xd9, + 0x1c, 0x97, 0xeb, 0x68, 0xbd, 0xee, 0xed, 0xf6, 0x65, 0x25, 0xe8, 0x1d, 0x10, 0xcf, 0x6b, 0x7f, + 0xe1, 0x5d, 0x11, 0xbe, 0x2b, 0x6f, 0x68, 0x25, 0xff, 0x96, 0xfd, 0xc5, 0xec, 0xe0, 0x03, 0x80, + 0x29, 0x65, 0x76, 0x5b, 0x0e, 0x7c, 0x02, 0x59, 0xee, 0xa0, 0x81 }; -static const zlib_struct compr_struct = { 566, 260, compr }; +static const zlib_struct compr_struct = { 554, 251, compr }; const zlib_struct *pdflua_zlib_struct_ptr = &compr_struct; diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua index dbb960fa6a4..a72b1a48256 100644 --- a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua +++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua @@ -1,5 +1,5 @@ -- $Id: pdflua.lua 3949 2010-11-07 00:09:19Z hhenkel $ --- $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/luascripts/pdflua.lua $ +-- $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luascripts/pdflua.lua $ -- this is early work in progress... diff --git a/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w index b642b182467..fbd8cdda34c 100644 --- a/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w +++ b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w @@ -19,7 +19,7 @@ % with LuaTeX; if not, see <http://www.gnu.org/licenses/>. % % $Id: txt2zlib.w 4479 2012-11-07 16:38:55Z taco $ -% $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/luascripts/txt2zlib.w $ +% $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luascripts/txt2zlib.w $ @ @c diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index c5b1ee034b1..43e056f68aa 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -24,16 +24,16 @@ #include "luatex_svnversion.h" static const char _svn_version[] = - "$Id: luatex.c 4969 2014-03-29 08:47:58Z taco $ " - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.79.1/source/texk/web2c/luatexdir/luatex.c $"; + "$Id: luatex.c 5082 2014-11-11 09:58:10Z luigi $ " + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luatex.c $"; #define TeX int luatex_svn = luatex_svn_revision; int luatex_version = 79; /* \.{\\luatexversion} */ -int luatex_revision = '1'; /* \.{\\luatexrevision} */ -int luatex_date_info = 2014040100; /* the compile date is now hardwired */ -const char *luatex_version_string = "beta-0.79.1"; +int luatex_revision = '2'; /* \.{\\luatexrevision} */ +int luatex_date_info = 2014111100; /* the compile date is now hardwired */ +const char *luatex_version_string = "beta-0.79.2"; const char *engine_name = my_name; /* the name of this engine */ #include <kpathsea/c-ctype.h> diff --git a/Build/source/texk/web2c/luatexdir/luatex.h b/Build/source/texk/web2c/luatexdir/luatex.h index f0cf9207af1..515d8b90d75 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.h +++ b/Build/source/texk/web2c/luatexdir/luatex.h @@ -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: luatex.h 4718 2014-01-02 15:35:31Z taco $ */ +/* $Id: luatex.h 5081 2014-11-07 18:38:33Z luigi $ */ #ifndef LUATEX_H # define LUATEX_H diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h index 5617183ee9d..bef33fd6cda 100644 --- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1 +1 @@ -#define luatex_svn_revision 4971 +#define luatex_svn_revision -1 diff --git a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h index c05e4f6024e..e4d66953440 100644 --- a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h +++ b/Build/source/texk/web2c/luatexdir/luatexcallbackids.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: luatexcallbackids.h 4956 2014-03-28 12:12:17Z luigi $ */ +/* $Id: luatexcallbackids.h 5081 2014-11-07 18:38:33Z luigi $ */ #ifndef LUATEXCALLBACKIDS_H #define LUATEXCALLBACKIDS_H @@ -62,6 +62,7 @@ typedef enum { pre_dump_callback, start_file_callback, stop_file_callback, show_error_message_callback,show_lua_error_hook_callback, + pdf_stream_filter_callback, total_callbacks } callback_callback_types; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w index 9bc503a8ec8..4bea1ebd3cd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfaction.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfaction.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfaction.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w index 88f548de3eb..30775fa5fa2 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfannot.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfannot.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfannot.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h index 225ac6045e7..c6a1256e05d 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.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: pdfgen.h 4956 2014-03-28 12:12:17Z luigi $ */ +/* $Id: pdfgen.h 5081 2014-11-07 18:38:33Z luigi $ */ #ifndef PDFGEN_H # define PDFGEN_H @@ -197,6 +197,7 @@ extern char *get_resname_prefix(PDF); extern void pdf_begin_page(PDF pdf); extern void pdf_end_page(PDF pdf); extern void print_pdf_table_string(PDF pdf, const char *s); +extern const char *get_pdf_table_string(const char *s); extern int get_pdf_table_bool(PDF, const char *, int); extern void fix_o_mode(PDF pdf); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 78873c7b5d5..35ce3307cc0 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfgen.w 4967 2014-03-28 19:44:06Z luigi $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.79.1/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; + "$Id: pdfgen.w 5081 2014-11-07 18:38:33Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; #include "ptexlib.h" @@ -155,8 +155,10 @@ PDF init_pdf_struct(PDF pdf) os->curbuf = PDFOUT_BUF; pdf->buf = os->buf[os->curbuf]; - - pdf->fb = new_strbuf(1, 100000000); + + /* Later ttf_seek_outbuf(TABDIR_OFF + n * 4 * TTF_ULONG_SIZE) */ + /* in ttf_init_font will need 236 bytes, so we start with 256 bytes as in pdftex. */ + pdf->fb = new_strbuf(256, 100000000); pdf->stream_deflate = false; pdf->stream_writing = false; @@ -235,9 +237,12 @@ static output_mode get_o_mode(void) { output_mode o_mode; if (pdf_output > 0) { + /* ls-hh: for the moment disabled ... incomplete old experiment */ + /* if (pdf_output == 2009) o_mode = OMODE_LUA; else + */ o_mode = OMODE_PDF; } else o_mode = OMODE_DVI; @@ -616,7 +621,7 @@ void pdf_print_str(PDF pdf, const char *s) return; } s++; - while (is_hex_char((unsigned char)*s)) + while (is_hex_char(*s)) s++; if (s != orig + l) { pdf_out(pdf, '('); @@ -639,7 +644,9 @@ void pdf_begin_stream(PDF pdf) pdf_puts(pdf, "\nstream\n"); pdf_save_offset(pdf); pdf_flush(pdf); - if (os->trigger_luastm) { + + if (callback_defined(pdf_stream_filter_callback)) { + /*if (os->trigger_luastm) {*/ os->trigger_luastm = false; /* this was just a trigger */ luaL_buffinit(Luas, &(os->b)); lbuf->p = lbuf->data = (unsigned char *) luaL_prepbuffer(&(os->b)); @@ -660,9 +667,20 @@ void pdf_begin_stream(PDF pdf) @c void pdf_end_stream(PDF pdf) { + typedef struct strbuf_const_s_ { + unsigned const char *data; /* a PDF stream buffer */ + unsigned const char *p; /* pointer to the next character in the PDF stream buffer */ + size_t size; /* currently allocated size of the PDF stream buffer, grows dynamically */ + size_t limit; /* maximum allowed PDF stream buffer size */ + } strbuf_const_s; + + os_struct *os = pdf->os; - strbuf_s *lbuf = os->buf[LUASTM_BUF]; + /* Old code, */ + /* strbuf_s *lbuf = os->buf[LUASTM_BUF]; */ + strbuf_const_s *lbuf = (strbuf_const_s * )os->buf[LUASTM_BUF]; const_lstring ls; + int callback_id ; assert(pdf->buf == os->buf[os->curbuf]); switch (os->curbuf) { case PDFOUT_BUF: @@ -673,12 +691,17 @@ void pdf_end_stream(PDF pdf) case LUASTM_BUF: luaL_addsize(&(os->b), strbuf_offset(os->buf[LUASTM_BUF])); luaL_pushresult(&(os->b)); - /* now the complete page stream is on the Lua stack */ /* TODO: pagestream filter callback here */ + callback_id = callback_defined(pdf_stream_filter_callback); + if (callback_id > 0) { + run_callback(callback_id, "S->S"); + } + ls.s = lua_tolstring(Luas, -1, &ls.l); - lbuf->data = (unsigned char *) ls.s; + /* lbuf->data = (unsigned char *) ls.s; */ + lbuf->data = (unsigned const char *) ls.s; lbuf->p = lbuf->data + ls.l; os->curbuf = LUASTM_BUF; pdf->buf = os->buf[os->curbuf]; @@ -751,17 +774,19 @@ for optimizations that are not possible in pascal. @c scaled round_xn_over_d(scaled x, int n, unsigned int d) { - boolean positive; /* was |x>=0|? */ + boolean positive = true; /* was |x>=0|, |n>=0| ? */ unsigned t, u, v; /* intermediate quantities */ - if (x >= 0) { - positive = true; - } else { + if (x < 0) { + positive = !positive; x = -(x); - positive = false; } - t = (unsigned) ((x % 0100000) * n);//printf("t=%d\n",t); - u = (unsigned) (((unsigned) (x) / 0100000) * (unsigned) n + (t / 0100000));//printf("u=%d\n",u); - v = (u % d) * 0100000 + (t % 0100000);//printf("v=%d\n",v); + if (n < 0) { + positive = !positive; + n = -(n); + } + t = (unsigned) ((x % 0100000) * n); + u = (unsigned) (((unsigned) (x) / 0100000) * (unsigned) n + (t / 0100000)); + v = (u % d) * 0100000 + (t % 0100000); if (u / d >= 0100000) arith_error = true; else @@ -1901,7 +1926,7 @@ void print_pdf_table_string(PDF pdf, const char *s) } @ @c -static const char *get_pdf_table_string(const char *s) +const char *get_pdf_table_string(const char *s) { const_lstring ls; lua_rawgeti(Luas, LUA_REGISTRYINDEX, lua_key_index(pdf_data)); @@ -1910,8 +1935,10 @@ static const char *get_pdf_table_string(const char *s) lua_rawget(Luas, -2); /* s? t ... */ if (lua_isstring(Luas, -1)) { /* s t ... */ ls.s = lua_tolstring(Luas, -1, &ls.l); + /* s is supposed to be anchored (e.g in the registry) + so it's not garbage collected */ lua_pop(Luas, 2); /* ... */ - return ls.s; + return ls.s; } lua_pop(Luas, 2); /* ... */ return NULL ; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h index 563a59847bc..b8ca8d97952 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.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: pdfglyph.h 4679 2013-12-19 15:47:53Z luigi $ */ +/* $Id: pdfglyph.h 5073 2014-10-24 16:54:52Z oneiros $ */ #ifndef PDFGLYPH_H # define PDFGLYPH_H diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w index c9fa5775198..84b2df14d37 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfglyph.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: pdfglyph.w 5073 2014-10-24 16:54:52Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfglyph.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w index 73ce55d8e3d..400cd9bcf4a 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdflink.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdflink.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdflink.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w index e4aba134dda..7ad2065dc3a 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfliteral.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfliteral.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfliteral.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h index 69ddf3406ca..b698ab86081 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.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: pdfluaapi.h 3949 2010-11-07 00:09:19Z hhenkel $ */ +/* $Id: pdfluaapi.h 5072 2014-10-24 16:53:43Z oneiros $ */ #ifndef PDFLUAAPI_H # define PDFLUAAPI_H diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w index a32d20490fd..fa0f4189160 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfluaapi.w 4847 2014-03-05 18:13:17Z luigi $" + "$Id: pdfluaapi.w 5072 2014-10-24 16:53:43Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w index a54cd563301..130d9720800 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfoutline.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfoutline.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfoutline.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h index a4fe0f53ba0..f742eff2fb1 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.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: pdfpage.h 4313 2011-06-21 18:31:19Z hhenkel $ */ +/* $Id: pdfpage.h 5073 2014-10-24 16:54:52Z oneiros $ */ #ifndef PDFPAGE_H # define PDFPAGE_H diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w index e089a8ed83c..c53db084423 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfpage.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: pdfpage.w 5073 2014-10-24 16:54:52Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfpage.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.h b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.h index 13185874ca0..fdd7841d5da 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.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: pdfpagetree.h 4214 2011-04-27 21:53:38Z hhenkel $ */ +/* $Id: pdfpagetree.h 5073 2014-10-24 16:54:52Z oneiros $ */ #ifndef PAGETREE_H # define PAGETREE_H diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w index d35d91578d9..1e2716bb0a7 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfpagetree.w 4957 2014-03-28 13:14:51Z taco $" + "$Id: pdfpagetree.w 5073 2014-10-24 16:54:52Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfpagetree.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.h b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.h index d1d13b77f00..aa5cc9b0e7f 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.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: pdfrule.h 3003 2009-08-16 19:55:55Z hhenkel $ */ +/* $Id: pdfrule.h 5073 2014-10-24 16:54:52Z oneiros $ */ #ifndef PDFRULE_H # define PDFRULE_H diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w index a7ed050a644..a4665e951f8 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfrule.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: pdfrule.w 5073 2014-10-24 16:54:52Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfrule.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w index 61342ed7786..f007a236c5b 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfshipout.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfshipout.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfshipout.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w index 5855647cddc..f2c8784f7f9 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfthread.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w index 17d7291f950..edf3d2ac4e4 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfxform.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfxform.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfxform.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/align.w b/Build/source/texk/web2c/luatexdir/tex/align.w index de80cc0a093..1e5c48cc0c4 100644 --- a/Build/source/texk/web2c/luatexdir/tex/align.w +++ b/Build/source/texk/web2c/luatexdir/tex/align.w @@ -21,7 +21,7 @@ @ @c static const char _svn_version[] = - "$Id: align.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: align.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/align.w $"; #include "ptexlib.h" @@ -1135,6 +1135,7 @@ value is changed to zero and so is the next tabskip. if (cur_list.mode_field == mmode) { finish_display_alignment(p, q, pd); } else { + cur_list.prev_depth_field = pd; /* aux:=aux_save; */ vlink(cur_list.tail_field) = p; if (p != null) cur_list.tail_field = q; diff --git a/Build/source/texk/web2c/luatexdir/tex/arithmetic.w b/Build/source/texk/web2c/luatexdir/tex/arithmetic.w index 1c84167ced5..5606aa641ec 100644 --- a/Build/source/texk/web2c/luatexdir/tex/arithmetic.w +++ b/Build/source/texk/web2c/luatexdir/tex/arithmetic.w @@ -21,8 +21,8 @@ @ @c static const char _svn_version[] = - "$Id: arithmetic.w 4634 2013-04-21 14:45:45Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/arithmetic.w $"; + "$Id: arithmetic.w 4593 2013-03-19 14:25:17Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/arithmetic.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/conditional.w b/Build/source/texk/web2c/luatexdir/tex/conditional.w index bcea19201a2..16092a491da 100644 --- a/Build/source/texk/web2c/luatexdir/tex/conditional.w +++ b/Build/source/texk/web2c/luatexdir/tex/conditional.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: conditional.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/conditional.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/conditional.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w index 718d6b7fb17..46913bce3a8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -19,14 +19,21 @@ @ @c static const char _svn_version[] = - "$Id: dumpdata.w 4563 2013-01-21 03:22:53Z khaled $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/dumpdata.w $"; + "$Id: dumpdata.w 5081 2014-11-07 18:38:33Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/dumpdata.w $"; #include "ptexlib.h" #define font_id_text(A) cs_text(font_id_base+(A)) #define prev_depth cur_list.prev_depth_field +/* 907 = sum of the values of the bytes of "don knuth" */ +/* The next FORMAT_ID will be 907+1 */ +#define FORMAT_ID (907+0) +#if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) +#error Wrong value for FORMAT_ID. +#endif + @ After \.{INITEX} has seen a collection of fonts and macros, it can write all the necessary information on an auxiliary file so @@ -42,8 +49,10 @@ after the |banner| line when \TeX\ is ready to start. For \.{INITEX} this string says simply `\.{(INITEX)}'; for other versions of \TeX\ it says, for example, `\.{(preloaded format=plain 1982.11.19)}', showing the year, month, and day that the format file was created. We have |format_ident=0| -before \TeX's tables are loaded. - +before \TeX's tables are loaded. |FORMAT_ID| is a new field of type int +suitable for the identification of a format: values between 0 and 256 +(included) can not be used because in the previous format they are used +for the length of the name of the engine. @c str_number format_ident; str_number format_name; /* principal file name */ @@ -114,6 +123,8 @@ void store_fmt_file(void) dump/undump macros. */ dump_int(0x57325458); /* Web2C \TeX's magic constant: "W2TX" */ + dump_int(FORMAT_ID); + /* Align engine to 4 bytes with one or more trailing NUL */ x = (int) strlen(engine_name); format_engine = xmalloc((unsigned) (x + 4)); @@ -368,11 +379,17 @@ boolean load_fmt_file(const char *fmtname) format_debug("format magic number", x); if (x != 0x57325458) goto BAD_FMT; /* not a format file */ + + undump_int(x); + format_debug("format id", x); + if (x != FORMAT_ID) + goto BAD_FMT; /* FORMAT_ID mismatch */ + undump_int(x); format_debug("engine name size", x); if ((x < 0) || (x > 256)) goto BAD_FMT; /* corrupted format file */ - + format_engine = xmalloc((unsigned) x); undump_things(format_engine[0], x); format_engine[x - 1] = 0; /* force string termination, just in case */ diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.w b/Build/source/texk/web2c/luatexdir/tex/equivalents.w index 74465213702..3c948634f98 100644 --- a/Build/source/texk/web2c/luatexdir/tex/equivalents.w +++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: equivalents.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/equivalents.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/equivalents.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.h b/Build/source/texk/web2c/luatexdir/tex/errors.h index e0ea6e671ad..537bea562da 100644 --- a/Build/source/texk/web2c/luatexdir/tex/errors.h +++ b/Build/source/texk/web2c/luatexdir/tex/errors.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: errors.h 4956 2014-03-28 12:12:17Z luigi $ */ +/* $Id: errors.h 5081 2014-11-07 18:38:33Z luigi $ */ #ifndef ERRORS_H # define ERRORS_H @@ -97,6 +97,7 @@ extern void tex_error(const char *msg, const char **hlp); extern void back_error(void); extern void ins_error(void); +extern void flush_err(void); extern void char_warning(internal_font_number f, int c); diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w index 120d44b8a3c..eab33d9c809 100644 --- a/Build/source/texk/web2c/luatexdir/tex/errors.w +++ b/Build/source/texk/web2c/luatexdir/tex/errors.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: errors.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: errors.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/errors.w $"; #include "ptexlib.h" @@ -60,7 +60,7 @@ char *last_error = NULL; int err_old_setting = 0 ; int in_error = 0 ; -static void flush_err(void) +void flush_err(void) { str_number s_error; char *s = NULL; diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.w b/Build/source/texk/web2c/luatexdir/tex/expand.w index 60e1e05686c..d00d84e128d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/expand.w +++ b/Build/source/texk/web2c/luatexdir/tex/expand.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: expand.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/expand.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/expand.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w index 99d6b77697b..41f709d3e29 100644 --- a/Build/source/texk/web2c/luatexdir/tex/extensions.w +++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w @@ -23,7 +23,7 @@ @ @c static const char _svn_version[] = "$Id: extensions.w 4519 2012-12-14 09:11:19Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/extensions.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/extensions.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/filename.w b/Build/source/texk/web2c/luatexdir/tex/filename.w index 697f413f2fa..95a94a75074 100644 --- a/Build/source/texk/web2c/luatexdir/tex/filename.w +++ b/Build/source/texk/web2c/luatexdir/tex/filename.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: filename.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/filename.w $"; + "$Id: filename.w 5081 2014-11-07 18:38:33Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/filename.w $"; #include "ptexlib.h" @@ -236,6 +236,7 @@ char *prompt_file_name(const char *s, const char *e) { int k; /* index into |buffer| */ str_number saved_cur_name; /* to catch empty terminal input */ + int callback_id ; char prompt[256]; char *ar, *na, *ex; saved_cur_name = cur_name; @@ -254,10 +255,16 @@ char *prompt_file_name(const char *s, const char *e) free(na); free(ex); print_err(prompt); - if ((strcmp(e, ".tex") == 0) || (strcmp(e, "") == 0)) - show_context(); - if (strcmp(s, "input file name") == 0) - tprint_nl(promptfilenamehelpmsg ")"); + callback_id = callback_defined(show_error_hook_callback); + if (callback_id > 0) { + flush_err(); + run_callback(callback_id, "->"); + } else { + if ((strcmp(e, ".tex") == 0) || (strcmp(e, "") == 0)) + show_context(); + if (strcmp(s, "input file name") == 0) + tprint_nl(promptfilenamehelpmsg ")"); + } tprint_nl("Please type another "); tprint(s); if (interaction < scroll_mode) @@ -283,6 +290,7 @@ char *prompt_file_name(const char *s, const char *e) return pack_file_name(cur_name, cur_area, cur_ext); } + @ @c void tprint_file_name(unsigned char *n, unsigned char *a, unsigned char *e) { diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.w b/Build/source/texk/web2c/luatexdir/tex/inputstack.w index 136d9507c03..2fc5628e251 100644 --- a/Build/source/texk/web2c/luatexdir/tex/inputstack.w +++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: inputstack.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/inputstack.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/inputstack.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index 646676bcfa2..fd486c3367e 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: linebreak.w 4775 2014-02-07 12:36:34Z luigi $" + "$Id: linebreak.w 4777 2014-02-10 10:09:39Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/linebreak.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w index 5ee630dc24d..05b842217a5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w +++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: maincontrol.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: maincontrol.w 5011 2014-05-26 08:05:55Z khaled $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/maincontrol.w $"; #include "ptexlib.h" @@ -2798,19 +2798,15 @@ void assign_internal_value(int a, halfword p, int val) if (val > 127) { print_err("Invalid \\newlinechar"); help2 - ("The value for \\newlinechar has to be between 0 and 127.", + ("The value for \\newlinechar has to be no higher than 127.", "Your invalid assignment will be ignored."); error(); - } else if (val < 0) { - word_define(p, -1); } else { word_define(p, val); } break; case end_line_char_code: - if (val < 0) { - word_define(p, -1); - } else if (val > 127) { + if (val > 127) { print_err("Invalid \\endlinechar"); help2 ("The value for \\endlinechar has to be no higher than 127.", diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w index 1603365bc2c..7092dace012 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w @@ -21,7 +21,7 @@ @ @c static const char _svn_version[] = "$Id: mathcodes.w 4562 2013-01-21 02:58:59Z khaled $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/mathcodes.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/mathcodes.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/memoryword.h b/Build/source/texk/web2c/luatexdir/tex/memoryword.h index 8c44a7e4e0d..6f9cfa393b1 100644 --- a/Build/source/texk/web2c/luatexdir/tex/memoryword.h +++ b/Build/source/texk/web2c/luatexdir/tex/memoryword.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: memoryword.h 3352 2010-01-10 15:35:31Z hhenkel $ */ +/* $Id: memoryword.h 5031 2014-07-04 07:16:27Z luigi $ */ /* This header file is extra special because it is read in from within the pascal source */ @@ -123,7 +123,7 @@ typedef union { typedef FILE *word_file; # ifdef DEBUG -extern procedure print_word(memory_word w); +extern void print_word(memory_word w); # endif #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/memoryword.w b/Build/source/texk/web2c/luatexdir/tex/memoryword.w index 339e094bb2c..d3002f1b2b6 100644 --- a/Build/source/texk/web2c/luatexdir/tex/memoryword.w +++ b/Build/source/texk/web2c/luatexdir/tex/memoryword.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: memoryword.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/memoryword.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/memoryword.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w index 3621d9f64b6..e653c07c6f0 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.w +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w @@ -24,7 +24,7 @@ @ @c static const char _svn_version[] = - "$Id: mlist.w 4804 2014-02-12 14:41:14Z luigi $" + "$Id: mlist.w 5033 2014-07-05 00:36:59Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/mlist.w $"; #include "ptexlib.h" @@ -1021,6 +1021,7 @@ try_couple_nodes(p,list_ptr(b)); } } + static void stack_glue_into_box(pointer b, scaled min, scaled max) { pointer p, q; /* new node placed into |b| */ q = new_spec(zero_glue); @@ -1029,10 +1030,8 @@ static void stack_glue_into_box(pointer b, scaled min, scaled max) { p = new_glue(q); reset_attributes(p, node_attr(b)); if (type(b) == vlist_node) { -// vlink(p) = list_ptr(b); -try_couple_nodes(p,list_ptr(b)); + try_couple_nodes(p,list_ptr(b)); list_ptr(b) = p; - height(b) = height(p); } else { q = list_ptr(b); if (q == null) { @@ -1042,10 +1041,6 @@ try_couple_nodes(p,list_ptr(b)); q = vlink(q); couple_nodes(q,p); } - if (height(b) < height(p)) - height(b) = height(p); - if (depth(b) < depth(p)) - depth(b) = depth(p); } } @@ -2539,7 +2534,7 @@ static void make_ord(pointer q) type(nucleus(r)) = math_text_char_node; /* prevent combination */ break; default: - couple_nodes(q,vlink(p)); + try_couple_nodes(q,vlink(p)); math_character(nucleus(q)) = lig_replacement(lig); /* \.{=:} */ s = math_clone(subscr(p)); subscr(q) = s; diff --git a/Build/source/texk/web2c/luatexdir/tex/nesting.w b/Build/source/texk/web2c/luatexdir/tex/nesting.w index aa0f32e3324..177901166f4 100644 --- a/Build/source/texk/web2c/luatexdir/tex/nesting.w +++ b/Build/source/texk/web2c/luatexdir/tex/nesting.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: nesting.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/nesting.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/nesting.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.w b/Build/source/texk/web2c/luatexdir/tex/packaging.w index d6d02106022..42a87f1ee0d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/packaging.w +++ b/Build/source/texk/web2c/luatexdir/tex/packaging.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: packaging.w 4679 2013-12-19 15:47:53Z luigi $" + "$Id: packaging.w 5023 2014-06-18 08:22:44Z taco $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/packaging.w $"; #include "ptexlib.h" @@ -1216,10 +1216,14 @@ void package(int c) halfword p; /* first node in a box */ scaled d; /* max depth */ int grp; + halfword saved0, saved2, saved3; grp = cur_group; d = box_max_depth; unsave(); save_ptr -= 4; + saved0 = saved_value(0); + saved2 = saved_value(2); + saved3 = saved_value(3); if (cur_list.mode_field == -hmode) { cur_box = filtered_hpack(cur_list.head_field, cur_list.tail_field, saved_value(1), @@ -1246,15 +1250,15 @@ void package(int c) } } - if (saved_value(2) != null) { + if (saved2 != null) { /* DIR: Adjust back |text_dir_ptr| for |scan_spec| */ flush_node_list(text_dir_ptr); - text_dir_ptr = saved_value(2); + text_dir_ptr = saved2; } - replace_attribute_list(cur_box, saved_value(3)); + replace_attribute_list(cur_box, saved3); pop_nest(); - box_end(saved_value(0)); + box_end(saved0); } diff --git a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w index ef769f7a357..d7990ca52c0 100644 --- a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: postlinebreak.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: postlinebreak.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/postlinebreak.w $"; #include "ptexlib.h" @@ -98,7 +98,7 @@ void ext_post_line_break(int paragraph_dir, halfword cur_line; /*the current line number being justified */ dir_ptr = cur_list.dirs_field; - /* Reverse the links of the relevant passive nodes, setting |cur_p| to + /* Reverse the links of the relevant passive nodes, setting |cur_p| to the first breakpoint; */ /* The job of reversing links in a list is conveniently regarded as the job of taking items off one stack and putting them on another. In this case we @@ -108,7 +108,7 @@ void ext_post_line_break(int paragraph_dir, */ q = break_node(best_bet); #if 0 - used_discs = used_disc(best_bet); + used_discs = used_disc(best_bet); #endif /* |has_direction| */ cur_p = null; @@ -530,17 +530,78 @@ void ext_post_line_break(int paragraph_dir, |break_width| values are computed for non-discretionary breakpoints. */ r = temp_head; - while (1) { - q = vlink(r); - if (q == cur_break(cur_p) || is_char_node(q)) - break; - if (!((type(q) == whatsit_node) - && (subtype(q) == local_par_node))) { - if (non_discardable(q) - || (type(q) == kern_node && subtype(q) != explicit)) + if (experimental_code[1]) { + /* hh-ls: This is a first step to improving symmetry and consistency in the node + list. This is normally no issue in tex, but in callbacks it matters. */ + + /* Normally we have a matching math open and math close node but when we cross a line + the open node is removed, including any glue or penalties following it. This is however + not that nice for callbacks that rely on symmetry. Of course this only counts for one + liners, as we can still have only a begin or end node on a line. The end_of_math lua + helper is made robust against this although there you should be aware of the fact that + one can end up in the middle of math in callbacks that don't work on whole paragraphs, + but at least this branch makes sure that some proper analysis is possible. (todo: check + if math glyphs have the subtype marked done). */ + + halfword m = null ; + halfword mp, mn, rn ; + while (1) { + q = vlink(r); + if (! q) { + /* unlikely */ break; + } else if (q == cur_break(cur_p)) { + /* quit */ + break; + } else if (type(q) == glyph_node) { + /* quit: is > math_code */ + break; + } else if (type(q) == math_node) { + /* we want to keep symmetry */ + surround(q) = 0 ; + // fprintf(stdout,"KEEP MATH NODE\n"); + m = q ; + } else if (type(q) == kern_node && subtype(q) != explicit) { + /* quit: so we keep \kern but also auto kerns */ + break; + } if (non_discardable(q)) { + /* quit: < math_node */ + break; + } else { + /* skip: glue, penalty, (font)kern, noads, temp stuff, all kind of left-overs */ + } + r = q; + } + if (m != null) { + if (r == m) { + /* [a] [b] [m=r] => [a] [b=r] */ + r = alink(m) ; + } else { + /* [a] [b] [m] [c] [r] [rn] => [a] [b] [c] [r] [m] [rn] */ + mp = alink(m) ; + mn = vlink(m) ; + rn = vlink(r) ; + vlink(r) = m ; + alink(m) = r ; + if (rn) { + alink(rn) = m ; + vlink(m) = rn ; + } + vlink(mp) = mn ; + alink(mn) = mp ; + } + } + } else { + while (1) { + q = vlink(r); + if (q == cur_break(cur_p) || is_char_node(q)) + break; + if (!((type(q) == whatsit_node) && (subtype(q) == local_par_node))) { + if (non_discardable(q) || (type(q) == kern_node && subtype(q) != explicit)) + break; + } + r = q; } - r = q; } if (r != temp_head) { vlink(r) = null; diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.w b/Build/source/texk/web2c/luatexdir/tex/primitive.w index ab983cfe346..e02ae1a7735 100644 --- a/Build/source/texk/web2c/luatexdir/tex/primitive.w +++ b/Build/source/texk/web2c/luatexdir/tex/primitive.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: primitive.w 4562 2013-01-21 02:58:59Z khaled $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/primitive.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/primitive.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.h b/Build/source/texk/web2c/luatexdir/tex/printing.h index e664c51d720..057ed422b95 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.h +++ b/Build/source/texk/web2c/luatexdir/tex/printing.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: printing.h 4722 2014-01-03 09:32:35Z taco $ */ +/* $Id: printing.h 5002 2014-05-20 09:14:16Z taco $ */ #ifndef PRINTING_H # define PRINTING_H @@ -60,6 +60,7 @@ by changing |wterm|, |wterm_ln|, and |wterm_cr| in this section. extern void print_ln(void); extern void print_char(int s); extern void print(int s); +extern void lprint (lstring *ss); extern void print_nl(str_number s); extern void print_nlp(void); extern void print_banner(const char *, int); diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w index 9b2404c0196..ce64d1e829c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.w +++ b/Build/source/texk/web2c/luatexdir/tex/printing.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: printing.w 4857 2014-03-07 00:01:41Z luigi $" + "$Id: printing.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/printing.w $"; #include "ptexlib.h" @@ -226,8 +226,6 @@ to do the same substraction while typesetting. @c void print(int s) { /* prints string |s| */ - unsigned char *j, *l; /* current character code position */ - if (s >= str_ptr) { /* this can't happen */ print_char('?'); @@ -285,8 +283,13 @@ void print(int s) append_string(str_string(s), (unsigned) str_length(s)); return; } - j = str_string(s); - l = j + str_length(s); + lprint(&str_lstring(s)); +} + +void lprint (lstring *ss) { + unsigned char *j, *l; /* current character code position */ + j = ss->s; + l = j + ss->l; while (j < l) { /* 0x110000 in utf=8: 0xF4 0x90 0x80 0x80 */ /* I don't bother checking the last two bytes explicitly */ @@ -302,7 +305,6 @@ void print(int s) } } - @ The procedure |print_nl| is like |print|, but it makes sure that the string appears at the beginning of a new line. @@ -339,8 +341,9 @@ void tprint(const char *sss) break; case pseudo: while (*sss) { - if (tally++ < trick_count) { + if (tally < trick_count) { trick_buf[tally % error_line] = (packed_ASCII_code) *sss++; + tally++; } else { return; } diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w index f3cc9b29bb5..7e2283a92cc 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.w +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: scanning.w 4877 2014-03-14 01:26:05Z luigi $" + "$Id: scanning.w 5009 2014-05-26 07:49:59Z taco $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/scanning.w $"; #include "ptexlib.h" @@ -2089,7 +2089,7 @@ halfword scan_toks(boolean macro_def, boolean xpand) sprint_cs(warning_index); help3("You meant to type ## instead of #, right?", "Or maybe a } was forgotten somewhere earlier, and things", - "are all screwed up? I''m going to assume that you meant ##."); + "are all screwed up? I'm going to assume that you meant ##."); back_error(); cur_tok = s; } else { diff --git a/Build/source/texk/web2c/luatexdir/tex/stringpool.h b/Build/source/texk/web2c/luatexdir/tex/stringpool.h index 136e5cdb758..d9a33fe102d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/stringpool.h +++ b/Build/source/texk/web2c/luatexdir/tex/stringpool.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: stringpool.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: stringpool.h 4599 2013-03-19 15:41:07Z taco $ */ #ifndef STRINGPOOL_H # define STRINGPOOL_H diff --git a/Build/source/texk/web2c/luatexdir/tex/stringpool.w b/Build/source/texk/web2c/luatexdir/tex/stringpool.w index 4df0c53c54b..990c619d7f2 100644 --- a/Build/source/texk/web2c/luatexdir/tex/stringpool.w +++ b/Build/source/texk/web2c/luatexdir/tex/stringpool.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: stringpool.w 4634 2013-04-21 14:45:45Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/stringpool.w $"; + "$Id: stringpool.w 4599 2013-03-19 15:41:07Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/stringpool.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/texdeffont.w b/Build/source/texk/web2c/luatexdir/tex/texdeffont.w index 2766c4b4cd7..174a1ba86dc 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texdeffont.w +++ b/Build/source/texk/web2c/luatexdir/tex/texdeffont.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: texdeffont.w 4520 2012-12-14 09:15:55Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/texdeffont.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texdeffont.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w index 527be959082..428e5001304 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.w +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: texmath.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: texmath.w 5081 2014-11-07 18:38:33Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texmath.w $"; #include "ptexlib.h" @@ -1418,7 +1418,10 @@ void math_limit_switch(void) NULL }; if (head != tail) { - if (type(tail) == simple_noad) { + if (type(tail) == simple_noad && + (subtype(tail) == op_noad_type_normal || + subtype(tail) == op_noad_type_limits || + subtype(tail) == op_noad_type_no_limits)) { subtype(tail) = (quarterword) cur_chr; return; } diff --git a/Build/source/texk/web2c/luatexdir/tex/textcodes.w b/Build/source/texk/web2c/luatexdir/tex/textcodes.w index e54aa0f72d0..08d890dfb3d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textcodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/textcodes.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: textcodes.w 4519 2012-12-14 09:11:19Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/textcodes.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/textcodes.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w index e9ae2e670a4..d37b85ae6f8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.w +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: textoken.w 4956 2014-03-28 12:12:17Z luigi $" + "$Id: textoken.w 5004 2014-05-20 09:23:31Z taco $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/textoken.w $"; #include "ptexlib.h" @@ -2323,7 +2323,7 @@ char *tokenlist_to_cstring(int pp, int inhibit_par, int *siz) s++; } } else { - Print_uchar(e); + if (e>=0 && e<0x110000) Print_uchar(e); while (*s) { Print_char(*s); s++; diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h index 05543befc20..6eb9ac6773d 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.h +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.h @@ -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: avlstuff.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: avlstuff.h 5074 2014-10-24 16:57:38Z oneiros $ */ #ifndef AVLSTUFF_H # define AVLSTUFF_H diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.w b/Build/source/texk/web2c/luatexdir/utils/avlstuff.w index ca00f29b75d..fc94e68fe9a 100644 --- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.w +++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.w @@ -22,8 +22,8 @@ @ @c static const char _svn_version[] = - "$Id: avlstuff.w 4634 2013-04-21 14:45:45Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/utils/avlstuff.w $"; + "$Id: avlstuff.w 5074 2014-10-24 16:57:38Z oneiros $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/avlstuff.w $"; #include "ptexlib.h" #include "utils/avl.h" diff --git a/Build/source/texk/web2c/luatexdir/utils/managed-sa.w b/Build/source/texk/web2c/luatexdir/utils/managed-sa.w index ed85a696acf..afdd99bfa61 100644 --- a/Build/source/texk/web2c/luatexdir/utils/managed-sa.w +++ b/Build/source/texk/web2c/luatexdir/utils/managed-sa.w @@ -22,7 +22,7 @@ @ @c static const char _svn_version[] = "$Id: managed-sa.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/utils/managed-sa.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/managed-sa.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/utils/unistring.h b/Build/source/texk/web2c/luatexdir/utils/unistring.h index e1f8e336c70..af9ba0f8f56 100644 --- a/Build/source/texk/web2c/luatexdir/utils/unistring.h +++ b/Build/source/texk/web2c/luatexdir/utils/unistring.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: unistring.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: unistring.h 5074 2014-10-24 16:57:38Z oneiros $ */ #ifndef UNISTRING_H # define UNISTRING_H diff --git a/Build/source/texk/web2c/luatexdir/utils/unistring.w b/Build/source/texk/web2c/luatexdir/utils/unistring.w index 5babddff1d2..9e3eb4f243b 100644 --- a/Build/source/texk/web2c/luatexdir/utils/unistring.w +++ b/Build/source/texk/web2c/luatexdir/utils/unistring.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: unistring.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: unistring.w 5074 2014-10-24 16:57:38Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/unistring.w $"; @ @c diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.h b/Build/source/texk/web2c/luatexdir/utils/utils.h index f67f080db11..d342feed4dd 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.h +++ b/Build/source/texk/web2c/luatexdir/utils/utils.h @@ -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: utils.h 4479 2012-11-07 16:38:55Z taco $ */ +/* $Id: utils.h 5074 2014-10-24 16:57:38Z oneiros $ */ #ifndef UTILS_H # define UTILS_H diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.w b/Build/source/texk/web2c/luatexdir/utils/utils.w index c164a0463fb..bb91e57b955 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.w +++ b/Build/source/texk/web2c/luatexdir/utils/utils.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: utils.w 4903 2014-03-15 12:18:10Z taco $" + "$Id: utils.w 5074 2014-10-24 16:57:38Z oneiros $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/utils.w $"; @ @c |