diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2014-03-15 12:21:15 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2014-03-15 12:21:15 +0000 |
commit | a22d9897afbabdd07f13d2bc5c7c5b9c5865ab53 (patch) | |
tree | 70829ffa23329ca4c04efa8da7a18cfe9c44a1f4 /Build/source/texk/web2c/luatexdir/pdf | |
parent | 5909dbd7ee4290cc486c9c12e4ef0b2bfb9067d4 (diff) |
here is luatex 0.79.0
git-svn-id: svn://tug.org/texlive/trunk@33180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf')
7 files changed, 62 insertions, 65 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w index 5b1c736e7dd..483db2a4c80 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfcolorstack.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; + "$Id: pdfcolorstack.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; #include "ptexlib.h" @@ -239,7 +239,7 @@ int colorstackpop(int colstack_no) if (global_shipping_mode == SHIPPING_PAGE) { if (colstack->page_used == 0) { - pdftex_warn("pop empty color page stack %u", + luatex_warn("pop empty color page stack %u", (unsigned int) colstack_no); return colstack->literal_mode; } @@ -248,7 +248,7 @@ int colorstackpop(int colstack_no) put_cstring_on_str_pool(colstack->page_current); } else { if (colstack->form_used == 0) { - pdftex_warn("pop empty color form stack %u", + luatex_warn("pop empty color form stack %u", (unsigned int) colstack_no); return colstack->literal_mode; } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 83e5a27e4c8..bfda9102e7b 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfgen.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: pdfgen.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; #include "ptexlib.h" @@ -34,7 +34,7 @@ static const char _svn_version[] = #define check_nprintf(size_get, size_want) \ if ((unsigned)(size_get) >= (unsigned)(size_want)) \ - pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); + luatex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); PDF static_pdf = NULL; @@ -254,8 +254,7 @@ void fix_o_mode(PDF pdf) if (pdf->o_mode == OMODE_NONE) pdf->o_mode = o_mode; else if (pdf->o_mode != o_mode) - pdf_error("setup", - "\\pdfoutput can only be changed before anything is written to the output"); + pdf_error("setup", "\\pdfoutput can only be changed before anything is written to the output"); } @ This ensures that |pdfminorversion| is set only before any bytes have @@ -268,14 +267,9 @@ void fix_pdf_minorversion(PDF pdf) { if (pdf->minor_version < 0) { /* unset */ if ((pdf_minor_version < 0) || (pdf_minor_version > 9)) { - const char *hlp[] = - { "The pdfminorversion must be between 0 and 9.", - "I changed this to 4.", NULL - }; + const char *hlp[] = { "The pdfminorversion must be between 0 and 9.", "I changed this to 4.", NULL }; char msg[256]; - (void) snprintf(msg, 255, - "LuaTeX error (illegal pdfminorversion %d)", - (int) pdf_minor_version); + (void) snprintf(msg, 255, "LuaTeX error (illegal pdfminorversion %d)", (int) pdf_minor_version); tex_error(msg, hlp); pdf_minor_version = 4; } @@ -283,11 +277,9 @@ void fix_pdf_minorversion(PDF pdf) } else { /* Check that variables for \.{PDF} output are unchanged */ if (pdf->minor_version != pdf_minor_version) - pdf_error("setup", - "\\pdfminorversion cannot be changed after data is written to the PDF file"); + pdf_error("setup", "\\pdfminorversion cannot be changed after data is written to the PDF file"); if (pdf->draftmode != pdf_draftmode) - pdf_error("setup", - "\\pdfdraftmode cannot be changed after data is written to the PDF file"); + pdf_error("setup", "\\pdfdraftmode cannot be changed after data is written to the PDF file"); } if (pdf->draftmode != 0) { pdf->compress_level = 0; /* re-fix it, might have been changed inbetween */ @@ -300,7 +292,7 @@ void fix_pdf_minorversion(PDF pdf) #define check_err(f, fn) \ if (f != Z_OK) \ - pdftex_fail("zlib: %s() failed (error code %d)", fn, f) + luatex_fail("zlib: %s() failed (error code %d)", fn, f) @ @c static void write_zip(PDF pdf) @@ -311,7 +303,7 @@ static void write_zip(PDF pdf) z_stream *s = pdf->c_stream; boolean finish = pdf->zip_write_state == ZIP_FINISH; assert(pdf->compress_level > 0); - /* This was just to suppress the filename report in |pdftex_fail| + /* This was just to suppress the filename report in |luatex_fail| but zlib errors are rare enough (especially now that the compress level is fixed) that I don't care about the slightly ugly error message that could result. @@ -361,7 +353,7 @@ static void write_zip(PDF pdf) } err = deflate(s, flush); if (err != Z_OK && err != Z_STREAM_END) - pdftex_fail("zlib: deflate() failed (error code %d)", err); + luatex_fail("zlib: deflate() failed (error code %d)", err); } pdf->stream_length = (off_t) s->total_out; } @@ -418,8 +410,7 @@ void pdf_flush(PDF pdf) pdf->zip_write_state = NO_ZIP; strbuf_seek(pdf->buf, 0); if (saved_pdf_gone > pdf->gone) - pdf_error("file size", - "File size exceeds architectural limits (pdf_gone wraps around)"); + pdf_error("file size", "File size exceeds architectural limits (pdf_gone wraps around)"); break; case LUASTM_BUF: luaL_addsize(&(os->b), strbuf_offset(pdf->buf)); @@ -852,7 +843,7 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k) re->resources_tree = avl_create(comp_page_resources, NULL, &avl_xallocator); if (re->resources_tree == NULL) - pdftex_fail + luatex_fail ("addto_page_resources(): avl_create() page_resource_tree failed"); } tmp.obj_type = t; @@ -863,7 +854,7 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k) pr->list = NULL; pp = avl_probe(re->resources_tree, pr); if (pp == NULL) - pdftex_fail + luatex_fail ("addto_page_resources(): avl_probe() out of memory in insertion"); } if (pr->list == NULL) { @@ -1420,8 +1411,7 @@ char *convertStringToPDFString(const char *in, int len) check_buf((unsigned) j + sizeof(buf), MAX_PSTRING_LEN); if (((unsigned char) in[i] < '!') || ((unsigned char) in[i] > '~')) { /* convert control characters into oct */ - k = snprintf(buf, sizeof(buf), - "\\%03o", (unsigned int) (unsigned char) in[i]); + k = snprintf(buf, sizeof(buf), "\\%03o", (unsigned int) (unsigned char) in[i]); check_nprintf(k, sizeof(buf)); out[j++] = buf[0]; out[j++] = buf[1]; @@ -1455,8 +1445,7 @@ static void convertStringToHexString(const char *in, char *out, int lin) char buf[3]; j = 0; for (i = 0; i < lin; i++) { - k = snprintf(buf, sizeof(buf), - "%02X", (unsigned int) (unsigned char) in[i]); + k = snprintf(buf, sizeof(buf), "%02X", (unsigned int) (unsigned char) in[i]); check_nprintf(k, sizeof(buf)); out[j++] = buf[0]; out[j++] = buf[1]; @@ -1515,7 +1504,7 @@ static void print_ID(PDF pdf) md5_append(&state, (const md5_byte_t *) time_str, (int) size); /* get the file name */ if (getcwd(pwd, sizeof(pwd)) == NULL) - pdftex_fail("getcwd() failed (%s), (path too long?)", strerror(errno)); + luatex_fail("getcwd() failed (%s), (path too long?)", strerror(errno)); #ifdef WIN32 { char *p; @@ -1917,7 +1906,7 @@ void print_pdf_table_string(PDF pdf, const char *s) void pdf_end_page(PDF pdf) { char s[64], *p; - int j, annots = 0, beads = 0; + int j, annots = 0, beads = 0, callback_id; pdf_resource_struct *res_p = pdf->page_resources; pdf_resource_struct local_page_resources; pdf_object_list *annot_list, *bead_list, *link_list, *ol, *ol1; @@ -1928,7 +1917,7 @@ void pdf_end_page(PDF pdf) /* Finish stream of page/form contents */ pdf_goto_pagemode(pdf); if (pos_stack_used > 0) { - pdftex_fail("%u unmatched \\pdfsave after %s shipout", + luatex_fail("%u unmatched \\pdfsave after %s shipout", (unsigned int) pos_stack_used, ((global_shipping_mode == SHIPPING_PAGE) ? "page" : "form")); @@ -1936,7 +1925,13 @@ void pdf_end_page(PDF pdf) pdf_end_stream(pdf); pdf_end_obj(pdf); + /* hh-ls : new call back finish_pdfpage_callback */ + callback_id = callback_defined(finish_pdfpage_callback); + if (callback_id > 0) + run_callback(callback_id, "b->",(global_shipping_mode == SHIPPING_PAGE)); + if (global_shipping_mode == SHIPPING_PAGE) { + pdf->last_pages = pdf_do_page_divert(pdf, pdf->last_page, 0); /* Write out /Page object */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w index dab5bc741ae..a32d20490fd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfluaapi.w 4524 2012-12-20 15:38:02Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; + "$Id: pdfluaapi.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; #include "ptexlib.h" @@ -32,14 +32,14 @@ int new_pdflua(void) const zlib_struct *zp = pdflua_zlib_struct_ptr; uLong uncomprLen = zp->uncomprLen; if ((uncompr = xtalloc(zp->uncomprLen, Byte)) == NULL) - pdftex_fail("new_pdflua(): xtalloc()"); + luatex_fail("new_pdflua(): xtalloc()"); err = uncompress(uncompr, &uncomprLen, zp->compr, zp->comprLen); if (err != Z_OK) - pdftex_fail("new_pdflua(): uncompress()"); + luatex_fail("new_pdflua(): uncompress()"); assert(uncomprLen == zp->uncomprLen); if (luaL_loadbuffer(Luas, (const char *) uncompr, uncomprLen, "pdflua") || lua_pcall(Luas, 0, 1, 0)) - pdftex_fail("new_pdflua(): lua_pcall()"); + luatex_fail("new_pdflua(): lua_pcall()"); luaL_checktype(Luas, -1, LUA_TTABLE); /* t */ i = luaL_ref(Luas, LUA_REGISTRYINDEX); /* - */ xfree(uncompr); @@ -64,7 +64,7 @@ void pdflua_begin_page(PDF pdf) lua_setfield(Luas, -2, "resources_objnum"); /* t f t ... */ err = lua_pcall(Luas, 1, 0, 0); /* (e) t ... */ if (err != 0) - pdftex_fail("pdflua.lua: beginpage()"); + luatex_fail("pdflua.lua: beginpage()"); /* t ... */ lua_pop(Luas, 1); /* ... */ } @@ -97,7 +97,7 @@ void pdflua_end_page(PDF pdf, int annots, int beads) } err = lua_pcall(Luas, 1, 0, 0); /* (e) t ... */ if (err != 0) - pdftex_fail("pdflua.lua: endpage()"); + luatex_fail("pdflua.lua: endpage()"); /* t ... */ lua_pop(Luas, 1); /* ... */ } @@ -111,5 +111,5 @@ void pdflua_output_pages_tree(PDF pdf) lua_gettable(Luas, -2); /* f */ err = lua_pcall(Luas, 0, 0, 0); /* - */ if (err != 0) - pdftex_fail("pdflua.lua: outputpagestree()"); + luatex_fail("pdflua.lua: outputpagestree()"); } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w index f2d0647c00c..af7bc1d584f 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w @@ -19,15 +19,15 @@ @ @c static const char _svn_version[] = - "$Id: pdfobj.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; + "$Id: pdfobj.w 4877 2014-03-14 01:26:05Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" int pdf_last_obj; -@ write a raw PDF object +@ write a raw PDF object @c void pdf_write_obj(PDF pdf, int k) @@ -79,8 +79,7 @@ void pdf_write_obj(PDF pdf, int k) callback_id = callback_defined(read_data_file_callback); if (fnam && callback_id > 0) { boolean file_opened = false; - res = run_callback(callback_id, "S->bSd", fnam, - &file_opened, &data.s, &ll); + res = run_callback(callback_id, "S->bSd", fnam, &file_opened, &data.s, &ll); data.l = (size_t) ll; if (!file_opened) pdf_error("ext5", "cannot open file for embedding"); @@ -88,8 +87,7 @@ void pdf_write_obj(PDF pdf, int k) byte_file f; /* the data file's FILE* */ if (!fnam) fnam = st.s; - if (!luatex_open_input - (&f, fnam, kpse_tex_format, FOPEN_RBIN_MODE, true)) + if (!luatex_open_input(&f, fnam, kpse_tex_format, FOPEN_RBIN_MODE, true)) pdf_error("ext5", "cannot open file for embedding"); res = read_data_file(f, &data.s, &ll); data.l = (size_t) ll; @@ -102,19 +100,23 @@ void pdf_write_obj(PDF pdf, int k) tprint("<<"); tprint(st.s); pdf_out_block(pdf, (const char *) data.s, data.l); - if (!obj_obj_is_stream(pdf, k) && data.s[data.l - 1] != '\n') - pdf_out(pdf, '\n'); + /* already happens in pdf_end_obj: + if (!obj_obj_is_stream(pdf, k) && data.s[data.l - 1] != '\n') + pdf_out(pdf, '\n'); + */ xfree(data.s); tprint(">>"); } else { pdf_out_block(pdf, st.s, st.l); - if (!obj_obj_is_stream(pdf, k) && st.s[st.l - 1] != '\n') - pdf_out(pdf, '\n'); + /* already happens in pdf_end_obj: + if (!obj_obj_is_stream(pdf, k) && st.s[st.l - 1] != '\n') + pdf_out(pdf, '\n'); + */ } if (obj_obj_is_stream(pdf, k)) { pdf_end_stream(pdf); pdf_end_obj(pdf); - } else + } else /* here we do the \n */ pdf_end_obj(pdf); luaL_unref(Luas, LUA_REGISTRYINDEX, l); obj_obj_data(pdf, k) = LUA_NOREF; @@ -137,7 +139,7 @@ void init_obj_obj(PDF pdf, int k) out only when the object is referenced by \.{\\pdfrefobj}. When \.{\\pdfobj} is used with \.{\\immediate}, the object contents will be written out immediately. Objects referenced in the current page are appended into - |pdf_obj_list|. + |pdf_obj_list|. @c void scan_obj(PDF pdf) diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w index 1b6859566a3..92a642adeb0 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfsaverestore.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; + "$Id: pdfsaverestore.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; #include "ptexlib.h" @@ -55,14 +55,14 @@ static void checkpdfrestore(scaledpos pos) { scaledpos diff; if (pos_stack_used == 0) { - pdftex_warn("%s", "\\pdfrestore: missing \\pdfsave"); + luatex_warn("%s", "\\pdfrestore: missing \\pdfsave"); return; } pos_stack_used--; diff.h = pos.h - pos_stack[pos_stack_used].pos.h; diff.v = pos.v - pos_stack[pos_stack_used].pos.v; if (diff.h != 0 || diff.v != 0) { - pdftex_warn("Misplaced \\pdfrestore by (%dsp, %dsp)", (int) diff.h, + luatex_warn("Misplaced \\pdfrestore by (%dsp, %dsp)", (int) diff.h, (int) diff.v); } if (global_shipping_mode == SHIPPING_PAGE) { diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w index 34f3ead258c..d90dbf91a87 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfsetmatrix.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; + "$Id: pdfsetmatrix.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; #include "ptexlib.h" @@ -94,7 +94,7 @@ static void pdfsetmatrix(const char *in, scaledpos pos) if (global_shipping_mode == SHIPPING_PAGE) { if (sscanf((const char *) in, " %lf %lf %lf %lf ", &x.a, &x.b, &x.c, &x.d) != 4) { - pdftex_warn("Unrecognized format of \\pdfsetmatrix{%s}", in); + luatex_warn("Unrecognized format of \\pdfsetmatrix{%s}", in); return; } /* calculate this transformation matrix */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w index ba8495137a2..48330c72e4c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdftables.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdftables.w $"; + "$Id: pdftables.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdftables.w $"; #include "ptexlib.h" @@ -58,11 +58,11 @@ static void avl_put_obj(PDF pdf, int t, oentry * oe) if (pdf->obj_tree[t] == NULL) { pdf->obj_tree[t] = avl_create(compare_info, NULL, &avl_xallocator); if (pdf->obj_tree[t] == NULL) - pdftex_fail("avlstuff.c: avl_create() pdf->obj_tree failed"); + luatex_fail("avlstuff.c: avl_create() pdf->obj_tree failed"); } pp = avl_probe(pdf->obj_tree[t], oe); if (pp == NULL) - pdftex_fail("avlstuff.c: avl_probe() out of memory in insertion"); + luatex_fail("avlstuff.c: avl_probe() out of memory in insertion"); } static void avl_put_int_obj(PDF pdf, int int0, int objptr, int t) |