From 70b9e104222eb5ba7a495c6267643c6470fb4667 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 10 Dec 2014 09:22:25 +0000 Subject: 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 --- Build/source/texk/web2c/luatexdir/pdf/pdfaction.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfannot.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfgen.h | 3 +- Build/source/texk/web2c/luatexdir/pdf/pdfgen.w | 65 +++++++++++++++------- Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdflink.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfpage.h | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfpage.w | 2 +- .../source/texk/web2c/luatexdir/pdf/pdfpagetree.h | 2 +- .../source/texk/web2c/luatexdir/pdf/pdfpagetree.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfrule.h | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfrule.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfthread.w | 2 +- Build/source/texk/web2c/luatexdir/pdf/pdfxform.w | 2 +- 20 files changed, 66 insertions(+), 38 deletions(-) (limited to 'Build/source/texk/web2c/luatexdir/pdf') 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 . */ -/* $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 . */ -/* $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 . */ -/* $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 . */ -/* $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 . */ -/* $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 . */ -/* $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" -- cgit v1.2.3