summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-04-12 14:17:47 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-04-12 14:17:47 +0000
commit307453997ef030ec4dfa1e876feaf0b8b8125bab (patch)
treeab2054693ba95e9ac8f6e3478b4d0175d893329f /Build/source/texk
parentd95b11a25d3d9e17cc4afb9c8713ef4037567527 (diff)
check in luatex 0.66.0
git-svn-id: svn://tug.org/texlive/trunk@22059 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/Makefile.in2
-rw-r--r--Build/source/texk/aclocal.m41
-rwxr-xr-xBuild/source/texk/afm2pl/configure9
-rwxr-xr-xBuild/source/texk/bibtex8/configure9
-rwxr-xr-xBuild/source/texk/bibtexu/configure11
-rwxr-xr-xBuild/source/texk/cjkutils/configure9
-rwxr-xr-xBuild/source/texk/configure30
-rwxr-xr-xBuild/source/texk/detex/configure9
-rwxr-xr-xBuild/source/texk/devnag/configure9
-rwxr-xr-xBuild/source/texk/dtl/configure9
-rwxr-xr-xBuild/source/texk/dvi2tty/configure9
-rwxr-xr-xBuild/source/texk/dvidvi/configure9
-rwxr-xr-xBuild/source/texk/dviljk/configure9
-rwxr-xr-xBuild/source/texk/dvipdfmx/configure6
-rwxr-xr-xBuild/source/texk/dvipng/configure9
-rwxr-xr-xBuild/source/texk/dvipos/configure9
-rwxr-xr-xBuild/source/texk/dvipsk/configure9
-rwxr-xr-xBuild/source/texk/dvipsk/squeeze/configure4
-rwxr-xr-xBuild/source/texk/dvisvgm/configure11
-rwxr-xr-xBuild/source/texk/gsftopk/configure9
-rwxr-xr-xBuild/source/texk/kpathsea/configure9
-rwxr-xr-xBuild/source/texk/lacheck/configure9
-rwxr-xr-xBuild/source/texk/lcdf-typetools/configure13
-rwxr-xr-xBuild/source/texk/makeindexk/configure9
-rwxr-xr-xBuild/source/texk/makejvf/configure9
-rwxr-xr-xBuild/source/texk/mendexk/configure9
-rwxr-xr-xBuild/source/texk/musixflx/configure6
-rwxr-xr-xBuild/source/texk/ps2pkm/configure9
-rwxr-xr-xBuild/source/texk/ptexenc/configure9
-rwxr-xr-xBuild/source/texk/seetexk/configure9
-rwxr-xr-xBuild/source/texk/tetex/configure4
-rwxr-xr-xBuild/source/texk/tex4htk/configure9
-rwxr-xr-xBuild/source/texk/texlive/configure4
-rwxr-xr-xBuild/source/texk/ttf2pk/configure9
-rwxr-xr-xBuild/source/texk/ttfdump/configure9
-rw-r--r--Build/source/texk/web2c/Makefile.am3
-rw-r--r--Build/source/texk/web2c/Makefile.in354
-rw-r--r--Build/source/texk/web2c/ac/web2c.ac2
-rw-r--r--Build/source/texk/web2c/aclocal.m4108
-rwxr-xr-xBuild/source/texk/web2c/configure195
-rw-r--r--Build/source/texk/web2c/configure.ac18
-rw-r--r--Build/source/texk/web2c/doc/Makefile.in5
-rw-r--r--Build/source/texk/web2c/lib/Makefile.in5
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/luatexdir/NEWS350
-rw-r--r--Build/source/texk/web2c/luatexdir/am/liblua51.am2
-rw-r--r--Build/source/texk/web2c/luatexdir/am/libluatex.am55
-rw-r--r--Build/source/texk/web2c/luatexdir/am/luafontforge.am3
-rw-r--r--Build/source/texk/web2c/luatexdir/am/luamisc.am2
-rw-r--r--Build/source/texk/web2c/luatexdir/am/luasocket.am2
-rw-r--r--Build/source/texk/web2c/luatexdir/am/luatex.am6
-rw-r--r--Build/source/texk/web2c/luatexdir/am/txt2zlib.am19
-rw-r--r--Build/source/texk/web2c/luatexdir/dvi/dvigen.w7
-rw-r--r--Build/source/texk/web2c/luatexdir/font/dofont.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luafont.w93
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luatexfont.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/font/mapfile.w10
-rw-r--r--Build/source/texk/web2c/luatexdir/font/pkin.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/sfnt.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/sfnt.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/font/subfont.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.h12
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.w14
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tfmofm.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tounicode.w14
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_glyf.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_table.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfovf.w135
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfpacket.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.w51
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writeenc.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writefont.w18
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet1.w57
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet3.w7
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writettf.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype0.w10
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype2.w45
-rw-r--r--Build/source/texk/web2c/luatexdir/image/epdf.h47
-rw-r--r--Build/source/texk/web2c/luatexdir/image/image.h14
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc328
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writeimg.w30
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writejbig2.h5
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writejbig2.w27
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writejp2.h31
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writejp2.w282
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writejpg.w42
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writepng.w61
-rw-r--r--Build/source/texk/web2c/luatexdir/lang/hyphen.w12
-rw-r--r--Build/source/texk/web2c/luatexdir/lang/texlang.w119
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c11
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lepdflib.cc2684
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lfontlib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/limglib.c14
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/liolib.c25
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lkpselib.c8
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llanglib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llfslibext.c173
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llualib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c299
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/loslibext.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdflib.c162
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstatslib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexiolib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c368
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltokenlib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luagen.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luanode.w108
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luastuff.w39
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h15
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatoken.w13
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/texluac.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua51/lauxlib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua51/luaconf.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/Makefile4
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/README60
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/index.html27
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/manual.html22
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c334
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.def2
-rw-r--r--Build/source/texk/web2c/luatexdir/luafilesystem/tests/test.lua17
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c8
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c10
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c1164
-rw-r--r--Build/source/texk/web2c/luatexdir/luapeg/lpeg.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/luascripts/pdflua.h34
-rw-r--r--Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua25
-rw-r--r--Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w145
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c147
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex_svnversion.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pagetree.w10
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfaction.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfaction.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfannot.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.h5
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfdest.w15
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdffont.w25
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.h49
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.w688
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w17
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfimage.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflink.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflistout.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w28
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h30
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w115
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfobj.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfobj.w44
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w25
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfpage.w9
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfrule.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w10
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfshipout.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w41
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftables.h33
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftables.w89
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfthread.h3
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfthread.w29
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftypes.h32
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfxform.w11
-rw-r--r--Build/source/texk/web2c/luatexdir/ptexlib.h25
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/align.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/arithmetic.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/arithmetic.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/buildpage.w42
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.h17
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.w30
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/conditional.w6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/directions.h30
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/directions.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.h8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h21
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.w6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/expand.w6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/filename.w6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.h8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.w15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/linebreak.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/linebreak.w27
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.h18
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.w14
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.h3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.w1460
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mathcodes.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/memoryword.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.w91
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/nesting.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/packaging.h12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/packaging.w12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/postlinebreak.w32
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/primitive.w18
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w24
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.w5
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/stringpool.h3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/stringpool.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texdeffont.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.w247
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.w90
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h18
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.w65
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textcodes.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.w72
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/avlstuff.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/managed-sa.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h13
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/synctex.c52
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/utils.w21
-rw-r--r--Build/source/texk/web2c/man/ChangeLog4
-rw-r--r--Build/source/texk/web2c/man/Makefile.in5
-rw-r--r--Build/source/texk/web2c/man/luatex.man2
-rw-r--r--Build/source/texk/web2c/omegafonts/Makefile.in5
-rw-r--r--Build/source/texk/web2c/otps/Makefile.in5
-rw-r--r--Build/source/texk/web2c/window/Makefile.in5
-rwxr-xr-xBuild/source/texk/xdv2pdf/configure16
-rwxr-xr-xBuild/source/texk/xdvik/configure7
-rwxr-xr-xBuild/source/texk/xdvik/squeeze/configure4
-rwxr-xr-xBuild/source/texk/xdvipdfmx/configure9
227 files changed, 9289 insertions, 3752 deletions
diff --git a/Build/source/texk/Makefile.in b/Build/source/texk/Makefile.in
index ca84e1c7717..f2e905132c2 100644
--- a/Build/source/texk/Makefile.in
+++ b/Build/source/texk/Makefile.in
@@ -57,6 +57,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../m4/kpse-common.m4 \
$(top_srcdir)/../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../m4/kpse-options.m4 \
$(top_srcdir)/../m4/kpse-pkgs.m4 \
+ $(top_srcdir)/../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../m4/kpse-setup.m4 \
$(top_srcdir)/../m4/kpse-t1lib-flags.m4 \
@@ -122,6 +123,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../m4/kpse-common.m4 \
$(top_srcdir)/../libs/graphite/ac/withenable.ac \
$(top_srcdir)/../libs/zziplib/ac/withenable.ac \
$(top_srcdir)/../libs/xpdf/ac/withenable.ac \
+ $(top_srcdir)/../libs/poppler/ac/withenable.ac \
$(top_srcdir)/../libs/gd/ac/withenable.ac \
$(top_srcdir)/../libs/freetype2/ac/withenable.ac \
$(top_srcdir)/../libs/freetype/ac/withenable.ac \
diff --git a/Build/source/texk/aclocal.m4 b/Build/source/texk/aclocal.m4
index 9eb7b6d1a8d..86d2a2ce443 100644
--- a/Build/source/texk/aclocal.m4
+++ b/Build/source/texk/aclocal.m4
@@ -1001,6 +1001,7 @@ m4_include([../m4/kpse-libpng-flags.m4])
m4_include([../m4/kpse-lt-hack.m4])
m4_include([../m4/kpse-options.m4])
m4_include([../m4/kpse-pkgs.m4])
+m4_include([../m4/kpse-poppler-flags.m4])
m4_include([../m4/kpse-ptexenc-flags.m4])
m4_include([../m4/kpse-setup.m4])
m4_include([../m4/kpse-t1lib-flags.m4])
diff --git a/Build/source/texk/afm2pl/configure b/Build/source/texk/afm2pl/configure
index 663714ce27a..62915400fa3 100755
--- a/Build/source/texk/afm2pl/configure
+++ b/Build/source/texk/afm2pl/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14628,9 +14627,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/bibtex8/configure b/Build/source/texk/bibtex8/configure
index a62cc898b86..171ab418d82 100755
--- a/Build/source/texk/bibtex8/configure
+++ b/Build/source/texk/bibtex8/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14542,9 +14541,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/bibtexu/configure b/Build/source/texk/bibtexu/configure
index f669f3b5cef..9fe363326a1 100755
--- a/Build/source/texk/bibtexu/configure
+++ b/Build/source/texk/bibtexu/configure
@@ -760,7 +760,6 @@ with_sysroot
enable_libtool_lock
enable_largefile
enable_compiler_warnings
-with_gnu_ld
enable_cxx_runtime_hack
with_system_kpathsea
with_kpathsea_includes
@@ -776,12 +775,8 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CPPFLAGS
CXX
CXXFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
CCC
CXXCPP'
@@ -18967,9 +18962,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/cjkutils/configure b/Build/source/texk/cjkutils/configure
index 2e9f68243dc..d6f76480eab 100755
--- a/Build/source/texk/cjkutils/configure
+++ b/Build/source/texk/cjkutils/configure
@@ -768,8 +768,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14868,9 +14867,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/configure b/Build/source/texk/configure
index 6940f5d27ac..a8cf420e523 100755
--- a/Build/source/texk/configure
+++ b/Build/source/texk/configure
@@ -771,6 +771,7 @@ with_graphite
with_system_graphite
with_system_zziplib
with_system_xpdf
+with_system_poppler
with_system_gd
with_gd_includes
with_gd_libdir
@@ -1610,6 +1611,8 @@ Optional Packages:
pkg-config)
--with-system-xpdf use installed poppler headers and library instead of
xpdf (requires pkg-config)
+ --with-system-poppler use installed poppler headers and library instead of
+ poppler (requires pkg-config)
--with-system-gd use installed gd headers and library
--with-gd-includes=DIR gd headers installed in DIR
--with-gd-libdir=DIR gd library installed in DIR
@@ -3569,7 +3572,7 @@ case $enable_luatex in #(
esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
- need_xpdf=yes
+ need_poppler=yes
need_libpng=yes
need_obsdcompat=yes
need_zziplib=yes
@@ -4659,6 +4662,27 @@ $as_echo "$as_me: Assuming installed \`xpdf' headers and library" >&6;}
fi
+## libs/poppler/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/poppler/
+## configure options and TL libraries required for poppler
+
+# Check whether --with-system-poppler was given.
+if test "${with_system_poppler+set}" = set; then :
+ withval=$with_system_poppler;
+fi
+if test "x$with_system_poppler" = x; then
+ if test -f $srcdir/../libs/poppler/configure; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming \`poppler' headers and library from TL tree" >&5
+$as_echo "$as_me: Assuming \`poppler' headers and library from TL tree" >&6;}
+ with_system_poppler=no
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming installed \`poppler' headers and library" >&5
+$as_echo "$as_me: Assuming installed \`poppler' headers and library" >&6;}
+ with_system_poppler=yes
+ fi
+ ac_configure_args="$ac_configure_args '--with-system-poppler=$with_system_poppler'"
+fi
+
+
## libs/gd/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/gd/
## configure options and TL libraries required for gd
@@ -6668,8 +6692,8 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/detex/configure b/Build/source/texk/detex/configure
index 022bb190729..2acb6cbdf3d 100755
--- a/Build/source/texk/detex/configure
+++ b/Build/source/texk/detex/configure
@@ -762,8 +762,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14752,9 +14751,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/devnag/configure b/Build/source/texk/devnag/configure
index fd861e69d92..2806fc14fb3 100755
--- a/Build/source/texk/devnag/configure
+++ b/Build/source/texk/devnag/configure
@@ -669,8 +669,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -4515,9 +4514,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dtl/configure b/Build/source/texk/dtl/configure
index 5a3989313e4..aad50ab7ad4 100755
--- a/Build/source/texk/dtl/configure
+++ b/Build/source/texk/dtl/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14762,9 +14761,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvi2tty/configure b/Build/source/texk/dvi2tty/configure
index 161d2a490ef..54f4d099ba7 100755
--- a/Build/source/texk/dvi2tty/configure
+++ b/Build/source/texk/dvi2tty/configure
@@ -759,8 +759,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14555,9 +14554,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvidvi/configure b/Build/source/texk/dvidvi/configure
index 818dea113db..5296c4c47a6 100755
--- a/Build/source/texk/dvidvi/configure
+++ b/Build/source/texk/dvidvi/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14518,9 +14517,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dviljk/configure b/Build/source/texk/dviljk/configure
index 7d360e40338..5760d04065c 100755
--- a/Build/source/texk/dviljk/configure
+++ b/Build/source/texk/dviljk/configure
@@ -760,8 +760,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14859,9 +14858,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvipdfmx/configure b/Build/source/texk/dvipdfmx/configure
index ada68009638..a8b21053d82 100755
--- a/Build/source/texk/dvipdfmx/configure
+++ b/Build/source/texk/dvipdfmx/configure
@@ -15884,9 +15884,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvipng/configure b/Build/source/texk/dvipng/configure
index 0382766c876..f8f0be1d0ab 100755
--- a/Build/source/texk/dvipng/configure
+++ b/Build/source/texk/dvipng/configure
@@ -813,8 +813,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -17089,9 +17088,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvipos/configure b/Build/source/texk/dvipos/configure
index d17e9007cc0..08960049fd4 100755
--- a/Build/source/texk/dvipos/configure
+++ b/Build/source/texk/dvipos/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14608,9 +14607,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvipsk/configure b/Build/source/texk/dvipsk/configure
index 6ea87da11ac..08a9ca8689c 100755
--- a/Build/source/texk/dvipsk/configure
+++ b/Build/source/texk/dvipsk/configure
@@ -760,8 +760,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
ac_subdirs_all='squeeze'
# Initialize some variables set by options.
@@ -14833,9 +14832,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvipsk/squeeze/configure b/Build/source/texk/dvipsk/squeeze/configure
index 0d2597f81d1..329d08ff8b6 100755
--- a/Build/source/texk/dvipsk/squeeze/configure
+++ b/Build/source/texk/dvipsk/squeeze/configure
@@ -3948,8 +3948,8 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure
index 47ef57a594c..d9f6dc4f2ba 100755
--- a/Build/source/texk/dvisvgm/configure
+++ b/Build/source/texk/dvisvgm/configure
@@ -772,7 +772,6 @@ enable_compiler_warnings
with_system_libgs
with_libgs_includes
with_libgs_libdir
-with_gnu_ld
enable_cxx_runtime_hack
with_system_kpathsea
with_kpathsea_includes
@@ -791,12 +790,8 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CPPFLAGS
CXX
CXXFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
CCC
CXXCPP'
@@ -19498,9 +19493,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/gsftopk/configure b/Build/source/texk/gsftopk/configure
index 234502cbe93..008aa9ff78e 100755
--- a/Build/source/texk/gsftopk/configure
+++ b/Build/source/texk/gsftopk/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14947,9 +14946,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/kpathsea/configure b/Build/source/texk/kpathsea/configure
index 32f77eab1fd..b2c264e2728 100755
--- a/Build/source/texk/kpathsea/configure
+++ b/Build/source/texk/kpathsea/configure
@@ -765,8 +765,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -13463,9 +13462,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/lacheck/configure b/Build/source/texk/lacheck/configure
index b5c8546f6f1..6acc07b287e 100755
--- a/Build/source/texk/lacheck/configure
+++ b/Build/source/texk/lacheck/configure
@@ -755,8 +755,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -13227,9 +13226,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/lcdf-typetools/configure b/Build/source/texk/lcdf-typetools/configure
index 5410039e0f6..94451b19f37 100755
--- a/Build/source/texk/lcdf-typetools/configure
+++ b/Build/source/texk/lcdf-typetools/configure
@@ -764,7 +764,6 @@ with_sysroot
enable_libtool_lock
enable_largefile
enable_compiler_warnings
-with_gnu_ld
enable_cxx_runtime_hack
enable_cfftot1
enable_mmafm
@@ -777,8 +776,6 @@ enable_t1rawafm
enable_t1reencode
enable_t1testpage
enable_ttftotype42
-enable_cfftot1
-enable_ttftotype42
enable_updmap
with_kpathsea
with_system_kpathsea
@@ -795,12 +792,8 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CPPFLAGS
CXX
CXXFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
CCC
CXXCPP'
@@ -20438,9 +20431,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/makeindexk/configure b/Build/source/texk/makeindexk/configure
index 19f94d71021..a6c709e96c6 100755
--- a/Build/source/texk/makeindexk/configure
+++ b/Build/source/texk/makeindexk/configure
@@ -760,8 +760,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14634,9 +14633,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/makejvf/configure b/Build/source/texk/makejvf/configure
index 5d3181151bf..66207ea352e 100755
--- a/Build/source/texk/makejvf/configure
+++ b/Build/source/texk/makejvf/configure
@@ -762,8 +762,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14610,9 +14609,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/mendexk/configure b/Build/source/texk/mendexk/configure
index 7df6c35c9f6..26933fda4a9 100755
--- a/Build/source/texk/mendexk/configure
+++ b/Build/source/texk/mendexk/configure
@@ -762,8 +762,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14610,9 +14609,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/musixflx/configure b/Build/source/texk/musixflx/configure
index 2028a0ec768..9b158fe1771 100755
--- a/Build/source/texk/musixflx/configure
+++ b/Build/source/texk/musixflx/configure
@@ -3922,9 +3922,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/ps2pkm/configure b/Build/source/texk/ps2pkm/configure
index a8ced9b6342..bd4bb4f79fc 100755
--- a/Build/source/texk/ps2pkm/configure
+++ b/Build/source/texk/ps2pkm/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14755,9 +14754,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/ptexenc/configure b/Build/source/texk/ptexenc/configure
index 0033bb81d77..e2bca918db1 100755
--- a/Build/source/texk/ptexenc/configure
+++ b/Build/source/texk/ptexenc/configure
@@ -762,8 +762,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14735,9 +14734,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/seetexk/configure b/Build/source/texk/seetexk/configure
index 7c9d4d5c486..11124bac098 100755
--- a/Build/source/texk/seetexk/configure
+++ b/Build/source/texk/seetexk/configure
@@ -758,8 +758,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14787,9 +14786,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/tetex/configure b/Build/source/texk/tetex/configure
index e1ad58e1f7e..2401df12e42 100755
--- a/Build/source/texk/tetex/configure
+++ b/Build/source/texk/tetex/configure
@@ -3997,8 +3997,8 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/tex4htk/configure b/Build/source/texk/tex4htk/configure
index 1d132067373..393267a9a3b 100755
--- a/Build/source/texk/tex4htk/configure
+++ b/Build/source/texk/tex4htk/configure
@@ -762,8 +762,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14838,9 +14837,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/texlive/configure b/Build/source/texk/texlive/configure
index f7854642805..0380c893a0f 100755
--- a/Build/source/texk/texlive/configure
+++ b/Build/source/texk/texlive/configure
@@ -3982,8 +3982,8 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/ttf2pk/configure b/Build/source/texk/ttf2pk/configure
index d3666685613..011fea10fa3 100755
--- a/Build/source/texk/ttf2pk/configure
+++ b/Build/source/texk/ttf2pk/configure
@@ -765,8 +765,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14680,9 +14679,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/ttfdump/configure b/Build/source/texk/ttfdump/configure
index c94c1776122..d7ff0756565 100755
--- a/Build/source/texk/ttfdump/configure
+++ b/Build/source/texk/ttfdump/configure
@@ -751,8 +751,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -13564,9 +13563,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/web2c/Makefile.am b/Build/source/texk/web2c/Makefile.am
index 7e112ade39c..af2a2844f8a 100644
--- a/Build/source/texk/web2c/Makefile.am
+++ b/Build/source/texk/web2c/Makefile.am
@@ -89,6 +89,8 @@ $(proglib): ${srcdir}/lib/*.c
@LIBPNG_RULE@
## Rebuild libxpdf & Co
@XPDF_RULE@
+## Rebuild poppler
+@POPPLER_RULE@
## Rebuild libopenbsd-compat
@OBSDCOMPAT_RULE@
## Rebuild libzzip
@@ -184,6 +186,7 @@ include $(srcdir)/luatexdir/am/luasocket.am
include $(srcdir)/luatexdir/am/luamisc.am
include $(srcdir)/luatexdir/am/luafontforge.am
include $(srcdir)/luatexdir/am/libluatex.am
+include $(srcdir)/luatexdir/am/txt2zlib.am
## XeTeX
include $(srcdir)/xetexdir/am/xetex.am
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 06354f80f72..f495db44a18 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -48,7 +48,7 @@ bin_PROGRAMS = tangle$(EXEEXT) ctangle$(EXEEXT) $(am__EXEEXT_6) \
$(am__EXEEXT_20) $(am__EXEEXT_21) $(am__EXEEXT_22) \
$(am__EXEEXT_23) synctex$(EXEEXT)
noinst_PROGRAMS = tangleboot$(EXEEXT) ctangleboot$(EXEEXT) \
- $(am__EXEEXT_31)
+ $(am__EXEEXT_31) txt2zlib$(EXEEXT)
check_PROGRAMS = $(am__EXEEXT_24) $(am__EXEEXT_25) $(am__EXEEXT_26) \
$(am__EXEEXT_27) $(am__EXEEXT_28) $(am__EXEEXT_29) \
$(am__EXEEXT_30) md5main$(EXEEXT)
@@ -76,6 +76,7 @@ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
$(srcdir)/luatexdir/am/luamisc.am \
$(srcdir)/luatexdir/am/luasocket.am \
$(srcdir)/luatexdir/am/luatex.am \
+ $(srcdir)/luatexdir/am/txt2zlib.am \
$(srcdir)/mplibdir/am/libmplib.am \
$(srcdir)/mplibdir/am/mplib.am \
$(srcdir)/omegaware/am/omegaware.am \
@@ -245,6 +246,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -356,6 +358,7 @@ am_libluatex_a_OBJECTS = libluatex_a-pdftoepdf.$(OBJEXT) \
libluatex_a-lfontlib.$(OBJEXT) libluatex_a-limglib.$(OBJEXT) \
libluatex_a-lepdflib.$(OBJEXT) libluatex_a-lkpselib.$(OBJEXT) \
libluatex_a-llanglib.$(OBJEXT) libluatex_a-llualib.$(OBJEXT) \
+ libluatex_a-llfslibext.$(OBJEXT) \
libluatex_a-lnodelib.$(OBJEXT) libluatex_a-loslibext.$(OBJEXT) \
libluatex_a-liolib.$(OBJEXT) libluatex_a-lpdflib.$(OBJEXT) \
libluatex_a-lstatslib.$(OBJEXT) \
@@ -374,15 +377,14 @@ nodist_libluatex_a_OBJECTS = libluatex_a-dvigen.$(OBJEXT) \
libluatex_a-writet1.$(OBJEXT) libluatex_a-writet3.$(OBJEXT) \
libluatex_a-writettf.$(OBJEXT) \
libluatex_a-writetype0.$(OBJEXT) \
- libluatex_a-writetype2.$(OBJEXT) libluatex_a-epdf.$(OBJEXT) \
+ libluatex_a-writetype2.$(OBJEXT) \
libluatex_a-writeimg.$(OBJEXT) \
libluatex_a-writejbig2.$(OBJEXT) \
- libluatex_a-writejpg.$(OBJEXT) libluatex_a-writepng.$(OBJEXT) \
- libluatex_a-luagen.$(OBJEXT) libluatex_a-luainit.$(OBJEXT) \
- libluatex_a-luanode.$(OBJEXT) libluatex_a-luastuff.$(OBJEXT) \
- libluatex_a-luatoken.$(OBJEXT) libluatex_a-texluac.$(OBJEXT) \
- libluatex_a-ocp.$(OBJEXT) libluatex_a-ocplist.$(OBJEXT) \
- libluatex_a-readocp.$(OBJEXT) libluatex_a-runocp.$(OBJEXT) \
+ libluatex_a-writejpg.$(OBJEXT) libluatex_a-writejp2.$(OBJEXT) \
+ libluatex_a-writepng.$(OBJEXT) libluatex_a-luagen.$(OBJEXT) \
+ libluatex_a-luainit.$(OBJEXT) libluatex_a-luanode.$(OBJEXT) \
+ libluatex_a-luastuff.$(OBJEXT) libluatex_a-luatoken.$(OBJEXT) \
+ libluatex_a-texluac.$(OBJEXT) libluatex_a-pdflua.$(OBJEXT) \
libluatex_a-texlang.$(OBJEXT) libluatex_a-hyphen.$(OBJEXT) \
libluatex_a-hnjalloc.$(OBJEXT) libluatex_a-pagetree.$(OBJEXT) \
libluatex_a-pdfaction.$(OBJEXT) libluatex_a-pdfannot.$(OBJEXT) \
@@ -391,7 +393,8 @@ nodist_libluatex_a_OBJECTS = libluatex_a-dvigen.$(OBJEXT) \
libluatex_a-pdfgen.$(OBJEXT) libluatex_a-pdfglyph.$(OBJEXT) \
libluatex_a-pdfimage.$(OBJEXT) libluatex_a-pdflink.$(OBJEXT) \
libluatex_a-pdflistout.$(OBJEXT) \
- libluatex_a-pdfliteral.$(OBJEXT) libluatex_a-pdfobj.$(OBJEXT) \
+ libluatex_a-pdfliteral.$(OBJEXT) \
+ libluatex_a-pdfluaapi.$(OBJEXT) libluatex_a-pdfobj.$(OBJEXT) \
libluatex_a-pdfoutline.$(OBJEXT) libluatex_a-pdfpage.$(OBJEXT) \
libluatex_a-pdfrule.$(OBJEXT) \
libluatex_a-pdfsaverestore.$(OBJEXT) \
@@ -805,6 +808,11 @@ tie_DEPENDENCIES = $(proglib) $(am__DEPENDENCIES_1)
am_ttf2afm_OBJECTS = ttf2afm-ttf2afm.$(OBJEXT)
ttf2afm_OBJECTS = $(am_ttf2afm_OBJECTS)
ttf2afm_LDADD = $(LDADD)
+nodist_txt2zlib_OBJECTS = txt2zlib-txt2zlib.$(OBJEXT)
+txt2zlib_OBJECTS = $(nodist_txt2zlib_OBJECTS)
+txt2zlib_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(txt2zlib_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
nodist_vftovp_OBJECTS = vftovp.$(OBJEXT)
vftovp_OBJECTS = $(nodist_vftovp_OBJECTS)
vftovp_LDADD = $(LDADD)
@@ -899,9 +907,10 @@ SOURCES = $(libff_a_SOURCES) $(libkanji_a_SOURCES) \
$(dist_tex_SOURCES) $(nodist_tex_SOURCES) \
$(nodist_tftopl_SOURCES) $(nodist_tie_SOURCES) \
$(ttf2afm_SOURCES) $(EXTRA_ttf2afm_SOURCES) \
- $(nodist_vftovp_SOURCES) $(nodist_vptovf_SOURCES) \
- $(nodist_weave_SOURCES) $(dist_xetex_SOURCES) \
- $(nodist_xetex_SOURCES) $(nodist_EXTRA_xetex_SOURCES)
+ $(nodist_txt2zlib_SOURCES) $(nodist_vftovp_SOURCES) \
+ $(nodist_vptovf_SOURCES) $(nodist_weave_SOURCES) \
+ $(dist_xetex_SOURCES) $(nodist_xetex_SOURCES) \
+ $(nodist_EXTRA_xetex_SOURCES)
DIST_SOURCES = $(libff_a_SOURCES) $(libkanji_a_SOURCES) \
$(liblua51_a_SOURCES) $(libluamisc_a_SOURCES) \
$(EXTRA_libluamisc_a_SOURCES) $(libluasocket_a_SOURCES) \
@@ -1098,6 +1107,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -1112,6 +1124,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
@@ -1455,19 +1468,20 @@ DISTCLEANFILES = $(EXTRA_LIBRARIES) tangle.c tangle.h tangle.p \
$(nodist_eptex_SOURCES) eptex.web eptex.ch eptex-web2c eptex.p \
eptex.pool eptex-tangle eptrip.diffs $(nodist_pdftex_SOURCES) \
pdftex.ch pdftex-web2c pdftex.p pdftex.pool pdftex-tangle \
- $(nodist_libluatex_a_SOURCES) $(nodist_xetex_SOURCES) \
- xetex.web xetex-web2c xetex.p xetex.pool xetex-tangle \
- $(omegaware_programs:=.c) $(omegaware_programs:=.h) \
- $(omegaware_programs:=.p) $(omegaware_programs:=-web2c) \
- omegaware/tests/xlevel1.ofm omegaware/tests/xlevel1.opl \
- ofont*vf omegaware/tests/xofont* omegaware/tests/Cherokee.tfm \
- omegaware/tests/OCherokee.ofm omegaware/tests/OCherokee.opl \
- omegaware/tests/OCherokee.ovf omegaware/tests/xCherokee.* \
- omegaware/tests/xOCherokee.* cftest.p \
- omegaware/tests/xrepeated.* omegaware/tests/specialhex.ofm \
- omegaware/tests/specialhex.opl omegaware/tests/specialhex.ovf \
- omegaware/tests/xspecialhex.* $(nodist_aleph_SOURCES) \
- aleph.web aleph.ch aleph-web2c aleph.p aleph.pool aleph-tangle
+ $(nodist_libluatex_a_SOURCES) txt2zlib.c \
+ $(nodist_xetex_SOURCES) xetex.web xetex-web2c xetex.p \
+ xetex.pool xetex-tangle $(omegaware_programs:=.c) \
+ $(omegaware_programs:=.h) $(omegaware_programs:=.p) \
+ $(omegaware_programs:=-web2c) omegaware/tests/xlevel1.ofm \
+ omegaware/tests/xlevel1.opl ofont*vf omegaware/tests/xofont* \
+ omegaware/tests/Cherokee.tfm omegaware/tests/OCherokee.ofm \
+ omegaware/tests/OCherokee.opl omegaware/tests/OCherokee.ovf \
+ omegaware/tests/xCherokee.* omegaware/tests/xOCherokee.* \
+ cftest.p omegaware/tests/xrepeated.* \
+ omegaware/tests/specialhex.ofm omegaware/tests/specialhex.opl \
+ omegaware/tests/specialhex.ovf omegaware/tests/xspecialhex.* \
+ $(nodist_aleph_SOURCES) aleph.web aleph.ch aleph-web2c aleph.p \
+ aleph.pool aleph-tangle
CLEANFILES =
TRIPTRAP_CLEAN = $(am__append_9) $(am__append_17) $(am__append_24) \
$(am__append_29) $(am__append_35) $(am__append_40)
@@ -1827,7 +1841,7 @@ pdftosrc_DEPENDENCIES = $(pdftex_dependencies)
# Force Automake to use CXXLD for linking
nodist_EXTRA_luatex_SOURCES = dummy.cxx
luatex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) \
- $(XPDF_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 \
+ $(POPPLER_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5 \
-I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 \
-I$(srcdir)/mplibdir -Dextra_version_info=`date +-%Y%m%d%H` \
-I$(srcdir)/synctexdir \
@@ -1835,11 +1849,11 @@ luatex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) \
luatex_CXXFLAGS = $(WARNING_CXXFLAGS)
luatex_ldadd = libluatex.a libff.a libluamisc.a libluasocket.a \
liblua51.a $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) \
- $(XPDF_LIBS) $(OBSDCOMPAT_LIBS) libmd5.a libmplib.a
+ $(POPPLER_LIBS) $(OBSDCOMPAT_LIBS) libmd5.a libmplib.a
luatex_LDFLAGS = -export-dynamic
luatex_LDADD = $(luatex_ldadd) $(LDADD) $(LIBADD_DLOPEN) $(lua_socketlibs)
luatex_DEPENDENCIES = $(proglib) $(KPATHSEA_DEPEND) libluatex.a \
- $(LIBPNG_DEPEND) $(ZLIB_DEPEND) $(XPDF_DEPEND) \
+ $(LIBPNG_DEPEND) $(ZLIB_DEPEND) $(POPPLER_DEPEND) \
$(OBSDCOMPAT_DEPEND) libmd5.a libmplib.a
luatex_SOURCES = luatexdir/luatex_svnversion.h luatexdir/luatex.c luatexdir/luatex.h
call_luatex_CPPFLAGS = -DEXEPROG=\"luatex.exe\"
@@ -1849,7 +1863,8 @@ call_luatex_LDADD =
# luaTeX Tests
#
luatex_tests = luatexdir/luatex.test
-liblua51_a_CPPFLAGS = -I$(top_srcdir)/luatexdir/lua51 $(am__append_50)
+liblua51_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/luatexdir/lua51 \
+ $(am__append_50)
liblua51_a_CFLAGS = # $(WARNING_CFLAGS)
liblua51_a_SOURCES = \
luatexdir/lua51/lapi.c \
@@ -1907,7 +1922,7 @@ liblua51_a_SOURCES = \
luatexdir/lua51/lzio.h
libluasocket_a_DEPENDENCIES = $(ZLIB_DEPEND) liblua51.a
-libluasocket_a_CPPFLAGS = \
+libluasocket_a_CPPFLAGS = $(AM_CPPFLAGS) \
-DLUASOCKET_DEBUG -I$(top_srcdir)/luatexdir/luasocket -I$(srcdir)/luatexdir/lua51
libluasocket_a_CFLAGS = # $(WARNING_CFLAGS)
@@ -1942,7 +1957,7 @@ libluasocket_a_SOURCES = \
luatexdir/luasocket/src/usocket.h
libluamisc_a_DEPENDENCIES = $(ZZIPLIB_DEPEND) libluasocket.a
-libluamisc_a_CPPFLAGS = \
+libluamisc_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(ZLIB_INCLUDES) \
$(ZZIPLIB_INCLUDES) \
-I$(top_srcdir)/luatexdir/lua51
@@ -1974,8 +1989,7 @@ libluamisc_a_SOURCES = \
EXTRA_libluamisc_a_SOURCES = luatexdir/slnunicode/slnudata.c
libff_a_DEPENDENCIES = libluamisc.a
-libff_a_CPPFLAGS = \
- $(AM_CPPFLAGS) \
+libff_a_CPPFLAGS = $(AM_CPPFLAGS) \
-DFONTFORGE_CONFIG_NO_WINDOWING_UI=1 -DLUA_FF_LIB=1 \
-D_NO_PYTHON=1 -DX_DISPLAY_MISSING=1 -DNODYNAMIC=1 \
-D_NO_FREETYPE=1 -D_NO_LIBUNINAMESLIST=1 -UHAVE_LIBINTL_H \
@@ -2086,7 +2100,7 @@ libff_a_SOURCES = \
libluatex_a_DEPENDENCIES = libff.a
libluatex_a_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) \
- $(LIBPNG_INCLUDES) $(XPDF_INCLUDES) $(OBSDCOMPAT_INCLUDES) \
+ $(LIBPNG_INCLUDES) $(POPPLER_INCLUDES) $(OBSDCOMPAT_INCLUDES) \
-I$(srcdir)/libmd5 -I$(srcdir)/luatexdir \
-I$(srcdir)/luatexdir/lua51 -DpdfTeX -I$(srcdir)/synctexdir \
-DSYNCTEX_ENGINE_H='<utils/synctex-luatex.h>'
@@ -2103,14 +2117,12 @@ libluatex_web = luatexdir/dvi/dvigen.w luatexdir/font/dofont.w \
luatexdir/font/writefont.w luatexdir/font/writet1.w \
luatexdir/font/writet3.w luatexdir/font/writettf.w \
luatexdir/font/writetype0.w luatexdir/font/writetype2.w \
- luatexdir/image/epdf.w luatexdir/image/writeimg.w \
- luatexdir/image/writejbig2.w luatexdir/image/writejpg.w \
+ luatexdir/image/writeimg.w luatexdir/image/writejbig2.w \
+ luatexdir/image/writejpg.w luatexdir/image/writejp2.w \
luatexdir/image/writepng.w luatexdir/lua/luagen.w \
luatexdir/lua/luainit.w luatexdir/lua/luanode.w \
luatexdir/lua/luastuff.w luatexdir/lua/luatoken.w \
- luatexdir/lua/texluac.w luatexdir/ocp/ocp.w \
- luatexdir/ocp/ocplist.w luatexdir/ocp/readocp.w \
- luatexdir/ocp/runocp.w luatexdir/lang/texlang.w \
+ luatexdir/lua/texluac.w luatexdir/lang/texlang.w \
luatexdir/lang/hyphen.w luatexdir/lang/hnjalloc.w \
luatexdir/pdf/pagetree.w luatexdir/pdf/pdfaction.w \
luatexdir/pdf/pdfannot.w luatexdir/pdf/pdfcolorstack.w \
@@ -2118,53 +2130,53 @@ libluatex_web = luatexdir/dvi/dvigen.w luatexdir/font/dofont.w \
luatexdir/pdf/pdfgen.w luatexdir/pdf/pdfglyph.w \
luatexdir/pdf/pdfimage.w luatexdir/pdf/pdflink.w \
luatexdir/pdf/pdflistout.w luatexdir/pdf/pdfliteral.w \
- luatexdir/pdf/pdfobj.w luatexdir/pdf/pdfoutline.w \
- luatexdir/pdf/pdfpage.w luatexdir/pdf/pdfrule.w \
- luatexdir/pdf/pdfsaverestore.w luatexdir/pdf/pdfsetmatrix.w \
- luatexdir/pdf/pdfshipout.w luatexdir/pdf/pdftables.w \
- luatexdir/pdf/pdfthread.w luatexdir/pdf/pdfxform.w \
- luatexdir/tex/align.w luatexdir/tex/dumpdata.w \
- luatexdir/tex/expand.w luatexdir/tex/inputstack.w \
- luatexdir/tex/maincontrol.w luatexdir/tex/mlist.w \
- luatexdir/tex/postlinebreak.w luatexdir/tex/scanning.w \
- luatexdir/tex/texdeffont.w luatexdir/tex/texnodes.w \
- luatexdir/tex/arithmetic.w luatexdir/tex/conditional.w \
- luatexdir/tex/equivalents.w luatexdir/tex/extensions.w \
- luatexdir/tex/commands.w luatexdir/tex/linebreak.w \
- luatexdir/tex/mathcodes.w luatexdir/tex/nesting.w \
- luatexdir/tex/primitive.w luatexdir/tex/texfileio.w \
- luatexdir/tex/textcodes.w luatexdir/tex/buildpage.w \
- luatexdir/tex/directions.w luatexdir/tex/errors.w \
- luatexdir/tex/filename.w luatexdir/tex/mainbody.w \
- luatexdir/tex/memoryword.w luatexdir/tex/packaging.w \
- luatexdir/tex/printing.w luatexdir/tex/stringpool.w \
- luatexdir/tex/texmath.w luatexdir/tex/textoken.w \
- luatexdir/utils/utils.w luatexdir/utils/avlstuff.w \
- luatexdir/utils/managed-sa.w
+ luatexdir/pdf/pdfluaapi.w luatexdir/pdf/pdfobj.w \
+ luatexdir/pdf/pdfoutline.w luatexdir/pdf/pdfpage.w \
+ luatexdir/pdf/pdfrule.w luatexdir/pdf/pdfsaverestore.w \
+ luatexdir/pdf/pdfsetmatrix.w luatexdir/pdf/pdfshipout.w \
+ luatexdir/pdf/pdftables.w luatexdir/pdf/pdfthread.w \
+ luatexdir/pdf/pdfxform.w luatexdir/tex/align.w \
+ luatexdir/tex/dumpdata.w luatexdir/tex/expand.w \
+ luatexdir/tex/inputstack.w luatexdir/tex/maincontrol.w \
+ luatexdir/tex/mlist.w luatexdir/tex/postlinebreak.w \
+ luatexdir/tex/scanning.w luatexdir/tex/texdeffont.w \
+ luatexdir/tex/texnodes.w luatexdir/tex/arithmetic.w \
+ luatexdir/tex/conditional.w luatexdir/tex/equivalents.w \
+ luatexdir/tex/extensions.w luatexdir/tex/commands.w \
+ luatexdir/tex/linebreak.w luatexdir/tex/mathcodes.w \
+ luatexdir/tex/nesting.w luatexdir/tex/primitive.w \
+ luatexdir/tex/texfileio.w luatexdir/tex/textcodes.w \
+ luatexdir/tex/buildpage.w luatexdir/tex/directions.w \
+ luatexdir/tex/errors.w luatexdir/tex/filename.w \
+ luatexdir/tex/mainbody.w luatexdir/tex/memoryword.w \
+ luatexdir/tex/packaging.w luatexdir/tex/printing.w \
+ luatexdir/tex/stringpool.w luatexdir/tex/texmath.w \
+ luatexdir/tex/textoken.w luatexdir/utils/utils.w \
+ luatexdir/utils/avlstuff.w luatexdir/utils/managed-sa.w
nodist_libluatex_a_SOURCES = dvigen.c dofont.c luafont.c mapfile.c \
pkin.c sfnt.c subfont.c texfont.c tfmofm.c tounicode.c \
tt_glyf.c tt_table.c vfovf.c vfpacket.c writecff.c writeenc.c \
writefont.c writet1.c writet3.c writettf.c writetype0.c \
- writetype2.c epdf.c writeimg.c writejbig2.c writejpg.c \
+ writetype2.c writeimg.c writejbig2.c writejpg.c writejp2.c \
writepng.c luagen.c luainit.c luanode.c luastuff.c luatoken.c \
- texluac.c ocp.c ocplist.c readocp.c runocp.c texlang.c \
- hyphen.c hnjalloc.c pagetree.c pdfaction.c pdfannot.c \
- pdfcolorstack.c pdfdest.c pdffont.c pdfgen.c pdfglyph.c \
- pdfimage.c pdflink.c pdflistout.c pdfliteral.c pdfobj.c \
- pdfoutline.c pdfpage.c pdfrule.c pdfsaverestore.c \
- pdfsetmatrix.c pdfshipout.c pdftables.c pdfthread.c pdfxform.c \
- align.c dumpdata.c expand.c inputstack.c maincontrol.c mlist.c \
- postlinebreak.c scanning.c texdeffont.c texnodes.c \
- arithmetic.c conditional.c equivalents.c extensions.c \
- commands.c linebreak.c mathcodes.c nesting.c primitive.c \
- texfileio.c textcodes.c buildpage.c directions.c errors.c \
- filename.c mainbody.c memoryword.c packaging.c printing.c \
- stringpool.c texmath.c textoken.c utils.c avlstuff.c \
- managed-sa.c mplibdir/lmplib.c
+ texluac.c pdflua.c texlang.c hyphen.c hnjalloc.c pagetree.c \
+ pdfaction.c pdfannot.c pdfcolorstack.c pdfdest.c pdffont.c \
+ pdfgen.c pdfglyph.c pdfimage.c pdflink.c pdflistout.c \
+ pdfliteral.c pdfluaapi.c pdfobj.c pdfoutline.c pdfpage.c \
+ pdfrule.c pdfsaverestore.c pdfsetmatrix.c pdfshipout.c \
+ pdftables.c pdfthread.c pdfxform.c align.c dumpdata.c expand.c \
+ inputstack.c maincontrol.c mlist.c postlinebreak.c scanning.c \
+ texdeffont.c texnodes.c arithmetic.c conditional.c \
+ equivalents.c extensions.c commands.c linebreak.c mathcodes.c \
+ nesting.c primitive.c texfileio.c textcodes.c buildpage.c \
+ directions.c errors.c filename.c mainbody.c memoryword.c \
+ packaging.c printing.c stringpool.c texmath.c textoken.c \
+ utils.c avlstuff.c managed-sa.c mplibdir/lmplib.c
luatex_font_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/font $(ctangle)
luatex_image_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/image $(ctangle)
luatex_lua_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/lua $(ctangle)
-luatex_ocp_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/ocp $(ctangle)
+luatex_luascripts_txt2zlib = $(TXTTOZLIB)
+luatex_luascripts_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/luascripts $(ctangle)
luatex_lang_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/lang $(ctangle)
luatex_pdf_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/pdf $(ctangle)
luatex_tex_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/tex $(ctangle)
@@ -2186,6 +2198,7 @@ libluatex_a_SOURCES = \
luatexdir/image/writeimg.h \
luatexdir/image/writejbig2.h \
luatexdir/image/writejpg.h \
+ luatexdir/image/writejp2.h \
luatexdir/image/writepng.h \
luatexdir/lang/hnjalloc.h \
luatexdir/lang/hyphen.h \
@@ -2197,6 +2210,7 @@ libluatex_a_SOURCES = \
luatexdir/lua/lkpselib.c \
luatexdir/lua/llanglib.c \
luatexdir/lua/llualib.c \
+ luatexdir/lua/llfslibext.c \
luatexdir/lua/lnodelib.c \
luatexdir/lua/loslibext.c \
luatexdir/lua/liolib.c \
@@ -2207,11 +2221,8 @@ libluatex_a_SOURCES = \
luatexdir/lua/ltokenlib.c \
luatexdir/lua/luagen.h \
luatexdir/lua/luatex-api.h \
+ luatexdir/luascripts/pdflua.h \
luatexdir/luatex.h \
- luatexdir/ocp/ocp.h \
- luatexdir/ocp/ocplist.h \
- luatexdir/ocp/readocp.h \
- luatexdir/ocp/runocp.h \
luatexdir/pdf/pagetree.h \
luatexdir/pdf/pdfaction.h \
luatexdir/pdf/pdfannot.h \
@@ -2224,6 +2235,7 @@ libluatex_a_SOURCES = \
luatexdir/pdf/pdflink.h \
luatexdir/pdf/pdflistout.h \
luatexdir/pdf/pdfliteral.h \
+ luatexdir/pdf/pdfluaapi.h \
luatexdir/pdf/pdfobj.h \
luatexdir/pdf/pdfoutline.h \
luatexdir/pdf/pdfpage.h \
@@ -2273,10 +2285,15 @@ libluatex_a_SOURCES = \
luatexdir/utils/managed-sa.h \
luatexdir/utils/synctex-common.h \
luatexdir/utils/synctex-luatex.h \
- luatexdir/utils/synctex.c \
luatexdir/utils/synctex.h \
+ luatexdir/utils/synctex.c \
luatexdir/utils/utils.h
+nodist_txt2zlib_SOURCES = txt2zlib.c
+txt2zlib_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
+txt2zlib_DEPENDENCIES = $(ZLIB_DEPEND)
+txt2zlib_CFLAGS = $(WARNING_CFLAGS)
+txt2zlib_LDADD = $(ZLIB_LIBS) $(LDADD)
# Force Automake to use CXXLD for linking
nodist_EXTRA_xetex_SOURCES = dummy.cxx
@@ -2493,7 +2510,7 @@ all: ff-config.h
.SUFFIXES: .c .cc .cin .cpp .cxx .h .hin .lo .o .obj .p .pin
am--refresh:
@:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/am/bootstrap.am $(srcdir)/am/web.am $(srcdir)/am/cweb.am $(srcdir)/am/texmf.am $(srcdir)/mplibdir/am/mplib.am $(srcdir)/mplibdir/am/libmplib.am $(srcdir)/etexdir/am/etex.am $(srcdir)/ptexdir/am/ptex.am $(srcdir)/eptexdir/am/eptex.am $(srcdir)/pdftexdir/am/pdftex.am $(srcdir)/pdftexdir/am/libpdftex.am $(srcdir)/pdftexdir/am/ttf2afm.am $(srcdir)/pdftexdir/am/pdftosrc.am $(srcdir)/luatexdir/am/luatex.am $(srcdir)/luatexdir/am/liblua51.am $(srcdir)/luatexdir/am/luasocket.am $(srcdir)/luatexdir/am/luamisc.am $(srcdir)/luatexdir/am/luafontforge.am $(srcdir)/luatexdir/am/libluatex.am $(srcdir)/xetexdir/am/xetex.am $(srcdir)/omegaware/am/omegaware.am $(srcdir)/alephdir/am/aleph.am $(srcdir)/synctexdir/am/synctex.am $(srcdir)/libmd5/am/md5.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/am/bootstrap.am $(srcdir)/am/web.am $(srcdir)/am/cweb.am $(srcdir)/am/texmf.am $(srcdir)/mplibdir/am/mplib.am $(srcdir)/mplibdir/am/libmplib.am $(srcdir)/etexdir/am/etex.am $(srcdir)/ptexdir/am/ptex.am $(srcdir)/eptexdir/am/eptex.am $(srcdir)/pdftexdir/am/pdftex.am $(srcdir)/pdftexdir/am/libpdftex.am $(srcdir)/pdftexdir/am/ttf2afm.am $(srcdir)/pdftexdir/am/pdftosrc.am $(srcdir)/luatexdir/am/luatex.am $(srcdir)/luatexdir/am/liblua51.am $(srcdir)/luatexdir/am/luasocket.am $(srcdir)/luatexdir/am/luamisc.am $(srcdir)/luatexdir/am/luafontforge.am $(srcdir)/luatexdir/am/libluatex.am $(srcdir)/luatexdir/am/txt2zlib.am $(srcdir)/xetexdir/am/xetex.am $(srcdir)/omegaware/am/omegaware.am $(srcdir)/alephdir/am/aleph.am $(srcdir)/synctexdir/am/synctex.am $(srcdir)/libmd5/am/md5.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -2813,6 +2830,9 @@ tie$(EXEEXT): $(tie_OBJECTS) $(tie_DEPENDENCIES)
ttf2afm$(EXEEXT): $(ttf2afm_OBJECTS) $(ttf2afm_DEPENDENCIES)
@rm -f ttf2afm$(EXEEXT)
$(LINK) $(ttf2afm_OBJECTS) $(ttf2afm_LDADD) $(LIBS)
+txt2zlib$(EXEEXT): $(txt2zlib_OBJECTS) $(txt2zlib_DEPENDENCIES)
+ @rm -f txt2zlib$(EXEEXT)
+ $(txt2zlib_LINK) $(txt2zlib_OBJECTS) $(txt2zlib_LDADD) $(LIBS)
vftovp$(EXEEXT): $(vftovp_OBJECTS) $(vftovp_DEPENDENCIES)
@rm -f vftovp$(EXEEXT)
$(LINK) $(vftovp_OBJECTS) $(vftovp_LDADD) $(LIBS)
@@ -2988,7 +3008,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-dofont.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-dumpdata.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-dvigen.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-epdf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-equivalents.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-errors.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-expand.Po@am__quote@
@@ -3005,6 +3024,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-liolib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-lkpselib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-llanglib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-llfslibext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-llualib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-lmplib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-lnodelib.Po@am__quote@
@@ -3028,8 +3048,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-memoryword.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-mlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-nesting.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-ocp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-ocplist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-packaging.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pagetree.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfaction.Po@am__quote@
@@ -3043,6 +3061,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdflink.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdflistout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfliteral.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdflua.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfluaapi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfobj.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfoutline.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-pdfpage.Po@am__quote@
@@ -3058,8 +3078,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-postlinebreak.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-primitive.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-printing.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-readocp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-runocp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-scanning.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-sfnt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-stringpool.Po@am__quote@
@@ -3086,6 +3104,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writefont.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writeimg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writejbig2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writejp2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writejpg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writepng.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluatex_a-writet1.Po@am__quote@
@@ -3201,6 +3220,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tie-tie.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttf2afm-macnames.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttf2afm-ttf2afm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/txt2zlib-txt2zlib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vftovp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vptovf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weave.Po@am__quote@
@@ -4912,6 +4932,20 @@ libluatex_a-llualib.obj: luatexdir/lua/llualib.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-llualib.obj `if test -f 'luatexdir/lua/llualib.c'; then $(CYGPATH_W) 'luatexdir/lua/llualib.c'; else $(CYGPATH_W) '$(srcdir)/luatexdir/lua/llualib.c'; fi`
+libluatex_a-llfslibext.o: luatexdir/lua/llfslibext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-llfslibext.o -MD -MP -MF $(DEPDIR)/libluatex_a-llfslibext.Tpo -c -o libluatex_a-llfslibext.o `test -f 'luatexdir/lua/llfslibext.c' || echo '$(srcdir)/'`luatexdir/lua/llfslibext.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-llfslibext.Tpo $(DEPDIR)/libluatex_a-llfslibext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='luatexdir/lua/llfslibext.c' object='libluatex_a-llfslibext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-llfslibext.o `test -f 'luatexdir/lua/llfslibext.c' || echo '$(srcdir)/'`luatexdir/lua/llfslibext.c
+
+libluatex_a-llfslibext.obj: luatexdir/lua/llfslibext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-llfslibext.obj -MD -MP -MF $(DEPDIR)/libluatex_a-llfslibext.Tpo -c -o libluatex_a-llfslibext.obj `if test -f 'luatexdir/lua/llfslibext.c'; then $(CYGPATH_W) 'luatexdir/lua/llfslibext.c'; else $(CYGPATH_W) '$(srcdir)/luatexdir/lua/llfslibext.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-llfslibext.Tpo $(DEPDIR)/libluatex_a-llfslibext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='luatexdir/lua/llfslibext.c' object='libluatex_a-llfslibext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-llfslibext.obj `if test -f 'luatexdir/lua/llfslibext.c'; then $(CYGPATH_W) 'luatexdir/lua/llfslibext.c'; else $(CYGPATH_W) '$(srcdir)/luatexdir/lua/llfslibext.c'; fi`
+
libluatex_a-lnodelib.o: luatexdir/lua/lnodelib.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-lnodelib.o -MD -MP -MF $(DEPDIR)/libluatex_a-lnodelib.Tpo -c -o libluatex_a-lnodelib.o `test -f 'luatexdir/lua/lnodelib.c' || echo '$(srcdir)/'`luatexdir/lua/lnodelib.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-lnodelib.Tpo $(DEPDIR)/libluatex_a-lnodelib.Po
@@ -5360,20 +5394,6 @@ libluatex_a-writetype2.obj: writetype2.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-writetype2.obj `if test -f 'writetype2.c'; then $(CYGPATH_W) 'writetype2.c'; else $(CYGPATH_W) '$(srcdir)/writetype2.c'; fi`
-libluatex_a-epdf.o: epdf.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-epdf.o -MD -MP -MF $(DEPDIR)/libluatex_a-epdf.Tpo -c -o libluatex_a-epdf.o `test -f 'epdf.c' || echo '$(srcdir)/'`epdf.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-epdf.Tpo $(DEPDIR)/libluatex_a-epdf.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epdf.c' object='libluatex_a-epdf.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-epdf.o `test -f 'epdf.c' || echo '$(srcdir)/'`epdf.c
-
-libluatex_a-epdf.obj: epdf.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-epdf.obj -MD -MP -MF $(DEPDIR)/libluatex_a-epdf.Tpo -c -o libluatex_a-epdf.obj `if test -f 'epdf.c'; then $(CYGPATH_W) 'epdf.c'; else $(CYGPATH_W) '$(srcdir)/epdf.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-epdf.Tpo $(DEPDIR)/libluatex_a-epdf.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epdf.c' object='libluatex_a-epdf.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-epdf.obj `if test -f 'epdf.c'; then $(CYGPATH_W) 'epdf.c'; else $(CYGPATH_W) '$(srcdir)/epdf.c'; fi`
-
libluatex_a-writeimg.o: writeimg.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-writeimg.o -MD -MP -MF $(DEPDIR)/libluatex_a-writeimg.Tpo -c -o libluatex_a-writeimg.o `test -f 'writeimg.c' || echo '$(srcdir)/'`writeimg.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-writeimg.Tpo $(DEPDIR)/libluatex_a-writeimg.Po
@@ -5416,6 +5436,20 @@ libluatex_a-writejpg.obj: writejpg.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-writejpg.obj `if test -f 'writejpg.c'; then $(CYGPATH_W) 'writejpg.c'; else $(CYGPATH_W) '$(srcdir)/writejpg.c'; fi`
+libluatex_a-writejp2.o: writejp2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-writejp2.o -MD -MP -MF $(DEPDIR)/libluatex_a-writejp2.Tpo -c -o libluatex_a-writejp2.o `test -f 'writejp2.c' || echo '$(srcdir)/'`writejp2.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-writejp2.Tpo $(DEPDIR)/libluatex_a-writejp2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='writejp2.c' object='libluatex_a-writejp2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-writejp2.o `test -f 'writejp2.c' || echo '$(srcdir)/'`writejp2.c
+
+libluatex_a-writejp2.obj: writejp2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-writejp2.obj -MD -MP -MF $(DEPDIR)/libluatex_a-writejp2.Tpo -c -o libluatex_a-writejp2.obj `if test -f 'writejp2.c'; then $(CYGPATH_W) 'writejp2.c'; else $(CYGPATH_W) '$(srcdir)/writejp2.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-writejp2.Tpo $(DEPDIR)/libluatex_a-writejp2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='writejp2.c' object='libluatex_a-writejp2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-writejp2.obj `if test -f 'writejp2.c'; then $(CYGPATH_W) 'writejp2.c'; else $(CYGPATH_W) '$(srcdir)/writejp2.c'; fi`
+
libluatex_a-writepng.o: writepng.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-writepng.o -MD -MP -MF $(DEPDIR)/libluatex_a-writepng.Tpo -c -o libluatex_a-writepng.o `test -f 'writepng.c' || echo '$(srcdir)/'`writepng.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-writepng.Tpo $(DEPDIR)/libluatex_a-writepng.Po
@@ -5514,61 +5548,19 @@ libluatex_a-texluac.obj: texluac.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-texluac.obj `if test -f 'texluac.c'; then $(CYGPATH_W) 'texluac.c'; else $(CYGPATH_W) '$(srcdir)/texluac.c'; fi`
-libluatex_a-ocp.o: ocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-ocp.o -MD -MP -MF $(DEPDIR)/libluatex_a-ocp.Tpo -c -o libluatex_a-ocp.o `test -f 'ocp.c' || echo '$(srcdir)/'`ocp.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-ocp.Tpo $(DEPDIR)/libluatex_a-ocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ocp.c' object='libluatex_a-ocp.o' libtool=no @AMDEPBACKSLASH@
+libluatex_a-pdflua.o: pdflua.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-pdflua.o -MD -MP -MF $(DEPDIR)/libluatex_a-pdflua.Tpo -c -o libluatex_a-pdflua.o `test -f 'pdflua.c' || echo '$(srcdir)/'`pdflua.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-pdflua.Tpo $(DEPDIR)/libluatex_a-pdflua.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pdflua.c' object='libluatex_a-pdflua.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-ocp.o `test -f 'ocp.c' || echo '$(srcdir)/'`ocp.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-pdflua.o `test -f 'pdflua.c' || echo '$(srcdir)/'`pdflua.c
-libluatex_a-ocp.obj: ocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-ocp.obj -MD -MP -MF $(DEPDIR)/libluatex_a-ocp.Tpo -c -o libluatex_a-ocp.obj `if test -f 'ocp.c'; then $(CYGPATH_W) 'ocp.c'; else $(CYGPATH_W) '$(srcdir)/ocp.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-ocp.Tpo $(DEPDIR)/libluatex_a-ocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ocp.c' object='libluatex_a-ocp.obj' libtool=no @AMDEPBACKSLASH@
+libluatex_a-pdflua.obj: pdflua.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-pdflua.obj -MD -MP -MF $(DEPDIR)/libluatex_a-pdflua.Tpo -c -o libluatex_a-pdflua.obj `if test -f 'pdflua.c'; then $(CYGPATH_W) 'pdflua.c'; else $(CYGPATH_W) '$(srcdir)/pdflua.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-pdflua.Tpo $(DEPDIR)/libluatex_a-pdflua.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pdflua.c' object='libluatex_a-pdflua.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-ocp.obj `if test -f 'ocp.c'; then $(CYGPATH_W) 'ocp.c'; else $(CYGPATH_W) '$(srcdir)/ocp.c'; fi`
-
-libluatex_a-ocplist.o: ocplist.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-ocplist.o -MD -MP -MF $(DEPDIR)/libluatex_a-ocplist.Tpo -c -o libluatex_a-ocplist.o `test -f 'ocplist.c' || echo '$(srcdir)/'`ocplist.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-ocplist.Tpo $(DEPDIR)/libluatex_a-ocplist.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ocplist.c' object='libluatex_a-ocplist.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-ocplist.o `test -f 'ocplist.c' || echo '$(srcdir)/'`ocplist.c
-
-libluatex_a-ocplist.obj: ocplist.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-ocplist.obj -MD -MP -MF $(DEPDIR)/libluatex_a-ocplist.Tpo -c -o libluatex_a-ocplist.obj `if test -f 'ocplist.c'; then $(CYGPATH_W) 'ocplist.c'; else $(CYGPATH_W) '$(srcdir)/ocplist.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-ocplist.Tpo $(DEPDIR)/libluatex_a-ocplist.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ocplist.c' object='libluatex_a-ocplist.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-ocplist.obj `if test -f 'ocplist.c'; then $(CYGPATH_W) 'ocplist.c'; else $(CYGPATH_W) '$(srcdir)/ocplist.c'; fi`
-
-libluatex_a-readocp.o: readocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-readocp.o -MD -MP -MF $(DEPDIR)/libluatex_a-readocp.Tpo -c -o libluatex_a-readocp.o `test -f 'readocp.c' || echo '$(srcdir)/'`readocp.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-readocp.Tpo $(DEPDIR)/libluatex_a-readocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='readocp.c' object='libluatex_a-readocp.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-readocp.o `test -f 'readocp.c' || echo '$(srcdir)/'`readocp.c
-
-libluatex_a-readocp.obj: readocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-readocp.obj -MD -MP -MF $(DEPDIR)/libluatex_a-readocp.Tpo -c -o libluatex_a-readocp.obj `if test -f 'readocp.c'; then $(CYGPATH_W) 'readocp.c'; else $(CYGPATH_W) '$(srcdir)/readocp.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-readocp.Tpo $(DEPDIR)/libluatex_a-readocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='readocp.c' object='libluatex_a-readocp.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-readocp.obj `if test -f 'readocp.c'; then $(CYGPATH_W) 'readocp.c'; else $(CYGPATH_W) '$(srcdir)/readocp.c'; fi`
-
-libluatex_a-runocp.o: runocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-runocp.o -MD -MP -MF $(DEPDIR)/libluatex_a-runocp.Tpo -c -o libluatex_a-runocp.o `test -f 'runocp.c' || echo '$(srcdir)/'`runocp.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-runocp.Tpo $(DEPDIR)/libluatex_a-runocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runocp.c' object='libluatex_a-runocp.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-runocp.o `test -f 'runocp.c' || echo '$(srcdir)/'`runocp.c
-
-libluatex_a-runocp.obj: runocp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-runocp.obj -MD -MP -MF $(DEPDIR)/libluatex_a-runocp.Tpo -c -o libluatex_a-runocp.obj `if test -f 'runocp.c'; then $(CYGPATH_W) 'runocp.c'; else $(CYGPATH_W) '$(srcdir)/runocp.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-runocp.Tpo $(DEPDIR)/libluatex_a-runocp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runocp.c' object='libluatex_a-runocp.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-runocp.obj `if test -f 'runocp.c'; then $(CYGPATH_W) 'runocp.c'; else $(CYGPATH_W) '$(srcdir)/runocp.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-pdflua.obj `if test -f 'pdflua.c'; then $(CYGPATH_W) 'pdflua.c'; else $(CYGPATH_W) '$(srcdir)/pdflua.c'; fi`
libluatex_a-texlang.o: texlang.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-texlang.o -MD -MP -MF $(DEPDIR)/libluatex_a-texlang.Tpo -c -o libluatex_a-texlang.o `test -f 'texlang.c' || echo '$(srcdir)/'`texlang.c
@@ -5780,6 +5772,20 @@ libluatex_a-pdfliteral.obj: pdfliteral.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-pdfliteral.obj `if test -f 'pdfliteral.c'; then $(CYGPATH_W) 'pdfliteral.c'; else $(CYGPATH_W) '$(srcdir)/pdfliteral.c'; fi`
+libluatex_a-pdfluaapi.o: pdfluaapi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-pdfluaapi.o -MD -MP -MF $(DEPDIR)/libluatex_a-pdfluaapi.Tpo -c -o libluatex_a-pdfluaapi.o `test -f 'pdfluaapi.c' || echo '$(srcdir)/'`pdfluaapi.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-pdfluaapi.Tpo $(DEPDIR)/libluatex_a-pdfluaapi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pdfluaapi.c' object='libluatex_a-pdfluaapi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-pdfluaapi.o `test -f 'pdfluaapi.c' || echo '$(srcdir)/'`pdfluaapi.c
+
+libluatex_a-pdfluaapi.obj: pdfluaapi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-pdfluaapi.obj -MD -MP -MF $(DEPDIR)/libluatex_a-pdfluaapi.Tpo -c -o libluatex_a-pdfluaapi.obj `if test -f 'pdfluaapi.c'; then $(CYGPATH_W) 'pdfluaapi.c'; else $(CYGPATH_W) '$(srcdir)/pdfluaapi.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-pdfluaapi.Tpo $(DEPDIR)/libluatex_a-pdfluaapi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pdfluaapi.c' object='libluatex_a-pdfluaapi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libluatex_a-pdfluaapi.obj `if test -f 'pdfluaapi.c'; then $(CYGPATH_W) 'pdfluaapi.c'; else $(CYGPATH_W) '$(srcdir)/pdfluaapi.c'; fi`
+
libluatex_a-pdfobj.o: pdfobj.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluatex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libluatex_a-pdfobj.o -MD -MP -MF $(DEPDIR)/libluatex_a-pdfobj.Tpo -c -o libluatex_a-pdfobj.o `test -f 'pdfobj.c' || echo '$(srcdir)/'`pdfobj.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libluatex_a-pdfobj.Tpo $(DEPDIR)/libluatex_a-pdfobj.Po
@@ -7670,6 +7676,20 @@ ttf2afm-macnames.obj: pdftexdir/macnames.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ttf2afm_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ttf2afm-macnames.obj `if test -f 'pdftexdir/macnames.c'; then $(CYGPATH_W) 'pdftexdir/macnames.c'; else $(CYGPATH_W) '$(srcdir)/pdftexdir/macnames.c'; fi`
+txt2zlib-txt2zlib.o: txt2zlib.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(txt2zlib_CPPFLAGS) $(CPPFLAGS) $(txt2zlib_CFLAGS) $(CFLAGS) -MT txt2zlib-txt2zlib.o -MD -MP -MF $(DEPDIR)/txt2zlib-txt2zlib.Tpo -c -o txt2zlib-txt2zlib.o `test -f 'txt2zlib.c' || echo '$(srcdir)/'`txt2zlib.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/txt2zlib-txt2zlib.Tpo $(DEPDIR)/txt2zlib-txt2zlib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='txt2zlib.c' object='txt2zlib-txt2zlib.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(txt2zlib_CPPFLAGS) $(CPPFLAGS) $(txt2zlib_CFLAGS) $(CFLAGS) -c -o txt2zlib-txt2zlib.o `test -f 'txt2zlib.c' || echo '$(srcdir)/'`txt2zlib.c
+
+txt2zlib-txt2zlib.obj: txt2zlib.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(txt2zlib_CPPFLAGS) $(CPPFLAGS) $(txt2zlib_CFLAGS) $(CFLAGS) -MT txt2zlib-txt2zlib.obj -MD -MP -MF $(DEPDIR)/txt2zlib-txt2zlib.Tpo -c -o txt2zlib-txt2zlib.obj `if test -f 'txt2zlib.c'; then $(CYGPATH_W) 'txt2zlib.c'; else $(CYGPATH_W) '$(srcdir)/txt2zlib.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/txt2zlib-txt2zlib.Tpo $(DEPDIR)/txt2zlib-txt2zlib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='txt2zlib.c' object='txt2zlib-txt2zlib.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(txt2zlib_CPPFLAGS) $(CPPFLAGS) $(txt2zlib_CFLAGS) $(CFLAGS) -c -o txt2zlib-txt2zlib.obj `if test -f 'txt2zlib.c'; then $(CYGPATH_W) 'txt2zlib.c'; else $(CYGPATH_W) '$(srcdir)/txt2zlib.c'; fi`
+
xetex-xetexextra.o: xetexdir/xetexextra.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xetex_CPPFLAGS) $(CPPFLAGS) $(xetex_CFLAGS) $(CFLAGS) -MT xetex-xetexextra.o -MD -MP -MF $(DEPDIR)/xetex-xetexextra.Tpo -c -o xetex-xetexextra.o `test -f 'xetexdir/xetexextra.c' || echo '$(srcdir)/'`xetexdir/xetexextra.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xetex-xetexextra.Tpo $(DEPDIR)/xetex-xetexextra.Po
@@ -8780,6 +8800,7 @@ $(proglib): ${srcdir}/lib/*.c
@ZLIB_RULE@
@LIBPNG_RULE@
@XPDF_RULE@
+@POPPLER_RULE@
@OBSDCOMPAT_RULE@
@ZZIPLIB_RULE@
@GRAPHITE_RULE@
@@ -9311,14 +9332,14 @@ writetype0.c: ctangle$(EXEEXT) luatexdir/font/writetype0.w
writetype2.c: ctangle$(EXEEXT) luatexdir/font/writetype2.w
$(luatex_font_ctangle) writetype2.w
-epdf.c: ctangle$(EXEEXT) luatexdir/image/epdf.w
- $(luatex_image_ctangle) epdf.w
writeimg.c: ctangle$(EXEEXT) luatexdir/image/writeimg.w
$(luatex_image_ctangle) writeimg.w
writejbig2.c: ctangle$(EXEEXT) luatexdir/image/writejbig2.w
$(luatex_image_ctangle) writejbig2.w
writejpg.c: ctangle$(EXEEXT) luatexdir/image/writejpg.w
$(luatex_image_ctangle) writejpg.w
+writejp2.c: ctangle$(EXEEXT) luatexdir/image/writejp2.w
+ $(luatex_image_ctangle) writejp2.w
writepng.c: ctangle$(EXEEXT) luatexdir/image/writepng.w
$(luatex_image_ctangle) writepng.w
@@ -9335,17 +9356,8 @@ luatoken.c: ctangle$(EXEEXT) luatexdir/lua/luatoken.w
texluac.c: ctangle$(EXEEXT) luatexdir/lua/texluac.w
$(luatex_lua_ctangle) texluac.w
-ocp.c: ctangle$(EXEEXT) luatexdir/ocp/ocp.w
- $(luatex_ocp_ctangle) ocp.w
-
-runocp.c: ctangle$(EXEEXT) luatexdir/ocp/runocp.w
- $(luatex_ocp_ctangle) runocp.w
-
-readocp.c: ctangle$(EXEEXT) luatexdir/ocp/readocp.w
- $(luatex_ocp_ctangle) readocp.w
-
-ocplist.c: ctangle$(EXEEXT) luatexdir/ocp/ocplist.w
- $(luatex_ocp_ctangle) ocplist.w
+pdflua.c: txt2zlib$(EXEEXT) luatexdir/luascripts/pdflua.lua
+ $(luatex_luascripts_txt2zlib) $(srcdir)/luatexdir/luascripts/pdflua.lua pdflua.c
hnjalloc.c: ctangle$(EXEEXT) luatexdir/lang/hnjalloc.w
$(luatex_lang_ctangle) hnjalloc.w
@@ -9392,6 +9404,9 @@ pdflistout.c: ctangle$(EXEEXT) luatexdir/pdf/pdflistout.w
pdfliteral.c: ctangle$(EXEEXT) luatexdir/pdf/pdfliteral.w
$(luatex_pdf_ctangle) pdfliteral.w
+pdfluaapi.c: ctangle$(EXEEXT) luatexdir/pdf/pdfluaapi.w
+ $(luatex_pdf_ctangle) pdfluaapi.w
+
pdfobj.c: ctangle$(EXEEXT) luatexdir/pdf/pdfobj.w
$(luatex_pdf_ctangle) pdfobj.w
@@ -9526,6 +9541,9 @@ avlstuff.c: ctangle$(EXEEXT) luatexdir/utils/avlstuff.w
$(luatex_utils_ctangle) avlstuff.w
$(libluatex_a_OBJECTS): libff.a libmplib.a
+
+txt2zlib.c: ctangle$(EXEEXT) luatexdir/luascripts/txt2zlib.w
+ $(luatex_luascripts_ctangle) txt2zlib.w
$(xetex_OBJECTS): $(xetex_prereq)
$(xetex_c_h): xetex-web2c
diff --git a/Build/source/texk/web2c/ac/web2c.ac b/Build/source/texk/web2c/ac/web2c.ac
index 933d05a7ecf..c88e73c5c6b 100644
--- a/Build/source/texk/web2c/ac/web2c.ac
+++ b/Build/source/texk/web2c/ac/web2c.ac
@@ -37,7 +37,7 @@ m4_define([kpse_tex_progs], [dnl
[[eptex], [yes], [no], [e-pTeX], [ptexenc]],
[[aleph], [yes], [no], [Aleph], []],
[[pdftex], [yes], [yes], [pdfTeX], [xpdf libpng obsdcompat]],
-[[luatex], [yes], [no], [luaTeX], [xpdf libpng obsdcompat zziplib]],
+[[luatex], [yes], [no], [luaTeX], [poppler libpng obsdcompat zziplib]],
[[xetex], [yes], [yes], [XeTeX], [xpdf libpng freetype2 icu-xetex teckit graphite]],
])[]dnl
m4_foreach([Kpse_Prog], [kpse_tex_progs],
diff --git a/Build/source/texk/web2c/aclocal.m4 b/Build/source/texk/web2c/aclocal.m4
index 8d89b6d7a1a..ff39f18ef22 100644
--- a/Build/source/texk/web2c/aclocal.m4
+++ b/Build/source/texk/web2c/aclocal.m4
@@ -19,113 +19,6 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
-# longlong.m4 serial 14
-dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Paul Eggert.
-
-# Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
-
-# Note: If the type 'long long int' exists but is only 32 bits large
-# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
-# defined. In this case you can treat 'long long int' like 'long int'.
-
-AC_DEFUN([AC_TYPE_LONG_LONG_INT],
-[
- AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
- [AC_LINK_IFELSE(
- [_AC_TYPE_LONG_LONG_SNIPPET],
- [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
- dnl If cross compiling, assume the bug isn't important, since
- dnl nobody cross compiles for this platform as far as we know.
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[@%:@include <limits.h>
- @%:@ifndef LLONG_MAX
- @%:@ define HALF \
- (1LL << (sizeof (long long int) * CHAR_BIT - 2))
- @%:@ define LLONG_MAX (HALF - 1 + HALF)
- @%:@endif]],
- [[long long int n = 1;
- int i;
- for (i = 0; ; i++)
- {
- long long int m = n << i;
- if (m >> i != n)
- return 1;
- if (LLONG_MAX / 2 < m)
- break;
- }
- return 0;]])],
- [ac_cv_type_long_long_int=yes],
- [ac_cv_type_long_long_int=no],
- [ac_cv_type_long_long_int=yes])],
- [ac_cv_type_long_long_int=no])])
- if test $ac_cv_type_long_long_int = yes; then
- AC_DEFINE([HAVE_LONG_LONG_INT], [1],
- [Define to 1 if the system has the type `long long int'.])
- fi
-])
-
-# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
-
-# Note: If the type 'unsigned long long int' exists but is only 32 bits
-# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
-# will not be defined. In this case you can treat 'unsigned long long int'
-# like 'unsigned long int'.
-
-AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
-[
- AC_CACHE_CHECK([for unsigned long long int],
- [ac_cv_type_unsigned_long_long_int],
- [AC_LINK_IFELSE(
- [_AC_TYPE_LONG_LONG_SNIPPET],
- [ac_cv_type_unsigned_long_long_int=yes],
- [ac_cv_type_unsigned_long_long_int=no])])
- if test $ac_cv_type_unsigned_long_long_int = yes; then
- AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
- [Define to 1 if the system has the type `unsigned long long int'.])
- fi
-])
-
-# Expands to a C program that can be used to test for simultaneous support
-# of 'long long' and 'unsigned long long'. We don't want to say that
-# 'long long' is available if 'unsigned long long' is not, or vice versa,
-# because too many programs rely on the symmetry between signed and unsigned
-# integer types (excluding 'bool').
-AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
-[
- AC_LANG_PROGRAM(
- [[/* For now, do not test the preprocessor; as of 2007 there are too many
- implementations with broken preprocessors. Perhaps this can
- be revisited in 2012. In the meantime, code should not expect
- #if to work with literals wider than 32 bits. */
- /* Test literals. */
- long long int ll = 9223372036854775807ll;
- long long int nll = -9223372036854775807LL;
- unsigned long long int ull = 18446744073709551615ULL;
- /* Test constant expressions. */
- typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
- ? 1 : -1)];
- typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
- ? 1 : -1)];
- int i = 63;]],
- [[/* Test availability of runtime routines for shift and division. */
- long long int llmax = 9223372036854775807ll;
- unsigned long long int ullmax = 18446744073709551615ull;
- return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
- | (llmax / ll) | (llmax % ll)
- | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
- | (ullmax / ull) | (ullmax % ull));]])
-])
-
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -1111,6 +1004,7 @@ m4_include([../../m4/kpse-libpng-flags.m4])
m4_include([../../m4/kpse-lt-hack.m4])
m4_include([../../m4/kpse-macos-framework.m4])
m4_include([../../m4/kpse-obsdcompat-flags.m4])
+m4_include([../../m4/kpse-poppler-flags.m4])
m4_include([../../m4/kpse-ptexenc-flags.m4])
m4_include([../../m4/kpse-socket-libs.m4])
m4_include([../../m4/kpse-teckit-flags.m4])
diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure
index 0ac3eee1d18..c9ad5135911 100755
--- a/Build/source/texk/web2c/configure
+++ b/Build/source/texk/web2c/configure
@@ -624,6 +624,7 @@ CTANGLE
CTANGLEBOOT
TANGLE
TANGLEBOOT
+TXTTOZLIB
OBSDCOMPAT_RULE
OBSDCOMPAT_DEPEND
OBSDCOMPAT_LIBS
@@ -649,6 +650,10 @@ ZZIPLIB_RULE
ZZIPLIB_DEPEND
ZZIPLIB_LIBS
ZZIPLIB_INCLUDES
+POPPLER_RULE
+POPPLER_DEPEND
+POPPLER_LIBS
+POPPLER_INCLUDES
XPDF_RULE
XPDF_DEPEND
XPDF_LIBS
@@ -927,6 +932,7 @@ with_zlib_includes
with_zlib_libdir
with_system_libpng
with_system_xpdf
+with_system_poppler
with_system_zziplib
with_system_graphite
with_system_freetype2
@@ -1655,6 +1661,8 @@ Optional Packages:
pkg-config)
--with-system-xpdf use installed poppler headers and library instead of
xpdf (requires pkg-config)
+ --with-system-poppler use installed poppler headers and library instead of
+ poppler (requires pkg-config)
--with-system-zziplib use installed zziplib headers and library (requires
pkg-config)
--with-system-graphite use installed silgraphite headers and library
@@ -17347,7 +17355,7 @@ case $enable_luatex in #(
esac
test "x$enable_web2c:$enable_luatex" = xyes:yes && {
- need_xpdf=yes
+ need_poppler=yes
need_libpng=yes
need_obsdcompat=yes
need_zziplib=yes
@@ -19757,18 +19765,18 @@ else
/* end confdefs.h. */
/* For now, do not test the preprocessor; as of 2007 there are too many
- implementations with broken preprocessors. Perhaps this can
- be revisited in 2012. In the meantime, code should not expect
- #if to work with literals wider than 32 bits. */
+ implementations with broken preprocessors. Perhaps this can
+ be revisited in 2012. In the meantime, code should not expect
+ #if to work with literals wider than 32 bits. */
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
- ? 1 : -1)];
+ ? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
- ? 1 : -1)];
+ ? 1 : -1)];
int i = 63;
int
main ()
@@ -19777,40 +19785,40 @@ main ()
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
- | (llmax / ll) | (llmax % ll)
- | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
- | (ullmax / ull) | (ullmax % ull));
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- if test "$cross_compiling" = yes; then :
+ if test "$cross_compiling" = yes; then :
ac_cv_type_long_long_int=yes
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <limits.h>
- #ifndef LLONG_MAX
- # define HALF \
- (1LL << (sizeof (long long int) * CHAR_BIT - 2))
- # define LLONG_MAX (HALF - 1 + HALF)
- #endif
+ #ifndef LLONG_MAX
+ # define HALF \
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+ # define LLONG_MAX (HALF - 1 + HALF)
+ #endif
int
main ()
{
long long int n = 1;
- int i;
- for (i = 0; ; i++)
- {
- long long int m = n << i;
- if (m >> i != n)
- return 1;
- if (LLONG_MAX / 2 < m)
- break;
- }
- return 0;
+ int i;
+ for (i = 0; ; i++)
+ {
+ long long int m = n << i;
+ if (m >> i != n)
+ return 1;
+ if (LLONG_MAX / 2 < m)
+ break;
+ }
+ return 0;
;
return 0;
}
@@ -21994,6 +22002,36 @@ ${top_builddir}/../../libs/xpdf/xpdf/Stream.h:
cd ${top_builddir}/../../libs/xpdf && $(MAKE) $(AM_MAKEFLAGS) rebuild'
fi
+## _KPSE_LIB_FLAGS: Setup poppler (-lpoppler) flags
+
+# Check whether --with-system-poppler was given.
+if test "${with_system_poppler+set}" = set; then :
+ withval=$with_system_poppler;
+fi
+if test "x$with_system_poppler" = xyes; then
+ if $PKG_CONFIG poppler --atleast-version=0.10; then
+ POPPLER_VERSION='-DPOPPLER_VERSION=\"'`$PKG_CONFIG poppler --modversion`'\"'
+ POPPLER_INCLUDES="$POPPLER_VERSION `$PKG_CONFIG poppler --cflags`"
+ POPPLER_LIBS=`$PKG_CONFIG poppler --libs`
+elif test "x$need_poppler:$with_system_poppler" = xyes:yes; then
+ as_fn_error $? "did not find poppler-0.10 or better" "$LINENO" 5
+fi
+else
+ POPPLER_INCLUDES=`echo '-DPDF_PARSER_ONLY -IBLD/libs/poppler -IBLD/libs/poppler/goo -IBLD/libs/poppler/poppler' | sed \
+ -e "s,SRC/,$kpse_SRC/,g" \
+ -e "s,BLD/,$kpse_BLD/,g"`
+ POPPLER_LIBS=`echo 'BLD/libs/poppler/libpoppler.a' | sed \
+ -e "s,BLD/,$kpse_BLD/,g"`
+
+ POPPLER_DEPEND=`echo 'BLD/libs/poppler/libpoppler.a' | sed \
+ -e 's,BLD/,${top_builddir}/../../,g'`
+ POPPLER_RULE='# Rebuild libpoppler
+$(POPPLER_DEPEND): ${top_builddir}/../../libs/poppler/poppler/Stream.h
+ cd ${top_builddir}/../../libs/poppler && $(MAKE) $(AM_MAKEFLAGS) rebuild
+${top_builddir}/../../libs/poppler/poppler/Stream.h:
+ cd ${top_builddir}/../../libs/poppler && $(MAKE) $(AM_MAKEFLAGS) rebuild'
+fi
+
## _KPSE_LIB_FLAGS: Setup zziplib (-lzzip) flags
# Check whether --with-system-zziplib was given.
@@ -22297,6 +22335,58 @@ CPPFLAGS=$kpse_save_CPPFLAGS
LIBS=$kpse_save_LIBS
+# Checks for xpdf (libpoppler) features.
+eval CPPFLAGS=\"$POPPLER_INCLUDES \$CPPFLAGS\"
+eval LIBS=\"$POPPLER_LIBS \$LIBS\"
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ac_link="./libtool --mode=link --tag=CXX $ac_link"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PDFDoc::getPDFMajorVersion" >&5
+$as_echo_n "checking for PDFDoc::getPDFMajorVersion... " >&6; }
+if ${kpse_cv_have_getPDFMajorVersion+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <PDFDoc.h>
+int
+main ()
+{
+PDFDoc *pdfDoc; pdfDoc->getPDFMajorVersion();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ kpse_cv_have_getPDFMajorVersion=yes
+else
+ kpse_cv_have_getPDFMajorVersion=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $kpse_cv_have_getPDFMajorVersion" >&5
+$as_echo "$kpse_cv_have_getPDFMajorVersion" >&6; }
+if test "x$kpse_cv_have_getPDFMajorVersion" = xyes; then :
+
+$as_echo "#define HAVE_GETPDFMAJORVERSION 1" >>confdefs.h
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_link="./libtool --mode=link --tag=CC $ac_link"
+
+CPPFLAGS=$kpse_save_CPPFLAGS
+LIBS=$kpse_save_LIBS
+
+
ac_config_headers="$ac_config_headers w2c/c-auto.h:c-auto.in"
@@ -22305,6 +22395,55 @@ ac_config_headers="$ac_config_headers w2c/c-auto.h:c-auto.in"
ac_config_headers="$ac_config_headers ff-config.h:luatexdir/luafontloader/ff-config.in"
+if test "x$cross_compiling" = xyes; then
+# Extract the first word of "txt2zlib", so it can be a program name with args.
+set dummy txt2zlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_TXTTOZLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $TXTTOZLIB in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_TXTTOZLIB="$TXTTOZLIB" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_TXTTOZLIB="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+TXTTOZLIB=$ac_cv_path_TXTTOZLIB
+if test -n "$TXTTOZLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TXTTOZLIB" >&5
+$as_echo "$TXTTOZLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test -z "${TXTTOZLIB}"; then
+ as_fn_error $? "txt2zlib was not found but is required when cross-compiling.
+ Install txt2zlib or set \$TXTTOZLIB to the full pathname." "$LINENO" 5
+fi
+else
+ TXTTOZLIB=./txt2zlib
+fi
+
# For cross-compilation. Put at the end so there is a fair chance
# these are still visible when the configure script has finished.
@@ -23337,9 +23476,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/web2c/configure.ac b/Build/source/texk/web2c/configure.ac
index 95d5df2ee3d..68033caaf36 100644
--- a/Build/source/texk/web2c/configure.ac
+++ b/Build/source/texk/web2c/configure.ac
@@ -251,6 +251,7 @@ KPSE_PTEXENC_FLAGS
KPSE_ZLIB_FLAGS
KPSE_LIBPNG_FLAGS
KPSE_XPDF_FLAGS
+KPSE_POPPLER_FLAGS
KPSE_ZZIPLIB_FLAGS
KPSE_GRAPHITE_FLAGS
KPSE_FREETYPE2_FLAGS
@@ -273,6 +274,21 @@ AS_IF([test "x$kpse_cv_have_getPDFMajorVersion" = xyes],
AC_LANG_POP([C++])
KPSE_RESTORE_FLAGS
+# Checks for xpdf (libpoppler) features.
+KPSE_ADD_FLAGS([poppler])
+AC_LANG_PUSH([C++])
+AC_CACHE_CHECK([for PDFDoc::getPDFMajorVersion],
+ [kpse_cv_have_getPDFMajorVersion],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <PDFDoc.h>]],
+ [[PDFDoc *pdfDoc; pdfDoc->getPDFMajorVersion();]])],
+ [kpse_cv_have_getPDFMajorVersion=yes],
+ [kpse_cv_have_getPDFMajorVersion=no])])
+AS_IF([test "x$kpse_cv_have_getPDFMajorVersion" = xyes],
+ [AC_DEFINE([HAVE_GETPDFMAJORVERSION], 1,
+ [Define to 1 if class `PDFDoc' has the `getPDFMajorVersion' member.])])
+AC_LANG_POP([C++])
+KPSE_RESTORE_FLAGS
+
dnl Write output here, instead of putting a zillion -D's on the command line.
AC_CONFIG_HEADERS([w2c/c-auto.h:c-auto.in],
[sed -e 's/^#define PACKAGE/#define WEB2C_PACKAGE/' \
@@ -307,6 +323,8 @@ AH_BOTTOM([#endif /* !WEB2C_C_AUTO_H */])
dnl Additional config header for luaTeX
AC_CONFIG_HEADERS([ff-config.h:luatexdir/luafontloader/ff-config.in])
+dnl This is also for luatex
+KPSE_CROSS_PATH_PROG([TXTTOZLIB], [txt2zlib], [./txt2zlib])
# For cross-compilation. Put at the end so there is a fair chance
# these are still visible when the configure script has finished.
diff --git a/Build/source/texk/web2c/doc/Makefile.in b/Build/source/texk/web2c/doc/Makefile.in
index 4d641ebd702..91ab9b87859 100644
--- a/Build/source/texk/web2c/doc/Makefile.in
+++ b/Build/source/texk/web2c/doc/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -207,6 +208,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -221,6 +225,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/web2c/lib/Makefile.in b/Build/source/texk/web2c/lib/Makefile.in
index 905c4f71191..a3f4021445a 100644
--- a/Build/source/texk/web2c/lib/Makefile.in
+++ b/Build/source/texk/web2c/lib/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -205,6 +206,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -219,6 +223,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 968c39cff52..d6f92a87dc4 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-12 Taco Hoekwater <taco@luatex.org>
+
+ * import of luatex 0.66.0, released version
+
2011-03-28 Peter Breitenlohner <peb@mppmu.mpg.de>
* am/libluatex.am: Use AM_CFLAGS instead of libluatex_a_CFLAGS.
diff --git a/Build/source/texk/web2c/luatexdir/NEWS b/Build/source/texk/web2c/luatexdir/NEWS
index 8b3ebbd1f87..fad2afefcc8 100644
--- a/Build/source/texk/web2c/luatexdir/NEWS
+++ b/Build/source/texk/web2c/luatexdir/NEWS
@@ -2,6 +2,354 @@
This file is in the public domain.
==============================================================
+Luatex beta-0.66.0 was released 20110512
+==============================================================
+
+News:
+
+* fixed: linebreak_filter doesn't do its default job when
+ tex.linebreak is used
+
+* fixed: \escapechar ignored by \meaning
+
+* fixed: wrong px default
+
+* fixed: font kern attribute inheritance
+
+* fixed: "nop" unrecognized in virtual fonts
+
+* fixed: assertion failure in dviluatex when font ptmr8t used
+
+* fixed: tex.settoks for with strings with embedded zeroes
+
+* fixed: an indexing problem with nonexistent font glyphs
+
+* fixed: some crashes and other bugs on the 'subtype' and 'prev'
+ fields (not all node types have those fields)
+
+* fixed: crash on token.csname_id ("")
+
+* fixed: initialize the statically allocated node's type ids
+
+* fixed: fencepost error in math parameter counting
+
+* fixed: math family numbers > 255 are allowed
+
+* fixed: compilation failure on Hurd
+
+* fixed: a small bug leading to displacements when reading
+ the AccentTop table
+
+* fixed: \directlua followed by \pdfximage generates error if
+ draft mode is active
+
+* fixed: a problem with \vadjust pre in alignments
+
+* fixed: a lua stack growing problem in the backend in 0.65.0,
+ resulting in an inability to create more than a few thousand
+ generated pages
+
+* fixed: inclusion of Scribus-generated pdfs
+
+* adapt: the default form margin is now zero (was 1bp before)
+
+* adapt: libpng 1.4.4, zzuplib 0.13.60, mplib 1.504
+
+* adapt: small changes to the build system and new imports from
+ the texlive repository
+
+* feature: new function node.currentattr() queries the current
+ active attribute list
+
+* feature: Lua font loading; ignore unknown enumeration keys in
+ MathConstants
+
+* feature: JPEG 2000 image support
+
+* feature: continuing work on the 'epdf' library
+
+* doc: the 'epdf' lua library is now documented
+
+* doc: various other manual corrections
+
+
+==============================================================
+Luatex beta-0.65.0 was released 20101213
+==============================================================
+
+News:
+
+* The Aleph and Omega version primitives are deprecated.
+
+* The Apple Snow Leopard Truetype font collections now work
+ properly.
+
+* Libpng has been updated to 1.4.4, and zlib to 1.2.5.
+
+* New lua functions node.next() and node.prev().
+
+* The already deprecated for some time node.protrusion_skipable()
+ function has been removed.
+
+* fontloader.apply_featurefile() and fontloader.apply_afmfile()
+ now return nil,<errortable> on failure.
+
+* The various node list fields in the lua node interface have
+ been renamed from 'list' to 'head', e.g. tex.box[0].head,
+ and the 'list' name is deprecated. For now, the deprecation
+ is silent, as 'list' will stay for quite some time. Please
+ update your lua source as soon as possible, though.
+
+* The call node.type(<node>) now returns "node". The existing
+ functionality is otherwise unchanged.
+
+* Luafilesystem has been updated to 1.5.0. NOTE: there is an
+ incompatible change in the directory iterator method.
+
+* The restriction on linebreak_filter has been eased: at least one
+ horizontal box should be returned, but that is not necessarily
+ the last node any more.
+
+* Backward compatibility has been restored for \meaning\mathchar
+
+* node.first_character() has been renamed to node.first_glyph()
+ to better match its actual functionality.
+
+* The \Umathaccent primitive now supports both/bottom keywords,
+ and \Umathbotaccent / \Umathaccents are now deprecated.
+
+* The \Umathaccent primitive now also supports the fixed keyword,
+ which supports non-growing math accents even if the font says
+ there are extensible variants.
+
+* Ongoing work on the epdf library.
+
+Bugfixes:
+
+* Assignment to \dimen65535 was broken earlier.
+
+* <box>.head.prev is now always initialized to null (0).
+
+* luatex -lua=<script> '\relax' no longer exits immediately,
+ instead going into interactive mode as it should.
+
+* The \jobname was initialized wrongly for input file names
+ with multiple dots in them.
+
+* The synctex file is now written in the right place when
+ --output-directory is given.
+
+* \letterspacefont could cause crashes, especially when combined
+ with font expansion.
+
+* Luatex would crash on linux32 systems if it was build in an
+ environment where LFS (>2GB files) was enabled by default.
+
+* Node lists created by node.copy_list() could not be hyphenated
+ due to an assertion error.
+
+* Synctex support was partially broken since 0.60.0.
+
+* With OpenType math fonts, accents with multiple parts
+ (like the \vec arrow) forgot to include all parts if the
+ accentee was too narrow.
+
+* With OpenType math fonts, accents over any class except 0 and 7
+ were misplaced.
+
+* kpse.lookup("plain", {all = true}) was broken in kpathsea
+ itself (no extension given as well as --all specified).
+
+* A FontForge bug made Cambria Math accents look bad, and the
+ placement of math top accents did not allow a marker at the
+ origin (patches by Stefan Philipp)
+
+* Cut&Paste from PDF was sometimes broken due to bad ToUnicode map.
+
+* Many small manual improvements (thanks to Paul Isambert)
+
+* An other bugfix to lpeg 0.9 (from Roberto Ierusalimsky)
+
+* Some small fixes to writet1.w (from Han The Thanh)
+
+* A build failure because of bad libz configuration on Win32
+
+==============================================================
+Luatex beta-0.64.0 was released 20101112
+==============================================================
+
+News:
+
+* New lua functions pdf.refobj(), pdf.maxobjnum() and pdf.objtype()
+
+* New lua function node.is_node()
+
+* The max_strings configuration variable's maximum value is
+ raised to be identical to texlive's maximum (2097151), and
+ same for param_size (32767).
+
+* The embedded mplib is now 1.503.
+
+* Minor cleanups in the output of fontloader.to_table():
+
+ - removed out-of-range altuni's from the output
+ - don't dump the extra encodings, just the actual font encoding
+ - export the encoding's name also as 'enc_name' at one level up
+ - no longer exporting unset macstyles, nor zero uniqueids
+ - fix creationtime and modification time
+
+* Ongoing work on the epdf library
+
+Bugfixes:
+
+* Fix a bug where an explicit hyphen prevented hyphenation for the
+ whole rest of the paragraph
+
+* Internal font copying forgot to copy the last font dimen
+
+* os.selfdir() is now documented
+
+* patch quad (\fontdimen6) in \letterspacefont to be compatible
+ with pdftex
+
+* Multi-page pdf inclusion was very slow in 0.63.0
+
+* Some extra checks added to the handling of glue_spec node
+ objects in lua code.
+
+* Some node.prev pointers have been corrected (but this is not
+ quite finished).
+
+* A small fix to lpeg 0.9.
+
+
+==============================================================
+Luatex beta-0.63.0 was released 20100909
+==============================================================
+
+News:
+
+* Drop tex.ht[], tex.wd[], tex.dp[].
+
+* Drop OCP support (and associated primitives).
+
+* Add tex.catcode[], tex.lccode[], tex.sfcode[], tex.uccode[],
+ tex.mathcode[] and tex.delcode[] and associated functions.
+
+* Add CIDset tables to the output pdf where appropriate.
+
+* Added a 'string' field to late_lua nodes on the lua side. This
+ field does not convert the assigned string to a tokenlist.
+
+* The result of fontloader.open() now has some virtual accessors
+ (as well as fontloader.to_table).
+
+* There is now a `short reference' in the manual folder
+ (functionref.pdf)
+
+Bugfixes:
+
+* Fix a crash on an empty font (bugreport #468).
+
+* Fix a crash for extremely long pattern arguments.
+
+* Fix a crash on bad virtual character arguments in lua.
+
+* Fix hyphenation exceptions.
+
+* Prevent linebreak between initial local_par paragraph whatsit
+ and a following skip (bugreport #437).
+
+* Fix placement of scripts on textstyle big operators in MATH
+ fonts (bugreport #466).
+
+* Fix a crash on the return value of MPlib's 'postscript'
+ operation on images.
+
+* Fix a crash on \leftghost & \rightghost in math mode.
+
+==============================================================
+Luatex beta-0.62.0 was released 20100823
+==============================================================
+
+News:
+
+* LuaTeX now uses libpoppler (0.12.4) instead of xpdf.
+
+* All backend functions now report what file they were searching
+ for whenever a file cannot be found.
+
+* Input-ed lua files are now mentioned in the fls file if
+ the --recorder switch is specified on the command line.
+
+* Paragraph indentation hlist nodes and hlist and vlist nodes
+ generated by alignment rows and cells now have a subtype
+ (3 for indent box, 4 for rows/columns, 5 for cells).
+
+* The 'epdf' lib is in active development and still growing.
+
+* The 'fontforge' table is finally removed (was deprecated
+ since 0.40).
+
+Bugfixes:
+
+* A new mplib import fixes two bad bugs in mplib:
+ - string equality test was wrong
+ - type declarations could delete pre-existing variables
+
+* PNG images with transparency could create random size
+ differences in the generated PDF.
+
+* In some special cases, font expansion could cause wrong
+ spacing in the generated PDF.
+
+* \letterspacefont was broken since a very long time.
+
+* The node subtype of the \leftskip and \rightskip glues was
+ wrong.
+
+* Some memory leaks have been removed.
+
+* Various manual fixes.
+
+==============================================================
+Luatex beta-0.61.0 was released 20100728
+==============================================================
+
+New features:
+
+* New lua library 'epdf' for introspection of PDF inclusions,
+ see the manual for details.
+
+* Mplib version 1.502 is now included (which is still beta,
+ so be careful).
+
+* new "finish_pdffile" and "pre_dump" callbacks.
+
+* new function pdf.pageref()
+
+* In the lua 'tex' library: assignment to internal glue
+ parameters is now allowed.
+
+* New lua function tex.error().
+
+Bugfixes:
+
+* Fix for crashes on fonts with bad Panose values.
+
+* Fix for a box placement bug that could sometimes cause text
+ to overlap.
+
+* Fix for a few small PDF/A1-a compatibility bugs.
+
+* Fix \letterspacefont.
+
+* Fix \Ustopdisplaymath in combination with aligned displays.
+
+* In math delimiters, the last of a chain of predefined sizes
+ was always ignored if there were also extensible parts.
+
+==============================================================
Luatex beta-0.60.2 was released 20100701
==============================================================
@@ -1551,7 +1899,7 @@ Other news:
we probably introduced new problems as well).
* Most (all?) files now have a corrected Copyright header,
- and link in $Id$ and $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/NEWS $ into the object file.
+ and link in $Id$ and $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/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/am/liblua51.am b/Build/source/texk/web2c/luatexdir/am/liblua51.am
index 1067e4da432..8f4e80782c0 100644
--- a/Build/source/texk/web2c/luatexdir/am/liblua51.am
+++ b/Build/source/texk/web2c/luatexdir/am/liblua51.am
@@ -7,7 +7,7 @@
##
EXTRA_LIBRARIES += liblua51.a
-liblua51_a_CPPFLAGS = -I$(top_srcdir)/luatexdir/lua51
+liblua51_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/luatexdir/lua51
if !MINGW32
liblua51_a_CPPFLAGS += -DLUA_USE_POSIX
endif !MINGW32
diff --git a/Build/source/texk/web2c/luatexdir/am/libluatex.am b/Build/source/texk/web2c/luatexdir/am/libluatex.am
index 072c448974c..73a909d32a4 100644
--- a/Build/source/texk/web2c/luatexdir/am/libluatex.am
+++ b/Build/source/texk/web2c/luatexdir/am/libluatex.am
@@ -10,7 +10,7 @@ EXTRA_LIBRARIES += libluatex.a
libluatex_a_DEPENDENCIES = libff.a
libluatex_a_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES)
-libluatex_a_CPPFLAGS += $(XPDF_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5
+libluatex_a_CPPFLAGS += $(POPPLER_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5
libluatex_a_CPPFLAGS += -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51
libluatex_a_CPPFLAGS += -DpdfTeX
libluatex_a_CPPFLAGS += -I$(srcdir)/synctexdir -DSYNCTEX_ENGINE_H='<utils/synctex-luatex.h>'
@@ -89,22 +89,23 @@ nodist_libluatex_a_SOURCES += writetype0.c writetype2.c
luatex_image_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/image $(ctangle)
-epdf.c: ctangle$(EXEEXT) luatexdir/image/epdf.w
- $(luatex_image_ctangle) epdf.w
writeimg.c: ctangle$(EXEEXT) luatexdir/image/writeimg.w
$(luatex_image_ctangle) writeimg.w
writejbig2.c: ctangle$(EXEEXT) luatexdir/image/writejbig2.w
$(luatex_image_ctangle) writejbig2.w
writejpg.c: ctangle$(EXEEXT) luatexdir/image/writejpg.w
$(luatex_image_ctangle) writejpg.w
+writejp2.c: ctangle$(EXEEXT) luatexdir/image/writejp2.w
+ $(luatex_image_ctangle) writejp2.w
writepng.c: ctangle$(EXEEXT) luatexdir/image/writepng.w
$(luatex_image_ctangle) writepng.w
-libluatex_web += luatexdir/image/epdf.w luatexdir/image/writeimg.w
-libluatex_web += luatexdir/image/writejbig2.w luatexdir/image/writejpg.w luatexdir/image/writepng.w
-
-nodist_libluatex_a_SOURCES += epdf.c writeimg.c writejbig2.c writejpg.c writepng.c
+libluatex_web += luatexdir/image/writeimg.w
+libluatex_web += luatexdir/image/writejbig2.w
+libluatex_web += luatexdir/image/writejpg.w luatexdir/image/writejp2.w
+libluatex_web += luatexdir/image/writepng.w
+nodist_libluatex_a_SOURCES += writeimg.c writejbig2.c writejpg.c writejp2.c writepng.c
luatex_lua_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/lua $(ctangle)
@@ -126,24 +127,17 @@ libluatex_web += luatexdir/lua/luastuff.w luatexdir/lua/luatoken.w luatexdir/lua
nodist_libluatex_a_SOURCES += luagen.c luainit.c luanode.c luastuff.c luatoken.c texluac.c
+##**********************************************************************
-luatex_ocp_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/ocp $(ctangle)
-
-ocp.c: ctangle$(EXEEXT) luatexdir/ocp/ocp.w
- $(luatex_ocp_ctangle) ocp.w
-
-runocp.c: ctangle$(EXEEXT) luatexdir/ocp/runocp.w
- $(luatex_ocp_ctangle) runocp.w
-
-readocp.c: ctangle$(EXEEXT) luatexdir/ocp/readocp.w
- $(luatex_ocp_ctangle) readocp.w
+luatex_luascripts_txt2zlib = $(TXTTOZLIB)
+luatex_luascripts_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/luascripts $(ctangle)
-ocplist.c: ctangle$(EXEEXT) luatexdir/ocp/ocplist.w
- $(luatex_ocp_ctangle) ocplist.w
+pdflua.c: txt2zlib$(EXEEXT) luatexdir/luascripts/pdflua.lua
+ $(luatex_luascripts_txt2zlib) $(srcdir)/luatexdir/luascripts/pdflua.lua pdflua.c
-libluatex_web += luatexdir/ocp/ocp.w luatexdir/ocp/ocplist.w luatexdir/ocp/readocp.w luatexdir/ocp/runocp.w
+nodist_libluatex_a_SOURCES += pdflua.c
-nodist_libluatex_a_SOURCES += ocp.c ocplist.c readocp.c runocp.c
+##**********************************************************************
luatex_lang_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/lang $(ctangle)
@@ -198,6 +192,9 @@ pdflistout.c: ctangle$(EXEEXT) luatexdir/pdf/pdflistout.w
pdfliteral.c: ctangle$(EXEEXT) luatexdir/pdf/pdfliteral.w
$(luatex_pdf_ctangle) pdfliteral.w
+pdfluaapi.c: ctangle$(EXEEXT) luatexdir/pdf/pdfluaapi.w
+ $(luatex_pdf_ctangle) pdfluaapi.w
+
pdfobj.c: ctangle$(EXEEXT) luatexdir/pdf/pdfobj.w
$(luatex_pdf_ctangle) pdfobj.w
@@ -232,15 +229,15 @@ libluatex_web += luatexdir/pdf/pagetree.w luatexdir/pdf/pdfaction.w luatexdir/pd
libluatex_web += luatexdir/pdf/pdfcolorstack.w luatexdir/pdf/pdfdest.w
libluatex_web += luatexdir/pdf/pdffont.w luatexdir/pdf/pdfgen.w luatexdir/pdf/pdfglyph.w
libluatex_web += luatexdir/pdf/pdfimage.w luatexdir/pdf/pdflink.w luatexdir/pdf/pdflistout.w
-libluatex_web += luatexdir/pdf/pdfliteral.w luatexdir/pdf/pdfobj.w luatexdir/pdf/pdfoutline.w
-libluatex_web += luatexdir/pdf/pdfpage.w luatexdir/pdf/pdfrule.w
+libluatex_web += luatexdir/pdf/pdfliteral.w luatexdir/pdf/pdfluaapi.w luatexdir/pdf/pdfobj.w
+libluatex_web += luatexdir/pdf/pdfoutline.w luatexdir/pdf/pdfpage.w luatexdir/pdf/pdfrule.w
libluatex_web += luatexdir/pdf/pdfsaverestore.w luatexdir/pdf/pdfsetmatrix.w
libluatex_web += luatexdir/pdf/pdfshipout.w luatexdir/pdf/pdftables.w
libluatex_web += luatexdir/pdf/pdfthread.w luatexdir/pdf/pdfxform.w
nodist_libluatex_a_SOURCES += pagetree.c pdfaction.c pdfannot.c pdfcolorstack.c pdfdest.c pdffont.c
nodist_libluatex_a_SOURCES += pdfgen.c pdfglyph.c pdfimage.c pdflink.c pdflistout.c pdfliteral.c
-nodist_libluatex_a_SOURCES += pdfobj.c pdfoutline.c pdfpage.c pdfrule.c pdfsaverestore.c
+nodist_libluatex_a_SOURCES += pdfluaapi.c pdfobj.c pdfoutline.c pdfpage.c pdfrule.c pdfsaverestore.c
nodist_libluatex_a_SOURCES += pdfsetmatrix.c pdfshipout.c pdftables.c pdfthread.c pdfxform.c
luatex_tex_ctangle = CWEBINPUTS=$(srcdir)/luatexdir/tex $(ctangle)
@@ -530,6 +527,7 @@ libluatex_a_SOURCES = \
luatexdir/image/writeimg.h \
luatexdir/image/writejbig2.h \
luatexdir/image/writejpg.h \
+ luatexdir/image/writejp2.h \
luatexdir/image/writepng.h \
luatexdir/lang/hnjalloc.h \
luatexdir/lang/hyphen.h \
@@ -541,6 +539,7 @@ libluatex_a_SOURCES = \
luatexdir/lua/lkpselib.c \
luatexdir/lua/llanglib.c \
luatexdir/lua/llualib.c \
+ luatexdir/lua/llfslibext.c \
luatexdir/lua/lnodelib.c \
luatexdir/lua/loslibext.c \
luatexdir/lua/liolib.c \
@@ -551,11 +550,8 @@ libluatex_a_SOURCES = \
luatexdir/lua/ltokenlib.c \
luatexdir/lua/luagen.h \
luatexdir/lua/luatex-api.h \
+ luatexdir/luascripts/pdflua.h \
luatexdir/luatex.h \
- luatexdir/ocp/ocp.h \
- luatexdir/ocp/ocplist.h \
- luatexdir/ocp/readocp.h \
- luatexdir/ocp/runocp.h \
luatexdir/pdf/pagetree.h \
luatexdir/pdf/pdfaction.h \
luatexdir/pdf/pdfannot.h \
@@ -568,6 +564,7 @@ libluatex_a_SOURCES = \
luatexdir/pdf/pdflink.h \
luatexdir/pdf/pdflistout.h \
luatexdir/pdf/pdfliteral.h \
+ luatexdir/pdf/pdfluaapi.h \
luatexdir/pdf/pdfobj.h \
luatexdir/pdf/pdfoutline.h \
luatexdir/pdf/pdfpage.h \
@@ -617,8 +614,8 @@ libluatex_a_SOURCES = \
luatexdir/utils/managed-sa.h \
luatexdir/utils/synctex-common.h \
luatexdir/utils/synctex-luatex.h \
- luatexdir/utils/synctex.c \
luatexdir/utils/synctex.h \
+ luatexdir/utils/synctex.c \
luatexdir/utils/utils.h
nodist_libluatex_a_SOURCES += \
diff --git a/Build/source/texk/web2c/luatexdir/am/luafontforge.am b/Build/source/texk/web2c/luatexdir/am/luafontforge.am
index 5f90b53b5b7..7864ac82ac5 100644
--- a/Build/source/texk/web2c/luatexdir/am/luafontforge.am
+++ b/Build/source/texk/web2c/luatexdir/am/luafontforge.am
@@ -11,8 +11,7 @@ libff_a_DEPENDENCIES = libluamisc.a
$(libff_a_OBJECTS): $(libff_a_DEPENDENCIES)
-libff_a_CPPFLAGS = \
- $(AM_CPPFLAGS) \
+libff_a_CPPFLAGS = $(AM_CPPFLAGS) \
-DFONTFORGE_CONFIG_NO_WINDOWING_UI=1 -DLUA_FF_LIB=1 \
-D_NO_PYTHON=1 -DX_DISPLAY_MISSING=1 -DNODYNAMIC=1 \
-D_NO_FREETYPE=1 -D_NO_LIBUNINAMESLIST=1 -UHAVE_LIBINTL_H \
diff --git a/Build/source/texk/web2c/luatexdir/am/luamisc.am b/Build/source/texk/web2c/luatexdir/am/luamisc.am
index 5f43cf2b64a..8518f3022ce 100644
--- a/Build/source/texk/web2c/luatexdir/am/luamisc.am
+++ b/Build/source/texk/web2c/luatexdir/am/luamisc.am
@@ -12,7 +12,7 @@ libluamisc_a_DEPENDENCIES = $(ZZIPLIB_DEPEND) libluasocket.a
$(libluamisc_a_OBJECTS): $(libluamisc_a_DEPENDENCIES)
-libluamisc_a_CPPFLAGS = \
+libluamisc_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(ZLIB_INCLUDES) \
$(ZZIPLIB_INCLUDES) \
-I$(top_srcdir)/luatexdir/lua51
diff --git a/Build/source/texk/web2c/luatexdir/am/luasocket.am b/Build/source/texk/web2c/luatexdir/am/luasocket.am
index 4dfb0149861..03b947ede2c 100644
--- a/Build/source/texk/web2c/luatexdir/am/luasocket.am
+++ b/Build/source/texk/web2c/luatexdir/am/luasocket.am
@@ -11,7 +11,7 @@ libluasocket_a_DEPENDENCIES = $(ZLIB_DEPEND) liblua51.a
$(libluasocket_a_OBJECTS): liblua51.a
-libluasocket_a_CPPFLAGS = \
+libluasocket_a_CPPFLAGS = $(AM_CPPFLAGS) \
-DLUASOCKET_DEBUG -I$(top_srcdir)/luatexdir/luasocket -I$(srcdir)/luatexdir/lua51
libluasocket_a_CFLAGS = # $(WARNING_CFLAGS)
diff --git a/Build/source/texk/web2c/luatexdir/am/luatex.am b/Build/source/texk/web2c/luatexdir/am/luatex.am
index 84cd5adf423..d438ad2cbad 100644
--- a/Build/source/texk/web2c/luatexdir/am/luatex.am
+++ b/Build/source/texk/web2c/luatexdir/am/luatex.am
@@ -21,14 +21,14 @@ EXTRA_PROGRAMS += luatex
nodist_EXTRA_luatex_SOURCES = dummy.cxx
luatex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES)
-luatex_CPPFLAGS += $(XPDF_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5
+luatex_CPPFLAGS += $(POPPLER_INCLUDES) $(OBSDCOMPAT_INCLUDES) -I$(srcdir)/libmd5
luatex_CPPFLAGS += -I$(srcdir)/luatexdir -I$(srcdir)/luatexdir/lua51 -I$(srcdir)/mplibdir
luatex_CPPFLAGS += -Dextra_version_info=`date +-%Y%m%d%H`
luatex_CPPFLAGS += -I$(srcdir)/synctexdir -DSYNCTEX_ENGINE_H='<utils/synctex-luatex.h>'
luatex_CXXFLAGS = $(WARNING_CXXFLAGS)
luatex_ldadd = libluatex.a libff.a libluamisc.a libluasocket.a liblua51.a
-luatex_ldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(XPDF_LIBS)
+luatex_ldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)
luatex_ldadd += $(OBSDCOMPAT_LIBS) libmd5.a libmplib.a
luatex_LDFLAGS = -export-dynamic
@@ -36,7 +36,7 @@ luatex_LDFLAGS = -export-dynamic
luatex_LDADD = $(luatex_ldadd) $(LDADD) $(LIBADD_DLOPEN) $(lua_socketlibs)
luatex_DEPENDENCIES = $(proglib) $(KPATHSEA_DEPEND) libluatex.a
-luatex_DEPENDENCIES += $(LIBPNG_DEPEND) $(ZLIB_DEPEND) $(XPDF_DEPEND)
+luatex_DEPENDENCIES += $(LIBPNG_DEPEND) $(ZLIB_DEPEND) $(POPPLER_DEPEND)
luatex_DEPENDENCIES += $(OBSDCOMPAT_DEPEND) libmd5.a libmplib.a
$(luatex_OBJECTS): libluatex.a
diff --git a/Build/source/texk/web2c/luatexdir/am/txt2zlib.am b/Build/source/texk/web2c/luatexdir/am/txt2zlib.am
new file mode 100644
index 00000000000..4936ac7a28b
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/am/txt2zlib.am
@@ -0,0 +1,19 @@
+## texk/web2c/luatexdir/am/txt2zlib.am: Makefile fragment for txt2zlib.
+##
+## Copyright (C) 2010 Hartmut Henkel <hartmut@luatex.org>
+## You may freely use, modify and/or distribute this file.
+##
+## $Id: txt2zlib.am 3958 2010-11-12 22:57:13Z hhenkel $
+
+noinst_PROGRAMS += txt2zlib
+
+nodist_txt2zlib_SOURCES = txt2zlib.c
+txt2zlib_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
+txt2zlib_DEPENDENCIES = $(ZLIB_DEPEND)
+txt2zlib_CFLAGS = $(WARNING_CFLAGS)
+txt2zlib_LDADD = $(ZLIB_LIBS) $(LDADD)
+DISTCLEANFILES += txt2zlib.c
+
+txt2zlib.c: ctangle$(EXEEXT) luatexdir/luascripts/txt2zlib.w
+ $(luatex_luascripts_ctangle) txt2zlib.w
+
diff --git a/Build/source/texk/web2c/luatexdir/dvi/dvigen.w b/Build/source/texk/web2c/luatexdir/dvi/dvigen.w
index 48336a2919f..b119c9fcdb3 100644
--- a/Build/source/texk/web2c/luatexdir/dvi/dvigen.w
+++ b/Build/source/texk/web2c/luatexdir/dvi/dvigen.w
@@ -30,8 +30,8 @@
@ Initial identification of this file, and the needed headers.
@c
static const char _svn_version[] =
- "$Id: dvigen.w 3612 2010-04-13 09:29:42Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/dvi/dvigen.w $";
+ "$Id: dvigen.w 3802 2010-08-07 12:03:08Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/dvi/dvigen.w $";
#include "ptexlib.h"
@@ -1191,10 +1191,11 @@ void write_out(halfword p)
if (callback_id > 0) {
lua_retval = run_callback(callback_id, "S->S", s, &ss);
if ((lua_retval == true) && (ss != NULL))
- s = ss;
+ { xfree(s); s = ss; }
}
}
tprint(s);
+ xfree(s);
print_ln();
flush_list(def_ref);
if (j == 18) {
diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.w b/Build/source/texk/web2c/luatexdir/font/dofont.w
index 3dad8b50abe..57e35858102 100644
--- a/Build/source/texk/web2c/luatexdir/font/dofont.w
+++ b/Build/source/texk/web2c/luatexdir/font/dofont.w
@@ -24,7 +24,7 @@
static const char _svn_version[] =
"$Id: dofont.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/dofont.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/dofont.w $";
@ a bit more interfacing is needed for proper error reporting
diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w
index 6ea114de45a..181e825847c 100644
--- a/Build/source/texk/web2c/luatexdir/font/luafont.w
+++ b/Build/source/texk/web2c/luatexdir/font/luafont.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: luafont.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/luafont.w $";
+ "$Id: luafont.w 4125 2011-04-11 09:06:59Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/luafont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -103,6 +103,24 @@ const char *MATH_param_names[] = {
NULL,
};
+/* here for now, may be useful elsewhere */
+
+int ff_checkoption (lua_State *L, int narg, const char *def,
+ const char *const lst[]);
+
+int ff_checkoption (lua_State *L, int narg, const char *def,
+ const char *const lst[]) {
+ const char *name = (def) ? luaL_optstring(L, narg, def) :
+ luaL_checkstring(L, narg);
+ int i;
+ for (i=0; lst[i]; i++)
+ if (strcmp(lst[i], name) == 0)
+ return i;
+ return -1;
+}
+
+
+
static void dump_intfield(lua_State * L, const char *n, int c)
{
lua_pushstring(L, n);
@@ -368,7 +386,7 @@ static void write_lua_math_parameters(lua_State * L, int f)
{
int k;
lua_newtable(L);
- for (k = 1; k < font_math_params(f); k++) {
+ for (k = 1; k <= font_math_params(f); k++) {
lua_pushnumber(L, font_math_param(f, k));
if (k <= MATH_param_max) {
lua_setfield(L, -2, MATH_param_names[k]);
@@ -455,11 +473,11 @@ int font_to_lua(lua_State * L, int f)
lua_pushnumber(L,pdf_font_num(f));
lua_setfield(L,-2,"pdf_num");
}
- if (pdf_font_blink(f) != 0) {
+ if (pdf_font_blink(f) != null_font) {
lua_pushnumber(L,pdf_font_blink(f));
lua_setfield(L,-2,"pdf_blink");
}
- if (pdf_font_elink(f) != 0) {
+ if (pdf_font_elink(f) != null_font) {
lua_pushnumber(L,pdf_font_elink(f));
lua_setfield(L,-2,"pdf_elink");
}
@@ -708,6 +726,7 @@ make_luaS_index(font);
make_luaS_index(char);
make_luaS_index(slot);
make_luaS_index(comment);
+make_luaS_index(nop);
make_luaS_index(push);
make_luaS_index(pop);
make_luaS_index(rule);
@@ -763,6 +782,7 @@ static void init_font_string_pointers(lua_State * L)
init_luaS_index(char);
init_luaS_index(slot);
init_luaS_index(comment);
+ init_luaS_index(nop);
init_luaS_index(push);
init_luaS_index(pop);
init_luaS_index(rule);
@@ -823,7 +843,8 @@ static int count_char_packet_bytes(lua_State * L)
} else if (luaS_ptr_eq(s, slot)) {
l += 10;
ff = 1;
- } else if (luaS_ptr_eq(s, comment)) {;
+ } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) {
+ ;
} else if (luaS_ptr_eq(s, push) || luaS_ptr_eq(s, pop)) {
l++;
} else if (luaS_ptr_eq(s, rule)) {
@@ -834,10 +855,15 @@ static int count_char_packet_bytes(lua_State * L)
} else if (luaS_ptr_eq(s, special)) {
size_t len;
lua_rawgeti(L, -2, 2);
- (void) lua_tolstring(L, -1, &len);
- lua_pop(L, 1);
- if (len > 0) {
- l = (int) (l + 5 + (int) len);
+ if (lua_isstring(L, -1)) {
+ (void) lua_tolstring(L, -1, &len);
+ lua_pop(L, 1);
+ if (len > 0) {
+ l = (int) (l + 5 + (int) len);
+ }
+ } else {
+ lua_pop(L, 1);
+ fprintf(stdout, "invalid packet special!\n");
}
} else if (luaS_ptr_eq(s, image)) {
l += 5;
@@ -905,16 +931,16 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
} else if (luaS_ptr_eq(s, slot)) {
cmd = packet_nop_code;
lua_rawgeti(L, -2, 2);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
ff = (n > max_f ? l_fonts[1] : l_fonts[n]);
lua_rawgeti(L, -3, 3);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
lua_pop(L, 2);
append_packet(packet_font_code);
do_store_four(ff);
append_packet(packet_char_code);
do_store_four(n);
- } else if (luaS_ptr_eq(s, comment)) {
+ } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) {
cmd = packet_nop_code;
} else if (luaS_ptr_eq(s, node)) {
cmd = packet_node_code;
@@ -942,7 +968,7 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
case packet_font_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
ff = (n > max_f ? l_fonts[1] : l_fonts[n]);
do_store_four(ff);
lua_pop(L, 1);
@@ -957,7 +983,7 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
case packet_char_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
do_store_four(n);
lua_pop(L, 1);
break;
@@ -965,24 +991,24 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
case packet_down_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
do_store_four(sp_to_dvi(n, atsize));
lua_pop(L, 1);
break;
case packet_rule_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
do_store_four(sp_to_dvi(n, atsize));
lua_rawgeti(L, -3, 3);
- n = (int) lua_tointeger(L, -1);
+ n = (int) luaL_checkinteger(L, -1);
do_store_four(sp_to_dvi(n, atsize));
lua_pop(L, 2);
break;
case packet_special_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
- s = lua_tolstring(L, -1, &l);
+ s = luaL_checklstring(L, -1, &l);
if (l > 0) {
do_store_four(l);
m = (int) l;
@@ -1125,10 +1151,10 @@ static void read_lua_math_parameters(lua_State * L, int f)
if (lua_isnumber(L, -2)) {
lua_number2int(i, lua_tonumber(L, -2));
} else if (lua_isstring(L, -2)) {
- i = luaL_checkoption(L, -2, NULL, MATH_param_names);
+ i = ff_checkoption(L, -2, NULL, MATH_param_names);
}
lua_number2int(n, lua_tonumber(L, -1));
- if (i != 0) {
+ if (i > 0) {
set_font_math_param(f, i, n);
}
lua_pop(L, 1); /* pop value */
@@ -1221,9 +1247,9 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i,
set_charinfo_tounicode(co, NULL);
if (has_math) {
- j = n_numeric_field(L, luaS_top_accent_index, 0);
+ j = n_numeric_field(L, luaS_top_accent_index, INT_MIN);
set_charinfo_top_accent(co, j);
- j = n_numeric_field(L, luaS_bot_accent_index, 0);
+ j = n_numeric_field(L, luaS_bot_accent_index, INT_MIN);
set_charinfo_bot_accent(co, j);
k = n_numeric_field(L, luaS_next_index, -1);
if (k >= 0) {
@@ -2221,6 +2247,10 @@ static void add_kern_before(halfword left, halfword right)
assert(vlink(prev) == right);
couple_nodes(prev, kern);
couple_nodes(kern, right);
+ /* update the attribute list (inherit from left) */
+ delete_attribute_ref(node_attr(kern));
+ add_node_attr_ref(node_attr(left));
+ node_attr(kern) = node_attr(left);
}
}
}
@@ -2237,6 +2267,10 @@ static void add_kern_after(halfword left, halfword right, halfword aft)
assert(next == null || alink(next) == aft);
couple_nodes(aft, kern);
try_couple_nodes(kern, next);
+ /* update the attribute list (inherit from left == aft) */
+ delete_attribute_ref(node_attr(kern));
+ add_node_attr_ref(node_attr(aft));
+ node_attr(kern) = node_attr(aft);
}
}
}
@@ -2341,22 +2375,25 @@ static halfword
run_lua_ligkern_callback(halfword head, halfword tail, int callback_id)
{
lua_State *L = Luas;
+ int i;
+ int top = lua_gettop(L);
if (!get_callback(L, callback_id)) {
lua_pop(L, 2);
return tail;
}
nodelist_to_lua(L, head);
nodelist_to_lua(L, tail);
- if (lua_pcall(L, 2, 1, 0) != 0) {
- fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 2);
- lua_error(L);
+ if ((i=lua_pcall(L, 2, 0, 0)) != 0) {
+ luatex_error(L, (i == LUA_ERRRUN ? 0 : 1));
return tail;
}
+ /* next two lines disabled to be compatible with the manual */
+#if 0
tail = nodelist_from_lua(L);
if (fix_node_lists)
+#endif
fix_node_list(head);
- lua_pop(L, 2);
+ lua_settop(L, top);
return tail;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
index fa2d2ac6c6d..15c48c7f50b 100644
--- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.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: luatexfont.h 3433 2010-02-20 10:03:04Z hhenkel $ */
+/* $Id: luatexfont.h 3790 2010-08-02 20:00:17Z oneiros $ */
#ifndef LUATEXFONT_H
# define LUATEXFONT_H
@@ -200,8 +200,8 @@ extern char notdef[];
/* vfovf.c */
void vf_expand_local_fonts(internal_font_number f);
-internal_font_number letter_space_font(halfword u, internal_font_number f,
- int e);
+internal_font_number letter_space_font(internal_font_number f,
+ int e, boolean nolig);
internal_font_number auto_expand_font(internal_font_number f, int e);
void pdf_check_vf(internal_font_number f);
internal_font_number copy_font_info(internal_font_number f);
diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w
index 8d06d046628..413e7832f78 100644
--- a/Build/source/texk/web2c/luatexdir/font/mapfile.w
+++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w
@@ -20,8 +20,8 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: mapfile.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/mapfile.w $";
+ "$Id: mapfile.w 3786 2010-08-02 15:25:12Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/mapfile.w $";
#include <math.h>
#include "ptexlib.h"
@@ -528,14 +528,14 @@ static void fm_read_info(void)
fm_file = NULL;
}
} else {
- pdftex_warn("cannot open font map file");
+ pdftex_warn("cannot open font map file (%s)", cur_file_name);
}
} else {
- pdftex_warn("cannot open font map file");
+ pdftex_warn("cannot open font map file (%s)", cur_file_name);
}
} else {
if (!fm_open(cur_file_name)) {
- pdftex_warn("cannot open font map file");
+ pdftex_warn("cannot open font map file (%s)", cur_file_name);
} else {
fm_read_file();
tex_printf("{%s", cur_file_name);
diff --git a/Build/source/texk/web2c/luatexdir/font/pkin.w b/Build/source/texk/web2c/luatexdir/font/pkin.w
index a807ab39d0c..19e6b5db48d 100644
--- a/Build/source/texk/web2c/luatexdir/font/pkin.w
+++ b/Build/source/texk/web2c/luatexdir/font/pkin.w
@@ -53,7 +53,7 @@ typedef short shalfword;
static const char _svn_version[] =
"$Id: pkin.w 3584 2010-04-02 17:45:55Z hhenkel $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/pkin.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/pkin.w $";
@
Now we have some routines to get stuff from the pk file. pkbyte returns
diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.h b/Build/source/texk/web2c/luatexdir/font/sfnt.h
index a67bd02d890..dda13643ff6 100644
--- a/Build/source/texk/web2c/luatexdir/font/sfnt.h
+++ b/Build/source/texk/web2c/luatexdir/font/sfnt.h
@@ -19,7 +19,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: sfnt.h 3404 2010-01-28 11:17:10Z taco $ */
+/* $Id: sfnt.h 3765 2010-07-29 07:10:21Z taco $ */
#ifndef _SFNT_H_
# define _SFNT_H_
diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.w b/Build/source/texk/web2c/luatexdir/font/sfnt.w
index a6482e29846..26653508b0f 100644
--- a/Build/source/texk/web2c/luatexdir/font/sfnt.w
+++ b/Build/source/texk/web2c/luatexdir/font/sfnt.w
@@ -32,8 +32,8 @@
#include "font/sfnt.h"
static const char _svn_version[] =
- "$Id: sfnt.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/sfnt.w $";
+ "$Id: sfnt.w 3765 2010-07-29 07:10:21Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/sfnt.w $";
diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.w b/Build/source/texk/web2c/luatexdir/font/subfont.w
index b7ea88064cf..fced62d248e 100644
--- a/Build/source/texk/web2c/luatexdir/font/subfont.w
+++ b/Build/source/texk/web2c/luatexdir/font/subfont.w
@@ -23,8 +23,8 @@
#include <string.h>
static const char _svn_version[] =
- "$Id: subfont.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/subfont.w $";
+ "$Id: subfont.w 3786 2010-08-02 15:25:12Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/subfont.w $";
@ @c
static struct avl_table *sfd_tree = NULL;
@@ -149,13 +149,13 @@ static sfd_entry *read_sfd(char *sfd_name)
if (!(run_callback(callback_id, "S->bSd", cur_file_name,
&file_opened, &sfd_buffer, &sfd_size) &&
file_opened && sfd_size > 0)) {
- pdftex_warn("cannot open SFD file for reading");
+ pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name);
cur_file_name = NULL;
return NULL;
}
} else {
if (!sfd_open(cur_file_name)) {
- pdftex_warn("cannot open SFD file for reading");
+ pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name);
cur_file_name = NULL;
return NULL;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h
index 9281b19ec0d..5c33c20af81 100644
--- a/Build/source/texk/web2c/luatexdir/font/texfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/texfont.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: texfont.h 3723 2010-06-18 09:19:27Z taco $ */
+/* $Id: texfont.h 3853 2010-09-03 18:05:14Z oneiros $ */
/* Here we have the interface to LuaTeX's font system, as seen from the
main pascal program. There is a companion list in luatex.defines to
@@ -38,11 +38,11 @@ typedef struct liginfo {
int adj;
int lig;
int type;
-#else
+# else
int type;
int lig;
int adj;
-#endif
+# endif
} liginfo;
/* these are dumped en block, so they need endianness tests */
@@ -50,10 +50,10 @@ typedef struct kerninfo {
# ifdef WORDS_BIGENDIAN
int adj;
scaled sc;
-#else
+# else
scaled sc;
int adj;
-#endif
+# endif
} kerninfo;
typedef struct extinfo {
@@ -172,7 +172,7 @@ typedef struct texfont {
int ligatures_disabled;
int _pdf_font_num; /* maps to a PDF resource ID */
- internal_font_number _pdf_font_blink; /* link to base font for expanded fonts */
+ internal_font_number _pdf_font_blink; /* link to base font for expanded fonts */
internal_font_number _pdf_font_elink; /* link to expanded fonts for base font */
str_number _pdf_font_attr; /* pointer to additional attributes */
} texfont;
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w
index 3943da67cb3..85c02131933 100644
--- a/Build/source/texk/web2c/luatexdir/font/texfont.w
+++ b/Build/source/texk/web2c/luatexdir/font/texfont.w
@@ -33,8 +33,8 @@ problematic |if 0 != null|.
@c
static const char _svn_version[] =
- "$Id: texfont.w 3634 2010-04-19 19:52:48Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/texfont.w $";
+ "$Id: texfont.w 3997 2010-11-28 10:37:21Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/texfont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -115,6 +115,8 @@ int new_font(void)
font_tables[id]->_right_boundary = NULL;
font_tables[id]->_param_base = NULL;
font_tables[id]->_math_param_base = NULL;
+ font_tables[id]->_pdf_font_blink = null_font;
+ font_tables[id]->_pdf_font_elink = null_font;
set_font_bc(id, 1); /* ec = 0 */
set_hyphen_char(id, '-');
@@ -1124,10 +1126,10 @@ int copy_font(int f)
if (font_cidordering(f) != NULL)
set_font_cidordering(k, xstrdup(font_cidordering(f)));
- i = (int) (sizeof(*param_base(f)) * (unsigned) font_params(f));
+ i = (int) (sizeof(*param_base(f)) * (unsigned) (font_params(f)+1));
font_bytes += i;
- param_base(k) = xmalloc((unsigned) i);
- memcpy(param_base(k), param_base(f), (size_t) i);
+ param_base(k) = xmalloc((unsigned) (i+1));
+ memcpy(param_base(k), param_base(f), (size_t) (i));
if (font_math_params(f) > 0) {
i = (int) (sizeof(*math_param_base(f)) *
@@ -1151,6 +1153,8 @@ int copy_font(int f)
ci = copy_charinfo(right_boundary(f));
set_charinfo(k, right_boundarychar, ci);
}
+ /* not updated yet: */
+ font_tables[k]->charinfo_count = font_tables[f]->charinfo_count;
return k;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.w b/Build/source/texk/web2c/luatexdir/font/tfmofm.w
index a007ac48b48..6a3e77d78d1 100644
--- a/Build/source/texk/web2c/luatexdir/font/tfmofm.w
+++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: tfmofm.w 3634 2010-04-19 19:52:48Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tfmofm.w $";
+ "$Id: tfmofm.w 3635 2010-04-19 20:07:44Z oneiros $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tfmofm.w $";
@ Here are some macros that help process ligatures and kerns
@c
diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w
index 14bf9bedad9..9647d9e049c 100644
--- a/Build/source/texk/web2c/luatexdir/font/tounicode.w
+++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: tounicode.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tounicode.w $";
+ "$Id: tounicode.w 3967 2010-11-24 13:41:45Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tounicode.w $";
@ @c
#define isXdigit(c) (isdigit(c) || ('A' <= (c) && (c) <= 'F'))
@@ -141,7 +141,7 @@ static long check_unicode_value(char *s, boolean multiple_value)
{
int l = (int) strlen(s);
int i;
- long code;
+ long code = 0; /* anything that is not |UNI_UNDEF| will do */
if (l == 0)
return UNI_UNDEF;
@@ -538,9 +538,11 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f)
i++;
} else { /* |gtab[i].code >= 0| */
j = i;
- while (i < 65536 && gtab[i + 1].code >= 0 &&
- gtab[i].code + 1 == gtab[i + 1].code)
- i++;
+ k = i % 256;
+ while (i < 65536 && k<255 && gtab[i + 1].code >= 0 &&
+ gtab[i].code + 1 == gtab[i + 1].code) {
+ i++; k++;
+ }
/* at this point i is the last entry of the subrange */
i++; /* move i to the next entry */
range_size[j] = i - j;
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
index 2a1fcf02f66..f0774647fe1 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
+++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
@@ -31,7 +31,7 @@
static const char _svn_version[] =
"$Id: tt_glyf.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tt_glyf.w $";
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tt_glyf.w $";
@ @c
#define NUM_GLYPH_LIMIT 65534
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_table.w b/Build/source/texk/web2c/luatexdir/font/tt_table.w
index 744baa8e6bf..f53e2659336 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_table.w
+++ b/Build/source/texk/web2c/luatexdir/font/tt_table.w
@@ -28,7 +28,7 @@
static const char _svn_version[] =
"$Id: tt_table.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tt_table.w $";
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tt_table.w $";
@ tables contains information refered by other tables
diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.w b/Build/source/texk/web2c/luatexdir/font/vfovf.w
index 68852e209e5..2448b1d732c 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfovf.w
+++ b/Build/source/texk/web2c/luatexdir/font/vfovf.w
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: vfovf.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/vfovf.w $";
+ "$Id: vfovf.w 3898 2010-09-22 06:03:03Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/vfovf.w $";
@ @c
/* this is a hack! */
@@ -1507,26 +1507,20 @@ void vf_expand_local_fonts(internal_font_number f)
@ @c
internal_font_number
-letter_space_font(halfword u, internal_font_number f, int e)
+letter_space_font(internal_font_number f, int e, boolean nolig)
{
internal_font_number k;
- scaled w, r;
-
+ scaled w;
+ int c;
+ charinfo *co;
char *new_font_name;
- int vf_z;
- int vf_alpha;
- int vf_beta;
- memory_word tmp_w; /* accumulator */
-
/* read a new font and expand the character widths */
- k = read_font_info(u, font_name(f), font_size(f), font_natural_dir(f));
- set_no_ligatures(k); /* disable ligatures for letter-spaced fonts */
-#if 0
- for (i = 0;i <= font_widths(k);i++) {
- set_font_width(k,i,font_width(f,i)+round_xn_over_d(quad(k), e, 1000));
- }
-#endif
+ k = copy_font(f);
+
+ if (nolig)
+ set_no_ligatures(k); /* disable ligatures for letter-spaced fonts */
+
/* append eg '+100ls' to font name */
new_font_name = xmalloc((unsigned) (strlen(font_name(k)) + 8)); /* |abs(e) <= 1000| */
if (e > 0) {
@@ -1539,86 +1533,45 @@ letter_space_font(halfword u, internal_font_number f, int e)
/* create the corresponding virtual font */
set_font_type(k, virtual_font_type);
-
- vf_z = font_size(f);
- vf_replace_z();
- w = round_xn_over_d(quad(f), e, 2000);
- if (w > 0) {
- tmp_b0 = 0;
- } else {
- tmp_b0 = 255;
- w = vf_alpha + w;
- }
- r = w * vf_beta;
- tmp_b1 = (quarterword) (r / vf_z);
- r = r % vf_z;
- if (r == 0) {
- tmp_b2 = 0;
- } else {
- r = r * 256;
- tmp_b2 = (quarterword) (r / vf_z);
- r = r % vf_z;
- }
- if (r == 0) {
- tmp_b3 = 0;
- } else {
- r = r * 256;
- tmp_b3 = (quarterword) (r / vf_z);
+
+ for (c=font_bc(k);c<=font_ec(k);c++) {
+ if (quick_char_exists(k, c)) {
+ int half_w;
+ int vf_np = 0;
+ eight_bits *vpackets = xmalloc((unsigned) (10+10+1));
+ if (e<0) {
+ half_w = -round_xn_over_d(quad(k), -e, 2000);
+ } else {
+ half_w = round_xn_over_d(quad(k), e, 2000);
+ }
+ co = get_charinfo(k, c);
+ w = char_width(k, c)+2*half_w;
+ set_charinfo_width(co, w);
+
+ append_packet(packet_right_code);
+ append_four(half_w);
+ append_fnt_set(f);
+ append_packet(packet_char_code);
+ append_four(c);
+ append_packet(packet_right_code);
+ append_four(half_w);
+ append_packet(packet_end_code);
+
+ set_charinfo_packets(co, vpackets);
+ }
}
+ /* now patch the quad size */
+ /* Patch 20100922: do not do this, to remain compatible with pdftex */
#if 0
- vf_packet_base[k] = new_vf_packet(k);
-
- for (c=font_bc(k);c<=font_ec(k);c++) {
- string_room(17);
- append_fnt_set(f);
- append_packet(right1 + 3);
- append_packet(tmp_b0);
- append_packet(tmp_b1);
- append_packet(tmp_b2);
- append_packet(tmp_b3);
-
- append_packet(set1);
- append_packet(c);
-
- append_packet(right1 + 3);
- append_packet(tmp_b0);
- append_packet(tmp_b1);
- append_packet(tmp_b2);
- append_packet(tmp_b3);
- s = make_string();
- store_packet(k, c, s);
- flush_str(s);
- }
+ if (e<0) {
+ set_font_param(k, quad_code, -round_xn_over_d(quad(k), 1000-e, 1000));
+ } else {
+ set_font_param(k, quad_code, round_xn_over_d(quad(k), 1000+e, 1000));
+ }
#endif
return k;
}
-@ the fontname has [+-]\d+ls at the end
-@c
-#if 0
-static boolean is_letterspaced_font(internal_font_number f)
-{
- char *i, *j;
- if (font_type(f) != virtual_font_type)
- return false;
- j = font_name(f);
- i = j + strlen(j);
- if ((*(i - 1) != 'l') || (*i != 's'))
- return false;
- i = i - 2;
- while (i >= j) {
- if ((*i < '0') || (*i > '9'))
- break;
- i--;
- }
- if (i < j)
- return false;
- if ((*i != '+') && (*i != '-'))
- return false;
- return true;
-}
-#endif
-
@ @c
internal_font_number copy_font_info(internal_font_number f)
{
diff --git a/Build/source/texk/web2c/luatexdir/font/vfpacket.w b/Build/source/texk/web2c/luatexdir/font/vfpacket.w
index 8a222e04c04..f26b774721d 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfpacket.w
+++ b/Build/source/texk/web2c/luatexdir/font/vfpacket.w
@@ -1,7 +1,7 @@
% vfpacket.w
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2009 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
% This file is part of LuaTeX.
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: vfpacket.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/vfpacket.w $";
+ "$Id: vfpacket.w 4098 2011-04-07 21:01:11Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/vfpacket.w $";
@ The |do_vf_packet| procedure is called in order to interpret the
@@ -189,7 +189,7 @@ void do_vf_packet(PDF pdf, internal_font_number vf_f, int c)
if (has_packet(lf, (int) k))
do_vf_packet(pdf, lf, (int) k);
else
- pdf_place_glyph(pdf, lf, (int) k);
+ backend_out[glyph_node] (pdf, lf, (int) k);
}
cur.h = cur.h + char_width(lf, (int) k);
break;
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w
index afbf9ef8ff9..6f818d9e422 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.w
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.w
@@ -23,9 +23,11 @@
#include "font/writecff.h"
+extern int cidset;
+
static const char _svn_version[] =
- "$Id: writecff.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writecff.w $";
+ "$Id: writecff.w 3848 2010-09-01 08:34:37Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writecff.w $";
@ @c
#define get_offset(s,n) get_unsigned(s, (n))
@@ -3162,6 +3164,28 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
}
}
+ /* CIDSet: a table of bits indexed by cid, bytes with high order bit first,
+ each (set) bit is a (present) CID. */
+ if (1) {
+ int cid;
+ cidset = pdf_new_objnum(pdf);
+ if (cidset != 0) {
+ size_t l = (last_cid/8)+1;
+ char *stream = xmalloc(l);
+ memset(stream, 0, l);
+ for (cid = 1; cid <= (long) last_cid; cid++) {
+ glyph->id = cid;
+ if (avl_find(fd->gl_tree,glyph) != NULL) {
+ stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
+ }
+ }
+ pdf_begin_dict(pdf, cidset, 0);
+ pdf_begin_stream(pdf);
+ pdf_out_block(pdf, stream, l);
+ pdf_end_stream(pdf);
+ }
+ }
+
/* this happens if the internal metrics do not agree with the actual disk font */
if (gid < num_glyphs) {
WARN("embedded subset is smaller than expected: %d instead of %d glyphs.", gid, num_glyphs);
@@ -3283,7 +3307,6 @@ card16 cff_charsets_lookup(cff_font * cff, card16 cid)
@ @c
#define is_cidfont(a) ((a)->flag & FONTTYPE_CIDFONT)
#define CID_MAX 65535
-
void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
{
cff_index *charstrings, *cs_idx;
@@ -3335,7 +3358,6 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
glyph = xtalloc(1, glw_entry);
}
- cid = 0;
last_cid = 0;
num_glyphs = 0;
for (cid = 0; cid <= CID_MAX; cid++) {
@@ -3349,6 +3371,27 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
}
}
+ /* CIDSet: a table of bits indexed by cid, bytes with high order bit first,
+ each (set) bit is a (present) CID. */
+ if (1) {
+ cidset = pdf_new_objnum(pdf);
+ if (cidset != 0) {
+ size_t l = (last_cid/8)+1;
+ char *stream = xmalloc(l);
+ memset(stream, 0, l);
+ for (cid = 1; cid <= (long) last_cid; cid++) {
+ if (CIDToGIDMap[2 * cid] || CIDToGIDMap[2 * cid + 1]) {
+ stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
+ }
+ }
+ pdf_begin_dict(pdf, cidset, 0);
+ pdf_begin_stream(pdf);
+ pdf_out_block(pdf, stream, l);
+ pdf_end_stream(pdf);
+ }
+ }
+
+
cff_read_fdselect(cffont);
cff_read_fdarray(cffont);
cff_read_private(cffont);
diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.w b/Build/source/texk/web2c/luatexdir/font/writeenc.w
index b8db3e9791b..1e097ad8fcc 100644
--- a/Build/source/texk/web2c/luatexdir/font/writeenc.w
+++ b/Build/source/texk/web2c/luatexdir/font/writeenc.w
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: writeenc.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writeenc.w $";
+ "$Id: writeenc.w 3615 2010-04-13 21:59:59Z oneiros $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writeenc.w $";
@ All encoding entries go into AVL tree for fast search by name.
@c
diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w
index d130b976bf1..5db7218f15a 100644
--- a/Build/source/texk/web2c/luatexdir/font/writefont.w
+++ b/Build/source/texk/web2c/luatexdir/font/writefont.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writefont.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writefont.w $";
+ "$Id: writefont.w 3836 2010-08-29 09:29:04Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writefont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -468,6 +468,7 @@ static void write_fontfile(PDF pdf, fd_entry * fd)
@
@c
+int cidset = 0;
static void write_fontdescriptor(PDF pdf, fd_entry * fd)
{
static const int std_flags[] = {
@@ -494,7 +495,7 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd)
struct avl_traverser t;
int fd_flags;
assert(fd != NULL && fd->fm != NULL);
-
+ cidset = 0; /* possibly updated by |write_fontfile| */
if (is_fontfile(fd->fm) && is_included(fd->fm))
write_fontfile(pdf, fd); /* this will set |fd->ff_found| if font file is found */
if (fd->fd_objnum == 0)
@@ -549,14 +550,11 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd)
assert(0);
}
}
- /* TODO: Optional keys for CID fonts.
-
- The most interesting ones are
+ if (cidset !=0)
+ pdf_printf(pdf, "/CIDSet %i 0 R\n", cidset);
+ /* TODO: Other optional keys for CID fonts.
+ The most interesting one is
\.{/Style << /Panose <12-byte string>>>}
- and
- \.{/CIDSET <stream>}
- the latter can be used in subsets, to give the included CIDs
- as a bitmap on the whole list.
*/
pdf_end_dict(pdf);
}
diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w
index ccb2196c451..64d76712309 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet1.w
+++ b/Build/source/texk/web2c/luatexdir/font/writet1.w
@@ -16,12 +16,12 @@
% License for more details.
%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
static const char _svn_version[] =
- "$Id: writet1.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writet1.w $";
+ "$Id: writet1.w 3960 2010-11-13 07:34:49Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writet1.w $";
#include "ptexlib.h"
#include <string.h>
@@ -231,8 +231,8 @@ static cs_entry *subr_tab;
static char *subr_array_start, *subr_array_end;
static int subr_max, subr_size, subr_size_pos;
-@ This list contains the begin/end tokens commonly used in the
-/Subrs array of a Type 1 font.
+@ This list contains the begin/end tokens commonly used in the
+/Subrs array of a Type 1 font.
@c
static const char *cs_token_pairs_list[][2] = {
@@ -286,7 +286,7 @@ char **load_enc_file(char *enc_name)
cur_file_name = luatex_find_file(enc_name, find_enc_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find encoding file for reading");
+ pdftex_fail("cannot find encoding file '%s' for reading", enc_name);
}
callback_id = callback_defined(read_enc_file_callback);
enc_curbyte = 0;
@@ -295,12 +295,12 @@ char **load_enc_file(char *enc_name)
if (run_callback(callback_id, "S->bSd", cur_file_name,
&file_opened, &enc_buffer, &enc_size)) {
if ((!file_opened) || enc_size == 0) {
- pdftex_fail("cannot open encoding file for reading");
+ pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name);
}
}
} else {
if (!enc_open(cur_file_name)) {
- pdftex_fail("cannot open encoding file for reading");
+ pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name);
}
enc_read_file();
enc_close();
@@ -326,7 +326,7 @@ char **load_enc_file(char *enc_name)
*r != ' ' && *r != 10 && *r != ']' && *r != '/'; *p++ = *r++);
*p = 0;
skip(r, ' ');
- if (names_count > 256)
+ if (names_count >= 256)
pdftex_fail("encoding vector contains more than 256 names");
if (strcmp(buf, notdef) != 0)
glyph_names[names_count] = xstrdup(buf);
@@ -652,7 +652,7 @@ static void t1_stop_eexec(PDF pdf)
t1_in_eexec = 2;
}
-@ macros for various transforms; unused, left for reference
+@ macros for various transforms; unused, left for reference
@c
#ifdef T1TRANSFORMMACROS
@@ -785,13 +785,13 @@ static char **t1_builtin_enc(void)
}
/* At this moment \.{/Encoding} is the prefix of |t1_line_array|, and the encoding is
not a predefined encoding.
-
+
We have two possible forms of Encoding vector. The first case is
-
+
\.{/Encoding [/a /b /c...] readonly def}
-
+
and the second case can look like
-
+
{\obeylines
\.{/Encoding 256 array 0 1 255 {1 index exch /.notdef put} for}
\.{dup 0 /x put}
@@ -1297,7 +1297,7 @@ static void cs_mark(const char *cs_name, int subr)
ptr->used = false;
}
-@ AVL search tree for glyph code by glyph name
+@ AVL search tree for glyph code by glyph name
@c
static int comp_t1_glyphs(const void *pa, const void *pb, void *p
__attribute__ ((unused)))
@@ -1622,11 +1622,36 @@ static void t1_mark_glyphs(void)
}
-@
+@ When |t1_subset_charstrings| is called, the |t1_line_array| contains \.{/CharStrings}.
+When we hit a case like this:
+{\obeylines \tt
+ dup/CharStrings
+ 229 dict dup begin
+}
+we read the next line and concatenate to |t1_line_array| before moving on. That is
+what |t1_check_unusual_charstring| is for.
+
@c
+static void t1_check_unusual_charstring(void)
+{
+ char *p = strstr(t1_line_array, charstringname) + strlen(charstringname);
+ int i;
+ /* if no number follows "/CharStrings", let's read the next line */
+ if (sscanf(p, "%i", &i) != 1) {
+ strcpy(t1_buf_array, t1_line_array);
+ t1_getline();
+ strcat(t1_buf_array, t1_line_array);
+ strcpy(t1_line_array, t1_buf_array);
+ t1_line_ptr = eol(t1_line_array);
+ }
+}
+
static void t1_subset_charstrings(PDF pdf)
{
cs_entry *ptr;
+
+ t1_check_unusual_charstring();
+
cs_size_pos = (int) (strstr(t1_line_array,
charstringname) + strlen(charstringname) -
t1_line_array + 1);
diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.w b/Build/source/texk/web2c/luatexdir/font/writet3.w
index b138df57c94..63988a80a28 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet3.w
+++ b/Build/source/texk/web2c/luatexdir/font/writet3.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writet3.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writet3.w $";
+ "$Id: writet3.w 3882 2010-09-13 22:29:18Z hhenkel $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writet3.w $";
#include "ptexlib.h"
#include <kpathsea/tex-glyph.h>
@@ -187,8 +187,7 @@ static boolean writepk(PDF pdf, internal_font_number f)
ury = cd.cheight + lly;
update_bbox(llx, lly, urx, ury, t3_glyph_num == 0);
t3_glyph_num++;
- pdf_new_dict(pdf, obj_type_others, 0, 0);
- t3_char_procs[cd.charcode] = pdf->obj_ptr;
+ t3_char_procs[cd.charcode] = pdf_new_dict(pdf, obj_type_others, 0, 0);
pdf_begin_stream(pdf);
pdf_print_real(pdf, (int) t3_char_widths[cd.charcode], 2);
pdf_printf(pdf, " 0 %i %i %i %i d1\n",
diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w
index 2a7c5c644c0..bc93ad5c7aa 100644
--- a/Build/source/texk/web2c/luatexdir/font/writettf.w
+++ b/Build/source/texk/web2c/luatexdir/font/writettf.w
@@ -24,8 +24,8 @@
#include <string.h>
static const char _svn_version[] =
- "$Id: writettf.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writettf.w $";
+ "$Id: writettf.w 3789 2010-08-02 19:59:49Z oneiros $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writettf.w $";
#define DEFAULT_NTABS 14
#define NEW_CMAP_SIZE 2
@@ -1703,7 +1703,7 @@ void writettf(PDF pdf, fd_entry * fd)
cur_file_name =
luatex_find_file(fd_cur->fm->ff_name, find_truetype_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find TrueType font file for reading");
+ pdftex_fail("cannot find TrueType font file for reading (%s)", fd_cur->fm->ff_name);
}
callback_id = callback_defined(read_truetype_file_callback);
if (callback_id > 0) {
@@ -1711,11 +1711,11 @@ void writettf(PDF pdf, fd_entry * fd)
&file_opened, &ttf_buffer, &ttf_size) &&
file_opened && ttf_size > 0) {
} else {
- pdftex_fail("cannot open TrueType font file for reading");
+ pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name);
}
} else {
if (!ttf_open(cur_file_name)) {
- pdftex_fail("cannot open TrueType font file for reading");
+ pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name);
}
ttf_read_file();
ttf_close();
@@ -1808,7 +1808,7 @@ void writeotf(PDF pdf, fd_entry * fd)
cur_file_name =
luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find OpenType font file for reading");
+ pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name);
}
callback_id = callback_defined(read_opentype_file_callback);
if (callback_id > 0) {
@@ -1816,11 +1816,11 @@ void writeotf(PDF pdf, fd_entry * fd)
&file_opened, &ttf_buffer, &ttf_size) &&
file_opened && ttf_size > 0) {
} else {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
} else {
if (!otf_open(cur_file_name)) {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
ttf_read_file();
ttf_close();
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.w b/Build/source/texk/web2c/luatexdir/font/writetype0.w
index 818a23b5ca1..945350a1384 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype0.w
+++ b/Build/source/texk/web2c/luatexdir/font/writetype0.w
@@ -23,8 +23,8 @@
#include "font/writecff.h"
static const char _svn_version[] =
- "$Id: writetype0.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writetype0.w $";
+ "$Id: writetype0.w 3786 2010-08-02 15:25:12Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writetype0.w $";
@ @c
void writetype0(PDF pdf, fd_entry * fd)
@@ -48,7 +48,7 @@ void writetype0(PDF pdf, fd_entry * fd)
cur_file_name =
luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find OpenType font file for reading");
+ pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name);
}
callback_id = callback_defined(read_opentype_file_callback);
if (callback_id > 0) {
@@ -56,11 +56,11 @@ void writetype0(PDF pdf, fd_entry * fd)
&file_opened, &ttf_buffer, &ttf_size) &&
file_opened && ttf_size > 0) {
} else {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
} else {
if (!otf_open(cur_file_name)) {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
ttf_read_file();
ttf_close();
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.w b/Build/source/texk/web2c/luatexdir/font/writetype2.w
index 66b97f7d201..12124f6edb8 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype2.w
+++ b/Build/source/texk/web2c/luatexdir/font/writetype2.w
@@ -27,7 +27,7 @@
#include "font/tt_glyf.h"
static const char _svn_version[] =
- "$Id: writetype2.w 3612 2010-04-13 09:29:42Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writetype2.w $";
+ "$Id: writetype2.w 3848 2010-09-01 08:34:37Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writetype2.w $";
@ forward declaration
@c
@@ -152,7 +152,7 @@ void writetype2(PDF pdf, fd_entry * fd)
cur_file_name =
luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find OpenType font file for reading");
+ pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name);
}
callback_id = callback_defined(read_opentype_file_callback);
if (callback_id > 0) {
@@ -160,11 +160,11 @@ void writetype2(PDF pdf, fd_entry * fd)
&file_opened, &ttf_buffer, &ttf_size) &&
file_opened && ttf_size > 0) {
} else {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
} else {
if (!otf_open(cur_file_name)) {
- pdftex_fail("cannot open OpenType font file for reading");
+ pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
}
ttf_read_file();
ttf_close();
@@ -259,11 +259,12 @@ static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx)
@ Creating the subset.
@c
+extern int cidset;
void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
{
long i, cid;
- unsigned int last_cid;
+ unsigned int last_cid = 0;
glw_entry *found;
struct avl_traverser t;
unsigned char *cidtogidmap;
@@ -395,6 +396,26 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
pdf_release_obj(fontfile);
+ /* CIDSet: a table of bits indexed by cid, bytes with high order bit first,
+ each (set) bit is a (present) CID. */
+ if (is_subsetted(fd->fm)) {
+ cidset = pdf_new_objnum(pdf);
+ if (cidset != 0) {
+ size_t l = (last_cid/8)+1;
+ char *stream = xmalloc(l);
+ memset(stream, 0, l);
+ for (cid = 1; cid <= (long) last_cid; cid++) {
+ if (used_chars[cid]) {
+ stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
+ }
+ }
+ pdf_begin_dict(pdf, cidset, 0);
+ pdf_begin_stream(pdf);
+ pdf_out_block(pdf, stream, l);
+ pdf_end_stream(pdf);
+ }
+ }
+
/* TODO other stuff that needs fixing: */
/* DW, W, DW2, and W2 */
@@ -408,19 +429,7 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
add_TTCIDVMetrics(font->fontdict, glyphs, used_chars, cidtogidmap, last_cid);
}
#endif
- /* CIDSet */
-#if 0
- {
- pdf_obj *cidset;
-
- cidset = pdf_new_stream(STREAM_COMPRESS);
- pdf_add_stream(cidset, used_chars, last_cid/8 + 1);
- pdf_add_dict(font->descriptor,
- pdf_new_name("CIDSet"),
- pdf_ref_obj(cidset));
- pdf_release_obj(cidset);
- }
-#endif
+
xfree(used_chars);
sfnt_close(sfont);
return;
diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h
index 0ce09ab13eb..c47c9f19f26 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 3650 2010-04-26 08:13:41Z taco $ */
+/* $Id: epdf.h 4054 2011-01-10 19:05:54Z hhenkel $ */
// this is the common header file for C++ sources pdftoepdf.cc and lepdflib.cc
@@ -31,22 +31,15 @@
# include <string.h>
# include <kpathsea/c-ctype.h>
# include <sys/stat.h>
-# ifdef POPPLER_VERSION
-# define GString GooString
-# include <dirent.h>
-# include <poppler-config.h>
-# include <goo/GooString.h>
-# include <goo/gmem.h>
-# include <goo/gfile.h>
-# else
-# include <aconf.h>
-# include <GString.h>
-# include <gmem.h>
-# include <gfile.h>
-# include <assert.h>
-# endif
+# include <dirent.h>
+# include <poppler-config.h>
+# include <goo/GooString.h>
+# include <goo/gmem.h>
+# include <goo/gfile.h>
# include "Object.h"
# include "Stream.h"
+# include "Gfx.h"
+# include "Annot.h"
# include "Array.h"
# include "Dict.h"
# include "XRef.h"
@@ -64,6 +57,8 @@ extern "C" {
extern char *xstrdup(const char *);
+ typedef enum { FE_FAIL, FE_RETURN_NULL } file_error_mode;
+
/* the following code is extremly ugly but needed for including web2c/config.h */
typedef const char *const_string; /* including kpathsea/types.h doesn't work on some systems */
@@ -75,7 +70,7 @@ extern "C" {
# undef CONFIG_H /* header file */
# endif
-# include <w2c/c-auto.h> /* define SIZEOF_LONG */
+# include <c-auto.h> /* define SIZEOF_LONG */
# include "openbsd-compat.h"
# include "image.h"
@@ -88,25 +83,24 @@ extern "C" {
/* pdfgen.c */
__attribute__ ((format(printf, 2, 3)))
extern void pdf_printf(PDF, const char *fmt, ...);
- extern void pdf_puts(PDF, const char *);
extern void pdf_begin_obj(PDF, int, bool);
extern void pdf_end_obj(PDF);
extern void pdf_begin_stream(PDF);
extern void pdf_end_stream(PDF);
extern void pdf_room(PDF, int);
-# define pdf_out(B,A) do { pdf_room(B,1); B->buf[B->ptr++] = A; } while (0)
+ extern void pdf_out_block(PDF pdf, const char *s, size_t n);
+
+# define pdf_out(B, A) do { pdf_room(B, 1); B->buf[B->ptr++] = A; } while (0)
+# define pdf_puts(pdf, s) pdf_out_block((pdf), (s), strlen(s))
/* pdftables.c */
extern int pdf_new_objnum(PDF);
- /* epdf.c */
- extern void epdf_free(void);
-
/* pdftoepdf.cc */
extern void read_pdf_info(image_dict *, int, int, img_readtype_e);
extern void write_epdf(PDF, image_dict *);
extern void unrefPdfDocument(char *);
- extern void epdf_check_mem(void);
+ extern void epdf_free(void);
/* utils.c */
__attribute__ ((format(printf, 1, 2)))
@@ -129,6 +123,9 @@ extern "C" {
// and &obj to get a pointer to the object.
// It is no longer necessary to call Object::free explicitely.
+# if 0
+// PdfObject is replaced by xpdf's Object type, with manual obj.free()
+
// *INDENT-OFF*
class PdfObject {
public:
@@ -150,6 +147,7 @@ class PdfObject {
Object iObject;
};
// *INDENT-ON*
+# endif
/**********************************************************************/
@@ -165,9 +163,10 @@ struct PdfDocument {
PDFDoc *doc;
InObj *inObjList; // temporary linked list
avl_table *ObjMapTree; // permanent over luatex run
- int occurences; // number of references to the PdfDocument; it can be deleted when occurences == 0
+ unsigned int occurences; // number of references to the PdfDocument; it can be deleted when occurences == 0
+ unsigned int pc; // counter to track PDFDoc generation or deletion
};
-PdfDocument *refPdfDocument(char *file_path);
+PdfDocument *refPdfDocument(char *file_path, file_error_mode fe);
#endif /* EPDF_H */
diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h
index c4d0c3963f7..c1b91abafb6 100644
--- a/Build/source/texk/web2c/luatexdir/image/image.h
+++ b/Build/source/texk/web2c/luatexdir/image/image.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: image.h 3388 2010-01-26 10:59:04Z taco $ */
+/* $Id: image.h 4051 2011-01-09 22:41:33Z hhenkel $ */
#ifndef IMAGE_H
# define IMAGE_H
@@ -30,7 +30,8 @@
# define JPG_UINT32 unsigned long
# define JPG_UINT8 unsigned char
-extern int do_zround(double r); /* from utils.c */
+extern int do_zround(double r); /* from utils.w */
+extern scaled one_hundred_bp; /* from pdfgen.w */
# define bp2int(p) do_zround(p * (one_hundred_bp / 100.0))
# define int2bp(i) (i * 100.0 / one_hundred_bp)
@@ -53,6 +54,10 @@ typedef struct {
JPG_UINT32 length; /* length of file/data */
} jpg_img_struct;
+typedef struct {
+ int length; /* length of file/data */
+} jp2_img_struct;
+
# if 0
typedef struct { /* currently unused */
} jb2_img_struct;
@@ -67,7 +72,7 @@ typedef enum { DICT_NEW, /* fresh dictionary */
} dict_state;
typedef enum { IMG_TYPE_NONE, IMG_TYPE_PDF, IMG_TYPE_PNG, IMG_TYPE_JPG,
- IMG_TYPE_JBIG2, IMG_TYPE_PDFSTREAM, IMG_TYPE_SENTINEL
+ IMG_TYPE_JP2, IMG_TYPE_JBIG2, IMG_TYPE_PDFSTREAM, IMG_TYPE_SENTINEL
} imgtype_e;
typedef enum { IMG_KEEPOPEN, IMG_CLOSEINBETWEEN } img_readtype_e;
@@ -111,6 +116,7 @@ typedef struct {
pdf_stream_struct *pdfstream;
png_img_struct *png;
jpg_img_struct *jpg;
+ jp2_img_struct *jp2;
/* jb2_img_struct *jb2; */
} img_struct;
} image_dict;
@@ -156,6 +162,8 @@ typedef struct {
# define img_jpg_ptr(N) ((N)->img_struct.jpg)
# define img_jpg_color(N) ((N)->img_struct.jpg->color_space)
+# define img_jp2_ptr(N) ((N)->img_struct.jp2)
+
# define img_jb2_ptr(N) ((N)->img_struct.jb2)
# define F_FLAG_BBOX (1 << 0)
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc
index 655fdd8842e..8c112d4261b 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.cc
@@ -19,12 +19,13 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: pdftoepdf.cc 3606 2010-04-10 12:58:25Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/image/pdftoepdf.cc $";
+ "$Id: pdftoepdf.cc 4136 2011-04-11 22:06:50Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/pdftoepdf.cc $";
-#include "epdf.h"
+// define DEBUG
-#define one_hundred_bp 6578176 // one_hundred_bp = 7227 * 65536 / 72
+#include "epdf.h"
+#define HAVE_GETPDFMAJORVERSION 1
// This file is mostly C and not very much C++; it's just used to interface
// the functions of xpdf, which happens to be written in C++.
@@ -62,41 +63,121 @@ static PdfDocument *findPdfDocument(char *file_path)
return pdf_doc;
}
-// Returns pointer to PdfDocument structure for PDF file.
-// Creates a new structure if it doesn't exist yet.
+#define PDF_CHECKSUM_SIZE 32
-char *get_file_checksum(char *a);
+static char *get_file_checksum(char *a, file_error_mode fe)
+{
+ struct stat finfo;
+ char *ck = NULL;
+ if (stat(a, &finfo) == 0) {
+ off_t size = finfo.st_size;
+ time_t mtime = finfo.st_mtime;
+ ck = (char *) malloc(PDF_CHECKSUM_SIZE);
+ if (ck == NULL)
+ pdftex_fail("PDF inclusion: out of memory while processing '%s'",
+ a);
+ snprintf(ck, PDF_CHECKSUM_SIZE, "%llu_%llu", (unsigned long long) size,
+ (unsigned long long) mtime);
+ } else {
+ switch (fe) {
+ case FE_FAIL:
+ pdftex_fail("PDF inclusion: could not stat() file '%s'", a);
+ break;
+ case FE_RETURN_NULL:
+ if (ck != NULL)
+ free(ck);
+ ck = NULL;
+ break;
+ default:
+ assert(0);
+ }
+ }
+ return ck;
+}
+
+// Returns pointer to PdfDocument structure for PDF file.
+// Creates a new PdfDocument structure if it doesn't exist yet.
+// When fe = FE_RETURN_NULL, the function returns NULL in error case.
-PdfDocument *refPdfDocument(char *file_path)
+PdfDocument *refPdfDocument(char *file_path, file_error_mode fe)
{
- PdfDocument *pdf_doc = findPdfDocument(file_path);
- if (pdf_doc == NULL) {
- if (PdfDocumentTree == NULL)
- PdfDocumentTree =
- avl_create(CompPdfDocument, NULL, &avl_xallocator);
+ char *checksum;
+ PdfDocument *pdf_doc;
+ PDFDoc *doc = NULL;
+ GooString *docName = NULL;
+ int new_flag = 0;
+ if ((checksum = get_file_checksum(file_path, fe)) == NULL) {
+ assert(fe == FE_RETURN_NULL);
+ return (PdfDocument *) NULL;
+ }
+ assert(checksum != NULL);
+ if ((pdf_doc = findPdfDocument(file_path)) == NULL) {
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: New PdfDocument %s\n", file_path);
+#endif
+ new_flag = 1;
pdf_doc = new PdfDocument;
pdf_doc->file_path = xstrdup(file_path);
- pdf_doc->checksum = get_file_checksum(file_path);
- void **aa = avl_probe(PdfDocumentTree, pdf_doc);
- assert(aa != NULL);
- pdf_doc->ObjMapTree = NULL;
+ pdf_doc->checksum = checksum;
pdf_doc->doc = NULL;
- }
- if (pdf_doc->doc == NULL) {
- GString *docName = new GString(pdf_doc->file_path);
- pdf_doc->doc = new PDFDoc(docName); // takes ownership of docName
- if (!pdf_doc->doc->isOk() || !pdf_doc->doc->okToPrint())
- pdftex_fail("xpdf: reading PDF image failed");
pdf_doc->inObjList = NULL;
+ pdf_doc->ObjMapTree = NULL;
pdf_doc->occurences = 0; // 0 = unreferenced
+ pdf_doc->pc = 0;
+ } else {
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: Found PdfDocument %s (%d)\n",
+ pdf_doc->file_path, pdf_doc->occurences);
+#endif
+ assert(pdf_doc->checksum != NULL);
+ if (strncmp(pdf_doc->checksum, checksum, PDF_CHECKSUM_SIZE) != 0) {
+ pdftex_fail("PDF inclusion: file has changed '%s'", file_path);
+ }
+ free(checksum);
}
+ assert(pdf_doc != NULL);
+ if (pdf_doc->doc == NULL) {
#ifdef DEBUG
- fprintf(stderr, "\nluatex Debug: Creating %s (%d)\n",
- pdf_doc->file_path, pdf_doc->occurences);
+ fprintf(stderr, "\nDEBUG: New PDFDoc %s (%d)\n",
+ pdf_doc->file_path, pdf_doc->occurences);
#endif
+ docName = new GooString(file_path);
+ doc = new PDFDoc(docName); // takes ownership of docName
+ pdf_doc->pc++;
+
+ if (!doc->isOk() || !doc->okToPrint()) {
+ switch (fe) {
+ case FE_FAIL:
+ pdftex_fail("xpdf: reading PDF image failed");
+ break;
+ case FE_RETURN_NULL:
+ delete doc;
+ // delete docName;
+ if (new_flag == 1) {
+ if (pdf_doc->file_path != NULL)
+ free(pdf_doc->file_path);
+ if (pdf_doc->checksum != NULL)
+ free(pdf_doc->checksum);
+ delete pdf_doc;
+ }
+ return (PdfDocument *) NULL;
+ break;
+ default:
+ assert(0);
+ }
+ }
+ pdf_doc->doc = doc;
+ }
+ // PDF file could be opened without problems, checksum ok.
+ if (PdfDocumentTree == NULL)
+ PdfDocumentTree = avl_create(CompPdfDocument, NULL, &avl_xallocator);
+ if ((PdfDocument *) avl_find(PdfDocumentTree, pdf_doc) == NULL) {
+ void **aa = avl_probe(PdfDocumentTree, pdf_doc);
+ assert(aa != NULL);
+ }
pdf_doc->occurences++;
#ifdef DEBUG
- fprintf(stderr, "\nluatex Debug: Incrementing %s (%d)\n",
+ fprintf(stderr, "\nDEBUG: Incrementing %s (%d)\n",
pdf_doc->file_path, pdf_doc->occurences);
#endif
return pdf_doc;
@@ -249,7 +330,7 @@ static char *convertNumToPDF(double n)
static void copyObject(PDF, PdfDocument *, Object *);
-static void copyString(PDF pdf, GString * string)
+static void copyString(PDF pdf, GooString * string)
{
char *p;
unsigned char c;
@@ -293,13 +374,14 @@ static void copyName(PDF pdf, char *s)
static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array)
{
int i, l;
- PdfObject obj1;
+ Object obj1;
pdf_puts(pdf, "[");
for (i = 0, l = array->getLength(); i < l; ++i) {
array->getNF(i, &obj1);
- if (!obj1->isName())
+ if (!obj1.isName())
pdf_puts(pdf, " ");
copyObject(pdf, pdf_doc, &obj1);
+ obj1.free();
}
pdf_puts(pdf, "]");
}
@@ -307,13 +389,14 @@ static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array)
static void copyDict(PDF pdf, PdfDocument * pdf_doc, Dict * dict)
{
int i, l;
- PdfObject obj1;
+ Object obj1;
pdf_puts(pdf, "<<");
for (i = 0, l = dict->getLength(); i < l; ++i) {
copyName(pdf, dict->getKey(i));
pdf_puts(pdf, " ");
dict->getValNF(i, &obj1);
copyObject(pdf, pdf_doc, &obj1);
+ obj1.free();
pdf_puts(pdf, "\n");
}
pdf_puts(pdf, ">>");
@@ -392,15 +475,16 @@ static void writeRefs(PDF pdf, PdfDocument * pdf_doc)
{
InObj *r, *n;
XRef *xref;
+ Object obj1;
xref = pdf_doc->doc->getXRef();
for (r = pdf_doc->inObjList; r != NULL;) {
- PdfObject obj1;
xref->fetch(r->ref.num, r->ref.gen, &obj1);
- if (obj1->isStream())
+ if (obj1.isStream())
pdf_begin_obj(pdf, r->num, 0);
else
pdf_begin_obj(pdf, r->num, 2); // \pdfobjcompresslevel = 2 is for this
copyObject(pdf, pdf_doc, &obj1);
+ obj1.free();
pdf_puts(pdf, "\n");
pdf_end_obj(pdf);
n = r->next;
@@ -436,26 +520,6 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
return page->getMediaBox(); // to make the compiler happy
}
-#define PDF_CHECKSUM_SIZE 32
-char *get_file_checksum(char *a)
-{
- struct stat finfo;
- char *ck = NULL;
- if (stat(a, &finfo) == 0) {
- off_t size = finfo.st_size;
- time_t mtime = finfo.st_mtime;
- ck = (char *) malloc(PDF_CHECKSUM_SIZE);
- if (ck == NULL)
- pdftex_fail("PDF inclusion: out of memory while processing '%s'",
- a);
- snprintf(ck, PDF_CHECKSUM_SIZE, "%llu_%llu", (unsigned long long) size,
- (unsigned long long) mtime);
- } else {
- pdftex_fail("PDF inclusion: could not stat() file '%s'", a);
- }
- return ck;
-}
-
// Reads various information about the PDF and sets it up for later inclusion.
// This will fail if the PDF version of the PDF is higher than
// minor_pdf_version_wanted or page_name is given and can not be found.
@@ -469,7 +533,6 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted,
PdfDocument *pdf_doc;
Page *page;
int rotate;
- char *checksum;
PDFRectangle *pagebox;
#ifdef HAVE_GETPDFMAJORVERSION
int pdf_major_version_found, pdf_minor_version_found;
@@ -486,15 +549,8 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted,
globalParams->setErrQuiet(gFalse);
isInit = gTrue;
}
- // calculate a checksum string
- checksum = get_file_checksum(img_filepath(idict));
// open PDF file
- pdf_doc = refPdfDocument(img_filepath(idict));
- if (strncmp(pdf_doc->checksum, checksum, PDF_CHECKSUM_SIZE) != 0) {
- pdftex_fail("PDF inclusion: file has changed '%s'",
- img_filename(idict));
- }
- free(checksum);
+ pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL);
// check PDF version
// this works only for PDF 1.x -- but since any versions of PDF newer
// than 1.x will not be backwards compatible to PDF 1.x, pdfTeX will
@@ -503,13 +559,15 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted,
pdf_major_version_found = pdf_doc->doc->getPDFMajorVersion();
pdf_minor_version_found = pdf_doc->doc->getPDFMinorVersion();
if ((pdf_major_version_found > 1)
- || (pdf_minor_version_found > minor_pdf_version_wanted)) {
+ || (pdf_minor_version_found > minor_pdf_version_wanted)) {
const char *msg =
"PDF inclusion: found PDF version <%d.%d>, but at most version <1.%d> allowed";
if (pdf_inclusion_errorlevel > 0) {
- pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted);
+ pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found,
+ minor_pdf_version_wanted);
} else {
- pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted);
+ pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found,
+ minor_pdf_version_wanted);
}
}
#else
@@ -528,7 +586,7 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted,
img_totalpages(idict) = pdf_doc->doc->getCatalog()->getNumPages();
if (img_pagename(idict)) {
// get page by name
- GString name(img_pagename(idict));
+ GooString name(img_pagename(idict));
LinkDest *link = pdf_doc->doc->findDest(&name);
if (link == NULL || !link->isOk())
pdftex_fail("PDF inclusion: invalid destination <%s>",
@@ -607,38 +665,30 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted,
// Here the included PDF is copied, so most errors that can happen
// during PDF inclusion will arise here.
-static void write_epdf1(PDF pdf, image_dict * idict)
+void write_epdf(PDF pdf, image_dict * idict)
{
PdfDocument *pdf_doc;
Page *page;
Ref *pageref;
Dict *pageDict;
- PdfObject info, contents, obj1, pageObj, dictObj;
+ Object obj1, contents, pageobj, pagesobj1, pagesobj2, *op1, *op2, *optmp;
PDFRectangle *pagebox;
int i, l;
float bbox[4];
- char *checksum;
char s[256];
- char *pagedictkeys[] =
+ const char *pagedictkeys[] =
{ "Group", "LastModified", "Metadata", "PieceInfo", "Resources",
"SeparationInfo", NULL
};
-
assert(idict != NULL);
- // calculate a checksum string
- checksum = get_file_checksum(img_filepath(idict));
+
// open PDF file
- pdf_doc = refPdfDocument(img_filepath(idict));
- if (strncmp(pdf_doc->checksum, checksum, PDF_CHECKSUM_SIZE) != 0) {
- pdftex_fail("PDF inclusion: file has changed '%s'",
- img_filename(idict));
- }
- free(checksum);
+ pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL);
page = pdf_doc->doc->getCatalog()->getPage(img_pagenum(idict));
pageref = pdf_doc->doc->getCatalog()->getPageRef(img_pagenum(idict));
assert(pageref != NULL); // was checked already in read_pdf_info()
- pdf_doc->doc->getXRef()->fetch(pageref->num, pageref->gen, &pageObj);
- pageDict = pageObj->getDict();
+ pdf_doc->doc->getXRef()->fetch(pageref->num, pageref->gen, &pageobj);
+ pageDict = pageobj.getDict();
// write the Page header
pdf_puts(pdf, "/Type /XObject\n/Subtype /Form\n");
@@ -652,12 +702,13 @@ static void write_epdf1(PDF pdf, image_dict * idict)
strlen(pdf_doc->file_path)));
pdf_printf(pdf, "/%s.PageNumber %i\n", pdfkeyprefix,
(int) img_pagenum(idict));
- pdf_doc->doc->getDocInfoNF(&info);
- if (info->isRef()) {
+ pdf_doc->doc->getDocInfoNF(&obj1);
+ if (obj1.isRef()) {
// the info dict must be indirect (PDF Ref p. 61)
pdf_printf(pdf, "/%s.InfoDict ", pdfkeyprefix);
- pdf_printf(pdf, "%d 0 R\n", addInObj(pdf, pdf_doc, info->getRef()));
+ pdf_printf(pdf, "%d 0 R\n", addInObj(pdf, pdf_doc, obj1.getRef()));
}
+ obj1.free();
if (img_is_bbox(idict)) {
bbox[0] = int2bp(img_bbox(idict)[0]);
bbox[1] = int2bp(img_bbox(idict)[1]);
@@ -678,33 +729,54 @@ static void write_epdf1(PDF pdf, image_dict * idict)
// Now all relevant parts of the Page dictionary are copied:
- // Resources validity check
- pageDict->lookupNF("Resources", &dictObj);
- if (dictObj->isNull()) {
- // Resources can be missing (files without them have been spotted
- // in the wild); in which case the /Resouces of the /Page will be used.
- // "This practice is not recommended".
- pdftex_warn
- ("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref.)");
- }
-
// Metadata validity check (as a stream it must be indirect)
- pageDict->lookupNF("Metadata", &dictObj);
- if (!dictObj->isNull() && !dictObj->isRef())
+ pageDict->lookupNF((char *) "Metadata", &obj1);
+ if (!obj1.isNull() && !obj1.isRef())
pdftex_warn("PDF inclusion: /Metadata must be indirect object");
+ obj1.free();
// copy selected items in Page dictionary
for (i = 0; pagedictkeys[i] != NULL; i++) {
- pageDict->lookupNF(pagedictkeys[i], &dictObj);
- if (!dictObj->isNull()) {
+ pageDict->lookupNF((char *) pagedictkeys[i], &obj1);
+ if (!obj1.isNull()) {
pdf_printf(pdf, "/%s ", pagedictkeys[i]);
- copyObject(pdf, pdf_doc, &dictObj); // preserves indirection
+ copyObject(pdf, pdf_doc, &obj1); // preserves indirection
}
+ obj1.free();
+ }
+
+ // If there are no Resources in the Page dict of the embedded page,
+ // try to inherit the Resources from the Pages tree of the embedded
+ // PDF file, climbing up the tree until the Resources are found.
+ // (This fixes a problem with Scribus 1.3.3.14.)
+ pageDict->lookupNF((char *) "Resources", &obj1);
+ if (obj1.isNull()) {
+ op1 = &pagesobj1;
+ op2 = &pagesobj2;
+ pageDict->lookup((char *) "Parent", op1);
+ while (op1->isDict()) {
+ obj1.free();
+ op1->dictLookupNF((char *) "Resources", &obj1);
+ if (!obj1.isNull()) {
+ pdf_puts(pdf, "/Resources ");
+ copyObject(pdf, pdf_doc, &obj1);
+ break;
+ }
+ op1->dictLookup((char *) "Parent", op2);
+ optmp = op1;
+ op1 = op2;
+ op2 = optmp;
+ op2->free();
+ };
+ if (!op1->isDict())
+ pdftex_warn("PDF inclusion: Page /Resources missing.");
+ op1->free();
}
+ obj1.free();
// write the Page contents
page->getContents(&contents);
- if (contents->isStream()) {
+ if (contents.isStream()) {
// Variant A: get stream and recompress under control
// of \pdfcompresslevel
//
@@ -714,37 +786,39 @@ static void write_epdf1(PDF pdf, image_dict * idict)
// Variant B: copy stream without recompressing
//
- contents->streamGetDict()->lookup((char *) "F", &obj1);
- if (!obj1->isNull()) {
+ contents.streamGetDict()->lookup((char *) "F", &obj1);
+ if (!obj1.isNull()) {
pdftex_fail("PDF inclusion: Unsupported external stream");
}
- contents->streamGetDict()->lookup((char *) "Length", &obj1);
- assert(!obj1->isNull());
+ obj1.free();
+ contents.streamGetDict()->lookup((char *) "Length", &obj1);
+ assert(!obj1.isNull());
pdf_puts(pdf, "/Length ");
copyObject(pdf, pdf_doc, &obj1);
+ obj1.free();
pdf_puts(pdf, "\n");
- contents->streamGetDict()->lookup((char *) "Filter", &obj1);
- if (!obj1->isNull()) {
+ contents.streamGetDict()->lookup((char *) "Filter", &obj1);
+ if (!obj1.isNull()) {
pdf_puts(pdf, "/Filter ");
copyObject(pdf, pdf_doc, &obj1);
+ obj1.free();
pdf_puts(pdf, "\n");
- contents->streamGetDict()->lookup((char *) "DecodeParms", &obj1);
- if (!obj1->isNull()) {
+ contents.streamGetDict()->lookup((char *) "DecodeParms", &obj1);
+ if (!obj1.isNull()) {
pdf_puts(pdf, "/DecodeParms ");
copyObject(pdf, pdf_doc, &obj1);
pdf_puts(pdf, "\n");
}
}
+ obj1.free();
pdf_puts(pdf, ">>\nstream\n");
- copyStreamStream(pdf, contents->getStream()->getBaseStream());
+ copyStreamStream(pdf, contents.getStream()->getBaseStream());
pdf_end_stream(pdf);
- } else if (contents->isArray()) {
+ } else if (contents.isArray()) {
pdf_begin_stream(pdf);
- for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
- PdfObject contentsobj;
- copyStreamStream(pdf,
- (contents->
- arrayGet(i, &contentsobj))->getStream());
+ for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
+ copyStreamStream(pdf, (contents.arrayGet(i, &obj1))->getStream());
+ obj1.free();
if (i < (l - 1)) {
// put a space between streams to be on the safe side (streams
// should have a trailing space here, but one never knows)
@@ -758,14 +832,13 @@ static void write_epdf1(PDF pdf, image_dict * idict)
}
// write out all indirect objects
writeRefs(pdf, pdf_doc);
-}
-
-// this relay function is needed to keep some destructor quiet (???)
-
-void write_epdf(PDF pdf, image_dict * idict)
-{
- write_epdf1(pdf, idict);
+ contents.free();
+ pageobj.free();
+ // unrefPdfDocument() must come after contents.free() and pageobj.free()!
+ // TH: The next line makes repeated pdf inclusion unacceptably slow
+#if 0
unrefPdfDocument(img_filepath(idict));
+#endif
}
//**********************************************************************
@@ -780,8 +853,12 @@ static void deletePdfDocumentPdfDoc(PdfDocument * pdf_doc)
n = r->next;
delete r;
}
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: Deleting PDFDoc %s\n", pdf_doc->file_path);
+#endif
delete pdf_doc->doc;
pdf_doc->doc = NULL;
+ pdf_doc->pc++;
}
static void destroyPdfDocument(void *pa, void * /*pb */ )
@@ -798,16 +875,13 @@ void unrefPdfDocument(char *file_path)
{
PdfDocument *pdf_doc = findPdfDocument(file_path);
assert(pdf_doc != NULL);
- assert(pdf_doc->occurences > 0); // aim for point landing
+ assert(pdf_doc->occurences != 0); // aim for point landing
pdf_doc->occurences--;
#ifdef DEBUG
- fprintf(stderr, "\nluatex Debug: Decrementing %s (%d)\n",
+ fprintf(stderr, "\nDEBUG: Decrementing %s (%d)\n",
pdf_doc->file_path, pdf_doc->occurences);
#endif
if (pdf_doc->occurences == 0) {
-#ifdef DEBUG
- fprintf(stderr, "\nluatex Debug: Deleting %s\n", pdf_doc->file_path);
-#endif
assert(pdf_doc->inObjList == NULL); // should be eaten up already
deletePdfDocumentPdfDoc(pdf_doc);
}
@@ -816,7 +890,7 @@ void unrefPdfDocument(char *file_path)
// Called when PDF embedding system is finalized.
// Now deallocate all remaining PdfDocuments.
-void epdf_check_mem()
+void epdf_free()
{
if (PdfDocumentTree != NULL)
avl_destroy(PdfDocumentTree, destroyPdfDocument);
diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w
index 45aeacd5fe7..57f0740f04b 100644
--- a/Build/source/texk/web2c/luatexdir/image/writeimg.w
+++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w
@@ -22,8 +22,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writeimg.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/image/writeimg.w $";
+ "$Id: writeimg.w 4055 2011-01-10 19:52:50Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/writeimg.w $";
#include <assert.h>
#include "ptexlib.h"
@@ -33,6 +33,7 @@ static const char _svn_version[] =
@ @c
#include "image/image.h"
#include "image/writejpg.h"
+#include "image/writejp2.h"
#include "image/writepng.h"
#include "image/writejbig2.h"
@@ -122,6 +123,7 @@ static const char _svn_version[] =
#define HEADER_JPG "\xFF\xD8"
#define HEADER_PNG "\x89PNG\r\n\x1A\n"
#define HEADER_JBIG2 "\x97\x4A\x42\x32\x0D\x0A\x1A\x0A"
+#define HEADER_JP2 "\x6A\x50\x20\x20"
#define HEADER_PDF "%PDF-1."
#define MAX_HEADER (sizeof(HEADER_PNG)-1)
@@ -145,6 +147,8 @@ static void check_type_by_header(image_dict * idict)
/* tests */
if (strncmp(header, HEADER_JPG, sizeof(HEADER_JPG) - 1) == 0)
img_type(idict) = IMG_TYPE_JPG;
+ else if (strncmp(header + 4, HEADER_JP2, sizeof(HEADER_JP2) - 1) == 0)
+ img_type(idict) = IMG_TYPE_JP2;
else if (strncmp(header, HEADER_PNG, sizeof(HEADER_PNG) - 1) == 0)
img_type(idict) = IMG_TYPE_PNG;
else if (strncmp(header, HEADER_JBIG2, sizeof(HEADER_JBIG2) - 1) == 0)
@@ -169,6 +173,8 @@ static void check_type_by_extension(image_dict * idict)
else if (strcasecmp(image_suffix, ".jpg") == 0 ||
strcasecmp(image_suffix, ".jpeg") == 0)
img_type(idict) = IMG_TYPE_JPG;
+ else if (strcasecmp(image_suffix, ".jp2") == 0)
+ img_type(idict) = IMG_TYPE_JP2;
else if (strcasecmp(image_suffix, ".jbig2") == 0 ||
strcasecmp(image_suffix, ".jb2") == 0)
img_type(idict) = IMG_TYPE_JBIG2;
@@ -257,6 +263,9 @@ void free_image_dict(image_dict * p)
case IMG_TYPE_JPG: /* assuming |IMG_CLOSEINBETWEEN| */
assert(img_jpg_ptr(p) == NULL);
break;
+ case IMG_TYPE_JP2: /* */
+ assert(img_jp2_ptr(p) == NULL);
+ break;
case IMG_TYPE_JBIG2: /* todo: writejbig2.w cleanup */
break;
case IMG_TYPE_PDFSTREAM:
@@ -295,7 +304,7 @@ void read_img(PDF pdf,
img_filepath(idict) =
kpse_find_file(img_filename(idict), kpse_tex_format, true);
if (img_filepath(idict) == NULL)
- pdftex_fail("cannot find image file");
+ pdftex_fail("cannot find image file '%s'", img_filename(idict));
}
recorder_record_input(img_filename(idict));
/* type checks */
@@ -314,6 +323,9 @@ void read_img(PDF pdf,
case IMG_TYPE_JPG:
read_jpg_info(pdf, idict, IMG_CLOSEINBETWEEN);
break;
+ case IMG_TYPE_JP2:
+ read_jp2_info(idict, IMG_CLOSEINBETWEEN);
+ break;
case IMG_TYPE_JBIG2:
if (minor_version < 4) {
pdftex_fail
@@ -338,9 +350,8 @@ static image_dict *read_image(PDF pdf, char *file_name, int page_num,
{
image *a = new_image();
image_dict *idict = img_dict(a) = new_image_dict();
- incr(pdf->ximage_count);
- pdf_create_obj(pdf, obj_type_ximage, pdf->ximage_count);
- img_objnum(idict) = pdf->obj_ptr;
+ pdf->ximage_count++;
+ img_objnum(idict) = pdf_create_obj(pdf, obj_type_ximage, pdf->ximage_count);
img_index(idict) = pdf->ximage_count;
set_obj_data_ptr(pdf, img_objnum(idict), img_index(idict));
idict_to_array(idict);
@@ -429,7 +440,7 @@ void scan_pdfrefximage(PDF pdf)
scaled_whd alt_rule, dim;
alt_rule = scan_alt_rule(); /* scans |<rule spec>| to |alt_rule| */
scan_int();
- check_obj_exists(pdf, obj_type_ximage, cur_val);
+ check_obj_type(pdf, obj_type_ximage, cur_val);
new_whatsit(pdf_refximage_node);
idict = idict_array[obj_data_ptr(pdf, cur_val)];
if (alt_rule.wd != null_flag || alt_rule.ht != null_flag
@@ -577,6 +588,9 @@ void write_img(PDF pdf, image_dict * idict)
case IMG_TYPE_JPG:
write_jpg(pdf, idict);
break;
+ case IMG_TYPE_JP2:
+ write_jp2(pdf, idict);
+ break;
case IMG_TYPE_JBIG2:
write_jbig2(pdf, idict);
break;
@@ -777,8 +791,8 @@ void undumpimagemeta(PDF pdf, int pdfversion, int pdfinclusionerrorlevel)
undumpinteger(img_pagenum(idict));
break;
case IMG_TYPE_PNG:
- break;
case IMG_TYPE_JPG:
+ case IMG_TYPE_JP2:
break;
case IMG_TYPE_JBIG2:
if (pdfversion < 4) {
diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.h b/Build/source/texk/web2c/luatexdir/image/writejbig2.h
index a5715d5732e..6609c2d2f99 100644
--- a/Build/source/texk/web2c/luatexdir/image/writejbig2.h
+++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.h
@@ -18,13 +18,16 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: writejbig2.h 2579 2009-06-23 14:12:23Z taco $ */
+/* $Id: writejbig2.h 4051 2011-01-09 22:41:33Z hhenkel $ */
#ifndef WRITEJBIG2_H
# define WRITEJBIG2_H
# include "image.h"
+unsigned int read2bytes(FILE * f);
+unsigned int read4bytes(FILE * f);
+
void flush_jbig2_page0_objects(PDF);
void read_jbig2_info(image_dict *);
void write_jbig2(PDF, image_dict *);
diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.w b/Build/source/texk/web2c/luatexdir/image/writejbig2.w
index 0e578f9b457..6828ba418aa 100644
--- a/Build/source/texk/web2c/luatexdir/image/writejbig2.w
+++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.w
@@ -1,7 +1,8 @@
% writejbig2.w
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2009 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2003-2011 Hartmut Henkel <hartmut@@luatex.org>
% This file is part of LuaTeX.
@@ -80,8 +81,8 @@ object exists, reference it. Else create fresh one.
@ @c
static const char _svn_version[] =
- "$Id: writejbig2.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/image/writejbig2.w $";
+ "$Id: writejbig2.w 4058 2011-01-10 20:44:28Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/writejbig2.w $";
#undef DEBUG
@@ -347,14 +348,14 @@ static SEGINFO *find_seginfo(LIST * slp, unsigned long segnum)
}
@ @c
-static unsigned int read2bytes(FILE * f)
+unsigned int read2bytes(FILE * f)
{
unsigned int c = (unsigned int) ygetc(f);
return (c << 8) + (unsigned int) ygetc(f);
}
@ @c
-static unsigned long read4bytes(FILE * f)
+unsigned int read4bytes(FILE * f)
{
unsigned int l = read2bytes(f);
return (l << 16) + read2bytes(f);
@@ -503,7 +504,7 @@ static boolean readseghdr(FILEINFO * fip, SEGINFO * sip)
}
/* 7.2.6 Segment page association */
if (sip->pageassocsizeflag)
- sip->segpage = (long int) read4bytes(fip->file);
+ sip->segpage = read4bytes(fip->file);
else
sip->segpage = ygetc(fip->file);
/* 7.2.7 Segment data length */
@@ -683,17 +684,17 @@ static void rd_jbig2_info(FILEINFO * fip)
/* 7.4.8 Page information segment syntax */
if (sip->pageinfoflag) {
pip->pagenum = (unsigned long) sip->segpage;
- pip->width = (unsigned) read4bytes(fip->file);
- pip->height = (unsigned) read4bytes(fip->file);
- pip->xres = (unsigned) read4bytes(fip->file);
- pip->yres = (unsigned) read4bytes(fip->file);
+ pip->width = read4bytes(fip->file);
+ pip->height = read4bytes(fip->file);
+ pip->xres = read4bytes(fip->file);
+ pip->yres = read4bytes(fip->file);
pip->pagesegmentflags = (unsigned) ygetc(fip->file);
/* 7.4.8.6 Page striping information */
pip->stripinginfo = read2bytes(fip->file);
seekdist -= 19;
}
if (sip->endofstripeflag) {
- pip->stripedheight = (unsigned) read4bytes(fip->file);
+ pip->stripedheight = read4bytes(fip->file);
seekdist -= 4;
}
if (!fip->sequentialaccess
@@ -732,8 +733,8 @@ static void wr_jbig2(PDF pdf, FILEINFO * fip, unsigned long page)
pdf_puts(pdf, "/Filter [/JBIG2Decode]\n");
if (fip->page0.last != NULL) {
if (fip->pdfpage0objnum == 0) {
- pdf_create_obj(pdf, obj_type_others, 0);
- fip->pdfpage0objnum = (unsigned long) pdf->obj_ptr;
+ fip->pdfpage0objnum =
+ (unsigned long) pdf_create_obj(pdf, obj_type_others, 0);
}
pdf_printf(pdf, "/DecodeParms [<< /JBIG2Globals %lu 0 R >>]\n",
fip->pdfpage0objnum);
diff --git a/Build/source/texk/web2c/luatexdir/image/writejp2.h b/Build/source/texk/web2c/luatexdir/image/writejp2.h
new file mode 100644
index 00000000000..04e350f3c9e
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/image/writejp2.h
@@ -0,0 +1,31 @@
+/* writejp2.h
+
+ Copyright 2011 Taco Hoekwater <taco@luatex.org>
+ Copyright 2011 Hartmut Henkel <hartmut@luatex.org>
+
+ This file is part of LuaTeX.
+
+ LuaTeX is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+
+/* $Id: writejp2.h 4060 2011-01-11 00:01:57Z hhenkel $ */
+
+#ifndef WRITEJP2_H
+# define WRITEJP2_H
+
+# include "image.h"
+
+void read_jp2_info(image_dict *, img_readtype_e);
+void write_jp2(PDF, image_dict *);
+
+#endif /* WRITEJP2_H */
diff --git a/Build/source/texk/web2c/luatexdir/image/writejp2.w b/Build/source/texk/web2c/luatexdir/image/writejp2.w
new file mode 100644
index 00000000000..1d27f733c56
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/image/writejp2.w
@@ -0,0 +1,282 @@
+% writejp2.w
+
+% Copyright 2011 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2011 Hartmut Henkel <hartmut@@luatex.org>
+
+% This file is part of LuaTeX.
+
+% LuaTeX is free software; you can redistribute it and/or modify it under
+% the terms of the GNU General Public License as published by the Free
+% Software Foundation; either version 2 of the License, or (at your
+% option) any later version.
+
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
+
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+
+@ @c
+static const char _svn_version[] =
+ "$Id: writejp2.w 4133 2011-04-11 16:54:11Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/writejp2.w $";
+
+@ Basic JPEG~2000 image support. Section and Table references below:
+Information technology --- JPEG~2000 image coding system: Core coding system.
+ISO/IEC 15444-1, Second edition, 2004-09-15, file |15444-1annexi.pdf|.
+
+@c
+#include <math.h>
+#include <assert.h>
+#include "ptexlib.h"
+#include "image/image.h"
+#include "image/writejp2.h"
+#include "image/writejbig2.h" /* read2bytes(), read4bytes() */
+
+/* Table 1.2 -- Defined boxes */
+#define BOX_JP 0x6A502020
+#define BOX_FTYP 0x66747970
+#define BOX_JP2H 0x6a703268
+#define BOX_IHDR 0x69686472
+#define BOX_BPCC 0x62706363
+#define BOX_COLR 0x636D6170
+#define BOX_CDEF 0x63646566
+#define BOX_RES 0x72657320
+#define BOX_RESC 0x72657363
+#define BOX_RESD 0x72657364
+#define BOX_JP2C 0x6A703263
+
+/* 1.4 Box definition */
+typedef struct {
+ unsigned long long lbox;
+ unsigned int tbox;
+} hdr_struct;
+
+static unsigned long long read8bytes(FILE * f)
+{
+ unsigned long long l = read4bytes(f);
+ l = (l << 32) + read4bytes(f);
+ return l;
+}
+
+static hdr_struct read_boxhdr(image_dict * idict)
+{
+ hdr_struct hdr;
+ hdr.lbox = read4bytes(img_file(idict));
+ hdr.tbox = read4bytes(img_file(idict));
+ if (hdr.lbox == 1)
+ hdr.lbox = read8bytes(img_file(idict));
+ if (hdr.lbox == 0 && hdr.tbox != BOX_JP2C)
+ pdftex_fail("reading JP2 image failed (LBox == 0)");
+ return hdr;
+}
+
+/* 1.5.3.1 Image Header box */
+static void scan_ihdr(image_dict * idict)
+{
+ unsigned int height, width, nc;
+ unsigned char bpc, c, unkc, ipr;
+ height = read4bytes(img_file(idict));
+ width = read4bytes(img_file(idict));
+ img_ysize(idict) = (int) height;
+ img_xsize(idict) = (int) width;
+ nc = read2bytes(img_file(idict));
+ bpc = (unsigned char) xgetc(img_file(idict));
+ img_colordepth(idict) = bpc + 1;
+ c = (unsigned char) xgetc(img_file(idict));
+ unkc = (unsigned char) xgetc(img_file(idict));
+ ipr = (unsigned char) xgetc(img_file(idict));
+}
+
+/* 1.5.3.7.1 Capture Resolution box */
+/* 1.5.3.7.2 Default Display Resolution box */
+static void scan_resc_resd(image_dict * idict)
+{
+ unsigned int vr_n, vr_d, hr_n, hr_d;
+ unsigned char vr_e, hr_e;
+ double hr_, vr_;
+ vr_n = read2bytes(img_file(idict));
+ vr_d = read2bytes(img_file(idict));
+ hr_n = read2bytes(img_file(idict));
+ hr_d = read2bytes(img_file(idict));
+ vr_e = (unsigned char) xgetc(img_file(idict));
+ hr_e = (unsigned char) xgetc(img_file(idict));
+ hr_ = ((double) hr_n / hr_d) * exp(hr_e * log(10.0)) * 0.0254;
+ vr_ = ((double) vr_n / vr_d) * exp(vr_e * log(10.0)) * 0.0254;
+ img_xres(idict) = (int) (hr_ + 0.5);
+ img_yres(idict) = (int) (vr_ + 0.5);
+}
+
+/* 1.5.3.7 Resolution box (superbox) */
+static void scan_res(image_dict * idict, unsigned long long epos_s)
+{
+ hdr_struct hdr;
+ unsigned long long spos, epos;
+ epos = xftell(img_file(idict), img_filepath(idict));
+ while (1) {
+ spos = epos;
+ hdr = read_boxhdr(idict);
+ epos = spos + hdr.lbox;
+ switch (hdr.tbox) {
+ case (BOX_RESC):
+ /* arbitrarily: let BOX_RESD have precedence */
+ if (img_xres(idict) == 0 && img_yres(idict) == 0) {
+ scan_resc_resd(idict);
+ if (xftell(img_file(idict), img_filepath(idict)) != (long)epos)
+ pdftex_fail
+ ("reading JP2 image failed (resc box size inconsistent)");
+ }
+ break;
+ case (BOX_RESD):
+ scan_resc_resd(idict);
+ if (xftell(img_file(idict), img_filepath(idict)) != (long)epos)
+ pdftex_fail
+ ("reading JP2 image failed (resd box size inconsistent)");
+ break;
+ default:;
+ }
+ if (epos > epos_s)
+ pdftex_fail("reading JP2 image failed (res box size inconsistent)");
+ if (epos == epos_s)
+ break;
+ xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict));
+ }
+}
+
+/* 1.5.3 JP2 Header box (superbox) */
+static boolean scan_jp2h(image_dict * idict, unsigned long long epos_s)
+{
+ boolean ihdr_found = false;
+ hdr_struct hdr;
+ unsigned long long spos, epos;
+ epos = xftell(img_file(idict), img_filepath(idict));
+ while (1) {
+ spos = epos;
+ hdr = read_boxhdr(idict);
+ epos = spos + hdr.lbox;
+ switch (hdr.tbox) {
+ case (BOX_IHDR):
+ scan_ihdr(idict);
+ if (xftell(img_file(idict), img_filepath(idict)) != (long)epos)
+ pdftex_fail
+ ("reading JP2 image failed (ihdr box size inconsistent)");
+ ihdr_found = true;
+ break;
+ case (BOX_RES):
+ scan_res(idict, epos);
+ break;
+ default:;
+ }
+ if (epos > epos_s)
+ pdftex_fail
+ ("reading JP2 image failed (jp2h box size inconsistent)");
+ if (epos == epos_s)
+ break;
+ xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict));
+ }
+ return ihdr_found;
+}
+
+static void close_and_cleanup_jp2(image_dict * idict)
+{
+ assert(idict != NULL);
+ assert(img_file(idict) != NULL);
+ assert(img_filepath(idict) != NULL);
+ xfclose(img_file(idict), img_filepath(idict));
+ img_file(idict) = NULL;
+ assert(img_jp2_ptr(idict) != NULL);
+ xfree(img_jp2_ptr(idict));
+}
+
+void read_jp2_info(image_dict * idict, img_readtype_e readtype)
+{
+ boolean ihdr_found = false;
+ hdr_struct hdr;
+ unsigned long long spos, epos;
+ assert(img_type(idict) == IMG_TYPE_JP2);
+ img_totalpages(idict) = 1;
+ img_pagenum(idict) = 1;
+ img_xres(idict) = img_yres(idict) = 0;
+ assert(img_file(idict) == NULL);
+ img_file(idict) = xfopen(img_filepath(idict), FOPEN_RBIN_MODE);
+ assert(img_jp2_ptr(idict) == NULL);
+ img_jp2_ptr(idict) = xtalloc(1, jp2_img_struct);
+ xfseek(img_file(idict), 0, SEEK_END, img_filepath(idict));
+ img_jp2_ptr(idict)->length =
+ (int) xftell(img_file(idict), img_filepath(idict));
+ xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict));
+
+ assert(sizeof(unsigned long long) >= 8);
+ spos = epos = 0;
+
+ /* 1.5.1 JPEG 2000 Signature box */
+ hdr = read_boxhdr(idict);
+ assert(hdr.tbox == BOX_JP); /* has already been checked */
+ epos = spos + hdr.lbox;
+ xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict));
+
+ /* 1.5.2 File Type box */
+ spos = epos;
+ hdr = read_boxhdr(idict);
+ if (hdr.tbox != BOX_FTYP)
+ pdftex_fail("reading JP2 image failed (missing ftyp box)");
+ epos = spos + hdr.lbox;
+ xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict));
+
+ while (!ihdr_found) {
+ spos = epos;
+ hdr = read_boxhdr(idict);
+ epos = spos + hdr.lbox;
+ switch (hdr.tbox) {
+ case BOX_JP2H:
+ ihdr_found = scan_jp2h(idict, epos);
+ break;
+ case BOX_JP2C:
+ if (!ihdr_found)
+ pdftex_fail("reading JP2 image failed (no ihdr box found)");
+ break;
+ default:;
+ }
+ xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict));
+ }
+ if (readtype == IMG_CLOSEINBETWEEN)
+ close_and_cleanup_jp2(idict);
+}
+
+static void reopen_jp2(image_dict * idict)
+{
+ int width, height, xres, yres;
+ width = img_xsize(idict);
+ height = img_ysize(idict);
+ xres = img_xres(idict);
+ yres = img_yres(idict);
+ read_jp2_info(idict, IMG_KEEPOPEN);
+ if (width != img_xsize(idict) || height != img_ysize(idict)
+ || xres != img_xres(idict) || yres != img_yres(idict))
+ pdftex_fail("writejp2: image dimensions have changed");
+}
+
+void write_jp2(PDF pdf, image_dict * idict)
+{
+ long unsigned l;
+ FILE *f;
+ assert(idict != NULL);
+ if (img_file(idict) == NULL)
+ reopen_jp2(idict);
+ xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict));
+ assert(img_jp2_ptr(idict) != NULL);
+ pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf(pdf, "%s\n", img_attr(idict));
+ pdf_printf(pdf, "/Width %i\n/Height %i\n/Length %i\n",
+ (int) img_xsize(idict),
+ (int) img_ysize(idict), (int) img_jp2_ptr(idict)->length);
+ pdf_puts(pdf, "/Filter /JPXDecode\n>>\nstream\n");
+ for (l = (long unsigned int) img_jp2_ptr(idict)->length, f =
+ img_file(idict); l > 0; l--)
+ pdf_out(pdf, xgetc(f));
+ pdf_end_stream(pdf);
+ close_and_cleanup_jp2(idict);
+}
diff --git a/Build/source/texk/web2c/luatexdir/image/writejpg.w b/Build/source/texk/web2c/luatexdir/image/writejpg.w
index 4f77303ce20..e7a202c54f3 100644
--- a/Build/source/texk/web2c/luatexdir/image/writejpg.w
+++ b/Build/source/texk/web2c/luatexdir/image/writejpg.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writejpg.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/image/writejpg.w $";
+ "$Id: writejpg.w 4095 2011-03-31 21:14:27Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/writejpg.w $";
#include <assert.h>
#include "ptexlib.h"
@@ -41,18 +41,18 @@ typedef enum { /* JPEG marker codes */
M_SOF5 = 0xc5, /* differential sequential DCT */
M_SOF6 = 0xc6, /* differential progressive DCT */
- M_SOF7 = 0xc7, /* differential lossless */
+ M_SOF7 = 0xc7, /* differential lossless (sequential) */
- M_JPG = 0xc8, /* JPEG extensions */
+ M_JPG = 0xc8, /* reserved for JPEG extensions */
M_SOF9 = 0xc9, /* extended sequential DCT */
M_SOF10 = 0xca, /* progressive DCT */
M_SOF11 = 0xcb, /* lossless (sequential) */
M_SOF13 = 0xcd, /* differential sequential DCT */
M_SOF14 = 0xce, /* differential progressive DCT */
- M_SOF15 = 0xcf, /* differential lossless */
+ M_SOF15 = 0xcf, /* differential lossless (sequential) */
- M_DHT = 0xc4, /* define Huffman tables */
+ M_DHT = 0xc4, /* define Huffman table(s) */
M_DAC = 0xcc, /* define arithmetic conditioning table */
@@ -101,13 +101,6 @@ typedef enum { /* JPEG marker codes */
} JPEG_MARKER;
@ @c
-static JPG_UINT16 read2bytes(FILE * f)
-{
- int c = xgetc(f);
- return (JPG_UINT16) ((c << 8) + (int) xgetc(f));
-}
-
-@ @c
static void close_and_cleanup_jpg(image_dict * idict)
{
assert(idict != NULL);
@@ -117,7 +110,6 @@ static void close_and_cleanup_jpg(image_dict * idict)
img_file(idict) = NULL;
assert(img_jpg_ptr(idict) != NULL);
xfree(img_jpg_ptr(idict));
- img_jpg_ptr(idict) = NULL;
}
@ @c
@@ -137,17 +129,17 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype)
xfseek(img_file(idict), 0, SEEK_END, img_filepath(idict));
img_jpg_ptr(idict)->length = xftell(img_file(idict), img_filepath(idict));
xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict));
- if (read2bytes(img_file(idict)) != 0xFFD8)
+ if ((unsigned int) read2bytes(img_file(idict)) != 0xFFD8)
pdftex_fail("reading JPEG image failed (no JPEG header found)");
/* currently only true JFIF files allow extracting |img_xres| and |img_yres| */
- if (read2bytes(img_file(idict)) == 0xFFE0) { /* check for JFIF */
+ if ((unsigned int) read2bytes(img_file(idict)) == 0xFFE0) { /* check for JFIF */
(void) read2bytes(img_file(idict));
for (i = 0; i < 5; i++) {
if (xgetc(img_file(idict)) != jpg_id[i])
break;
}
if (i == 5) { /* it's JFIF */
- read2bytes(img_file(idict));
+ (void) read2bytes(img_file(idict));
units = xgetc(img_file(idict));
img_xres(idict) = (int) read2bytes(img_file(idict));
img_yres(idict) = (int) read2bytes(img_file(idict));
@@ -177,23 +169,25 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype)
pdftex_fail("reading JPEG image failed (premature file end)");
if (fgetc(img_file(idict)) != 0xFF)
pdftex_fail("reading JPEG image failed (no marker found)");
- switch (xgetc(img_file(idict))) {
+ i = xgetc(img_file(idict));
+ switch (i) {
+ case M_SOF3: /* lossless */
case M_SOF5:
case M_SOF6:
- case M_SOF7:
+ case M_SOF7: /* lossless */
case M_SOF9:
case M_SOF10:
- case M_SOF11:
+ case M_SOF11: /* lossless */
case M_SOF13:
case M_SOF14:
- case M_SOF15:
- pdftex_fail("unsupported type of compression");
+ case M_SOF15: /* lossless */
+ pdftex_fail("unsupported type of compression (SOF_%d)", i - M_SOF0);
+ break;
case M_SOF2:
if (pdf->minor_version <= 2)
pdftex_fail("cannot use progressive DCT with PDF-1.2");
case M_SOF0:
case M_SOF1:
- case M_SOF3:
(void) read2bytes(img_file(idict)); /* read segment length */
img_colordepth(idict) = xgetc(img_file(idict));
img_ysize(idict) = (int) read2bytes(img_file(idict));
@@ -230,7 +224,7 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype)
case M_RST7:
break;
default: /* skip variable length markers */
- xfseek(img_file(idict), read2bytes(img_file(idict)) - 2,
+ xfseek(img_file(idict), (int) read2bytes(img_file(idict)) - 2,
SEEK_CUR, img_filepath(idict));
break;
}
diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.w b/Build/source/texk/web2c/luatexdir/image/writepng.w
index fbe80259a63..7d497deea0e 100644
--- a/Build/source/texk/web2c/luatexdir/image/writepng.w
+++ b/Build/source/texk/web2c/luatexdir/image/writepng.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writepng.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/image/writepng.w $";
+ "$Id: writepng.w 4133 2011-04-11 16:54:11Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/image/writepng.w $";
#include <assert.h>
#include "ptexlib.h"
@@ -42,7 +42,6 @@ static void close_and_cleanup_png(image_dict * idict)
png_destroy_read_struct(&(img_png_png_ptr(idict)),
&(img_png_info_ptr(idict)), NULL);
xfree(img_png_ptr(idict));
- img_png_ptr(idict) = NULL;
}
@ @c
@@ -115,7 +114,7 @@ void read_png_info(PDF pdf, image_dict * idict, img_readtype_e readtype)
img_procset(idict) |= PROCSET_IMAGE_C;
break;
default:
- pdftex_fail("unsupported type of color_type <%i>", png_get_color_type(png_p, info_p));
+ pdftex_fail("unsupported type of color_type <%i>", (int)png_get_color_type (png_p, info_p));
}
img_colordepth(idict) = png_get_bit_depth(png_p, info_p);
if (readtype == IMG_CLOSEINBETWEEN)
@@ -187,10 +186,9 @@ static void write_png_palette(PDF pdf, image_dict * idict)
if (img_colorspace(idict) != 0) {
pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
} else {
- pdf_create_obj(pdf, obj_type_others, 0);
- palette_objnum = pdf->obj_ptr;
+ palette_objnum = pdf_create_obj(pdf, obj_type_others, 0);
pdf_printf(pdf, "[/Indexed /DeviceRGB %i %i 0 R]\n",
- num_palette - 1, (int) palette_objnum);
+ (int) (num_palette - 1), (int) palette_objnum);
}
pdf_begin_stream(pdf);
if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
@@ -212,7 +210,7 @@ static void write_png_palette(PDF pdf, image_dict * idict)
if (palette_objnum > 0) {
pdf_begin_dict(pdf, palette_objnum, 0);
pdf_begin_stream(pdf);
- for (i = 0; (unsigned) i < num_palette; i++) {
+ for (i = 0; i < num_palette; i++) {
pdf_room(pdf, 3);
pdf_quick_out(pdf, palette[i].red);
pdf_quick_out(pdf, palette[i].green);
@@ -264,14 +262,13 @@ static void write_png_gray_alpha(PDF pdf, image_dict * idict)
png_bytep smask;
int smask_ptr = 0;
int smask_size = 0;
- int bitdepth;
+ png_byte bitdepth;
if (img_colorspace(idict) != 0) {
pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
} else {
pdf_puts(pdf, "/DeviceGray\n");
}
- pdf_create_obj(pdf, obj_type_others, 0);
- smask_objnum = pdf->obj_ptr;
+ smask_objnum = pdf_create_obj(pdf, obj_type_others, 0);
pdf_printf(pdf, "/SMask %i 0 R\n", (int) smask_objnum);
smask_size = (int) ((png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height (png_p, info_p));
smask = xtalloc((unsigned) smask_size, png_byte);
@@ -302,7 +299,7 @@ static void write_png_gray_alpha(PDF pdf, image_dict * idict)
pdf_end_stream(pdf);
pdf_flush(pdf);
/* now write the Smask object */
- bitdepth = (int) png_get_bit_depth(png_p, info_p);
+ bitdepth = png_get_bit_depth (png_p, info_p);
pdf_begin_dict(pdf, smask_objnum, 0);
pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
@@ -366,16 +363,15 @@ static void write_png_rgb_alpha(PDF pdf, image_dict * idict)
png_bytep smask;
int smask_ptr = 0;
int smask_size = 0;
- int bitdepth;
+ png_byte bitdepth;
if (img_colorspace(idict) != 0) {
pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
} else {
pdf_puts(pdf, "/DeviceRGB\n");
}
- pdf_create_obj(pdf, obj_type_others, 0);
- smask_objnum = pdf->obj_ptr;
+ smask_objnum = pdf_create_obj(pdf, obj_type_others, 0);
pdf_printf(pdf, "/SMask %i 0 R\n", (int) smask_objnum);
- smask_size = (int) ((png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height (png_p, info_p));
+ smask_size = (int) ((png_get_rowbytes (png_p, info_p) / 4) * png_get_image_height (png_p, info_p));
smask = xtalloc((unsigned) smask_size, png_byte);
pdf_begin_stream(pdf);
if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
@@ -405,7 +401,7 @@ static void write_png_rgb_alpha(PDF pdf, image_dict * idict)
pdf_flush(pdf);
/* now write the Smask object */
if (smask_objnum > 0) {
- bitdepth = (int) png_get_bit_depth(png_p, info_p);
+ bitdepth = png_get_bit_depth (png_p, info_p);
pdf_begin_dict(pdf, smask_objnum, 0);
pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
@@ -483,12 +479,12 @@ static void copy_png(PDF pdf, image_dict * idict)
"/Filter/FlateDecode\n"
"/DecodeParms<<"
"/Colors %d"
- "/Columns %d"
+ "/Columns %u"
"/BitsPerComponent %i"
"/Predictor 10>>\n>>\nstream\n", streamlength,
- png_get_color_type(png_p, info_p) == 2 ? 3 : 1,
- (int) png_get_image_width (png_p, info_p),
- png_get_bit_depth(png_p, info_p));
+ png_get_color_type (png_p, info_p) == 2 ? 3 : 1,
+ png_get_image_width (png_p, info_p),
+ png_get_bit_depth (png_p, info_p));
/* 2nd pass to copy data */
endflag = false;
if (fseek(fp, 8, SEEK_SET) != 0)
@@ -575,10 +571,12 @@ void write_png(PDF pdf, image_dict * idict)
}
/* the switching between |info_p| and |png_p| queries has been trial and error.
*/
- if (pdf->minor_version > 1 && png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE
- &&!(png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_GRAY_ALPHA ||
- png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_RGB_ALPHA)
- && ((pdf->image_hicolor != 0) || (png_get_bit_depth(png_p, info_p) <= 8))
+ if (pdf->minor_version > 1
+ && png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE
+ && (png_p->transformations == 0 || png_p->transformations == 0x2000) /* gamma */
+ &&!(png_get_color_type (png_p, info_p) == PNG_COLOR_TYPE_GRAY_ALPHA ||
+ png_get_color_type (png_p, info_p) == PNG_COLOR_TYPE_RGB_ALPHA)
+ && ((pdf->image_hicolor != 0) || (png_get_bit_depth (png_p, info_p) <= 8))
&& (checked_gamma <= 1.01 && checked_gamma > 0.99)
) {
png_colorp palette;
@@ -590,8 +588,7 @@ void write_png(PDF pdf, image_dict * idict)
} else {
switch (png_get_color_type(png_p, info_p)) {
case PNG_COLOR_TYPE_PALETTE:
- pdf_create_obj(pdf, obj_type_others, 0);
- palette_objnum = pdf->obj_ptr;
+ palette_objnum = pdf_create_obj(pdf, obj_type_others, 0);
pdf_printf(pdf, "[/Indexed /DeviceRGB %i %i 0 R]\n",
num_palette - 1, (int) palette_objnum);
break;
@@ -608,7 +605,7 @@ void write_png(PDF pdf, image_dict * idict)
if (palette_objnum > 0) {
pdf_begin_dict(pdf, palette_objnum, 0);
pdf_begin_stream(pdf);
- for (i = 0; (unsigned) i < num_palette; i++) {
+ for (i = 0; i < num_palette; i++) {
pdf_room(pdf, 3);
pdf_quick_out(pdf, palette[i].red);
pdf_quick_out(pdf, palette[i].green);
@@ -622,9 +619,11 @@ void write_png(PDF pdf, image_dict * idict)
if ((pdf->image_apply_gamma != 0) &&
(checked_gamma > 1.01 || checked_gamma < 0.99))
tex_printf("gamma delta=%lf ", checked_gamma);
- if ((png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_GRAY)
- && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_RGB)
- && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_PALETTE))
+ if (png_p->transformations != PNG_TRANSFORM_IDENTITY)
+ tex_printf("transform=%lu", (long) png_p->transformations);
+ if ((png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_GRAY)
+ && (png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_RGB)
+ && (png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_PALETTE))
tex_printf("colortype ");
if (pdf->minor_version <= 1)
tex_printf("version=%d ", pdf->minor_version);
diff --git a/Build/source/texk/web2c/luatexdir/lang/hyphen.w b/Build/source/texk/web2c/luatexdir/lang/hyphen.w
index fc88ac9c571..a5ad227d740 100644
--- a/Build/source/texk/web2c/luatexdir/lang/hyphen.w
+++ b/Build/source/texk/web2c/luatexdir/lang/hyphen.w
@@ -56,8 +56,8 @@
@ @c
static const char _svn_version[] =
- "$Id: hyphen.w 3612 2010-04-13 09:29:42Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lang/hyphen.w $";
+ "$Id: hyphen.w 3831 2010-08-25 04:35:34Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lang/hyphen.w $";
@ TODO: should be moved to separate library
@@ -324,7 +324,7 @@ static char *hyppat_lookup(HashTab * hashtab, const unsigned char *chars, int l)
{
int i;
HashEntry *e;
- unsigned char key[128]; /* should be ample */
+ unsigned char key[256]; /* should be ample */
strncpy((char *) key, (const char *) chars, (size_t) l);
key[l] = 0;
i = (int) (hnj_string_hash(key) % HASH_SIZE);
@@ -604,6 +604,12 @@ void hnj_hyphen_load(HyphenDict * dict, const unsigned char *f)
char *org;
while ((format = next_pattern(&l, &f)) != NULL) {
int i, j, e;
+ if (l>=255) {
+ help1("Individual patterns should not be longer than 254 bytes total.");
+ print_err("Pattern of enormous length ignored");
+ error();
+ continue;
+ }
#if 0
printf("%s\n",format);
char* repl = strnchr(format, '/',l);
diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w
index 9aa55787ca7..01081c02326 100644
--- a/Build/source/texk/web2c/luatexdir/lang/texlang.w
+++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w
@@ -26,13 +26,14 @@
static const char _svn_version[] =
- "$Id: texlang.w 3701 2010-05-26 09:57:17Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/lang/texlang.w $";
+ "$Id: texlang.w 3907 2010-10-04 09:02:29Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lang/texlang.w $";
@ Low-level helpers
@c
+#define ex_hyphen_char int_par(ex_hyphen_char_code)
static char *uni2string(char *utf8_text, unsigned ch)
{
/* Increment and deposit character */
@@ -245,64 +246,82 @@ void load_tex_patterns(int curlang, halfword head)
@ @c
#define STORE_CHAR(x) do { \
- word[w] = (unsigned char)x; \
- if (w<MAX_WORD_LEN) w++; \
+ unsigned xx = get_lc_code(x); \
+ if (!xx) xx = x; \
+ uindex = uni2string(uindex, xx); \
} while (0)
-/* todo change this! */
+/* Cleans one word which is returned in |cleaned|,
+ returns the new offset into |buffer| */
const char *clean_hyphenation(const char *buffer, char **cleaned)
{
- int items;
- unsigned char word[MAX_WORD_LEN + 1];
- int w = 0;
+ int items = 0;
+ unsigned char word[MAX_WORD_LEN + 1]; /* work buffer for bytes */
+ unsigned uword[MAX_WORD_LEN + 1] = { 0 }; /* work buffer for unicode */
+ int u = 0; /* unicode buffer value */
+ int i = 0; /* index into buffer */
+ char *uindex = (char *)word;
const char *s = buffer;
+
while (*s && !isspace(*s)) {
- if (*s == '-') { /* skip */
- } else if (*s == '=') {
+ word[i++] = (unsigned)*s;
+ s++;
+ if ((s-buffer)>MAX_WORD_LEN) {
+ /* todo: this is too strict, should count unicode, not bytes */
+ *cleaned = NULL;
+ tex_error("exception too long", NULL);
+ return s;
+ }
+ }
+ /* now convert the input to unicode */
+ word[i] = '\0';
+ utf82u_strcpy(uword, (const char *)word);
+
+ /* build the new word string */
+ i = 0;
+ while (uword[i]>0) {
+ u = uword[i++];
+ if (u == '-') { /* skip */
+ } else if (u == '=') {
STORE_CHAR('-');
- } else if (*s == '{') {
- s++;
+ } else if (u == '{') {
+ u = uword[i++];
items = 0;
- while (*s && *s != '}') {
- s++;
+ while (u && u != '}') {
+ u = uword[i++];
}
- if (*s == '}') {
+ if (u == '}') {
items++;
- s++;
+ u = uword[i++];
}
- while (*s && *s != '}') {
- s++;
+ while (u && u != '}') {
+ u = uword[i++];
}
- if (*s == '}') {
+ if (u == '}') {
items++;
- s++;
+ u = uword[i++];;
}
- if (*s == '{') {
- s++;
+ if (u == '{') {
+ u = uword[i++];;
}
- while (*s && *s != '}') {
- STORE_CHAR(*s);
- s++;
+ while (u && u != '}') {
+ STORE_CHAR(u);
+ u = uword[i++];
}
- if (*s == '}') {
- items++;
- } else {
- s--;
+ if (u == '}') {
+ items++;
}
if (items != 3) { /* syntax error */
*cleaned = NULL;
- while (*s && !isspace(*s)) {
- s++;
- }
+ tex_error("exception syntax error", NULL);
return s;
}
} else {
- STORE_CHAR(*s);
+ STORE_CHAR(u);
}
- s++;
}
- word[w] = 0;
+ *uindex = '\0';
*cleaned = xstrdup((char *) word);
return s;
}
@@ -824,6 +843,7 @@ void hnj_hyphenation(halfword head, halfword tail)
int wordlen = 0;
char *hy = utf8word;
char *replacement = NULL;
+ boolean explicit_hyphen = false;
halfword s, r = head, wordstart = null, save_tail = null, left =
null, right = null;
@@ -866,7 +886,11 @@ void hnj_hyphenation(halfword head, halfword tail)
type(r) == glyph_node &&
is_simple_character(r) &&
clang == char_lang(r) &&
- (lchar = get_lc_code(character(r))) > 0) {
+ (((lchar = get_lc_code(character(r))) > 0)
+ ||
+ (character(r) == ex_hyphen_char && (lchar = ex_hyphen_char)))) {
+ if (character(r) == ex_hyphen_char)
+ explicit_hyphen = true;
wordlen++;
hy = uni2string(hy, (unsigned) lchar);
/* this should not be needed any more */
@@ -886,6 +910,28 @@ void hnj_hyphenation(halfword head, halfword tail)
#endif
do_exception(wordstart, r, replacement);
free(replacement);
+ } else if (explicit_hyphen == true) {
+ /* insert an explicit discretionary after each of the last in a
+ set of explicit hyphens */
+ halfword rr = r;
+ halfword t = null;
+#ifdef VERBOSE
+ fprintf(stderr, "explicit hyphen(s) found in %s (c=%d)\n", utf8word, clang);
+#endif
+ while (rr != wordstart) {
+ if (is_simple_character(rr)) {
+ if (character(rr) == ex_hyphen_char) {
+ t = compound_word_break(rr, clang);
+ subtype(t) = automatic_disc;
+ while(character(alink(rr)) == ex_hyphen_char)
+ rr = alink(rr);
+ if (rr == wordstart)
+ break;
+ }
+ }
+ rr = alink(rr);
+ }
+
} else if (lang->patterns != NULL) {
left = wordstart;
@@ -910,6 +956,7 @@ void hnj_hyphenation(halfword head, halfword tail)
wordlen, left, right, &langdata);
}
}
+ explicit_hyphen = false;
wordlen = 0;
hy = utf8word;
if (r == null)
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
index a3961703528..98444a9f705 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: lcallbacklib.c 3404 2010-01-28 11:17:10Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lcallbacklib.c $";
+ "$Id: lcallbacklib.c 3965 2010-11-22 12:38:45Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lcallbacklib.c $";
int callback_count = 0;
int saved_callback_count = 0;
@@ -35,7 +35,6 @@ static const char *const callbacknames[] = {
"find_image_file",
"find_format_file",
"find_read_file", "open_read_file",
- "find_ocp_file", "read_ocp_file",
"find_vf_file", "read_vf_file",
"find_data_file", "read_data_file",
"find_font_file", "read_font_file",
@@ -63,11 +62,19 @@ static const char *const callbacknames[] = {
"linebreak_filter",
"post_linebreak_filter",
"mlist_to_hlist",
+ "finish_pdffile",
+ "pre_dump",
NULL
};
int callback_callbacks_id = 0;
+int debug_callback_defined(int i)
+{
+ printf ("callback_defined(%s)\n", callbacknames[i]);
+ return callback_set[i];
+}
+
void get_lua_boolean(const char *table, const char *name, boolean * target)
{
int stacktop;
diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
index 2c1bc34fc1b..66b8731acbb 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -1,6 +1,7 @@
/* lepdflib.cc
- Copyright 2009-2010 Taco Hoekwater <taco@luatex.org>
+ Copyright 2009-2011 Taco Hoekwater <taco@luatex.org>
+ Copyright 2009-2011 Hartmut Henkel <hartmut@luatex.org>
This file is part of LuaTeX.
@@ -18,41 +19,2688 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: lepdflib.cc 3366 2010-01-20 14:49:31Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lepdflib.cc $";
+ "$Id: lepdflib.cc 4134 2011-04-11 20:54:58Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lepdflib.cc $";
#include "image/epdf.h"
+// define DEBUG
+
+//**********************************************************************
+// TODO: add more poppler functions (many are still missing)
+
+//**********************************************************************
+// objects allocated by poppler may not be deleted in the lepdflib
+
+typedef enum { ALLOC_POPPLER, ALLOC_LEPDF } alloctype;
+
+typedef struct {
+ void *d;
+ alloctype atype; // was it allocated by poppler or the lepdflib.cc?
+ PdfDocument *pd; // reference to PdfDocument, or NULL
+ unsigned long pc; // counter to detect PDFDoc change
+} udstruct;
+
+static const char *ErrorCodeNames[] = { "None", "OpenFile", "BadCatalog",
+ "Damaged", "Encrypted", "HighlightFile", "BadPrinter", "Printing",
+ "Permission", "BadPageNum", "FileIO", NULL
+};
+
+//**********************************************************************
+
+#define M_Annot "Annot"
+#define M_AnnotBorder "AnnotBorder"
+#define M_AnnotBorderStyle "AnnotBorderStyle"
+#define M_Annots "Annots"
+#define M_Array "Array"
+#define M_Catalog "Catalog"
+#define M_EmbFile "EmbFile"
+#define M_Dict "Dict"
+#define M_GooString "GooString"
+#define M_LinkDest "LinkDest"
+#define M_Links "Links"
+#define M_Object "Object"
+#define M_Page "Page"
+#define M_PDFDoc "PDFDoc"
+#define M_PDFRectangle "PDFRectangle"
+#define M_Ref "Ref"
+#define M_Stream "Stream"
+#define M_XRef "XRef"
+#define M_XRefEntry "XRefEntry"
+
+//**********************************************************************
+
+#define new_poppler_userdata(type) \
+static udstruct *new_##type##_userdata(lua_State * L) \
+{ \
+ udstruct *a; \
+ a = (udstruct *) lua_newuserdata(L, sizeof(udstruct)); /* udstruct ... */ \
+ a->atype = ALLOC_POPPLER; \
+ luaL_getmetatable(L, M_##type); /* m udstruct ... */ \
+ lua_setmetatable(L, -2); /* udstruct ... */ \
+ return a; \
+}
+
+new_poppler_userdata(PDFDoc);
+
+new_poppler_userdata(Annot);
+new_poppler_userdata(AnnotBorder);
+//new_poppler_userdata(AnnotBorderStyle);
+new_poppler_userdata(Annots);
+new_poppler_userdata(Array);
+new_poppler_userdata(Catalog);
+new_poppler_userdata(EmbFile);
+new_poppler_userdata(Dict);
+//new_poppler_userdata(GooString);
+new_poppler_userdata(LinkDest);
+new_poppler_userdata(Links);
+new_poppler_userdata(Object);
+new_poppler_userdata(Page);
+new_poppler_userdata(PDFRectangle);
+new_poppler_userdata(Ref);
+new_poppler_userdata(Stream);
+new_poppler_userdata(XRef);
+//new_poppler_userdata(XRefEntry);
+
+//**********************************************************************
+
+static void pdfdoc_changed_error(lua_State * L)
+{
+ luaL_error(L, "PDFDoc changed or gone");
+}
+
+static void pdfdoc_differs_error(lua_State * L)
+{
+ luaL_error(L, "PDFDoc differs between arguments");
+}
+
+//**********************************************************************
+
+static int l_open_PDFDoc(lua_State * L)
+{
+ const char *file_path;
+ udstruct *uout;
+ PdfDocument *d;
+ file_path = luaL_checkstring(L, 1); // path
+ d = refPdfDocument((char *) file_path, FE_RETURN_NULL);
+ if (d == NULL)
+ lua_pushnil(L);
+ else {
+ uout = new_PDFDoc_userdata(L);
+ uout->d = d;
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = d->pc;
+ uout->pd = d;
+ }
+ return 1; // doc path
+}
+
+static int l_new_Annot(lua_State * L)
+{
+ udstruct *uxref, *udict, *ucatalog, *uref, *uout;
+ uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+ udict = (udstruct *) luaL_checkudata(L, 2, M_Dict);
+ ucatalog = (udstruct *) luaL_checkudata(L, 3, M_Catalog);
+ uref = (udstruct *) luaL_checkudata(L, 4, M_Ref);
+ if (uxref->pd != ucatalog->pd || uxref->pd != udict->pd
+ || uxref->pd != uref->pd)
+ pdfdoc_differs_error(L);
+ if ((uxref->pd != NULL && uxref->pd->pc != uxref->pc) ||
+ (ucatalog->pd != NULL && ucatalog->pd->pc != ucatalog->pc) ||
+ (udict->pd != NULL && udict->pd->pc != udict->pc) ||
+ (uref->pd != NULL && uref->pd->pc != uref->pc))
+ pdfdoc_changed_error(L);
+ uout = new_Annot_userdata(L);
+ uout->d =
+ new Annot((XRef *) uxref->d, (Dict *) udict->d, (Catalog *) ucatalog->d,
+ (Object *) uref->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uxref->pc;
+ uout->pd = uxref->pd;
+ return 1;
+}
+
+static int l_new_Annots(lua_State * L)
+{
+ udstruct *uxref, *ucatalog, *uannotsobj, *uout;
+ uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+ ucatalog = (udstruct *) luaL_checkudata(L, 2, M_Catalog);
+ uannotsobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+ if (uxref->pd != ucatalog->pd || uxref->pd != uannotsobj->pd)
+ pdfdoc_differs_error(L);
+ if ((uxref->pd != NULL && uxref->pd->pc != uxref->pc)
+ || (ucatalog->pd != NULL && ucatalog->pd->pc != ucatalog->pc)
+ || (uannotsobj->pd != NULL && uannotsobj->pd->pc != uannotsobj->pc))
+ pdfdoc_changed_error(L);
+ uout = new_Annots_userdata(L);
+ uout->d =
+ new Annots((XRef *) uxref->d, (Catalog *) ucatalog->d,
+ (Object *) uannotsobj->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uxref->pc;
+ uout->pd = uxref->pd;
+ return 1;
+}
+
+static int l_new_Array(lua_State * L)
+{
+ udstruct *uxref, *uout;
+ uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+ if (uxref->pd != NULL && uxref->pd->pc != uxref->pc)
+ pdfdoc_changed_error(L);
+ uout = new_Array_userdata(L);
+ uout->d = new Array((XRef *) uxref->d); // automatic init to length 0
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uxref->pc;
+ uout->pd = uxref->pd;
+ return 1;
+}
+
+static int l_new_Dict(lua_State * L)
+{
+ udstruct *uxref, *uout;
+ uxref = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+ if (uxref->pd != NULL && uxref->pd->pc != uxref->pc)
+ pdfdoc_changed_error(L);
+ uout = new_Dict_userdata(L);
+ uout->d = new Dict((XRef *) uxref->d); // automatic init to length 0
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uxref->pc;
+ uout->pd = uxref->pd;
+ return 1;
+}
+
+static int l_new_Object(lua_State * L)
+{
+ udstruct *uout;
+ uout = new_Object_userdata(L);
+ uout->d = new Object(); // automatic init to type "none"
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL; // not connected to any PDFDoc
+ return 1;
+}
+
+// PDFRectangle see Page.h
+
+static int l_new_PDFRectangle(lua_State * L)
+{
+ udstruct *uout;
+ uout = new_PDFRectangle_userdata(L);
+ uout->d = new PDFRectangle(); // automatic init to [0, 0, 0, 0]
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = 0;
+ uout->pd = NULL;
+ return 1;
+}
+
+static const struct luaL_Reg epdflib[] = {
+ {"open", l_open_PDFDoc},
+ {"Annot", l_new_Annot},
+ {"Annots", l_new_Annots},
+ {"Array", l_new_Array},
+ {"Dict", l_new_Dict},
+ {"Object", l_new_Object},
+ {"PDFRectangle", l_new_PDFRectangle},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+
+#define m_poppler_get_poppler(in, out, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ out *o; \
+ udstruct *uin, *uout; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ o = ((in *) uin->d)->function(); \
+ if (o != NULL) { \
+ uout = new_##out##_userdata(L); \
+ uout->d = o; \
+ uout->pc = uin->pc; \
+ uout->pd = uin->pd; \
+ } else \
+ lua_pushnil(L); \
+ return 1; \
+}
+
+#define m_poppler_get_BOOL(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ if (((in *) uin->d)->function()) \
+ lua_pushboolean(L, 1); \
+ else \
+ lua_pushboolean(L, 0); \
+ return 1; \
+}
+
+#define m_poppler_get_INT(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ 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 = (int) ((in *) uin->d)->function(); \
+ lua_pushinteger(L, i); \
+ return 1; \
+}
+
+#define m_poppler_get_DOUBLE(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ double d; \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ d = (double) ((in *) uin->d)->function(); \
+ lua_pushnumber(L, d); \
+ return 1; \
+}
+
+#define m_poppler_get_GOOSTRING(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ GooString *gs; \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ gs = ((in *) uin->d)->function(); \
+ if (gs != NULL) \
+ lua_pushlstring(L, gs->getCString(), gs->getLength()); \
+ else \
+ lua_pushnil(L); \
+ return 1; \
+}
+
+#define m_poppler_get_OBJECT(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ udstruct *uin, *uout; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ uout = new_Object_userdata(L); \
+ uout->d = new Object(); \
+ ((in *) uin->d)->function((Object *) uout->d); \
+ uout->atype = ALLOC_LEPDF; \
+ uout->pc = uin->pc; \
+ uout->pd = uin->pd; \
+ return 1; \
+}
+
+#define m_poppler_do(in, function) \
+static int m_##in##_##function(lua_State * L) \
+{ \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ ((in *) uin->d)->function(); \
+ return 0; \
+}
+
+#define m_poppler__tostring(type) \
+static int m_##type##__tostring(lua_State * L) \
+{ \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_##type); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ lua_pushfstring(L, "%s: %p", #type, (type *) uin->d); \
+ return 1; \
+}
+
//**********************************************************************
+// Annot
+
+m_poppler_get_BOOL(Annot, isOk);
+m_poppler_get_OBJECT(Annot, getAppearance);
+m_poppler_get_poppler(Annot, AnnotBorder, getBorder);
-int l_new_pdfdoc(lua_State * L)
+static int m_Annot_match(lua_State * L)
{
- PdfDocument *pdf_doc;
- char *file_path;
- if (lua_gettop(L) != 1)
- luaL_error(L, "epdf.new() needs exactly 1 argument");
- if (!lua_isstring(L, -1))
- luaL_error(L, "epdf.new() needs filename (string)");
- file_path = (char *) lua_tostring(L, -1);
+ udstruct *uin, *uref;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Annot);
+ uref = (udstruct *) luaL_checkudata(L, 2, M_Ref);
+ if (uin->pd != NULL && uref->pd != NULL && uin->pd != uref->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uref->pd != NULL && uref->pd->pc != uref->pc))
+ pdfdoc_changed_error(L);
+ lua_pushboolean(L, ((Annot *) uin->d)->match((Ref *) uref->d));
+ return 1;
+}
+
+m_poppler__tostring(Annot);
- printf("\n======================== 1 <%s>\n", file_path);
+static int m_Annot__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Annot);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== Annot GC ===== uin=<%p>\n", uin);
+#endif
+ if (uin->atype == ALLOC_LEPDF)
+ delete(Annot *) uin->d;
+ return 0;
+}
- pdf_doc = refPdfDocument(file_path);
+static const struct luaL_Reg Annot_m[] = {
+ {"isOk", m_Annot_isOk},
+ {"getAppearance", m_Annot_getAppearance},
+ {"getBorder", m_Annot_getBorder},
+ {"match", m_Annot_match},
+ {"__tostring", m_Annot__tostring},
+ {"__gc", m_Annot__gc},
+ {NULL, NULL} // sentinel
+};
+//**********************************************************************
+// AnnotBorderStyle
+
+m_poppler_get_DOUBLE(AnnotBorderStyle, getWidth);
+
+m_poppler__tostring(AnnotBorderStyle);
+
+static int m_Annots__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Annots);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== Annots GC ===== uin=<%p>\n", uin);
+#endif
+ if (uin->atype == ALLOC_LEPDF)
+ delete(Annots *) uin->d;
return 0;
}
+static const struct luaL_Reg AnnotBorderStyle_m[] = {
+ {"getWidth", m_AnnotBorderStyle_getWidth},
+ {"__tostring", m_AnnotBorderStyle__tostring},
+ {"__gc", m_Annots__gc},
+ {NULL, NULL} // sentinel
+};
+
//**********************************************************************
+// Annots
-static const struct luaL_Reg epdflib[] = {
- // {"new", l_new_pdfdoc},
- {NULL, NULL} /* sentinel */
+m_poppler_get_INT(Annots, getNumAnnots);
+
+static int m_Annots_getAnnot(lua_State * L)
+{
+ int i, annots;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Annots);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ annots = ((Annots *) uin->d)->getNumAnnots();
+ if (i > 0 && i <= annots) {
+ uout = new_Annot_userdata(L);
+ uout->d = ((Annots *) uin->d)->getAnnot(i);
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler__tostring(Annots);
+
+static const struct luaL_Reg Annots_m[] = {
+ {"getNumAnnots", m_Annots_getNumAnnots},
+ {"getAnnot", m_Annots_getAnnot},
+ {"__tostring", m_Annots__tostring},
+ {NULL, NULL} // sentinel
};
-int luaopen_epdf(lua_State * L)
+//**********************************************************************
+// Array
+
+static int m_Array_incRef(lua_State * L)
{
- luaL_register(L, "epdf", epdflib);
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = ((Array *) uin->d)->incRef();
+ lua_pushinteger(L, i);
+ return 1;
+}
+
+static int m_Array_decRef(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = ((Array *) uin->d)->decRef();
+ lua_pushinteger(L, i);
+ return 1;
+}
+
+m_poppler_get_INT(Array, getLength);
+
+static int m_Array_add(lua_State * L)
+{
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ uobj = (udstruct *) luaL_checkudata(L, 2, M_Object);
+ if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
+ pdfdoc_changed_error(L);
+ ((Array *) uin->d)->add(((Object *) uobj->d));
+ return 0;
+}
+
+static int m_Array_get(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Array *) uin->d)->getLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Array *) uin->d)->get(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Array_getNF(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Array *) uin->d)->getLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Array *) uin->d)->getNF(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Array_getString(lua_State * L)
+{
+ GooString *gs;
+ int i, len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Array *) uin->d)->getLength();
+ if (i > 0 && i <= len) {
+ gs = new GooString();
+ if (((Array *) uin->d)->getString(i - 1, gs))
+ lua_pushlstring(L, gs->getCString(), gs->getLength());
+ else
+ lua_pushnil(L);
+ delete gs;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler__tostring(Array);
+
+static const struct luaL_Reg Array_m[] = {
+ {"incRef", m_Array_incRef},
+ {"decRef", m_Array_decRef},
+ {"getLength", m_Array_getLength},
+ {"add", m_Array_add},
+ {"get", m_Array_get},
+ {"getNF", m_Array_getNF},
+ {"getString", m_Array_getString},
+ {"__tostring", m_Array__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Catalog
+
+m_poppler_get_BOOL(Catalog, isOk);
+m_poppler_get_INT(Catalog, getNumPages);
+
+static int m_Catalog_getPage(lua_State * L)
+{
+ int i, pages;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ pages = ((Catalog *) uin->d)->getNumPages();
+ if (i > 0 && i <= pages) {
+ uout = new_Page_userdata(L);
+ uout->d = ((Catalog *) uin->d)->getPage(i);
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Catalog_getPageRef(lua_State * L)
+{
+ int i, pages;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ pages = ((Catalog *) uin->d)->getNumPages();
+ if (i > 0 && i <= pages) {
+ uout = new_Ref_userdata(L);
+ uout->d = (Ref *) gmalloc(sizeof(Ref));
+ ((Ref *) uout->d)->num = ((Catalog *) uin->d)->getPageRef(i)->num;
+ ((Ref *) uout->d)->gen = ((Catalog *) uin->d)->getPageRef(i)->gen;
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler_get_GOOSTRING(Catalog, getBaseURI);
+m_poppler_get_GOOSTRING(Catalog, readMetadata);
+m_poppler_get_poppler(Catalog, Object, getStructTreeRoot);
+
+static int m_Catalog_findPage(lua_State * L)
+{
+ int num, gen, i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ num = luaL_checkint(L, 2);
+ gen = luaL_checkint(L, 3);
+ i = ((Catalog *) uin->d)->findPage(num, gen);
+ if (i > 0)
+ lua_pushinteger(L, i);
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Catalog_findDest(lua_State * L)
+{
+ GooString *name;
+ LinkDest *dest;
+ const char *s;
+ size_t len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checklstring(L, 2, &len);
+ name = new GooString(s, len);
+ dest = ((Catalog *) uin->d)->findDest(name);
+ if (dest != NULL) {
+ uout = new_LinkDest_userdata(L);
+ uout->d = dest;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ delete name;
+ return 1;
+}
+
+m_poppler_get_poppler(Catalog, Object, getDests);
+m_poppler_get_INT(Catalog, numEmbeddedFiles);
+
+static int m_Catalog_embeddedFile(lua_State * L)
+{
+ EmbFile *ef;
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Catalog *) uin->d)->numEmbeddedFiles();
+ if (i > 0 && i <= len) {
+ ef = ((Catalog *) uin->d)->embeddedFile(i - 1);
+ if (ef != NULL) {
+ uout = new_EmbFile_userdata(L);
+ uout->d = ef;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler_get_INT(Catalog, numJS);
+
+static int m_Catalog_getJS(lua_State * L)
+{
+ GooString *gs;
+ int i, len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Catalog);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Catalog *) uin->d)->numJS();
+ if (i > 0 && i <= len) {
+ gs = ((Catalog *) uin->d)->getJS(i - 1);
+ if (gs != NULL)
+ lua_pushlstring(L, gs->getCString(), gs->getLength());
+ else
+ lua_pushnil(L);
+ delete gs;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler_get_poppler(Catalog, Object, getOutline);
+m_poppler_get_poppler(Catalog, Object, getAcroForm);
+
+m_poppler__tostring(Catalog);
+
+static const struct luaL_Reg Catalog_m[] = {
+ {"isOk", m_Catalog_isOk},
+ {"getNumPages", m_Catalog_getNumPages},
+ {"getPage", m_Catalog_getPage},
+ {"getPageRef", m_Catalog_getPageRef},
+ {"getBaseURI", m_Catalog_getBaseURI},
+ {"readMetadata", m_Catalog_readMetadata},
+ {"getStructTreeRoot", m_Catalog_getStructTreeRoot},
+ {"findPage", m_Catalog_findPage},
+ {"findDest", m_Catalog_findDest},
+ {"getDests", m_Catalog_getDests},
+ {"numEmbeddedFiles", m_Catalog_numEmbeddedFiles},
+ {"embeddedFile", m_Catalog_embeddedFile},
+ {"numJS", m_Catalog_numJS},
+ {"getJS", m_Catalog_getJS},
+ {"getOutline", m_Catalog_getOutline},
+ {"getAcroForm", m_Catalog_getAcroForm},
+ {"__tostring", m_Catalog__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// EmbFile
+
+m_poppler_get_GOOSTRING(EmbFile, name);
+m_poppler_get_GOOSTRING(EmbFile, description);
+m_poppler_get_INT(EmbFile, size);
+m_poppler_get_GOOSTRING(EmbFile, modDate);
+m_poppler_get_GOOSTRING(EmbFile, createDate);
+m_poppler_get_GOOSTRING(EmbFile, checksum);
+m_poppler_get_GOOSTRING(EmbFile, mimeType);
+
+static int m_EmbFile_streamObject(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_EmbFile);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ uout = new_Object_userdata(L);
+ uout->d = new Object(); // automatic init to type "none"
+ ((EmbFile *) uin->d)->streamObject().copy((Object *) uout->d);
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+m_poppler_get_BOOL(EmbFile, isOk);
+
+m_poppler__tostring(EmbFile);
+
+static const struct luaL_Reg EmbFile_m[] = {
+ {"name", m_EmbFile_name},
+ {"description", m_EmbFile_description},
+ {"size", m_EmbFile_size},
+ {"modDate", m_EmbFile_modDate},
+ {"createDate", m_EmbFile_createDate},
+ {"checksum", m_EmbFile_checksum},
+ {"mimeType", m_EmbFile_mimeType},
+ {"streamObject", m_EmbFile_streamObject},
+ {"isOk", m_EmbFile_isOk},
+ {"__tostring", m_EmbFile__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Dict
+
+static int m_Dict_incRef(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = ((Dict *) uin->d)->incRef();
+ lua_pushinteger(L, i);
+ return 1;
+}
+
+static int m_Dict_decRef(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = ((Dict *) uin->d)->decRef();
+ lua_pushinteger(L, i);
+ return 1;
+}
+
+m_poppler_get_INT(Dict, getLength);
+
+static int m_Dict_add(lua_State * L)
+{
+ char *s;
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = copyString((char *) luaL_checkstring(L, 2));
+ uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+ ((Dict *) uin->d)->add(s, ((Object *) uobj->d));
+ return 0;
+}
+
+static int m_Dict_set(lua_State * L)
+{
+ char *s;
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = (char *) luaL_checkstring(L, 2);
+ uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+ ((Dict *) uin->d)->set(s, ((Object *) uobj->d));
+ return 0;
+}
+
+static int m_Dict_remove(lua_State * L)
+{
+ char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = (char *) luaL_checkstring(L, 2);
+ ((Dict *) uin->d)->remove(s);
+ return 0;
+}
+
+static int m_Dict_is(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (((Dict *) uin->d)->is((char *) s))
+ lua_pushboolean(L, 1);
+ else
+ lua_pushboolean(L, 0);
+ return 1;
+}
+
+static int m_Dict_lookup(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Dict *) uin->d)->lookup((char *) s, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+static int m_Dict_lookupNF(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Dict *) uin->d)->lookupNF((char *) s, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+static int m_Dict_lookupInt(lua_State * L)
+{
+ const char *s1, *s2;
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s1 = luaL_checkstring(L, 2);
+ s2 = luaL_checkstring(L, 3);
+ if (((Dict *) uin->d)->lookupInt(s1, s2, &i))
+ lua_pushinteger(L, i);
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Dict_getKey(lua_State * L)
+{
+ int i, len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Dict *) uin->d)->getLength();
+ if (i > 0 && i <= len)
+ lua_pushstring(L, ((Dict *) uin->d)->getKey(i - 1));
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Dict_getVal(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Dict *) uin->d)->getLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Dict *) uin->d)->getVal(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Dict_getValNF(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ len = ((Dict *) uin->d)->getLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Dict *) uin->d)->getValNF(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler__tostring(Dict);
+
+static const struct luaL_Reg Dict_m[] = {
+ {"incRef", m_Dict_incRef},
+ {"decRef", m_Dict_decRef},
+ {"getLength", m_Dict_getLength},
+ {"add", m_Dict_add},
+ {"set", m_Dict_set},
+ {"remove", m_Dict_remove},
+ {"is", m_Dict_is},
+ {"lookup", m_Dict_lookup},
+ {"lookupNF", m_Dict_lookupNF},
+ {"lookupInt", m_Dict_lookupInt},
+ {"getKey", m_Dict_getKey},
+ {"getVal", m_Dict_getVal},
+ {"getValNF", m_Dict_getValNF},
+ {"__tostring", m_Dict__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// GooString
+
+static int m_GooString__tostring(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_GooString);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ lua_pushlstring(L, ((GooString *) uin->d)->getCString(),
+ ((GooString *) uin->d)->getLength());
+ return 1;
+}
+
+static const struct luaL_Reg GooString_m[] = {
+ {"__tostring", m_GooString__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// LinkDest
+
+static const char *LinkDestKindNames[] =
+ { "XYZ", "Fit", "FitH", "FitV", "FitR", "FitB", "FitBH", "FitBV", NULL };
+
+m_poppler_get_BOOL(LinkDest, isOk);
+
+static int m_LinkDest_getKind(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_LinkDest);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = (int) ((LinkDest *) uin->d)->getKind();
+ lua_pushinteger(L, i);
+ return 1;
+}
+
+static int m_LinkDest_getKindName(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_LinkDest);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = (int) ((LinkDest *) uin->d)->getKind();
+ lua_pushstring(L, LinkDestKindNames[i]);
+ return 1;
+}
+
+m_poppler_get_BOOL(LinkDest, isPageRef);
+m_poppler_get_INT(LinkDest, getPageNum);
+
+static int m_LinkDest_getPageRef(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_LinkDest);
+ 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 = ((LinkDest *) uin->d)->getPageRef().num;
+ ((Ref *) uout->d)->gen = ((LinkDest *) uin->d)->getPageRef().gen;
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+m_poppler_get_DOUBLE(LinkDest, getLeft);
+m_poppler_get_DOUBLE(LinkDest, getBottom);
+m_poppler_get_DOUBLE(LinkDest, getRight);
+m_poppler_get_DOUBLE(LinkDest, getTop);
+m_poppler_get_DOUBLE(LinkDest, getZoom);
+m_poppler_get_BOOL(LinkDest, getChangeLeft);
+m_poppler_get_BOOL(LinkDest, getChangeTop);
+m_poppler_get_BOOL(LinkDest, getChangeZoom);
+
+m_poppler__tostring(LinkDest);
+
+static const struct luaL_Reg LinkDest_m[] = {
+ {"isOk", m_LinkDest_isOk},
+ {"getKind", m_LinkDest_getKind},
+ {"getKindName", m_LinkDest_getKindName}, // not poppler
+ {"isPageRef", m_LinkDest_isPageRef},
+ {"getPageNum", m_LinkDest_getPageNum},
+ {"getPageRef", m_LinkDest_getPageRef},
+ {"getLeft", m_LinkDest_getLeft},
+ {"getBottom", m_LinkDest_getBottom},
+ {"getRight", m_LinkDest_getRight},
+ {"getTop", m_LinkDest_getTop},
+ {"getZoom", m_LinkDest_getZoom},
+ {"getChangeLeft", m_LinkDest_getChangeLeft},
+ {"getChangeTop", m_LinkDest_getChangeTop},
+ {"getChangeZoom", m_LinkDest_getChangeZoom},
+ {"__tostring", m_LinkDest__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Links
+
+m_poppler__tostring(Links);
+
+static const struct luaL_Reg Links_m[] = {
+ {"__tostring", m_Links__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Object
+
+// Special type checking.
+#define m_Object_isType(function) \
+static int m_Object_##function(lua_State * L) \
+{ \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ if (lua_gettop(L) >= 2) { \
+ if (lua_isstring(L, 2) \
+ && ((Object *) uin->d)->function((char *) lua_tostring(L, 2))) \
+ lua_pushboolean(L, 1); \
+ else \
+ lua_pushboolean(L, 0); \
+ } else { \
+ if (((Object *) uin->d)->function()) \
+ lua_pushboolean(L, 1); \
+ else \
+ lua_pushboolean(L, 0); \
+ } \
+ return 1; \
+}
+
+static int m_Object_initBool(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ luaL_checktype(L, 2, LUA_TBOOLEAN);
+ if (lua_toboolean(L, 2) != 0)
+ ((Object *) uin->d)->initBool(gTrue);
+ else
+ ((Object *) uin->d)->initBool(gFalse);
+ return 0;
+}
+
+static int m_Object_initInt(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ ((Object *) uin->d)->initInt(i);
+ return 0;
+}
+
+static int m_Object_initReal(lua_State * L)
+{
+ double d;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ d = luaL_checknumber(L, 2);
+ ((Object *) uin->d)->initReal(d);
+ return 0;
+}
+
+static int m_Object_initString(lua_State * L)
+{
+ GooString *gs;
+ const char *s;
+ size_t len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checklstring(L, 2, &len);
+ gs = new GooString(s, len);
+ ((Object *) uin->d)->initString(gs);
+ return 0;
+}
+
+static int m_Object_initName(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ ((Object *) uin->d)->initName((char *) s);
+ return 0;
+}
+
+static int m_Object_initNull(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initNull();
+ return 0;
+}
+
+static int m_Object_initArray(lua_State * L)
+{
+ udstruct *uin, *uxref;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef);
+ if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initArray((XRef *) uxref->d);
+ return 0;
+}
+
+// TODO: decide betweeen
+// Object *initDict(XRef *xref);
+// Object *initDict(Dict *dictA);
+
+static int m_Object_initDict(lua_State * L)
+{
+ udstruct *uin, *uxref;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef);
+ if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initDict((XRef *) uxref->d);
+ return 0;
+}
+
+static int m_Object_initStream(lua_State * L)
+{
+ udstruct *uin, *ustream;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ ustream = (udstruct *) luaL_checkudata(L, 2, M_Stream);
+ if (uin->pd != NULL && ustream->pd != NULL && uin->pd != ustream->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (ustream->pd != NULL && ustream->pd->pc != ustream->pc))
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initStream((Stream *) ustream->d);
+ return 0;
+}
+
+static int m_Object_initRef(lua_State * L)
+{
+ int num, gen;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ num = luaL_checkint(L, 2);
+ gen = luaL_checkint(L, 3);
+ ((Object *) uin->d)->initRef(num, gen);
+ return 0;
+}
+
+static int m_Object_initCmd(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ ((Object *) uin->d)->initCmd((char *) s);
+ return 0;
+}
+
+static int m_Object_initError(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initError();
+ return 0;
+}
+
+static int m_Object_initEOF(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ ((Object *) uin->d)->initEOF();
+ return 0;
+}
+
+static int m_Object_fetch(lua_State * L)
+{
+ udstruct *uin, *uxref, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef);
+ if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
+ pdfdoc_changed_error(L);
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->fetch((XRef *) uxref->d, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+static int m_Object_getType(lua_State * L)
+{
+ ObjType t;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ t = ((Object *) uin->d)->getType();
+ lua_pushinteger(L, (int) t);
+ return 1;
+}
+
+static int m_Object_getTypeName(lua_State * L)
+{
+ char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = ((Object *) uin->d)->getTypeName();
+ lua_pushstring(L, s);
+ return 1;
+}
+
+m_poppler_get_BOOL(Object, isBool);
+m_poppler_get_BOOL(Object, isInt);
+m_poppler_get_BOOL(Object, isReal);
+m_poppler_get_BOOL(Object, isNum);
+m_poppler_get_BOOL(Object, isString);
+m_Object_isType(isName);
+m_poppler_get_BOOL(Object, isNull);
+m_poppler_get_BOOL(Object, isArray);
+m_Object_isType(isDict);
+m_Object_isType(isStream);
+m_poppler_get_BOOL(Object, isRef);
+m_Object_isType(isCmd);
+m_poppler_get_BOOL(Object, isError);
+m_poppler_get_BOOL(Object, isEOF);
+m_poppler_get_BOOL(Object, isNone);
+
+static int m_Object_getBool(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isBool()) {
+ if (((Object *) uin->d)->getBool())
+ lua_pushboolean(L, 1);
+ else
+ lua_pushboolean(L, 0);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getInt(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isInt())
+ lua_pushnumber(L, ((Object *) uin->d)->getInt());
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getReal(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isReal())
+ lua_pushnumber(L, ((Object *) uin->d)->getReal());
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getNum(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isNum())
+ lua_pushnumber(L, ((Object *) uin->d)->getNum());
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getString(lua_State * L)
+{
+ GooString *gs;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isString()) {
+ gs = ((Object *) uin->d)->getString();
+ lua_pushlstring(L, gs->getCString(), gs->getLength());
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getName(lua_State * L)
+{
+ char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isName()) {
+ s = ((Object *) uin->d)->getName();
+ lua_pushstring(L, s);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getArray(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isArray()) {
+ uout = new_Array_userdata(L);
+ uout->d = ((Object *) uin->d)->getArray();
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getDict(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isDict()) {
+ uout = new_Dict_userdata(L);
+ uout->d = ((Object *) uin->d)->getDict();
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getStream(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream()) {
+ uout = new_Stream_userdata(L);
+ uout->d = ((Object *) uin->d)->getStream();
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getRef(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isRef()) {
+ uout = new_Ref_userdata(L);
+ uout->d = (Ref *) gmalloc(sizeof(Ref));
+ ((Ref *) uout->d)->num = ((Object *) uin->d)->getRef().num;
+ ((Ref *) uout->d)->gen = ((Object *) uin->d)->getRef().gen;
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getRefNum(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isRef()) {
+ i = ((Object *) uin->d)->getRef().num;
+ lua_pushinteger(L, i);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getRefGen(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isRef()) {
+ i = ((Object *) uin->d)->getRef().gen;
+ lua_pushinteger(L, i);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_getCmd(lua_State * L)
+{
+ char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isCmd()) {
+ s = ((Object *) uin->d)->getCmd();
+ lua_pushstring(L, s);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_arrayGetLength(lua_State * L)
+{
+ int len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isArray()) {
+ len = ((Object *) uin->d)->arrayGetLength();
+ lua_pushnumber(L, len);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_arrayAdd(lua_State * L)
+{
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ uobj = (udstruct *) luaL_checkudata(L, 2, M_Object);
+ if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ pdfdoc_changed_error(L);
+ if (!((Object *) uin->d)->isArray())
+ luaL_error(L, "Object is not an Array");
+ ((Object *) uin->d)->arrayAdd((Object *) uobj->d);
+ return 0;
+}
+
+static int m_Object_arrayGet(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isArray()) {
+ len = ((Object *) uin->d)->arrayGetLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->arrayGet(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_arrayGetNF(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isArray()) {
+ len = ((Object *) uin->d)->arrayGetLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->arrayGetNF(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictGetLength(lua_State * L)
+{
+ int len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isDict()) {
+ len = ((Object *) uin->d)->dictGetLength();
+ lua_pushnumber(L, len);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictAdd(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ s = luaL_checkstring(L, 2);
+ uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+ if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ pdfdoc_changed_error(L);
+ if (!((Object *) uin->d)->isDict())
+ luaL_error(L, "Object is not a Dict");
+ ((Object *) uin->d)->dictAdd((char *) s, (Object *) uobj->d);
+ return 0;
+}
+
+static int m_Object_dictSet(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uobj;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ s = luaL_checkstring(L, 2);
+ uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
+ if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ pdfdoc_changed_error(L);
+ if (!((Object *) uin->d)->isDict())
+ luaL_error(L, "Object is not a Dict");
+ ((Object *) uin->d)->dictSet((char *) s, (Object *) uobj->d);
+ return 0;
+}
+
+static int m_Object_dictLookup(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (((Object *) uin->d)->isDict()) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->dictLookup((char *) s, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictLookupNF(lua_State * L)
+{
+ const char *s;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (((Object *) uin->d)->isDict()) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->dictLookupNF((char *) s, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictGetKey(lua_State * L)
+{
+ int i, len;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isDict()) {
+ len = ((Object *) uin->d)->dictGetLength();
+ if (i > 0 && i <= len)
+ lua_pushstring(L, ((Object *) uin->d)->dictGetKey(i - 1));
+ else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictGetVal(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isDict()) {
+ len = ((Object *) uin->d)->dictGetLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->dictGetVal(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_dictGetValNF(lua_State * L)
+{
+ int i, len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isDict()) {
+ len = ((Object *) uin->d)->dictGetLength();
+ if (i > 0 && i <= len) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((Object *) uin->d)->dictGetValNF(i - 1, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_streamIs(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (((Object *) uin->d)->isStream()) {
+ if (((Object *) uin->d)->streamIs((char *) s))
+ lua_pushboolean(L, 1);
+ else
+ lua_pushboolean(L, 0);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_streamReset(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream())
+ ((Object *) uin->d)->streamReset();
+ return 0;
+}
+
+static int m_Object_streamGetChar(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream()) {
+ i = ((Object *) uin->d)->streamGetChar();
+ lua_pushinteger(L, i);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_streamLookChar(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream()) {
+ i = ((Object *) uin->d)->streamLookChar();
+ lua_pushinteger(L, i);
+ } else
+ lua_pushnil(L);
return 1;
}
+static int m_Object_streamGetPos(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream()) {
+ i = (int) ((Object *) uin->d)->streamGetPos();
+ lua_pushinteger(L, i);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object_streamSetPos(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ if (((Object *) uin->d)->isStream())
+ ((Object *) uin->d)->streamSetPos(i);
+ return 0;
+}
+
+static int m_Object_streamGetDict(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((Object *) uin->d)->isStream()) {
+ uout = new_Dict_userdata(L);
+ uout->d = ((Object *) uin->d)->streamGetDict();
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_Object__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== Object GC ===== uin=<%p>\n", uin);
+#endif
+ if (uin->atype == ALLOC_LEPDF)
+ delete(Object *) uin->d;
+ return 0;
+}
+
+m_poppler__tostring(Object);
+
+static const struct luaL_Reg Object_m[] = {
+ {"initBool", m_Object_initBool},
+ {"initInt", m_Object_initInt},
+ {"initReal", m_Object_initReal},
+ {"initString", m_Object_initString},
+ {"initName", m_Object_initName},
+ {"initNull", m_Object_initNull},
+ {"initArray", m_Object_initArray},
+ {"initDict", m_Object_initDict},
+ {"initStream", m_Object_initStream},
+ {"initRef", m_Object_initRef},
+ {"initCmd", m_Object_initCmd},
+ {"initError", m_Object_initError},
+ {"initEOF", m_Object_initEOF},
+ // {"copy", m_Object_copy},
+ {"fetch", m_Object_fetch},
+ {"getType", m_Object_getType},
+ {"getTypeName", m_Object_getTypeName},
+ {"isBool", m_Object_isBool},
+ {"isInt", m_Object_isInt},
+ {"isReal", m_Object_isReal},
+ {"isNum", m_Object_isNum},
+ {"isString", m_Object_isString},
+ {"isName", m_Object_isName},
+ {"isNull", m_Object_isNull},
+ {"isArray", m_Object_isArray},
+ {"isDict", m_Object_isDict},
+ {"isStream", m_Object_isStream},
+ {"isRef", m_Object_isRef},
+ {"isCmd", m_Object_isCmd},
+ {"isError", m_Object_isError},
+ {"isEOF", m_Object_isEOF},
+ {"isNone", m_Object_isNone},
+ {"getBool", m_Object_getBool},
+ {"getInt", m_Object_getInt},
+ {"getReal", m_Object_getReal},
+ {"getNum", m_Object_getNum},
+ {"getString", m_Object_getString},
+ {"getName", m_Object_getName},
+ {"getArray", m_Object_getArray},
+ {"getDict", m_Object_getDict},
+ {"getStream", m_Object_getStream},
+ {"getRef", m_Object_getRef},
+ {"getRefNum", m_Object_getRefNum},
+ {"getRefGen", m_Object_getRefGen},
+ {"getCmd", m_Object_getCmd},
+ {"arrayGetLength", m_Object_arrayGetLength},
+ {"arrayAdd", m_Object_arrayAdd},
+ {"arrayGet", m_Object_arrayGet},
+ {"arrayGetNF", m_Object_arrayGetNF},
+ {"dictGetLength", m_Object_dictGetLength},
+ {"dictAdd", m_Object_dictAdd},
+ {"dictSet", m_Object_dictSet},
+ {"dictLookup", m_Object_dictLookup},
+ {"dictLookupNF", m_Object_dictLookupNF},
+ {"dictGetKey", m_Object_dictGetKey},
+ {"dictGetVal", m_Object_dictGetVal},
+ {"dictGetValNF", m_Object_dictGetValNF},
+ {"streamIs", m_Object_streamIs},
+ {"streamReset", m_Object_streamReset},
+ // {"streamClose", m_Object_streamClose},
+ {"streamGetChar", m_Object_streamGetChar},
+ {"streamLookChar", m_Object_streamLookChar},
+ // {"streamGetLine", m_Object_streamGetLine},
+ {"streamGetPos", m_Object_streamGetPos},
+ {"streamSetPos", m_Object_streamSetPos},
+ {"streamGetDict", m_Object_streamGetDict},
+ {"__tostring", m_Object__tostring},
+ {"__gc", m_Object__gc}, // finalizer
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Page
+
+m_poppler_get_BOOL(Page, isOk);
+m_poppler_get_INT(Page, getNum);
+m_poppler_get_poppler(Page, PDFRectangle, getMediaBox);
+m_poppler_get_poppler(Page, PDFRectangle, getCropBox);
+m_poppler_get_BOOL(Page, isCropped);
+m_poppler_get_DOUBLE(Page, getMediaWidth);
+m_poppler_get_DOUBLE(Page, getMediaHeight);
+m_poppler_get_DOUBLE(Page, getCropWidth);
+m_poppler_get_DOUBLE(Page, getCropHeight);
+m_poppler_get_poppler(Page, PDFRectangle, getBleedBox);
+m_poppler_get_poppler(Page, PDFRectangle, getTrimBox);
+m_poppler_get_poppler(Page, PDFRectangle, getArtBox);
+m_poppler_get_INT(Page, getRotate);
+m_poppler_get_GOOSTRING(Page, getLastModified);
+m_poppler_get_poppler(Page, Dict, getBoxColorInfo);
+m_poppler_get_poppler(Page, Dict, getGroup);
+m_poppler_get_poppler(Page, Stream, getMetadata);
+m_poppler_get_poppler(Page, Dict, getPieceInfo);
+m_poppler_get_poppler(Page, Dict, getSeparationInfo);
+m_poppler_get_poppler(Page, Dict, getResourceDict);
+m_poppler_get_OBJECT(Page, getAnnots);
+
+static int m_Page_getLinks(lua_State * L)
+{
+ Links *links;
+ udstruct *uin, *ucat, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Page);
+ ucat = (udstruct *) luaL_checkudata(L, 2, M_Catalog);
+ if (uin->pd != NULL && ucat->pd != NULL && uin->pd != ucat->pd)
+ pdfdoc_differs_error(L);
+ if ((uin->pd != NULL && uin->pd->pc != uin->pc)
+ || (ucat->pd != NULL && ucat->pd->pc != ucat->pd->pc))
+ pdfdoc_changed_error(L);
+ links = ((Page *) uin->d)->getLinks((Catalog *) ucat->d);
+ if (links != NULL) {
+ uout = new_Links_userdata(L);
+ uout->d = links;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler_get_OBJECT(Page, getContents);
+
+m_poppler__tostring(Page);
+
+static const struct luaL_Reg Page_m[] = {
+ {"isOk", m_Page_isOk},
+ {"getNum", m_Page_getNum},
+ {"getMediaBox", m_Page_getMediaBox},
+ {"getCropBox", m_Page_getCropBox},
+ {"isCropped", m_Page_isCropped},
+ {"getMediaWidth", m_Page_getMediaWidth},
+ {"getMediaHeight", m_Page_getMediaHeight},
+ {"getCropWidth", m_Page_getCropWidth},
+ {"getCropHeight", m_Page_getCropHeight},
+ {"getBleedBox", m_Page_getBleedBox},
+ {"getTrimBox", m_Page_getTrimBox},
+ {"getArtBox", m_Page_getArtBox},
+ {"getRotate", m_Page_getRotate},
+ {"getLastModified", m_Page_getLastModified},
+ {"getBoxColorInfo", m_Page_getBoxColorInfo},
+ {"getGroup", m_Page_getGroup},
+ {"getMetadata", m_Page_getMetadata},
+ {"getPieceInfo", m_Page_getPieceInfo},
+ {"getSeparationInfo", m_Page_getSeparationInfo},
+ {"getResourceDict", m_Page_getResourceDict},
+ {"getAnnots", m_Page_getAnnots},
+ {"getLinks", m_Page_getLinks},
+ {"getContents", m_Page_getContents},
+ {"__tostring", m_Page__tostring},
+ {NULL, NULL} // sentinel
+};
+
//**********************************************************************
+// PDFDoc
+
+#define m_PDFDoc_BOOL(function) \
+static int m_PDFDoc_##function(lua_State * L) \
+{ \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ if (((PdfDocument *) uin->d)->doc->function()) \
+ lua_pushboolean(L, 1); \
+ else \
+ lua_pushboolean(L, 0); \
+ return 1; \
+}
+
+#define m_PDFDoc_INT(function) \
+static int m_PDFDoc_##function(lua_State * L) \
+{ \
+ int i; \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ i = ((PdfDocument *) uin->d)->doc->function(); \
+ lua_pushinteger(L, i); \
+ return 1; \
+}
+
+m_PDFDoc_BOOL(isOk);
+m_PDFDoc_INT(getErrorCode);
+
+static int m_PDFDoc_getFileName(lua_State * L)
+{
+ GooString *gs;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ gs = ((PdfDocument *) uin->d)->doc->getFileName();
+ if (gs != NULL)
+ lua_pushlstring(L, gs->getCString(), gs->getLength());
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_getErrorCodeName(lua_State * L)
+{
+ int i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = ((PdfDocument *) uin->d)->doc->getErrorCode();
+ lua_pushstring(L, ErrorCodeNames[i]);
+ return 1;
+}
+
+static int m_PDFDoc_getXRef(lua_State * L)
+{
+ XRef *xref;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ xref = ((PdfDocument *) uin->d)->doc->getXRef();
+ if (xref->isOk()) {
+ uout = new_XRef_userdata(L);
+ uout->d = xref;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_getCatalog(lua_State * L)
+{
+ Catalog *cat;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ cat = ((PdfDocument *) uin->d)->doc->getCatalog();
+ if (cat->isOk()) {
+ uout = new_Catalog_userdata(L);
+ uout->d = cat;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+#define m_PDFDoc_PAGEDIMEN(function) \
+static int m_PDFDoc_##function(lua_State * L) \
+{ \
+ int i, pages; \
+ double d; \
+ udstruct *uin; \
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc); \
+ if (uin->pd != NULL && uin->pd->pc != uin->pc) \
+ pdfdoc_changed_error(L); \
+ i = luaL_checkint(L, 2); \
+ pages = ((PdfDocument *) uin->d)->doc->getNumPages(); \
+ if (i > 0 && i <= pages) { \
+ d = (double) ((PdfDocument *) uin->d)->doc->function(i); \
+ lua_pushnumber(L, d); \
+ } else \
+ lua_pushnil(L); \
+ return 1; \
+}
+
+m_PDFDoc_PAGEDIMEN(getPageMediaWidth);
+m_PDFDoc_PAGEDIMEN(getPageMediaHeight);
+m_PDFDoc_PAGEDIMEN(getPageCropWidth);
+m_PDFDoc_PAGEDIMEN(getPageCropHeight);
+m_PDFDoc_INT(getNumPages);
+
+static int m_PDFDoc_readMetadata(lua_State * L)
+{
+ GooString *gs;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
+ gs = ((PdfDocument *) uin->d)->doc->readMetadata();
+ if (gs != NULL)
+ lua_pushlstring(L, gs->getCString(), gs->getLength());
+ else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_getStructTreeRoot(lua_State * L)
+{
+ Object *obj;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
+ obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
+ uout = new_Object_userdata(L);
+ uout->d = obj;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_findPage(lua_State * L)
+{
+ int num, gen, i;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ num = luaL_checkint(L, 2);
+ gen = luaL_checkint(L, 3);
+ if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
+ i = ((PdfDocument *) uin->d)->doc->findPage(num, gen);
+ if (i > 0)
+ lua_pushinteger(L, i);
+ else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_getLinks(lua_State * L)
+{
+ int i;
+ Links *links;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ i = luaL_checkint(L, 2);
+ links = ((PdfDocument *) uin->d)->doc->getLinks(i);
+ if (links != NULL) {
+ uout = new_Links_userdata(L);
+ uout->d = links;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_findDest(lua_State * L)
+{
+ GooString *name;
+ LinkDest *dest;
+ const char *s;
+ size_t len;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checklstring(L, 2, &len);
+ name = new GooString(s, len);
+ if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
+ dest = ((PdfDocument *) uin->d)->doc->findDest(name);
+ if (dest != NULL) {
+ uout = new_LinkDest_userdata(L);
+ uout->d = dest;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ delete name;
+ return 1;
+}
+
+m_PDFDoc_BOOL(isEncrypted);
+m_PDFDoc_BOOL(okToPrint);
+m_PDFDoc_BOOL(okToChange);
+m_PDFDoc_BOOL(okToCopy);
+m_PDFDoc_BOOL(okToAddNotes);
+m_PDFDoc_BOOL(isLinearized);
+
+static int m_PDFDoc_getDocInfo(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((PdfDocument *) uin->d)->doc->getDocInfo((Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFDoc_getDocInfoNF(lua_State * L)
+{
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((PdfDocument *) uin->d)->doc->getDocInfoNF((Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_PDFDoc_INT(getPDFMajorVersion);
+m_PDFDoc_INT(getPDFMinorVersion);
+
+static int m_PDFDoc__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== PDFDoc GC ===== file_path=<%s>\n",
+ ((PdfDocument *) uin->d)->file_path);
+#endif
+ assert(uin->atype == ALLOC_LEPDF);
+ unrefPdfDocument(((PdfDocument *) uin->d)->file_path);
+ return 0;
+}
+
+static const struct luaL_Reg PDFDoc_m[] = {
+ {"isOk", m_PDFDoc_isOk},
+ {"getErrorCode", m_PDFDoc_getErrorCode},
+ {"getErrorCodeName", m_PDFDoc_getErrorCodeName}, // not poppler
+ {"getFileName", m_PDFDoc_getFileName},
+ {"getXRef", m_PDFDoc_getXRef},
+ {"getCatalog", m_PDFDoc_getCatalog},
+ // {"getBaseStream", m_PDFDoc_getBaseStream},
+ {"getPageMediaWidth", m_PDFDoc_getPageMediaWidth},
+ {"getPageMediaHeight", m_PDFDoc_getPageMediaHeight},
+ {"getPageCropWidth", m_PDFDoc_getPageCropWidth},
+ {"getPageCropHeight", m_PDFDoc_getPageCropHeight},
+ {"getNumPages", m_PDFDoc_getNumPages},
+ {"readMetadata", m_PDFDoc_readMetadata},
+ {"getStructTreeRoot", m_PDFDoc_getStructTreeRoot},
+ {"findPage", m_PDFDoc_findPage},
+ {"getLinks", m_PDFDoc_getLinks},
+ {"findDest", m_PDFDoc_findDest},
+ {"isEncrypted", m_PDFDoc_isEncrypted},
+ {"okToPrint", m_PDFDoc_okToPrint},
+ {"okToChange", m_PDFDoc_okToChange},
+ {"okToCopy", m_PDFDoc_okToCopy},
+ {"okToAddNotes", m_PDFDoc_okToAddNotes},
+ {"isLinearized", m_PDFDoc_isLinearized},
+ {"getDocInfo", m_PDFDoc_getDocInfo},
+ {"getDocInfoNF", m_PDFDoc_getDocInfoNF},
+ {"getPDFMajorVersion", m_PDFDoc_getPDFMajorVersion},
+ {"getPDFMinorVersion", m_PDFDoc_getPDFMinorVersion},
+ {"__gc", m_PDFDoc__gc}, // finalizer
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// PDFRectangle
+
+m_poppler_get_BOOL(PDFRectangle, isValid);
+
+m_poppler__tostring(PDFRectangle);
+
+static int m_PDFRectangle__index(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFRectangle);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (strlen(s) == 2) {
+ if (s[0] == 'x') {
+ if (s[1] == '1')
+ lua_pushnumber(L, ((PDFRectangle *) uin->d)->x1);
+ else if (s[1] == '2')
+ lua_pushnumber(L, ((PDFRectangle *) uin->d)->x2);
+ else
+ lua_pushnil(L);
+ } else if (s[0] == 'y') {
+ if (s[1] == '1')
+ lua_pushnumber(L, ((PDFRectangle *) uin->d)->y1);
+ else if (s[1] == '2')
+ lua_pushnumber(L, ((PDFRectangle *) uin->d)->y2);
+ else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ } else
+ lua_pushnil(L);
+ return 1;
+}
+
+static int m_PDFRectangle__newindex(lua_State * L)
+{
+ double d;
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFRectangle);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ d = luaL_checknumber(L, 3);
+ if (strlen(s) == 2) {
+ if (s[0] == 'x') {
+ if (s[1] == '1')
+ ((PDFRectangle *) uin->d)->x1 = d;
+ else if (s[1] == '2')
+ ((PDFRectangle *) uin->d)->x2 = d;
+ else
+ luaL_error(L, "wrong PDFRectangle coordinate (%s)", s);
+ } else if (s[0] == 'y') {
+ if (s[1] == '1')
+ ((PDFRectangle *) uin->d)->y1 = d;
+ else if (s[1] == '2')
+ ((PDFRectangle *) uin->d)->y2 = d;
+ } else
+ luaL_error(L, "wrong PDFRectangle coordinate (%s)", s);
+ } else
+ luaL_error(L, "wrong PDFRectangle coordinate (%s)", s);
+ return 0;
+}
+
+static int m_PDFRectangle__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_PDFRectangle);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== PDFRectangle GC ===== uin=<%p>\n", uin);
+#endif
+ if (uin->atype == ALLOC_LEPDF)
+ delete(PDFRectangle *) uin->d;
+ return 0;
+}
+
+static const struct luaL_Reg PDFRectangle_m[] = {
+ {"isValid", m_PDFRectangle_isValid},
+ {"__index", m_PDFRectangle__index},
+ {"__newindex", m_PDFRectangle__newindex},
+ {"__tostring", m_PDFRectangle__tostring},
+ {"__gc", m_PDFRectangle__gc},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Ref
+
+static int m_Ref__index(lua_State * L)
+{
+ const char *s;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Ref);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ s = luaL_checkstring(L, 2);
+ if (strcmp(s, "num") == 0)
+ lua_pushinteger(L, ((Ref *) uin->d)->num);
+ else if (strcmp(s, "gen") == 0)
+ lua_pushinteger(L, ((Ref *) uin->d)->gen);
+ else
+ lua_pushnil(L);
+ return 1;
+}
+
+m_poppler__tostring(Ref);
+
+static int m_Ref__gc(lua_State * L)
+{
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Ref);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+#ifdef DEBUG
+ printf("\n===== Ref GC ===== uin=<%p>\n", uin);
+#endif
+ if (uin->atype == ALLOC_LEPDF && ((Ref *) uin->d) != NULL)
+ gfree(((Ref *) uin->d));
+ return 0;
+}
+
+static const struct luaL_Reg Ref_m[] = {
+ {"__index", m_Ref__index},
+ {"__tostring", m_Ref__tostring},
+ {"__gc", m_Ref__gc}, // finalizer
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// Stream
+
+static const char *StreamKindNames[] =
+ { "File", "ASCIIHex", "ASCII85", "LZW", "RunLength", "CCITTFax", "DCT",
+ "Flate", "JBIG2", "JPX", "Weird", NULL
+};
+
+#if 0
+static const char *StreamColorSpaceModeNames[] =
+ { "CSNone", "CSDeviceGray", "CSDeviceRGB", "CSDeviceCMYK", NULL };
+#endif
+
+m_poppler_get_INT(Stream, getKind);
+
+static int m_Stream_getKindName(lua_State * L)
+{
+ StreamKind t;
+ udstruct *uin;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_Stream);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ t = ((Stream *) uin->d)->getKind();
+ lua_pushstring(L, StreamKindNames[t]);
+ return 1;
+}
+
+m_poppler_do(Stream, reset);
+m_poppler_do(Stream, close);
+m_poppler_get_INT(Stream, getChar);
+m_poppler_get_INT(Stream, lookChar);
+m_poppler_get_INT(Stream, getRawChar);
+m_poppler_get_INT(Stream, getUnfilteredChar);
+m_poppler_do(Stream, unfilteredReset);
+m_poppler_get_INT(Stream, getPos);
+m_poppler_get_BOOL(Stream, isBinary);
+m_poppler_get_poppler(Stream, Stream, getUndecodedStream);
+m_poppler_get_poppler(Stream, Dict, getDict);
+
+m_poppler__tostring(Stream);
+
+static const struct luaL_Reg Stream_m[] = {
+ {"getKind", m_Stream_getKind},
+ {"getKindName", m_Stream_getKindName}, // not poppler
+ {"reset", m_Stream_reset},
+ {"close", m_Stream_close},
+ {"getUndecodedStream", m_Stream_getUndecodedStream},
+ {"getChar", m_Stream_getChar},
+ {"lookChar", m_Stream_lookChar},
+ {"getRawChar", m_Stream_getRawChar},
+ {"getUnfilteredChar", m_Stream_getUnfilteredChar},
+ {"unfilteredReset", m_Stream_unfilteredReset},
+ // {"getLine", m_Stream_getLine},
+ {"getPos", m_Stream_getPos},
+ {"isBinary", m_Stream_isBinary},
+ {"getUndecodedStream", m_Stream_getUndecodedStream},
+ {"getDict", m_Stream_getDict},
+ {"__tostring", m_Stream__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// XRef
+
+m_poppler_get_BOOL(XRef, isOk);
+m_poppler_get_INT(XRef, getErrorCode);
+m_poppler_get_BOOL(XRef, isEncrypted);
+m_poppler_get_BOOL(XRef, okToPrint);
+m_poppler_get_BOOL(XRef, okToPrintHighRes);
+m_poppler_get_BOOL(XRef, okToChange);
+m_poppler_get_BOOL(XRef, okToCopy);
+m_poppler_get_BOOL(XRef, okToAddNotes);
+m_poppler_get_BOOL(XRef, okToFillForm);
+m_poppler_get_BOOL(XRef, okToAccessibility);
+m_poppler_get_BOOL(XRef, okToAssemble);
+m_poppler_get_OBJECT(XRef, getCatalog);
+
+static int m_XRef_fetch(lua_State * L)
+{
+ int num, gen;
+ udstruct *uin, *uout;
+ uin = (udstruct *) luaL_checkudata(L, 1, M_XRef);
+ if (uin->pd != NULL && uin->pd->pc != uin->pc)
+ pdfdoc_changed_error(L);
+ num = luaL_checkint(L, 2);
+ gen = luaL_checkint(L, 3);
+ uout = new_Object_userdata(L);
+ uout->d = new Object();
+ ((XRef *) uin->d)->fetch(num, gen, (Object *) uout->d);
+ uout->atype = ALLOC_LEPDF;
+ uout->pc = uin->pc;
+ uout->pd = uin->pd;
+ return 1;
+}
+
+m_poppler_get_OBJECT(XRef, getDocInfo);
+m_poppler_get_OBJECT(XRef, getDocInfoNF);
+m_poppler_get_INT(XRef, getNumObjects);
+// getLastXRefPos
+m_poppler_get_INT(XRef, getRootNum);
+m_poppler_get_INT(XRef, getRootGen);
+// getStreamEnd
+m_poppler_get_INT(XRef, getSize);
+// getEntry
+m_poppler_get_poppler(XRef, Object, getTrailerDict);
+
+m_poppler__tostring(XRef);
+
+static const struct luaL_Reg XRef_m[] = {
+ {"isOk", m_XRef_isOk},
+ {"getErrorCode", m_XRef_getErrorCode},
+ {"isEncrypted", m_XRef_isEncrypted},
+ {"okToPrint", m_XRef_okToPrint},
+ {"okToPrintHighRes", m_XRef_okToPrintHighRes},
+ {"okToChange", m_XRef_okToChange},
+ {"okToCopy", m_XRef_okToCopy},
+ {"okToAddNotes", m_XRef_okToAddNotes},
+ {"okToFillForm", m_XRef_okToFillForm},
+ {"okToAccessibility", m_XRef_okToAccessibility},
+ {"okToAssemble", m_XRef_okToAssemble},
+ {"getCatalog", m_XRef_getCatalog},
+ {"fetch", m_XRef_fetch},
+ {"getDocInfo", m_XRef_getDocInfo},
+ {"getDocInfoNF", m_XRef_getDocInfoNF},
+ {"getNumObjects", m_XRef_getNumObjects},
+ //
+ {"getRootNum", m_XRef_getRootNum},
+ {"getRootGen", m_XRef_getRootGen},
+ //
+ {"getSize", m_XRef_getSize},
+ {"getTrailerDict", m_XRef_getTrailerDict},
+ {"__tostring", m_XRef__tostring},
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+// XRefEntry
+
+static const struct luaL_Reg XRefEntry_m[] = {
+ {NULL, NULL} // sentinel
+};
+
+//**********************************************************************
+
+#define register_meta(type) \
+ luaL_newmetatable(L, M_##type); \
+ lua_pushvalue(L, -1); \
+ lua_setfield(L, -2, "__index"); \
+ lua_pushstring(L, "no user access"); \
+ lua_setfield(L, -2, "__metatable"); \
+ luaL_register(L, NULL, type##_m)
+
+int luaopen_epdf(lua_State * L)
+{
+ register_meta(Annot);
+ // TODO register_meta(AnnotBorder);
+ register_meta(AnnotBorderStyle);
+ register_meta(Annots);
+ register_meta(Array);
+ register_meta(Catalog);
+ register_meta(EmbFile);
+ register_meta(Dict);
+ register_meta(GooString);
+ register_meta(LinkDest);
+ register_meta(Links);
+ register_meta(Object);
+ register_meta(Page);
+ register_meta(PDFDoc);
+ register_meta(PDFRectangle);
+ register_meta(Ref);
+ register_meta(Stream);
+ register_meta(XRef);
+ register_meta(XRefEntry);
+
+ luaL_register(L, "epdf", epdflib);
+ return 1;
+}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
index da7a69cb571..e6b45578d55 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
@@ -22,7 +22,7 @@
static const char _svn_version[] =
- "$Id: lfontlib.c 3551 2010-03-26 14:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lfontlib.c $";
+ "$Id: lfontlib.c 3551 2010-03-26 14:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lfontlib.c $";
#define TIMERS 0
diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c
index 5245e31d0a3..4cc13454c22 100644
--- a/Build/source/texk/web2c/luatexdir/lua/limglib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c
@@ -18,8 +18,8 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: limglib.c 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/limglib.c $";
+ "$Id: limglib.c 4051 2011-01-09 22:41:33Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/limglib.c $";
#include <stdio.h>
#include <string.h>
@@ -94,9 +94,9 @@ static const parm_struct img_parms[] = {
{NULL, P__SENTINEL}
};
-#define imgtype_max 5
+#define imgtype_max 6
const char *imgtype_s[] =
- { "none", "pdf", "png", "jpg", "jbig2", "stream", NULL };
+ { "none", "pdf", "png", "jpg", "jp2", "jbig2", "stream", NULL };
#define pagebox_max 5
const char *pdfboxspec_s[] =
@@ -558,8 +558,8 @@ static void setup_image(PDF pdf, image * a, wrtype_e writetype)
read_scale_img(a);
if (img_objnum(ad) == 0) { /* latest needed just before out_img() */
pdf->ximage_count++;
- pdf_create_obj(pdf, obj_type_ximage, pdf->ximage_count);
- img_objnum(ad) = pdf->obj_ptr;
+ img_objnum(ad) =
+ pdf_create_obj(pdf, obj_type_ximage, pdf->ximage_count);
img_index(ad) = pdf->ximage_count;
idict_to_array(ad); /* now ad is read-only */
obj_data_ptr(pdf, pdf->obj_ptr) = img_index(ad);
@@ -609,6 +609,8 @@ static int l_write_image(lua_State * L)
static int l_immediatewrite_image(lua_State * L)
{
check_o_mode(static_pdf, "img.immediatewrite()", 1 << OMODE_PDF, true);
+ if (global_shipping_mode != NOT_SHIPPING)
+ luaL_error(L, "pdf.immediatewrite() can not be used with \\latelua");
write_image_or_node(L, WR_IMMEDIATEWRITE);
return 1; /* image */
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/liolib.c b/Build/source/texk/web2c/luatexdir/lua/liolib.c
index 93d21b23697..a85b38b8683 100644
--- a/Build/source/texk/web2c/luatexdir/lua/liolib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/liolib.c
@@ -1,5 +1,5 @@
/*
-** $Id: liolib.c 3404 2010-01-28 11:17:10Z taco $
+** $Id: liolib.c 3794 2010-08-03 07:02:06Z taco $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@@ -165,7 +165,13 @@ static int io_open(lua_State * L)
const char *mode = luaL_optstring(L, 2, "r");
FILE **pf = newfile(L);
*pf = fopen(filename, mode);
- return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
+ if (*pf == NULL)
+ return pushresult(L, 0, filename);
+ if (mode[0]=='r')
+ recorder_record_input(filename);
+ else
+ recorder_record_output(filename);
+ return 1;
}
static int io_open_ro(lua_State * L)
@@ -177,7 +183,10 @@ static int io_open_ro(lua_State * L)
return pushresult(L, 0, filename);
pf = newfile(L);
*pf = fopen(filename, mode);
- return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
+ if (*pf == NULL)
+ return pushresult(L, 0, filename);
+ recorder_record_input(filename);
+ return 1;
}
@@ -250,8 +259,14 @@ static int g_iofile(lua_State * L, int f, const char *mode)
if (filename) {
FILE **pf = newfile(L);
*pf = fopen(filename, mode);
- if (*pf == NULL)
+ if (*pf == NULL) {
fileerror(L, 1, filename);
+ } else {
+ if (mode[0]=='r')
+ recorder_record_input(filename);
+ else
+ recorder_record_output(filename);
+ }
} else {
tofile(L); /* check that it's a valid file handle */
lua_pushvalue(L, 1);
@@ -307,6 +322,8 @@ static int io_lines(lua_State * L)
*pf = fopen(filename, "r");
if (*pf == NULL)
fileerror(L, 1, filename);
+ else
+ recorder_record_input(filename);
aux_lines(L, lua_gettop(L), 1);
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
index 35191538f0b..2949fae16f1 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
@@ -28,7 +28,7 @@
#include <kpathsea/tex-file.h>
static const char _svn_version[] =
- "$Id: lkpselib.c 3551 2010-03-26 14:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lkpselib.c $";
+ "$Id: lkpselib.c 4020 2010-11-30 13:43:25Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lkpselib.c $";
static const unsigned filetypes[] = {
kpse_gf_format,
@@ -564,7 +564,7 @@ static int do_lua_kpathsea_lookup(lua_State * L, kpathsea kpse, int idx)
lua_pop(L, 1);
- lua_pushstring(L, "must-exist");
+ lua_pushstring(L, "mustexist");
lua_gettable(L, idx + 1);
if (lua_type(L, -1) == LUA_TBOOLEAN) {
must_exist = lua_toboolean(L, -1);
@@ -756,7 +756,7 @@ static int readable_file(lua_State * L)
{
const char *name = luaL_checkstring(L, 1);
TEST_PROGRAM_NAME_SET;
- lua_pushstring(L, (char *) kpse_readable_file(name));
+ lua_pushstring(L, kpse_readable_file(name));
return 1;
}
@@ -764,7 +764,7 @@ static int lua_kpathsea_readable_file(lua_State * L)
{
kpathsea *kp = (kpathsea *) luaL_checkudata(L, 1, KPATHSEA_METATABLE);
const char *name = luaL_checkstring(L, 2);
- lua_pushstring(L, (char *) kpathsea_readable_file(*kp, name));
+ lua_pushstring(L, kpathsea_readable_file(*kp, name));
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c
index 7b880b4293e..76cd921c2a2 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 3551 2010-03-26 14:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/llanglib.c $";
+ "$Id: llanglib.c 3551 2010-03-26 14:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/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
new file mode 100644
index 00000000000..5168d9c24de
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/lua/llfslibext.c
@@ -0,0 +1,173 @@
+/* llfslibext.c
+
+ Copyright 2010 Taco Hoekwater <taco@luatex.org>
+
+ This file is part of LuaTeX.
+
+ LuaTeX is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+
+#include "lua/luatex-api.h"
+#include "ptexlib.h"
+
+#include <kpathsea/c-stat.h>
+#include <kpathsea/c-dir.h>
+#include <time.h>
+
+static const char _svn_version[] =
+ "$Id: llfslibext.c 4084 2011-02-10 09:06:29Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/llfslibext.c $";
+
+#ifdef _WIN32
+# include <windows.h>
+#else
+#endif
+
+#ifdef _WIN32
+
+static int get_short_name(lua_State * L)
+{
+ long length = 0;
+ TCHAR *buffer = NULL;
+ const char *lpszPath = luaL_checkstring(L, 1);
+ length = GetShortPathName(lpszPath, NULL, 0);
+ if (length == 0) {
+ lua_pushnil(L);
+ lua_pushfstring(L, "operating system error: %d", (int) GetLastError());
+ return 2;
+ }
+ buffer = (TCHAR *) xmalloc(length * sizeof(TCHAR));
+ length = GetShortPathName(lpszPath, buffer, length);
+ if (length == 0) {
+ lua_pushnil(L);
+ lua_pushfstring(L, "operating system error: %d", (int) GetLastError());
+ return 2;
+ }
+ lua_pushlstring(L, (const char *) buffer, (size_t) length);
+ return 1;
+}
+
+static int read_link(lua_State * L)
+{
+ lua_pushboolean(L, 0);
+ lua_pushliteral(L, "readlink not supported on this platform");
+ return 2;
+}
+
+#else
+
+static int pusherror(lua_State * L, const char *info)
+{
+ lua_pushnil(L);
+ if (info == NULL)
+ lua_pushstring(L, strerror(errno));
+ else
+ lua_pushfstring(L, "%s: %s", info, strerror(errno));
+ lua_pushinteger(L, errno);
+ return 3;
+}
+
+static int Preadlink(lua_State * L)
+{
+/** readlink(path) */
+ const char *path = luaL_checkstring(L, 1);
+ char *b = NULL;
+ size_t allocated = 128;
+ int n;
+ while (1) {
+ b = malloc(allocated);
+ if (!b)
+ return pusherror(L, path);
+ n = readlink(path, b, allocated);
+ if (n == -1) {
+ free(b);
+ return pusherror(L, path);
+ }
+ if (n < allocated)
+ break;
+ /* Not enough room, try bigger */
+ allocated *= 2;
+ free(b);
+ }
+ lua_pushlstring(L, b, n);
+ free(b);
+ return 1;
+}
+
+
+static int read_link(lua_State * L)
+{
+ return Preadlink(L);
+}
+
+static int get_short_name(lua_State * L)
+{
+ /* simply do nothing */
+ return 1;
+}
+#endif
+
+
+/*
+** Get file information
+*/
+static int file_is_directory(lua_State * L)
+{
+ struct stat info;
+ const char *file = luaL_checkstring(L, 1);
+
+ if (stat(file, &info)) {
+ lua_pushnil(L);
+ lua_pushfstring(L, "cannot obtain information from file `%s'", file);
+ return 2;
+ }
+ if (S_ISDIR(info.st_mode))
+ lua_pushboolean(L, 1);
+ else
+ lua_pushboolean(L, 0);
+
+ return 1;
+}
+
+static int file_is_file(lua_State * L)
+{
+ struct stat info;
+ const char *file = luaL_checkstring(L, 1);
+
+ if (stat(file, &info)) {
+ lua_pushnil(L);
+ lua_pushfstring(L, "cannot obtain information from file `%s'", file);
+ return 2;
+ }
+ if (S_ISREG(info.st_mode))
+ lua_pushboolean(L, 1);
+ else
+ lua_pushboolean(L, 0);
+
+ return 1;
+}
+
+
+void open_lfslibext(lua_State * L)
+{
+
+ lua_getglobal(L, "lfs");
+ lua_pushcfunction(L, file_is_directory);
+ lua_setfield(L, -2, "isdir");
+ lua_pushcfunction(L, file_is_file);
+ lua_setfield(L, -2, "isfile");
+ lua_pushcfunction(L, read_link);
+ lua_setfield(L, -2, "readlink");
+ lua_pushcfunction(L, get_short_name);
+ lua_setfield(L, -2, "shortname");
+ lua_pop(L, 1); /* pop the table */
+}
diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c
index ec247e88010..de1ec5d5d2c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/llualib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: llualib.c 3612 2010-04-13 09:29:42Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/llualib.c $";
+ "$Id: llualib.c 3615 2010-04-13 21:59:59Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/llualib.c $";
#define LOAD_BUF_SIZE 256
#define UINT_MAX32 0xFFFFFFFF
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index ba81322a209..8fa1fb0d4cc 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -18,8 +18,8 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: lnodelib.c 3726 2010-06-24 12:13:43Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/lua/lnodelib.c $";
+ "$Id: lnodelib.c 4140 2011-04-12 10:18:37Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lnodelib.c $";
#include "lua/luatex-api.h"
#include "ptexlib.h"
@@ -39,23 +39,35 @@ static const char _svn_version[] =
#define luaS_ptr_eq(a,b) (a==luaS_##b##_ptr)
#define NODE_METATABLE "luatex_node"
+
+#define DEBUG 0
+#define DEBUG_OUT stdout
make_luaS_index(luatex_node);
-halfword *check_isnode(lua_State * L, int ud)
+static halfword *maybe_isnode(lua_State * L, int ud)
{
- register halfword *p = lua_touserdata(L, ud);
+ halfword *p = lua_touserdata(L, ud);
if (p != NULL) {
if (lua_getmetatable(L, ud)) {
lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(luatex_node));
lua_gettable(L, LUA_REGISTRYINDEX);
- if (lua_rawequal(L, -1, -2)) {
- lua_pop(L, 2);
- return p;
+ if (!lua_rawequal(L, -1, -2)) {
+ p = NULL;
}
+ lua_pop(L, 2);
}
}
- luaL_typerror(L, ud, NODE_METATABLE);
+ return p;
+}
+
+halfword *check_isnode(lua_State * L, int ud)
+{
+ halfword *p = maybe_isnode(L, ud);
+ if (p != NULL) {
+ return p;
+ }
+ pdftex_fail("There should have been a lua <node> here, not an object with type %s!", luaL_typename(L, ud));
return NULL;
}
@@ -115,6 +127,40 @@ int get_valid_node_subtype_id(lua_State * L, int n)
return i;
}
+/* returns true is the argument is a userdata object of type node */
+
+static int lua_nodelib_isnode(lua_State * L)
+{
+ if (maybe_isnode(L,1) != NULL)
+ lua_pushboolean(L,1);
+ else
+ lua_pushboolean(L,0);
+ return 1;
+}
+
+/* two simple helpers to speed up and simplify lua code: */
+
+static int lua_nodelib_next(lua_State * L)
+{
+ halfword *p = maybe_isnode(L,1);
+ if (p != NULL && *p && vlink(*p)) {
+ lua_nodelib_push_fast(L,vlink(*p));
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+static int lua_nodelib_prev(lua_State * L)
+{
+ halfword *p = maybe_isnode(L,1);
+ if (p != NULL && *p && alink(*p)) {
+ lua_nodelib_push_fast(L,alink(*p));
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
/* Creates a userdata object for a number found at the stack top,
@@ -209,12 +255,17 @@ static int lua_nodelib_subtype(lua_State * L)
static int lua_nodelib_type(lua_State * L)
{
- int i = get_node_type_id(L, 1);
- if (i >= 0) {
- lua_pushstring(L, node_data[i].name);
- } else {
- lua_pushnil(L);
+ if (lua_type(L,1) == LUA_TNUMBER) {
+ int i = get_node_type_id(L, 1);
+ if (i >= 0) {
+ lua_pushstring(L, node_data[i].name);
+ return 1;
+ }
+ } else if (maybe_isnode(L, 1) != NULL) {
+ lua_pushstring(L,"node");
+ return 1;
}
+ lua_pushnil(L);
return 1;
}
@@ -293,7 +344,17 @@ static int lua_nodelib_flush_list(lua_State * L)
/* remove a node from a list */
-
+#if DEBUG
+static void show_node_links (halfword l, const char * p)
+{
+ halfword t = l;
+ while (t) {
+ fprintf(DEBUG_OUT, "%s t = %d, prev = %d, next = %d\n", p, (int)t, (int)alink(t), (int)vlink(t));
+ t = vlink(t);
+ }
+}
+#endif
+
static int lua_nodelib_remove(lua_State * L)
{
halfword head, current, t;
@@ -301,6 +362,9 @@ static int lua_nodelib_remove(lua_State * L)
luaL_error(L, "Not enough arguments for node.remove()");
}
head = *(check_isnode(L, 1));
+#if DEBUG
+ show_node_links(head, "before");
+#endif
if (lua_isnil(L, 2)) {
return 2; /* the arguments, as they are */
}
@@ -328,6 +392,9 @@ static int lua_nodelib_remove(lua_State * L)
}
current = vlink(current);
}
+#if DEBUG
+ show_node_links(head, "after");
+#endif
lua_pushnumber(L, head);
lua_nodelib_push(L);
lua_pushnumber(L, current);
@@ -573,7 +640,7 @@ static int lua_nodelib_dimensions(lua_State * L)
return 3;
} else {
luaL_error(L,
- "missing argument to 'dimensions' (luatex_node expected)");
+ "missing argument to 'dimensions' (node expected)");
}
return 0; /* not reached */
}
@@ -683,6 +750,8 @@ make_luaS_index(width);
make_luaS_index(height);
make_luaS_index(depth);
make_luaS_index(expansion_factor);
+make_luaS_index(list);
+make_luaS_index(head);
static void initialize_luaS_indexes(lua_State * L)
@@ -705,12 +774,17 @@ static void initialize_luaS_indexes(lua_State * L)
init_luaS_index(height);
init_luaS_index(depth);
init_luaS_index(expansion_factor);
+ init_luaS_index(list);
+ init_luaS_index(head);
}
static int get_node_field_id(lua_State * L, int n, int node)
{
register int t = type(node);
register const char *s = lua_tostring(L, n);
+ if (luaS_ptr_eq(s, list)) {
+ s = luaS_head_ptr; /* create a |head| alias for now */
+ }
if (luaS_ptr_eq(s, next)) {
return 0;
} else if (luaS_ptr_eq(s, id)) {
@@ -749,19 +823,21 @@ static int get_node_field_id(lua_State * L, int n, int node)
} else if (luaS_ptr_eq(s, expansion_factor)) {
return 16;
}
- } else if (luaS_ptr_eq(s, prev)) {
+ } else if (luaS_ptr_eq(s, prev) && nodetype_has_prev(t)) {
return -1;
- } else if (luaS_ptr_eq(s, subtype)) {
+ } else if (luaS_ptr_eq(s, subtype) && nodetype_has_subtype(t)) {
return 2;
} else {
int j;
const char **fields = node_data[t].fields;
if (t == whatsit_node)
fields = whatsit_node_data[subtype(node)].fields;
- for (j = 0; fields[j] != NULL; j++) {
- if (strcmp(s, fields[j]) == 0) {
- return j + 3;
- }
+ if (fields != NULL) {
+ for (j = 0; fields[j] != NULL; j++) {
+ if (strcmp(s, fields[j]) == 0) {
+ return j + 3;
+ }
+ }
}
}
return -2;
@@ -819,6 +895,7 @@ static int lua_nodelib_whatsits(lua_State * L)
static int lua_nodelib_fields(lua_State * L)
{
int i = -1;
+ int offset = 3;
const char **fields;
int t = get_valid_node_type_id(L, 1);
if (t == whatsit_node) {
@@ -833,14 +910,19 @@ static int lua_nodelib_fields(lua_State * L)
lua_rawseti(L, -2, 0);
lua_pushstring(L, "id");
lua_rawseti(L, -2, 1);
- lua_pushstring(L, "subtype");
- lua_rawseti(L, -2, 2);
+ if (nodetype_has_subtype(t)) {
+ lua_pushstring(L, "subtype");
+ lua_rawseti(L, -2, 2);
+ offset--;
+ }
if (fields != NULL) {
- lua_pushstring(L, "prev");
- lua_rawseti(L, -2, -1);
+ if (nodetype_has_prev(t)) {
+ lua_pushstring(L, "prev");
+ lua_rawseti(L, -2, -1);
+ }
for (i = 0; fields[i] != NULL; i++) {
lua_pushstring(L, fields[i]);
- lua_rawseti(L, -2, (i + 3));
+ lua_rawseti(L, -2, (i + offset));
}
}
return 1;
@@ -858,7 +940,7 @@ static int lua_nodelib_tail(lua_State * L)
t = *n;
if (t == null)
return 1; /* the old userdata */
- alink(t) = null;
+ /* alink(t) = null; */ /* don't do this, |t|'s |alink| may be a valid pointer */
while (vlink(t) != null) {
alink(vlink(t)) = t;
t = vlink(t);
@@ -1374,15 +1456,20 @@ static void lua_nodelib_getfield_whatsit(lua_State * L, int n, int field)
break;
case late_lua_node:
switch (field) {
- case 4:
+ case 4: /* regid (obsolete?)*/
lua_pushnumber(L, late_lua_reg(n));
break;
- case 5:
- tokenlist_to_luastring(L, late_lua_data(n));
- break;
- case 6:
+ case 6: /* name */
tokenlist_to_luastring(L, late_lua_name(n));
break;
+ case 5: /* data */
+ case 7: /* string */
+ if (late_lua_type(n) == lua_refid_literal) {
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX, late_lua_data(n));
+ } else {
+ tokenlist_to_luastring(L, late_lua_data(n));
+ }
+ break;
default:
lua_pushnil(L);
}
@@ -1520,6 +1607,9 @@ static int lua_nodelib_getfield(lua_State * L)
lua_pushnumber(L, (double) glue_set(n));
break;
case 12:
+ if (list_ptr(n)) {
+ alink(list_ptr(n)) = null;
+ }
nodelib_pushlist(L, list_ptr(n));
break;
default:
@@ -1559,6 +1649,9 @@ static int lua_nodelib_getfield(lua_State * L)
lua_pushnumber(L, span_count(n));
break;
case 13:
+ if (list_ptr(n)) {
+ alink(list_ptr(n)) = null;
+ }
nodelib_pushlist(L, list_ptr(n));
break;
default:
@@ -1604,6 +1697,9 @@ static int lua_nodelib_getfield(lua_State * L)
nodelib_pushspec(L, split_top_ptr(n));
break;
case 8:
+ if (ins_ptr(n)) {
+ alink(ins_ptr(n)) = null;
+ }
nodelib_pushlist(L, ins_ptr(n));
break;
default:
@@ -1631,6 +1727,9 @@ static int lua_nodelib_getfield(lua_State * L)
lua_pushnumber(L, subtype(n));
break;
case 4:
+ if (adjust_ptr(n)) {
+ alink(adjust_ptr(n)) = null;
+ }
nodelib_pushlist(L, adjust_ptr(n));
break;
default:
@@ -1944,6 +2043,9 @@ static int lua_nodelib_getfield(lua_State * L)
lua_pushnumber(L, subtype(n));
break;
case 4:
+ if (math_list(n)) {
+ alink(math_list(n)) = null;
+ }
nodelib_pushlist(L, math_list(n));
break;
default:
@@ -2458,12 +2560,23 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, int field)
case 4:
late_lua_reg(n) = (halfword) lua_tointeger(L, 3);
break;
- case 5:
+ case 5: /* data */
late_lua_data(n) = nodelib_gettoks(L, 3);
+ late_lua_type(n) = normal;
break;
case 6:
late_lua_name(n) = nodelib_gettoks(L, 3);
break;
+ case 7: /* string */
+ if (ini_version) {
+ late_lua_data(n) = nodelib_gettoks(L, 3);
+ late_lua_type(n) = normal;
+ } else {
+ lua_pushvalue(L, 3);
+ late_lua_data(n) = luaL_ref(L, LUA_REGISTRYINDEX);
+ late_lua_type(n) = lua_refid_literal;
+ }
+ break;
default:
return nodelib_cantset(L, field, n);
}
@@ -2561,9 +2674,17 @@ static int lua_nodelib_setfield(lua_State * L)
/* return implied */
}
if (field == 0) {
- vlink(n) = nodelib_getlist(L, 3);
+ halfword x = nodelib_getlist(L, 3);
+ if (x>0 && type(x) == glue_spec_node) {
+ return luaL_error(L, "You can't assign a %s node to a next field\n", node_data[type(x)].name);
+ }
+ vlink(n) = x;
} else if (field == -1) {
- alink(n) = nodelib_getlist(L, 3);
+ halfword x = nodelib_getlist(L, 3);
+ if (x>0 && type(x) == glue_spec_node) {
+ return luaL_error(L, "You can't assign a %s node to a prev field\n", node_data[type(x)].name);
+ }
+ alink(n) = x;
} else if (field == 3 && nodetype_has_attributes(type(n))) {
nodelib_setattr(L, 3, n);
} else if (type(n) == glyph_node) {
@@ -3278,8 +3399,7 @@ static int lua_nodelib_unprotect_glyphs(lua_State * L)
return 2;
}
-
-static int lua_nodelib_first_character(lua_State * L)
+static int lua_nodelib_first_glyph(lua_State * L)
{
/* on the stack are two nodes and a direction */
halfword h, savetail = null, t = null;
@@ -3294,7 +3414,7 @@ static int lua_nodelib_first_character(lua_State * L)
savetail = vlink(t);
vlink(t) = null;
}
- while (h != null && !is_simple_character(h)) {
+ while (h != null && (type(h) != glyph_node || !is_simple_character(h))) {
h = vlink(h);
}
if (savetail != null) {
@@ -3306,6 +3426,13 @@ static int lua_nodelib_first_character(lua_State * L)
return 2;
}
+static int lua_nodelib_first_character(lua_State * L)
+{
+ pdftex_warn("node.first_character() is deprecated, please update to node.first_glyph()");
+ return lua_nodelib_first_glyph(L);
+}
+
+
/* this is too simplistic, but it helps Hans to get going */
@@ -3356,47 +3483,79 @@ static int lua_nodelib_cp_skipable(lua_State * L)
return 1;
}
+static int lua_nodelib_currentattr(lua_State * L)
+{
+ int n = lua_gettop(L);
+ if (n == 0) {
+ /* query */
+ if (max_used_attr >= 0) {
+ if (attr_list_cache == cache_disabled) {
+ update_attribute_cache();
+ if (attr_list_cache == null) {
+ lua_pushnil (L);
+ return 1;
+ }
+ }
+ attr_list_ref(attr_list_cache)++;
+ lua_pushnumber(L, attr_list_cache);
+ lua_nodelib_push(L);
+ } else {
+ lua_pushnil (L);
+ }
+ return 1;
+ } else {
+ /* assign */
+ pdftex_warn("Assignment via node.current_attr(<list>) is not supported (yet)");
+ return 0;
+ }
+}
+
+
static const struct luaL_reg nodelib_f[] = {
- {"id", lua_nodelib_id},
- {"subtype", lua_nodelib_subtype},
- {"type", lua_nodelib_type},
- {"new", lua_nodelib_new},
- {"length", lua_nodelib_length},
+ {"copy", lua_nodelib_copy},
+ {"copy_list", lua_nodelib_copy_list},
{"count", lua_nodelib_count},
- {"traverse", lua_nodelib_traverse},
- {"traverse_id", lua_nodelib_traverse_filtered},
- {"tail", lua_nodelib_tail_only},
- {"slide", lua_nodelib_tail},
- {"types", lua_nodelib_types},
- {"whatsits", lua_nodelib_whatsits},
+ {"current_attr", lua_nodelib_currentattr},
+ {"dimensions", lua_nodelib_dimensions},
+ {"do_ligature_n", lua_nodelib_do_ligature_n},
+ {"family_font", lua_nodelib_mfont},
{"fields", lua_nodelib_fields},
- {"has_field", lua_nodelib_has_field},
- {"free", lua_nodelib_free},
+ {"first_character", lua_nodelib_first_character},
+ {"first_glyph", lua_nodelib_first_glyph},
{"flush_list", lua_nodelib_flush_list},
- {"remove", lua_nodelib_remove},
- {"insert_before", lua_nodelib_insert_before},
+ {"free", lua_nodelib_free},
+ {"has_attribute", lua_nodelib_has_attribute},
+ {"has_field", lua_nodelib_has_field},
+ {"hpack", lua_nodelib_hpack},
+ {"id", lua_nodelib_id},
{"insert_after", lua_nodelib_insert_after},
- {"write", lua_nodelib_append},
+ {"insert_before", lua_nodelib_insert_before},
+ {"is_node", lua_nodelib_isnode},
+ {"kerning", font_tex_kerning},
{"last_node", lua_nodelib_last_node},
- {"copy", lua_nodelib_copy},
- {"copy_list", lua_nodelib_copy_list},
- {"dimensions", lua_nodelib_dimensions},
- {"hpack", lua_nodelib_hpack},
- {"vpack", lua_nodelib_vpack},
+ {"length", lua_nodelib_length},
+ {"ligaturing", font_tex_ligaturing},
{"mlist_to_hlist", lua_nodelib_mlist_to_hlist},
- {"family_font", lua_nodelib_mfont},
- {"has_attribute", lua_nodelib_has_attribute},
+ {"new", lua_nodelib_new},
+ {"next", lua_nodelib_next},
+ {"prev", lua_nodelib_prev},
+ {"protect_glyphs", lua_nodelib_protect_glyphs},
+ {"protrusion_skippable", lua_nodelib_cp_skipable},
+ {"remove", lua_nodelib_remove},
{"set_attribute", lua_nodelib_set_attribute},
+ {"slide", lua_nodelib_tail},
+ {"subtype", lua_nodelib_subtype},
+ {"tail", lua_nodelib_tail_only},
+ {"traverse", lua_nodelib_traverse},
+ {"traverse_id", lua_nodelib_traverse_filtered},
+ {"type", lua_nodelib_type},
+ {"types", lua_nodelib_types},
+ {"unprotect_glyphs", lua_nodelib_unprotect_glyphs},
{"unset_attribute", lua_nodelib_unset_attribute},
- {"do_ligature_n", lua_nodelib_do_ligature_n},
- {"ligaturing", font_tex_ligaturing},
- {"kerning", font_tex_kerning},
- {"first_character", lua_nodelib_first_character},
{"usedlist", lua_nodelib_usedlist},
- {"protect_glyphs", lua_nodelib_protect_glyphs},
- {"unprotect_glyphs", lua_nodelib_unprotect_glyphs},
- {"protrusion_skipable", lua_nodelib_cp_skipable},
- {"protrusion_skippable", lua_nodelib_cp_skipable},
+ {"vpack", lua_nodelib_vpack},
+ {"whatsits", lua_nodelib_whatsits},
+ {"write", lua_nodelib_append},
{NULL, NULL} /* sentinel */
};
@@ -3432,5 +3591,5 @@ int nodelist_from_lua(lua_State * L)
if (lua_isnil(L, -1))
return null;
n = check_isnode(L, -1);
- return *n;
+ return (n ? *n : null);
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/loslibext.c b/Build/source/texk/web2c/luatexdir/lua/loslibext.c
index 3efdd07d1e0..b0bf0d5abea 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 3648 2010-04-24 08:04:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.1/source/texk/web2c/luatexdir/lua/loslibext.c $";
+ "$Id: loslibext.c 3682 2010-05-11 08:07:11Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/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 e5f688400e9..c3d16111e6b 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
@@ -18,23 +18,15 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char _svn_version[] =
- "$Id: lpdflib.c 3618 2010-04-15 05:54:45Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lpdflib.c $";
+ "$Id: lpdflib.c 3941 2010-11-01 23:31:27Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lpdflib.c $";
#include "lua/luatex-api.h"
#include "ptexlib.h"
-#define buf_to_pdfbuf_macro(p, s, l) \
-for (i = 0; i < (l); i++) { \
- if (i % 16 == 0) \
- pdf_room(p, 16); \
- pdf_quick_out(p, ((const unsigned char *) (s))[i]); \
-}
-
static int luapdfprint(lua_State * L)
{
int n;
- unsigned i;
const_lstring st, modestr;
ctm_transform_modes literal_mode;
st.s = modestr.s = NULL;
@@ -79,19 +71,19 @@ static int luapdfprint(lua_State * L)
assert(0);
}
st.s = lua_tolstring(L, n, &st.l);
- buf_to_pdfbuf_macro(static_pdf, st.s, st.l);
+ pdf_out_block(static_pdf, st.s, st.l);
return 0;
}
-static unsigned char *fread_to_buf(lua_State * L, const char *filename, size_t * len)
+static unsigned char *fread_to_buf(lua_State * L, const char *filename,
+ size_t * len)
{
- int i = 0;
int ilen = 0;
FILE *f;
unsigned char *buf = NULL;
if ((f = fopen(filename, "rb")) == NULL)
luaL_error(L, "pdf.immediateobj() cannot open input file");
- if ((i = readbinfile(f, &buf, &ilen)) == 0)
+ if (readbinfile(f, &buf, &ilen) == 0)
luaL_error(L, "pdf.immediateobj() cannot read input file");
fclose(f);
*len = (size_t) ilen;
@@ -101,23 +93,23 @@ static unsigned char *fread_to_buf(lua_State * L, const char *filename, size_t *
static int l_immediateobj(lua_State * L)
{
int n, first_arg = 1;
- unsigned i;
int k;
lstring buf;
const_lstring st1, st2, st3;
st1.s = st2.s = st3.s = NULL;
check_o_mode(static_pdf, "immediateobj()", 1 << OMODE_PDF, true);
+ if (global_shipping_mode != NOT_SHIPPING)
+ luaL_error(L, "pdf.immediateobj() can not be used with \\latelua");
n = lua_gettop(L);
if (n > 0 && lua_type(L, 1) == LUA_TNUMBER) {
first_arg++;
lua_number2int(k, lua_tonumber(L, 1));
- check_obj_exists(static_pdf, obj_type_obj, k);
+ check_obj_type(static_pdf, obj_type_obj, k);
if (is_obj_scheduled(static_pdf, k) || obj_data_ptr(static_pdf, k) != 0)
luaL_error(L, "pdf.immediateobj() object in use");
} else {
- incr(static_pdf->obj_count);
- pdf_create_obj(static_pdf, obj_type_obj, static_pdf->sys_obj_ptr + 1);
- k = static_pdf->sys_obj_ptr;
+ static_pdf->obj_count++;
+ k = pdf_create_obj(static_pdf, obj_type_obj, static_pdf->obj_ptr + 1);
}
pdf_last_obj = k;
switch (n - first_arg + 1) {
@@ -129,7 +121,7 @@ static int l_immediateobj(lua_State * L)
luaL_error(L, "pdf.immediateobj() 1st argument must be string");
pdf_begin_obj(static_pdf, k, 1);
st1.s = lua_tolstring(L, first_arg, &st1.l);
- buf_to_pdfbuf_macro(static_pdf, st1.s, st1.l);
+ pdf_out_block(static_pdf, st1.s, st1.l);
if (st1.s[st1.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
pdf_end_obj(static_pdf);
@@ -148,7 +140,7 @@ static int l_immediateobj(lua_State * L)
"pdf.immediateobj() 3rd argument forbidden in file mode");
pdf_begin_obj(static_pdf, k, 1);
buf.s = fread_to_buf(L, st2.s, &buf.l);
- buf_to_pdfbuf_macro(static_pdf, buf.s, buf.l);
+ pdf_out_block(static_pdf, (const char *) buf.s, buf.l);
if (buf.s[buf.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
xfree(buf.s);
@@ -160,18 +152,18 @@ static int l_immediateobj(lua_State * L)
luaL_error(L,
"pdf.immediateobj() 3rd argument must be string");
st3.s = lua_tolstring(L, first_arg + 2, &st3.l);
- buf_to_pdfbuf_macro(static_pdf, st3.s, st3.l);
+ pdf_out_block(static_pdf, st3.s, st3.l);
if (st3.s[st3.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
}
pdf_begin_stream(static_pdf);
if (st1.l == 6 && strncmp((const char *) st1.s, "stream", 6) == 0) {
- buf_to_pdfbuf_macro(static_pdf, st2.s, st2.l);
+ pdf_out_block(static_pdf, st2.s, st2.l);
} else if (st1.l == 10
&& strncmp((const char *) st1.s, "streamfile",
10) == 0) {
buf.s = fread_to_buf(L, st2.s, &buf.l);
- buf_to_pdfbuf_macro(static_pdf, buf.s, buf.l);
+ pdf_out_block(static_pdf, (const char *) buf.s, buf.l);
xfree(buf.s);
} else
luaL_error(L, "pdf.immediateobj() invalid argument");
@@ -193,9 +185,6 @@ typedef enum { P__ZERO,
P_H,
P_INFO,
P_NAMES,
- P_PAGEATTRIBUTES,
- P_PAGERESOURCES,
- P_PAGESATTRIBUTES,
P_PDFCATALOG,
P_PDFINFO,
P_PDFNAMES,
@@ -213,9 +202,6 @@ static const parm_struct pdf_parms[] = {
{"h", P_H},
{"info", P_INFO},
{"names", P_NAMES},
- {"pageattributes", P_PAGEATTRIBUTES},
- {"pageresources", P_PAGERESOURCES},
- {"pagesattributes", P_PAGESATTRIBUTES},
{"pdfcatalog", P_PDFCATALOG}, /* obsolescent */
{"pdfinfo", P_PDFINFO}, /* obsolescent */
{"pdfnames", P_PDFNAMES}, /* obsolescent */
@@ -237,7 +223,6 @@ static int table_obj(lua_State * L)
int saved_compress_level = static_pdf->compress_level;
const_lstring attr, st;
lstring buf;
- size_t i;
int immediate = 0; /* default: not immediate */
attr.s = st.s = NULL;
attr.l = 0;
@@ -285,13 +270,12 @@ static int table_obj(lua_State * L)
if (!lua_isnumber(L, -1)) /* !vi t */
luaL_error(L, "pdf.obj(): \"objnum\" must be integer");
k = (int) lua_tointeger(L, -1); /* vi t */
- check_obj_exists(static_pdf, obj_type_obj, k);
+ check_obj_type(static_pdf, obj_type_obj, k);
if (is_obj_scheduled(static_pdf, k) || obj_data_ptr(static_pdf, k) != 0)
luaL_error(L, "pdf.obj() object in use");
} else {
- incr(static_pdf->obj_count);
- pdf_create_obj(static_pdf, obj_type_obj, static_pdf->sys_obj_ptr + 1);
- k = static_pdf->sys_obj_ptr;
+ static_pdf->obj_count++;
+ k = pdf_create_obj(static_pdf, obj_type_obj, static_pdf->obj_ptr + 1);
}
pdf_last_obj = k;
if (immediate == 0) {
@@ -379,7 +363,7 @@ static int table_obj(lua_State * L)
"pdf.obj(): \"string\" must be string for raw object");
if (immediate == 1) {
st.s = lua_tolstring(L, -1, &st.l);
- buf_to_pdfbuf_macro(static_pdf, st.s, st.l);
+ pdf_out_block(static_pdf, st.s, st.l);
if (st.s[st.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
} else
@@ -392,7 +376,7 @@ static int table_obj(lua_State * L)
if (immediate == 1) {
st.s = lua_tolstring(L, -1, &st.l); /* file-s nil t */
buf.s = fread_to_buf(L, st.s, &buf.l);
- buf_to_pdfbuf_macro(static_pdf, buf.s, buf.l);
+ pdf_out_block(static_pdf, (const char *) buf.s, buf.l);
if (buf.s[buf.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
xfree(buf.s);
@@ -408,7 +392,7 @@ static int table_obj(lua_State * L)
if (immediate == 1) {
pdf_begin_dict(static_pdf, k, 0); /* 0 = not an object stream candidate! */
if (attr.s != NULL) {
- buf_to_pdfbuf_macro(static_pdf, attr.s, attr.l);
+ pdf_out_block(static_pdf, attr.s, attr.l);
if (attr.s[attr.l - 1] != '\n')
pdf_puts(static_pdf, "\n");
}
@@ -428,7 +412,7 @@ static int table_obj(lua_State * L)
"pdf.obj(): \"string\" must be string for stream object");
if (immediate == 1) {
st.s = lua_tolstring(L, -1, &st.l); /* string-s t */
- buf_to_pdfbuf_macro(static_pdf, st.s, st.l);
+ pdf_out_block(static_pdf, st.s, st.l);
} else
obj_obj_data(static_pdf, k) = luaL_ref(L, LUA_REGISTRYINDEX); /* t */
} else {
@@ -439,7 +423,7 @@ static int table_obj(lua_State * L)
if (immediate == 1) {
st.s = lua_tolstring(L, -1, &st.l); /* file-s nil t */
buf.s = fread_to_buf(L, st.s, &buf.l);
- buf_to_pdfbuf_macro(static_pdf, buf.s, buf.l);
+ pdf_out_block(static_pdf, (const char *) buf.s, buf.l);
xfree(buf.s);
} else {
set_obj_obj_is_file(static_pdf, k);
@@ -466,13 +450,12 @@ static int orig_obj(lua_State * L)
if (n > 0 && lua_type(L, 1) == LUA_TNUMBER) {
first_arg++;
lua_number2int(k, lua_tonumber(L, 1));
- check_obj_exists(static_pdf, obj_type_obj, k);
+ check_obj_type(static_pdf, obj_type_obj, k);
if (is_obj_scheduled(static_pdf, k) || obj_data_ptr(static_pdf, k) != 0)
luaL_error(L, "pdf.obj() object in use");
} else {
- incr(static_pdf->obj_count);
- pdf_create_obj(static_pdf, obj_type_obj, static_pdf->sys_obj_ptr + 1);
- k = static_pdf->sys_obj_ptr;
+ static_pdf->obj_count++;
+ k = pdf_create_obj(static_pdf, obj_type_obj, static_pdf->obj_ptr + 1);
}
pdf_last_obj = k;
obj_data_ptr(static_pdf, k) = pdf_get_mem(static_pdf, pdfmem_obj_size);
@@ -522,8 +505,7 @@ static int orig_obj(lua_State * L)
static int l_obj(lua_State * L)
{
- int n;
- int k;
+ int k, n;
ensure_output_state(static_pdf, ST_HEADER_WRITTEN);
n = lua_gettop(L);
if (n == 1 && lua_istable(L, 1))
@@ -534,6 +516,20 @@ static int l_obj(lua_State * L)
return 1;
}
+static int l_refobj(lua_State * L)
+{
+ int k, n;
+ n = lua_gettop(L);
+ if (n != 1)
+ luaL_error(L, "pdf.refobj() needs exactly 1 argument");
+ k = (int) luaL_checkinteger(L, 1);
+ if (global_shipping_mode == NOT_SHIPPING)
+ scan_refobj_lua(static_pdf, k);
+ else
+ pdf_ref_obj_lua(static_pdf, k);
+ return 0;
+}
+
static int l_reserveobj(lua_State * L)
{
int n;
@@ -542,17 +538,16 @@ static int l_reserveobj(lua_State * L)
n = lua_gettop(L);
switch (n) {
case 0:
- incr(static_pdf->obj_count);
- pdf_create_obj(static_pdf, obj_type_obj, static_pdf->sys_obj_ptr + 1);
- pdf_last_obj = static_pdf->sys_obj_ptr;
+ static_pdf->obj_count++;
+ pdf_last_obj =
+ pdf_create_obj(static_pdf, obj_type_obj, static_pdf->obj_ptr + 1);
break;
case 1:
if (!lua_isstring(L, -1))
luaL_error(L, "pdf.reserveobj() optional argument must be string");
st.s = lua_tolstring(L, 1, &st.l);
if (st.l == 5 && strncmp((const char *) st.s, "annot", 5) == 0) {
- pdf_create_obj(static_pdf, obj_type_annot, 0);
- pdf_last_annot = static_pdf->sys_obj_ptr;
+ pdf_last_annot = pdf_create_obj(static_pdf, obj_type_annot, 0);
} else {
luaL_error(L, "pdf.reserveobj() optional string must be \"annot\"");
}
@@ -571,7 +566,7 @@ static int l_registerannot(lua_State * L)
n = lua_gettop(L);
switch (n) {
case 1:
- if (!is_shipping_page)
+ if (global_shipping_mode == NOT_SHIPPING)
luaL_error(L, "pdf.registerannot() can only be used in late lua");
i = (int) luaL_checkinteger(L, 1);
if (i <= 0)
@@ -588,27 +583,14 @@ static int l_registerannot(lua_State * L)
static int getpdf(lua_State * L)
{
char *s;
- const char *st;
int i, l;
- if (lua_isstring(L, 2) && (st = lua_tostring(L, 2)) != NULL) {
+ if (lua_isstring(L, 2) && (lua_tostring(L, 2) != NULL)) {
lua_pushvalue(L, 2); /* st ... */
lua_gettable(L, LUA_ENVIRONINDEX); /* i? ... */
if (lua_isnumber(L, -1)) { /* i ... */
i = (int) lua_tointeger(L, -1); /* i ... */
lua_pop(L, 1); /* ... */
switch (i) {
- case P_PAGEATTRIBUTES:
- s = tokenlist_to_cstring(pdf_pageattributes_toks, true, &l);
- lua_pushlstring(L, s, (size_t) l);
- break;
- case P_PAGERESOURCES:
- s = tokenlist_to_cstring(pdf_pageresources_toks, true, &l);
- lua_pushlstring(L, s, (size_t) l);
- break;
- case P_PAGESATTRIBUTES:
- s = tokenlist_to_cstring(pdf_pagesattributes_toks, true, &l);
- lua_pushlstring(L, s, (size_t) l);
- break;
case P_PDFCATALOG:
case P_CATALOG:
s = tokenlist_to_cstring(pdf_catalog_toks, true, &l);
@@ -661,15 +643,6 @@ static int setpdf(lua_State * L)
i = (int) lua_tointeger(L, -1); /* i ... */
lua_pop(L, 1); /* ... */
switch (i) {
- case P_PAGEATTRIBUTES:
- pdf_pageattributes_toks = tokenlist_from_lua(L);
- break;
- case P_PAGERESOURCES:
- pdf_pageresources_toks = tokenlist_from_lua(L);
- break;
- case P_PAGESATTRIBUTES:
- pdf_pagesattributes_toks = tokenlist_from_lua(L);
- break;
case P_PDFCATALOG:
case P_CATALOG:
pdf_catalog_toks = tokenlist_from_lua(L);
@@ -699,6 +672,28 @@ static int setpdf(lua_State * L)
return 0;
}
+static int l_objtype(lua_State * L)
+{
+ int n = lua_gettop(L);
+ if (n != 1)
+ luaL_error(L, "pdf.objtype() needs exactly 1 argument");
+ n = (int) luaL_checkinteger(L, 1);
+ if (n < 0 || n > static_pdf->obj_ptr)
+ lua_pushnil(L);
+ else
+ lua_pushstring(L, pdf_obj_typenames[obj_type(static_pdf, n)]);
+ return 1;
+}
+
+static int l_maxobjnum(lua_State * L)
+{
+ int n = lua_gettop(L);
+ if (n != 0)
+ luaL_error(L, "pdf.maxobjnum() needs 0 arguments");
+ lua_pushinteger(L, static_pdf->obj_ptr);
+ return 1;
+}
+
static int l_mapfile(lua_State * L)
{
char *s;
@@ -735,14 +730,31 @@ static int l_pdfmapline(lua_State * L)
return 0;
}
+static int l_pageref(lua_State * L)
+{
+ int n = lua_gettop(L);
+ if (n != 1)
+ luaL_error(L, "pdf.pageref() needs exactly 1 argument");
+ n = (int) luaL_checkinteger(L, 1);
+ if (n <= 0)
+ luaL_error(L, "pdf.pageref() needs page number > 0");
+ n = get_obj(static_pdf, obj_type_page, n, false);
+ lua_pushnumber(L, n);
+ return 1;
+}
+
static const struct luaL_reg pdflib[] = {
{"immediateobj", l_immediateobj},
{"mapfile", l_mapfile},
{"mapline", l_mapline},
+ {"maxobjnum", l_maxobjnum},
{"obj", l_obj},
+ {"objtype", l_objtype},
+ {"pageref", l_pageref},
{"pdfmapfile", l_pdfmapfile}, /* obsolete */
{"pdfmapline", l_pdfmapline}, /* obsolete */
{"print", luapdfprint},
+ {"refobj", l_refobj},
{"registerannot", l_registerannot},
{"reserveobj", l_reserveobj},
{NULL, NULL} /* sentinel */
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
index 020fe6d616a..49a72210577 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
@@ -19,7 +19,7 @@
static const char _svn_version[] =
"$Id: lstatslib.c 3477 2010-03-12 13:59:34Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/lstatslib.c $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/lstatslib.c $";
#include "lua/luatex-api.h"
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
index 63ab77d9f65..6acd371161c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: ltexiolib.c 3550 2010-03-26 14:37:09Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/ltexiolib.c $";
+ "$Id: ltexiolib.c 3550 2010-03-26 14:37:09Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/ltexiolib.c $";
typedef void (*texio_printer) (const char *);
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index 317dbbd9afd..f40e173a108 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -23,7 +23,7 @@
static const char _svn_version[] =
- "$Id: ltexlib.c 3612 2010-04-13 09:29:42Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/ltexlib.c $";
+ "$Id: ltexlib.c 4132 2011-04-11 14:04:10Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/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
@@ -574,6 +574,46 @@ static int tex_scaledimen(lua_State * L)
return 1;
}
+static int texerror (lua_State * L)
+{
+ int i, n, l;
+ const char **errhlp = NULL;
+ const char *error = luaL_checkstring(L,1);
+ n = lua_gettop(L);
+ if (n==2 && lua_type(L, n) == LUA_TTABLE) {
+ l = 1; /* |errhlp| is terminated by a NULL entry */
+ for (i = 1;; i++) {
+ lua_rawgeti(L, n, i);
+ if (lua_isstring(L, -1)) {
+ l++;
+ lua_pop(L, 1);
+ } else {
+ lua_pop(L, 1);
+ break;
+ }
+ }
+ if (l>1) {
+ errhlp = xmalloc(l * sizeof(char *));
+ memset(errhlp,0,l * sizeof(char *));
+ for (i = 1;; i++) {
+ lua_rawgeti(L, n, i);
+ if (lua_isstring(L, -1)) {
+ errhlp[(i-1)] = lua_tostring(L,-1);
+ lua_pop(L, 1);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ deletions_allowed = false;
+ tex_error(error, errhlp);
+ if (errhlp)
+ xfree(errhlp);
+ deletions_allowed = true;
+ return 0;
+}
+
static int get_item_index(lua_State * L, int i, int base)
{
@@ -783,6 +823,8 @@ static int vsettoks(lua_State * L, int is_global)
int i, err;
int k;
lstring str;
+ char *s;
+ const char *ss;
int save_global_defs = int_par(global_defs_code);
if (is_global)
int_par(global_defs_code) = 1;
@@ -790,7 +832,10 @@ static int vsettoks(lua_State * L, int is_global)
if (!lua_isstring(L, i)) {
luaL_error(L, "unsupported value type");
}
- str.s = (unsigned char *) xstrdup(lua_tolstring(L, i, &str.l));
+ ss = lua_tolstring(L, i, &str.l);
+ s = xmalloc (str.l+1);
+ memcpy (s, ss, str.l+1);
+ str.s = (unsigned char *)s;
k = get_item_index(L, (i - 1), toks_base);
check_index_range(k, "settoks");
err = set_tex_toks_register(k, str);
@@ -903,114 +948,238 @@ static int setbox(lua_State * L)
return vsetbox(L, isglobal);
}
-static int getboxdim(lua_State * L, int whichdim)
+#define check_char_range(j,s,lim) \
+ if (j<0 || j >= lim) { \
+ luaL_error(L, "incorrect character value %d for tex.%s()", (int)j, s); }
+
+
+static int setcode (lua_State *L, void (*setone)(int,halfword,quarterword),
+ void (*settwo)(int,halfword,quarterword), const char *name, int lim)
{
- int i, j;
- i = lua_gettop(L);
- j = get_box_id(L, i);
- lua_settop(L, (i - 2)); /* table at -1 */
- if (j < 0 || j > 65535) {
- luaL_error(L, "incorrect index");
- }
- switch (whichdim) {
- case width_offset:
- lua_pushnumber(L, get_tex_box_width(j));
- break;
- case height_offset:
- lua_pushnumber(L, get_tex_box_height(j));
- break;
- case depth_offset:
- lua_pushnumber(L, get_tex_box_depth(j));
+ int ch;
+ halfword val, ucval;
+ int level = cur_level;
+ int n = lua_gettop(L);
+ int f = 1;
+ if (n>1 && lua_type(L,1) == LUA_TTABLE)
+ f++;
+ if (n>2 && lua_isstring(L, f)) {
+ const char *s = lua_tostring(L, f);
+ if (strcmp(s, "global") == 0) {
+ level = level_one;
+ f++;
+ }
+ }
+ ch = (int) luaL_checkinteger(L, f);
+ check_char_range(ch, name, 65536*17);
+ val = (halfword) luaL_checkinteger(L, f+1);
+ check_char_range(val, name, lim);
+ (setone)(ch, val, level);
+ if (settwo != NULL && n-f == 2) {
+ ucval = (halfword) luaL_checkinteger(L, f+2);
+ check_char_range(ucval, name, lim);
+ (settwo)(ch, ucval, level);
}
+ return 0;
+}
+
+static int setlccode(lua_State * L)
+{
+ return setcode(L, &set_lc_code, &set_uc_code, "setlccode", 65536*17);
+}
+
+static int getlccode(lua_State * L)
+{
+ int ch = (int) luaL_checkinteger(L, -1);
+ check_char_range(ch, "getlccode", 65536*17);
+ lua_pushnumber(L, get_lc_code(ch));
return 1;
}
-static int getboxwd(lua_State * L)
+static int setuccode(lua_State * L)
{
- return getboxdim(L, width_offset);
+ return setcode(L, &set_uc_code, &set_lc_code, "setuccode", 65536*17);
}
-static int getboxht(lua_State * L)
+static int getuccode(lua_State * L)
{
- return getboxdim(L, height_offset);
+ int ch = (int) luaL_checkinteger(L, -1);
+ check_char_range(ch, "getuccode", 65536*17);
+ lua_pushnumber(L, get_uc_code(ch));
+ return 1;
}
-static int getboxdp(lua_State * L)
+static int setsfcode(lua_State * L)
{
- return getboxdim(L, depth_offset);
+ return setcode(L, &set_sf_code, NULL, "setsfcode", 32768);
}
-static int vsetboxdim(lua_State * L, int whichdim, int is_global)
+static int getsfcode(lua_State * L)
{
- int i, j, k, err;
- int save_global_defs = int_par(global_defs_code);
- if (is_global)
- int_par(global_defs_code) = 1;
- i = lua_gettop(L);
- if (!lua_isnumber(L, i)) {
- j = dimen_to_number(L, lua_tostring(L, i));
- } else {
- lua_number2int(j, lua_tonumber(L, i));
- }
- k = get_box_id(L, (i - 1));
- lua_settop(L, (i - 3)); /* table at -2 */
- if (k < 0 || k > 65535) {
- luaL_error(L, "incorrect index");
- }
- err = 0;
- switch (whichdim) {
- case width_offset:
- err = set_tex_box_width(k, j);
- break;
- case height_offset:
- err = set_tex_box_height(k, j);
- break;
- case depth_offset:
- err = set_tex_box_depth(k, j);
+ int ch = (int) luaL_checkinteger(L, -1);
+ check_char_range(ch, "getsfcode", 65536*17);
+ lua_pushnumber(L, get_sf_code(ch));
+ return 1;
+}
+
+static int setcatcode(lua_State * L)
+{
+ int ch;
+ halfword val;
+ int level = cur_level;
+ int cattable = int_par(cat_code_table_code);
+ int n = lua_gettop(L);
+ int f = 1;
+ if (n>1 && lua_type(L,1) == LUA_TTABLE)
+ f++;
+ if (n>2 && lua_isstring(L, f)) {
+ const char *s = lua_tostring(L, f);
+ if (strcmp(s, "global") == 0) {
+ level = level_one;
+ f++;
+ }
}
- int_par(global_defs_code) = save_global_defs;
- if (err) {
- luaL_error(L, "not a box");
+ if (n-f == 2) {
+ cattable = (int) luaL_checkinteger(L, -3);
}
+ ch = (int) luaL_checkinteger(L, -2);
+ check_char_range(ch, "setcatcode", 65536*17);
+ val = (halfword) luaL_checkinteger(L, -1);
+ check_char_range(val, "setcatcode", 16);
+ set_cat_code(cattable, ch, val, level);
return 0;
}
-static int setboxwd(lua_State * L)
+static int getcatcode(lua_State * L)
{
- int isglobal = 0;
- int n = lua_gettop(L);
- if (n == 3 && lua_isstring(L, 1)) {
- const char *s = lua_tostring(L, 1);
- if (strcmp(s, "global") == 0)
- isglobal = 1;
+ int cattable = int_par(cat_code_table_code);
+ int ch = (int) luaL_checkinteger(L, -1);
+ if (lua_gettop(L)>=2 && lua_type(L,-2)==LUA_TNUMBER) {
+ cattable = luaL_checkinteger(L, -2);
}
- return vsetboxdim(L, width_offset, isglobal);
+ check_char_range(ch, "getcatcode", 65536*17);
+ lua_pushnumber(L, get_cat_code(cattable, ch));
+ return 1;
}
-static int setboxht(lua_State * L)
+
+static int setmathcode(lua_State * L)
{
- int isglobal = 0;
+ int ch;
+ halfword cval, fval, chval;
+ int level = cur_level;
int n = lua_gettop(L);
- if (n == 3 && lua_isstring(L, 1)) {
- const char *s = lua_tostring(L, 1);
- if (strcmp(s, "global") == 0)
- isglobal = 1;
+ int f = 1;
+ if (n>1 && lua_type(L,1) == LUA_TTABLE)
+ f++;
+ if (n>2 && lua_isstring(L, f)) {
+ const char *s = lua_tostring(L, f);
+ if (strcmp(s, "global") == 0) {
+ level = level_one;
+ f++;
+ }
+ }
+ if (n-f!=1 || lua_type(L,f+1) != LUA_TTABLE) {
+ luaL_error(L, "Bad arguments for tex.setmathcode()");
}
- return vsetboxdim(L, height_offset, isglobal);
+ ch = (int) luaL_checkinteger(L, -2);
+ check_char_range(ch, "setmathcode", 65536*17);
+
+ lua_rawgeti(L, -1, 1);
+ cval = (halfword) luaL_checkinteger(L, -1);
+ lua_rawgeti(L, -2, 2);
+ fval = (halfword) luaL_checkinteger(L, -1);
+ lua_rawgeti(L, -3, 3);
+ chval = (halfword) luaL_checkinteger(L, -1);
+ lua_pop(L,3);
+
+ check_char_range(cval, "setmathcode", 8);
+ check_char_range(fval, "setmathcode", 256);
+ check_char_range(chval, "setmathcode", 65536*17);
+ set_math_code(ch, xetex_mathcode, cval,fval, chval, (quarterword) (level));
+ return 0;
}
-static int setboxdp(lua_State * L)
+static int getmathcode(lua_State * L)
{
- int isglobal = 0;
+ mathcodeval mval = { 0, 0, 0, 0 };
+ int ch = (int) luaL_checkinteger(L, -1);
+ check_char_range(ch, "getmathcode", 65536*17);
+ mval = get_math_code(ch);
+ lua_newtable(L);
+ lua_pushnumber(L,mval.class_value);
+ lua_rawseti(L, -2, 1);
+ lua_pushnumber(L,mval.family_value);
+ lua_rawseti(L, -2, 2);
+ lua_pushnumber(L,mval.character_value);
+ lua_rawseti(L, -2, 3);
+ return 1;
+}
+
+
+
+static int setdelcode(lua_State * L)
+{
+ int ch;
+ halfword sfval, scval, lfval, lcval;
+ int level = cur_level;
int n = lua_gettop(L);
- if (n == 3 && lua_isstring(L, 1)) {
- const char *s = lua_tostring(L, 1);
- if (strcmp(s, "global") == 0)
- isglobal = 1;
+ int f = 1;
+ if (n>1 && lua_type(L,1) == LUA_TTABLE)
+ f++;
+ if (n>2 && lua_isstring(L, f)) {
+ const char *s = lua_tostring(L, f);
+ if (strcmp(s, "global") == 0) {
+ level = level_one;
+ f++;
+ }
}
- return vsetboxdim(L, depth_offset, isglobal);
+ if (n-f!=1 || lua_type(L,f+1) != LUA_TTABLE) {
+ luaL_error(L, "Bad arguments for tex.setdelcode()");
+ }
+ ch = (int) luaL_checkinteger(L, -2);
+ check_char_range(ch, "setdelcode", 65536*17);
+ lua_rawgeti(L, -1, 1);
+ sfval = (halfword) luaL_checkinteger(L, -1);
+ lua_rawgeti(L, -2, 2);
+ scval = (halfword) luaL_checkinteger(L, -1);
+ lua_rawgeti(L, -3, 3);
+ lfval = (halfword) luaL_checkinteger(L, -1);
+ lua_rawgeti(L, -4, 4);
+ lcval = (halfword) luaL_checkinteger(L, -1);
+ lua_pop(L,4);
+
+ check_char_range(sfval, "setdelcode", 256);
+ check_char_range(scval, "setdelcode", 65536*17);
+ check_char_range(lfval, "setdelcode", 256);
+ check_char_range(lcval, "setdelcode", 65536*17);
+ set_del_code(ch, xetex_mathcode, sfval, scval, lfval, lcval, (quarterword) (level));
+
+ return 0;
+}
+
+static int getdelcode(lua_State * L)
+{
+ delcodeval mval = { 0, 0, 0, 0, 0, 0 };
+ int ch = (int) luaL_checkinteger(L, -1);
+ check_char_range(ch, "getdelcode", 65536*17);
+ mval = get_del_code(ch);
+ /* lua_pushnumber(L, mval.class_value); */
+ /* lua_pushnumber(L, mval.origin_value); */
+ lua_newtable(L);
+ lua_pushnumber(L,mval.small_family_value);
+ lua_rawseti(L, -2, 1);
+ lua_pushnumber(L,mval.small_character_value);
+ lua_rawseti(L, -2, 2);
+ lua_pushnumber(L,mval.large_family_value);
+ lua_rawseti(L, -2, 3);
+ lua_pushnumber(L,mval.large_character_value);
+ lua_rawseti(L, -2, 4);
+ return 1;
}
+
+
static int settex(lua_State * L)
{
const char *st;
@@ -1052,6 +1221,11 @@ static int settex(lua_State * L)
lua_number2int(j, lua_tonumber(L, i));
}
assign_internal_value((isglobal ? 4 : 0), equiv(cur_cs), j);
+ } else if (is_glue_assign(cur_cmd)) {
+ halfword *j = check_isnode(L, i); /* the value */
+ { int a = isglobal;
+ define(equiv(cur_cs), assign_glue_cmd, *j);
+ }
} else if (is_toks_assign(cur_cmd)) {
if (lua_isstring(L, i)) {
j = tokenlist_from_lua(L); /* uses stack -1 */
@@ -1062,7 +1236,12 @@ static int settex(lua_State * L)
}
} else {
- luaL_error(L, "unsupported tex internal assignment");
+ /* people may want to add keys that are also primitives
+ (|tex.wd| for example) so creating an error is not
+ right here */
+ if (lua_istable(L, (i - 2)))
+ lua_rawset(L, (i - 2));
+ /* luaL_error(L, "unsupported tex internal assignment"); */
}
} else {
if (lua_istable(L, (i - 2)))
@@ -2018,10 +2197,10 @@ static int tex_run_linebreak(lua_State * L)
pdflastlinedepth, pdfignoreddimen, parshape;
int fewest_demerits = 0, actual_looseness = 0;
halfword clubpenalties, interlinepenalties, widowpenalties;
-
+ int save_vlink_tmp_head;
/* push a new nest level */
push_nest();
- /* save_vlink_cur_head = vlink(cur_list.head_field); */
+ save_vlink_tmp_head = vlink(temp_head);
j = check_isnode(L, 1); /* the value */
vlink(temp_head) = *j;
@@ -2139,6 +2318,7 @@ static int tex_run_linebreak(lua_State * L)
lua_settable(L, -3);
/* restore nest stack */
+ vlink(temp_head) = save_vlink_tmp_head;
pop_nest();
if (parshape != equiv(par_shape_loc))
flush_node(parshape);
@@ -2148,7 +2328,7 @@ static int tex_run_linebreak(lua_State * L)
static int tex_shipout(lua_State * L)
{
int boxnum = get_box_id(L, 1);
- ship_out(static_pdf, box(boxnum), true);
+ ship_out(static_pdf, box(boxnum), SHIPPING_PAGE);
box(boxnum) = null;
return 0;
}
@@ -2250,6 +2430,7 @@ static const struct luaL_reg texlib[] = {
{"write", luacwrite},
{"print", luacprint},
{"tprint", luactprint},
+ {"error", texerror},
{"sprint", luacsprint},
{"set", settex},
{"get", gettex},
@@ -2267,14 +2448,20 @@ static const struct luaL_reg texlib[] = {
{"getbox", getbox},
{"setlist", setlist},
{"getlist", getlist},
- {"setboxwd", setboxwd},
- {"getboxwd", getboxwd},
- {"setboxht", setboxht},
- {"getboxht", getboxht},
- {"setboxdp", setboxdp},
- {"getboxdp", getboxdp},
{"setnest", setnest},
{"getnest", getnest},
+ {"setcatcode", setcatcode},
+ {"getcatcode", getcatcode},
+ {"setdelcode", setdelcode},
+ {"getdelcode", getdelcode},
+ {"setlccode", setlccode},
+ {"getlccode", getlccode},
+ {"setmathcode", setmathcode},
+ {"getmathcode", getmathcode},
+ {"setsfcode", setsfcode},
+ {"getsfcode", getsfcode},
+ {"setuccode", setuccode},
+ {"getuccode", getuccode},
{"round", tex_roundnumber},
{"scale", tex_scaletable},
{"sp", tex_scaledimen},
@@ -2311,9 +2498,12 @@ int luaopen_tex(lua_State * L)
make_table(L, "count", "getcount", "setcount");
make_table(L, "toks", "gettoks", "settoks");
make_table(L, "box", "getbox", "setbox");
- make_table(L, "wd", "getboxwd", "setboxwd");
- make_table(L, "ht", "getboxht", "setboxht");
- make_table(L, "dp", "getboxdp", "setboxdp");
+ make_table(L, "sfcode", "getsfcode", "setsfcode");
+ make_table(L, "lccode", "getlccode", "setlccode");
+ make_table(L, "uccode", "getuccode", "setuccode");
+ make_table(L, "catcode", "getcatcode", "setcatcode");
+ make_table(L, "mathcode", "getmathcode", "setmathcode");
+ make_table(L, "delcode", "getdelcode", "setdelcode");
make_table(L, "lists", "getlist", "setlist");
make_table(L, "nest", "getnest", "setnest");
/* *INDENT-ON* */
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
index 0f1c5332466..4f3913e0bc3 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: ltokenlib.c 3404 2010-01-28 11:17:10Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/ltokenlib.c $";
+ "$Id: ltokenlib.c 3404 2010-01-28 11:17:10Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/ltokenlib.c $";
#define is_valid_token(L,i) (lua_istable(L,i) && lua_objlen(L,i)==3)
#define get_token_cmd(L,i) lua_rawgeti(L,i,1)
diff --git a/Build/source/texk/web2c/luatexdir/lua/luagen.w b/Build/source/texk/web2c/luatexdir/lua/luagen.w
index 69589ba04e0..f992a15b17e 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luagen.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luagen.w
@@ -20,7 +20,7 @@
@ @c
static const char _svn_version[] =
"$Id: luagen.w 3583 2010-04-02 17:40:44Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/luagen.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/luagen.w $";
#include "ptexlib.h"
#include "pdf/pdfpage.h"
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w
index 3efeb7a949c..aa63118624c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w
@@ -28,7 +28,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: luainit.w 3621 2010-04-15 16:08:22Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/luainit.w $";
+ "$Id: luainit.w 4114 2011-04-11 06:44:43Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/luainit.w $";
@
TH: TODO
@@ -331,7 +331,7 @@ static void parse_options(int argc, char **argv)
"the terms of the GNU General Public License, version 2. For more\n"
"information about these matters, see the file named COPYING and\n"
"the LuaTeX source.\n\n"
- "Copyright 2009 Taco Hoekwater, the LuaTeX Team.\n");
+ "Copyright 2010 Taco Hoekwater, the LuaTeX Team.\n");
/* *INDENT-ON* */
uexit(0);
} else if (ARGUMENT_IS("credits")) {
@@ -350,7 +350,7 @@ static void parse_options(int argc, char **argv)
"lua by Roberto Ierusalimschy, Waldemar Celes,\n"
" Luiz Henrique de Figueiredo\n"
"metapost by John Hobby, Taco Hoekwater and friends.\n"
- "xpdf by Derek Noonburg (partial)\n"
+ "poppler by Derek Noonburg, Kristian Høgsberg (partial)\n"
"fontforge by George Williams (partial)\n\n"
"Some extensions to lua and additional lua libraries are used, as well as\n"
"libraries for graphic inclusion. More details can be found in the source.\n"
@@ -731,13 +731,13 @@ void lua_initialize(int ac, char **av)
argv = av;
if (luatex_svn < 0) {
- if (asprintf(&banner, "This is LuaTeX, Version %s-%d%s",
- luatex_version_string, luatex_date_info, WEB2CVERSION) < 0) {
+ if (asprintf(&banner, "This is LuaTeX, Version %s-%d",
+ luatex_version_string, luatex_date_info) < 0) {
exit(EXIT_FAILURE);
}
} else {
- if (asprintf(&banner, "This is LuaTeX, Version %s-%d%s (rev %d)",
- luatex_version_string, luatex_date_info, WEB2CVERSION, luatex_svn) < 0) {
+ if (asprintf(&banner, "This is LuaTeX, Version %s-%d (rev %d)",
+ luatex_version_string, luatex_date_info, luatex_svn) < 0) {
exit(EXIT_FAILURE);
}
}
@@ -816,7 +816,7 @@ void lua_initialize(int ac, char **av)
if (!dump_name) {
get_lua_string("texconfig", "formatname", &dump_name);
}
- if ((lua_only) || ((!input_name) && (!dump_name))) {
+ if (lua_only) {
if (given_file)
free(given_file);
/* this is not strictly needed but it pleases valgrind */
diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.w b/Build/source/texk/web2c/luatexdir/lua/luanode.w
index ce157f0767a..56f6cf734b2 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luanode.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luanode.w
@@ -23,8 +23,8 @@
static const char _svn_version[] =
- "$Id: luanode.w 3583 2010-04-02 17:40:44Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/luanode.w $";
+ "$Id: luanode.w 4092 2011-03-16 14:53:39Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/luanode.w $";
@ @c
static const char *group_code_names[] = {
@@ -60,10 +60,12 @@ const char *pack_type_name[] = { "exactly", "additional" };
void lua_node_filter_s(int filterid, const char *extrainfo)
{
lua_State *L = Luas;
- int s_top = lua_gettop(L);
int callback_id = callback_defined(filterid);
- if (callback_id <= 0)
+ int s_top = lua_gettop(L);
+ if (callback_id <= 0) {
+ lua_settop(L, s_top);
return;
+ }
if (!get_callback(L, callback_id)) {
lua_settop(L, s_top);
return;
@@ -87,19 +89,22 @@ lua_node_filter(int filterid, int xextrainfo, halfword head_node,
halfword ret;
int a;
lua_State *L = Luas;
+ int s_top = lua_gettop(L);
const char *extrainfo = group_code_names[xextrainfo];
int callback_id = callback_defined(filterid);
- if (head_node == null || vlink(head_node) == null || callback_id <= 0)
+ if (head_node == null || vlink(head_node) == null || callback_id <= 0) {
+ lua_settop(L, s_top);
return;
+ }
if (!get_callback(L, callback_id)) {
- lua_pop(L, 2);
+ lua_settop(L, s_top);
return;
}
nodelist_to_lua(L, vlink(head_node)); /* arg 1 */
lua_pushstring(L, extrainfo); /* arg 2 */
if (lua_pcall(L, 2, 1, 0) != 0) { /* no arg, 1 result */
fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 2);
+ lua_settop(L, s_top);
error();
return;
}
@@ -110,7 +115,7 @@ lua_node_filter(int filterid, int xextrainfo, halfword head_node,
}
} else {
a = nodelist_from_lua(L);
- vlink(head_node) = a;
+ try_couple_nodes(head_node,a);
}
lua_pop(L, 2); /* result and callback container table */
if (fix_node_lists)
@@ -123,6 +128,7 @@ lua_node_filter(int filterid, int xextrainfo, halfword head_node,
} else {
*tail_node = head_node;
}
+ lua_settop(L, s_top);
return;
}
@@ -135,18 +141,21 @@ lua_linebreak_callback(int is_broken, halfword head_node, halfword * new_head)
register halfword *p;
int ret = 0; /* failure */
lua_State *L = Luas;
+ int s_top = lua_gettop(L);
int callback_id = callback_defined(linebreak_filter_callback);
- if (head_node == null || vlink(head_node) == null || callback_id <= 0)
+ if (head_node == null || vlink(head_node) == null || callback_id <= 0) {
+ lua_settop(L, s_top);
return ret;
+ }
if (!get_callback(L, callback_id)) {
- lua_pop(L, 2);
+ lua_settop(L, s_top);
return ret;
}
nodelist_to_lua(L, vlink(head_node)); /* arg 1 */
lua_pushboolean(L, is_broken); /* arg 2 */
if (lua_pcall(L, 2, 1, 0) != 0) { /* no arg, 1 result */
fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 2);
+ lua_settop(L, s_top);
error();
return ret;
}
@@ -154,10 +163,10 @@ lua_linebreak_callback(int is_broken, halfword head_node, halfword * new_head)
p = lua_touserdata(L, -1);
if (p != NULL) {
a = nodelist_from_lua(L);
- vlink(*new_head) = a;
+ try_couple_nodes(*new_head,a);
ret = 1;
}
- lua_pop(L, 2); /* result and callback container table */
+ lua_settop(L, s_top);
return ret;
}
@@ -170,11 +179,14 @@ lua_hpack_filter(halfword head_node, scaled size, int pack_type, int extrainfo,
{
halfword ret;
lua_State *L = Luas;
+ int s_top = lua_gettop(L);
int callback_id = callback_defined(hpack_filter_callback);
- if (head_node == null || callback_id <= 0)
+ if (head_node == null || callback_id <= 0) {
+ lua_settop(L, s_top);
return head_node;
+ }
if (!get_callback(L, callback_id)) {
- lua_pop(L, 2);
+ lua_settop(L, s_top);
return head_node;
}
nodelist_to_lua(L, head_node);
@@ -187,7 +199,7 @@ lua_hpack_filter(halfword head_node, scaled size, int pack_type, int extrainfo,
lua_pushnil(L);
if (lua_pcall(L, 5, 1, 0) != 0) { /* no arg, 1 result */
fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 2);
+ lua_settop(L, s_top);
error();
return head_node;
}
@@ -200,7 +212,7 @@ lua_hpack_filter(halfword head_node, scaled size, int pack_type, int extrainfo,
} else {
ret = nodelist_from_lua(L);
}
- lua_pop(L, 2); /* result and callback container table */
+ lua_settop(L, s_top);
#if 0
lua_gc(L,LUA_GCSTEP, LUA_GC_STEP_SIZE);
#endif
@@ -217,18 +229,22 @@ lua_vpack_filter(halfword head_node, scaled size, int pack_type, scaled maxd,
halfword ret;
int callback_id;
lua_State *L = Luas;
- if (head_node == null)
+ int s_top = lua_gettop(L);
+ if (head_node == null) {
+ lua_settop(L, s_top);
return head_node;
+ }
if (strcmp("output", group_code_names[extrainfo]) == 0) {
callback_id = callback_defined(pre_output_filter_callback);
} else {
callback_id = callback_defined(vpack_filter_callback);
}
if (callback_id <= 0) {
+ lua_settop(L, s_top);
return head_node;
}
if (!get_callback(L, callback_id)) {
- lua_pop(L, 2);
+ lua_settop(L, s_top);
return head_node;
}
nodelist_to_lua(L, head_node);
@@ -242,7 +258,7 @@ lua_vpack_filter(halfword head_node, scaled size, int pack_type, scaled maxd,
lua_pushnil(L);
if (lua_pcall(L, 6, 1, 0) != 0) { /* no arg, 1 result */
fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
- lua_pop(L, 2);
+ lua_settop(L, s_top);
error();
return head_node;
}
@@ -255,7 +271,7 @@ lua_vpack_filter(halfword head_node, scaled size, int pack_type, scaled maxd,
} else {
ret = nodelist_from_lua(L);
}
- lua_pop(L, 2); /* result and callback container table */
+ lua_settop(L, s_top);
#if 0
lua_gc(L,LUA_GCSTEP, LUA_GC_STEP_SIZE);
#endif
@@ -297,13 +313,7 @@ void lua_pdf_literal(PDF pdf, int i)
size_t l = 0;
lua_rawgeti(Luas, LUA_REGISTRYINDEX, i);
s = lua_tolstring(Luas, -1, &l);
- if (l < max_single_pdf_print) {
- pdf_out_block(pdf, s, l);
- } else {
- while (l--) {
- pdf_out(pdf, *s++);
- }
- }
+ pdf_out_block(pdf, s, l);
pdf_out(pdf, 10); /* |pdf_print_nl| */
lua_pop(Luas, 1);
}
@@ -322,6 +332,20 @@ void copy_pdf_literal(pointer r, pointer p)
}
}
+void copy_late_lua(pointer r, pointer p)
+{
+ late_lua_type(r) = late_lua_type(p);
+ if (late_lua_name(p) > 0)
+ add_token_ref(late_lua_name(p));
+ if (late_lua_type(p) == normal) {
+ late_lua_data(r) = late_lua_data(p);
+ add_token_ref(late_lua_data(p));
+ } else {
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX, late_lua_data(p));
+ late_lua_data(r) = luaL_ref(Luas, LUA_REGISTRYINDEX);
+ }
+}
+
@ @c
void free_pdf_literal(pointer p)
@@ -333,6 +357,17 @@ void free_pdf_literal(pointer p)
}
}
+void free_late_lua(pointer p)
+{
+ if (late_lua_name(p) > 0)
+ delete_token_ref(late_lua_name(p));
+ if (late_lua_type(p) == normal) {
+ delete_token_ref(late_lua_data(p));
+ } else {
+ luaL_unref(Luas, LUA_REGISTRYINDEX, late_lua_data(p));
+ }
+}
+
@ @c
void show_pdf_literal(pointer p)
{
@@ -354,7 +389,24 @@ void show_pdf_literal(pointer p)
print_mark(pdf_literal_data(p));
} else {
lua_rawgeti(Luas, LUA_REGISTRYINDEX, pdf_literal_data(p));
+ tprint("\"");
+ tprint(lua_tostring(Luas, -1));
+ tprint("\"");
+ lua_pop(Luas, 1);
+ }
+}
+
+void show_late_lua(pointer p)
+{
+ tprint_esc("latelua");
+ print_int(late_lua_reg(p));
+ if (late_lua_type(p) == normal) {
+ print_mark(late_lua_data(p));
+ } else {
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX, late_lua_data(p));
+ tprint("\"");
tprint(lua_tostring(Luas, -1));
+ tprint("\"");
lua_pop(Luas, 1);
}
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.w b/Build/source/texk/web2c/luatexdir/lua/luastuff.w
index e8a3c5b9321..fdd38dbd798 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luastuff.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: luastuff.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/luastuff.w $";
+ "$Id: luastuff.w 4001 2010-11-28 15:49:46Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/luastuff.w $";
#include "lua/luatex-api.h"
#include "ptexlib.h"
@@ -189,6 +189,7 @@ void luainterpreter(void)
luatex_md5_lua_open(L);
open_oslibext(L, safer_option);
+ open_lfslibext(L);
/* luasockets */
/* socket and mime are a bit tricky to open because
@@ -344,24 +345,35 @@ int lua_traceback(lua_State * L)
}
@ @c
-static void luacall(int p, int nameptr)
+static void luacall(int p, int nameptr, boolean is_string)
{
LoadS ls;
- int i, l;
+ int i;
+ size_t ll = 0;
char *lua_id;
char *s = NULL;
if (Luas == NULL) {
luainterpreter();
}
- l = 0;
lua_active++;
- s = tokenlist_to_cstring(p, 1, &l);
+ if (is_string) {
+ const char *ss = NULL;
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX, p);
+ ss = lua_tolstring(Luas, -1, &ll);
+ s = xmalloc(ll+1);
+ memcpy(s,ss,ll+1);
+ lua_pop(Luas,1);
+ } else {
+ int l = 0;
+ s = tokenlist_to_cstring(p, 1, &l);
+ ll = (size_t)l;
+ }
ls.s = s;
- ls.size = (size_t) l;
-
+ ls.size = ll;
if (ls.size > 0) {
if (nameptr > 0) {
+ int l = 0; /* not used */
lua_id = tokenlist_to_cstring(nameptr, 1, &l);
} else if (nameptr < 0) {
char *tmp = get_lua_name((nameptr + 65536));
@@ -390,6 +402,7 @@ static void luacall(int p, int nameptr)
}
}
xfree(lua_id);
+ xfree(ls.s);
}
lua_active--;
}
@@ -398,9 +411,13 @@ static void luacall(int p, int nameptr)
void late_lua(PDF pdf, halfword p)
{
(void) pdf;
- expand_macros_in_tokenlist(p); /* sets |def_ref| */
- luacall(def_ref, late_lua_name(p));
- flush_list(def_ref);
+ if (late_lua_type(p)==normal) {
+ expand_macros_in_tokenlist(p); /* sets |def_ref| */
+ luacall(def_ref, late_lua_name(p), false);
+ flush_list(def_ref);
+ } else {
+ luacall(late_lua_data(p), late_lua_name(p), true);
+ }
}
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index e754a498d8d..e25f3ca8d40 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 3612 2010-04-13 09:29:42Z taco $ */
+/* $Id: luatex-api.h 4001 2010-11-28 15:49:46Z taco $ */
#ifndef LUATEX_API_H
# define LUATEX_API_H 1
@@ -30,7 +30,7 @@
# include "lua51/lualib.h"
typedef struct LoadS {
- const char *s;
+ char *s;
size_t size;
} LoadS;
@@ -75,6 +75,7 @@ extern int luaopen_epdf(lua_State * L);
extern int luaopen_mplib(lua_State * L);
extern void open_oslibext(lua_State * L, int safer_option);
+extern void open_lfslibext(lua_State * L);
extern void initfilecallbackids(int max);
extern void setinputfilecallbackid(int n, int i);
@@ -167,12 +168,10 @@ extern int program_name_set; /* in lkpselib.c */
extern char **argv;
extern int argc;
-
extern int loader_C_luatex(lua_State * L, const char *name,
const char *filename);
-extern int loader_Call_luatex (lua_State *L, const char *name,
- const char *filename);
-
+extern int loader_Call_luatex(lua_State * L, const char *name,
+ const char *filename);
extern void init_tex_table(lua_State * L);
@@ -198,6 +197,6 @@ extern char charsetstr[]; /* from mpdir/psout.w */
extern char **environ;
-extern int luac_main(int argc, char *argv[]); /* texluac.w */
+extern int luac_main(int argc, char *argv[]); /* texluac.w */
-#endif
+#endif /* LUATEX_API_H */
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.w b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
index 7647eec5f9b..d41dd78db88 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatoken.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: luatoken.w 3583 2010-04-02 17:40:44Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/luatoken.w $";
+ "$Id: luatoken.w 3849 2010-09-01 09:10:48Z taco $ "
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/luatoken.w $";
@ @c
command_item command_names[] = {
@@ -144,15 +144,6 @@ command_item command_names[] = {
{"set_interaction", set_interaction_cmd, NULL},
{"letterspace_font", letterspace_font_cmd, NULL},
{"pdf_copy_font", pdf_copy_font_cmd, NULL},
- {"set_ocp", set_ocp_cmd, NULL},
- {"def_ocp", def_ocp_cmd, NULL},
- {"set_ocp_list", set_ocp_list_cmd, NULL},
- {"def_ocp_list", def_ocp_list_cmd, NULL},
- {"clear_ocp_lists", clear_ocp_lists_cmd, NULL},
- {"push_ocp_list", push_ocp_list_cmd, NULL},
- {"pop_ocp_list", pop_ocp_list_cmd, NULL},
- {"ocp_list_op", ocp_list_op_cmd, NULL},
- {"ocp_trace_level", ocp_trace_level_cmd, NULL},
{"undefined_cs", undefined_cs_cmd, NULL},
{"expand_after", expand_after_cmd, NULL},
{"no_expand", no_expand_cmd, NULL},
diff --git a/Build/source/texk/web2c/luatexdir/lua/texluac.w b/Build/source/texk/web2c/luatexdir/lua/texluac.w
index 3bc7cc2069d..153ae7a8934 100644
--- a/Build/source/texk/web2c/luatexdir/lua/texluac.w
+++ b/Build/source/texk/web2c/luatexdir/lua/texluac.w
@@ -49,7 +49,7 @@
@ @c
static const char _svn_version[] =
- "$Id: texluac.w 3705 2010-05-28 07:19:20Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/lua/texluac.w $";
+ "$Id: texluac.w 3707 2010-05-28 13:24:16Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/lua/texluac.w $";
/* fix for non-gcc compilation: */
#if !defined(__GNUC__) || (__GNUC__ < 2)
diff --git a/Build/source/texk/web2c/luatexdir/lua51/lauxlib.c b/Build/source/texk/web2c/luatexdir/lua51/lauxlib.c
index 10f14e2c088..e294b407084 100644
--- a/Build/source/texk/web2c/luatexdir/lua51/lauxlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua51/lauxlib.c
@@ -562,6 +562,8 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
else {
lua_pushfstring(L, "@%s", filename);
lf.f = fopen(filename, "r");
+ if (lf.f != NULL)
+ recorder_record_input (filename);
if (lf.f == NULL) return errfile(L, "open", fnameindex);
}
c = getc(lf.f);
diff --git a/Build/source/texk/web2c/luatexdir/lua51/luaconf.h b/Build/source/texk/web2c/luatexdir/lua51/luaconf.h
index 413f12e23f3..fc89eae731e 100644
--- a/Build/source/texk/web2c/luatexdir/lua51/luaconf.h
+++ b/Build/source/texk/web2c/luatexdir/lua51/luaconf.h
@@ -11,7 +11,7 @@
#include <limits.h>
#include <stddef.h>
-#include <w2c/c-auto.h>
+#include <c-auto.h>
/*
** ==================================================================
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/Makefile b/Build/source/texk/web2c/luatexdir/luafilesystem/Makefile
index 10d9ca44c2c..6b54f2c779d 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/Makefile
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.34 2008/05/07 19:06:37 carregal Exp $
+# $Id: Makefile,v 1.36 2009/09/21 17:02:44 mascarenhas Exp $
T= lfs
@@ -12,7 +12,7 @@ OBJS= src/$T.o
lib: src/lfs.so
src/lfs.so: $(OBJS)
- export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/lfs.so $(OBJS)
+ MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/lfs.so $(OBJS)
install:
mkdir -p $(LUA_LIBDIR)
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/README b/Build/source/texk/web2c/luatexdir/luafilesystem/README
index 858ecb67bb0..0103efa6421 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/README
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/README
@@ -10,29 +10,57 @@ related to file systems offered by the standard Lua distribution.
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
LuaFileSystem is free software and uses the same license as Lua 5.1
-Version 1.4.1 [07/May/2008] changes:
+LuaRocks Installation
+---------------------
+luarocks install luafilesystem
+
+
+Documentation
+-------------
+Please check the documentation at doc/us/ for more information.
+
+History
+-------
+
+Version 1.5.0 [20/Oct/2009]
+ * added explicit next and close methods to second return value of lfs.dir (the directory object), for explicit iteration or explicit closing.
+ * added directory locking via lfs.lock_dir function (see the manual).
+
+Version 1.4.2 [03/Feb/2009]
+
+ * fixed bug [#13198] lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).
+ * fixed bug [#39794] Compile error on Solaris 10 (bug report and patch by Aaron B).
+ * fixed compilation problems with Borland C.
+
+Version 1.4.1 [07/May/2008]
+
* documentation review
* fixed Windows compilation issues
* fixed bug in the Windows tests (patch by Shmuel Zeigerman)
* fixed bug [#2185] lfs.attributes(filename, 'size') overflow on files > 2 Gb
-LuaRocks Installation
----------------------
-luarocks install luafilesystem
+Version 1.4.0 [13/Feb/2008]
-Unix Installation
------------------
-To install on Linux/OSX/BSD, please edit the config file and then call
+ * added function lfs.setmode (works only in Windows systems).
+ * lfs.attributes raises an error if attribute does not exist
-make
-make install
+Version 1.3.0 [26/Oct/2007]
-The last step may require root privileges.
+ * added function lfs.symlinkattributes (works only in non Windows systems).
-Windows Installation
---------------------
-To install on Windows, please copy lfs.dll to your package.cpath directory
+Version 1.2.1 [08/May/2007]
-Documentation
--------------
-Please check the documentation at /doc/us/ for more information.
+ * compatible only with Lua 5.1 (Lua 5.0 support was dropped)
+
+Version 1.2 [15/Mar/2006]
+
+ * added optional argument to lfs.attributes
+ * added function lfs.rmdir
+ * bug correction on lfs.dir
+
+Version 1.1 [30/May/2005]
+
+ * added function lfs.touch.
+
+Version 1.0 [21/Jan/2005]
+Version 1.0 Beta [10/Nov/2004]
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/index.html b/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/index.html
index 63b57915e9d..43edefc5a1b 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/index.html
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/index.html
@@ -71,19 +71,32 @@ the underlying directory structure and file attributes.</p>
<h2><a name="status"></a>Status</h2>
-<p>Current version is 1.4.1. It was developed for Lua 5.1.</p>
+<p>Current version is 1.5.0. It was developed for Lua 5.1.</p>
<h2><a name="download"></a>Download</h2>
<p>LuaFileSystem source can be downloaded from its
-<a href="http://luaforge.net/projects/luafilesystem/files">Lua Forge</a>
-page. If you are using
-<a href="http://luabinaries.luaforge.net">LuaBinaries</a> 5.1.3 a Windows binary
-version of LuaFileSystem (compiled with Visual Studio 2005 Express) can be found at the same LuaForge page.</p>
+<a href="http://github.com/keplerproject/luafilesystem">Github</a>
+page.</p>
<h2><a name="history"></a>History</h2>
<dl class="history">
+ <dt><strong>Version 1.5.0</strong> [20/Oct/2009]</dt>
+ <li>Added explicit next and close methods to second return value of lfs.dir
+(the directory object), for explicit iteration or explicit closing.</li>
+ <li>Added directory locking via lfs.lock_dir function (see the <a href="manual.html">manual</a>).</li>
+ <dt><strong>Version 1.4.2</strong> [03/Feb/2009]</dt>
+ <dd>
+ <ul>
+ <li>fixed bug [<a href="http://luaforge.net/tracker/?func=detail&amp;group_id=66&amp;aid=13198&amp;atid=356">#13198</a>]
+ lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).</li>
+ <li>fixed bug [<a href="http://luaforge.net/tracker/?group_id=66&amp;atid=356&amp;func=detail&amp;aid=39794">#39794</a>]
+ Compile error on Solaris 10 (bug report and patch by Aaron B).</li>
+ <li>fixed compilation problems with Borland C.</li>
+ </ul>
+ </dd>
+
<dt><strong>Version 1.4.1</strong> [07/May/2008]</dt>
<dd>
<ul>
@@ -153,7 +166,7 @@ version of LuaFileSystem (compiled with Visual Studio 2005 Express) can be found
<p>LuaFileSystem was designed by Roberto Ierusalimschy,
Andr&eacute; Carregal and Tom&aacute;s Guisasola as part of the
<a href="http://www.keplerproject.org">Kepler Project</a>,
-which holds its copyright.</p>
+which holds its copyright. LuaFileSystem is currently maintained by F&aacute;bio Mascarenhas.</p>
<h2><a name="contact"></a>Contact us</h2>
@@ -170,7 +183,7 @@ Comments are welcome!</p>
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
- <p><small>$Id: index.html,v 1.42 2008/05/07 19:06:37 carregal Exp $</small></p>
+ <p><small>$Id: index.html,v 1.44 2009/02/04 21:21:33 carregal Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/manual.html b/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/manual.html
index efae2363359..1409c404b1a 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/manual.html
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/doc/us/manual.html
@@ -80,6 +80,9 @@ The file has some definitions like paths to the external libraries,
compiler options and the like.
</p>
+<p>On Windows, the C runtime used to compile LuaFileSystem must be the same
+runtime that Lua uses, or some LuaFileSystem functions will not work.</p>
+
<h2><a name="installation"></a>Installation</h2>
<p>The easiest way to install LuaFileSystem is to use LuaRocks:</p>
@@ -168,16 +171,27 @@ LuaFileSystem offers the following functions:
<code>path</code>.<br />
Returns <code>true</code> in case of success or <code>nil</code> plus an
error string.</dd>
+
+ <dt><a name="chdir"></a><strong><code>lfs.lock_dir(path, [seconds_stale])</code></strong></dt>
+ <dd>Creates a lockfile (called lockfile.lfs) in <code>path</code> if it does not
+ exist and returns the lock. If the lock already exists checks it
+ it's stale, using the second parameter (default for the second
+ parameter is <code>INT_MAX</code>, which in practice means the lock will never
+ be stale. To free the the lock call <code>lock:free()</code>. <br/>
+ In case of any errors it returns nil and the error message. In
+ particular, if the lock exists and is not stale it returns the
+ "File exists" message.</dd>
<dt><a name="getcwd"></a><strong><code>lfs.currentdir ()</code></strong></dt>
<dd>Returns a string with the current working directory or <code>nil</code>
plus an error string.</dd>
- <dt><a name="dir"></a><strong><code>lfs.dir (path)</code></strong></dt>
+ <dt><a name="dir"></a><strong><code>iter, dir_obj = lfs.dir (path)</code></strong></dt>
<dd>
Lua iterator over the entries of a given directory.
- Each time the iterator is called it returns a directory entry's name as a string, or
- <code>nil</code> if there are no more entries.
+ Each time the iterator is called with <code>dir_obj</code> it returns a directory entry's name as a string, or
+ <code>nil</code> if there are no more entries. You can also iterate by calling <code>dir_obj:next()</code>, and
+ explicitly close the directory before the iteration finished with <code>dir_obj:close()</code>.
Raises an error if <code>path</code> is not a directory.
</dd>
@@ -248,7 +262,7 @@ LuaFileSystem offers the following functions:
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
- <p><small>$Id: manual.html,v 1.42 2008/03/24 18:17:59 carregal Exp $</small></p>
+ <p><small>$Id: manual.html,v 1.45 2009/06/03 20:53:55 mascarenhas Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c
index eed623dfad8..6e968b6d2e8 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c
@@ -9,6 +9,7 @@
** lfs.currentdir ()
** lfs.dir (path)
** lfs.lock (fh, mode)
+** lfs.lock_dir (path)
** lfs.mkdir (path)
** lfs.rmdir (path)
** lfs.setmode (filepath, mode)
@@ -16,9 +17,17 @@
** lfs.touch (filepath [, atime [, mtime]])
** lfs.unlock (fh)
**
-** $Id: lfs.c,v 1.53 2008/05/07 19:06:37 carregal Exp $
+** $Id: lfs.c,v 1.61 2009/07/04 02:10:16 mascarenhas Exp $
*/
+#ifndef _WIN32
+#ifndef _AIX
+#define _FILE_OFFSET_BITS 64 /* Linux, Solaris and HP-UX */
+#else
+#define _LARGE_FILES 1 /* AIX */
+#endif
+#endif
+
#define _LARGEFILE64_SOURCE
#include <errno.h>
@@ -30,11 +39,15 @@
#ifdef _WIN32
#include <direct.h>
+#include <windows.h>
#include <io.h>
#include <sys/locking.h>
-#include <sys/utime.h>
+#ifdef __BORLANDC__
+ #include <utime.h>
+#else
+ #include <sys/utime.h>
+#endif
#include <fcntl.h>
-#include <windows.h>
#else
#include <unistd.h>
#include <dirent.h>
@@ -73,24 +86,26 @@ typedef struct dir_data {
#endif
} dir_data;
+#define LOCK_METATABLE "lock metatable"
#ifdef _WIN32
-#define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m))
-#define STAT_STRUCT struct _stati64
+ #ifdef __BORLANDC__
+ #define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m))
+ #define STAT_STRUCT struct stati64
+ #else
+ #define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m))
+ #define STAT_STRUCT struct _stati64
+ #endif
#define STAT_FUNC _stati64
#else
+#define _O_TEXT 0
+#define _O_BINARY 0
#define lfs_setmode(L,file,m) ((void)((void)file,m), \
luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1)
-#ifdef HAVE_STAT64
-#define STAT_STRUCT struct stat64
-#define STAT_FUNC stat64
-#define LSTAT_FUNC lstat64
-#else
#define STAT_STRUCT struct stat
#define STAT_FUNC stat
#define LSTAT_FUNC lstat
#endif
-#endif
/*
** This function changes the working (current) directory
@@ -113,9 +128,13 @@ static int change_dir (lua_State *L) {
** If unable to get the current directory, it returns nil
** and a string describing the error
*/
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
static int get_dir (lua_State *L) {
- char path[500];
- if (getcwd((char *)path, 500) == NULL) {
+ char path[PATH_MAX];
+ if (getcwd((char *)path, PATH_MAX) == NULL) {
lua_pushnil(L);
lua_pushstring(L, getcwd_error);
return 2;
@@ -171,7 +190,11 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star
len = ftell (fh);
}
fseek (fh, start, SEEK_SET);
+#ifdef __BORLANDC__
+ code = locking (fileno(fh), lkmode, len);
+#else
code = _locking (fileno(fh), lkmode, len);
+#endif
#else
struct flock f;
switch (*mode) {
@@ -189,6 +212,79 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star
}
#ifdef _WIN32
+typedef struct lfs_Lock {
+ HANDLE fd;
+} lfs_Lock;
+static int lfs_lock_dir(lua_State *L) {
+ size_t pathl; HANDLE fd;
+ lfs_Lock *lock;
+ char *ln;
+ const char *lockfile = "/lockfile.lfs";
+ const char *path = luaL_checklstring(L, 1, &pathl);
+ ln = (char*)malloc(pathl + strlen(lockfile) + 1);
+ if(!ln) {
+ lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
+ }
+ strcpy(ln, path); strcat(ln, lockfile);
+ if((fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL)) == INVALID_HANDLE_VALUE) {
+ int en = GetLastError();
+ free(ln); lua_pushnil(L);
+ if(en == ERROR_FILE_EXISTS || en == ERROR_SHARING_VIOLATION)
+ lua_pushstring(L, "File exists");
+ else
+ lua_pushstring(L, strerror(en));
+ return 2;
+ }
+ free(ln);
+ lock = (lfs_Lock*)lua_newuserdata(L, sizeof(lfs_Lock));
+ lock->fd = fd;
+ luaL_getmetatable (L, LOCK_METATABLE);
+ lua_setmetatable (L, -2);
+ return 1;
+}
+static int lfs_unlock_dir(lua_State *L) {
+ lfs_Lock *lock = luaL_checkudata(L, 1, LOCK_METATABLE);
+ CloseHandle(lock->fd);
+ return 0;
+}
+#else
+typedef struct lfs_Lock {
+ char *ln;
+} lfs_Lock;
+static int lfs_lock_dir(lua_State *L) {
+ lfs_Lock *lock;
+ size_t pathl;
+ char *ln;
+ const char *lockfile = "/lockfile.lfs";
+ const char *path = luaL_checklstring(L, 1, &pathl);
+ lock = (lfs_Lock*)lua_newuserdata(L, sizeof(lfs_Lock));
+ ln = (char*)malloc(pathl + strlen(lockfile) + 1);
+ if(!ln) {
+ lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
+ }
+ strcpy(ln, path); strcat(ln, lockfile);
+ if(symlink("lock", ln) == -1) {
+ free(ln); lua_pushnil(L);
+ lua_pushstring(L, strerror(errno)); return 2;
+ }
+ lock->ln = ln;
+ luaL_getmetatable (L, LOCK_METATABLE);
+ lua_setmetatable (L, -2);
+ return 1;
+}
+static int lfs_unlock_dir(lua_State *L) {
+ lfs_Lock *lock = luaL_checkudata(L, 1, LOCK_METATABLE);
+ if(lock->ln) {
+ unlink(lock->ln);
+ free(lock->ln);
+ lock->ln = NULL;
+ }
+ return 0;
+}
+#endif
+
+#ifdef _WIN32
static int lfs_g_setmode (lua_State *L, FILE *f, int arg) {
static const int mode[] = {_O_TEXT, _O_BINARY};
static const char *const modenames[] = {"text", "binary", NULL};
@@ -319,7 +415,7 @@ static int dir_iter (lua_State *L) {
#else
struct dirent *entry;
#endif
- dir_data *d = (dir_data *)lua_touserdata (L, lua_upvalueindex (1));
+ dir_data *d = (dir_data *)luaL_checkudata (L, 1, DIR_METATABLE);
luaL_argcheck (L, !d->closed, 1, "closed directory");
#ifdef _WIN32
if (d->hFile == 0L) { /* first entry */
@@ -381,7 +477,9 @@ static int dir_close (lua_State *L) {
*/
static int dir_iter_factory (lua_State *L) {
const char *path = luaL_checkstring (L, 1);
- dir_data *d = (dir_data *) lua_newuserdata (L, sizeof(dir_data));
+ dir_data *d;
+ lua_pushcfunction (L, dir_iter);
+ d = (dir_data *) lua_newuserdata (L, sizeof(dir_data));
d->closed = 0;
#ifdef _WIN32
d->hFile = 0L;
@@ -398,8 +496,7 @@ static int dir_iter_factory (lua_State *L) {
if (d->dir == NULL)
luaL_error (L, "cannot open %s: %s", path, strerror (errno));
#endif
- lua_pushcclosure (L, dir_iter, 1);
- return 1;
+ return 2;
}
@@ -409,10 +506,33 @@ static int dir_iter_factory (lua_State *L) {
static int dir_create_meta (lua_State *L) {
luaL_newmetatable (L, DIR_METATABLE);
/* set its __gc field */
+ lua_pushstring (L, "__index");
+ lua_newtable(L);
+ lua_pushstring (L, "next");
+ lua_pushcfunction (L, dir_iter);
+ lua_settable(L, -3);
+ lua_pushstring (L, "close");
+ lua_pushcfunction (L, dir_close);
+ lua_settable(L, -3);
+ lua_settable (L, -3);
lua_pushstring (L, "__gc");
lua_pushcfunction (L, dir_close);
lua_settable (L, -3);
+ return 1;
+}
+/*
+** Creates lock metatable.
+*/
+static int lock_create_meta (lua_State *L) {
+ luaL_newmetatable (L, LOCK_METATABLE);
+ /* set its __gc field */
+ lua_newtable(L);
+ lua_pushcfunction(L, lfs_unlock_dir);
+ lua_setfield(L, -2, "free");
+ lua_setfield(L, -2, "__index");
+ lua_pushcfunction(L, lfs_unlock_dir);
+ lua_setfield(L, -2, "__gc");
return 1;
}
@@ -466,36 +586,6 @@ static const char *mode2string (mode_t mode) {
return "other";
}
- /*
-** Convert the inode protection mode to a permission list.
-*/
-
-#ifdef _WIN32
-static const char *perm2string (unsigned short mode) {
- static char perms[10] = "---------\0";
- if (mode & _S_IREAD)
- { perms[0] = 'r'; perms[3] = 'r'; perms[6] = 'r'; }
- if (mode & _S_IWRITE)
- { perms[1] = 'w'; perms[4] = 'w'; perms[7] = 'w'; }
- if (mode & _S_IEXEC)
- { perms[2] = 'x'; perms[5] = 'x'; perms[8] = 'x'; }
- return perms;
-}
-#else
-static const char *perm2string (mode_t mode) {
- static char perms[10] = "---------\0";
- if (mode & S_IRUSR) perms[0] = 'r';
- if (mode & S_IWUSR) perms[1] = 'w';
- if (mode & S_IXUSR) perms[2] = 'x';
- if (mode & S_IRGRP) perms[3] = 'r';
- if (mode & S_IWGRP) perms[4] = 'w';
- if (mode & S_IXGRP) perms[5] = 'x';
- if (mode & S_IROTH) perms[6] = 'r';
- if (mode & S_IWOTH) perms[7] = 'w';
- if (mode & S_IXOTH) perms[8] = 'x';
- return perms;
-}
-#endif
/*
** Set access time and modification values for file
@@ -565,10 +655,6 @@ static void push_st_ctime (lua_State *L, STAT_STRUCT *info) {
static void push_st_size (lua_State *L, STAT_STRUCT *info) {
lua_pushnumber (L, (lua_Number)info->st_size);
}
-/* permssions string */
-static void push_st_perm (lua_State *L, STAT_STRUCT *info) {
- lua_pushstring (L, perm2string (info->st_mode));
-}
#ifndef _WIN32
/* blocks allocated for file */
static void push_st_blocks (lua_State *L, STAT_STRUCT *info) {
@@ -586,6 +672,46 @@ static void push_invalid (lua_State *L, STAT_STRUCT *info) {
#endif
}
+ /*
+** Convert the inode protection mode to a permission list.
+*/
+
+#ifdef _WIN32
+static const char *perm2string (unsigned short mode) {
+ static char perms[10] = "---------\0";
+ int i;
+ for (i=0;i<9;i++) perms[i]='-';
+ if (mode & _S_IREAD)
+ { perms[0] = 'r'; perms[3] = 'r'; perms[6] = 'r'; }
+ if (mode & _S_IWRITE)
+ { perms[1] = 'w'; perms[4] = 'w'; perms[7] = 'w'; }
+ if (mode & _S_IEXEC)
+ { perms[2] = 'x'; perms[5] = 'x'; perms[8] = 'x'; }
+ return perms;
+}
+#else
+static const char *perm2string (mode_t mode) {
+ static char perms[10] = "---------\0";
+ int i;
+ for (i=0;i<9;i++) perms[i]='-';
+ if (mode & S_IRUSR) perms[0] = 'r';
+ if (mode & S_IWUSR) perms[1] = 'w';
+ if (mode & S_IXUSR) perms[2] = 'x';
+ if (mode & S_IRGRP) perms[3] = 'r';
+ if (mode & S_IWGRP) perms[4] = 'w';
+ if (mode & S_IXGRP) perms[5] = 'x';
+ if (mode & S_IROTH) perms[6] = 'r';
+ if (mode & S_IWOTH) perms[7] = 'w';
+ if (mode & S_IXOTH) perms[8] = 'x';
+ return perms;
+}
+#endif
+
+/* permssions string */
+static void push_st_perm (lua_State *L, STAT_STRUCT *info) {
+ lua_pushstring (L, perm2string (info->st_mode));
+}
+
typedef void (*_push_function) (lua_State *L, STAT_STRUCT *info);
struct _stat_members {
@@ -595,7 +721,6 @@ struct _stat_members {
struct _stat_members members[] = {
{ "mode", push_st_mode },
- { "permissions", push_st_perm },
{ "dev", push_st_dev },
{ "ino", push_st_ino },
{ "nlink", push_st_nlink },
@@ -606,6 +731,7 @@ struct _stat_members members[] = {
{ "modification", push_st_mtime },
{ "change", push_st_ctime },
{ "size", push_st_size },
+ { "permissions", push_st_perm },
#ifndef _WIN32
{ "blocks", push_st_blocks },
{ "blksize", push_st_blksize },
@@ -653,28 +779,6 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
return 1;
}
-#ifndef WIN32
-static int pusherror(lua_State *L, const char *info)
-{
- lua_pushnil(L);
- if (info==NULL)
- lua_pushstring(L, strerror(errno));
- else
- lua_pushfstring(L, "%s: %s", info, strerror(errno));
- lua_pushinteger(L, errno);
- return 3;
-}
-
-static int Preadlink(lua_State *L) /** readlink(path) */
-{
- char b[PATH_MAX];
- const char *path = luaL_checkstring(L, 1);
- int n = readlink(path, b, sizeof(b));
- if (n==-1) return pusherror(L, path);
- lua_pushlstring(L, b, n);
- return 1;
-}
-#endif
/*
** Get file information using stat.
@@ -683,6 +787,7 @@ static int file_info (lua_State *L) {
return _file_info_ (L, STAT_FUNC);
}
+
/*
** Get symbolic link information using lstat.
*/
@@ -690,106 +795,33 @@ static int file_info (lua_State *L) {
static int link_info (lua_State *L) {
return _file_info_ (L, LSTAT_FUNC);
}
-static int read_link (lua_State *L) {
- return Preadlink (L);
-}
-static int get_short_name (lua_State *L) {
- /* simply do nothing */
- return 1;
-}
#else
static int link_info (lua_State *L) {
lua_pushboolean(L, 0);
lua_pushliteral(L, "symlinkattributes not supported on this platform");
return 2;
}
-static int read_link (lua_State *L) {
- lua_pushboolean(L, 0);
- lua_pushliteral(L, "readlink not supported on this platform");
- return 2;
-}
-static int get_short_name (lua_State *L) {
- long length = 0;
- TCHAR* buffer = NULL;
- const char *lpszPath = luaL_checkstring (L, 1);
- length = GetShortPathName(lpszPath, NULL, 0);
- if (length == 0) {
- lua_pushnil(L);
- lua_pushfstring(L, "operating system error: %d", (int)GetLastError());
- return 2;
- }
- buffer = (TCHAR *)xmalloc(length * sizeof(TCHAR));
- length = GetShortPathName(lpszPath, buffer, length);
- if (length == 0) {
- lua_pushnil(L);
- lua_pushfstring(L, "operating system error: %d", (int)GetLastError());
- return 2;
- }
- lua_pushlstring(L, (const char *)buffer, (size_t)length);
- return 1;
-}
#endif
-
-/*
-** Get file information
-*/
-static int file_is_directory (lua_State *L) {
- struct stat info;
- const char *file = luaL_checkstring (L, 1);
-
- if (stat(file, &info)) {
- lua_pushnil (L);
- lua_pushfstring (L, "cannot obtain information from file `%s'", file);
- return 2;
- }
- if ( S_ISDIR(info.st_mode) )
- lua_pushboolean (L, 1);
- else
- lua_pushboolean (L, 0);
-
- return 1;
-}
-
-static int file_is_file (lua_State *L) {
- struct stat info;
- const char *file = luaL_checkstring (L, 1);
-
- if (stat(file, &info)) {
- lua_pushnil (L);
- lua_pushfstring (L, "cannot obtain information from file `%s'", file);
- return 2;
- }
- if ( S_ISREG(info.st_mode) )
- lua_pushboolean (L, 1);
- else
- lua_pushboolean (L, 0);
-
- return 1;
-}
-
-
/*
** Assumes the table is on top of the stack.
*/
static void set_info (lua_State *L) {
lua_pushliteral (L, "_COPYRIGHT");
- lua_pushliteral (L, "Copyright (C) 2003 Kepler Project");
+ lua_pushliteral (L, "Copyright (C) 2003-2009 Kepler Project");
lua_settable (L, -3);
lua_pushliteral (L, "_DESCRIPTION");
lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution");
lua_settable (L, -3);
lua_pushliteral (L, "_VERSION");
- lua_pushliteral (L, "LuaFileSystem 1.4.1");
+ lua_pushliteral (L, "LuaFileSystem 1.5.0");
lua_settable (L, -3);
}
static const struct luaL_reg fslib[] = {
{"attributes", file_info},
- {"isdir", file_is_directory },
- {"isfile", file_is_file },
{"chdir", change_dir},
{"currentdir", get_dir},
{"dir", dir_iter_factory},
@@ -797,16 +829,16 @@ static const struct luaL_reg fslib[] = {
{"mkdir", make_dir},
{"rmdir", remove_dir},
{"symlinkattributes", link_info},
- {"readlink", read_link},
- {"shortname", get_short_name},
{"setmode", lfs_f_setmode},
{"touch", file_utime},
{"unlock", file_unlock},
+ {"lock_dir", lfs_lock_dir},
{NULL, NULL},
};
int luaopen_lfs (lua_State *L) {
dir_create_meta (L);
+ lock_create_meta (L);
luaL_register (L, "lfs", fslib);
set_info (L);
return 1;
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.def b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.def
index 978ee6e60f9..f79cd298b31 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.def
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.def
@@ -1,5 +1,5 @@
LIBRARY lfs.dll
DESCRIPTION "LuaFileSystem"
-VERSION 1.4.1
+VERSION 1.4.2
EXPORTS
luaopen_lfs
diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/tests/test.lua b/Build/source/texk/web2c/luatexdir/luafilesystem/tests/test.lua
index 1fd6157a7b9..71110749c06 100644
--- a/Build/source/texk/web2c/luatexdir/luafilesystem/tests/test.lua
+++ b/Build/source/texk/web2c/luatexdir/luafilesystem/tests/test.lua
@@ -110,4 +110,21 @@ for i = 1, 4000 do
count = count + 1
end
end
+
+-- Stressing directory iterator, explicit version
+count = 0
+for i = 1, 4000 do
+ local iter, dir = lfs.dir(tmp)
+ local file = dir:next()
+ while file do
+ count = count + 1
+ file = dir:next()
+ end
+ assert(not pcall(dir.next, dir))
+end
+
+-- directory explicit close
+local iter, dir = lfs.dir(tmp)
+dir:close()
+assert(not pcall(dir.next, dir))
print"Ok!"
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c
index 3eb886c352f..c2298dcf43f 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/nouiutil.c
@@ -46,7 +46,7 @@ static void NOUI__LogError(const char *format,va_list ap) {
fprintf(stderr,"%s",str);
if ( str[strlen(str)-1]!='\n' )
putc('\n',stderr);
- free(str);
+/* free(str);*/
}
static void NOUI_LogError(const char *format,...) {
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
index dc51b328e3d..7b82ce775fc 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
@@ -5005,7 +5005,7 @@ return;
} else {
if ( dounicode )
info->chars[startglyph+i-start]->unicodeenc = i;
- if ( map!=NULL && i < map->enccount )
+ if ( map!=NULL && i < map->enccount && i>=0)
map->map[i] = startglyph+i-start;
}
}
@@ -5263,7 +5263,7 @@ static void readttfpostnames(FILE *ttf,struct ttfinfo *info) {
free(info->chars[i]->name); /* If it's a null string get rid of it */
if ( i==0 )
name = ".notdef";
- else if ( info->chars[i]->unicodeenc==-1 ) {
+ else if ( info->chars[i]->unicodeenc<0 ) {
/* Do this later */;
name = NULL;
} else {
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
index 1c01d821d8c..ce91a44571e 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
@@ -4954,13 +4954,14 @@ static void ttf_math_read_icta(FILE *ttf,struct ttfinfo *info, uint32 start, int
if ( glyphs==NULL )
return;
fseek(ttf,start+4,SEEK_SET);
- for ( i=0; i<cnt; ++i ) if ( glyphs[i]<info->glyph_cnt && info->chars[ glyphs[i]]!=NULL ) {
- val = (int16) getushort(ttf);
+ for ( i=0; i<cnt; ++i ) {
+ val = (int16) getushort(ttf);
+ offset = getushort(ttf);
+ if ( glyphs[i]<info->glyph_cnt && info->chars[ glyphs[i]]!=NULL ) {
if ( is_ic )
info->chars[ glyphs[i] ]->italic_correction = val;
else
info->chars[ glyphs[i] ]->top_accent_horiz = val;
- offset = getushort(ttf);
#ifdef FONTFORGE_CONFIG_DEVICETABLES
if ( offset!=0 ) {
DeviceTable *dv = chunkalloc(sizeof(DeviceTable));
@@ -4971,6 +4972,7 @@ return;
info->chars[ glyphs[i] ]->top_accent_adjusts = dv;
}
#endif
+ }
}
free(glyphs);
}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c
index ffce23e0958..1a1e499bf1b 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c
@@ -28,14 +28,14 @@
#include <ustring.h>
static const char _svn_version[] =
- "$Id: ffdummies.c 3706 2010-05-28 07:21:15Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c $";
+ "$Id: ffdummies.c 3738 2010-07-13 10:28:24Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luafontloader/src/ffdummies.c $";
/* fix for non-gcc compilation: */
#if !defined(__GNUC__) || (__GNUC__ < 2)
-# define __attribute__(x)
-#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
+# define __attribute__(x)
+#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
char **gww_errors = NULL;
int gww_error_count = 0;
@@ -62,7 +62,7 @@ static void LUAUI_IError(const char *format, ...)
l = strlen("Internal Error: ");
snprintf(buffer, sizeof(buffer), "Internal Error: ");
va_start(ap, format);
- vsnprintf(buffer+l, sizeof(buffer)-l, format, ap);
+ vsnprintf(buffer + l, sizeof(buffer) - l, format, ap);
va_end(ap);
str = xstrdup((char *) buffer);
gww_errors = realloc(gww_errors, (gww_error_count + 2) * sizeof(char *));
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
index 726fb0d5659..a3b9d1748c7 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
@@ -1,6 +1,6 @@
/* luafflib.c
- Copyright 2007-2009 Taco Hoekwater <taco@luatex.org>
+ Copyright 2007-2010 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -30,10 +30,11 @@
#include "pfaedit.h"
#include "ustring.h"
+#include "lib/lib.h" /* web2c's lib, for recorder_record_input */
static const char _svn_version[] =
- "$Id: luafflib.c 3736 2010-07-12 15:42:56Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c $";
+ "$Id: luafflib.c 4094 2011-03-28 12:24:59Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c $";
extern char **gww_errors;
extern int gww_error_count;
@@ -43,6 +44,9 @@ extern struct ui_interface luaui_interface;
extern int readbinfile(FILE * f, unsigned char **b, int *s);
#define FONT_METATABLE "fontloader.splinefont"
+#define FONT_SUBFONT_METATABLE "fontloader.splinefont.subfont"
+#define FONT_GLYPHS_METATABLE "fontloader.splinefont.glyphs"
+#define FONT_GLYPH_METATABLE "fontloader.splinefont.glyph"
#define LUA_OTF_VERSION "0.3"
@@ -140,6 +144,7 @@ static char *uni_interp_enum[9] = {
};
#define check_isfont(L,b) (SplineFont **)luaL_checkudata(L,b,FONT_METATABLE)
+#define check_isglyph(L,b) (struct splinechar **)luaL_checkudata(L,b,FONT_GLYPH_METATABLE)
void handle_generic_pst(lua_State * L, struct generic_pst *pst); /* forward */
void handle_generic_fpst(lua_State * L, struct generic_fpst *fpst); /* forward */
@@ -147,6 +152,28 @@ void handle_generic_asm(lua_State * L, struct generic_asm *sm);
void handle_kernclass(lua_State * L, struct kernclass *kerns);
void handle_anchorclass(lua_State * L, struct anchorclass *anchor);
void handle_splinefont(lua_State * L, struct splinefont *sf);
+void handle_kernpair(lua_State * L, struct kernpair *kp);
+void handle_splinecharlist(lua_State * L, struct splinecharlist *scl);
+void handle_liglist(lua_State * L, struct liglist *ligofme);
+void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor);
+void handle_glyphvariants(lua_State * L, struct glyphvariants *vars);
+void handle_mathkern(lua_State * L, struct mathkern *mk);
+int handle_altuni(lua_State * L, struct altuni *au);
+
+int is_userdata(lua_State *L, int b, char *utype)
+{
+ if (lua_type(L,b) == LUA_TUSERDATA) {
+ lua_getmetatable(L, b);
+ luaL_getmetatable(L, utype);
+ if (lua_equal(L, -2, -1)) {
+ lua_pop(L,2);
+ return 1;
+ }
+ lua_pop(L,2);
+ }
+ return 0;
+}
+
void lua_ff_pushfont(lua_State * L, SplineFont * sf)
@@ -163,6 +190,34 @@ void lua_ff_pushfont(lua_State * L, SplineFont * sf)
return;
}
+void lua_ff_pushsubfont(lua_State * L, SplineFont * sf)
+{
+ SplineFont **a;
+ if (sf == NULL) {
+ lua_pushnil(L);
+ } else {
+ a = lua_newuserdata(L, sizeof(SplineFont *));
+ *a = sf;
+ luaL_getmetatable(L, FONT_SUBFONT_METATABLE);
+ lua_setmetatable(L, -2);
+ }
+ return;
+}
+
+void lua_ff_pushglyph(lua_State * L, struct splinechar *sc)
+{
+ struct splinechar **a;
+ if (sc == NULL) {
+ lua_pushnil(L);
+ } else {
+ a = lua_newuserdata(L, sizeof(struct splinechar *));
+ *a = sc;
+ luaL_getmetatable(L, FONT_GLYPH_METATABLE);
+ lua_setmetatable(L, -2);
+ }
+ return;
+}
+
static int ff_open(lua_State * L)
{
@@ -172,10 +227,11 @@ static int ff_open(lua_State * L)
char s[511];
size_t len;
int args, i;
- int openflags = 1;
+ int openflags = 1 + 4;
fontname = luaL_checkstring(L, 1);
/* test fontname for existance */
if ((l = fopen(fontname, "r"))) {
+ recorder_record_input(fontname);
fclose(l);
} else {
lua_pushnil(L);
@@ -237,7 +293,7 @@ static int ff_close(lua_State * L)
/*fputs("ff_close called",stderr); */
sf = check_isfont(L, 1);
if (*sf != NULL) {
- if ((*sf)->fv) { // condition might be improved
+ if ((*sf)->fv) { // condition might be improved
FontViewClose((*sf)->fv);
} else {
EncMapFree((*sf)->map);
@@ -248,6 +304,22 @@ static int ff_close(lua_State * L)
return 0;
}
+static int notdef_loc(SplineFont * sf)
+{
+ int k;
+ int l = -1;
+ for (k = 0; k < sf->glyphcnt; k++) {
+ if (sf->glyphs[k]) {
+ if (strcmp(sf->glyphs[k]->name, ".notdef") == 0) {
+ l = k;
+ }
+ }
+ }
+ if (l == -1)
+ l = sf->glyphcnt;
+ return l;
+}
+
static int ff_apply_featurefile(lua_State * L)
{
SplineFont **sf;
@@ -255,7 +327,18 @@ static int ff_apply_featurefile(lua_State * L)
sf = check_isfont(L, 1);
fname = (char *) luaL_checkstring(L, 2);
SFApplyFeatureFilename(*sf, fname);
- return 0;
+ if (gww_error_count > 0) {
+ int i;
+ lua_newtable(L);
+ for (i = 0; i < gww_error_count; i++) {
+ lua_pushstring(L, gww_errors[i]);
+ lua_rawseti(L, -2, (i + 1));
+ }
+ gwwv_errors_free();
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
}
static int ff_apply_afmfile(lua_State * L)
@@ -265,8 +348,18 @@ static int ff_apply_afmfile(lua_State * L)
sf = check_isfont(L, 1);
fname = (char *) luaL_checkstring(L, 2);
CheckAfmOfPostscript(*sf, fname, (*sf)->map);
-
- return 0;
+ if (gww_error_count > 0) {
+ int i;
+ lua_newtable(L);
+ for (i = 0; i < gww_error_count; i++) {
+ lua_pushstring(L, gww_errors[i]);
+ lua_rawseti(L, -2, (i + 1));
+ }
+ gwwv_errors_free();
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
}
@@ -279,6 +372,14 @@ static void dump_intfield(lua_State * L, char *name, long int field)
lua_rawset(L, -3);
}
+static void dump_uintfield(lua_State * L, char *name, unsigned int field)
+{
+ lua_checkstack(L, 2);
+ lua_pushstring(L, name);
+ lua_pushnumber(L, field);
+ lua_rawset(L, -3);
+}
+
static void dump_realfield(lua_State * L, char *name, real field)
{
lua_checkstack(L, 2);
@@ -629,20 +730,25 @@ void handle_splinecharlist(lua_State * L, struct splinecharlist *scl)
/* variant shape. The specifics depend on the selector and script */
/* fid is currently unused, but may, someday, be used to do ttcs */
/* NOTE: GlyphInfo displays vs==-1 as vs==0, and fixes things up */
-void handle_altuni(lua_State * L, struct altuni *au)
+int handle_altuni(lua_State * L, struct altuni *au)
{
struct altuni *next = au;
+ int i = 0;
int k = 1;
lua_checkstack(L, 3);
while (next != NULL) {
- lua_newtable(L);
- dump_intfield(L, "unicode", next->unienc);
- if (next->vs != -1)
- dump_intfield(L, "variant", next->vs);
- /* dump_intfield(L, "fid", next->fid); */
- lua_rawseti(L, -2, k++);
+ if (next->unienc<0x10FFF) {
+ lua_newtable(L);
+ dump_intfield(L, "unicode", next->unienc);
+ i++;
+ if (next->vs != -1)
+ dump_intfield(L, "variant", next->vs);
+ /* dump_intfield(L, "fid", next->fid); */
+ lua_rawseti(L, -2, k++);
+ }
next = next->next;
}
+ return i;
}
@@ -770,6 +876,7 @@ void do_handle_liglist(lua_State * L, struct liglist *ligofme)
dump_intfield(L, "ccnt", ligofme->ccnt);
}
+
void handle_liglist(lua_State * L, struct liglist *ligofme)
{
struct liglist *next;
@@ -835,6 +942,7 @@ void do_handle_anchorpoint(lua_State * L, struct anchorpoint *anchor)
lua_pop(L, 1);
}
+
void handle_anchorpoint(lua_State * L, struct anchorpoint *anchor)
{
struct anchorpoint *next;
@@ -1015,9 +1123,14 @@ void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics)
}
if (glyph->altuni != NULL) {
+ int i;
lua_newtable(L);
- handle_altuni(L, glyph->altuni);
- lua_setfield(L, -2, "altuni");
+ i = handle_altuni(L, glyph->altuni);
+ if (i>0) {
+ lua_setfield(L, -2, "altuni");
+ } else {
+ lua_pop(L,1);
+ }
}
if (glyph->tex_height != TEX_UNDEF)
@@ -1148,16 +1261,31 @@ void handle_pfminfo(lua_State * L, struct pfminfo pfm)
dump_intfield(L, "firstchar", pfm.firstchar);
dump_intfield(L, "lastchar", pfm.lastchar);
lua_createtable(L, 0, 10);
- dump_enumfield(L, "familytype", fix_range(panose_values_0_max, pfm.panose[0]), panose_values_0);
- dump_enumfield(L, "serifstyle", fix_range(panose_values_1_max, pfm.panose[1]), panose_values_1);
- dump_enumfield(L, "weight", fix_range(panose_values_2_max, pfm.panose[2]), panose_values_2);
- dump_enumfield(L, "proportion", fix_range(panose_values_3_max, pfm.panose[3]), panose_values_3);
- dump_enumfield(L, "contrast", fix_range(panose_values_4_max, pfm.panose[4]), panose_values_4);
- dump_enumfield(L, "strokevariation", fix_range(panose_values_5_max, pfm.panose[5]), panose_values_5);
- dump_enumfield(L, "armstyle", fix_range(panose_values_6_max, pfm.panose[6]), panose_values_6);
- dump_enumfield(L, "letterform", fix_range(panose_values_7_max, pfm.panose[7]), panose_values_7);
- dump_enumfield(L, "midline", fix_range(panose_values_8_max, pfm.panose[8]), panose_values_8);
- dump_enumfield(L, "xheight", fix_range(panose_values_9_max, pfm.panose[9]), panose_values_9);
+ dump_enumfield(L, "familytype",
+ fix_range(panose_values_0_max, pfm.panose[0]),
+ panose_values_0);
+ dump_enumfield(L, "serifstyle",
+ fix_range(panose_values_1_max, pfm.panose[1]),
+ panose_values_1);
+ dump_enumfield(L, "weight", fix_range(panose_values_2_max, pfm.panose[2]),
+ panose_values_2);
+ dump_enumfield(L, "proportion",
+ fix_range(panose_values_3_max, pfm.panose[3]),
+ panose_values_3);
+ dump_enumfield(L, "contrast", fix_range(panose_values_4_max, pfm.panose[4]),
+ panose_values_4);
+ dump_enumfield(L, "strokevariation",
+ fix_range(panose_values_5_max, pfm.panose[5]),
+ panose_values_5);
+ dump_enumfield(L, "armstyle", fix_range(panose_values_6_max, pfm.panose[6]),
+ panose_values_6);
+ dump_enumfield(L, "letterform",
+ fix_range(panose_values_7_max, pfm.panose[7]),
+ panose_values_7);
+ dump_enumfield(L, "midline", fix_range(panose_values_8_max, pfm.panose[8]),
+ panose_values_8);
+ dump_enumfield(L, "xheight", fix_range(panose_values_9_max, pfm.panose[9]),
+ panose_values_9);
lua_setfield(L, -2, "panose");
dump_intfield(L, "fstype", pfm.fstype);
@@ -1210,10 +1338,10 @@ void handle_pfminfo(lua_State * L, struct pfminfo pfm)
}
-void do_handle_enc(lua_State * L, struct enc *enc)
+char *do_handle_enc(lua_State * L, struct enc *enc)
{
int i;
-
+ char *ret = enc->enc_name;
dump_stringfield(L, "enc_name", enc->enc_name);
dump_intfield(L, "char_cnt", enc->char_cnt);
@@ -1262,6 +1390,7 @@ void do_handle_enc(lua_State * L, struct enc *enc)
dump_stringfield(L, "iconv_name", enc->iconv_name);
dump_intfield(L, "char_max", enc->char_max);
+ return ret;
}
void handle_enc(lua_State * L, struct enc *enc)
@@ -1320,9 +1449,12 @@ void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc)
}
if (map->enc != NULL) {
+ char *encname;
lua_newtable(L);
- handle_enc(L, map->enc);
+ encname = do_handle_enc(L, map->enc);
lua_setfield(L, -2, "enc");
+ lua_pushstring(L, encname);
+ lua_setfield(L, -2, "enc_name");
}
}
@@ -2062,7 +2194,9 @@ void handle_splinefont(lua_State * L, struct splinefont *sf)
dump_floatfield(L, "uwidth", sf->uwidth);
dump_intfield(L, "ascent", sf->ascent);
dump_intfield(L, "descent", sf->descent);
- dump_intfield(L, "uniqueid", sf->uniqueid);
+ if (sf->uniqueid!=0) {
+ dump_intfield(L, "uniqueid", sf->uniqueid);
+ }
dump_intfield(L, "glyphcnt", sf->glyphcnt);
dump_intfield(L, "glyphmax", sf->glyphmax);
dump_intfield(L, "units_per_em", sf->units_per_em);
@@ -2267,7 +2401,9 @@ void handle_splinefont(lua_State * L, struct splinefont *sf)
}
dump_stringfield(L, "chosenname", sf->chosenname);
- dump_intfield(L, "macstyle", sf->macstyle);
+ if (sf->macstyle!=-1) {
+ dump_intfield(L, "macstyle", sf->macstyle);
+ }
dump_stringfield(L, "fondname", sf->fondname);
dump_intfield(L, "design_size", sf->design_size);
@@ -2295,8 +2431,8 @@ void handle_splinefont(lua_State * L, struct splinefont *sf)
lua_setfield(L, -2, "mark_classes");
}
- dump_intfield(L, "creationtime", sf->creationtime);
- dump_intfield(L, "modificationtime", sf->modificationtime);
+ dump_uintfield(L, "creationtime", sf->creationtime);
+ dump_uintfield(L, "modificationtime", sf->modificationtime);
dump_intfield(L, "os2_version", sf->os2_version);
dump_intfield(L, "sfd_version", sf->sfd_version);
@@ -2393,6 +2529,902 @@ void do_ff_info(lua_State * L, SplineFont * sf)
}
+typedef enum {
+ FK_table_version = 0,
+ FK_fontname,
+ FK_fullname,
+ FK_familyname,
+ FK_weight,
+ FK_copyright,
+ FK_filename,
+ FK_version,
+ FK_italicangle,
+ FK_upos,
+ FK_uwidth,
+ FK_ascent,
+ FK_descent,
+ FK_uniqueid,
+ FK_glyphcnt,
+ FK_glyphmax,
+ FK_units_per_em,
+ FK_lookups,
+ FK_glyphs,
+ FK_hasvmetrics,
+ FK_onlybitmaps,
+ FK_serifcheck,
+ FK_isserif,
+ FK_issans,
+ FK_encodingchanged,
+ FK_strokedfont,
+ FK_use_typo_metrics,
+ FK_weight_width_slope_only,
+ FK_head_optimized_for_cleartype,
+ FK_uni_interp,
+ FK_map,
+ FK_origname,
+ FK_private,
+ FK_xuid,
+ FK_pfminfo,
+ FK_names,
+ FK_cidinfo,
+ FK_subfonts,
+ FK_comments,
+ FK_fontlog,
+ FK_cvt_names,
+ FK_ttf_tables,
+ FK_ttf_tab_saved,
+ FK_texdata,
+ FK_anchor_classes,
+ FK_kerns,
+ FK_vkerns,
+ FK_gsub,
+ FK_gpos,
+ FK_sm,
+ FK_features,
+ FK_mm,
+ FK_chosenname,
+ FK_macstyle,
+ FK_fondname,
+ FK_design_size,
+ FK_fontstyle_id,
+ FK_fontstyle_name,
+ FK_design_range_bottom,
+ FK_design_range_top,
+ FK_strokewidth,
+ FK_mark_classes,
+ FK_creationtime,
+ FK_modificationtime,
+ FK_os2_version,
+ FK_sfd_version,
+ FK_math,
+ FK_validation_state,
+ FK_horiz_base,
+ FK_vert_base,
+ FK_extrema_bound,
+} font_key_values;
+
+const char *font_keys[] = {
+ "table_version",
+ "fontname",
+ "fullname",
+ "familyname",
+ "weight",
+ "copyright",
+ "filename",
+ "version",
+ "italicangle",
+ "upos",
+ "uwidth",
+ "ascent",
+ "descent",
+ "uniqueid",
+ "glyphcnt",
+ "glyphmax",
+ "units_per_em",
+ "lookups",
+ "glyphs",
+ "hasvmetrics",
+ "onlybitmaps",
+ "serifcheck",
+ "isserif",
+ "issans",
+ "encodingchanged",
+ "strokedfont",
+ "use_typo_metrics",
+ "weight_width_slope_only",
+ "head_optimized_for_cleartype",
+ "uni_interp",
+ "map",
+ "origname",
+ "private",
+ "xuid",
+ "pfminfo",
+ "names",
+ "cidinfo",
+ "subfonts",
+ "comments",
+ "fontlog",
+ "cvt_names",
+ "ttf_tables",
+ "ttf_tab_saved",
+ "texdata",
+ "anchor_classes",
+ "kerns",
+ "vkerns",
+ "gsub",
+ "gpos",
+ "sm",
+ "features",
+ "mm",
+ "chosenname",
+ "macstyle",
+ "fondname",
+ "design_size",
+ "fontstyle_id",
+ "fontstyle_name",
+ "design_range_bottom",
+ "design_range_top",
+ "strokewidth",
+ "mark_classes",
+ "creationtime",
+ "modificationtime",
+ "os2_version",
+ "sfd_version",
+ "math",
+ "validation_state",
+ "horiz_base",
+ "vert_base",
+ "extrema_bound",
+ NULL
+};
+
+
+typedef enum {
+ GK_name = 0,
+ GK_unicode,
+ GK_boundingbox,
+ GK_vwidth,
+ GK_width,
+ GK_lsidebearing,
+ GK_class,
+ GK_kerns,
+ GK_vkerns,
+ GK_dependents,
+ GK_lookups,
+ GK_ligatures,
+ GK_comment,
+ GK_anchors,
+ GK_altuni,
+ GK_tex_height,
+ GK_tex_depth,
+ GK_is_extended_shape,
+ GK_italic_correction,
+ GK_top_accent,
+ GK_vert_variants,
+ GK_horiz_variants,
+ GK_mathkern,
+} font_glyph_key_values;
+
+const char *font_glyph_keys[] = {
+ "name",
+ "unicode",
+ "boundingbox",
+ "vwidth",
+ "width",
+ "lsidebearing",
+ "class",
+ "kerns",
+ "vkerns",
+ "dependents",
+ "lookups",
+ "ligatures",
+ "comment",
+ "anchors",
+ "altuni",
+ "tex_height",
+ "tex_depth",
+ "is_extended_shape",
+ "italic_correction",
+ "top_accent",
+ "vert_variants",
+ "horiz_variants",
+ "mathkern",
+ NULL
+};
+
+
+static int ff_fields(lua_State * L)
+{
+ int i;
+ const char **fields = NULL;
+ if (is_userdata(L, 1, FONT_METATABLE) ||
+ is_userdata(L, 1, FONT_SUBFONT_METATABLE)) {
+ fields = font_keys;
+ } else if (is_userdata(L, 1, FONT_GLYPH_METATABLE)) {
+ fields = font_glyph_keys;
+ }
+ if (fields != NULL) {
+ lua_newtable(L);
+ for (i = 0; fields[i] != NULL; i++) {
+ lua_pushstring(L, fields[i]);
+ lua_rawseti(L, -2, (i + 1));
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+
+
+static int ff_glyphs_index(lua_State * L)
+{
+
+ SplineFont *sf;
+ int gid = 0;
+ int l = -1;
+ int fix_notdef = 0;
+ lua_pushstring(L, "__sf");
+ lua_rawget(L, 1);
+ /* sf = *check_isfont(L, -1); */
+ if (!(is_userdata(L, -1, FONT_METATABLE) ||
+ is_userdata(L, -1, FONT_SUBFONT_METATABLE))) {
+ return luaL_error(L,
+ "fontloader.__index: expected a (sub)font userdata object\n");
+ }
+ sf = *((SplineFont **)lua_touserdata(L, -1));
+
+ lua_pop(L, 1);
+ gid = luaL_checkinteger(L, 2);
+ if (gid < 0 || gid >= sf->glyphmax) {
+ return luaL_error(L, "fontloader.glyphs.__index: index is invalid\n");
+ }
+ /* This after-the-fact type discovery is not brilliant,
+ I should really add a 'format' key in the structure */
+ if ((sf->origname != NULL) &&
+ (strmatch(sf->origname + strlen(sf->origname) - 4, ".pfa") == 0 ||
+ strmatch(sf->origname + strlen(sf->origname) - 4, ".pfb") == 0)) {
+ fix_notdef = 1;
+ }
+ /* some code to ensure that the .notdef ends up in slot 0
+ (this will actually be enforced by the CFF writer) */
+ if (fix_notdef) {
+ l = notdef_loc(sf);
+ /* now l is the .notdef location, adjust gid if needed */
+ if (l == sf->glyphcnt) { /* no .notdef at all, will be created at zero */
+ if (gid == 0) {
+ gid = l; /* .notdef was added at end */
+ } else {
+ gid--; /* f.glyphs[gid] == sf->glyphs[gid-1] */
+ }
+ } else if (l != 0) {
+ if (gid == 0) {
+ gid = l;
+ } else if (gid < l) {
+ gid--;
+ }
+ }
+ }
+ /* push the glyph */
+ if (sf->glyphs[gid] && sf->glyphs[gid] != (struct splinechar *)-1) {
+ lua_ff_pushglyph(L, sf->glyphs[gid]);
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+static int ff_glyph_index(lua_State * L)
+{
+ struct splinechar *glyph;
+ int key;
+ glyph = *check_isglyph(L, 1);
+ if (glyph == NULL) {
+ return luaL_error(L,
+ "fontloader.glyph.__index: glyph is nonexistent\n");
+ }
+ if (!lua_isstring(L, 2)) { /* 1 == 'font' */
+ return luaL_error(L,
+ "fontloader.glyph.__index: can only be indexed by string\n");
+ }
+ key = luaL_checkoption(L, 2, NULL, font_glyph_keys);
+ switch (key) {
+ case GK_name:
+ lua_pushstring(L, glyph->name);
+ break;
+ case GK_unicode:
+ lua_pushnumber(L, glyph->unicodeenc);
+ break;
+ case GK_boundingbox:
+ if (glyph->xmax == 0 && glyph->ymax == 0 && glyph->xmin == 0
+ && glyph->ymin == 0) {
+ DBounds bb;
+ SplineCharFindBounds(glyph, &bb);
+ glyph->xmin = bb.minx;
+ glyph->ymin = bb.miny;
+ glyph->xmax = bb.maxx;
+ glyph->ymax = bb.maxy;
+ }
+ lua_createtable(L, 4, 0);
+ lua_pushnumber(L, 1);
+ lua_pushnumber(L, glyph->xmin);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 2);
+ lua_pushnumber(L, glyph->ymin);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 3);
+ lua_pushnumber(L, glyph->xmax);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 4);
+ lua_pushnumber(L, glyph->ymax);
+ lua_rawset(L, -3);
+ break;
+ case GK_vwidth:
+ lua_pushnumber(L, glyph->vwidth);
+ break;
+ case GK_width:
+ lua_pushnumber(L, glyph->width);
+ break;
+ case GK_lsidebearing:
+ lua_pushnumber(L, glyph->lsidebearing);
+ break;
+ case GK_class:
+ if (glyph->glyph_class > 0) {
+ lua_pushstring(L, glyph_class_enum[glyph->glyph_class]);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_kerns:
+ if (glyph->kerns != NULL) {
+ lua_newtable(L);
+ handle_kernpair(L, glyph->kerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_vkerns:
+ if (glyph->vkerns != NULL) {
+ lua_newtable(L);
+ handle_kernpair(L, glyph->vkerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_dependents:
+ if (glyph->dependents != NULL) {
+ lua_newtable(L);
+ handle_splinecharlist(L, glyph->dependents);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_lookups:
+ if (glyph->possub != NULL) {
+ lua_newtable(L);
+ handle_generic_pst(L, glyph->possub);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_ligatures:
+ if (glyph->ligofme != NULL) {
+ lua_newtable(L);
+ handle_liglist(L, glyph->ligofme);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_comment:
+ lua_pushstring(L, glyph->comment);
+ break;
+ case GK_anchors:
+ if (glyph->anchor != NULL) {
+ lua_newtable(L);
+ handle_anchorpoint(L, glyph->anchor);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_altuni:
+ if (glyph->altuni != NULL) {
+ lua_newtable(L);
+ handle_altuni(L, glyph->altuni);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_tex_height:
+ if (glyph->tex_height != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->tex_height);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_tex_depth:
+ if (glyph->tex_height != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->tex_depth);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_is_extended_shape:
+ lua_pushnumber(L, glyph->is_extended_shape);
+ break;
+ case GK_italic_correction:
+ if (glyph->italic_correction != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->italic_correction);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_top_accent:
+ if (glyph->top_accent_horiz != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->top_accent_horiz);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_vert_variants:
+ if (glyph->vert_variants != NULL) {
+ lua_newtable(L);
+ handle_glyphvariants(L, glyph->vert_variants);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_horiz_variants:
+ if (glyph->horiz_variants != NULL) {
+ lua_newtable(L);
+ handle_glyphvariants(L, glyph->horiz_variants);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_mathkern:
+ if (glyph->mathkern != NULL) {
+ lua_newtable(L);
+ handle_mathkern(L, glyph->mathkern);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ default:
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+
+static int ff_index(lua_State * L)
+{
+ SplineFont *sf;
+ int k, key;
+ /* sf = *check_isfont(L, 1); */
+ if (!(is_userdata(L, 1, FONT_METATABLE) ||
+ is_userdata(L, 1, FONT_SUBFONT_METATABLE))) {
+ return luaL_error(L,
+ "fontloader.__index: expected a (sub)font userdata object\n");
+ }
+ sf = *((SplineFont **)lua_touserdata(L, 1));
+
+ if (sf == NULL) {
+ return luaL_error(L,
+ "fontloader.__index: font is nonexistent or freed already\n");
+ }
+ if (!lua_isstring(L, 2)) { /* 1 == 'font' */
+ return luaL_error(L,
+ "fontloader.__index: can only be indexed by string\n");
+ }
+ key = luaL_checkoption(L, 2, NULL, font_keys);
+ switch (key) {
+ case FK_table_version:
+ lua_pushstring(L, LUA_OTF_VERSION);
+ break;
+ case FK_fontname:
+ lua_pushstring(L, sf->fontname);
+ break;
+ case FK_fullname:
+ lua_pushstring(L, sf->fullname);
+ break;
+ case FK_familyname:
+ lua_pushstring(L, sf->familyname);
+ break;
+ case FK_weight:
+ lua_pushstring(L, sf->weight);
+ break;
+ case FK_copyright:
+ lua_pushstring(L, sf->copyright);
+ break;
+ case FK_filename:
+ lua_pushstring(L, sf->filename);
+ break;
+ case FK_version:
+ lua_pushstring(L, sf->version);
+ break;
+ case FK_italicangle:
+ lua_pushnumber(L, sf->italicangle);
+ break;
+ case FK_upos:
+ lua_pushnumber(L, sf->upos);
+ break;
+ case FK_uwidth:
+ lua_pushnumber(L, sf->uwidth);
+ break;
+ case FK_ascent:
+ lua_pushnumber(L, sf->ascent);
+ break;
+ case FK_descent:
+ lua_pushnumber(L, sf->descent);
+ break;
+ case FK_uniqueid:
+ lua_pushnumber(L, sf->uniqueid);
+ break;
+ case FK_glyphcnt:
+ lua_pushnumber(L, sf->glyphcnt);
+ break;
+ case FK_glyphmax:
+ lua_pushnumber(L, sf->glyphmax);
+ break;
+ case FK_units_per_em:
+ lua_pushnumber(L, sf->units_per_em);
+ break;
+ case FK_lookups:
+ if (sf->possub != NULL) {
+ lua_newtable(L);
+ handle_generic_fpst(L, sf->possub);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_glyphs:
+ lua_newtable(L); /* the virtual glyph table */
+ lua_pushstring(L, "__sf");
+ lua_pushvalue(L, 1); /* that is our font */
+ lua_rawset(L, -3);
+ luaL_getmetatable(L, FONT_GLYPHS_METATABLE);
+ lua_setmetatable(L, -2); /* assign the metatable */
+ break;
+ case FK_hasvmetrics:
+ lua_pushnumber(L, sf->hasvmetrics);
+ break;
+ case FK_onlybitmaps:
+ lua_pushnumber(L, sf->onlybitmaps);
+ break;
+ case FK_serifcheck:
+ lua_pushnumber(L, sf->serifcheck);
+ break;
+ case FK_isserif:
+ lua_pushnumber(L, sf->isserif);
+ break;
+ case FK_issans:
+ lua_pushnumber(L, sf->issans);
+ break;
+ case FK_encodingchanged:
+ lua_pushnumber(L, sf->encodingchanged);
+ break;
+ case FK_strokedfont:
+ lua_pushnumber(L, sf->strokedfont);
+ break;
+ case FK_use_typo_metrics:
+ lua_pushnumber(L, sf->use_typo_metrics);
+ break;
+ case FK_weight_width_slope_only:
+ lua_pushnumber(L, sf->weight_width_slope_only);
+ break;
+ case FK_head_optimized_for_cleartype:
+ lua_pushnumber(L, sf->head_optimized_for_cleartype);
+ break;
+ case FK_uni_interp:
+ lua_pushstring(L, uni_interp_enum[(sf->uni_interp + 1)]);
+ break;
+ case FK_map:
+ if (sf->map != NULL) {
+ lua_newtable(L);
+ handle_encmap(L, sf->map, notdef_loc(sf));
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_origname:
+ lua_pushstring(L, sf->origname);
+ break;
+ case FK_private:
+ if (sf->private != NULL) {
+ lua_newtable(L);
+ handle_psdict(L, sf->private);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_xuid:
+ lua_pushstring(L, sf->xuid);
+ break;
+ case FK_pfminfo:
+ lua_createtable(L, 0, 40);
+ handle_pfminfo(L, sf->pfminfo);
+ break;
+ case FK_names:
+ if (sf->names != NULL) {
+ lua_newtable(L);
+ handle_ttflangname(L, sf->names);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_cidinfo:
+ lua_createtable(L, 0, 4);
+ dump_stringfield(L, "registry", sf->cidregistry);
+ dump_stringfield(L, "ordering", sf->ordering);
+ dump_intfield(L, "version", sf->cidversion);
+ dump_intfield(L, "supplement", sf->supplement);
+ break;
+ case FK_subfonts:
+ if (sf->subfontcnt > 0) {
+ lua_createtable(L, sf->subfontcnt, 0);
+ for (k = 0; k < sf->subfontcnt; k++) {
+ lua_ff_pushsubfont(L, sf->subfonts[k]);
+ lua_rawseti(L, -2, (k + 1));
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_comments:
+ lua_pushstring(L, sf->comments);
+ break;
+ case FK_fontlog:
+ lua_pushstring(L, sf->fontlog);
+ break;
+ case FK_cvt_names:
+ if (sf->cvt_names != NULL) {
+ lua_newtable(L);
+ for (k = 0; sf->cvt_names[k] != END_CVT_NAMES; ++k) {
+ lua_pushstring(L, sf->cvt_names[k]);
+ lua_rawseti(L, -2, (k + 1));
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_ttf_tables:
+ if (sf->ttf_tables != NULL) {
+ lua_newtable(L);
+ handle_ttf_table(L, sf->ttf_tables);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_ttf_tab_saved:
+ if (sf->ttf_tab_saved != NULL) {
+ lua_newtable(L);
+ handle_ttf_table(L, sf->ttf_tab_saved);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_texdata:
+ if (sf->texdata.type != tex_unset) {
+ lua_newtable(L);
+ dump_enumfield(L, "type", sf->texdata.type, tex_type_enum);
+ lua_newtable(L);
+ for (k = 0; k < 22; k++) {
+ lua_pushnumber(L, k);
+ lua_pushnumber(L, sf->texdata.params[k]);
+ lua_rawset(L, -3);
+ }
+ lua_setfield(L, -2, "params");
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_anchor_classes:
+ if (sf->anchor != NULL) {
+ lua_newtable(L);
+ handle_anchorclass(L, sf->anchor);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_kerns:
+ if (sf->kerns != NULL) {
+ lua_newtable(L);
+ handle_kernclass(L, sf->kerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_vkerns:
+ if (sf->vkerns != NULL) {
+ lua_newtable(L);
+ handle_kernclass(L, sf->vkerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_gsub:
+ if (sf->gsub_lookups != NULL) {
+ lua_newtable(L);
+ handle_lookup(L, sf->gsub_lookups, sf);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_gpos:
+ if (sf->gpos_lookups != NULL) {
+ lua_newtable(L);
+ handle_lookup(L, sf->gpos_lookups, sf);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_sm:
+ if (sf->sm != NULL) {
+ lua_newtable(L);
+ handle_generic_asm(L, sf->sm);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_features:
+ if (sf->features != NULL) {
+ lua_newtable(L);
+ handle_macfeat(L, sf->features);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_mm:
+ if (sf->mm != NULL) {
+ lua_newtable(L);
+ handle_mmset(L, sf->mm);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_chosenname:
+ lua_pushstring(L, sf->chosenname);
+ break;
+ case FK_macstyle:
+ lua_pushnumber(L, sf->macstyle);
+ break;
+ case FK_fondname:
+ lua_pushstring(L, sf->fondname);
+ break;
+ case FK_design_size:
+ lua_pushnumber(L, sf->design_size);
+ break;
+ case FK_fontstyle_id:
+ lua_pushnumber(L, sf->fontstyle_id);
+ break;
+ case FK_fontstyle_name:
+ if (sf->fontstyle_name != NULL) {
+ lua_newtable(L);
+ handle_otfname(L, sf->fontstyle_name);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_design_range_bottom:
+ lua_pushnumber(L, sf->design_range_bottom);
+ break;
+ case FK_design_range_top:
+ lua_pushnumber(L, sf->design_range_top);
+ break;
+ case FK_strokewidth:
+ lua_pushnumber(L, sf->strokewidth);
+ break;
+ case FK_mark_classes:
+ if (sf->mark_class_cnt > 0) {
+ lua_newtable(L);
+ for (k = 0; k < sf->mark_class_cnt; k++) {
+ if (sf->mark_class_names[k] != NULL) {
+ lua_pushstring(L, sf->mark_class_names[k]);
+ lua_pushstring(L, sf->mark_classes[k]);
+ lua_rawset(L, -3);
+ }
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_creationtime:
+ lua_pushnumber(L, sf->creationtime);
+ break;
+ case FK_modificationtime:
+ lua_pushnumber(L, sf->modificationtime);
+ break;
+ case FK_os2_version:
+ lua_pushnumber(L, sf->os2_version);
+ break;
+ case FK_sfd_version:
+ lua_pushnumber(L, sf->sfd_version);
+ break;
+ case FK_math:
+ if (sf->MATH != NULL) {
+ lua_newtable(L);
+ handle_MATH(L, sf->MATH);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_validation_state:
+ if (sf->loadvalidation_state != 0) {
+ int val, st;
+ lua_newtable(L);
+ val = 1;
+ st = sf->loadvalidation_state;
+ if (st & lvs_bad_ps_fontname) {
+ lua_pushliteral(L, "bad_ps_fontname");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_glyph_table) {
+ lua_pushliteral(L, "bad_glyph_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_cff_table) {
+ lua_pushliteral(L, "bad_cff_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_metrics_table) {
+ lua_pushliteral(L, "bad_metrics_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_cmap_table) {
+ lua_pushliteral(L, "bad_cmap_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_bitmaps_table) {
+ lua_pushliteral(L, "bad_bitmaps_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_gx_table) {
+ lua_pushliteral(L, "bad_gx_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_ot_table) {
+ lua_pushliteral(L, "bad_ot_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_os2_version) {
+ lua_pushliteral(L, "bad_os2_version");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_sfnt_header) {
+ lua_pushliteral(L, "bad_sfnt_header");
+ lua_rawseti(L, -2, val++);
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_horiz_base:
+ if (sf->horiz_base != NULL) {
+ lua_newtable(L);
+ handle_base(L, sf->horiz_base);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_vert_base:
+ if (sf->vert_base != NULL) {
+ lua_newtable(L);
+ handle_base(L, sf->vert_base);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_extrema_bound:
+ lua_pushnumber(L, sf->extrema_bound);
+ break;
+ default: /* can't actually happen, |luaL_checkoption| raises an error instead */
+ lua_pushnil(L);
+ break;
+ }
+ return 1;
+}
+
+
static int ff_info(lua_State * L)
{
SplineFont *sf;
@@ -2409,6 +3441,7 @@ static int ff_info(lua_State * L)
}
/* test fontname for existance */
if ((l = fopen(fontname, "r"))) {
+ recorder_record_input(fontname);
fclose(l);
} else {
lua_pushnil(L);
@@ -2458,6 +3491,7 @@ static void ff_do_cff(SplineFont * sf, char *filename, unsigned char **buf,
(filename, sf, ff_cff, bsizes, bf_none, flags, map, ly_fore)) {
/* success */
f = fopen(filename, "rb");
+ recorder_record_input(filename);
readbinfile(f, buf, bufsiz);
/*fprintf(stdout,"\n%s => CFF, size: %d\n", sf->filename, *bufsiz); */
fclose(f);
@@ -2509,50 +3543,20 @@ int ff_get_ttc_index(char *ffname, char *psname)
while (sf != NULL) {
if (strcmp(sf->fontname, psname) == 0) {
index = i;
- break;
}
i++;
sf = sf->next;
}
- return index;
-}
-
-static int warning_given = 0;
-
-static int ffold_info(lua_State * L)
-{
- if (warning_given < 5) {
- fprintf(stderr,
- "Warning: The 'fontforge' table has been renamed to 'fontloader'.\n");
- fprintf(stderr, " Please update your source file(s) accordingly.\n");
- warning_given++;
- }
- return ff_info(L);
+ if (index>=0)
+ return (i-index-1);
+ return -1;
}
-static int ffold_open(lua_State * L)
-{
- fprintf(stderr,
- "Warning: The 'fontforge' table has been renamed to 'fontloader'.\n");
- fprintf(stderr, " Please update your source file(s) accordingly.\n");
- return ff_open(L);
-}
-
-
-static struct luaL_reg fflib[] = {
- {"open", ffold_open},
- {"info", ffold_info},
- {"close", ff_close},
- {"apply_afmfile", ff_apply_afmfile},
- {"apply_featurefile", ff_apply_featurefile},
- {"to_table", ff_make_table},
- {NULL, NULL}
-};
-
static struct luaL_reg fllib[] = {
{"open", ff_open},
{"info", ff_info},
{"close", ff_close},
+ {"fields", ff_fields},
{"apply_afmfile", ff_apply_afmfile},
{"apply_featurefile", ff_apply_featurefile},
{"to_table", ff_make_table},
@@ -2561,6 +3565,7 @@ static struct luaL_reg fllib[] = {
static const struct luaL_reg fflib_m[] = {
{"__gc", ff_close}, /* doesnt work yet! */
+ {"__index", ff_index},
{NULL, NULL} /* sentinel */
};
@@ -2577,7 +3582,28 @@ int luaopen_ff(lua_State * L)
SaveTablesPref = "VORG,JSTF,acnt,bsln,fdsc,fmtx,hsty,just,trak,Zapf,LINO";
luaL_newmetatable(L, FONT_METATABLE);
luaL_register(L, NULL, fflib_m);
- luaL_openlib(L, "fontforge", fflib, 0);
+
+ /* virtual subfont table */
+ luaL_newmetatable(L, FONT_SUBFONT_METATABLE);
+ lua_pushstring(L, "__index");
+ lua_pushcfunction(L, ff_index);
+ lua_rawset(L, -3);
+ lua_pop(L, 1);
+ /* virtual glyphs table */
+ luaL_newmetatable(L, FONT_GLYPHS_METATABLE);
+ lua_pushstring(L, "__index");
+ lua_pushcfunction(L, ff_glyphs_index);
+ lua_rawset(L, -3);
+ lua_pop(L, 1);
+ /* virtual glyph table */
+ luaL_newmetatable(L, FONT_GLYPH_METATABLE);
+ lua_pushstring(L, "__index");
+ lua_pushcfunction(L, ff_glyph_index);
+ lua_rawset(L, -3);
+ lua_pop(L, 1);
+
+
luaL_openlib(L, "fontloader", fllib, 0);
+
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/luapeg/lpeg.c b/Build/source/texk/web2c/luatexdir/luapeg/lpeg.c
index 07cbf341d59..c86dc7a0ee9 100644
--- a/Build/source/texk/web2c/luatexdir/luapeg/lpeg.c
+++ b/Build/source/texk/web2c/luatexdir/luapeg/lpeg.c
@@ -478,6 +478,7 @@ static const char *match (lua_State *L,
case IBackCommit: {
assert(stack > stackbase && (stack - 1)->s != NULL);
s = (--stack)->s;
+ captop = stack->caplevel; /* patch from RI, 20101101 */
p += p->i.offset;
continue;
}
@@ -693,7 +694,7 @@ static void checkrule (lua_State *L, Instruction *op, int from, int to,
for (i = from; i < to; i += sizei(op + i)) {
if (op[i].i.code == IPartialCommit && op[i].i.offset < 0) { /* loop? */
int start = dest(op, i);
- assert(op[start - 1].i.code == IChoice && dest(op, start - 1) == i + 1);
+ /* assert(op[start - 1].i.code == IChoice && dest(op, start - 1) == i + 1); */
if (start <= lastopen) { /* loop does contain an open call? */
if (!verify(L, op, op + start, op + i, postable, rule)) /* check body */
luaL_error(L, "possible infinite loop in %s", val2str(L, rule));
diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h
new file mode 100644
index 00000000000..d835843e523
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h
@@ -0,0 +1,34 @@
+/* pdflua.h
+
+ Copyright 2010 Taco Hoekwater <taco@luatex.org>
+ Copyright 2010 Hartmut Henkel <hartmut@luatex.org>
+
+ This file is part of LuaTeX.
+
+ LuaTeX is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+
+/* $Id: pdflua.h 3937 2010-11-01 21:58:54Z hhenkel $ */
+
+#ifndef PDFLUA_H
+# define PDFLUA_H
+
+typedef struct _zlib_struct {
+ uLong uncomprLen;
+ uLong comprLen;
+ const Byte *compr;
+} zlib_struct;
+
+extern const zlib_struct *pdflua_zlib_struct_ptr;
+
+#endif /* PDFLUA_H */
diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua
new file mode 100644
index 00000000000..2009b162d92
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua
@@ -0,0 +1,25 @@
+-- $Id: pdflua.lua 3949 2010-11-07 00:09:19Z hhenkel $
+-- $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luascripts/pdflua.lua $
+
+-- this is early work in progress...
+
+------------------------------------------------------------------------
+
+beginpage = function(a)
+end
+
+endpage = function(a)
+end
+
+outputpagestree = function()
+end
+
+------------------------------------------------------------------------
+
+local pdflua = {
+ beginpage = beginpage,
+ endpage = endpage,
+ outputpagestree = outputpagestree,
+}
+
+return pdflua
diff --git a/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w
new file mode 100644
index 00000000000..ccf5d56cb88
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w
@@ -0,0 +1,145 @@
+% txt2zlib.w
+
+% Copyright 2010 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2010 Hartmut Henkel <hartmut@@luatex.org>
+
+% This file is part of LuaTeX.
+
+% LuaTeX is free software; you can redistribute it and/or modify it under
+% the terms of the GNU General Public License as published by the Free
+% Software Foundation; either version 2 of the License, or (at your
+% option) any later version.
+
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
+
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+
+% $Id: txt2zlib.w 3937 2010-11-01 21:58:54Z hhenkel $
+% $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luascripts/txt2zlib.w $
+
+@
+@c
+
+#include<stdlib.h>
+#include<stdio.h>
+#include<string.h>
+#include<zlib.h>
+
+#define INBUFINITLEN 10
+#define LINELEN 16
+
+char header[] =
+ " Copyright 2010 Taco Hoekwater <taco@@luatex.org>\n"
+ " Copyright 2010 Hartmut Henkel <hartmut@@luatex.org>\n"
+ "\n"
+ " This file is part of LuaTeX.\n"
+ "\n"
+ " LuaTeX is free software; you can redistribute it and/or modify it under\n"
+ " the terms of the GNU General Public License as published by the Free\n"
+ " Software Foundation; either version 2 of the License, or (at your\n"
+ " option) any later version.\n"
+ "\n"
+ " LuaTeX is distributed in the hope that it will be useful, but WITHOUT\n"
+ " ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
+ " FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\n"
+ " License for more details.\n"
+ "\n"
+ " You should have received a copy of the GNU General Public License along\n"
+ " with LuaTeX; if not, see <http://www.gnu.org/licenses/>.";
+
+#define NAMELEN 100
+
+int main(int argc, char *argv[])
+{
+ int i, j, c, err;
+ Byte *inbuf = NULL, *outbuf;
+ FILE *fin, *fout;
+ char ptrname[NAMELEN];
+ uLong inbuflen, uncomprLen = 0, outbuflen, comprLen;
+
+ if (argc != 3) {
+ fprintf(stderr,
+ "%s: need exactly two arguments (input file name, output file name).\n",
+ argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ fin = fopen(argv[1], "r");
+ if (fin == NULL) {
+ fprintf(stderr, "%s: can't open %s for reading.\n", argv[0], argv[1]);
+ exit(EXIT_FAILURE);
+ }
+ fout = fopen(argv[2], "w");
+ if (fout == NULL) {
+ fprintf(stderr, "%s: can't open %s for writing.\n", argv[0], argv[2]);
+ exit(EXIT_FAILURE);
+ }
+ if ((inbuf = malloc(INBUFINITLEN * sizeof(Byte))) == NULL)
+ exit(EXIT_FAILURE);
+ inbuflen = INBUFINITLEN;
+ while ((c = fgetc(fin)) != EOF) {
+ if (uncomprLen == inbuflen - 1) {
+ inbuflen = (uLong) ((double) inbuflen * 1.5 + 1);
+ if ((inbuf = realloc(inbuf, inbuflen)) == NULL)
+ exit(EXIT_FAILURE);
+ }
+ inbuf[uncomprLen] = (Byte) c;
+ uncomprLen++;
+ }
+
+ outbuflen = comprLen = (uLong) ((double) uncomprLen * 1.1 + 50);
+ if ((outbuf = malloc(outbuflen * sizeof(Byte))) == NULL)
+ exit(EXIT_FAILURE);
+
+ err = compress(outbuf, &comprLen, inbuf, uncomprLen);
+
+ if (err != Z_OK) {
+ fprintf(stderr, "compress error: %d\n", err);
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(fout, "/* %s\n\n", argv[2]);
+ fprintf(fout, "%s */\n\n", header);
+ fprintf(fout, "#include \"ptexlib.h\"\n\n");
+
+ fprintf(fout, "static const Byte compr[%ld] = {\n", comprLen);
+ for (i = 0, j = 0; (uLong) i < comprLen; i++) {
+ if (j == 0)
+ fprintf(fout, " ");
+ fprintf(fout, "0x%02x", outbuf[i]);
+ if ((uLong) i < comprLen - 1) {
+ fprintf(fout, ",");
+ if (j == LINELEN - 1) {
+ fprintf(fout, "\n");
+ j = 0;
+ } else {
+ fprintf(fout, " ");
+ j++;
+ }
+ }
+ }
+ fprintf(fout, "\n};\n\n");
+
+ strncpy(ptrname, argv[2], NAMELEN - 20);
+ for (i = (int) strlen(ptrname) - 1; i > 0; i--) {
+ if (ptrname[i] == '.') {
+ ptrname[i] = '\0';
+ break;
+ }
+ }
+
+ strcat(ptrname, "_zlib_struct_ptr");
+
+ fprintf(fout,
+ "static const zlib_struct compr_struct = { %ld, %ld, compr };\n\n",
+ uncomprLen, comprLen);
+
+ fprintf(fout, "const zlib_struct *%s = &compr_struct;\n", ptrname);
+
+ fclose(fin);
+ fclose(fout);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index bb3eb1a10ff..06ec012cc93 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -15,16 +15,16 @@
#include "luatex_svnversion.h"
static const char _svn_version[] =
- "$Id: luatex.c 3730 2010-07-01 07:12:12Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/luatex.c $";
+ "$Id: luatex.c 4117 2011-04-11 07:58:32Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luatex.c $";
#define TeX
int luatex_svn = luatex_svn_revision;
-int luatex_version = 60; /* \.{\\luatexversion} */
-int luatex_revision = '2'; /* \.{\\luatexrevision} */
+int luatex_version = 66; /* \.{\\luatexversion} */
+int luatex_revision = '0'; /* \.{\\luatexrevision} */
int luatex_date_info = -extra_version_info; /* the compile date is negated */
-const char *luatex_version_string = "beta-0.60.2";
+const char *luatex_version_string = "beta-0.66.0";
const char *engine_name = "luatex"; /* the name of this engine */
#include <kpathsea/c-ctype.h>
@@ -879,99 +879,6 @@ boolean input_line(FILE * f)
}
-/* This string specifies what the `e' option does in response to an
- error message. */
-#if 0
-static const_string edit_value = EDITOR;
-#endif
-
-/* This procedure originally due to sjc@s1-c. TeX & Metafont call it when
- the user types `e' in response to an error, invoking a text editor on
- the erroneous source file. FNSTART is how far into FILENAME the
- actual filename starts; FNLENGTH is how long the filename is. */
-
-#if 0
-void
-calledit(packedASCIIcode * filename,
- poolpointer fnstart, int fnlength, int linenumber)
-{
- char *temp, *command;
- char c;
- int sdone, ddone, i;
-
- sdone = ddone = 0;
- filename += fnstart;
-
- /* Close any open input files, since we're going to kill the job. */
- for (i = 1; i <= in_open; i++)
- xfclose(input_file[i], "inputfile");
-
- /* Replace the default with the value of the appropriate environment
- variable or config file value, if it's set. */
- temp = kpse_var_value(edit_var);
- if (temp != NULL)
- edit_value = temp;
-
- /* Construct the command string. The `11' is the maximum length an
- integer might be. */
- command =
- (string) xmalloc((unsigned) strlen(edit_value) + (unsigned) fnlength +
- 11);
-
- /* So we can construct it as we go. */
- temp = command;
-
- while ((c = *edit_value++) != 0) {
- if (c == '%') {
- switch (c = *edit_value++) {
- case 'd':
- if (ddone)
- FATAL("call_edit: `%%d' appears twice in editor command");
- sprintf(temp, "%ld", (long int) linenumber);
- while (*temp != '\0')
- temp++;
- ddone = 1;
- break;
-
- case 's':
- if (sdone)
- FATAL("call_edit: `%%s' appears twice in editor command");
- for (i = 0; i < fnlength; i++)
- *temp++ = (char) Xchr(filename[i]);
- sdone = 1;
- break;
-
- case '\0':
- *temp++ = '%';
- /* Back up to the null to force termination. */
- edit_value--;
- break;
-
- default:
- *temp++ = '%';
- *temp++ = c;
- break;
- }
- } else
- *temp++ = c;
- }
-
- *temp = 0;
-
- /* Execute the command. */
-#ifdef __MINGW32__
- /* Win32 reimplementation of the system() command
- provides opportunity to call it asynchronously */
- if (win32_system(command, true) != 0)
-#else
- if (system(command) != 0)
-#endif
- fprintf(stderr, "! Trouble executing `%s'.\n", command);
-
- /* Quit, since we found an error. */
- uexit(1);
-}
-#endif
/* Read and write dump files. As distributed, these files are
architecture dependent; specifically, BigEndian and LittleEndian
@@ -995,7 +902,7 @@ calledit(packedASCIIcode * filename,
void swap_items(char *pp, int nitems, int size)
{
char temp;
- unsigned total = nitems*size;
+ unsigned total = (unsigned) (nitems * size);
char *q = xmalloc(total);
char *p = q;
memcpy(p,pp,total);
@@ -1067,48 +974,6 @@ void swap_items(char *pp, int nitems, int size)
}
#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
-
-#if 0
-/* Here we write NITEMS items, each item being ITEM_SIZE bytes long.
- The pointer to the stuff to write is P, and we write to the file
- OUT_FILE. */
-
-void do_dump(char *p, int item_size, int nitems, FILE * out_file)
-{
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
- swap_items(p, nitems, item_size);
-#endif
-
- if (fwrite(p, (size_t) item_size, (size_t) nitems, out_file) !=
- (unsigned) nitems) {
- fprintf(stderr, "! Could not write %d %d-byte item(s).\n", nitems,
- item_size);
- uexit(1);
- }
-
- /* Have to restore the old contents of memory, since some of it might
- get used again. */
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
- swap_items(p, nitems, item_size);
-#endif
-}
-#endif
-
-
-
-/* Here is the dual of the writing routine. */
-#if 0
-void do_undump(char *p, int item_size, int nitems, FILE * in_file)
-{
- if (fread(p, (size_t) item_size, (size_t) nitems, in_file) !=
- (size_t) nitems)
- FATAL2("Could not undump %d %d-byte item(s)", nitems, item_size);
-
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
- swap_items(p, nitems, item_size);
-#endif
-}
-#endif
/* Get the job name to be used, which may have been set from the
diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
index 1a9f3e62096..f74ca715caa 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 3736
+#define luatex_svn_revision 4141
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pagetree.w b/Build/source/texk/web2c/luatexdir/pdf/pagetree.w
index 8063d6a103b..b126d8a7a25 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pagetree.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pagetree.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: pagetree.w 3573 2010-04-02 14:10:54Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pagetree.w $";
+ "$Id: pagetree.w 3887 2010-09-14 21:32:23Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pagetree.w $";
@* Page diversions.
@@ -71,8 +71,7 @@ static pages_entry *new_pages_entry(PDF pdf)
for (i = 0; i < PAGES_TREE_KIDSMAX; i++)
p->kids[i] = 0;
p->next = NULL;
- pdf_create_obj(pdf, obj_type_pages, 0);
- p->objnum = pdf->obj_ptr;
+ p->objnum = pdf_create_obj(pdf, obj_type_pages, 0);
return p;
}
@@ -223,8 +222,7 @@ static void write_pages(PDF pdf, pages_entry * p, int parent)
if (parent == 0) { /* it's root */
if (pdf_pages_attr != null)
pdf_print_toks_ln(pdf, pdf_pages_attr);
- if (pdf_pagesattributes_toks != null) /* from Lua */
- pdf_print_toks_ln(pdf, pdf_pagesattributes_toks);
+ print_pdf_table_string(pdf, "pagesattributes");
} else
pdf_printf(pdf, "/Parent %d 0 R\n", parent);
pdf_printf(pdf, "/Count %d\n/Kids [", (int) p->number_of_pages);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.h b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.h
index 77944dd3f5b..2ea3a175403 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.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: pdfaction.h 2801 2009-07-10 13:12:59Z taco $ */
+/* $Id: pdfaction.h 3891 2010-09-14 23:02:24Z hhenkel $ */
#ifndef PDFACTION_H
# define PDFACTION_H
@@ -59,7 +59,7 @@ typedef enum {
if (pdf_action_refcount(a) == null) { \
delete_action_node(a); \
} else { \
- decr(pdf_action_refcount(a)); \
+ pdf_action_refcount(a)--; \
} \
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w
index 46992866f21..4bef7c1d087 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: pdfaction.w 3612 2010-04-13 09:29:42Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfaction.w $";
+ "$Id: pdfaction.w 3615 2010-04-13 21:59:59Z oneiros $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfaction.w $";
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
index a33de9e1905..b112c1a5447 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfannot.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfannot.w $";
+ "$Id: pdfannot.w 3908 2010-10-13 19:22:02Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfannot.w $";
#include "ptexlib.h"
@@ -30,14 +30,15 @@ static const char _svn_version[] =
void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
{
scaled_whd alt_rule;
- if (!is_shipping_page)
+ int k;
+ if (global_shipping_mode == SHIPPING_FORM)
pdf_error("ext4", "annotations cannot be inside an XForm");
if (doing_leaders)
return;
if (is_obj_scheduled(pdf, pdf_annot_objnum(p))) {
- pdf_create_obj(pdf, obj_type_annot, pdf->sys_obj_ptr + 1);
+ k = pdf_create_obj(pdf, obj_type_annot, pdf->obj_ptr + 1);
obj_annot_ptr(pdf, pdf_annot_objnum(p)) = p;
- pdf_annot_objnum(p) = pdf->sys_obj_ptr;
+ pdf_annot_objnum(p) = k;
}
alt_rule.wd = width(p);
alt_rule.ht = height(p);
@@ -72,8 +73,7 @@ void scan_annot(PDF pdf)
{
int k;
if (scan_keyword("reserveobjnum")) {
- pdf_create_obj(pdf, obj_type_annot, pdf->sys_obj_ptr + 1);
- k = pdf->sys_obj_ptr;
+ k = pdf_create_obj(pdf, obj_type_annot, pdf->obj_ptr + 1);
/* Scan an optional space */
get_x_token();
if (cur_cmd != spacer_cmd)
@@ -82,12 +82,11 @@ void scan_annot(PDF pdf)
if (scan_keyword("useobjnum")) {
scan_int();
k = cur_val;
- check_obj_exists(pdf, obj_type_annot, k);
+ check_obj_type(pdf, obj_type_annot, k);
if (obj_annot_ptr(pdf, k) != 0)
pdf_error("ext1", "annot object in use");
} else {
- pdf_create_obj(pdf, obj_type_annot, pdf->sys_obj_ptr + 1);
- k = pdf->sys_obj_ptr;
+ k = pdf_create_obj(pdf, obj_type_annot, pdf->obj_ptr + 1);
}
new_annot_whatsit(pdf_annot_node);
obj_annot_ptr(pdf, k) = tail;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.h b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.h
index 20d8e436146..3d8a396aa94 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.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: pdfcolorstack.h 3261 2009-12-18 11:38:21Z taco $ */
+/* $Id: pdfcolorstack.h 3676 2010-05-02 20:04:49Z hhenkel $ */
#ifndef PDFCOLORSTACK_H
# define PDFCOLORSTACK_H
@@ -26,9 +26,6 @@
# define set_pdf_colorstack_cmd(A,B) pdf_colorstack_cmd(A)=B
# define set_pdf_colorstack_data(A,B) pdf_colorstack_data(A)=B
-/* remember shipout mode: page/form */
-extern boolean page_mode;
-
# define STACK_INCREMENT 8
int newcolorstack(int s, int literal_mode, boolean pagestart);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
index 4d31e99e76a..3ed72e0eb87 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: pdfcolorstack.w 3612 2010-04-13 09:29:42Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $";
+ "$Id: pdfcolorstack.w 3891 2010-09-14 23:02:24Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $";
@* Color Stack and Matrix Transformation Support.
@@ -54,9 +54,6 @@ They have the following properties:
#define DIRECT_PAGE 1
#define DIRECT_ALWAYS 2
-/* remember shipout mode: page/form */
-boolean page_mode;
-
typedef struct {
char **page_stack;
char **form_stack;
@@ -176,7 +173,7 @@ static int colorstackset(int colstack_no, str_number s)
{
colstack_type *colstack = get_colstack(colstack_no);
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
xfree(colstack->page_current);
colstack->page_current = makecstring(s);
} else {
@@ -191,7 +188,7 @@ int colorstackcurrent(int colstack_no)
{
colstack_type *colstack = get_colstack(colstack_no);
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
put_cstring_on_str_pool(colstack->page_current);
} else {
put_cstring_on_str_pool(colstack->form_current);
@@ -204,7 +201,7 @@ static int colorstackpush(int colstack_no, str_number s)
{
colstack_type *colstack = get_colstack(colstack_no);
char *str;
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
if (colstack->page_used == colstack->page_size) {
colstack->page_size += STACK_INCREMENT;
colstack->page_stack = xretalloc(colstack->page_stack,
@@ -243,7 +240,7 @@ int colorstackpop(int colstack_no)
{
colstack_type *colstack = get_colstack(colstack_no);
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
if (colstack->page_used == 0) {
pdftex_warn("pop empty color page stack %u",
(unsigned int) colstack_no);
@@ -271,7 +268,7 @@ void colorstackpagestart(void)
int i, j;
colstack_type *colstack;
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
/* see procedure |pdf_out_colorstack_startpage| */
return;
}
@@ -381,6 +378,6 @@ void pdf_out_colorstack_startpage(PDF pdf)
flush_str(s);
}
}
- incr(i);
+ i++;
}
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w b/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w
index f97ea95e2ac..6081369e8b8 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfdest.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfdest.w $";
+ "$Id: pdfdest.w 3889 2010-09-14 22:21:57Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfdest.w $";
#include "ptexlib.h"
@@ -88,7 +88,7 @@ void do_dest(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
scaledpos pos = pdf->posstruct->pos;
scaled_whd alt_rule;
int k;
- if (!is_shipping_page)
+ if (global_shipping_mode == SHIPPING_FORM)
pdf_error("ext4", "destinations cannot be inside an XForm");
if (doing_leaders)
return;
@@ -321,6 +321,7 @@ int output_name_tree(PDF pdf)
int k = 0; /* index of current child of |l|; if |k < pdf_dest_names_ptr|
then this is pointer to |dest_names| array;
otherwise it is the pointer to |obj_tab| (object number) */
+ int m;
int dests = 0;
int names_head = 0, names_tail = 0;
if (pdf->dest_names_ptr == 0) {
@@ -329,10 +330,8 @@ int output_name_tree(PDF pdf)
sort_dest_names(pdf);
while (true) {
-
do {
- pdf_create_obj(pdf, obj_type_others, 0); /* create a new node */
- l = pdf->obj_ptr;
+ l = pdf_create_obj(pdf, obj_type_others, 0); /* create a new node */
if (b == 0)
b = l; /* first in this level */
if (names_head == 0) {
@@ -401,7 +400,7 @@ int output_name_tree(PDF pdf)
DONE:
if ((dests != 0) || (pdf_names_toks != null)) {
- pdf_new_dict(pdf, obj_type_others, 0, 1);
+ m = pdf_new_dict(pdf, obj_type_others, 0, 1);
if (dests != 0)
pdf_indirect_ln(pdf, "Dests", dests);
if (pdf_names_toks != null) {
@@ -410,7 +409,7 @@ int output_name_tree(PDF pdf)
pdf_names_toks = null;
}
pdf_end_dict(pdf);
- return pdf->obj_ptr;
+ return m;
} else {
return 0;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w
index 94dbc0c1e0a..0a33057f368 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w
@@ -21,8 +21,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdffont.w 3638 2010-04-20 14:00:47Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.1/source/texk/web2c/luatexdir/pdf/pdffont.w $";
+ "$Id: pdffont.w 4098 2011-04-07 21:01:11Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdffont.w $";
#include "ptexlib.h"
@@ -64,7 +64,6 @@ void output_one_char(PDF pdf, internal_font_number ffi, int c)
break;
}
if (has_packet(ffi, c)) {
- assert(pdf->o_mode == OMODE_PDF);
do_vf_packet(pdf, ffi, c);
} else
backend_out[glyph_node] (pdf, ffi, c); /* |pdf_place_glyph(pdf, ffi, c);| */
@@ -91,7 +90,7 @@ indicates that the corresponding font shares the font resource with the font
static boolean font_shareable(internal_font_number f, internal_font_number k)
{
int ret = 0;
- internal_font_number b;
+ internal_font_number b; /* possible base font */
/* For some lua-loaded (for instance AFM) fonts, it is normal to have
a zero cidregistry, and such fonts do not have a fontmap entry yet
at this point, so the test should use the other branch */
@@ -101,7 +100,7 @@ static boolean font_shareable(internal_font_number f, internal_font_number k)
font_map(f) != NULL &&
(same(font_name, k, f) ||
(font_auto_expand(f) &&
- (b = pdf_font_blink(f)) != 0 && same(font_name, k, b)))) {
+ (b = pdf_font_blink(k)) != null_font && same(font_name, k, b)))) {
ret = 1;
}
#ifdef DEBUG
@@ -111,7 +110,8 @@ static boolean font_shareable(internal_font_number f, internal_font_number k)
} else {
if ((same(font_filename, k, f) && same(font_fullname, k, f))
|| (font_auto_expand(f)
- && (b = pdf_font_blink(f)) != 0 && same(font_name, k, b))) {
+ && (b = pdf_font_blink(k)) != null_font
+ && same(font_name, k, b))) {
ret = 1;
}
#ifdef DEBUG
@@ -129,12 +129,12 @@ void pdf_init_font(PDF pdf, internal_font_number f)
{
internal_font_number k, b;
fm_entry *fm;
- int i;
+ int i, l;
assert(!font_used(f));
/* if |f| is auto expanded then ensure the base font is initialized */
- if (font_auto_expand(f) && ((b = pdf_font_blink(f)) != 0)) {
+ if (font_auto_expand(f) && ((b = pdf_font_blink(f)) != null_font)) {
if (!font_used(b))
pdf_init_font(pdf, b);
set_font_map(f, font_map(b));
@@ -173,8 +173,8 @@ void pdf_init_font(PDF pdf, internal_font_number f)
i = obj_link(pdf, i);
}
/* create a new font object for |f| */
- pdf_create_obj(pdf, obj_type_font, f);
- pdf_use_font(f, pdf->obj_ptr);
+ l = pdf_create_obj(pdf, obj_type_font, f);
+ pdf_use_font(f, l);
}
@ set the actual font on PDF page
@@ -418,6 +418,7 @@ void new_letterspaced_font(small_number a)
pointer u; /* user's font identifier */
str_number t; /* name for the frozen font identifier */
internal_font_number f, k;
+ boolean nolig = false;
get_r_token();
u = cur_cs;
if (u >= hash_base)
@@ -429,7 +430,9 @@ void new_letterspaced_font(small_number a)
scan_font_ident();
k = cur_val;
scan_int();
- f = letter_space_font(u, k, fix_int(cur_val, -1000, 1000));
+ if (scan_keyword("nolig"))
+ nolig=true;
+ f = letter_space_font(k, fix_int(cur_val, -1000, 1000), nolig);
equiv(u) = f;
eqtb[font_id_base + f] = eqtb[u];
font_id_text(f) = t;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h
index f5840e715db..0bc83c7e04d 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 3573 2010-04-02 14:10:54Z hhenkel $ */
+/* $Id: pdfgen.h 3940 2010-11-01 22:46:24Z hhenkel $ */
#ifndef PDFGEN_H
# define PDFGEN_H
@@ -76,6 +76,8 @@ typedef enum {
zip_finish = 2 /* finish \.{ZIP} compression */
} zip_write_states;
+typedef enum { NOT_SHIPPING, SHIPPING_PAGE, SHIPPING_FORM } shipping_mode_e;
+
extern int pdf_output_option;
extern int pdf_output_value;
extern int pdf_draftmode_option;
@@ -99,11 +101,14 @@ extern void fix_pdf_minorversion(PDF);
/* do the same as |pdf_quick_out| and flush the PDF buffer if necessary */
# define pdf_out(pdf,A) do { pdf_room(pdf,1); pdf_quick_out(pdf,A); } while (0)
-# define pdf_out_block(pdf,A,n) do { \
+# if 0
+/* see function pdf_out_block() */
+# define pdf_out_block_macro(pdf,A,n) do { \
pdf_room(pdf,(int)(n)); \
(void)memcpy((pdf->buf+pdf->ptr),(A),(size_t)(n)); \
pdf->ptr+=(int)(n); \
} while (0)
+# endif
/*
Basic printing procedures for PDF output are very similiar to \TeX\ basic
@@ -111,10 +116,10 @@ printing ones but the output is going to PDF buffer. Subroutines with
suffix |_ln| append a new-line character to the PDF output.
*/
-# define pdf_new_line_char 10 /* new-line character for UNIX platforms */
+# define pdf_newline_char 10 /* new-line character '\n' for UNIX platforms */
/* output a new-line character to PDF buffer */
-# define pdf_print_nl(pdf) pdf_out(pdf,pdf_new_line_char)
+# define pdf_print_nl(pdf) pdf_out(pdf,pdf_newline_char)
/* print out a string to PDF buffer followed by a new-line character */
# define pdf_print_ln(pdf,A) do { \
@@ -128,7 +133,6 @@ suffix |_ln| append a new-line character to the PDF output.
pdf_print_nl(pdf); \
} while (0)
-extern void pdf_puts(PDF, const char *);
extern __attribute__ ((format(printf, 2, 3)))
void pdf_printf(PDF, const char *, ...);
@@ -151,13 +155,15 @@ extern void pdf_print_mag_bp(PDF, scaled);
extern void addto_page_resources(PDF pdf, pdf_obj_type t, int k);
extern pdf_object_list *get_page_resources_list(PDF pdf, pdf_obj_type t);
+extern void pdf_out_block(PDF pdf, const char *s, size_t n);
+
+# define pdf_puts(pdf, s) pdf_out_block((pdf), (s), strlen(s))
+
# define pdf_print_resname_prefix(pdf) do { \
if (pdf->resname_prefix != NULL) \
- pdf_puts(pdf,pdf->resname_prefix); \
+ pdf_puts(pdf, pdf->resname_prefix); \
} while (0)
-extern void pdf_print_fw_int(PDF, longinteger, int);
-extern void pdf_out_bytes(PDF, longinteger, int);
extern void pdf_int_entry(PDF, const char *, int);
extern void pdf_int_entry_ln(PDF, const char *, int);
extern void pdf_indirect(PDF, const char *, int);
@@ -173,23 +179,13 @@ extern void pdf_print_rect_spec(PDF, halfword);
extern void pdf_rectangle(PDF, halfword);
extern void pdf_begin_obj(PDF, int, int);
-extern void pdf_new_obj(PDF, int, int, int);
+extern int pdf_new_obj(PDF, int, int, int);
extern void pdf_end_obj(PDF);
extern void pdf_begin_dict(PDF, int, int);
-extern void pdf_new_dict(PDF, int, int, int);
+extern int pdf_new_dict(PDF, int, int, int);
extern void pdf_end_dict(PDF);
-extern void pdf_os_switch(PDF pdf, boolean pdf_os);
-extern void pdf_os_prepare_obj(PDF pdf, int i, int pdf_os_level);
-extern void pdf_os_write_objstream(PDF);
-
-extern void write_stream_length(PDF, int, longinteger);
-
-extern void print_creation_date(PDF);
-extern void print_mod_date(PDF);
-extern void print_ID(PDF, const char *);
-
extern void remove_pdffile(PDF);
extern int fb_offset(PDF);
@@ -198,12 +194,11 @@ extern void fb_putchar(PDF, eight_bits);
extern void fb_seek(PDF, int);
extern void fb_free(PDF);
-extern void write_zip(PDF, boolean);
extern void zip_free(PDF);
/* functions that do not output stuff */
-extern scaled round_xn_over_d(scaled x, int n, int d);
+extern scaled round_xn_over_d(scaled x, int n, unsigned int d);
extern char *convertStringToPDFString(const char *in, int len);
extern void init_start_time(PDF);
@@ -215,8 +210,9 @@ extern void check_o_mode(PDF pdf, const char *s, int o_mode, boolean errorflag);
extern void set_job_id(PDF, int, int, int, int);
extern char *get_resname_prefix(PDF);
-extern void pdf_begin_page(PDF pdf, boolean shipping_page);
-extern void pdf_end_page(PDF pdf, boolean shipping_page);
+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 void fix_o_mode(PDF pdf);
extern void ensure_output_state(PDF pdf, output_state s);
@@ -227,13 +223,10 @@ extern halfword pdf_catalog_toks; /* additional keys of Catalog dictionary
extern halfword pdf_catalog_openaction;
extern halfword pdf_names_toks; /* additional keys of Names dictionary */
extern halfword pdf_trailer_toks; /* additional keys of Trailer dictionary */
-extern halfword pdf_pageattributes_toks; /* additional keys of Page dictionary */
-extern halfword pdf_pageresources_toks; /* additional keys of Resources dictionary */
-extern halfword pdf_pagesattributes_toks; /* additional keys of Pages dictionary */
extern void scan_pdfcatalog(PDF pdf);
extern void finish_pdf_file(PDF pdf, int luatex_version,
str_number luatex_revision);
-extern boolean is_shipping_page;
+extern shipping_mode_e global_shipping_mode;
#endif /* PDFGEN_H */
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
index 98d318c9ea8..fc25df199e7 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
@@ -19,14 +19,15 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfgen.w 3638 2010-04-20 14:00:47Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.1/source/texk/web2c/luatexdir/pdf/pdfgen.w $";
+ "$Id: pdfgen.w 4126 2011-04-11 09:34:50Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfgen.w $";
#include "ptexlib.h"
@ @c
#include <kpathsea/c-dir.h>
#include <kpathsea/c-ctype.h>
+#include "lua/luatex-api.h"
#include "md5.h"
#define is_hex_char isxdigit
@@ -51,10 +52,7 @@ halfword pdf_catalog_toks; /* additional keys of Catalog dictionary */
halfword pdf_catalog_openaction;
halfword pdf_names_toks; /* additional keys of Names dictionary */
halfword pdf_trailer_toks; /* additional keys of Trailer dictionary */
-halfword pdf_pageattributes_toks; /* additional keys of Page dictionary */
-halfword pdf_pageresources_toks; /* additional keys of Resources dictionary */
-halfword pdf_pagesattributes_toks; /* additional keys of Pages dictionary */
-boolean is_shipping_page; /* set to |shipping_page| when |ship_out| starts */
+shipping_mode_e global_shipping_mode = NOT_SHIPPING; /* set to |shipping_mode| when |ship_out| starts */
@ |init_pdf_struct()| is called early, only once, from maincontrol.w
@@ -62,17 +60,17 @@ boolean is_shipping_page; /* set to |shipping_page| when |ship_out| starts
PDF init_pdf_struct(PDF pdf)
{
assert(pdf == NULL);
- pdf = xmalloc(sizeof(pdf_output_file));
+ pdf = xtalloc(1, pdf_output_file);
memset(pdf, 0, sizeof(pdf_output_file));
pdf->o_mode = OMODE_NONE; /* will be set by |fix_o_mode()| */
pdf->o_state = ST_INITIAL;
- pdf->os_obj = xmalloc(pdf_os_max_objs * sizeof(os_obj_data));
+ pdf->os_obj = xtalloc(pdf_os_max_objs, os_obj_data);
pdf->os_buf_size = inf_pdf_os_buf_size;
- pdf->os_buf = xmalloc((unsigned) pdf->os_buf_size * sizeof(unsigned char));
+ pdf->os_buf = xtalloc(pdf->os_buf_size, unsigned char);
pdf->op_buf_size = inf_pdf_op_buf_size;
- pdf->op_buf = xmalloc((unsigned) pdf->op_buf_size * sizeof(unsigned char));
+ pdf->op_buf = xtalloc(pdf->op_buf_size, unsigned char);
pdf->buf_size = pdf->op_buf_size;
pdf->buf = pdf->op_buf;
@@ -80,20 +78,18 @@ PDF init_pdf_struct(PDF pdf)
/* Sometimes it is neccesary to allocate memory for PDF output that cannot
be deallocated then, so we use |mem| for this purpose. */
pdf->mem_size = inf_pdf_mem_size; /* allocated size of |mem| array */
- pdf->mem = xmalloc((unsigned) ((unsigned) pdf->mem_size * sizeof(int)));
+ pdf->mem = xtalloc(pdf->mem_size, int);
pdf->mem_ptr = 1; /* the first word is not used so we can use zero as a value for testing
whether a pointer to |mem| is valid */
pdf->pstruct = NULL;
- pdf->posstruct = xmalloc(sizeof(posstructure));
+ pdf->posstruct = xtalloc(1, posstructure);
pdf->posstruct->pos.h = 0;
pdf->posstruct->pos.v = 0;
pdf->posstruct->dir = dir_TLT;
pdf->obj_tab_size = (unsigned) inf_obj_tab_size; /* allocated size of |obj_tab| array */
- pdf->obj_tab = xmalloc((unsigned)
- ((unsigned) (pdf->obj_tab_size + 1) *
- sizeof(obj_entry)));
+ pdf->obj_tab = xtalloc(pdf->obj_tab_size + 1, obj_entry);
memset(pdf->obj_tab, 0, sizeof(obj_entry));
pdf->minor_version = -1; /* unset */
@@ -114,27 +110,27 @@ PDF init_pdf_struct(PDF pdf)
pdf->page_resources = NULL;
init_pdf_pagecalculations(pdf);
+ pdf->pdflua_ref = new_pdflua();
return pdf;
}
@ @c
-static void pdf_shipout_begin(boolean shipping_page)
+static void pdf_shipout_begin()
{
pos_stack_used = 0; /* start with empty stack */
- page_mode = shipping_page;
- if (shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
colorstackpagestart();
}
}
-static void pdf_shipout_end(boolean shipping_page)
+static void pdf_shipout_end()
{
if (pos_stack_used > 0) {
pdftex_fail("%u unmatched \\pdfsave after %s shipout",
(unsigned int) pos_stack_used,
- ((shipping_page) ? "page" : "form"));
+ ((global_shipping_mode == SHIPPING_PAGE) ? "page" : "form"));
}
}
@@ -163,33 +159,36 @@ int pdf_get_mem(PDF pdf, int s)
return ret;
}
+@ |get_o_mode| translates from |pdf_output| to |o_mode|.
+
+@c
+static output_mode get_o_mode()
+{
+ output_mode o_mode;
+ if (pdf_output > 0) {
+ if (pdf_output == 2009)
+ o_mode = OMODE_LUA;
+ else
+ o_mode = OMODE_PDF;
+ } else
+ o_mode = OMODE_DVI;
+ return o_mode;
+}
@ |fix_o_mode| freezes |pdf->o_mode| as soon as anything goes through
the backend, be it \.{PDF}, \.{DVI}, or \.{Lua}.
@c
-#define pdf_output int_par(pdf_output_code)
-
void fix_o_mode(PDF pdf)
{
- static int fixed_pdf_output = 0;
- if (pdf->o_mode == OMODE_NONE) {
- if (pdf_output > 0) {
- if (pdf_output == 2009)
- pdf->o_mode = OMODE_LUA;
- else
- pdf->o_mode = OMODE_PDF;
- } else
- pdf->o_mode = OMODE_DVI;
- fixed_pdf_output = pdf_output;
- pdf_output_value = pdf_output;
- } else if (pdf_output != fixed_pdf_output) {
+ output_mode o_mode = get_o_mode();
+ 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");
- }
}
-
@ This ensures that |pdfminorversion| is set only before any bytes have
been written to the generated \.{PDF} file. Here also all variables for
\.{PDF} output are initialized, the \.{PDF} file is opened by |ensure_pdf_open|,
@@ -214,10 +213,10 @@ void fix_pdf_minorversion(PDF pdf)
pdf->minor_version = pdf_minor_version;
} else {
/* Check that variables for \.{PDF} output are unchanged */
- if (pdf->minor_version != int_par(pdf_minor_version_code))
+ if (pdf->minor_version != pdf_minor_version)
pdf_error("setup",
"\\pdfminorversion cannot be changed after data is written to the PDF file");
- if (pdf->draftmode != int_par(pdf_draftmode_code))
+ if (pdf->draftmode != pdf_draftmode)
pdf_error("setup",
"\\pdfdraftmode cannot be changed after data is written to the PDF file");
}
@@ -227,19 +226,91 @@ void fix_pdf_minorversion(PDF pdf)
}
}
+@ @c
+#define ZIP_BUF_SIZE 32768
+
+#define check_err(f, fn) \
+ if (f != Z_OK) \
+ pdftex_fail("zlib: %s() failed (error code %d)", fn, f)
+
+@ @c
+static void write_zip(PDF pdf)
+{
+ int flush, err = Z_OK;
+ uInt zip_len;
+ 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|
+ 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.
+ */
+#if 0
+ cur_file_name = NULL;
+#endif
+ if (pdf->stream_length == 0) {
+ if (s == NULL) {
+ s = pdf->c_stream = xtalloc(1, z_stream);
+ s->zalloc = (alloc_func) 0;
+ s->zfree = (free_func) 0;
+ s->opaque = (voidpf) 0;
+ check_err(deflateInit(s, pdf->compress_level), "deflateInit");
+ assert(pdf->zipbuf == NULL);
+ pdf->zipbuf = xtalloc(ZIP_BUF_SIZE, char);
+ } else
+ check_err(deflateReset(s), "deflateReset");
+ s->next_out = (Bytef *) pdf->zipbuf;
+ s->avail_out = ZIP_BUF_SIZE;
+ }
+ assert(s != NULL);
+ assert(pdf->zipbuf != NULL);
+ s->next_in = pdf->buf;
+ s->avail_in = (uInt) pdf->ptr;
+ while (true) {
+ if (s->avail_out == 0 || (finish && s->avail_out < ZIP_BUF_SIZE)) {
+ zip_len = ZIP_BUF_SIZE - s->avail_out;
+ pdf->gone += (off_t) xfwrite(pdf->zipbuf, 1, zip_len, pdf->file);
+ pdf->last_byte = pdf->zipbuf[zip_len - 1];
+ s->next_out = (Bytef *) pdf->zipbuf;
+ s->avail_out = ZIP_BUF_SIZE;
+ }
+ if (finish) {
+ if (err == Z_STREAM_END) {
+ assert(s->avail_in == 0);
+ assert(s->avail_out == ZIP_BUF_SIZE);
+ xfflush(pdf->file);
+ break;
+ }
+ flush = Z_FINISH;
+ } else {
+ if (s->avail_in == 0)
+ break;
+ flush = Z_NO_FLUSH;
+ }
+ err = deflate(s, flush);
+ if (err != Z_OK && err != Z_STREAM_END)
+ pdftex_fail("zlib: deflate() failed (error code %d)", err);
+ }
+ pdf->stream_length = (off_t) s->total_out;
+}
+
+@ @c
+void zip_free(PDF pdf)
+{
+ if (pdf->zipbuf != NULL) {
+ check_err(deflateEnd(pdf->c_stream), "deflateEnd");
+ xfree(pdf->zipbuf);
+ }
+ xfree(pdf->c_stream);
+}
+
@ The PDF buffer is flushed by calling |pdf_flush|, which checks the
variable |zip_write_state| and will compress the buffer before flushing if
neccesary. We call |pdf_begin_stream| to begin a stream and |pdf_end_stream|
to finish it. The stream contents will be compressed if compression is turn on.
@c
-static void write_pdf(PDF pdf, int a, int b)
-{
- (void) fwrite((char *) &pdf->buf[a], sizeof(pdf->buf[a]),
- (size_t) ((b) - (a) + 1), pdf->file);
-}
-
-@ @c
void pdf_flush(PDF pdf)
{ /* flush out the |pdf_buf| */
@@ -250,18 +321,19 @@ void pdf_flush(PDF pdf)
case no_zip:
if (pdf->ptr > 0) {
if (pdf->draftmode == 0)
- write_pdf(pdf, 0, pdf->ptr - 1);
+ (void) xfwrite((char *) pdf->buf, sizeof(char),
+ (size_t) pdf->ptr, pdf->file);
pdf->gone += pdf->ptr;
pdf->last_byte = pdf->buf[pdf->ptr - 1];
}
break;
case zip_writing:
if (pdf->draftmode == 0)
- write_zip(pdf, false);
+ write_zip(pdf);
break;
case zip_finish:
if (pdf->draftmode == 0)
- write_zip(pdf, true);
+ write_zip(pdf);
pdf->zip_write_state = no_zip;
break;
}
@@ -275,7 +347,7 @@ void pdf_flush(PDF pdf)
@ switch between PDF stream and object stream mode
@c
-void pdf_os_switch(PDF pdf, boolean pdf_os)
+static void pdf_os_switch(PDF pdf, boolean pdf_os)
{
if (pdf_os && pdf->os_enable) {
if (!pdf->os_mode) { /* back up PDF stream variables */
@@ -299,15 +371,14 @@ void pdf_os_switch(PDF pdf, boolean pdf_os)
@ create new \.{/ObjStm} object if required, and set up cross reference info
@c
-void pdf_os_prepare_obj(PDF pdf, int i, int pdf_os_level)
+static void pdf_os_prepare_obj(PDF pdf, int i, int pdf_os_level)
{
pdf_os_switch(pdf, ((pdf_os_level > 0)
&& (pdf->objcompresslevel >= pdf_os_level)));
if (pdf->os_mode) {
if (pdf->os_cur_objnum == 0) {
- pdf_create_obj(pdf, obj_type_objstm, pdf->sys_obj_ptr + 1);
- pdf->os_cur_objnum = pdf->sys_obj_ptr;
- pdf->obj_ptr--; /* object stream is not accessible to user */
+ pdf->os_cur_objnum =
+ pdf_create_obj(pdf, obj_type_objstm, pdf->obj_ptr + 1);
pdf->os_cntr++; /* only for statistics */
pdf->os_idx = 0;
pdf->ptr = 0; /* start fresh object stream */
@@ -385,30 +456,27 @@ void pdf_print_char(PDF pdf, int c)
pdf_print_escaped(c);
}
-void pdf_print_wide_char(PDF pdf, int c)
+@ @c
+void pdf_out_block(PDF pdf, const char *s, size_t n)
{
- char hex[5];
- snprintf(hex, 5, "%04X", c);
- pdf_room(pdf, 4);
- pdf_quick_out(pdf, (unsigned char) hex[0]);
- pdf_quick_out(pdf, (unsigned char) hex[1]);
- pdf_quick_out(pdf, (unsigned char) hex[2]);
- pdf_quick_out(pdf, (unsigned char) hex[3]);
+ size_t l;
+ do {
+ l = n;
+ if ((int) l > pdf->buf_size)
+ l = (size_t) pdf->buf_size;
+ pdf_room(pdf, (int) l);
+ (void) memcpy(pdf->buf + pdf->ptr, s, l);
+ pdf->ptr += (int) l;
+ s += l;
+ n -= l;
+ } while (n > 0);
}
-@ @c
-void pdf_puts(PDF pdf, const char *s)
+void pdf_print_wide_char(PDF pdf, int c)
{
-
- size_t l = strlen(s);
- if (l < (size_t) pdf->buf_size) {
- pdf_room(pdf, (int) l);
- while (*s != '\0')
- pdf_quick_out(pdf, *s++);
- } else {
- while (*s != '\0')
- pdf_out(pdf, *s++);
- }
+ char hex[5];
+ snprintf(hex, 5, "%04X", c);
+ pdf_out_block(pdf, (const char *) hex, 4);
}
@ @c
@@ -429,15 +497,15 @@ void pdf_printf(PDF pdf, const char *fmt, ...)
@c
void pdf_print(PDF pdf, str_number s)
{
- if (s < number_chars) {
+ const char *ss;
+ size_t l;
+ if (s >= STRING_OFFSET) {
+ ss = (const char *) str_string(s);
+ l = str_length(s);
+ pdf_out_block(pdf, ss, l);
+ } else {
assert(s < 256);
pdf_out(pdf, s);
- } else {
- unsigned char *k, *j;
- j = str_string(s) + str_length(s);
- for (k = str_string(s); k < j; k++) {
- pdf_out(pdf, *k);
- }
}
}
@@ -467,7 +535,7 @@ void pdf_print_int(PDF pdf, longinteger n)
}
do {
dig[k++] = (int) (n % 10);
- n = n / 10;
+ n /= 10;
} while (n != 0);
pdf_room(pdf, k);
while (k-- > 0) {
@@ -493,7 +561,7 @@ void pdf_print_real(PDF pdf, int m, int d)
d--;
}
while (m % 10 == 0)
- m = m / 10;
+ m /= 10;
pdf_print_int(pdf, m);
}
}
@@ -554,6 +622,18 @@ void pdf_begin_stream(PDF pdf)
}
}
+@ @c
+static void write_stream_length(PDF pdf, int length, longinteger offset)
+{
+ if (jobname_cstr == NULL)
+ jobname_cstr = makecstring(job_name);
+ if (pdf->draftmode == 0) {
+ xfseeko(pdf->file, (off_t) offset, SEEK_SET, jobname_cstr);
+ fprintf(pdf->file, "%li", (long int) length);
+ xfseeko(pdf->file, pdf_offset(pdf), SEEK_SET, jobname_cstr);
+ }
+}
+
@ end a stream
@c
void pdf_end_stream(PDF pdf)
@@ -567,8 +647,8 @@ void pdf_end_stream(PDF pdf)
write_stream_length(pdf, (int) pdf->stream_length,
pdf->stream_length_offset);
pdf->seek_write_length = false;
- if (pdf->last_byte != pdf_new_line_char)
- pdf_out(pdf, pdf_new_line_char);
+ if (pdf->last_byte != pdf_newline_char)
+ pdf_out(pdf, pdf_newline_char);
pdf_puts(pdf, "endstream\n");
pdf_end_obj(pdf);
}
@@ -579,7 +659,6 @@ void pdf_remove_last_space(PDF pdf)
pdf->ptr--;
}
-
@ To print |scaled| value to PDF output we need some subroutines to ensure
accurary.
@@ -592,14 +671,16 @@ scaled one_hundred_inch = 7227 * 65536;
/* scaled value corresponds to 1in (rounded to 4736287) */
scaled one_inch = (7227 * 65536 + 50) / 100;
- /* scaled value corresponds to 1truein (rounded!) */
+/* scaled value corresponds to 1truein (rounded!) */
scaled one_true_inch = (7227 * 65536 + 50) / 100;
/* scaled value corresponds to 100bp */
scaled one_hundred_bp = (7227 * 65536) / 72;
/* scaled value corresponds to 1bp (rounded to 65782) */
-scaled one_bp = ((7227 * 65536) / 72 + 50) / 100;
+/* changed on 20110411 to be exactly 65781, as in tex itself,
+ because this value is also used for \pdfpxdimen */
+scaled one_bp = 65781;
/* $10^0..10^9$ */
int ten_pow[10] = {
@@ -612,7 +693,7 @@ digits of precision. It is defined in C because it is a good candidate
for optimizations that are not possible in pascal.
@c
-scaled round_xn_over_d(scaled x, int n, int d)
+scaled round_xn_over_d(scaled x, int n, unsigned int d)
{
boolean positive; /* was |x>=0|? */
unsigned t, u, v; /* intermediate quantities */
@@ -630,7 +711,7 @@ scaled round_xn_over_d(scaled x, int n, int d)
else
u = 0100000 * (u / d) + (v / d);
v = v % d;
- if (2 * v >= (unsigned) d)
+ if (2 * v >= d)
u++;
if (positive)
return (scaled) u;
@@ -703,7 +784,6 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k)
void **pp;
pdf_object_list *p, *item = NULL;
assert(pdf != NULL);
- /* assert(obj_type(pdf, k) == t); *//* TODO, not yet strictly true */
re = pdf->page_resources;
assert(re != NULL);
assert(t <= PDF_OBJ_TYPE_MAX);
@@ -726,19 +806,21 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k)
("addto_page_resources(): avl_probe() out of memory in insertion");
}
if (pr->list == NULL) {
- item = xmalloc(sizeof(pdf_object_list));
+ item = xtalloc(1, pdf_object_list);
item->link = NULL;
item->info = k;
pr->list = item;
- set_obj_scheduled(pdf, k); /* k is an object number */
+ if (obj_type(pdf, k) == (int)t)
+ set_obj_scheduled(pdf, k); /* k is an object number */
} else {
for (p = pr->list; p->info != k && p->link != NULL; p = p->link);
if (p->info != k) {
- item = xmalloc(sizeof(pdf_object_list));
+ item = xtalloc(1, pdf_object_list);
item->link = NULL;
item->info = k;
p->link = item;
- set_obj_scheduled(pdf, k);
+ if (obj_type(pdf, k) == (int)t)
+ set_obj_scheduled(pdf, k);
}
}
}
@@ -797,38 +879,34 @@ static void destroy_page_resources_tree(PDF pdf)
@* Subroutines to print out various PDF objects.
-@ print out an integer with fixed width; used for outputting cross-reference table
+@ print out an integer |n| with fixed width |w|; used for outputting cross-reference table
@c
-void pdf_print_fw_int(PDF pdf, longinteger n, int w)
+static void pdf_print_fw_int(PDF pdf, longinteger n, size_t w)
{
int k; /* $0\le k\le23$ */
- int dig[24];
- k = 0;
+ unsigned char digits[24];
+ k = (int) w;
do {
- dig[k] = (int) (n % 10);
- n = n / 10;
- k++;
- } while (k != w);
- pdf_room(pdf, k);
- while (k-- > 0)
- pdf_quick_out(pdf, (unsigned char) ('0' + dig[k]));
+ k--;
+ digits[k] = (unsigned char) ('0' + (n % 10));
+ n /= 10;
+ } while (k != 0);
+ pdf_out_block(pdf, (const char *) digits, w);
}
-@ print out an integer as a number of bytes; used for outputting \.{/XRef} cross-reference stream
+@ print out an integer |n| as a fixed number |w| of bytes; used for outputting \.{/XRef} cross-reference stream
@c
-void pdf_out_bytes(PDF pdf, longinteger n, int w)
+static void pdf_out_bytes(PDF pdf, longinteger n, size_t w)
{
int k;
- int bytes[8]; /* digits in a number being output */
- k = 0;
+ unsigned char bytes[8]; /* digits in a number being output */
+ k = (int) w;
do {
- bytes[k] = (int) (n % 256);
- n = n / 256;
- k++;
- } while (k != w);
- pdf_room(pdf, k);
- while (k-- > 0)
- pdf_quick_out(pdf, bytes[k]);
+ k--;
+ bytes[k] = (unsigned char) (n % 256);
+ n /= 256;
+ } while (k != 0);
+ pdf_out_block(pdf, (const char *) bytes, w);
}
@ print out an entry in dictionary with integer value to PDF buffer
@@ -1062,42 +1140,6 @@ void ensure_output_state(PDF pdf, output_state s)
}
}
-@ begin a PDF dictionary object
-@c
-void pdf_begin_dict(PDF pdf, int i, int pdf_os_level)
-{
- ensure_output_state(pdf, ST_HEADER_WRITTEN);
- pdf_os_prepare_obj(pdf, i, pdf_os_level);
- if (!pdf->os_mode) {
- pdf_printf(pdf, "%d 0 obj <<\n", (int) i);
- } else {
- if (pdf->compress_level == 0)
- pdf_printf(pdf, "%% %d 0 obj\n", (int) i); /* debugging help */
- pdf_puts(pdf, "<<\n");
- }
-}
-
-@ begin a new PDF dictionary object
-@c
-void pdf_new_dict(PDF pdf, int t, int i, int pdf_os)
-{
- pdf_create_obj(pdf, t, i);
- pdf_begin_dict(pdf, pdf->obj_ptr, pdf_os);
-}
-
-@ end a PDF dictionary object
-@c
-void pdf_end_dict(PDF pdf)
-{
- if (pdf->os_mode) {
- pdf_puts(pdf, ">>\n");
- if (pdf->os_idx == pdf_os_max_objs - 1)
- pdf_os_write_objstream(pdf);
- } else {
- pdf_puts(pdf, ">> endobj\n");
- }
-}
-
@ Write out an accumulated object stream.
First the object number and byte offset pairs are generated
@@ -1108,7 +1150,7 @@ copied to the PDF output buffer, where also compression is done.
When calling this procedure, |pdf_os_mode| must be |true|.
@c
-void pdf_os_write_objstream(PDF pdf)
+static void pdf_os_write_objstream(PDF pdf)
{
halfword i, j, p, q;
if (pdf->os_cur_objnum == 0) /* no object stream started */
@@ -1120,7 +1162,7 @@ void pdf_os_write_objstream(PDF pdf)
pdf_printf(pdf, "%d %d", (int) pdf->os_obj[i].num,
(int) pdf->os_obj[i].off);
if (j == 9) { /* print out in groups of ten for better readability */
- pdf_out(pdf, pdf_new_line_char);
+ pdf_out(pdf, pdf_newline_char);
j = 0;
} else {
pdf_out(pdf, ' ');
@@ -1128,19 +1170,16 @@ void pdf_os_write_objstream(PDF pdf)
}
i++;
}
- pdf->buf[pdf->ptr - 1] = pdf_new_line_char; /* no risk of flush, as we are in |pdf_os_mode| */
+ pdf->buf[pdf->ptr - 1] = pdf_newline_char; /* no risk of flush, as we are in |pdf_os_mode| */
q = pdf->ptr;
pdf_begin_dict(pdf, pdf->os_cur_objnum, 0); /* switch to PDF stream writing */
pdf_puts(pdf, "/Type /ObjStm\n");
pdf_printf(pdf, "/N %d\n", (int) (pdf->os_idx + 1));
pdf_printf(pdf, "/First %d\n", (int) (q - p));
pdf_begin_stream(pdf);
- pdf_room(pdf, q - p); /* should always fit into the PDF output buffer */
- i = p;
- while (i < q) { /* write object number and byte offset pairs */
- pdf_quick_out(pdf, pdf->os_buf[i]);
- i++;
- }
+ /* write object number and byte offset pairs;
+ |q - p| should always fit into the PDF output buffer */
+ pdf_out_block(pdf, (const char *) (pdf->os_buf + p), (size_t) (q - p));
i = 0;
while (i < p) {
q = i + pdf->buf_size;
@@ -1156,6 +1195,43 @@ void pdf_os_write_objstream(PDF pdf)
pdf->os_cur_objnum = 0; /* to force object stream generation next time */
}
+@ begin a PDF dictionary object
+@c
+void pdf_begin_dict(PDF pdf, int i, int pdf_os_level)
+{
+ ensure_output_state(pdf, ST_HEADER_WRITTEN);
+ pdf_os_prepare_obj(pdf, i, pdf_os_level);
+ if (!pdf->os_mode) {
+ pdf_printf(pdf, "%d 0 obj\n<<\n", (int) i);
+ } else {
+ if (pdf->compress_level == 0)
+ pdf_printf(pdf, "%% %d 0 obj\n", (int) i); /* debugging help */
+ pdf_puts(pdf, "<<\n");
+ }
+}
+
+@ begin a new PDF dictionary object
+@c
+int pdf_new_dict(PDF pdf, int t, int i, int pdf_os_level)
+{
+ int k = pdf_create_obj(pdf, t, i);
+ pdf_begin_dict(pdf, k, pdf_os_level);
+ return k;
+}
+
+@ end a PDF dictionary object
+@c
+void pdf_end_dict(PDF pdf)
+{
+ if (pdf->os_mode) {
+ pdf_puts(pdf, ">>\n");
+ if (pdf->os_idx == pdf_os_max_objs - 1)
+ pdf_os_write_objstream(pdf);
+ } else {
+ pdf_puts(pdf, ">>\nendobj\n");
+ }
+}
+
@ begin a PDF object
@c
void pdf_begin_obj(PDF pdf, int i, int pdf_os_level)
@@ -1171,10 +1247,11 @@ void pdf_begin_obj(PDF pdf, int i, int pdf_os_level)
@ begin a new PDF object
@c
-void pdf_new_obj(PDF pdf, int t, int i, int pdf_os)
+int pdf_new_obj(PDF pdf, int t, int i, int pdf_os_level)
{
- pdf_create_obj(pdf, t, i);
- pdf_begin_obj(pdf, pdf->obj_ptr, pdf_os);
+ int k = pdf_create_obj(pdf, t, i);
+ pdf_begin_obj(pdf, k, pdf_os_level);
+ return k;
}
@ end a PDF object
@@ -1189,18 +1266,6 @@ void pdf_end_obj(PDF pdf)
}
}
-@ @c
-void write_stream_length(PDF pdf, int length, longinteger offset)
-{
- if (jobname_cstr == NULL)
- jobname_cstr = makecstring(job_name);
- if (pdf->draftmode == 0) {
- xfseeko(pdf->file, (off_t) offset, SEEK_SET, jobname_cstr);
- fprintf(pdf->file, "%li", (long int) length);
- xfseeko(pdf->file, pdf_offset(pdf), SEEK_SET, jobname_cstr);
- }
-}
-
@ Converts any string given in in in an allowed PDF string which can be
handled by printf et.al.: \.{\\} is escaped to \.{\\\\}, parenthesis are escaped and
control characters are octal encoded.
@@ -1297,7 +1362,7 @@ static void convertStringToHexString(const char *in, char *out, int lin)
implementation using just the first two items.
@c
-void print_ID(PDF pdf, const char *file_name)
+static void print_ID(PDF pdf, const char *file_name)
{
time_t t;
size_t size;
@@ -1440,14 +1505,14 @@ void init_start_time(PDF pdf)
}
@ @c
-void print_creation_date(PDF pdf)
+static void print_creation_date(PDF pdf)
{
init_start_time(pdf);
pdf_printf(pdf, "/CreationDate (%s)\n", pdf->start_time_str);
}
@ @c
-void print_mod_date(PDF pdf)
+static void print_mod_date(PDF pdf)
{
init_start_time(pdf);
pdf_printf(pdf, "/ModDate (%s)\n", pdf->start_time_str);
@@ -1534,82 +1599,6 @@ void fb_free(PDF pdf)
}
@ @c
-#define ZIP_BUF_SIZE 32768
-
-#define check_err(f, fn) \
- if (f != Z_OK) \
- pdftex_fail("zlib: %s() failed (error code %d)", fn, f)
-
-@ @c
-void write_zip(PDF pdf, boolean finish)
-{
- int err;
- int level = pdf->compress_level;
- assert(level > 0);
- /* This was just to suppress the filename report in |pdftex_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.
- */
-#if 0
- cur_file_name = NULL;
-#endif
- if (pdf->stream_length == 0) {
- if (pdf->zipbuf == NULL) {
- pdf->zipbuf = xtalloc(ZIP_BUF_SIZE, char);
- pdf->c_stream.zalloc = (alloc_func) 0;
- pdf->c_stream.zfree = (free_func) 0;
- pdf->c_stream.opaque = (voidpf) 0;
- check_err(deflateInit(&pdf->c_stream, level), "deflateInit");
- } else {
- check_err(deflateReset(&pdf->c_stream), "deflateReset");
- }
- pdf->c_stream.next_out = (Bytef *) pdf->zipbuf;
- pdf->c_stream.avail_out = ZIP_BUF_SIZE;
- }
- assert(pdf->zipbuf != NULL);
- pdf->c_stream.next_in = pdf->buf;
- pdf->c_stream.avail_in = (uInt) pdf->ptr;
- for (;;) {
- if (pdf->c_stream.avail_out == 0) {
- pdf->gone =
- pdf->gone + (off_t) xfwrite(pdf->zipbuf, 1, ZIP_BUF_SIZE,
- pdf->file);
- pdf->last_byte = pdf->zipbuf[ZIP_BUF_SIZE - 1]; /* not needed */
- pdf->c_stream.next_out = (Bytef *) pdf->zipbuf;
- pdf->c_stream.avail_out = ZIP_BUF_SIZE;
- }
- err = deflate(&pdf->c_stream, finish ? Z_FINISH : Z_NO_FLUSH);
- if (finish && err == Z_STREAM_END)
- break;
- check_err(err, "deflate");
- if (!finish && pdf->c_stream.avail_in == 0)
- break;
- }
- if (finish) {
- if (pdf->c_stream.avail_out < ZIP_BUF_SIZE) { /* at least one byte has been output */
- pdf->gone = pdf->gone +
- (off_t) xfwrite(pdf->zipbuf, 1,
- (size_t) (ZIP_BUF_SIZE -
- pdf->c_stream.avail_out), pdf->file);
- pdf->last_byte =
- pdf->zipbuf[ZIP_BUF_SIZE - pdf->c_stream.avail_out - 1];
- }
- xfflush(pdf->file);
- }
- pdf->stream_length = (off_t) pdf->c_stream.total_out;
-}
-
-@ @c
-void zip_free(PDF pdf)
-{
- if (pdf->zipbuf != NULL) {
- check_err(deflateEnd(&pdf->c_stream), "deflateEnd");
- free(pdf->zipbuf);
- }
-}
-
-@ @c
void pdf_error(const char *t, const char *p)
{
normalize_selector();
@@ -1661,15 +1650,9 @@ void check_o_mode(PDF pdf, const char *s, int o_mode_bitpattern, boolean strict)
in possibly wrong state until real output, ok.
*/
- if (pdf->o_mode == OMODE_NONE) {
- if (pdf_output > 0) {
- if (pdf_output == 2009)
- o_mode = OMODE_LUA;
- else
- o_mode = OMODE_PDF;
- } else
- o_mode = OMODE_DVI;
- } else
+ if (pdf->o_mode == OMODE_NONE)
+ o_mode = get_o_mode();
+ else
o_mode = pdf->o_mode;
if (!((1 << o_mode) & o_mode_bitpattern)) { /* warning or error */
switch (o_mode) {
@@ -1750,26 +1733,27 @@ char *get_resname_prefix(PDF pdf)
#define pdf_xform_attr equiv(pdf_xform_attr_loc)
#define pdf_xform_resources equiv(pdf_xform_resources_loc)
-void pdf_begin_page(PDF pdf, boolean shipping_page)
+void pdf_begin_page(PDF pdf)
{
- scaled form_margin = one_bp;
+ scaled form_margin = 0; /* was one_bp until SVN4066 */
ensure_output_state(pdf, ST_HEADER_WRITTEN);
init_pdf_pagecalculations(pdf);
if (pdf->page_resources == NULL) {
- pdf->page_resources = xmalloc(sizeof(pdf_resource_struct));
+ pdf->page_resources = xtalloc(1, pdf_resource_struct);
pdf->page_resources->resources_tree = NULL;
}
pdf->page_resources->last_resources = pdf_new_objnum(pdf);
reset_page_resources(pdf);
- if (shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
pdf->last_page = get_obj(pdf, obj_type_page, total_pages + 1, 0);
set_obj_aux(pdf, pdf->last_page, 1); /* mark that this page has been created */
- pdf_new_dict(pdf, obj_type_pagestream, 0, 0);
- pdf->last_stream = pdf->obj_ptr;
+ pdf->last_stream = pdf_new_dict(pdf, obj_type_pagestream, 0, 0);
pdf->last_thread = null;
+ pdflua_begin_page(pdf);
} else {
+ assert(global_shipping_mode == SHIPPING_FORM);
pdf_begin_dict(pdf, pdf_cur_form, 0);
pdf->last_stream = pdf_cur_form;
@@ -1798,7 +1782,7 @@ void pdf_begin_page(PDF pdf, boolean shipping_page)
}
/* Start stream of page/form contents */
pdf_begin_stream(pdf);
- if (shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
/* Adjust transformation matrix for the magnification ratio */
if (mag != 1000) {
pdf_print_real(pdf, mag, 3);
@@ -1807,35 +1791,52 @@ void pdf_begin_page(PDF pdf, boolean shipping_page)
pdf_puts(pdf, " 0 0 cm\n");
}
}
- pdf_shipout_begin(shipping_page);
+ pdf_shipout_begin();
- if (shipping_page)
+ if (global_shipping_mode == SHIPPING_PAGE)
pdf_out_colorstack_startpage(pdf);
}
@ @c
+void print_pdf_table_string(PDF pdf, const char *s)
+{
+ size_t len;
+ const char *ls;
+ lua_getglobal(Luas, "pdf"); /* t ... */
+ lua_pushstring(Luas, s); /* s t ... */
+ lua_gettable(Luas, -2); /* s? t ... */
+ if (lua_isstring(Luas, -1)) { /* s t ... */
+ ls = lua_tolstring(Luas, -1, &len);
+ pdf_out_block(pdf, ls, len);
+ pdf_out(pdf, '\n');
+ }
+ lua_pop(Luas, 2); /* ... */
+}
+
+@ @c
#define pdf_page_attr equiv(pdf_page_attr_loc)
#define pdf_page_resources equiv(pdf_page_resources_loc)
-void pdf_end_page(PDF pdf, boolean shipping_page)
+void pdf_end_page(PDF pdf)
{
- int j;
+ int j, annots = 0, beads = 0;
pdf_resource_struct *res_p = pdf->page_resources;
pdf_resource_struct local_page_resources;
- pdf_object_list *ol, *ol1;
+ pdf_object_list *annot_list, *bead_list, *link_list, *ol, *ol1;
scaledpos save_cur_page_size; /* to save |cur_page_size| during flushing pending forms */
+ shipping_mode_e save_shipping_mode;
int procset = PROCSET_PDF;
/* Finish stream of page/form contents */
pdf_goto_pagemode(pdf);
- pdf_shipout_end(shipping_page);
+ pdf_shipout_end();
pdf_end_stream(pdf);
- if (shipping_page) {
- /* Write out page object */
+ if (global_shipping_mode == SHIPPING_PAGE) {
+ pdf->last_pages = pdf_do_page_divert(pdf, pdf->last_page, 0);
+ /* Write out /Page object */
pdf_begin_dict(pdf, pdf->last_page, 1);
- pdf->last_pages = pdf_do_page_divert(pdf, pdf->last_page, 0);
pdf_puts(pdf, "/Type /Page\n");
pdf_indirect_ln(pdf, "Contents", pdf->last_stream);
pdf_indirect_ln(pdf, "Resources", res_p->last_resources);
@@ -1846,33 +1847,57 @@ void pdf_end_page(PDF pdf, boolean shipping_page)
pdf_puts(pdf, "]\n");
if (pdf_page_attr != null)
pdf_print_toks_ln(pdf, pdf_page_attr);
- if (pdf_pageattributes_toks != null) /* from Lua */
- pdf_print_toks_ln(pdf, pdf_pageattributes_toks);
+ print_pdf_table_string(pdf, "pageattributes");
pdf_indirect_ln(pdf, "Parent", pdf->last_pages);
- if (pdf->img_page_group_val > 0) {
+ if (pdf->img_page_group_val != 0) {
+ assert(pdf->img_page_group_val > 0);
pdf_printf(pdf, "/Group %d 0 R\n", pdf->img_page_group_val);
- pdf->img_page_group_val = 0;
}
+ annot_list = get_page_resources_list(pdf, obj_type_annot);
+ link_list = get_page_resources_list(pdf, obj_type_link);
+ if (annot_list != NULL || link_list != NULL) {
+ annots = pdf_create_obj(pdf, obj_type_annots, 0);
+ pdf_indirect_ln(pdf, "Annots", annots);
+ }
+ bead_list = get_page_resources_list(pdf, obj_type_bead);
+ if (bead_list != NULL) {
+ beads = pdf_create_obj(pdf, obj_type_beads, 0);
+ pdf_indirect_ln(pdf, "B", beads);
+ }
+ pdf_end_dict(pdf);
+ pdflua_end_page(pdf, annots, beads);
+
+ pdf->img_page_group_val = 0;
+
/* Generate array of annotations or beads in page */
- ol = get_page_resources_list(pdf, obj_type_annot);
- ol1 = get_page_resources_list(pdf, obj_type_link);
- if (ol != NULL || ol1 != NULL) {
- pdf_puts(pdf, "/Annots [ ");
- while (ol != NULL) {
- assert(ol->info > 0);
- pdf_print_int(pdf, ol->info);
+ if (annot_list != NULL || link_list != NULL) {
+ pdf_begin_obj(pdf, annots, 1);
+ pdf_puts(pdf, "[");
+ while (annot_list != NULL) {
+ assert(annot_list->info > 0);
+ pdf_print_int(pdf, annot_list->info);
pdf_puts(pdf, " 0 R ");
- ol = ol->link;
+ annot_list = annot_list->link;
}
- while (ol1 != NULL) {
- pdf_print_int(pdf, ol1->info);
+ while (link_list != NULL) {
+ pdf_print_int(pdf, link_list->info);
pdf_puts(pdf, " 0 R ");
- ol1 = ol1->link;
+ link_list = link_list->link;
}
pdf_puts(pdf, "]\n");
+ pdf_end_obj(pdf);
+ }
+ if (bead_list != NULL) {
+ pdf_begin_dict(pdf, beads, 1);
+ pdf_puts(pdf, "[");
+ while (bead_list != NULL) {
+ pdf_print_int(pdf, bead_list->info);
+ pdf_printf(pdf, " 0 R ");
+ bead_list = bead_list->link;
+ }
+ pdf_printf(pdf, "]\n");
+ pdf_end_dict(pdf);
}
- print_beads_list(pdf);
- pdf_end_dict(pdf);
}
/* Write out resource lists */
@@ -1894,11 +1919,13 @@ void pdf_end_page(PDF pdf, boolean shipping_page)
if (!is_obj_written(pdf, ol->info)) {
pdf_cur_form = ol->info;
save_cur_page_size = cur_page_size;
+ save_shipping_mode = global_shipping_mode;
pdf->page_resources = &local_page_resources;
local_page_resources.resources_tree = NULL;
- ship_out(pdf, obj_xform_box(pdf, pdf_cur_form), false);
+ ship_out(pdf, obj_xform_box(pdf, pdf_cur_form), SHIPPING_FORM);
/* Restore page size and page resources */
cur_page_size = save_cur_page_size;
+ global_shipping_mode = save_shipping_mode;
destroy_page_resources_tree(pdf);
pdf->page_resources = res_p;
}
@@ -1913,12 +1940,12 @@ void pdf_end_page(PDF pdf, boolean shipping_page)
ol = ol->link;
}
- if (shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
/* Write out pending PDF marks */
/* Write out PDF annotations */
ol = get_page_resources_list(pdf, obj_type_annot);
while (ol != NULL) {
- if (ol->info > 0) {
+ if (ol->info > 0 && obj_type(pdf, ol->info) == obj_type_annot) {
j = obj_annot_ptr(pdf, ol->info); /* |j| points to |pdf_annot_node| */
pdf_begin_dict(pdf, ol->info, 1);
pdf_puts(pdf, "/Type /Annot\n");
@@ -1967,11 +1994,10 @@ void pdf_end_page(PDF pdf, boolean shipping_page)
/* Write out resources dictionary */
pdf_begin_dict(pdf, res_p->last_resources, 1);
/* Print additional resources */
- if (shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
if (pdf_page_resources != null)
pdf_print_toks_ln(pdf, pdf_page_resources);
- if (pdf_pageresources_toks != null) /* from Lua */
- pdf_print_toks_ln(pdf, pdf_pageresources_toks);
+ print_pdf_table_string(pdf, "pageresources");
} else {
if (pdf_xform_resources != null)
pdf_print_toks_ln(pdf, pdf_xform_resources);
@@ -2045,9 +2071,6 @@ void pdf_end_page(PDF pdf, boolean shipping_page)
@* Finishing the PDF output file.
-@ @c
-#define pdf_gen_tounicode int_par(pdf_gen_tounicode_code)
-
@ Destinations that have been referenced but don't exists have
|obj_dest_ptr=null|. Leaving them undefined might cause troubles for
PDF browsers, so we need to fix them; they point to the last page.
@@ -2111,13 +2134,14 @@ static boolean substr_of_str(const char *s, const char *t)
return true;
}
-static void pdf_print_info(PDF pdf, int luatex_version, str_number luatex_revision)
+static int pdf_print_info(PDF pdf, int luatex_version,
+ str_number luatex_revision)
{ /* print info object */
boolean creator_given, producer_given, creationdate_given, moddate_given,
trapped_given;
char *s = NULL;
- int len = 0;
- pdf_new_dict(pdf, obj_type_others, 0, 3); /* keep Info readable unless explicitely forced */
+ int k, len = 0;
+ k = pdf_new_dict(pdf, obj_type_info, 0, 3); /* keep Info readable unless explicitely forced */
creator_given = false;
producer_given = false;
creationdate_given = false;
@@ -2140,7 +2164,6 @@ static void pdf_print_info(PDF pdf, int luatex_version, str_number luatex_revisi
pdf_out(pdf, '.');
pdf_print(pdf, luatex_revision);
pdf_puts(pdf, ")\n");
-
}
if (pdf_info_toks != null) {
if (len > 0) {
@@ -2164,6 +2187,7 @@ static void pdf_print_info(PDF pdf, int luatex_version, str_number luatex_revisi
}
pdf_str_entry_ln(pdf, "PTEX.Fullbanner", pdftex_banner);
pdf_end_dict(pdf);
+ return k;
}
static void build_free_object_list(PDF pdf)
@@ -2171,7 +2195,7 @@ static void build_free_object_list(PDF pdf)
int k, l;
l = 0;
set_obj_fresh(pdf, l); /* null object at begin of list of free objects */
- for (k = 1; k <= pdf->sys_obj_ptr; k++) {
+ for (k = 1; k <= pdf->obj_ptr; k++) {
if (!is_obj_written(pdf, k)) {
set_obj_link(pdf, l, k);
l = k;
@@ -2188,9 +2212,10 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
{
boolean res;
int i, j, k;
- int root, outlines, threads, names_tree;
- int xref_offset_width;
+ int root, info, xref_stm = 0, outlines, threads, names_tree;
+ size_t xref_offset_width;
int callback_id = callback_defined(stop_run_callback);
+ int callback_id1 = callback_defined(finish_pdffile_callback);
if (total_pages == 0) {
if (callback_id == 0) {
@@ -2204,6 +2229,8 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
if (pdf->draftmode == 0) {
pdf_flush(pdf); /* to make sure that the output file name has been already created */
flush_jbig2_page0_objects(pdf); /* flush page 0 objects from JBIG2 images, if any */
+ if (callback_id1 > 0)
+ res = run_callback(callback_id1, "->");
check_nonexisting_pages(pdf);
check_nonexisting_destinations(pdf);
@@ -2250,6 +2277,7 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
write_fontstuff(pdf);
pdf->last_pages = output_pages_tree(pdf);
+ pdflua_output_pages_tree(pdf);
/* Output outlines */
outlines = print_outlines(pdf);
@@ -2265,8 +2293,7 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
/* Output article threads */
if (pdf->head_tab[obj_type_thread] != 0) {
- pdf_new_obj(pdf, obj_type_others, 0, 1);
- threads = pdf->obj_ptr;
+ threads = pdf_new_obj(pdf, obj_type_others, 0, 1);
pdf_out(pdf, '[');
k = pdf->head_tab[obj_type_thread];
while (k != 0) {
@@ -2286,9 +2313,8 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
threads = 0;
}
- /* Output the catalog object */
- pdf_new_dict(pdf, obj_type_others, 0, 1);
- root = pdf->obj_ptr;
+ /* Output the /Catalog object */
+ root = pdf_new_dict(pdf, obj_type_catalog, 0, 1);
pdf_puts(pdf, "/Type /Catalog\n");
pdf_indirect_ln(pdf, "Pages", pdf->last_pages);
if (threads != 0)
@@ -2306,7 +2332,8 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
pdf_indirect_ln(pdf, "OpenAction", pdf_catalog_openaction);
pdf_end_dict(pdf);
- pdf_print_info(pdf, luatex_version, luatex_revision); /* last candidate for object stream */
+ /* last candidate for object stream */
+ info = pdf_print_info(pdf, luatex_version, luatex_revision); /* final object for pdf->os_enable == false */
if (pdf->os_enable) {
pdf_os_switch(pdf, true);
@@ -2314,12 +2341,12 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
pdf_flush(pdf);
pdf_os_switch(pdf, false);
/* Output the cross-reference stream dictionary */
- pdf_new_dict(pdf, obj_type_others, 0, 0);
- if ((obj_offset(pdf, pdf->sys_obj_ptr) / 256) > 16777215)
+ xref_stm = pdf_new_dict(pdf, obj_type_others, 0, 0); /* final object for pdf->os_enable == true */
+ if ((obj_offset(pdf, pdf->obj_ptr) / 256) > 16777215)
xref_offset_width = 5;
- else if (obj_offset(pdf, pdf->sys_obj_ptr) > 16777215)
+ else if (obj_offset(pdf, pdf->obj_ptr) > 16777215)
xref_offset_width = 4;
- else if (obj_offset(pdf, pdf->sys_obj_ptr) > 65535)
+ else if (obj_offset(pdf, pdf->obj_ptr) > 65535)
xref_offset_width = 3;
else
xref_offset_width = 2;
@@ -2331,10 +2358,10 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
pdf_puts(pdf, "]\n");
pdf_int_entry_ln(pdf, "Size", pdf->obj_ptr + 1);
pdf_puts(pdf, "/W [1 ");
- pdf_print_int(pdf, xref_offset_width);
+ pdf_print_int(pdf, (int) xref_offset_width);
pdf_puts(pdf, " 1]\n");
pdf_indirect_ln(pdf, "Root", root);
- pdf_indirect_ln(pdf, "Info", pdf->obj_ptr - 1);
+ pdf_indirect_ln(pdf, "Info", info);
if (pdf_trailer_toks != null) {
pdf_print_toks_ln(pdf, pdf_trailer_toks);
delete_token_ref(pdf_trailer_toks);
@@ -2343,7 +2370,7 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
print_ID(pdf, pdf->file_name);
pdf_print_nl(pdf);
pdf_begin_stream(pdf);
- for (k = 0; k <= pdf->sys_obj_ptr; k++) {
+ for (k = 0; k <= pdf->obj_ptr; k++) {
if (!is_obj_written(pdf, k)) { /* a free object */
pdf_out(pdf, 0);
pdf_out_bytes(pdf, obj_link(pdf, k), xref_offset_width);
@@ -2391,9 +2418,9 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
if (!pdf->os_enable) {
pdf_puts(pdf, "trailer\n");
pdf_puts(pdf, "<< ");
- pdf_int_entry_ln(pdf, "Size", pdf->sys_obj_ptr + 1);
+ pdf_int_entry_ln(pdf, "Size", pdf->obj_ptr + 1);
pdf_indirect_ln(pdf, "Root", root);
- pdf_indirect_ln(pdf, "Info", pdf->sys_obj_ptr);
+ pdf_indirect_ln(pdf, "Info", info);
if (pdf_trailer_toks != null) {
pdf_print_toks_ln(pdf, pdf_trailer_toks);
delete_token_ref(pdf_trailer_toks);
@@ -2404,7 +2431,7 @@ void finish_pdf_file(PDF pdf, int luatex_version, str_number luatex_revision)
}
pdf_puts(pdf, "startxref\n");
if (pdf->os_enable)
- pdf_print_int_ln(pdf, obj_offset(pdf, pdf->sys_obj_ptr));
+ pdf_print_int_ln(pdf, obj_offset(pdf, xref_stm));
else
pdf_print_int_ln(pdf, pdf_saved_offset(pdf));
pdf_puts(pdf, "%%EOF\n");
@@ -2470,8 +2497,7 @@ void scan_pdfcatalog(PDF pdf)
} else {
check_o_mode(pdf, "\\pdfcatalog", 1 << OMODE_PDF, true);
p = scan_action(pdf);
- pdf_new_obj(pdf, obj_type_others, 0, 1);
- pdf_catalog_openaction = pdf->obj_ptr;
+ pdf_catalog_openaction = pdf_new_obj(pdf, obj_type_others, 0, 1);
write_action(pdf, p);
pdf_end_obj(pdf);
delete_action_ref(p);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
index 6eb6d9fc5b2..6e6c4b26dca 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfglyph.w 3703 2010-05-27 07:58:34Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/pdf/pdfglyph.w $";
+ "$Id: pdfglyph.w 4131 2011-04-11 13:41:26Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfglyph.w $";
#include "ptexlib.h"
@@ -107,16 +107,17 @@ static void print_tm(PDF pdf, pdffloat * tm)
}
@ @c
-static void set_textmatrix(PDF pdf, scaledpos pos, boolean force)
+static void set_textmatrix(PDF pdf, scaledpos pos)
{
boolean move;
pdfstructure *p = pdf->pstruct;
assert(is_textmode(p));
move = calc_pdfpos(p, pos);
- if (force || move) {
+ if (p->need_tm == 1 || move) {
print_tm(pdf, p->tm);
p->pdf.h.m = p->pdf_bt_pos.h.m + p->tm[4].m; /* Tm replaces */
p->pdf.v.m = p->pdf_bt_pos.v.m + p->tm[5].m;
+ p->need_tm = 0;
}
}
@@ -183,9 +184,9 @@ void pdf_place_glyph(PDF pdf, internal_font_number f, int c)
setup_fontparameters(pdf, f);
if (p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m) {
set_font(pdf);
- set_textmatrix(pdf, pos, true); /* force Tm setting */
- } else
- set_textmatrix(pdf, pos, false);
+ p->need_tm = 1; /* force Tm setting */
+ }
+ set_textmatrix(pdf, pos);
begin_chararray(pdf);
}
assert(is_charmode(p) || is_chararraymode(p));
@@ -197,7 +198,7 @@ void pdf_place_glyph(PDF pdf, internal_font_number f, int c)
&& (p->pdf_bt_pos.h.m + p->tm[4].m) != p->pdf.h.m)
|| abs(p->tj_delta.m) >= 1000000) {
pdf_goto_textmode(pdf);
- set_textmatrix(pdf, pos, false);
+ set_textmatrix(pdf, pos);
begin_chararray(pdf);
move = calc_pdfpos(p, pos);
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w
index 5fbdc037912..cc1e20c1870 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w
@@ -20,7 +20,7 @@
@ @c
static const char _svn_version[] =
"$Id: pdfimage.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfimage.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfimage.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 517f0079a01..4cdfa711ed6 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdflink.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdflink.w $";
+ "$Id: pdflink.w 3891 2010-09-14 23:02:24Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdflink.w $";
#include "ptexlib.h"
@@ -37,7 +37,7 @@ void push_link_level(PDF pdf, halfword p)
if (pdf->link_stack_ptr >= pdf_max_link_level)
overflow("pdf link stack size", pdf_max_link_level);
assert(((type(p) == whatsit_node) && (subtype(p) == pdf_start_link_node)));
- incr(pdf->link_stack_ptr);
+ pdf->link_stack_ptr++;
pdf->link_stack[pdf->link_stack_ptr].nesting_level = cur_s;
pdf->link_stack[pdf->link_stack_ptr].link_node = copy_node_list(p);
pdf->link_stack[pdf->link_stack_ptr].ref_link_node = p;
@@ -48,7 +48,7 @@ void pop_link_level(PDF pdf)
{
assert(pdf->link_stack_ptr > 0);
flush_node_list(pdf->link_stack[pdf->link_stack_ptr].link_node);
- decr(pdf->link_stack_ptr);
+ pdf->link_stack_ptr--;
}
@ @c
@@ -57,7 +57,7 @@ void do_link(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
scaled_whd alt_rule;
if (type(p) == vlist_node)
pdf_error("ext4", "\\pdfstartlink ended up in vlist");
- if (!is_shipping_page)
+ if (global_shipping_mode == SHIPPING_FORM)
pdf_error("ext4", "link annotations cannot be inside an XForm");
assert(type(parent_box) == hlist_node);
if (is_obj_scheduled(pdf, pdf_link_objnum(p)))
@@ -90,7 +90,7 @@ void end_link(PDF pdf, halfword p)
if (is_running(width(pdf->link_stack[pdf->link_stack_ptr].link_node))) {
q = pdf->link_stack[pdf->link_stack_ptr].ref_link_node;
- if (is_shipping_page && matrixused()) {
+ if (global_shipping_mode == SHIPPING_PAGE && matrixused()) {
matrixrecalculate(pos.h + pdf_link_margin);
pdf_ann_left(q) = getllx() - pdf_link_margin;
pdf_ann_top(q) = cur_page_size.v - getury() - pdf_link_margin;
@@ -128,6 +128,7 @@ node, in order to use |flush_node_list| to do the job.
void append_link(PDF pdf, halfword parent_box, scaledpos cur, small_number i)
{
halfword p;
+ int k;
scaled_whd alt_rule;
assert(type(parent_box) == hlist_node);
p = copy_node(pdf->link_stack[(int) i].link_node);
@@ -137,9 +138,9 @@ void append_link(PDF pdf, halfword parent_box, scaledpos cur, small_number i)
alt_rule.ht = height(p);
alt_rule.dp = depth(p);
set_rect_dimens(pdf, p, parent_box, cur, alt_rule, pdf_link_margin);
- pdf_create_obj(pdf, obj_type_others, 0);
- obj_annot_ptr(pdf, pdf->obj_ptr) = p;
- addto_page_resources(pdf, obj_type_link, pdf->obj_ptr);
+ k = pdf_create_obj(pdf, obj_type_others, 0);
+ obj_annot_ptr(pdf, k) = p;
+ addto_page_resources(pdf, obj_type_link, k);
}
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
index 67be319082e..397c09902c7 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
@@ -21,8 +21,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdflistout.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdflistout.w $";
+ "$Id: pdflistout.w 3891 2010-09-14 23:02:24Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdflistout.w $";
#include "ptexlib.h"
@@ -221,9 +221,9 @@ static halfword calculate_width_to_enddir(halfword p, real cur_glue,
case whatsit_node:
if (subtype(q) == dir_node) {
if (dir_dir(q) >= 0)
- incr(dir_nest);
+ dir_nest++;
else
- decr(dir_nest);
+ dir_nest--;
if (dir_nest == 0) {
enddir_ptr = q;
dir_cur_h(enddir_ptr) = w;
@@ -347,7 +347,7 @@ void hlist_out(PDF pdf, halfword this_box)
localpos.pos = refpos->pos;
localpos.dir = box_dir(this_box);
- incr(cur_s);
+ cur_s++;
if (cur_s > max_push)
max_push = cur_s;
@@ -782,7 +782,7 @@ void hlist_out(PDF pdf, halfword this_box)
dvi = save_dvi; /* DVI! */
}
}
- decr(cur_s);
+ cur_s--;
pdf->posstruct = refpos;
}
@@ -825,7 +825,7 @@ void vlist_out(PDF pdf, halfword this_box)
localpos.dir = box_dir(this_box);
synch_pos_with_cur(pdf->posstruct, refpos, cur);
- incr(cur_s);
+ cur_s++;
if (cur_s > max_push)
max_push = cur_s;
@@ -1134,6 +1134,6 @@ void vlist_out(PDF pdf, halfword this_box)
dvi = save_dvi; /* DVI! */
}
}
- decr(cur_s);
+ cur_s--;
pdf->posstruct = refpos;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w
index 36b90dfca1f..798036f80bd 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w
@@ -1,5 +1,5 @@
% pdfliteral.w
-%
+%
% Copyright 2009-2010 Taco Hoekwater <taco@@luatex.org>
% This file is part of LuaTeX.
@@ -15,14 +15,14 @@
% License for more details.
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: pdfliteral.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfliteral.w $";
+ "$Id: pdfliteral.w 3733 2010-07-06 22:14:07Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfliteral.w $";
@ @c
void pdf_special(PDF pdf, halfword p)
@@ -49,6 +49,7 @@ void pdf_out_literal(PDF pdf, halfword p)
{
int old_setting; /* holds print |selector| */
str_number s;
+ pdfstructure *ps = pdf->pstruct;
if (pdf_literal_type(p) == normal) {
old_setting = selector;
selector = new_string;
@@ -69,6 +70,7 @@ void pdf_out_literal(PDF pdf, halfword p)
break;
case direct_always:
pdf_end_string_nl(pdf);
+ ps->need_tm = 1;
break;
default:
confusion("literal1");
@@ -78,7 +80,7 @@ void pdf_out_literal(PDF pdf, halfword p)
}
}
-@ test equality of start of strings
+@ test equality of start of strings
@c
static boolean str_in_cstr(str_number s, const char *r, unsigned i)
{
@@ -97,7 +99,10 @@ static boolean str_in_cstr(str_number s, const char *r, unsigned i)
@ @c
void pdf_literal(PDF pdf, str_number s, int literal_mode, boolean warn)
{
+ unsigned char *ss;
+ size_t l;
pool_pointer j = 0; /* current character code position, initialized to make the compiler happy */
+ pdfstructure *p = pdf->pstruct;
if (s >= STRING_OFFSET) { /* needed for |out_save| */
j = 0;
if (literal_mode == scan_special) {
@@ -131,21 +136,16 @@ void pdf_literal(PDF pdf, str_number s, int literal_mode, boolean warn)
break;
case direct_always:
pdf_end_string_nl(pdf);
+ p->need_tm = 1;
break;
default:
confusion("literal1");
break;
}
if (s >= STRING_OFFSET) {
- unsigned char *ss = str_string(s);
- size_t l = str_length(s) - (size_t) j;
- if (l < max_single_pdf_print) {
- pdf_out_block(pdf, (ss + j), l);
- } else {
-
- while (l--)
- pdf_out(pdf, *(ss + j++));
- }
+ ss = str_string(s);
+ l = str_length(s) - (size_t) j;
+ pdf_out_block(pdf, (const char *) (ss + j), l);
} else {
assert(s < 256);
pdf_out(pdf, s);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h
new file mode 100644
index 00000000000..69ddf3406ca
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.h
@@ -0,0 +1,30 @@
+/* pdfluaapi.h
+
+ Copyright 2009 Taco Hoekwater <taco@luatex.org>
+
+ This file is part of LuaTeX.
+
+ LuaTeX is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+
+/* $Id: pdfluaapi.h 3949 2010-11-07 00:09:19Z hhenkel $ */
+
+#ifndef PDFLUAAPI_H
+# define PDFLUAAPI_H
+
+extern int new_pdflua(void);
+extern void pdflua_begin_page(PDF pdf);
+extern void pdflua_end_page(PDF pdf, int annots, int beads);
+extern void pdflua_output_pages_tree(PDF pdf);
+
+#endif /* PDFLUAAPI_H */
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w
new file mode 100644
index 00000000000..c434241f3de
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w
@@ -0,0 +1,115 @@
+% pdfluaapi.w
+%
+% Copyright 2010 Taco Hoekwater <taco@@luatex.org>
+
+% This file is part of LuaTeX.
+
+% LuaTeX is free software; you can redistribute it and/or modify it under
+% the terms of the GNU General Public License as published by the Free
+% Software Foundation; either version 2 of the License, or (at your
+% option) any later version.
+
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
+
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+
+@ @c
+static const char _svn_version[] =
+ "$Id: pdfluaapi.w 4066 2011-01-18 20:19:50Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $";
+
+#include "ptexlib.h"
+
+@ @c
+int new_pdflua(void)
+{
+ int i, err;
+ Byte *uncompr;
+ zlib_struct *zp = (zlib_struct *) pdflua_zlib_struct_ptr;
+ uLong uncomprLen = zp->uncomprLen;
+ if ((uncompr = xtalloc(zp->uncomprLen, Byte)) == NULL)
+ pdftex_fail("new_pdflua(): xtalloc()");
+ err = uncompress(uncompr, &uncomprLen, zp->compr, zp->comprLen);
+ if (err != Z_OK)
+ pdftex_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()");
+ luaL_checktype(Luas, -1, LUA_TTABLE); /* t */
+ i = luaL_ref(Luas, LUA_GLOBALSINDEX); /* - */
+ xfree(uncompr);
+ return i;
+}
+
+@ @c
+void pdflua_begin_page(PDF pdf)
+{
+ int err; /* ... */
+ lua_rawgeti(Luas, LUA_GLOBALSINDEX, pdf->pdflua_ref); /* t ... */
+ lua_pushstring(Luas, "beginpage"); /* s t ... */
+ lua_gettable(Luas, -2); /* f t ... */
+ lua_newtable(Luas); /* t f t ... */
+ lua_pushnumber(Luas, total_pages + 1); /* i t f t ... */
+ lua_setfield(Luas, -2, "pagenum"); /* t f t ... */
+ lua_pushnumber(Luas, pdf->last_page); /* i t f t ... */
+ lua_setfield(Luas, -2, "page_objnum"); /* t f t ... */
+ lua_pushnumber(Luas, pdf->last_stream); /* i t f t ... */
+ lua_setfield(Luas, -2, "stream_objnum"); /* t f t ... */
+ lua_pushnumber(Luas, pdf->page_resources->last_resources); /* i t f t ... */
+ 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()");
+ /* t ... */
+ lua_pop(Luas, 1); /* ... */
+}
+
+@ @c
+void pdflua_end_page(PDF pdf, int annots, int beads)
+{
+ int err; /* ... */
+ lua_rawgeti(Luas, LUA_GLOBALSINDEX, pdf->pdflua_ref); /* t ... */
+ lua_pushstring(Luas, "endpage"); /* s t ... */
+ lua_gettable(Luas, -2); /* f t ... */
+ lua_newtable(Luas); /* t f t ... */
+ lua_pushnumber(Luas, total_pages); /* i t f t ... */
+ lua_setfield(Luas, -2, "pagenum"); /* t f t ... */
+ lua_pushnumber(Luas, cur_page_size.h); /* i t f t ... */
+ lua_setfield(Luas, -2, "hsize"); /* t f t ... */
+ lua_pushnumber(Luas, cur_page_size.v); /* i t f t ... */
+ lua_setfield(Luas, -2, "vsize"); /* t f t ... */
+ if (annots != 0) {
+ lua_pushnumber(Luas, annots); /* i t f t ... */
+ lua_setfield(Luas, -2, "annots"); /* t f t ... */
+ }
+ if (beads != 0) {
+ lua_pushnumber(Luas, beads); /* i t f t ... */
+ lua_setfield(Luas, -2, "beads"); /* t f t ... */
+ }
+ if (pdf->img_page_group_val != 0) {
+ lua_pushnumber(Luas, pdf->img_page_group_val); /* i t f t ... */
+ lua_setfield(Luas, -2, "imggroup"); /* t f t ... */
+ }
+ err = lua_pcall(Luas, 1, 0, 0); /* (e) t ... */
+ if (err != 0)
+ pdftex_fail("pdflua.lua: endpage()");
+ /* t ... */
+ lua_pop(Luas, 1); /* ... */
+}
+
+@ @c
+void pdflua_output_pages_tree(PDF pdf)
+{
+ int err;
+ lua_rawgeti(Luas, LUA_GLOBALSINDEX, pdf->pdflua_ref); /* t */
+ lua_pushstring(Luas, "outputpagestree"); /* s t */
+ lua_gettable(Luas, -2); /* f */
+ err = lua_pcall(Luas, 0, 0, 0); /* - */
+ if (err != 0)
+ pdftex_fail("pdflua.lua: outputpagestree()");
+}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.h b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.h
index 35325a1e8bb..6b6f628b8ec 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.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: pdfobj.h 3261 2009-12-18 11:38:21Z taco $ */
+/* $Id: pdfobj.h 3874 2010-09-11 22:22:05Z hhenkel $ */
#ifndef PDFOBJ_H
# define PDFOBJ_H
@@ -61,6 +61,8 @@ extern void init_obj_obj(PDF pdf, int k);
extern void pdf_write_obj(PDF pdf, int n);
extern void scan_obj(PDF pdf);
extern void scan_refobj(PDF pdf);
+extern void scan_refobj_lua(PDF pdf, int k);
extern void pdf_ref_obj(PDF pdf, halfword p);
+extern void pdf_ref_obj_lua(PDF pdf, int k);
#endif
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
index 8ad6319274f..2d370ddc54f 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfobj.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfobj.w $";
+ "$Id: pdfobj.w 4093 2011-03-16 16:17:06Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfobj.w $";
#include "ptexlib.h"
@@ -36,7 +36,7 @@ void pdf_write_obj(PDF pdf, int k)
{
lstring data;
const_lstring st;
- size_t i, li; /* index into |data.s| */
+ size_t li; /* index into |data.s| */
int saved_compress_level = pdf->compress_level;
int os_level = 1; /* gives compressed objects for \.{\\pdfobjcompresslevel} $>$ 0 */
int l = 0; /* possibly a lua registry reference */
@@ -54,8 +54,7 @@ void pdf_write_obj(PDF pdf, int k)
assert(lua_isstring(Luas, -1));
st.s = lua_tolstring(Luas, -1, &li);
st.l = li;
- for (i = 0; i < st.l; i++)
- pdf_out(pdf, st.s[i]);
+ pdf_out_block(pdf, st.s, st.l);
if (st.s[st.l - 1] != '\n')
pdf_out(pdf, '\n');
luaL_unref(Luas, LUA_REGISTRYINDEX, l);
@@ -69,6 +68,7 @@ void pdf_write_obj(PDF pdf, int k)
assert(lua_isstring(Luas, -1));
st.s = lua_tolstring(Luas, -1, &li);
st.l = li;
+ lua_pop(Luas,1);
if (obj_obj_is_file(pdf, k)) {
boolean res = false; /* callback status value */
const char *fnam = NULL; /* callback found filename */
@@ -100,15 +100,13 @@ void pdf_write_obj(PDF pdf, int k)
pdf_error("ext5", "error reading file for embedding");
tprint("<<");
tprint(st.s);
- for (i = 0; i < data.l; i++)
- pdf_out(pdf, data.s[i]);
+ 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');
xfree(data.s);
tprint(">>");
} else {
- for (i = 0; i < st.l; i++)
- pdf_out(pdf, st.s[i]);
+ 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');
}
@@ -149,20 +147,18 @@ void scan_obj(PDF pdf)
get_x_token();
if (cur_cmd != spacer_cmd)
back_input();
- incr(pdf->obj_count);
- pdf_create_obj(pdf, obj_type_obj, pdf->sys_obj_ptr + 1);
- k = pdf->sys_obj_ptr;
+ pdf->obj_count++;
+ k = pdf_create_obj(pdf, obj_type_obj, pdf->obj_ptr + 1);
} else {
if (scan_keyword("useobjnum")) {
scan_int();
k = cur_val;
- check_obj_exists(pdf, obj_type_obj, k);
+ check_obj_type(pdf, obj_type_obj, k);
if (is_obj_scheduled(pdf, k) || obj_data_ptr(pdf, k) != 0)
luaL_error(Luas, "object in use");
} else {
- incr(pdf->obj_count);
- pdf_create_obj(pdf, obj_type_obj, pdf->sys_obj_ptr + 1);
- k = pdf->sys_obj_ptr;
+ pdf->obj_count++;
+ k = pdf_create_obj(pdf, obj_type_obj, pdf->obj_ptr + 1);
}
obj_data_ptr(pdf, k) = pdf_get_mem(pdf, pdfmem_obj_size);
init_obj_obj(pdf, k);
@@ -201,14 +197,28 @@ void scan_obj(PDF pdf)
void scan_refobj(PDF pdf)
{
scan_int();
- check_obj_exists(pdf, obj_type_obj, cur_val);
+ check_obj_type(pdf, obj_type_obj, cur_val);
new_whatsit(pdf_refobj_node);
pdf_obj_objnum(tail) = cur_val;
}
+void scan_refobj_lua(PDF pdf, int k)
+{
+ check_obj_type(pdf, obj_type_obj, k);
+ new_whatsit(pdf_refobj_node);
+ pdf_obj_objnum(tail) = k;
+}
+
@ @c
void pdf_ref_obj(PDF pdf, halfword p)
{
if (!is_obj_scheduled(pdf, pdf_obj_objnum(p)))
addto_page_resources(pdf, obj_type_obj, pdf_obj_objnum(p));
}
+
+@ @c
+void pdf_ref_obj_lua(PDF pdf, int k)
+{
+ if (!is_obj_scheduled(pdf, k))
+ addto_page_resources(pdf, obj_type_obj, k);
+}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w
index 7efaa479bf6..dc97c290f30 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: pdfoutline.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfoutline.w $";
+ "$Id: pdfoutline.w 3891 2010-09-14 23:02:24Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfoutline.w $";
@ Data structure of outlines; it's not able to write out outline entries
before all outline entries are defined, so memory allocated for outline
@@ -64,7 +64,7 @@ static int open_subentries(PDF pdf, halfword p)
if (obj_outline_first(pdf, p) != 0) {
l = obj_outline_first(pdf, p);
do {
- incr(k);
+ k++;
c = open_subentries(pdf, l);
if (obj_outline_count(pdf, l) > 0)
k = k + c;
@@ -89,7 +89,7 @@ static int outline_list_count(PDF pdf, pointer p)
{
int k = 1;
while (obj_outline_prev(pdf, p) != 0) {
- incr(k);
+ k++;
p = obj_outline_prev(pdf, p);
}
return k;
@@ -99,7 +99,7 @@ static int outline_list_count(PDF pdf, pointer p)
void scan_pdfoutline(PDF pdf)
{
halfword p, q, r;
- int i, j, k;
+ int i, j, k, l;
if (scan_keyword("attr")) {
scan_pdf_ext_toks();
r = def_ref;
@@ -115,17 +115,15 @@ void scan_pdfoutline(PDF pdf)
}
scan_pdf_ext_toks();
q = def_ref;
- pdf_new_obj(pdf, obj_type_others, 0, 1);
- j = pdf->obj_ptr;
+ j = pdf_new_obj(pdf, obj_type_others, 0, 1);
write_action(pdf, p);
pdf_end_obj(pdf);
delete_action_ref(p);
- pdf_create_obj(pdf, obj_type_outline, 0);
- k = pdf->obj_ptr;
+ k = pdf_create_obj(pdf, obj_type_outline, 0);
set_obj_outline_ptr(pdf, k, pdf_get_mem(pdf, pdfmem_outline_size));
set_obj_outline_action_objnum(pdf, k, j);
set_obj_outline_count(pdf, k, i);
- pdf_new_obj(pdf, obj_type_others, 0, 1);
+ l = pdf_new_obj(pdf, obj_type_others, 0, 1);
{
char *s = tokenlist_to_cstring(q, true, NULL);
pdf_print_str_ln(pdf, s);
@@ -133,7 +131,7 @@ void scan_pdfoutline(PDF pdf)
}
delete_token_ref(q);
pdf_end_obj(pdf);
- set_obj_outline_title(pdf, k, pdf->obj_ptr);
+ set_obj_outline_title(pdf, k, l);
set_obj_outline_prev(pdf, k, 0);
set_obj_outline_next(pdf, k, 0);
set_obj_outline_first(pdf, k, 0);
@@ -182,12 +180,11 @@ int print_outlines(PDF pdf)
int k, l, a;
int outlines;
if (pdf->first_outline != 0) {
- pdf_new_dict(pdf, obj_type_others, 0, 1);
- outlines = pdf->obj_ptr;
+ outlines = pdf_new_dict(pdf, obj_type_others, 0, 1);
l = pdf->first_outline;
k = 0;
do {
- incr(k);
+ k++;
a = open_subentries(pdf, l);
if (obj_outline_count(pdf, l) > 0)
k = k + a;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
index 1cd00ac0537..15d90288ea9 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
@@ -19,16 +19,16 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfpage.w 3703 2010-05-27 07:58:34Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.2/source/texk/web2c/luatexdir/pdf/pdfpage.w $";
+ "$Id: pdfpage.w 4131 2011-04-11 13:41:26Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfpage.w $";
+
+#include "ptexlib.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
-#include "ptexlib.h"
-
#define lround(a) (long) floor((a) + 0.5)
@ eternal constants
@@ -68,6 +68,7 @@ void init_pdf_pagecalculations(PDF pdf)
p->wmode = WMODE_H;
p->mode = PMODE_PAGE;
p->ishex = 0;
+ p->need_tm = 0;
p->k1 = ten_pow[p->pdf.h.e] / one_bp;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w
index 80385154163..4b70e9cfa31 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w
@@ -20,7 +20,7 @@
@ @c
static const char _svn_version[] =
"$Id: pdfrule.w 3584 2010-04-02 17:45:55Z hhenkel $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfrule.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfrule.w $";
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w
index 3f44429c059..5a5f4fea22d 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 3571 2010-04-02 13:50:45Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $";
+ "$Id: pdfsaverestore.w 3676 2010-05-02 20:04:49Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $";
#include "ptexlib.h"
@@ -44,7 +44,7 @@ static void checkpdfsave(scaledpos pos)
}
pos_stack[pos_stack_used].pos.h = pos.h;
pos_stack[pos_stack_used].pos.v = pos.v;
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
pos_stack[pos_stack_used].matrix_stack = matrix_stack_used;
}
pos_stack_used++;
@@ -65,7 +65,7 @@ static void checkpdfrestore(scaledpos pos)
pdftex_warn("Misplaced \\pdfrestore by (%dsp, %dsp)", (int) diff.h,
(int) diff.v);
}
- if (page_mode) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
matrix_stack_used = pos_stack[pos_stack_used].matrix_stack;
}
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w
index c597c51ee5d..0dbb8be7cc6 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 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $";
+ "$Id: pdfsetmatrix.w 3676 2010-05-02 20:04:49Z hhenkel $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $";
#include "ptexlib.h"
@@ -91,7 +91,7 @@ static void pdfsetmatrix(const char *in, scaledpos pos)
matrix_entry x, *y, *z;
- if (page_mode) {
+ 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);
@@ -184,7 +184,7 @@ void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury)
{
scaled x1, x2, x3, x4, y1, y2, y3, y4;
- if (page_mode && matrix_stack_used > 0) {
+ if (global_shipping_mode == SHIPPING_PAGE && matrix_stack_used > 0) {
last_llx = llx;
last_lly = lly;
last_urx = urx;
@@ -207,7 +207,7 @@ void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury)
void matrixtransformpoint(scaled x, scaled y)
{
- if (page_mode && matrix_stack_used > 0) {
+ if (global_shipping_mode == SHIPPING_PAGE && matrix_stack_used > 0) {
do_matrixtransform(x, y, &ret_llx, &ret_lly);
} else {
ret_llx = x;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.h b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.h
index 1070996a5ba..37e49a3b0d4 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.h
@@ -17,14 +17,14 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: pdfshipout.h 2977 2009-08-08 12:49:35Z hhenkel $ */
+/* $Id: pdfshipout.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef PDFSHIPOUT_H
# define PDFSHIPOUT_H
-extern boolean is_shipping_page; /* set to |shipping_page| when |ship_out| starts */
+extern shipping_mode_e global_shipping_mode; /* set to |shipping_mode| when |ship_out| starts */
extern scaledpos shipbox_refpos; /* for \gleaders */
-extern void ship_out(PDF pdf, halfword p, boolean shipping_page);
+extern void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode);
#endif
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
index cb0a36ae256..f00ac0b2722 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfshipout.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfshipout.w $";
+ "$Id: pdfshipout.w 3891 2010-09-14 23:02:24Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfshipout.w $";
#include "ptexlib.h"
@@ -44,11 +44,11 @@ static const char _svn_version[] =
scaledpos shipbox_refpos;
@ |ship_out| is used to shipout a box to PDF or DVI mode.
-If |shipping_page| is not set then the output will be a Form object
-(only PDF), otherwise it will be a Page object.
+If |shipping_mode| is set to |SHIPPING_FORM| then the output will be a Form object
+(only PDF), and if it is set to |SHIPPING_PAGE| it will be a Page object.
@c
-void ship_out(PDF pdf, halfword p, boolean shipping_page)
+void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
{
/* output the box |p| */
int j, k; /* indices to first ten count registers */
@@ -77,8 +77,8 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
print_ln();
tprint("Completed box being shipped out");
}
- is_shipping_page = shipping_page;
- if (shipping_page) {
+ global_shipping_mode = shipping_mode;
+ if (shipping_mode == SHIPPING_PAGE) {
if (pre_callback_id > 0)
(void) run_callback(pre_callback_id, "->");
else if (pre_callback_id == 0) {
@@ -89,7 +89,7 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
print_char('[');
j = 9;
while ((count(j) == 0) && (j > 0))
- decr(j);
+ j--;
for (k = 0; k <= j; k++) {
print_int(count(k));
if (k < j)
@@ -97,7 +97,7 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
}
}
}
- if ((tracing_output > 0) && shipping_page) {
+ if ((tracing_output > 0) && shipping_mode == SHIPPING_PAGE) {
print_char(']');
update_terminal();
begin_diagnostic();
@@ -106,7 +106,7 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
}
/* Ship box |p| out */
- if (shipping_page && box_dir(p) != page_direction)
+ if (shipping_mode == SHIPPING_PAGE && box_dir(p) != page_direction)
pdf_warning("\\shipout",
"\\pagedir != \\bodydir; "
"\\box\\outputbox may be placed wrongly on the page.", true,
@@ -139,7 +139,7 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
max_h = width(p) + h_offset;
/* Calculate page dimensions and margins */
- if (is_shipping_page) {
+ if (global_shipping_mode == SHIPPING_PAGE) {
if (page_width > 0)
cur_page_size.h = page_width;
else {
@@ -256,14 +256,14 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
switch (pdf->o_mode) {
case OMODE_DVI:
- assert(shipping_page);
+ assert(shipping_mode == SHIPPING_PAGE);
dvi_begin_page(pdf);
break;
case OMODE_PDF:
- pdf_begin_page(pdf, shipping_page);
+ pdf_begin_page(pdf);
break;
case OMODE_LUA:
- assert(shipping_page);
+ assert(shipping_mode == SHIPPING_PAGE);
lua_begin_page(pdf);
break;
default:
@@ -281,8 +281,8 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
assert(0);
}
- if (shipping_page)
- incr(total_pages);
+ if (shipping_mode == SHIPPING_PAGE)
+ total_pages++;
cur_s = -1;
/* Finish shipping */
@@ -292,7 +292,7 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
dvi_end_page(pdf);
break;
case OMODE_PDF:
- pdf_end_page(pdf, shipping_page);
+ pdf_end_page(pdf);
break;
case OMODE_LUA:
lua_end_page(pdf);
@@ -302,7 +302,8 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
}
DONE:
- if ((tracing_output <= 0) && (post_callback_id == 0) && shipping_page) {
+ if ((tracing_output <= 0) && (post_callback_id == 0)
+ && shipping_mode == SHIPPING_PAGE) {
print_char(']');
update_terminal();
}
@@ -323,10 +324,12 @@ void ship_out(PDF pdf, halfword p, boolean shipping_page)
print_int(dyn_used);
print_ln();
}
- if (shipping_page && (post_callback_id > 0))
+ if (shipping_mode == SHIPPING_PAGE && (post_callback_id > 0))
(void) run_callback(post_callback_id, "->");
/* Finish sheet {\sl Sync\TeX} information record */
if (int_par(synctex_code))
synctexteehs();
+
+ global_shipping_mode = NOT_SHIPPING;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
index f44c6b2a7c6..b5ee6b55266 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
@@ -17,11 +17,13 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: pdftables.h 3261 2009-12-18 11:38:21Z taco $ */
+/* $Id: pdftables.h 4062 2011-01-11 20:47:28Z hhenkel $ */
#ifndef PDFTABLES_H
# define PDFTABLES_H
+const char *pdf_obj_typenames[PDF_OBJ_TYPE_MAX + 1];
+
typedef enum {
union_type_int,
union_type_cstring,
@@ -68,7 +70,7 @@ well.
# define obj_info(pdf,A) pdf->obj_tab[(A)].u.int0 /* information representing identifier of this object */
# define obj_start(pdf,A) pdf->obj_tab[(A)].u.str0
# define obj_link(pdf,A) pdf->obj_tab[(A)].int1 /* link to the next entry in linked list */
-# define obj_offset(pdf,A) pdf->obj_tab[(A)].int2 /* negative (flags), or byte offset for this object in PDF
+# define obj_offset(pdf,A) pdf->obj_tab[(A)].int2 /* negative (flags), or byte offset for this object in PDF
output file, or object stream number for this object */
# define obj_os_idx(pdf,A) pdf->obj_tab[(A)].int3 /* index of this object in object stream */
# define obj_aux(pdf,A) pdf->obj_tab[(A)].v.int4 /* auxiliary pointer */
@@ -90,7 +92,7 @@ well.
# define is_obj_scheduled(pdf,A) (intcast(obj_offset(pdf,A))>-2)
# define is_obj_written(pdf,A) (intcast(obj_offset(pdf,A))>-1)
-/* NOTE: The data structure definitions for the nodes on the typesetting side are
+/* NOTE: The data structure definitions for the nodes on the typesetting side are
inside |nodes.h| */
/* Some constants */
@@ -98,9 +100,10 @@ well.
# define sup_pk_dpi 8000 /* max PK pixel density value from \.{texmf.cnf} */
extern int find_obj(PDF pdf, int t, int i, boolean byname);
-extern void check_obj_exists(PDF pdf, int t, int n);
+extern void check_obj_exists(PDF pdf, int objnum);
+extern void check_obj_type(PDF pdf, int t, int objnum);
extern int get_obj(PDF pdf, int t, int i, boolean byname);
-extern void pdf_create_obj(PDF pdf, int t, int i);
+extern int pdf_create_obj(PDF pdf, int t, int i);
extern int pdf_new_objnum(PDF pdf);
extern void set_rect_dimens(PDF pdf, halfword p, halfword parent_box,
@@ -116,21 +119,23 @@ extern void undump_pdftex_data(PDF pdf);
# define set_depth(A, B) depth(A) = (B)
/* interface definitions for eqtb locations */
-# define pdf_minor_version int_par(pdf_minor_version_code)
+# define pdf_compress_level int_par(pdf_compress_level_code)
# define pdf_decimal_digits int_par(pdf_decimal_digits_code)
+# define pdf_draftmode int_par(pdf_draftmode_code)
# define pdf_gamma int_par(pdf_gamma_code)
+# define pdf_gen_tounicode int_par(pdf_gen_tounicode_code)
+# define pdf_image_apply_gamma int_par(pdf_image_apply_gamma_code)
# define pdf_image_gamma int_par(pdf_image_gamma_code)
# define pdf_image_hicolor int_par(pdf_image_hicolor_code)
-# define pdf_image_apply_gamma int_par(pdf_image_apply_gamma_code)
-# define pdf_objcompresslevel int_par(pdf_objcompresslevel_code)
-# define pdf_draftmode int_par(pdf_draftmode_code)
# define pdf_inclusion_copy_font int_par(pdf_inclusion_copy_font_code)
# define pdf_inclusion_errorlevel int_par(pdf_inclusion_errorlevel_code)
-# define pdf_replace_font int_par(pdf_replace_font_code)
-# define pdf_pk_resolution int_par(pdf_pk_resolution_code)
+# define pdf_minor_version int_par(pdf_minor_version_code)
+# define pdf_move_chars int_par(pdf_move_chars_code)
+# define pdf_objcompresslevel int_par(pdf_objcompresslevel_code)
+# define pdf_output int_par(pdf_output_code)
# define pdf_pk_mode equiv(pdf_pk_mode_loc)
+# define pdf_pk_resolution int_par(pdf_pk_resolution_code)
+# define pdf_replace_font int_par(pdf_replace_font_code)
# define pdf_unique_resname int_par(pdf_unique_resname_code)
-# define pdf_compress_level int_par(pdf_compress_level_code)
-# define pdf_move_chars int_par(pdf_move_chars_code)
-#endif
+#endif /* PDFTABLES_H */
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w
index 5db049c758e..b7f7869d3b4 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w
@@ -19,33 +19,16 @@
@ @c
static const char _svn_version[] =
- "$Id: pdftables.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdftables.w $";
+ "$Id: pdftables.w 3908 2010-10-13 19:22:02Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdftables.w $";
#include "ptexlib.h"
-@ One AVL tree each for a few |obj_type| out of |0...PDF_OBJ_TYPE_MAX|
-
-@c
-/* mark which objects should be searchable through AVL tree */
-
-static int obj_in_tree[PDF_OBJ_TYPE_MAX + 1] = {
- 0, /* |obj_type_font = 0|, */
- 0, /* |obj_type_outline = 1|, */
- 1, /* |obj_type_dest = 2|, */
- 0, /* |obj_type_obj = 3|, */
- 0, /* |obj_type_xform = 4|, */
- 0, /* |obj_type_ximage = 5|, */
- 1, /* |obj_type_thread = 6|, */
- /* the ones below don't go into a linked list */
- 0, /* |obj_type_pagestream = 7|, */
- 1, /* |obj_type_page = 8|, */
- 0, /* |obj_type_pages = 9|, */
- 0, /* |obj_type_link = 10|, */
- 0, /* |obj_type_bead = 11|, */
- 0, /* |obj_type_annot = 12|, */
- 0, /* |obj_type_objstm = 13|, */
- 0 /* |obj_type_others = 14| */
+@ @c
+const char *pdf_obj_typenames[PDF_OBJ_TYPE_MAX + 1] =
+ { "font", "outline", "dest", "obj", "xform", "ximage", "thread",
+ "pagestream", "page", "pages", "catalog", "info", "link", "annot", "annots",
+ "bead", "beads", "objstm", "others"
};
@ AVL sort oentry into |avl_table[]|
@@ -71,7 +54,7 @@ static int compare_info(const void *pa, const void *pb, void *param)
static void avl_put_obj(PDF pdf, int t, oentry * oe)
{
void **pp;
- assert(t >= 0 || t <= PDF_OBJ_TYPE_MAX || obj_in_tree[t] == 1);
+ assert(t >= 0 && t <= PDF_OBJ_TYPE_MAX);
if (pdf->obj_tree[t] == NULL) {
pdf->obj_tree[t] = avl_create(compare_info, NULL, &avl_xallocator);
if (pdf->obj_tree[t] == NULL)
@@ -106,7 +89,7 @@ static int avl_find_int_obj(PDF pdf, int t, int i)
{
oentry *p;
oentry tmp;
- assert(t >= 0 || t <= PDF_OBJ_TYPE_MAX || obj_in_tree[t] == 1);
+ assert(t >= 0 && t <= PDF_OBJ_TYPE_MAX);
tmp.u.int0 = i;
tmp.u_type = union_type_int;
if (pdf->obj_tree[t] == NULL)
@@ -121,7 +104,7 @@ static int avl_find_str_obj(PDF pdf, int t, char *s)
{
oentry *p;
oentry tmp;
- assert(t >= 0 || t <= PDF_OBJ_TYPE_MAX || obj_in_tree[t] == 1);
+ assert(t >= 0 && t <= PDF_OBJ_TYPE_MAX);
tmp.u.str0 = s;
tmp.u_type = union_type_cstring;
if (pdf->obj_tree[t] == NULL)
@@ -135,13 +118,13 @@ static int avl_find_str_obj(PDF pdf, int t, char *s)
@ Create an object with type |t| and identifier |i|
@c
-void pdf_create_obj(PDF pdf, int t, int i)
+int pdf_create_obj(PDF pdf, int t, int i)
{
int a;
char *ss = NULL;
- if (pdf->sys_obj_ptr == sup_obj_tab_size)
+ if (pdf->obj_ptr == sup_obj_tab_size)
overflow("indirect objects table size", (unsigned) pdf->obj_tab_size);
- if (pdf->sys_obj_ptr == pdf->obj_tab_size) {
+ if (pdf->obj_ptr == pdf->obj_tab_size) {
a = pdf->obj_tab_size / 5;
if (pdf->obj_tab_size < sup_obj_tab_size - a)
pdf->obj_tab_size = pdf->obj_tab_size + a;
@@ -151,8 +134,7 @@ void pdf_create_obj(PDF pdf, int t, int i)
xreallocarray(pdf->obj_tab, obj_entry,
(unsigned) pdf->obj_tab_size);
}
- incr(pdf->sys_obj_ptr);
- pdf->obj_ptr = pdf->sys_obj_ptr;
+ pdf->obj_ptr++;
obj_info(pdf, pdf->obj_ptr) = i;
obj_type(pdf, pdf->obj_ptr) = t;
set_obj_fresh(pdf, pdf->obj_ptr);
@@ -169,7 +151,9 @@ void pdf_create_obj(PDF pdf, int t, int i)
append_dest_name(pdf, makecstring(-obj_info(pdf, pdf->obj_ptr)),
pdf->obj_ptr);
}
+ return pdf->obj_ptr;
}
+
@ @c
int find_obj(PDF pdf, int t, int i, boolean byname)
{
@@ -209,12 +193,11 @@ int get_obj(PDF pdf, int t, int i, boolean byname)
}
if (r == 0) {
if (byname > 0) {
- pdf_create_obj(pdf, t, -s);
+ r = pdf_create_obj(pdf, t, -s);
s = 0;
} else {
- pdf_create_obj(pdf, t, i);
+ r = pdf_create_obj(pdf, t, i);
}
- r = pdf->obj_ptr;
if (t == obj_type_dest)
set_obj_dest_ptr(pdf, r, null);
}
@@ -228,16 +211,30 @@ int get_obj(PDF pdf, int t, int i, boolean byname)
@c
int pdf_new_objnum(PDF pdf)
{
- pdf_create_obj(pdf, obj_type_others, 0);
- return pdf->obj_ptr;
+ int k = pdf_create_obj(pdf, obj_type_others, 0);
+ return k;
}
-void check_obj_exists(PDF pdf, int t, int objnum)
+void check_obj_exists(PDF pdf, int objnum)
{
if (objnum < 0 || objnum > pdf->obj_ptr)
pdf_error("ext1", "cannot find referenced object");
- if (t != obj_type(pdf, objnum))
- pdf_error("ext1", "referenced object has wrong type");
+}
+
+void check_obj_type(PDF pdf, int t, int objnum)
+{
+ int u;
+ char *s;
+ check_obj_exists(pdf, objnum);
+ u = obj_type(pdf, objnum);
+ if (t != u) {
+ assert(t >= 0 && t <= PDF_OBJ_TYPE_MAX);
+ assert(u >= 0 && u <= PDF_OBJ_TYPE_MAX);
+ s = (char *) xtalloc(128, char);
+ snprintf(s, 127, "referenced object has wrong type %s; should be %s",
+ pdf_obj_typenames[u], pdf_obj_typenames[t]);
+ pdf_error("ext1", s);
+ }
}
@ @c
@@ -277,7 +274,7 @@ void set_rect_dimens(PDF pdf, halfword p, halfword parent_box, scaledpos cur,
pos_ll.v = pos_ur.v;
pos_ur.v = tmp.v;
}
- if (is_shipping_page && matrixused()) {
+ if (global_shipping_mode == SHIPPING_PAGE && matrixused()) {
matrixtransformrect(pos_ll.h, pos_ll.v, pos_ur.h, pos_ur.v);
pos_ll.h = getllx();
pos_ll.v = getlly();
@@ -333,9 +330,7 @@ void dump_pdftex_data(PDF pdf)
dump_int(x);
x = pdf->obj_ptr;
dump_int(x);
- x = pdf->sys_obj_ptr;
- dump_int(x);
- for (k = 1; k <= pdf->sys_obj_ptr; k++) {
+ for (k = 1; k <= pdf->obj_ptr; k++) {
x = obj_info(pdf, k);
dump_int(x);
x = obj_link(pdf, k);
@@ -348,7 +343,7 @@ void dump_pdftex_data(PDF pdf)
dump_int(x);
}
print_ln();
- print_int(pdf->sys_obj_ptr);
+ print_int(pdf->obj_ptr);
tprint(" indirect objects");
dump_int(pdf->obj_count);
dump_int(pdf->xform_count);
@@ -405,9 +400,7 @@ void undump_pdftex_data(PDF pdf)
pdf->obj_tab_size = x;
undump_int(x);
pdf->obj_ptr = x;
- undump_int(x);
- pdf->sys_obj_ptr = x;
- for (k = 1; k <= pdf->sys_obj_ptr; k++) {
+ for (k = 1; k <= pdf->obj_ptr; k++) {
undump_int(x);
obj_info(pdf, k) = x;
undump_int(x);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.h b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.h
index 45d50a4551f..c1671f4f0aa 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.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: pdfthread.h 3261 2009-12-18 11:38:21Z taco $ */
+/* $Id: pdfthread.h 3905 2010-10-02 20:29:20Z hhenkel $ */
#ifndef PDFTHREAD_H
# define PDFTHREADH
@@ -64,7 +64,6 @@ extern void pdf_fix_thread(PDF pdf, int t);
extern void out_thread(PDF pdf, int t);
extern void check_running_thread(PDF pdf, halfword this_box, scaledpos cur);
-extern void print_beads_list(PDF pdf);
extern void print_bead_rectangles(PDF pdf);
extern void flush_beads_list(void);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
index f5baf228d25..72ba892fa50 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfthread.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfthread.w $";
+ "$Id: pdfthread.w 3905 2010-10-02 20:29:20Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfthread.w $";
#include "ptexlib.h"
@@ -34,7 +34,7 @@ static const char _svn_version[] =
void append_bead(PDF pdf, halfword p)
{
int a, b, c, t;
- if (!is_shipping_page)
+ if (global_shipping_mode == SHIPPING_FORM)
pdf_error("ext4", "threads cannot be inside an XForm");
t = get_obj(pdf, obj_type_thread, pdf_thread_id(p), pdf_thread_named_id(p));
b = pdf_new_objnum(pdf);
@@ -166,8 +166,7 @@ void pdf_fix_thread(PDF pdf, int t)
tprint(" has been referenced but does not exist, replaced by a fixed one");
print_ln();
print_ln();
- pdf_new_dict(pdf, obj_type_others, 0, 0);
- a = pdf->obj_ptr;
+ a = pdf_new_dict(pdf, obj_type_others, 0, 0);
pdf_indirect_ln(pdf, "T", t);
pdf_indirect_ln(pdf, "V", a);
pdf_indirect_ln(pdf, "N", a);
@@ -254,35 +253,21 @@ void check_running_thread(PDF pdf, halfword this_box, scaledpos cur)
}
@ @c
-void print_beads_list(PDF pdf)
-{
- pdf_object_list *k;
- if ((k = get_page_resources_list(pdf, obj_type_bead)) != NULL) {
- pdf_printf(pdf, "/B [ ");
- while (k != NULL) {
- pdf_print_int(pdf, k->info);
- pdf_printf(pdf, " 0 R ");
- k = k->link;
- }
- pdf_printf(pdf, "]\n");
- }
-}
-
-@ @c
void print_bead_rectangles(PDF pdf)
{
halfword i;
pdf_object_list *k;
+ int l;
if ((k = get_page_resources_list(pdf, obj_type_bead)) != NULL) {
while (k != NULL) {
- pdf_new_obj(pdf, obj_type_others, 0, 1);
+ l = pdf_new_obj(pdf, obj_type_others, 0, 1);
pdf_out(pdf, '[');
i = obj_bead_data(pdf, k->info); /* pointer to a whatsit or whatsit-like node */
pdf_print_rect_spec(pdf, i);
if (subtype(i) == pdf_thread_data_node) /* thanh says it mis be destroyed here */
flush_node(i);
pdf_printf(pdf, "]\n");
- set_obj_bead_rect(pdf, k->info, pdf->obj_ptr); /* rewrite |obj_bead_data| */
+ set_obj_bead_rect(pdf, k->info, l); /* rewrite |obj_bead_data| */
pdf_end_obj(pdf);
k = k->link;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
index 83b3c89a97e..255a156ef61 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
@@ -17,12 +17,13 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: pdftypes.h 3341 2010-01-08 19:52:54Z hhenkel $ */
+/* $Id: pdftypes.h 3949 2010-11-07 00:09:19Z hhenkel $ */
#ifndef PDFTYPES_H
# define PDFTYPES_H
# include <zlib.h>
+# include "lua/luatex-api.h"
/* This stucture holds everything that is needed for the actual pdf generation.
@@ -109,6 +110,7 @@ typedef struct {
writing_mode wmode; /* PDF writing mode WMode (horizontal/vertical) */
pos_mode mode; /* current positioning mode */
int ishex; /* Whether the current char string is <> or () */
+ int need_tm; /* flag whether Tm needs to be set */
} pdfstructure;
typedef struct obj_entry_ {
@@ -131,7 +133,7 @@ typedef struct dest_name_entry_ {
int objnum; /* destination object number */
} dest_name_entry;
-# define pdf_max_link_level 10 /* maximum depth of link nesting */
+# define pdf_max_link_level 10/* maximum depth of link nesting */
typedef struct pdf_link_stack_record {
int nesting_level;
@@ -153,17 +155,21 @@ typedef enum {
/* |obj_type_thread| is the highest entry in |head_tab|, but there are a few
more linked lists that are handy: */
obj_type_pagestream = 7, /* Page stream objects */
- obj_type_page = 8, /* Page objects */
- obj_type_pages = 9, /* Pages objects */
- obj_type_link = 10, /* link objects */
- obj_type_bead = 11, /* thread bead objects */
- obj_type_annot = 12, /* annotation objects */
- obj_type_objstm = 13, /* /ObjStm objects */
- obj_type_others = 14 /* any other objects (also not linked in any list) */
+ obj_type_page = 8, /* /Page objects */
+ obj_type_pages = 9, /* /Pages objects */
+ obj_type_catalog = 10, /* /Catalog object */
+ obj_type_info = 11, /* /Info object */
+ obj_type_link = 12, /* link objects */
+ obj_type_annot = 13, /* annotation objects */
+ obj_type_annots = 14, /* /Annots objects */
+ obj_type_bead = 15, /* thread bead objects */
+ obj_type_beads = 16, /* /B objects (array of bead objects) */
+ obj_type_objstm = 17, /* /ObjStm objects */
+ obj_type_others = 18 /* any other objects (also not linked in any list) */
} pdf_obj_type;
# define HEAD_TAB_MAX 6 /* obj_type_thread */
-# define PDF_OBJ_TYPE_MAX 14 /* obj_type_others */
+# define PDF_OBJ_TYPE_MAX 18 /* obj_type_others */
typedef struct pdf_resource_struct_ {
struct avl_table *resources_tree;
@@ -223,7 +229,7 @@ typedef struct pdf_output_file_ {
size_t fb_limit;
char *zipbuf;
- z_stream c_stream; /* compression stream */
+ z_stream *c_stream; /* compression stream pointer */
int zip_write_state; /* which state of compression we are in */
int pk_scale_factor; /* this is just a preprocessed value that depends on
@@ -245,8 +251,7 @@ typedef struct pdf_output_file_ {
struct avl_table *obj_tree[PDF_OBJ_TYPE_MAX + 1]; /* this is useful for finding the objects back */
int pages_tail;
- int obj_ptr; /* user objects counter */
- int sys_obj_ptr; /* system objects counter, including object streams */
+ int obj_ptr; /* objects counter */
int last_pages; /* pointer to most recently generated pages object */
int last_page; /* pointer to most recently generated page object */
int last_stream; /* pointer to most recently generated stream */
@@ -284,6 +289,7 @@ typedef struct pdf_output_file_ {
int thread_level; /* depth of nesting of box containing the last thread */
int f_cur; /* TeX font number */
+ int pdflua_ref;
} pdf_output_file;
typedef pdf_output_file *PDF;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
index ab62fc465a1..724755f4ebc 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: pdfxform.w 3571 2010-04-02 13:50:45Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/pdf/pdfxform.w $";
+ "$Id: pdfxform.w 3908 2010-10-13 19:22:02Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfxform.w $";
#include "ptexlib.h"
@@ -72,9 +72,8 @@ void scan_pdfxform(PDF pdf)
{
int k;
halfword p;
- incr(pdf->xform_count);
- pdf_create_obj(pdf, obj_type_xform, pdf->xform_count);
- k = pdf->obj_ptr;
+ pdf->xform_count++;
+ k = pdf_create_obj(pdf, obj_type_xform, pdf->xform_count);
set_obj_data_ptr(pdf, k, pdf_get_mem(pdf, pdfmem_xform_size));
if (scan_keyword("attr")) {
scan_pdf_ext_toks();
@@ -109,7 +108,7 @@ void scan_pdfrefxform(PDF pdf)
scaled_whd alt_rule, dim, nat;
alt_rule = scan_alt_rule(); /* scans |<rule spec>| to |alt_rule| */
scan_int();
- check_obj_exists(pdf, obj_type_xform, cur_val);
+ check_obj_type(pdf, obj_type_xform, cur_val);
new_whatsit(pdf_refxform_node);
nat.wd = obj_xform_width(pdf, cur_val);
nat.ht = obj_xform_height(pdf, cur_val);
diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h
index e26b84d7980..236b270cd5e 100644
--- a/Build/source/texk/web2c/luatexdir/ptexlib.h
+++ b/Build/source/texk/web2c/luatexdir/ptexlib.h
@@ -27,14 +27,14 @@
# define EXTERN extern
# include "luatex.h"
-# include "lib/lib.h"
+# include "lib/lib.h"
# ifdef MSVC
extern double rint(double x);
# endif
# if defined(WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
-extern char **suffixlist; /* in luainit.w */
+extern char **suffixlist; /* in luainit.w */
# endif
@@ -189,6 +189,7 @@ size_t T##_limit
# include "pdf/pdflink.h"
# include "pdf/pdflistout.h"
# include "pdf/pdfliteral.h"
+# include "pdf/pdfluaapi.h"
# include "pdf/pdfobj.h"
# include "pdf/pdfoutline.h"
# include "pdf/pdfrule.h"
@@ -200,17 +201,14 @@ size_t T##_limit
# include "lua/luagen.h"
+# include "luascripts/pdflua.h"
+
# include "font/luatexfont.h"
# include "font/mapfile.h"
# include "utils/utils.h"
# include "image/writejbig2.h"
# include "image/pdftoepdf.h"
-# include "ocp/ocp.h"
-# include "ocp/ocplist.h"
-# include "ocp/runocp.h"
-# include "ocp/readocp.h"
-
# include "lang/texlang.h"
# include "tex/textcodes.h"
@@ -271,6 +269,10 @@ void copy_pdf_literal(pointer r, pointer p);
void free_pdf_literal(pointer p);
void show_pdf_literal(pointer p);
+void copy_late_lua(pointer r, pointer p);
+void free_late_lua(pointer p);
+void show_late_lua(pointer p);
+
void load_tex_patterns(int curlang, halfword head);
void load_tex_hyphenation(int curlang, halfword head);
@@ -319,7 +321,6 @@ typedef enum {
find_image_file_callback,
find_format_file_callback,
find_read_file_callback, open_read_file_callback,
- find_ocp_file_callback, read_ocp_file_callback,
find_vf_file_callback, read_vf_file_callback,
find_data_file_callback, read_data_file_callback,
find_font_file_callback, read_font_file_callback,
@@ -347,6 +348,8 @@ typedef enum {
linebreak_filter_callback,
post_linebreak_filter_callback,
mlist_to_hlist_callback,
+ finish_pdffile_callback,
+ pre_dump_callback,
total_callbacks
} callback_callback_types;
@@ -354,6 +357,9 @@ extern int callback_set[];
extern int lua_active;
# define callback_defined(a) callback_set[a]
+/* # define callback_defined(a) debug_callback_defined(a) */
+
+extern int debug_callback_defined(int i);
extern int run_callback(int i, const char *values, ...);
extern int run_saved_callback(int i, const char *name, const char *values, ...);
@@ -414,8 +420,7 @@ extern void topenin(void);
extern str_number getjobname(str_number);
extern str_number makefullnamestring(void);
-
-extern KPSEDLL string kpathsea_version_string; /* from kpathsea/version.c */
+#include <kpathsea/version.h>
extern PDF static_pdf;
diff --git a/Build/source/texk/web2c/luatexdir/tex/align.w b/Build/source/texk/web2c/luatexdir/tex/align.w
index 8e21f7ed86a..827e2bc07ae 100644
--- a/Build/source/texk/web2c/luatexdir/tex/align.w
+++ b/Build/source/texk/web2c/luatexdir/tex/align.w
@@ -23,8 +23,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: align.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/align.w $";
+ "$Id: align.w 4044 2010-12-18 09:23:06Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/align.w $";
@ @c
void fin_align(void);
@@ -239,12 +239,14 @@ static void push_alignment(void)
vlink(p + 5) = cur_pre_tail;
align_ptr = p;
cur_head = new_node(temp_node, 0);
+ cur_pre_head = new_node(temp_node, 0);
}
static void pop_alignment(void)
{
pointer p; /* the top alignment stack node */
flush_node(cur_head);
+ flush_node(cur_pre_head);
p = align_ptr;
cur_pre_tail = vlink(p + 5);
cur_pre_head = vinfo(p + 5);
@@ -953,11 +955,11 @@ value is changed to zero and so is the next tabskip.
if (cur_list.mode_field == -vmode) {
type(q) = hlist_node;
- subtype(q) = 0;
+ subtype(q) = HLIST_SUBTYPE_ALIGNROW;
width(q) = width(p);
} else {
type(q) = vlist_node;
- subtype(q) = 0;
+ subtype(q) = HLIST_SUBTYPE_ALIGNROW;
height(q) = height(p);
}
glue_order(q) = glue_order(p);
@@ -1004,6 +1006,7 @@ value is changed to zero and so is the next tabskip.
vlink(u) = rr;
u = vlink(u);
t = t + width(s);
+ subtype(u) = HLIST_SUBTYPE_ALIGNCELL;
if (cur_list.mode_field == -vmode) {
width(u) = width(s);
} else {
@@ -1045,6 +1048,7 @@ value is changed to zero and so is the next tabskip.
}
width(r) = w;
type(r) = hlist_node;
+ subtype(r) = HLIST_SUBTYPE_ALIGNCELL;
} else {
/* Make the unset node |r| into a |vlist_node| of height |w|,
@@ -1076,9 +1080,10 @@ value is changed to zero and so is the next tabskip.
}
height(r) = w;
type(r) = vlist_node;
+ subtype(r) = HLIST_SUBTYPE_ALIGNCELL;
}
- subtype(r) = 0;
+ /* subtype(r) = 0; */
shift_amount(r) = 0;
if (u != hold_head) { /* append blank boxes to account for spanned nodes */
vlink(u) = vlink(r);
@@ -1104,6 +1109,7 @@ value is changed to zero and so is the next tabskip.
vlink(q) = null;
q = hpack(q, 0, additional, -1);
shift_amount(q) = o;
+ subtype(q) = HLIST_SUBTYPE_ALIGNCELL;
vlink(q) = r;
vlink(s) = q;
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/arithmetic.h b/Build/source/texk/web2c/luatexdir/tex/arithmetic.h
index 89dce4e4f74..6e809372ab6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/arithmetic.h
+++ b/Build/source/texk/web2c/luatexdir/tex/arithmetic.h
@@ -17,15 +17,15 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: arithmetic.h 3477 2010-03-12 13:59:34Z taco $ */
+/* $Id: arithmetic.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef ARITHMETIC_H
# define ARITHMETIC_H
/* |incr| and |decr| are in texmfmp.h */
- /* #define incr(A) (A)++ *//* increase a variable by unity */
- /* #define decr(A) (A)-- *//* decrease a variable by unity */
+ /* #define incr(A) (A)++ *//* increase a variable by unity */
+ /* #define decr(A) (A)-- *//* decrease a variable by unity */
# define negate(A) (A)=-(A) /* change the sign of a variable */
diff --git a/Build/source/texk/web2c/luatexdir/tex/arithmetic.w b/Build/source/texk/web2c/luatexdir/tex/arithmetic.w
index 76ccbbf419e..f0f0adb5abd 100644
--- a/Build/source/texk/web2c/luatexdir/tex/arithmetic.w
+++ b/Build/source/texk/web2c/luatexdir/tex/arithmetic.w
@@ -24,7 +24,7 @@
static const char _svn_version[] =
"$Id: arithmetic.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/arithmetic.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/arithmetic.w $";
@ The principal computations performed by \TeX\ are done entirely in terms of
diff --git a/Build/source/texk/web2c/luatexdir/tex/buildpage.w b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
index 2c2c8460464..bc6f61a15dc 100644
--- a/Build/source/texk/web2c/luatexdir/tex/buildpage.w
+++ b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: buildpage.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/buildpage.w $";
+ "$Id: buildpage.w 4132 2011-04-11 14:04:10Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/buildpage.w $";
#include "ptexlib.h"
@@ -387,8 +387,8 @@ void build_page(void)
else
width(temp_ptr) = 0;
}
- vlink(q) = p;
- vlink(contrib_head) = q;
+ couple_nodes(q, p);
+ couple_nodes(contrib_head, q);
goto CONTINUE;
} else {
@@ -462,8 +462,8 @@ void build_page(void)
or extremely lucky, or both. */
q = new_node(inserting_node, n);
- vlink(q) = vlink(r);
- vlink(r) = q;
+ try_couple_nodes(q, vlink(r));
+ couple_nodes(r, q);
r = q;
ensure_vbox(n);
if (box(n) == null)
@@ -569,6 +569,7 @@ void build_page(void)
break;
default:
+ fprintf(stderr, "type(p)=%d\n", type(p));
confusion("page");
break;
}
@@ -691,20 +692,21 @@ void build_page(void)
}
/* Link node |p| into the current page and |goto done| */
- vlink(page_tail) = p;
+ couple_nodes(page_tail, p);
page_tail = p;
- vlink(contrib_head) = vlink(p);
+ try_couple_nodes(contrib_head,vlink(p));
vlink(p) = null;
goto DONE;
DONE1:
/* Recycle node |p| */
- vlink(contrib_head) = vlink(p);
+ try_couple_nodes(contrib_head,vlink(p));
vlink(p) = null;
if (int_par(saving_vdiscards_code) > 0) {
- if (page_disc == null)
+ if (page_disc == null) {
page_disc = p;
- else
- vlink(tail_page_disc) = p;
+ } else {
+ couple_nodes(tail_page_disc, p);
+ }
tail_page_disc = p;
} else {
flush_node_list(p);
@@ -871,10 +873,10 @@ void fire_up(halfword c)
}
/* Either append the insertion node |p| after node |q|, and remove it
from the current page, or delete |node(p)| */
- vlink(prev_p) = vlink(p);
+ try_couple_nodes(prev_p, vlink(p));
vlink(p) = null;
if (wait) {
- vlink(q) = p;
+ couple_nodes(q, p);
q = p;
incr(insert_penalties);
} else {
@@ -917,8 +919,8 @@ void fire_up(halfword c)
if (vlink(contrib_head) == null) {
contrib_tail = page_tail;
}
- vlink(page_tail) = vlink(contrib_head);
- vlink(contrib_head) = p;
+ couple_nodes(page_tail,vlink(contrib_head));
+ couple_nodes(contrib_head, p);
vlink(prev_p) = null;
}
save_vbadness = vbadness;
@@ -997,7 +999,7 @@ void fire_up(halfword c)
}
flush_node_list(page_disc);
page_disc = null;
- ship_out(static_pdf, box(output_box), true);
+ ship_out(static_pdf, box(output_box), SHIPPING_PAGE);
box(output_box) = null;
}
@@ -1037,14 +1039,14 @@ void resume_after_output(void)
}
if (tail != head) { /* current list goes after heldover insertions */
- vlink(page_tail) = vlink(head);
+ try_couple_nodes(page_tail, vlink(head));
page_tail = tail;
}
if (vlink(page_head) != null) { /* and both go before heldover contributions */
if (vlink(contrib_head) == null)
contrib_tail = page_tail;
- vlink(page_tail) = vlink(contrib_head);
- vlink(contrib_head) = vlink(page_head);
+ try_couple_nodes(page_tail, vlink(contrib_head));
+ try_couple_nodes(contrib_head, vlink(page_head));
vlink(page_head) = null;
page_tail = page_head;
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h
index 88d012aaa5c..6c8ceec4570 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.h
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.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: commands.h 2899 2009-07-21 23:03:53Z oneiros $ */
+/* $Id: commands.h 4000 2010-11-28 13:58:35Z taco $ */
#ifndef COMMANDS_H
# define COMMANDS_H
@@ -143,14 +143,14 @@ typedef enum {
super_sub_script_cmd, /* explicit super- or subscript */
math_shift_cs_cmd, /* start- and endmath */
end_cs_name_cmd, /* end control sequence ( \.{\\endcsname} ) */
- char_ghost_cmd, /* \.{\\ghostleft}, \.{\\ghostright} character for kerning */
+ char_ghost_cmd, /* \.{\\leftghost}, \.{\\rightghost} character for kerning */
assign_local_box_cmd, /* box for guillemets \.{\\localleftbox} or \.{\\localrightbox} */
char_given_cmd, /* character code defined by \.{\\chardef} */
# define min_internal_cmd char_given_cmd
/* the smallest code that can follow \.{\\the} */
math_given_cmd, /* math code defined by \.{\\mathchardef} */
omath_given_cmd, /* math code defined by \.{\\omathchardef} */
- xmath_given_cmd, /* math code defined by \.{\\LuaTeXmathchardef} */
+ xmath_given_cmd, /* math code defined by \.{\\Umathchardef} */
last_item_cmd, /* most recent item ( \.{\\lastpenalty}, \.{\\lastkern}, \.{\\lastskip} ) */
# define max_non_prefixed_command_cmd last_item_cmd /* largest command code that can't be \.{\\global} */
toks_register_cmd, /* token list register ( \.{\\toks} ) */
@@ -195,15 +195,6 @@ typedef enum {
set_interaction_cmd, /* define level of interaction ( \.{\\batchmode}, etc.~) */
letterspace_font_cmd, /* letterspace a font ( \.{\\letterspacefont} ) */
pdf_copy_font_cmd, /* create a new font instance ( \.{\\pdfcopyfont} ) */
- set_ocp_cmd, /* Place a translation process in the stream */
- def_ocp_cmd, /* Define and load a translation process */
- set_ocp_list_cmd, /* Place a list of OCPs in the stream */
- def_ocp_list_cmd, /* Define a list of OCPs */
- clear_ocp_lists_cmd, /* Remove all active OCP lists */
- push_ocp_list_cmd, /* Add to the sequence of active OCP lists */
- pop_ocp_list_cmd, /* Remove from the sequence of active OCP lists */
- ocp_list_op_cmd, /* Operations for building a list of OCPs */
- ocp_trace_level_cmd, /* Tracing of active OCPs, either 0 or 1 */
undefined_cs_cmd, /* initial state of most |eq_type| fields */
expand_after_cmd, /* special expansion ( \.{\\expandafter} ) */
no_expand_cmd, /* special nonexpansion ( \.{\\noexpand} ) */
@@ -227,7 +218,7 @@ typedef enum {
data_cmd, /* the equivalent is simply a halfword number */
} tex_command_code;
-# define max_command_cmd ocp_trace_level_cmd /* the largest command code seen at |big_switch| */
+# define max_command_cmd pdf_copy_font_cmd /* the largest command code seen at |big_switch| */
# define last_cmd data_cmd
# define max_non_prefixed_command last_item_cmd
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w
index 83e81602840..db5a7672317 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.w
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.w
@@ -23,8 +23,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: commands.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/commands.w $";
+ "$Id: commands.w 3849 2010-09-01 09:10:48Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/commands.w $";
@ The symbolic names for glue parameters are put into \TeX's hash table
by using the routine called |primitive|, defined below. Let us enter them
@@ -537,18 +537,6 @@ void initialize_commands(void)
primitive_tex("nullfont", set_font_cmd, null_font, 0);
cs_text(frozen_null_font) = maketexstring("nullfont");
eqtb[frozen_null_font] = eqtb[cur_val];
- /* $\Omega$ always knows at least one ocp, namely the null ocp.
- It does nothing. */
- primitive_omega("nullocp", set_ocp_cmd, null_ocp, 0);
- cs_text(frozen_null_ocp) = maketexstring("nullocp");
- eqtb[frozen_null_ocp] = eqtb[cur_val];
- geq_define(ocp_active_number_base, data_cmd, 0);
- geq_define(ocp_active_min_ptr_base, data_cmd, 0);
- geq_define(ocp_active_max_ptr_base, data_cmd, 0);
- /* $\Omega$ always knows at least one ocp list, namely the null ocp list. */
- primitive_omega("nullocplist", set_ocp_list_cmd, null_ocp_list, 0);
- cs_text(frozen_null_ocp_list) = maketexstring("nullocplist");
- eqtb[frozen_null_ocp_list] = eqtb[cur_val];
primitive_tex("span", tab_mark_cmd, span_code, tab_mark_cmd_code);
primitive_luatex("aligntab", tab_mark_cmd, tab_mark_cmd_code,
@@ -1037,20 +1025,6 @@ void initialize_commands(void)
primitive_pdftex("pdfglyphtounicode", extension_cmd,
pdf_glyph_to_unicode_code, 0);
- primitive_omega("ocp", def_ocp_cmd, 0, 0);
- primitive_omega("externalocp", def_ocp_cmd, 1, 0);
- primitive_omega("ocplist", def_ocp_list_cmd, 0, 0);
- primitive_omega("pushocplist", push_ocp_list_cmd, 0, 0);
- primitive_omega("popocplist", pop_ocp_list_cmd, 0, 0);
- primitive_omega("clearocplists", clear_ocp_lists_cmd, 0, 0);
- primitive_omega("addbeforeocplist", ocp_list_op_cmd, add_before_op, 0);
- primitive_omega("addafterocplist", ocp_list_op_cmd, add_after_op, 0);
- primitive_omega("removebeforeocplist", ocp_list_op_cmd, remove_before_op,
- 0);
- primitive_omega("removeafterocplist", ocp_list_op_cmd, remove_after_op, 0);
- primitive_omega("ocptracelevel", ocp_trace_level_cmd, 0, 0);
- set_equiv(ocp_trace_level_base, 0);
-
/* some of the internal integer parameters are not associated with actual
primitives at all. */
diff --git a/Build/source/texk/web2c/luatexdir/tex/conditional.w b/Build/source/texk/web2c/luatexdir/tex/conditional.w
index a0df81779d7..a4a327568ab 100644
--- a/Build/source/texk/web2c/luatexdir/tex/conditional.w
+++ b/Build/source/texk/web2c/luatexdir/tex/conditional.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: conditional.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/conditional.w $";
+ "$Id: conditional.w 3955 2010-11-12 13:28:03Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/conditional.w $";
@ @c
#define box(A) eqtb[box_base+(A)].hh.rh
@@ -187,7 +187,7 @@ static boolean test_for_cs(void)
while (p != null) {
if (m >= max_buf_stack) {
max_buf_stack = m + 4;
- if (max_buf_stack == buf_size)
+ if (max_buf_stack >= buf_size)
check_buffer_overflow(max_buf_stack);
}
s = token_chr(token_info(p));
diff --git a/Build/source/texk/web2c/luatexdir/tex/directions.h b/Build/source/texk/web2c/luatexdir/tex/directions.h
index bea50879b64..f7b3e784d07 100644
--- a/Build/source/texk/web2c/luatexdir/tex/directions.h
+++ b/Build/source/texk/web2c/luatexdir/tex/directions.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: directions.h 3523 2010-03-19 13:28:08Z taco $ */
+/* $Id: directions.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef DIRECTIONS_H
# define DIRECTIONS_H
@@ -33,7 +33,7 @@
# define dir_RTT 24
-/* # define dir_array_size 25 */ /* |dir_RTT + 1| */
+ /* # define dir_array_size 25 *//* |dir_RTT + 1| */
/* inv(primary) == tertiary */
/*
@@ -44,7 +44,7 @@ _is_mirrored[dir_LTL] = 0;
_is_mirrored[dir_RTT] = 0;
*/
-#define is_mirrored(a) 0
+# define is_mirrored(a) 0
/* secondary == tertiary */
/*
@@ -55,7 +55,7 @@ _is_rotated[dir_LTL] = 0;
_is_rotated[dir_RTT] = 1;
*/
-#define is_rotated(a) (a == dir_RTT)
+# define is_rotated(a) (a == dir_RTT)
/* secondary == secondary */
/*
@@ -78,7 +78,7 @@ _textdir_parallel[dir_RTT][dir_LTL] = 1;
_textdir_parallel[dir_RTT][dir_RTT] = 1;
*/
-#define textdir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
+# define textdir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
((a == dir_LTL || a == dir_RTT)&&(b == dir_LTL || b == dir_RTT)))
@@ -104,7 +104,7 @@ _pardir_parallel[dir_RTT][dir_RTT] = 1;
*/
-#define pardir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
+# define pardir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
((a == dir_LTL || a == dir_RTT)&&(b == dir_LTL || b == dir_RTT)))
@@ -129,7 +129,7 @@ _pardir_opposite[dir_RTT][dir_LTL] = 1;
_pardir_opposite[dir_RTT][dir_RTT] = 0;
*/
-#define pardir_opposite(a,b) ((a == dir_LTL && b == dir_RTT)||(a == dir_RTT && b == dir_LTL))
+# define pardir_opposite(a,b) ((a == dir_LTL && b == dir_RTT)||(a == dir_RTT && b == dir_LTL))
/* inv(secondary) == secondary */
@@ -153,7 +153,7 @@ _textdir_opposite[dir_RTT][dir_LTL] = 0;
_textdir_opposite[dir_RTT][dir_RTT] = 0;
*/
-#define textdir_opposite(a,b) ((a == dir_TLT && b == dir_TRT)||(a == dir_TRT && b == dir_TLT))
+# define textdir_opposite(a,b) ((a == dir_TLT && b == dir_TRT)||(a == dir_TRT && b == dir_TLT))
/* inv(tertiary) == tertiary */
@@ -177,7 +177,7 @@ _glyphdir_opposite[dir_RTT][dir_LTL] = 0;
_glyphdir_opposite[dir_RTT][dir_RTT] = 0;
*/
-#define glyphdir_opposite(a,b) 0
+# define glyphdir_opposite(a,b) 0
/* primary == primary */
@@ -201,7 +201,7 @@ _pardir_eq[dir_RTT][dir_LTL] = 0;
_pardir_eq[dir_RTT][dir_RTT] = 1;
*/
-#define pardir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT))|| \
+# define pardir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT))|| \
(a == dir_LTL && b == dir_LTL) || \
(a == dir_RTT && b == dir_RTT))
@@ -226,7 +226,7 @@ _textdir_eq[dir_RTT][dir_LTL] = 1;
_textdir_eq[dir_RTT][dir_RTT] = 1;
*/
-#define textdir_eq(a,b) ((a == dir_TLT && b == dir_TLT) || \
+# define textdir_eq(a,b) ((a == dir_TLT && b == dir_TLT) || \
(a == dir_TRT && b == dir_TRT) || \
(a == dir_LTL && (b == dir_LTL || b == dir_RTT)) || \
(a == dir_RTT && (b == dir_LTL || b == dir_RTT))
@@ -253,9 +253,9 @@ _glyphdir_eq[dir_RTT][dir_LTL] = 0;
_glyphdir_eq[dir_RTT][dir_RTT] = 1;
*/
-#define glyphdir_eq(a,b) ((a != dir_LTL && b != dir_LTL) || \
+# define glyphdir_eq(a,b) ((a != dir_LTL && b != dir_LTL) || \
(a == dir_LTL && b == dir_LTL))
-
+
/* primary == secondary */
/*
@@ -278,7 +278,7 @@ _partextdir_eq[dir_RTT][dir_LTL] = 0;
_partextdir_eq[dir_RTT][dir_RTT] = 0;
*/
-#define partextdir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_LTL || b == dir_RTT)) || \
+# define partextdir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_LTL || b == dir_RTT)) || \
(a == dir_LTL && b == dir_TLT) || \
(a == dir_RTT && b == dir_TRT))
@@ -292,7 +292,7 @@ _textglyphdir_orthogonal[dir_LTL] = 1;
_textglyphdir_orthogonal[dir_RTT] = 0;
*/
-#define textglyphdir_orthogonal(a) (a != dir_RTT)
+# define textglyphdir_orthogonal(a) (a != dir_RTT)
/* secondary == L */
/*
diff --git a/Build/source/texk/web2c/luatexdir/tex/directions.w b/Build/source/texk/web2c/luatexdir/tex/directions.w
index d89c407c7a9..15f03049bf4 100644
--- a/Build/source/texk/web2c/luatexdir/tex/directions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/directions.w
@@ -22,7 +22,7 @@
static const char _svn_version[] =
"$Id: directions.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/directions.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/directions.w $";
@ @c
void scan_direction(void)
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.h b/Build/source/texk/web2c/luatexdir/tex/dumpdata.h
index 44f7fabe96d..3b29ca6372d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.h
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.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: dumpdata.h 3612 2010-04-13 09:29:42Z taco $ */
+/* $Id: dumpdata.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef DUMPDATA_H
# define DUMPDATA_H
@@ -38,9 +38,9 @@ extern boolean load_fmt_file(const char *);
extern void do_zdump(char *, int, int, FILE *);
extern void do_zundump(char *, int, int, FILE *);
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
-extern void swap_items(char *p, int nitems, int size); /* in luatex.c */
-#endif
+# if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
+extern void swap_items(char *p, int nitems, int size); /* in luatex.c */
+# endif
/* Like do_undump, but check each value against LOW and HIGH. The
slowdown isn't significant, and this improves the chances of
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
index 975fbb24c5f..8a58fa94144 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: dumpdata.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/dumpdata.w $";
+ "$Id: dumpdata.w 3849 2010-09-01 09:10:48Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/dumpdata.w $";
#define font_id_text(A) cs_text(font_id_base+(A))
#define prev_depth cur_list.prev_depth_field
@@ -62,6 +62,7 @@ void store_fmt_file(void)
halfword p; /* all-purpose pointer */
int x; /* something to dump */
char *format_engine;
+ int callback_id; /* |pre_dump| callback */
char *fmtname = NULL;
/* If dumping is not allowed, abort */
/* The user is not allowed to dump a format file unless |save_ptr=0|.
@@ -75,6 +76,10 @@ void store_fmt_file(void)
/* Create the |format_ident|, open the format file, and inform the user
that dumping has begun */
+ callback_id = callback_defined(pre_dump_callback);
+ if (callback_id > 0) {
+ (void) run_callback(callback_id, "->");
+ }
selector = new_string;
tprint(" (format=");
print(job_name);
@@ -284,11 +289,6 @@ void store_fmt_file(void)
print_char('s');
dump_math_data();
- /* Dump the ocp information */
- dump_active_ocp_info();
- dump_ocp_info();
- dump_ocplist_info();
-
/* Dump the hyphenation tables */
dump_language_data();
@@ -493,11 +493,6 @@ boolean load_fmt_file(const char *fmtname)
undump_math_data();
make_pdftex_banner();
- /* Undump the ocp information */
- undump_active_ocp_info();
- undump_ocp_info();
- undump_ocplist_info();
-
/* Undump the hyphenation tables */
undump_language_data();
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
index 99894d4226a..c0616d91ad5 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.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: equivalents.h 3385 2010-01-26 05:45:55Z taco $ */
+/* $Id: equivalents.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef EQUIVALENTS_H
# define EQUIVALENTS_H
@@ -36,11 +36,6 @@ emphasize this distinction.
*/
# define font_base 0 /* smallest internal font number; must not be less than |min_quarterword| */
-# define ocp_base 0
-# define number_ocps 32768
-# define ocp_list_base 0
-# define number_ocp_lists 32768
-# define max_active_ocp_lists 32768
# define biggest_reg 65535 /* the largest allowed register number; must be |< max_quarterword| */
# define number_regs 65536 /* |biggest_reg+1| */
# define number_attrs 65536 /* total numbeer of attributes */
@@ -145,12 +140,7 @@ here, and the |number_regs| \.{\\dimen} registers.
# define frozen_special (frozen_control_sequence+12 ) /* permanent `\.{\\special}' */
# define frozen_null_font (frozen_control_sequence+13 ) /* permanent `\.{\\nullfont}' */
# define font_id_base (frozen_null_font-font_base ) /* begins table of |number_fonts| permanent font identifiers */
-# define frozen_null_ocp (frozen_null_font+number_fonts ) /* permanent `\.{\\nullocp}' */
-# define ocp_id_base (frozen_null_ocp-ocp_base )
- /* begins table of |number_ocps| permanent ocp identifiers */
-# define frozen_null_ocp_list (frozen_null_ocp+number_ocps ) /* permanent `\.{\\nullocplist}' */
-# define ocp_list_id_base (frozen_null_ocp_list-ocp_list_base ) /* begins table of |number_ocp_lists| permanent ocp list identifiers */
-# define undefined_control_sequence (frozen_null_ocp_list+number_ocp_lists)
+# define undefined_control_sequence (frozen_null_font+number_fonts)
# define glue_base (undefined_control_sequence+1) /* beginning of region 3 */
# define line_skip_code 0 /* interline glue if |baseline_skip| is infeasible */
@@ -200,12 +190,7 @@ here, and the |number_regs| \.{\\dimen} registers.
# define pdf_xform_resources_loc (pdftex_first_loc + 4) /* points to token list for \.{\\pdfxformresources} */
# define pdf_pk_mode_loc (pdftex_first_loc + 5) /* points to token list for \.{\\pdfpkmode} */
# define pdf_toks (pdftex_first_loc+6) /* end of \pdfTeX's token list parameters */
-# define ocp_trace_level_base (pdf_toks)
-# define ocp_active_number_base (ocp_trace_level_base+1)
-# define ocp_active_min_ptr_base (ocp_active_number_base+1)
-# define ocp_active_max_ptr_base (ocp_active_min_ptr_base+1)
-# define ocp_active_base (ocp_active_max_ptr_base+1)
-# define toks_base (ocp_active_base+max_active_ocp_lists) /* table of |number_regs| token list registers */
+# define toks_base (pdf_toks) /* table of |number_regs| token list registers */
# define etex_pen_base (toks_base+number_regs) /* start of table of \eTeX's penalties */
# define inter_line_penalties_loc (etex_pen_base) /* additional penalties between lines */
# define club_penalties_loc (etex_pen_base+1) /* penalties for creating club lines */
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.w b/Build/source/texk/web2c/luatexdir/tex/equivalents.w
index a7a425376c4..a3639112620 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.w
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: equivalents.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/equivalents.w $";
+ "$Id: equivalents.w 3849 2010-09-01 09:10:48Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/equivalents.w $";
@ @c
#define par_shape_ptr equiv(par_shape_loc)
@@ -1017,7 +1017,6 @@ void show_eqtb(halfword n)
print_int(vinfo(par_shape_ptr + 1));
}
} else if (n < toks_base) {
- /* TODO make extra cases for ocps here! */
print_cmd_chr(assign_toks_cmd, n);
print_char('=');
if (equiv(n) != null)
@@ -1130,7 +1129,6 @@ void show_eqtb_meaning(halfword n)
else
print_cmd_chr(set_etex_shape_cmd, n);
} else if (n < toks_base) {
- /* TODO make extra cases for ocps here! */
print_cmd_chr(assign_toks_cmd, n);
} else if (n < box_base) {
tprint_esc("toks");
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w
index 1a6ec9a46e0..3a5bb4c8647 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.w
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.w
@@ -22,7 +22,7 @@
static const char _svn_version[] =
"$Id: errors.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/errors.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/errors.w $";
@ @c
#define new_line_char int_par(new_line_char_code)
diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.w b/Build/source/texk/web2c/luatexdir/tex/expand.w
index 4f92a2fdd95..1a203d0c0e2 100644
--- a/Build/source/texk/web2c/luatexdir/tex/expand.w
+++ b/Build/source/texk/web2c/luatexdir/tex/expand.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: expand.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/expand.w $";
+ "$Id: expand.w 3802 2010-08-07 12:03:08Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/expand.w $";
@ Only a dozen or so command codes |>max_command| can possibly be returned by
@@ -344,7 +344,7 @@ void manufacture_csname(void)
} else {
cur_cs = null_cs; /* the list is empty */
}
- xfree(ss->s);
+ free_lstring(ss);
flush_list(r);
if (eq_type(cur_cs) == undefined_cs_cmd) {
eq_define(cur_cs, relax_cmd, too_big_char); /* N.B.: The |save_stack| might change */
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w
index 62c9e65fa8a..38e91d0a94e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w
@@ -22,8 +22,8 @@
@ @c
static const char _svn_version[] =
- "$Id: extensions.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/extensions.w $";
+ "$Id: extensions.w 3851 2010-09-03 11:55:16Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/extensions.w $";
#include "ptexlib.h"
@@ -208,7 +208,7 @@ void do_extension(PDF pdf)
true);
do_extension(pdf); /* scan form and set |pdf_last_xform| */
pdf_cur_form = pdf_last_xform;
- ship_out(pdf, obj_xform_box(pdf, pdf_last_xform), false);
+ ship_out(pdf, obj_xform_box(pdf, pdf_last_xform), SHIPPING_FORM);
break;
case pdf_ximage_code:
check_o_mode(pdf, "\\immediate\\pdfximage", 1 << OMODE_PDF,
@@ -500,7 +500,7 @@ void do_extension(PDF pdf)
break;
case late_lua_node:
/* Implement \.{\\latelua} */
- new_whatsit(late_lua_node);
+ new_whatsit(late_lua_node); /* type == normal */
late_lua_name(tail) = scan_lua_state();
(void) scan_toks(false, false);
late_lua_data(tail) = def_ref;
diff --git a/Build/source/texk/web2c/luatexdir/tex/filename.w b/Build/source/texk/web2c/luatexdir/tex/filename.w
index 4757bfc19cd..77776a50087 100644
--- a/Build/source/texk/web2c/luatexdir/tex/filename.w
+++ b/Build/source/texk/web2c/luatexdir/tex/filename.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: filename.w 3587 2010-04-03 14:32:25Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/filename.w $";
+ "$Id: filename.w 3802 2010-08-07 12:03:08Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/filename.w $";
@ In order to isolate the system-dependent aspects of file names, the
@@ -107,6 +107,7 @@ static void end_name(void)
cur_string[area_delimiter] = '\0';
cur_length = (unsigned) strlen((char *) cur_string);
cur_area = make_string();
+ xfree(cur_string);
cur_length = (unsigned) strlen((char *) s);
cur_string = s;
}
@@ -119,6 +120,7 @@ static void end_name(void)
cur_string[l] = '\0';
cur_length = (unsigned) strlen((char *) cur_string);
cur_name = make_string();
+ xfree(cur_string);
cur_length = (unsigned) strlen((char *) s);
cur_string = s;
cur_ext = make_string();
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.h b/Build/source/texk/web2c/luatexdir/tex/inputstack.h
index 428bd9d2adb..246bc93e9e2 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.h
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.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: inputstack.h 3720 2010-06-13 08:04:27Z taco $ */
+/* $Id: inputstack.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef INPUTSTACK_H
# define INPUTSTACK_H 1
@@ -33,10 +33,8 @@ typedef struct in_state_record {
halfword loc_field;
halfword limit_field;
halfword name_field;
- halfword ocp_lstack_field; /* used for omega translation processes */
int synctex_tag_field; /* stack the tag of the current file */
- signed int ocp_no_field:16; /* used for omega translation processes */
- signed int cattable_field:16; /* category table used by the current line (see textoken.c) */
+ signed int cattable_field:16; /* category table used by the current line (see textoken.c) */
quarterword state_field:8;
quarterword index_field:8;
boolean partial_field:8; /* is the current line partial? (see textoken.c) */
@@ -56,8 +54,6 @@ extern in_state_record cur_input; /* the ``top'' input state */
# define iname cur_input.name_field /* name of the current file */
# define nofilter cur_input.nofilter_field /* is token filtering explicitly disallowed? */
# define synctex_tag cur_input.synctex_tag_field /* tag of the current file */
-# define current_ocp_lstack cur_input.ocp_lstack_field /* name of the current ocp */
-# define current_ocp_no cur_input.ocp_no_field /* name of the current ocp */
# define line_catcode_table cur_input.cattable_field
# define line_partial cur_input.partial_field
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.w b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
index 3e1c33bd9b8..857f86dfe6e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.w
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: inputstack.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/inputstack.w $";
+ "$Id: inputstack.w 3849 2010-09-01 09:10:48Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/inputstack.w $";
@ @c
#define end_line_char int_par(end_line_char_code)
@@ -286,14 +286,7 @@ void show_context(void)
/* we omit backed-up token lists that have already been read */
tally = 0; /* get ready to count characters */
old_setting = selector;
- if (current_ocp_lstack > 0) {
- tprint_nl("OCP stack ");
- print_scaled(current_ocp_lstack);
- tprint(" entry ");
- print_int(current_ocp_no);
- tprint(":");
- PSEUDO_PRINT_THE_LINE();
- } else if (istate != token_list) {
+ if (istate != token_list) {
/* Print location of current line */
/*
This routine should be changed, if necessary, to give the best possible
@@ -623,8 +616,6 @@ void initialize_inputstack(void)
iindex = 0;
line = 0;
iname = 0;
- current_ocp_lstack = 0;
- current_ocp_no = 0;
nofilter = false;
force_eof = false;
luacstrings = 0;
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.h b/Build/source/texk/web2c/luatexdir/tex/linebreak.h
index 791a5f0de7c..e91b3f2fa27 100644
--- a/Build/source/texk/web2c/luatexdir/tex/linebreak.h
+++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.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: linebreak.h 3526 2010-03-19 20:56:38Z taco $ */
+/* $Id: linebreak.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef LINEBREAK_H
# define LINEBREAK_H
@@ -68,13 +68,13 @@ extern void ext_do_line_break(int paragraph_dir,
int broken_penalty, halfword final_par_glue,
halfword pdf_ignored_dimen);
-extern void get_linebreak_info (int *, int *) ;
+extern void get_linebreak_info(int *, int *);
extern halfword find_protchar_left(halfword l, boolean d);
extern halfword find_protchar_right(halfword l, halfword r);
/* skipable nodes at the margins during character protrusion */
-#define cp_skipable(a) ((! is_char_node((a))) && \
+# define cp_skipable(a) ((! is_char_node((a))) && \
((type((a)) == ins_node) \
|| (type((a)) == mark_node) \
|| (type((a)) == adjust_node) \
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
index f5b958eb9bd..1478839f8d6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w
+++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: linebreak.w 3587 2010-04-03 14:32:25Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/linebreak.w $";
+ "$Id: linebreak.w 3995 2010-11-28 09:49:37Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/linebreak.w $";
@ We come now to what is probably the most interesting algorithm of \TeX:
the mechanism for choosing the ``best possible'' breakpoints that yield
@@ -139,14 +139,21 @@ void line_break(boolean d, int line_break_context)
lua_linebreak_callback(d, temp_head,
addressof(cur_list.tail_field));
if (callback_id > 0) {
- just_box = cur_list.tail_field;
- if (just_box != null)
- while (vlink(just_box) != null)
- just_box = vlink(just_box);
- if ((just_box == null) || (type(just_box) != hlist_node)) {
+ /* find the correct value for the |just_box| */
+ halfword box_search = cur_list.tail_field;
+ just_box = null;
+ if (box_search != null) {
+ do {
+ if (type(box_search) == hlist_node) {
+ just_box = box_search;
+ }
+ box_search = vlink(box_search);
+ } while (box_search != null);
+ }
+ if (just_box == null) {
help3
("A linebreaking routine should return a non-empty list of nodes",
- "and the last one of those has to be a \\hbox.",
+ "and at least one of those has to be a \\hbox.",
"Sorry, I cannot recover from this.");
print_err("Invalid linebreak_filter");
succumb();
@@ -898,8 +905,6 @@ compute_break_width(int break_type, int line_break_dir, int pdf_adjust_spacing,
} else {
s = null;
}
- } else {
- s = p; /* unhyphenated: we need to 'skip' any 'whitespace' following */
}
while (s != null) {
switch (type(s)) {
@@ -1781,7 +1786,7 @@ ext_do_line_break(int paragraph_dir,
/* LOCAL: Initialize with first |local_paragraph| node */
if ((cur_p != null) && (type(cur_p) == whatsit_node)
&& (subtype(cur_p) == local_par_node)) {
- assert(alink(cur_p) == temp_head);
+ alink(cur_p) = temp_head; /* this used to be an assert, but may as well force it */
internal_pen_inter = local_pen_inter(cur_p);
internal_pen_broken = local_pen_broken(cur_p);
init_internal_left_box = local_box_left(cur_p);
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.h b/Build/source/texk/web2c/luatexdir/tex/mainbody.h
index 93794932cc9..98434521776 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.h
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.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: mainbody.h 3612 2010-04-13 09:29:42Z taco $ */
+/* $Id: mainbody.h 3911 2010-10-16 07:28:11Z taco $ */
#ifndef MAINBODY_H
# define MAINBODY_H
@@ -37,7 +37,7 @@ in production versions of \TeX.
@^system dependencies@>
*/
-# define ssup_max_strings 262143
+# define ssup_max_strings 2097151
# define inf_max_strings 100000
# define sup_max_strings ssup_max_strings
@@ -54,7 +54,7 @@ in production versions of \TeX.
# define sup_max_in_open 127
# define inf_param_size 60
-# define sup_param_size 6000
+# define sup_param_size 32767
# define inf_save_size 600
# define sup_save_size 80000
@@ -68,15 +68,8 @@ in production versions of \TeX.
# define sup_hash_extra sup_max_strings
# define inf_hash_extra 0
-# define sup_ocp_list_size 1000000
-# define inf_ocp_list_size 1000
-# define sup_ocp_buf_size 100000000
-# define inf_ocp_buf_size 1000
-# define sup_ocp_stack_size 1000000
-# define inf_ocp_stack_size 1000
-
# define inf_expand_depth 100
-# define sup_expand_depth 1000000
+# define sup_expand_depth 10000000
# include <stdio.h>
@@ -136,9 +129,6 @@ extern char *bound_name;
extern int error_line;
extern int half_error_line;
extern int max_print_line;
-extern int ocp_list_size;
-extern int ocp_buf_size;
-extern int ocp_stack_size;
extern int max_strings;
extern int strings_free;
extern int font_k;
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
index fea85fa31be..93ea9018d13 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
@@ -25,8 +25,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: mainbody.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/mainbody.w $";
+ "$Id: mainbody.w 4061 2011-01-11 19:31:03Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/mainbody.w $";
@
pdfTeX is copyright (C) 1996-2006 Han The Thanh, <thanh@@pdftex.org>.
@@ -206,9 +206,6 @@ int error_line; /* width of context lines on terminal error mess
int half_error_line; /* width of first lines of contexts in terminal
error messages; should be between 30 and |error_line-15| */
int max_print_line; /* width of longest text lines output; should be at least 60 */
-int ocp_list_size;
-int ocp_buf_size;
-int ocp_stack_size;
int max_strings; /* maximum number of strings; must not exceed |max_halfword| */
int strings_free; /* strings available after format loaded */
int font_k; /* loop variable for initialization */
@@ -301,9 +298,6 @@ int main_initialize(void)
setup_bound_var(79, "error_line", error_line);
setup_bound_var(50, "half_error_line", half_error_line);
setup_bound_var(79, "max_print_line", max_print_line);
- setup_bound_var(1000, "ocp_list_size", ocp_list_size);
- setup_bound_var(1000, "ocp_buf_size", ocp_buf_size);
- setup_bound_var(1000, "ocp_stack_size", ocp_stack_size);
setup_bound_var(0, "hash_extra", hash_extra);
setup_bound_var(72, "pk_dpi", pk_dpi);
setup_bound_var(10000, "expand_depth", expand_depth);
@@ -338,8 +332,6 @@ int main_initialize(void)
full_source_filename_stack = xmallocarray(char *, (unsigned) max_in_open);
param_stack = xmallocarray(halfword, (unsigned) param_size);
dvi_buf = xmallocarray(eight_bits, (unsigned) dvi_buf_size);
- initialize_ocplist_arrays(ocp_list_size);
- initialize_ocp_buffers(ocp_buf_size, ocp_stack_size);
if (ini_version) {
fixmem = xmallocarray(smemory_word, fix_mem_init + 1);
@@ -451,7 +443,7 @@ void main_body(void)
if (pdf_output_option != 0)
int_par(pdf_output_code) = pdf_output_value;
if (pdf_draftmode_option != 0)
- int_par(pdf_draftmode_code) = pdf_draftmode_value;
+ pdf_draftmode = static_pdf->draftmode = pdf_draftmode_value;
pdf_init_map_file((char *) pdftex_map);
if (end_line_char_inactive())
decr(ilimit);
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h b/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
index e07f1e23cd9..daa2527a0a0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.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: maincontrol.h 3354 2010-01-11 08:49:33Z taco $ */
+/* $Id: maincontrol.h 3752 2010-07-27 10:18:24Z taco $ */
#ifndef MAINCONTROL_H
# define MAINCONTROL_H
@@ -157,6 +157,7 @@ extern void fixup_directions(void);
# define is_int_assign(cmd) (cmd==assign_int_cmd)
# define is_dim_assign(cmd) (cmd==assign_dimen_cmd)
+# define is_glue_assign(cmd) (cmd==assign_glue_cmd)
# define is_toks_assign(cmd) (cmd==assign_toks_cmd)
# define show_code 0 /* \.{\\show} */
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
index 38b508f31d3..6b17a5bdb8d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: maincontrol.w 3659 2010-04-28 15:10:32Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/maincontrol.w $";
+ "$Id: maincontrol.w 4023 2010-12-05 15:10:06Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/maincontrol.w $";
#include "ptexlib.h"
@@ -178,716 +178,737 @@ is very welcome, which is why I need to have the next two globals:
internal_font_number space_spec_font;
halfword space_spec_cache;
-@ for mode-independent commands, the following macros is useful:
+@ To handle the execution state of |main_control|'s eternal loop,
+an extra global variable is used, along with a macro to define
+its values.
@c
-#define any_mode(A) vmode+(A): case hmode+(A): case mmode+(A)
+#define goto_next 0
+#define goto_skip_token 1
+#define goto_return 2
+static int main_control_state;
-@ There is a list of cases where the user has probably gotten into or out of math
-mode by mistake. \TeX\ will insert a dollar sign and rescan the current token.
+@* Main control helpers.
+
+Here are all the functions that are called from |main_control| that
+are not already defined elsewhere. For the moment, this list simply
+in the order that the appear in |init_main_control|, below.
+
+@
@c
-#define non_math(A) vmode+(A): case hmode+(A)
+static void run_char_num (void) {
+ scan_char_num();
+ cur_chr = cur_val;
+ adjust_space_factor();
+ tail_append(new_char(cur_font, cur_chr));
+}
+
+static void run_char (void) {
+ adjust_space_factor();
+ tail_append(new_char(cur_font, cur_chr));
+}
-@ @c
-void main_control(void)
-{ /* governs \TeX's activities */
- int t; /* general-purpose temporary variable */
- halfword p; /* for whatsit nodes and testing whether an auto kern should be inserted */
- int chr_stack; /* to temporarily save an |cur_chr| to be appended */
- mathcodeval mval; /* to build up an argument to |set_math_char| */
- t = 0; /* for -Wall */
- chr_stack = -1;
- if (equiv(every_job_loc) != null)
- begin_token_list(equiv(every_job_loc), every_job_text);
+@
+The occurrence of blank spaces is almost part of \TeX's inner loop,
+since we usually encounter about one space for every five non-blank characters.
+Therefore |main_control| gives second-highest priority to ordinary spaces.
- BIG_SWITCH:
- get_x_token();
+When a glue parameter like \.{\\spaceskip} is set to `\.{0pt}', we will
+see to it later that the corresponding glue specification is precisely
+|zero_glue|, not merely a pointer to some specification that happens
+to be full of zeroes. Therefore it is simple to test whether a glue parameter
+is zero or~not.
- RESWITCH:
- /* Give diagnostic information, if requested */
- /* When a new token has just been fetched at |big_switch|, we have an
- ideal place to monitor \TeX's activity. */
- if (interrupt != 0) {
- if (OK_to_interrupt) {
- back_input();
- check_interrupt();
- goto BIG_SWITCH;
- }
- }
- if (int_par(tracing_commands_code) > 0)
- show_cur_cmd_chr();
- switch (abs(mode) + cur_cmd) {
- case hmode + letter_cmd:
- case hmode + other_char_cmd:
- case hmode + char_given_cmd:
- case hmode + char_num_cmd:
- if (abs(mode) + cur_cmd == hmode + char_num_cmd) {
- scan_char_num();
- cur_chr = cur_val;
- }
- if (is_last_ocp(current_ocp_lstack, current_ocp_no)) {
- /* Append character |cur_chr| and the following characters (if~any)
- to the current hlist in the current font; |goto reswitch| when
- a non-character has been fetched */
- CONTINUE:
- adjust_space_factor();
- chr_stack = cur_chr;
- tail_append(new_char(cur_font, chr_stack));
- get_x_token();
- if ((cur_cmd == letter_cmd) || (cur_cmd == other_char_cmd) ||
- (cur_cmd == char_given_cmd) || (cur_cmd == char_num_cmd)) {
- if (cur_cmd == char_num_cmd) {
- scan_char_num();
- cur_chr = cur_val;
- }
- if ((chr_stack == ex_hyphen_char) && (cur_chr != ex_hyphen_char)
- && (mode > 0)) {
- tail = compound_word_break(tail, cur_lang);
- subtype(tail) = automatic_disc;
- }
- goto CONTINUE;
- } else {
- if ((chr_stack == ex_hyphen_char) && (mode > 0)) {
- tail = compound_word_break(tail, cur_lang);
- subtype(tail) = automatic_disc;
- }
- chr_stack = -1;
- goto RESWITCH;
+@c
+static void run_app_space (void) {
+ if ((abs(mode) + cur_cmd == hmode + spacer_cmd)
+ && (!(space_factor == 1000))) {
+ app_space();
+ } else {
+ /* Append a normal inter-word space to the current list */
+ if (space_skip == zero_glue) {
+ /* Find the glue specification, |main_p|, for
+ text spaces in the current font */
+ if (cur_font != space_spec_font) {
+ if (space_spec_cache != zero_glue)
+ delete_glue_ref(space_spec_cache);
+ space_spec_cache = new_spec(zero_glue);
+ width(space_spec_cache) = space(cur_font);
+ stretch(space_spec_cache) = space_stretch(cur_font);
+ shrink(space_spec_cache) = space_shrink(cur_font);
+ space_spec_font = cur_font;
}
+ main_p = space_spec_cache;
+ temp_ptr = new_glue(main_p);
} else {
- /* Create a buffer with character |cur_chr| and the following
- characters (if~any) and then apply the current active OCP filter
- to this buffer */
- run_ocp();
- goto BIG_SWITCH;
-
+ temp_ptr = new_param_glue(space_skip_code);
}
- break;
- case hmode + spacer_cmd:
- case hmode + ex_space_cmd:
- case mmode + ex_space_cmd:
- if ((abs(mode) + cur_cmd == hmode + spacer_cmd)
- && (!(space_factor == 1000))) {
- app_space();
- } else {
- /* Append a normal inter-word space to the current list */
- /* The occurrence of blank spaces is almost part of \TeX's inner loop,
- since we usually encounter about one space for every five non-blank characters.
- Therefore |main_control| gives second-highest priority to ordinary spaces.
-
- When a glue parameter like \.{\\spaceskip} is set to `\.{0pt}', we will
- see to it later that the corresponding glue specification is precisely
- |zero_glue|, not merely a pointer to some specification that happens
- to be full of zeroes. Therefore it is simple to test whether a glue parameter
- is zero or~not.
- */
- if (space_skip == zero_glue) {
- /* Find the glue specification, |main_p|, for
- text spaces in the current font */
- if (cur_font != space_spec_font) {
- if (space_spec_cache != zero_glue)
- delete_glue_ref(space_spec_cache);
- space_spec_cache = new_spec(zero_glue);
- width(space_spec_cache) = space(cur_font);
- stretch(space_spec_cache) = space_stretch(cur_font);
- shrink(space_spec_cache) = space_shrink(cur_font);
- space_spec_font = cur_font;
- }
- main_p = space_spec_cache;
+ couple_nodes(tail,temp_ptr);
+ tail = temp_ptr;
- temp_ptr = new_glue(main_p);
- } else {
- temp_ptr = new_param_glue(space_skip_code);
- }
- vlink(tail) = temp_ptr;
- tail = temp_ptr;
-
- }
- break;
+ }
+}
- case hmode + no_boundary_cmd:
- /* Append a |cancel_boundary_node| */
- new_whatsit(cancel_boundary_node);
- break;
- case hmode + char_ghost_cmd:
- t = cur_chr;
- get_x_token();
- if ((cur_cmd == letter_cmd) || (cur_cmd == other_char_cmd)
- || (cur_cmd == char_given_cmd) || (cur_cmd == char_num_cmd)) {
- p = new_glyph(get_cur_font(), cur_chr);
- if (t == 0) {
- set_is_leftghost(p);
- } else {
- set_is_rightghost(p);
- }
- tail_append(p);
- }
- break;
- /* Cases of |main_control| that are not part of the inner loop */
- case any_mode(relax_cmd):
- case vmode + spacer_cmd:
- case mmode + spacer_cmd:
- case mmode + no_boundary_cmd:
- break;
- case any_mode(ignore_spaces_cmd):
- if (cur_chr == 0) {
- /* Get the next non-blank non-call... */
- do {
- get_x_token();
- } while (cur_cmd == spacer_cmd);
+@ Append a |cancel_boundary_node|
+@c
+static void run_no_boundary (void) {
+ new_whatsit(cancel_boundary_node);
+}
- goto RESWITCH;
+@ @c
+static void run_char_ghost (void) {
+ int t;
+ t = cur_chr;
+ get_x_token();
+ if ((cur_cmd == letter_cmd) || (cur_cmd == other_char_cmd)
+ || (cur_cmd == char_given_cmd) || (cur_cmd == char_num_cmd)) {
+ halfword p = new_glyph(get_cur_font(), cur_chr);
+ if (t == 0) {
+ set_is_leftghost(p);
} else {
- t = scanner_status;
- scanner_status = normal;
- get_token_lua();
- scanner_status = t;
- cur_cs = prim_lookup(cs_text(cur_cs));
- if (cur_cs != undefined_primitive) {
- cur_cmd = get_prim_eq_type(cur_cs);
- cur_chr = get_prim_equiv(cur_cs);
- cur_tok = (cur_cmd * STRING_OFFSET) + cur_chr;
- goto RESWITCH;
- }
+ set_is_rightghost(p);
}
- break;
- case vmode + stop_cmd:
- if (its_all_over())
- return; /* this is the only way out */
- break;
- /* Math cases in non-math modes */
- case vmode + math_char_num_cmd:
- case vmode + math_given_cmd:
- case vmode + omath_given_cmd:
- case vmode + xmath_given_cmd:
- back_input();
- new_graf(true);
- break;
- case hmode + math_char_num_cmd:
- if (cur_chr == 0)
- mval = scan_mathchar(tex_mathcode);
- else if (cur_chr == 1)
- mval = scan_mathchar(aleph_mathcode);
- else if (cur_chr == 2)
- mval = scan_mathchar(xetex_mathcode);
- else
- mval = scan_mathchar(xetexnum_mathcode);
- math_char_in_text(mval);
- break;
- case hmode + math_given_cmd:
- mval = mathchar_from_integer(cur_chr, tex_mathcode);
- math_char_in_text(mval);
- break;
- case hmode + omath_given_cmd:
- mval = mathchar_from_integer(cur_chr, aleph_mathcode);
- math_char_in_text(mval);
- break;
- case hmode + xmath_given_cmd:
- mval = mathchar_from_integer(cur_chr, xetex_mathcode);
- math_char_in_text(mval);
- break;
-
- /* Forbidden cases detected in |main_control| */
- case vmode + vmove_cmd:
- case hmode + hmove_cmd:
- case mmode + hmove_cmd:
- case any_mode(last_item_cmd):
- case vmode + vadjust_cmd:
- case vmode + ital_corr_cmd:
- case non_math(eq_no_cmd):
- case any_mode(mac_param_cmd):
- /* When erroneous situations arise, \TeX\ usually issues an error message
- specific to the particular error. For example, `\.{\\noalign}' should
- not appear in any mode, since it is recognized by the |align_peek| routine
- in all of its legitimate appearances; a special error message is given
- when `\.{\\noalign}' occurs elsewhere. But sometimes the most appropriate
- error message is simply that the user is not allowed to do what he or she
- has attempted. For example, `\.{\\moveleft}' is allowed only in vertical mode,
- and `\.{\\lower}' only in non-vertical modes. Such cases are enumerated
- here and in the other sections referred to under `See also \dots.'
- */
- report_illegal_case();
- break;
+ tail_append(p);
+ }
+}
- /* Math-only cases in non-math modes, or vice versa */
- case non_math(sup_mark_cmd):
- case non_math(sub_mark_cmd):
- case non_math(super_sub_script_cmd):
- case non_math(math_comp_cmd):
- case non_math(delim_num_cmd):
- case non_math(left_right_cmd):
- case non_math(above_cmd):
- case non_math(radical_cmd):
- case non_math(math_style_cmd):
- case non_math(math_choice_cmd):
- case non_math(vcenter_cmd):
- case non_math(non_script_cmd):
- case non_math(mkern_cmd):
- case non_math(limit_switch_cmd):
- case non_math(mskip_cmd):
- case non_math(math_accent_cmd):
- case mmode + endv_cmd:
- case mmode + par_end_cmd:
- case mmode + stop_cmd:
- case mmode + vskip_cmd:
- case mmode + un_vbox_cmd:
- case mmode + valign_cmd:
- case mmode + hrule_cmd:
- insert_dollar_sign();
- break;
- /* Cases of |main_control| that build boxes and lists */
- case vmode + hrule_cmd:
- case hmode + vrule_cmd:
- case mmode + vrule_cmd:
- /* The most important parts of |main_control| are concerned with \TeX's
- chief mission of box-making. We need to control the activities that put
- entries on vlists and hlists, as well as the activities that convert
- those lists into boxes. All of the necessary machinery has already been
- developed; it remains for us to ``push the buttons'' at the right times.
-
- As an introduction to these routines, let's consider one of the simplest
- cases: What happens when `\.{\\hrule}' occurs in vertical mode, or
- `\.{\\vrule}' in horizontal mode or math mode? The code in |main_control|
- is short, since the |scan_rule_spec| routine already does most of what is
- required; thus, there is no need for a special action procedure.
-
- Note that baselineskip calculations are disabled after a rule in vertical
- mode, by setting |prev_depth:=pdf_ignored_dimen|.
- */
- tail_append(scan_rule_spec());
- if (abs(mode) == vmode)
- prev_depth = pdf_ignored_dimen;
- else if (abs(mode) == hmode)
- space_factor = 1000;
- break;
+@ @c
+static void run_relax (void) {
+ return;
+}
- case vmode + vskip_cmd:
- case hmode + hskip_cmd:
- case mmode + hskip_cmd:
- case mmode + mskip_cmd:
- /* The processing of things like \.{\\hskip} and \.{\\vskip} is slightly
- more complicated. But the code in |main_control| is very short, since
- it simply calls on the action routine |append_glue|. Similarly, \.{\\kern}
- activates |append_kern|. */
- append_glue();
- break;
- case any_mode(kern_cmd):
- case mmode + mkern_cmd:
- append_kern();
- break;
-
- case non_math(left_brace_cmd):
- /* Many of the actions related to box-making are triggered by the appearance
- of braces in the input. For example, when the user says `\.{\\hbox}
- \.{to} \.{100pt\{$\langle\,\hbox{hlist}\,\rangle$\}}' in vertical mode,
- the information about the box size (100pt, |exactly|) is put onto |save_stack|
- with a level boundary word just above it, and |cur_group:=adjusted_hbox_group|;
- \TeX\ enters restricted horizontal mode to process the hlist. The right
- brace eventually causes |save_stack| to be restored to its former state,
- at which time the information about the box size (100pt, |exactly|) is
- available once again; a box is packaged and we leave restricted horizontal
- mode, appending the new box to the current list of the enclosing mode
- (in this case to the current list of vertical mode), followed by any
- vertical adjustments that were removed from the box by |hpack|.
-
- The next few sections of the program are therefore concerned with the
- treatment of left and right curly braces.
-
- If a left brace occurs in the middle of a page or paragraph, it simply
- introduces a new level of grouping, and the matching right brace will not have
- such a drastic effect. Such grouping affects neither the mode nor the
- current list. */
- new_save_level(simple_group);
- eq_word_define(int_base + no_local_whatsits_code, 0);
- eq_word_define(int_base + no_local_dirs_code, 0);
- break;
- case any_mode(begin_group_cmd):
- new_save_level(semi_simple_group);
- eq_word_define(int_base + no_local_whatsits_code, 0);
- eq_word_define(int_base + no_local_dirs_code, 0);
- break;
- case any_mode(end_group_cmd):
- if (cur_group == semi_simple_group) {
- fixup_directions();
- } else {
- off_save();
+@ |ignore_spaces| is a special case: after it has acted, |get_x_token| has already
+fetched the next token from the input, so that operation in |main_control|
+should be skipped.
+
+@c
+static void run_ignore_spaces (void) {
+ if (cur_chr == 0) {
+ /* Get the next non-blank non-call... */
+ do {
+ get_x_token();
+ } while (cur_cmd == spacer_cmd);
+
+ main_control_state = goto_skip_token;
+ } else {
+ int t = scanner_status;
+ scanner_status = normal;
+ get_token_lua();
+ scanner_status = t;
+ cur_cs = prim_lookup(cs_text(cur_cs));
+ if (cur_cs != undefined_primitive) {
+ cur_cmd = get_prim_eq_type(cur_cs);
+ cur_chr = get_prim_equiv(cur_cs);
+ cur_tok = (cur_cmd * STRING_OFFSET) + cur_chr;
+ main_control_state = goto_skip_token;
}
- break;
- case any_mode(right_brace_cmd):
- handle_right_brace();
- break;
+ }
+}
- case vmode + hmove_cmd:
- case hmode + vmove_cmd:
- case mmode + vmove_cmd:
- /* Constructions that require a box are started by calling |scan_box| with
- a specified context code. The |scan_box| routine verifies
- that a |make_box| command comes next and then it calls |begin_box|.
- */
- t = cur_chr;
- scan_normal_dimen();
- if (t == 0)
- scan_box(cur_val);
- else
- scan_box(-cur_val);
- break;
- case any_mode(leader_ship_cmd):
- scan_box(leader_flag - a_leaders + cur_chr);
- break;
- case any_mode(make_box_cmd):
- begin_box(0);
- break;
- case any_mode(assign_box_dir_cmd):
- scan_register_num();
- cur_box = box(cur_val);
- scan_optional_equals();
- scan_direction();
- if (cur_box != null)
- box_dir(cur_box) = cur_val;
- break;
+@ |stop| is the second special case. We want |main_control| to return to its caller
+if there is nothing left to do.
- case vmode + start_par_cmd:
- /* There is a really small patch to add a new primitive called
- \.{\\quitvmode}. In vertical modes, it is identical to \.{\\indent},
- but in horizontal and math modes it is really a no-op (as opposed to
- \.{\\indent}, which executes the |indent_in_hmode| procedure).
- */
- /* A paragraph begins when horizontal-mode material occurs in vertical mode,
- or when the paragraph is explicitly started by `\.{\\quitvmode}',
- `\.{\\indent}' or `\.{\\noindent}'.
- */
- new_graf((cur_chr > 0));
- break;
- case hmode + start_par_cmd:
- case mmode + start_par_cmd:
- if (cur_chr != 2)
- indent_in_hmode();
- break;
- case vmode + letter_cmd:
- case vmode + other_char_cmd:
- case vmode + char_num_cmd:
- case vmode + char_given_cmd:
- case vmode + char_ghost_cmd:
- case vmode + math_shift_cmd:
- case vmode + math_shift_cs_cmd:
- case vmode + un_hbox_cmd:
- case vmode + vrule_cmd:
- case vmode + accent_cmd:
- case vmode + discretionary_cmd:
- case vmode + hskip_cmd:
- case vmode + valign_cmd:
- case vmode + ex_space_cmd:
- case vmode + no_boundary_cmd:
- back_input();
- new_graf(true);
- break;
+@c
+static void run_stop (void) {
+ if (its_all_over())
+ main_control_state= goto_return; /* this is the only way out */
+}
- case vmode + par_end_cmd:
- /* A paragraph ends when a |par_end| command is sensed, or when we are in
- horizontal mode when reaching the right brace of vertical-mode routines
- like \.{\\vbox}, \.{\\insert}, or \.{\\output}. */
- normal_paragraph();
- if (mode > 0) {
- check_filter("vmode_par");
- build_page();
- }
- break;
- case hmode + par_end_cmd:
- if (align_state < 0)
- off_save(); /* this tries to recover from an alignment that didn't end properly */
- end_graf(bottom_level); /* this takes us to the enclosing mode, if |mode>0| */
- if (mode == vmode) {
- check_filter("hmode_par");
- build_page();
- }
- break;
- case hmode + stop_cmd:
- case hmode + vskip_cmd:
- case hmode + hrule_cmd:
- case hmode + un_vbox_cmd:
- case hmode + halign_cmd:
- head_for_vmode();
- break;
- case any_mode(insert_cmd):
- case hmode + vadjust_cmd:
- case mmode + vadjust_cmd:
- /* Insertion and adjustment and mark nodes are constructed by the following
- pieces of the program. */
- begin_insert_or_adjust();
- break;
- case any_mode(mark_cmd):
- handle_mark();
- break;
- case any_mode(break_penalty_cmd):
- /* Penalty nodes get into a list via the |break_penalty| command. */
- append_penalty();
- break;
- case any_mode(remove_item_cmd):
- /* The |remove_item| command removes a penalty, kern, or glue node if it
- appears at the tail of the current list, using a brute-force linear scan.
- Like \.{\\lastbox}, this command is not allowed in vertical mode (except
- internal vertical mode), since the current list in vertical mode is sent
- to the page builder. But if we happen to be able to implement it in
- vertical mode, we do. */
- delete_last();
- break;
- case vmode + un_vbox_cmd:
- case hmode + un_hbox_cmd:
- case mmode + un_hbox_cmd:
- /* The |un_hbox| and |un_vbox| commands unwrap one of the |number_regs|
- current boxes. */
- unpackage();
- break;
- case hmode + ital_corr_cmd:
- /* Italic corrections are converted to kern nodes when the |ital_corr| command
- follows a character. In math mode the same effect is achieved by appending
- a kern of zero here, since italic corrections are supplied later. */
- append_italic_correction();
- break;
- case mmode + ital_corr_cmd:
- tail_append(new_kern(0));
- break;
- case hmode + discretionary_cmd:
- case mmode + discretionary_cmd:
- append_discretionary();
- break;
- case any_mode(assign_local_box_cmd):
- append_local_box(cur_chr);
- break;
- case hmode + accent_cmd:
- /* We need only one more thing to complete the horizontal mode routines, namely
- the \.{\\accent} primitive. */
- make_accent();
- break;
- case any_mode(car_ret_cmd):
- case any_mode(tab_mark_cmd):
- align_error();
- break;
- case any_mode(no_align_cmd):
- no_align_error();
- break;
- case any_mode(omit_cmd):
- omit_error();
- break;
- case vmode + halign_cmd:
- case hmode + valign_cmd:
- init_align();
- break;
- case mmode + halign_cmd:
- if (privileged()) {
- if (cur_group == math_shift_group)
- init_align();
- else
- off_save();
- }
- break;
- case vmode + endv_cmd:
- case hmode + endv_cmd:
- do_endv();
- break;
- case any_mode(end_cs_name_cmd):
- cs_error();
- break;
- case hmode + math_shift_cmd:
- case hmode + math_shift_cs_cmd:
- init_math();
- break;
- case mmode + eq_no_cmd:
- if (privileged()) {
- if (cur_group == math_shift_group)
- start_eq_no();
- else
- off_save();
- }
- break;
- case mmode + left_brace_cmd:
- math_left_brace();
- break;
- case mmode + letter_cmd:
- case mmode + other_char_cmd:
- case mmode + char_given_cmd:
- set_math_char(get_math_code(cur_chr));
- break;
- case mmode + char_num_cmd:
- scan_char_num();
- cur_chr = cur_val;
- set_math_char(get_math_code(cur_chr));
- break;
- case mmode + math_char_num_cmd:
- if (cur_chr == 0)
- mval = scan_mathchar(tex_mathcode);
- else if (cur_chr == 1)
- mval = scan_mathchar(aleph_mathcode);
- else if (cur_chr == 2)
- mval = scan_mathchar(xetex_mathcode);
- else
- mval = scan_mathchar(xetexnum_mathcode);
- set_math_char(mval);
- break;
- case mmode + math_given_cmd:
- mval = mathchar_from_integer(cur_chr, tex_mathcode);
- set_math_char(mval);
- break;
- case mmode + omath_given_cmd:
- mval = mathchar_from_integer(cur_chr, aleph_mathcode);
- set_math_char(mval);
- break;
- case mmode + xmath_given_cmd:
- mval = mathchar_from_integer(cur_chr, xetex_mathcode);
- set_math_char(mval);
- break;
- case mmode + delim_num_cmd:
- if (cur_chr == 0)
- mval = scan_delimiter_as_mathchar(tex_mathcode);
- else if (cur_chr == 1)
- mval = scan_delimiter_as_mathchar(aleph_mathcode);
- else
- mval = scan_delimiter_as_mathchar(xetex_mathcode);
- set_math_char(mval);
- break;
- case mmode + math_comp_cmd:
- math_math_comp();
- break;
- case mmode + limit_switch_cmd:
- math_limit_switch();
- break;
- case mmode + radical_cmd:
- math_radical();
- break;
- case mmode + accent_cmd:
- case mmode + math_accent_cmd:
- math_ac();
- break;
- case mmode + vcenter_cmd:
- scan_spec(vcenter_group);
- normal_paragraph();
- push_nest();
- mode = -vmode;
+@ @c
+static void run_non_math_math (void) {
+ back_input();
+ new_graf(true);
+}
+
+@ @c
+static void run_math_char_num (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ if (cur_chr == 0)
+ mval = scan_mathchar(tex_mathcode);
+ else if (cur_chr == 1)
+ mval = scan_mathchar(aleph_mathcode);
+ else if (cur_chr == 2)
+ mval = scan_mathchar(xetex_mathcode);
+ else
+ mval = scan_mathchar(xetexnum_mathcode);
+ math_char_in_text(mval);
+}
+
+@ @c
+static void run_math_given (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, tex_mathcode);
+ math_char_in_text(mval);
+}
+
+static void run_omath_given (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, aleph_mathcode);
+ math_char_in_text(mval);
+}
+
+static void run_xmath_given (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, xetex_mathcode);
+ math_char_in_text(mval);
+}
+
+@ The most important parts of |main_control| are concerned with \TeX's
+chief mission of box-making. We need to control the activities that put
+entries on vlists and hlists, as well as the activities that convert
+those lists into boxes. All of the necessary machinery has already been
+developed; it remains for us to ``push the buttons'' at the right times.
+
+As an introduction to these routines, let's consider one of the simplest
+cases: What happens when `\.{\\hrule}' occurs in vertical mode, or
+`\.{\\vrule}' in horizontal mode or math mode? The code in |main_control|
+is short, since the |scan_rule_spec| routine already does most of what is
+required; thus, there is no need for a special action procedure.
+
+Note that baselineskip calculations are disabled after a rule in vertical
+mode, by setting |prev_depth:=pdf_ignored_dimen|.
+
+@c
+static void run_rule (void) {
+ tail_append(scan_rule_spec());
+ if (abs(mode) == vmode)
prev_depth = pdf_ignored_dimen;
- if (every_vbox != null)
- begin_token_list(every_vbox, every_vbox_text);
- break;
- case mmode + math_style_cmd:
- tail_append(new_style((small_number) cur_chr));
- break;
- case mmode + non_script_cmd:
- tail_append(new_glue(zero_glue));
- subtype(tail) = cond_math_glue;
- break;
- case mmode + math_choice_cmd:
- if (cur_chr == 0)
- append_choices();
+ else if (abs(mode) == hmode)
+ space_factor = 1000;
+}
+
+@
+Many of the actions related to box-making are triggered by the appearance
+of braces in the input. For example, when the user says `\.{\\hbox}
+\.{to} \.{100pt\{$\langle\,\hbox{hlist}\,\rangle$\}}' in vertical mode,
+the information about the box size (100pt, |exactly|) is put onto |save_stack|
+with a level boundary word just above it, and |cur_group:=adjusted_hbox_group|;
+\TeX\ enters restricted horizontal mode to process the hlist. The right
+brace eventually causes |save_stack| to be restored to its former state,
+at which time the information about the box size (100pt, |exactly|) is
+available once again; a box is packaged and we leave restricted horizontal
+mode, appending the new box to the current list of the enclosing mode
+(in this case to the current list of vertical mode), followed by any
+vertical adjustments that were removed from the box by |hpack|.
+
+The next few sections of the program are therefore concerned with the
+treatment of left and right curly braces.
+
+If a left brace occurs in the middle of a page or paragraph, it simply
+introduces a new level of grouping, and the matching right brace will not have
+such a drastic effect. Such grouping affects neither the mode nor the
+current list.
+
+@c
+static void run_left_brace (void) {
+ new_save_level(simple_group);
+ eq_word_define(int_base + no_local_whatsits_code, 0);
+ eq_word_define(int_base + no_local_dirs_code, 0);
+}
+
+static void run_begin_group (void) {
+ new_save_level(semi_simple_group);
+ eq_word_define(int_base + no_local_whatsits_code, 0);
+ eq_word_define(int_base + no_local_dirs_code, 0);
+}
+
+static void run_end_group (void) {
+ if (cur_group == semi_simple_group) {
+ fixup_directions();
+ } else {
+ off_save();
+ }
+}
+
+@ Constructions that require a box are started by calling |scan_box| with
+a specified context code. The |scan_box| routine verifies
+that a |make_box| command comes next and then it calls |begin_box|.
+
+@c
+static void run_move (void) {
+ int t = cur_chr;
+ scan_normal_dimen();
+ if (t == 0)
+ scan_box(cur_val);
+ else
+ scan_box(-cur_val);
+}
+
+@ @c
+static void run_leader_ship (void) {
+ scan_box(leader_flag - a_leaders + cur_chr);
+}
+
+@ @c
+static void run_make_box (void) {
+ begin_box(0);
+}
+
+@ @c
+static void run_box_dir (void) {
+ scan_register_num();
+ cur_box = box(cur_val);
+ scan_optional_equals();
+ scan_direction();
+ if (cur_box != null)
+ box_dir(cur_box) = cur_val;
+}
+
+@ There is a really small patch to add a new primitive called
+\.{\\quitvmode}. In vertical modes, it is identical to \.{\\indent},
+but in horizontal and math modes it is really a no-op (as opposed to
+\.{\\indent}, which executes the |indent_in_hmode| procedure).
+
+A paragraph begins when horizontal-mode material occurs in vertical mode,
+or when the paragraph is explicitly started by `\.{\\quitvmode}',
+`\.{\\indent}' or `\.{\\noindent}'.
+
+@c
+static void run_start_par_vmode (void) {
+ new_graf((cur_chr > 0));
+}
+
+@ @c
+static void run_start_par (void) {
+ if (cur_chr != 2)
+ indent_in_hmode();
+}
+
+@ @c
+static void run_new_graf (void) {
+ back_input();
+ new_graf(true);
+}
+
+@ A paragraph ends when a |par_end| command is sensed, or when we are in
+horizontal mode when reaching the right brace of vertical-mode routines
+like \.{\\vbox}, \.{\\insert}, or \.{\\output}.
+
+@c
+static void run_par_end_vmode (void) {
+ normal_paragraph();
+ if (mode > 0) {
+ check_filter("vmode_par");
+ build_page();
+ }
+}
+
+@ @c
+static void run_par_end_hmode (void) {
+ if (align_state < 0)
+ off_save(); /* this tries to recover from an alignment that didn't end properly */
+ end_graf(bottom_level); /* this takes us to the enclosing mode, if |mode>0| */
+ if (mode == vmode) {
+ check_filter("hmode_par");
+ build_page();
+ }
+}
+
+@ @c
+static void append_italic_correction_mmode (void) {
+ tail_append(new_kern(0));
+}
+
+@ @c
+static void run_local_box (void) {
+ append_local_box(cur_chr);
+}
+
+@ @c
+static void run_halign_mmode (void) {
+ if (privileged()) {
+ if (cur_group == math_shift_group)
+ init_align();
else
- setup_math_style();
- break;
- case mmode + above_cmd:
- math_fraction();
- break;
- case mmode + sub_mark_cmd:
- case mmode + sup_mark_cmd:
- case mmode + super_sub_script_cmd:
- sub_sup();
- break;
- case mmode + left_right_cmd:
- math_left_right();
- break;
- case mmode + math_shift_cmd:
- case mmode + math_shift_cs_cmd:
+ off_save();
+ }
+}
+
+@ @c
+static void run_eq_no (void) {
+ if (privileged()) {
if (cur_group == math_shift_group)
- after_math();
+ start_eq_no();
else
off_save();
- break;
+ }
+}
- /* Cases of |main_control| that do not depend on |mode| */
- /*
- The long |main_control| procedure has now been fully specified, except for
- certain activities that are independent of the current mode. These activities
- do not change the current vlist or hlist or mlist; if they change anything,
- it is the value of a parameter or the meaning of a control sequence.
- */
- case any_mode(toks_register_cmd):
- case any_mode(assign_toks_cmd):
- case any_mode(assign_int_cmd):
- case any_mode(assign_attr_cmd):
- case any_mode(assign_dir_cmd):
- case any_mode(assign_dimen_cmd):
- case any_mode(assign_glue_cmd):
- case any_mode(assign_mu_glue_cmd):
- case any_mode(assign_font_dimen_cmd):
- case any_mode(assign_font_int_cmd):
- case any_mode(set_aux_cmd):
- case any_mode(set_prev_graf_cmd):
- case any_mode(set_page_dimen_cmd):
- case any_mode(set_page_int_cmd):
- case any_mode(set_box_dimen_cmd):
- case any_mode(set_tex_shape_cmd):
- case any_mode(set_etex_shape_cmd):
- case any_mode(def_char_code_cmd):
- case any_mode(def_del_code_cmd):
- case any_mode(extdef_math_code_cmd):
- case any_mode(extdef_del_code_cmd):
- case any_mode(def_family_cmd):
- case any_mode(set_math_param_cmd):
- case any_mode(set_font_cmd):
- case any_mode(def_font_cmd):
- case any_mode(letterspace_font_cmd):
- case any_mode(pdf_copy_font_cmd):
- case any_mode(register_cmd):
- case any_mode(advance_cmd):
- case any_mode(multiply_cmd):
- case any_mode(divide_cmd):
- case any_mode(prefix_cmd):
- case any_mode(let_cmd):
- case any_mode(shorthand_def_cmd):
- case any_mode(read_to_cs_cmd):
- case any_mode(def_cmd):
- case any_mode(set_box_cmd):
- case any_mode(hyph_data_cmd):
- case any_mode(set_interaction_cmd):
- case any_mode(set_ocp_cmd):
- case any_mode(def_ocp_cmd):
- case any_mode(set_ocp_list_cmd):
- case any_mode(def_ocp_list_cmd):
- case any_mode(clear_ocp_lists_cmd):
- case any_mode(push_ocp_list_cmd):
- case any_mode(pop_ocp_list_cmd):
- case any_mode(ocp_list_op_cmd):
- case any_mode(ocp_trace_level_cmd):
- prefixed_command();
- break;
- case any_mode(after_assignment_cmd):
- get_token();
- after_token = cur_tok;
- break;
- case any_mode(after_group_cmd):
- get_token();
- save_for_after(cur_tok);
- break;
- case any_mode(in_stream_cmd):
- open_or_close_in();
- break;
- case any_mode(message_cmd):
- issue_message();
- break;
- case any_mode(case_shift_cmd):
- shift_case();
- break;
- case any_mode(xray_cmd):
- show_whatever();
- break;
+@ @c
+static void run_letter_mmode (void) {
+ set_math_char(get_math_code(cur_chr));
+}
- /* Cases of |main_control| that are for extensions to \TeX */
- case any_mode(extension_cmd):
- do_extension(static_pdf);
- break;
- } /* end of the big |switch| statement */
+@ @c
+static void run_char_num_mmode (void) {
+ scan_char_num();
+ cur_chr = cur_val;
+ set_math_char(get_math_code(cur_chr));
+}
+
+@ @c
+static void run_math_char_num_mmode (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ if (cur_chr == 0)
+ mval = scan_mathchar(tex_mathcode);
+ else if (cur_chr == 1)
+ mval = scan_mathchar(aleph_mathcode);
+ else if (cur_chr == 2)
+ mval = scan_mathchar(xetex_mathcode);
+ else
+ mval = scan_mathchar(xetexnum_mathcode);
+ set_math_char(mval);
+}
+
+@ @c
+static void run_math_given_mmode (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, tex_mathcode);
+ set_math_char(mval);
+}
+
+static void run_omath_given_mmode (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, aleph_mathcode);
+ set_math_char(mval);
+}
+
+static void run_xmath_given_mmode (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ mval = mathchar_from_integer(cur_chr, xetex_mathcode);
+ set_math_char(mval);
+}
+
+@ @c
+static void run_delim_num (void) {
+ mathcodeval mval; /* to build up an argument to |set_math_char| */
+ if (cur_chr == 0)
+ mval = scan_delimiter_as_mathchar(tex_mathcode);
+ else if (cur_chr == 1)
+ mval = scan_delimiter_as_mathchar(aleph_mathcode);
+ else
+ mval = scan_delimiter_as_mathchar(xetex_mathcode);
+ set_math_char(mval);
+
+}
+
+@ @c
+static void run_vcenter (void) {
+ scan_spec(vcenter_group);
+ normal_paragraph();
+ push_nest();
+ mode = -vmode;
+ prev_depth = pdf_ignored_dimen;
+ if (every_vbox != null)
+ begin_token_list(every_vbox, every_vbox_text);
+}
+
+@ @c
+static void run_math_style (void) {
+ tail_append(new_style((small_number) cur_chr));
+}
+
+@ @c
+static void run_non_script (void) {
+ tail_append(new_glue(zero_glue));
+ subtype(tail) = cond_math_glue;
+}
+
+@ @c
+static void run_math_choice (void) {
+ if (cur_chr == 0)
+ append_choices();
+ else
+ setup_math_style();
+}
+
+@ @c
+static void run_math_shift (void) {
+ if (cur_group == math_shift_group)
+ after_math();
+ else
+ off_save();
+}
+
+@ @c
+static void run_after_assignment (void) {
+ get_token();
+ after_token = cur_tok;
+}
+
+@ @c
+static void run_after_group (void) {
+ get_token();
+ save_for_after(cur_tok);
+}
+
+@ @c
+static void run_extension (void) {
+ do_extension(static_pdf);
+}
+
+
+@ For mode-independent commands, the following macro is useful.
+
+Also, there is a list of cases where the user has probably gotten into or out of math
+mode by mistake. \TeX\ will insert a dollar sign and rescan the current token, and
+it makes sense ot have a macro for that as well.
- goto BIG_SWITCH; /* restart */
+@c
+#define any_mode(A,B) jump_table[vmode+(A)]=B; jump_table[hmode+(A)]=B; jump_table[mmode+(A)]=B
+#define non_math(A,B) jump_table[vmode+(A)]=B; jump_table[hmode+(A)]=B;
+
+
+@ The |main_control| uses a jump table, and |init_main_control| sets that table up.
+@c
+typedef void (*main_control_function) (void);
+main_control_function *jump_table;
+
+static void init_main_control (void) {
+ jump_table = xmalloc((mmode+max_command_cmd+1) * sizeof(main_control_function)) ;
+
+ jump_table[hmode + char_num_cmd] = run_char_num;
+ jump_table[hmode + letter_cmd] = run_char;
+ jump_table[hmode + other_char_cmd] = run_char;
+ jump_table[hmode + char_given_cmd] = run_char;
+ jump_table[hmode + spacer_cmd] = run_app_space;
+ jump_table[hmode + ex_space_cmd] = run_app_space;
+ jump_table[mmode + ex_space_cmd] = run_app_space;
+ jump_table[hmode + no_boundary_cmd] = run_no_boundary;
+ jump_table[hmode + char_ghost_cmd] = run_char_ghost;
+ jump_table[mmode + char_ghost_cmd] = run_char_ghost;
+ any_mode(relax_cmd, run_relax);
+ jump_table[vmode + spacer_cmd] = run_relax;
+ jump_table[mmode + spacer_cmd] = run_relax;
+ jump_table[mmode + no_boundary_cmd] = run_relax;
+ any_mode(ignore_spaces_cmd,run_ignore_spaces);
+ jump_table[vmode + stop_cmd] = run_stop;
+ jump_table[vmode + math_char_num_cmd] = run_non_math_math;
+ jump_table[vmode + math_given_cmd] = run_non_math_math;
+ jump_table[vmode + omath_given_cmd] = run_non_math_math;
+ jump_table[vmode + xmath_given_cmd] = run_non_math_math;
+ jump_table[hmode + math_char_num_cmd] = run_math_char_num;
+ jump_table[hmode + math_given_cmd] = run_math_given;
+ jump_table[hmode + omath_given_cmd] = run_omath_given;
+ jump_table[hmode + xmath_given_cmd] = run_xmath_given;
+
+ jump_table[vmode + vmove_cmd] = report_illegal_case;
+ jump_table[hmode + hmove_cmd] = report_illegal_case;
+ jump_table[mmode + hmove_cmd] = report_illegal_case;
+ any_mode(last_item_cmd, report_illegal_case);
+ jump_table[vmode + vadjust_cmd] = report_illegal_case;
+ jump_table[vmode + ital_corr_cmd] = report_illegal_case;
+ non_math(eq_no_cmd,report_illegal_case);
+ any_mode(mac_param_cmd,report_illegal_case);
+
+ non_math(sup_mark_cmd, insert_dollar_sign);
+ non_math(sub_mark_cmd, insert_dollar_sign);
+ non_math(super_sub_script_cmd, insert_dollar_sign);
+ non_math(math_comp_cmd, insert_dollar_sign);
+ non_math(delim_num_cmd, insert_dollar_sign);
+ non_math(left_right_cmd, insert_dollar_sign);
+ non_math(above_cmd, insert_dollar_sign);
+ non_math(radical_cmd, insert_dollar_sign);
+ non_math(math_style_cmd, insert_dollar_sign);
+ non_math(math_choice_cmd, insert_dollar_sign);
+ non_math(vcenter_cmd, insert_dollar_sign);
+ non_math(non_script_cmd, insert_dollar_sign);
+ non_math(mkern_cmd, insert_dollar_sign);
+ non_math(limit_switch_cmd, insert_dollar_sign);
+ non_math(mskip_cmd, insert_dollar_sign);
+ non_math(math_accent_cmd, insert_dollar_sign);
+ jump_table[mmode + endv_cmd] = insert_dollar_sign;
+ jump_table[mmode + par_end_cmd] = insert_dollar_sign;
+ jump_table[mmode + stop_cmd] = insert_dollar_sign;
+ jump_table[mmode + vskip_cmd] = insert_dollar_sign;
+ jump_table[mmode + un_vbox_cmd] = insert_dollar_sign;
+ jump_table[mmode + valign_cmd] = insert_dollar_sign;
+ jump_table[mmode + hrule_cmd] = insert_dollar_sign;
+ jump_table[vmode + hrule_cmd] = run_rule;
+ jump_table[hmode + vrule_cmd] = run_rule;
+ jump_table[mmode + vrule_cmd] = run_rule;
+ jump_table[vmode + vskip_cmd] = append_glue;
+ jump_table[hmode + hskip_cmd] = append_glue;
+ jump_table[mmode + hskip_cmd] = append_glue;
+ jump_table[mmode + mskip_cmd] = append_glue;
+ any_mode(kern_cmd, append_kern);
+ jump_table[mmode + mkern_cmd] = append_kern;
+ non_math(left_brace_cmd, run_left_brace);
+ any_mode(begin_group_cmd,run_begin_group);
+ any_mode(end_group_cmd, run_end_group);
+ any_mode(right_brace_cmd, handle_right_brace);
+ jump_table[vmode + hmove_cmd] = run_move;
+ jump_table[hmode + vmove_cmd] = run_move;
+ jump_table[mmode + vmove_cmd] = run_move;
+ any_mode(leader_ship_cmd, run_leader_ship);
+ any_mode(make_box_cmd, run_make_box);
+ any_mode(assign_box_dir_cmd, run_box_dir);
+ jump_table[vmode + start_par_cmd] = run_start_par_vmode;
+ jump_table[hmode + start_par_cmd] = run_start_par;
+ jump_table[mmode + start_par_cmd] = run_start_par;
+ jump_table[vmode + letter_cmd] = run_new_graf;
+ jump_table[vmode + other_char_cmd] = run_new_graf;
+ jump_table[vmode + char_num_cmd] = run_new_graf;
+ jump_table[vmode + char_given_cmd] = run_new_graf;
+ jump_table[vmode + char_ghost_cmd] = run_new_graf;
+ jump_table[vmode + math_shift_cmd] = run_new_graf;
+ jump_table[vmode + math_shift_cs_cmd] = run_new_graf;
+ jump_table[vmode + un_hbox_cmd] = run_new_graf;
+ jump_table[vmode + vrule_cmd] = run_new_graf;
+ jump_table[vmode + accent_cmd] = run_new_graf;
+ jump_table[vmode + discretionary_cmd] = run_new_graf;
+ jump_table[vmode + hskip_cmd] = run_new_graf;
+ jump_table[vmode + valign_cmd] = run_new_graf;
+ jump_table[vmode + ex_space_cmd] = run_new_graf;
+ jump_table[vmode + no_boundary_cmd] = run_new_graf;
+ jump_table[vmode + par_end_cmd] = run_par_end_vmode;
+ jump_table[hmode + par_end_cmd] = run_par_end_hmode;
+ jump_table[hmode + stop_cmd] = head_for_vmode;
+ jump_table[hmode + vskip_cmd] = head_for_vmode;
+ jump_table[hmode + hrule_cmd] = head_for_vmode;
+ jump_table[hmode + un_vbox_cmd] = head_for_vmode;
+ jump_table[hmode + halign_cmd] = head_for_vmode;
+ any_mode(insert_cmd,begin_insert_or_adjust);
+ jump_table[hmode + vadjust_cmd] = begin_insert_or_adjust;
+ jump_table[mmode + vadjust_cmd] = begin_insert_or_adjust;
+ any_mode(mark_cmd, handle_mark);
+ any_mode(break_penalty_cmd, append_penalty);
+ any_mode(remove_item_cmd, delete_last);
+ jump_table[vmode + un_vbox_cmd] = unpackage;
+ jump_table[hmode + un_hbox_cmd] = unpackage;
+ jump_table[mmode + un_hbox_cmd] = unpackage;
+ jump_table[hmode + ital_corr_cmd] = append_italic_correction;
+ jump_table[mmode + ital_corr_cmd] = append_italic_correction_mmode;
+ jump_table[hmode + discretionary_cmd] = append_discretionary;
+ jump_table[mmode + discretionary_cmd] = append_discretionary;
+ any_mode(assign_local_box_cmd, run_local_box);
+ jump_table[hmode + accent_cmd] = make_accent;
+ any_mode(car_ret_cmd,align_error);
+ any_mode(tab_mark_cmd,align_error);
+ any_mode(no_align_cmd,no_align_error);
+ any_mode(omit_cmd, omit_error);
+ jump_table[vmode + halign_cmd] = init_align;
+ jump_table[hmode + valign_cmd] = init_align;
+ jump_table[mmode + halign_cmd] = run_halign_mmode;
+ jump_table[vmode + endv_cmd] = do_endv;
+ jump_table[hmode + endv_cmd] = do_endv;
+ any_mode(end_cs_name_cmd, cs_error);
+ jump_table[hmode + math_shift_cmd] = init_math;
+ jump_table[hmode + math_shift_cs_cmd] = init_math;
+ jump_table[mmode + eq_no_cmd] = run_eq_no;
+ jump_table[mmode + left_brace_cmd] = math_left_brace;
+ jump_table[mmode + letter_cmd] = run_letter_mmode;
+ jump_table[mmode + other_char_cmd] = run_letter_mmode;
+ jump_table[mmode + char_given_cmd] = run_letter_mmode;
+ jump_table[mmode + char_num_cmd] = run_char_num_mmode;
+ jump_table[mmode + math_char_num_cmd] = run_math_char_num_mmode;
+ jump_table[mmode + math_given_cmd] = run_math_given_mmode;
+ jump_table[mmode + omath_given_cmd] = run_omath_given_mmode;
+ jump_table[mmode + xmath_given_cmd] = run_xmath_given_mmode;
+ jump_table[mmode + delim_num_cmd] = run_delim_num;
+ jump_table[mmode + math_comp_cmd] = math_math_comp;
+ jump_table[mmode + limit_switch_cmd] = math_limit_switch;
+ jump_table[mmode + radical_cmd] = math_radical;
+ jump_table[mmode + accent_cmd] = math_ac;
+ jump_table[mmode + math_accent_cmd] = math_ac;
+ jump_table[mmode + vcenter_cmd] = run_vcenter;
+ jump_table[mmode + math_style_cmd] = run_math_style;
+ jump_table[mmode + non_script_cmd] = run_non_script;
+ jump_table[mmode + math_choice_cmd] = run_math_choice;
+ jump_table[mmode + above_cmd] = math_fraction;
+ jump_table[mmode + sub_mark_cmd] = sub_sup;
+ jump_table[mmode + sup_mark_cmd] = sub_sup;
+ jump_table[mmode + super_sub_script_cmd] = sub_sup;
+ jump_table[mmode + left_right_cmd] = math_left_right;
+ jump_table[mmode + math_shift_cmd] = run_math_shift;
+ jump_table[mmode + math_shift_cs_cmd] = run_math_shift;
+ any_mode(toks_register_cmd, prefixed_command);
+ any_mode(assign_toks_cmd, prefixed_command);
+ any_mode(assign_int_cmd, prefixed_command);
+ any_mode(assign_attr_cmd, prefixed_command);
+ any_mode(assign_dir_cmd, prefixed_command);
+ any_mode(assign_dimen_cmd, prefixed_command);
+ any_mode(assign_glue_cmd, prefixed_command);
+ any_mode(assign_mu_glue_cmd, prefixed_command);
+ any_mode(assign_font_dimen_cmd, prefixed_command);
+ any_mode(assign_font_int_cmd, prefixed_command);
+ any_mode(set_aux_cmd, prefixed_command);
+ any_mode(set_prev_graf_cmd, prefixed_command);
+ any_mode(set_page_dimen_cmd, prefixed_command);
+ any_mode(set_page_int_cmd, prefixed_command);
+ any_mode(set_box_dimen_cmd, prefixed_command);
+ any_mode(set_tex_shape_cmd, prefixed_command);
+ any_mode(set_etex_shape_cmd, prefixed_command);
+ any_mode(def_char_code_cmd, prefixed_command);
+ any_mode(def_del_code_cmd, prefixed_command);
+ any_mode(extdef_math_code_cmd, prefixed_command);
+ any_mode(extdef_del_code_cmd, prefixed_command);
+ any_mode(def_family_cmd, prefixed_command);
+ any_mode(set_math_param_cmd, prefixed_command);
+ any_mode(set_font_cmd, prefixed_command);
+ any_mode(def_font_cmd, prefixed_command);
+ any_mode(letterspace_font_cmd, prefixed_command);
+ any_mode(pdf_copy_font_cmd, prefixed_command);
+ any_mode(register_cmd, prefixed_command);
+ any_mode(advance_cmd, prefixed_command);
+ any_mode(multiply_cmd, prefixed_command);
+ any_mode(divide_cmd, prefixed_command);
+ any_mode(prefix_cmd, prefixed_command);
+ any_mode(let_cmd, prefixed_command);
+ any_mode(shorthand_def_cmd, prefixed_command);
+ any_mode(read_to_cs_cmd, prefixed_command);
+ any_mode(def_cmd, prefixed_command);
+ any_mode(set_box_cmd, prefixed_command);
+ any_mode(hyph_data_cmd, prefixed_command);
+ any_mode(set_interaction_cmd, prefixed_command);
+ any_mode(after_assignment_cmd,run_after_assignment);
+ any_mode(after_group_cmd,run_after_group);
+ any_mode(in_stream_cmd,open_or_close_in);
+ any_mode(message_cmd,issue_message);
+ any_mode(case_shift_cmd, shift_case);
+ any_mode(xray_cmd, show_whatever);
+ any_mode(extension_cmd, run_extension);
+}
+
+@ And here is |main_control| itself. It is quite short nowadays.
+
+@c
+void main_control(void)
+{
+ main_control_state = goto_next;
+ init_main_control () ;
+
+ if (equiv(every_job_loc) != null)
+ begin_token_list(equiv(every_job_loc), every_job_text);
+
+ while (1) {
+ if (main_control_state == goto_skip_token)
+ main_control_state = goto_next; /* reset */
+ else
+ get_x_token();
+
+ /* Give diagnostic information, if requested */
+ /* When a new token has just been fetched at |big_switch|, we have an
+ ideal place to monitor \TeX's activity. */
+ if (interrupt != 0 && OK_to_interrupt) {
+ back_input();
+ check_interrupt();
+ continue;
+ }
+ if (int_par(tracing_commands_code) > 0)
+ show_cur_cmd_chr();
+
+ (jump_table[(abs(mode) + cur_cmd)])(); /* run the command */
+
+ if (main_control_state == goto_return) {
+ return;
+ }
+ }
+ return; /* not reached */
}
@ @c
@@ -941,6 +962,18 @@ void you_cant(void)
print_in_mode(mode);
}
+@
+When erroneous situations arise, \TeX\ usually issues an error message
+specific to the particular error. For example, `\.{\\noalign}' should
+not appear in any mode, since it is recognized by the |align_peek| routine
+in all of its legitimate appearances; a special error message is given
+when `\.{\\noalign}' occurs elsewhere. But sometimes the most appropriate
+error message is simply that the user is not allowed to do what he or she
+has attempted. For example, `\.{\\moveleft}' is allowed only in vertical mode,
+and `\.{\\lower}' only in non-vertical modes. Such cases are enumerated
+here and in the other sections referred to under `See also \dots.'
+
+@c
void report_illegal_case(void)
{
you_cant();
@@ -1324,7 +1357,7 @@ void box_end(int box_context)
space_factor = 1000;
else
cur_box = new_sub_box(cur_box);
- vlink(tail) = cur_box;
+ couple_nodes(tail, cur_box);
tail = cur_box;
}
}
@@ -1362,7 +1395,7 @@ void box_end(int box_context)
}
} else
- ship_out(static_pdf, cur_box, true);
+ ship_out(static_pdf, cur_box, SHIPPING_PAGE);
}
}
@@ -1410,6 +1443,7 @@ void new_graf(boolean indented)
p = new_null_box();
box_dir(p) = par_direction;
width(p) = par_indent;
+ subtype(p) = HLIST_SUBTYPE_INDENT;
q = tail;
tail_append(p);
} else {
@@ -1419,8 +1453,8 @@ void new_graf(boolean indented)
while (dir_rover != null) {
if ((vlink(dir_rover) != null) || (dir_dir(dir_rover) != par_direction)) {
dir_graf_tmp = new_dir(dir_dir(dir_rover));
- vlink(dir_graf_tmp) = vlink(q);
- vlink(q) = dir_graf_tmp;
+ try_couple_nodes(dir_graf_tmp,vlink(q));
+ couple_nodes(q,dir_graf_tmp);
}
dir_rover = vlink(dir_rover);
}
@@ -1578,6 +1612,13 @@ void append_penalty(void)
@ When |delete_last| is called, |cur_chr| is the |type| of node that
will be deleted, if present.
+The |remove_item| command removes a penalty, kern, or glue node if it
+appears at the tail of the current list, using a brute-force linear scan.
+Like \.{\\lastbox}, this command is not allowed in vertical mode (except
+internal vertical mode), since the current list in vertical mode is sent
+to the page builder. But if we happen to be able to implement it in
+vertical mode, we do.
+
@c
void delete_last(void)
{
@@ -1635,7 +1676,7 @@ void unpackage(void)
halfword s; /* for varmem assignment */
if (cur_chr > copy_code) {
/* Handle saved items and |goto done| */
- vlink(tail) = disc_ptr[cur_chr];
+ try_couple_nodes(tail, disc_ptr[cur_chr]);
disc_ptr[cur_chr] = null;
goto DONE;
}
@@ -1656,9 +1697,9 @@ void unpackage(void)
}
if (c == copy_code) {
s = copy_node_list(list_ptr(p));
- vlink(tail) = s;
+ try_couple_nodes(tail,s);
} else {
- vlink(tail) = list_ptr(p);
+ try_couple_nodes(tail,list_ptr(p));
box(cur_val) = null;
list_ptr(p) = null;
flush_node(p);
@@ -1667,14 +1708,19 @@ void unpackage(void)
while (vlink(tail) != null) {
r = vlink(tail);
if (!is_char_node(r) && (type(r) == margin_kern_node)) {
- vlink(tail) = vlink(r);
+ try_couple_nodes(tail,vlink(r));
flush_node(r);
}
tail = vlink(tail);
}
}
-@ @c
+@
+Italic corrections are converted to kern nodes when the |ital_corr| command
+follows a character. In math mode the same effect is achieved by appending
+a kern of zero here, since italic corrections are supplied later.
+
+@c
void append_italic_correction(void)
{
halfword p; /* |char_node| at the tail of the current list */
@@ -2662,40 +2708,6 @@ void prefixed_command(void)
case set_interaction_cmd:
new_interaction();
break;
- case set_ocp_cmd:
- print_err("To use ocps, use the \\pushocplist primitive");
- print_ln();
- break;
- case def_ocp_cmd:
- new_ocp((small_number) a);
- break;
- case set_ocp_list_cmd:
- print_err("To use ocp lists, use the \\pushocplist primitive");
- print_ln();
- break;
- case def_ocp_list_cmd:
- new_ocp_list((small_number) a);
- break;
- case push_ocp_list_cmd:
- do_push_ocp_list((small_number) a);
- break;
- case pop_ocp_list_cmd:
- do_pop_ocp_list((small_number) a);
- break;
- case clear_ocp_lists_cmd:
- do_clear_ocp_lists((small_number) a);
- break;
- case ocp_list_op_cmd:
- print_err("To build ocp lists, use the \\ocplist primitive");
- print_ln();
- break;
- case ocp_trace_level_cmd:
- scan_optional_equals();
- scan_int();
- if (cur_val != 0)
- cur_val = 1;
- define(ocp_trace_level_base, data_cmd, cur_val);
- break;
default:
confusion("prefix");
break;
@@ -2854,7 +2866,7 @@ void assign_internal_value(int a, halfword p, int cur_val)
no_local_whatsits + 1);
}
- } else if ((p >= dimen_base) && (p < eqtb_size)) {
+ } else if ((p >= dimen_base) && (p <= eqtb_size)) {
if (p == (dimen_base + page_left_offset_code)) {
n = cur_val - one_true_inch;
word_define(dimen_base + h_offset_code, n);
@@ -3582,8 +3594,6 @@ void initialize(void)
cs_text(frozen_primitive) = maketexstring("primitive");
create_null_font();
font_bytes = 0;
- init_null_ocp(get_nullstr(), maketexstring("nullocp"));
- initialize_init_ocplists();
pdf_h_origin = one_inch;
pdf_v_origin = one_inch;
pdf_compress_level = 9;
diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
index 0850cbe2776..8b9ff0d8a11 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: mathcodes.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/mathcodes.w $";
+ "$Id: mathcodes.w 3992 2010-11-28 08:24:21Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/mathcodes.w $";
@ math codes
@c
@@ -97,9 +97,18 @@ void show_mathcode_value(mathcodeval c)
print_int(m);
} else {
print_char('"');
- print_hex_digit(c.class_value);
- print_hex_digit(c.family_value);
- two_hex(c.character_value);
+ if (c.class_value) {
+ print_hex_digit(c.class_value);
+ print_hex_digit(c.family_value);
+ two_hex(c.character_value);
+ } else if (c.family_value) {
+ print_hex_digit(c.family_value);
+ two_hex(c.character_value);
+ } else if (c.character_value >= 16) {
+ two_hex(c.character_value);
+ } else {
+ print_hex_digit(c.character_value);
+ }
}
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/memoryword.w b/Build/source/texk/web2c/luatexdir/tex/memoryword.w
index 5c86ea12e6b..7338743ae79 100644
--- a/Build/source/texk/web2c/luatexdir/tex/memoryword.w
+++ b/Build/source/texk/web2c/luatexdir/tex/memoryword.w
@@ -22,7 +22,7 @@
static const char _svn_version[] =
"$Id: memoryword.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/memoryword.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/memoryword.w $";
@ When debugging, we may want to print a |memory_word| without knowing
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w
index c41c17392ea..5efcfac96b6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w
@@ -25,8 +25,8 @@
#include "lua/luatex-api.h"
static const char _svn_version[] =
- "$Id: mlist.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/mlist.w $";
+ "$Id: mlist.w 3985 2010-11-26 15:08:32Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/mlist.w $";
@ @c
#define delimiter_factor int_par(delimiter_factor_code)
@@ -1237,7 +1237,12 @@ static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
|(num_extenders*with_extenders)+num_normal|
*/
/* create an array of maximum shrinks and fill it */
- num_total = ((num_extenders * with_extenders) + num_normal);
+ if (with_extenders) {
+ num_total = ((num_extenders * with_extenders) + num_normal);
+ } else {
+ /* make sure we take at least the extenders that are needed to complete the built-up glyph */
+ num_total = (num_extenders + num_normal);
+ }
if (num_total == 1) {
/* weird, but could happen */
cc = ext->glyph;
@@ -1451,11 +1456,13 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
int z; /* runs through font family members */
boolean large_attempt; /* are we trying the ``large'' variant? */
pointer att; /* to save the current attribute list */
+ boolean do_parts;
extinfo *ext;
att = null;
f = null_font;
c = 0;
w = 0;
+ do_parts = false;
large_attempt = false;
if (d == null)
goto FOUND;
@@ -1473,11 +1480,6 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
CONTINUE:
i++;
if (char_exists(g, y)) {
- if (char_tag(g, y) == ext_tag) {
- f = g;
- c = y;
- goto FOUND;
- }
if (flat)
u = char_width(g, y);
else
@@ -1489,6 +1491,12 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
if (u >= v)
goto FOUND;
}
+ if (char_tag(g, y) == ext_tag) {
+ f = g;
+ c = y;
+ do_parts = true;
+ goto FOUND;
+ }
if (i > 10000) {
/* endless loop */
endless_loop_error(g, y);
@@ -1514,11 +1522,11 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
flush_node(d);
}
if (f != null_font) {
- /* When the following code is executed, |char_tag(q)| will be equal to
- |ext_tag| if and only if a built-up symbol is supposed to be returned.
+ /* When the following code is executed, |do_parts| will be true
+ if a built-up symbol is supposed to be returned.
*/
ext = NULL;
- if ((char_tag(f, c) == ext_tag) &&
+ if ((do_parts) &&
((!flat
&& (ext = get_charinfo_vert_variants(char_info(f, c))) != NULL)
|| (flat
@@ -2123,9 +2131,11 @@ respect to the size of the final box.
@c
#define TOP_CODE 1
#define BOT_CODE 2
+#define TOP_OR_BOT_MASK ((TOP_CODE) | (BOT_CODE))
+#define STRETCH_ACCENT_CODE 4
static void do_make_math_accent(pointer q, internal_font_number f, int c,
- int top_or_bot, int cur_style)
+ int flags, int cur_style)
{
pointer p, r, x, y; /* temporary registers for box construction */
scaled s; /* amount to skew the accent to the right */
@@ -2135,6 +2145,8 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
boolean s_is_absolute; /* will be true if a top-accent is placed in |s| */
extinfo *ext;
pointer attr_p;
+ const int compat_mode = radical_rule(cur_style) == undefined_math_parameter;
+ const int top_or_bot = flags & TOP_OR_BOT_MASK;
attr_p = (top_or_bot == TOP_CODE ? accent_chr(q) : bot_accent_chr(q));
s_is_absolute = false;
c = cur_c;
@@ -2143,29 +2155,40 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
s = 0;
if (type(nucleus(q)) == math_char_node) {
fetch(nucleus(q));
+ if (compat_mode) {
+ if (top_or_bot == TOP_CODE) {
+ s = get_kern(cur_f, cur_c, skew_char(cur_f));
+ } else {
+ s = 0;
+ }
+ } else {
if (top_or_bot == TOP_CODE) {
s = char_top_accent(cur_f, cur_c);
- if (s != 0) {
+ if (s != INT_MIN) {
s_is_absolute = true;
- } else {
- s = get_kern(cur_f, cur_c, skew_char(cur_f));
}
} else { /* new skewchar madness for bot accents */
s = char_bot_accent(cur_f, cur_c);
- if (s == 0) { /* better than nothing: */
+ if (s == INT_MIN) { /* better than nothing: */
s = char_top_accent(cur_f, cur_c);
}
- if (s != 0) {
+ if (s != INT_MIN) {
s_is_absolute = true;
}
}
+ }
}
x = clean_box(nucleus(q), cramped_style(cur_style), cur_style);
w = width(x);
h = height(x);
+ if (!compat_mode && !s_is_absolute && type(nucleus(q)) == math_char_node) {
+ s = half(w);
+ s_is_absolute = true;
+ }
/* Switch to a larger accent if available and appropriate */
y = null;
- while (1) {
+ if (flags & STRETCH_ACCENT_CODE) {
+ while (1) {
ext = NULL;
if ((char_tag(f, c) == ext_tag) &&
((ext = get_charinfo_hor_variants(char_info(f, c))) != NULL)) {
@@ -2184,6 +2207,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
break;
c = yy;
}
+ }
}
if (y == null) {
y = char_box(f, c, node_attr(attr_p));
@@ -2220,12 +2244,16 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
sa = char_top_accent(f, c);
else
sa = char_bot_accent(f, c);
- if (sa == 0) {
+ if (sa == INT_MIN) {
sa = half(width(y)); /* just take the center */
}
shift_amount(y) = s - sa;
} else {
- shift_amount(y) = s + half(w - width(y));
+ if (width(y)== 0) {
+ shift_amount(y) = s + w;
+ } else {
+ shift_amount(y) = s + half(w - width(y));
+ }
}
width(y) = 0;
if (top_or_bot == TOP_CODE) {
@@ -2264,10 +2292,13 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
static void make_math_accent(pointer q, int cur_style)
{
+ int topstretch = !(subtype(q) % 2);
+ int botstretch = !(subtype(q) / 2);
+
if (accent_chr(q) != null) {
fetch(accent_chr(q));
if (char_exists(cur_f, cur_c)) {
- do_make_math_accent(q, cur_f, cur_c, TOP_CODE, cur_style);
+ do_make_math_accent(q, cur_f, cur_c, TOP_CODE | (topstretch ? STRETCH_ACCENT_CODE : 0), cur_style);
}
flush_node(accent_chr(q));
accent_chr(q) = null;
@@ -2275,7 +2306,7 @@ static void make_math_accent(pointer q, int cur_style)
if (bot_accent_chr(q) != null) {
fetch(bot_accent_chr(q));
if (char_exists(cur_f, cur_c)) {
- do_make_math_accent(q, cur_f, cur_c, BOT_CODE, cur_style);
+ do_make_math_accent(q, cur_f, cur_c, BOT_CODE | (botstretch ? STRETCH_ACCENT_CODE : 0), cur_style);
}
flush_node(bot_accent_chr(q));
bot_accent_chr(q) = null;
@@ -2432,6 +2463,7 @@ static scaled make_op(pointer q, int cur_style)
x = clean_box(nucleus(q), cur_style, cur_style);
if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits))
width(x) = width(x) - delta; /* remove italic correction */
+
shift_amount(x) =
half(height(x) - depth(x)) - math_axis(cur_size);
/* center vertically */
@@ -2444,6 +2476,19 @@ static scaled make_op(pointer q, int cur_style)
x = clean_box(nucleus(q), cur_style, cur_style);
if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits))
width(x) = width(x) - delta; /* remove italic correction */
+
+ /* For an OT MATH font, we may have to get rid of yet another italic
+ correction because |make_scripts()| will add one.
+ This test is somewhat more complicated because |x| can be a null
+ delimiter */
+ if ((subscr(q) != null || supscr(q) != null)
+ && (subtype(q) != op_noad_type_limits)
+ && ((list_ptr(x) != null)
+ && (type(list_ptr(x)) == glyph_node)
+ && is_new_mathfont(font(list_ptr(x))))) {
+ width(x) -= delta; /* remove another italic correction */
+ }
+
shift_amount(x) = half(height(x) - depth(x)) - math_axis(cur_size);
/* center vertically */
type(nucleus(q)) = sub_box_node;
@@ -3400,7 +3445,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
make_radical(q, cur_style);
break;
case accent_noad:
- make_math_accent(q, cur_style);
+ make_math_accent(q, cur_style);
break;
case style_node:
cur_style = subtype(q);
diff --git a/Build/source/texk/web2c/luatexdir/tex/nesting.w b/Build/source/texk/web2c/luatexdir/tex/nesting.w
index 332058a9451..8e9577b84e3 100644
--- a/Build/source/texk/web2c/luatexdir/tex/nesting.w
+++ b/Build/source/texk/web2c/luatexdir/tex/nesting.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: nesting.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/nesting.w $";
+ "$Id: nesting.w 3615 2010-04-13 21:59:59Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/nesting.w $";
@ these are for |show_activities|
diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.h b/Build/source/texk/web2c/luatexdir/tex/packaging.h
index af1f18a265f..c10a715695a 100644
--- a/Build/source/texk/web2c/luatexdir/tex/packaging.h
+++ b/Build/source/texk/web2c/luatexdir/tex/packaging.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: packaging.h 3261 2009-12-18 11:38:21Z taco $ */
+/* $Id: packaging.h 4044 2010-12-18 09:23:06Z taco $ */
#ifndef PACKAGING_H
# define PACKAGING_H
@@ -57,10 +57,12 @@ extern void do_subst_font(halfword p, int ex_ratio);
extern scaled char_pw(halfword p, int side);
extern halfword new_margin_kern(scaled w, halfword p, int side);
-# define update_adjust_list(A) do { \
- vlink(A) = adjust_ptr(p); \
- while (vlink(A) != null) \
- A = vlink(A); \
+# define update_adjust_list(A) do { \
+ if (A == null) \
+ pdf_error("pre vadjust", "adjust_tail or pre_adjust_tail is null"); \
+ vlink(A) = adjust_ptr(p); \
+ while (vlink(A) != null) \
+ A = vlink(A); \
} while (0)
extern halfword hpack(halfword p, scaled w, int m, int d);
diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.w b/Build/source/texk/web2c/luatexdir/tex/packaging.w
index 6813d61e85f..2de2d13f99d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/packaging.w
+++ b/Build/source/texk/web2c/luatexdir/tex/packaging.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: packaging.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/packaging.w $";
+ "$Id: packaging.w 4044 2010-12-18 09:23:06Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/packaging.w $";
@ @c
#define scan_normal_dimen() scan_dimen(false,false,false)
@@ -115,7 +115,6 @@ void scan_full_spec(group_code c, int spec_direction)
int v;
int spec_code;
halfword attr_list;
- s = 0;
if (attr_list_cache == cache_disabled)
update_attribute_cache();
attr_list = attr_list_cache;
@@ -423,7 +422,6 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
scaled s; /* shift amount */
halfword g; /* points to a glue specification */
int o; /* order of infinity */
- internal_font_number f; /* the font in a |char_node| */
halfword dir_ptr; /* for managing the direction stack */
/* BEWARE: this shadows a global |dir_ptr| */
int hpack_dir; /* the current direction */
@@ -438,7 +436,6 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
box_dir(r) = text_direction;
} else {
box_dir(r) = pack_direction;
- pack_direction = -1;
}
hpack_dir = box_dir(r);
dir_ptr = null;
@@ -493,7 +490,6 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
do_subst_font(p, font_expand_ratio);
}
}
- f = font(p);
whd = pack_width_height_depth(hpack_dir, dir_TRT, p, true);
x += whd.wd;
if (whd.ht > h)
@@ -533,7 +529,7 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
case ins_node:
case mark_node:
case adjust_node:
- if (adjust_tail != null) {
+ if (adjust_tail != null || pre_adjust_tail != null) {
/* Transfer node |p| to the adjustment list */
/*
Although node |q| is not necessarily the immediate predecessor of node |p|,
@@ -852,7 +848,6 @@ scaled_whd natural_sizes(halfword p, halfword pp, glue_ratio g_mult,
{
scaled s; /* shift amount */
halfword g; /* points to a glue specification */
- internal_font_number f; /* the font in a |char_node| */
int hpack_dir;
scaled_whd xx; /* for recursion */
scaled_whd whd, siz = { 0, 0, 0 };
@@ -863,7 +858,6 @@ scaled_whd natural_sizes(halfword p, halfword pp, glue_ratio g_mult,
}
while (p != pp && p != null) {
while (is_char_node(p) && p != pp) {
- f = font(p);
whd = pack_width_height_depth(hpack_dir, dir_TRT, p, true);
siz.wd += whd.wd;
if (whd.ht > siz.ht)
diff --git a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
index e9a80961457..f96fd1cf861 100644
--- a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
+++ b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: postlinebreak.w 3587 2010-04-03 14:32:25Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/postlinebreak.w $";
+ "$Id: postlinebreak.w 3904 2010-10-01 07:42:12Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/postlinebreak.w $";
@ So far we have gotten a little way into the |line_break| routine, having
covered its important |try_break| subroutine. Now let's consider the
@@ -323,8 +323,8 @@ void ext_post_line_break(int paragraph_dir,
delete_attribute_ref(node_attr(k));
node_attr(k) = node_attr(p);
add_node_attr_ref(node_attr(k));
- vlink(k) = vlink(ptmp);
- vlink(ptmp) = k;
+ try_couple_nodes(k, vlink(ptmp));
+ couple_nodes(ptmp,k);
if (ptmp == q)
q = vlink(q);
}
@@ -335,13 +335,12 @@ void ext_post_line_break(int paragraph_dir,
/* Put the \.{\\rightskip} glue after node |q|; */
halfword r = new_glue((right_skip == null ? null : copy_node(right_skip)));
glue_ref_count(glue_ptr(r)) = null;
- subtype(r) = right_skip_code;
- vlink(r) = vlink(q);
+ subtype(r) = right_skip_code+1;
+ try_couple_nodes(r,vlink(q));
delete_attribute_ref(node_attr(r));
node_attr(r) = node_attr(q);
add_node_attr_ref(node_attr(r));
- vlink(q) = r;
- alink(r) = q;
+ couple_nodes(q,r);
q = r;
}
@@ -361,14 +360,14 @@ void ext_post_line_break(int paragraph_dir,
/* omega bits: */
r = copy_node_list(passive_left_box(cur_p));
s = vlink(q);
- vlink(r) = q;
+ couple_nodes(r,q);
q = r;
if ((cur_line == cur_list.pg_field + 1) && (s != null)) {
if (type(s) == hlist_node) {
if (list_ptr(s) == null) {
q = vlink(q);
- vlink(r) = vlink(s);
- vlink(s) = r;
+ try_couple_nodes(r,vlink(s));
+ try_couple_nodes(s, r);
}
}
}
@@ -383,19 +382,18 @@ void ext_post_line_break(int paragraph_dir,
delete_attribute_ref(node_attr(k));
node_attr(k) = node_attr(q);
add_node_attr_ref(node_attr(k));
- vlink(k) = q;
+ couple_nodes(k,q);
q = k;
}
- };
+ }
if (left_skip != zero_glue) {
r = new_glue(copy_node(left_skip));
glue_ref_count(glue_ptr(r)) = null;
- subtype(r) = left_skip_code;
+ subtype(r) = left_skip_code+1;
delete_attribute_ref(node_attr(r));
node_attr(r) = node_attr(q);
add_node_attr_ref(node_attr(r));
- vlink(r) = q;
- alink(q) = r;
+ couple_nodes(r,q);
q = r;
}
/* /Put the \.{\\leftskip} glue at the left and detach this line; */
@@ -541,7 +539,7 @@ void ext_post_line_break(int paragraph_dir,
break;
}
r = q;
- };
+ }
if (r != temp_head) {
vlink(r) = null;
flush_node_list(vlink(temp_head));
diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.w b/Build/source/texk/web2c/luatexdir/tex/primitive.w
index e40090dada0..3fd3f4ff9fa 100644
--- a/Build/source/texk/web2c/luatexdir/tex/primitive.w
+++ b/Build/source/texk/web2c/luatexdir/tex/primitive.w
@@ -22,8 +22,8 @@
static const char _svn_version[] =
- "$Id: primitive.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/primitive.w $";
+ "$Id: primitive.w 4130 2011-04-11 13:27:56Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/primitive.w $";
@ Control sequences are stored and retrieved by means of a fairly standard hash
@@ -127,9 +127,9 @@ void ini_init_primitives(void)
static halfword compute_hash(const char *j, unsigned int l,
halfword prime_number)
{
- unsigned int k;
+ int k;
halfword h = (unsigned char) *j;
- for (k = 1; k <= l - 1; k++) {
+ for (k = 1; k <= (int)(l - 1); k++) {
h = h + h + (unsigned char) *(j + k);
while (h >= prime_number)
h = h - prime_number;
@@ -389,6 +389,7 @@ static halfword insert_id(halfword p, const unsigned char *j, unsigned int l)
append_char(*k);
cs_text(p) = make_string();
cur_length = saved_cur_length;
+ xfree(cur_string);
cur_string = saved_cur_string;
cur_string_size = saved_cur_string_size;
incr(cs_count);
@@ -491,7 +492,7 @@ static void prim_cmd_chr(quarterword cmd, halfword chr_code)
if (cmd <= last_cmd &&
idx >= 0 && idx < prim_data[cmd].subids &&
prim_data[cmd].names != NULL && prim_data[cmd].names[idx] != 0) {
- tprint("\\");
+ tprint_esc("");
print(prim_data[cmd].names[idx]);
} else {
/* TEX82 didn't print the |cmd,idx| information, but it may be useful */
@@ -609,13 +610,6 @@ void print_cmd_chr(quarterword cmd, halfword chr_code)
}
break;
- case set_ocp_cmd:
- tprint("select ocp ");
- slow_print(ocp_name(chr_code));
- break;
- case set_ocp_list_cmd:
- tprint("select ocp list ");
- break;
case assign_glue_cmd:
case assign_mu_glue_cmd:
if (chr_code < skip_base) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index 278b8a70e71..9ea3fd98014 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -22,8 +22,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: printing.w 3587 2010-04-03 14:32:25Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/printing.w $";
+ "$Id: printing.w 3885 2010-09-14 19:24:08Z oneiros $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/printing.w $";
@ @c
#define font_id_text(A) cs_text(font_id_base+(A))
@@ -361,10 +361,10 @@ void print_banner(const char *v, int e, int ver)
callback_id = callback_defined(start_run_callback);
if (callback_id == 0) {
if (ver < 0)
- fprintf(term_out, "This is LuaTeX, Version %s-%d%s ", v, e, WEB2CVERSION);
+ fprintf(term_out, "This is LuaTeX, Version %s-%d ", v, e);
else
- fprintf(term_out, "This is LuaTeX, Version %s-%d%s (rev %d) ", v, e,
- WEB2CVERSION, ver);
+ fprintf(term_out, "This is LuaTeX, Version %s-%d (rev %d) ", v, e,
+ ver);
if (format_ident > 0)
slow_print(format_ident);
print_ln();
@@ -390,9 +390,9 @@ void log_banner(const char *v, int e, int ver)
if (month > 12)
month = 0;
if (ver < 0)
- fprintf(log_file, "This is LuaTeX, Version %s-%d%s ", v, e, WEB2CVERSION);
+ fprintf(log_file, "This is LuaTeX, Version %s-%d ", v, e);
else
- fprintf(log_file, "This is LuaTeX, Version %s-%d%s (rev %d) ", v, e, WEB2CVERSION, ver);
+ fprintf(log_file, "This is LuaTeX, Version %s-%d (rev %d) ", v, e, ver);
slow_print(format_ident);
print_char(' ');
print_char(' ');
@@ -543,14 +543,14 @@ works; therefore no explanation will be given. Notice that 1990 yields
void print_roman_int(int n)
{
char *j, *k; /* mysterious indices */
- nonnegative_integer u, v; /* mysterious numbers */
+ int u, v; /* mysterious numbers */
char mystery[] = "m2d5c2l5x2v5i";
j = (char *) mystery;
v = 1000;
while (1) {
- while (n >= (int) v) {
+ while (n >= v) {
print_char(*j);
- n = n - (int) v;
+ n = n - v;
}
if (n <= 0)
return; /* nonpositive input produces no output */
@@ -560,9 +560,9 @@ void print_roman_int(int n)
k = k + 2;
u = u / (*(k - 1) - '0');
}
- if (n + (int) u >= (int) v) {
+ if (n + u >= v) {
print_char(*k);
- n = n + (int) u;
+ n = n + u;
} else {
j = j + 2;
v = v / (*(j - 1) - '0');
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.h b/Build/source/texk/web2c/luatexdir/tex/scanning.h
index 853a22a9a46..8c263404173 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.h
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.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: scanning.h 3376 2010-01-25 16:50:23Z taco $ */
+/* $Id: scanning.h 4085 2011-02-10 09:21:57Z taco $ */
#ifndef SCANNING_H
# define SCANNING_H
@@ -50,7 +50,7 @@ extern void scan_limited_int(int max, const char *name);
# define scan_mark_num() scan_limited_int(65535,"marks code")
# define scan_char_num() scan_limited_int(biggest_char,"character code")
# define scan_four_bit_int() scan_limited_int(15,NULL)
-# define scan_math_family_int() scan_limited_int(265,"math family")
+# define scan_math_family_int() scan_limited_int(255,"math family")
# define scan_real_fifteen_bit_int() scan_limited_int(32767,"mathchar")
# define scan_big_fifteen_bit_int() scan_limited_int(0x7FFFFFF,"extended mathchar")
# define scan_twenty_seven_bit_int() scan_limited_int(0777777777,"delimiter code")
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w
index a968dae4a4b..86a2c01cee3 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.w
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: scanning.w 3596 2010-04-05 10:12:46Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/scanning.w $";
+ "$Id: scanning.w 3713 2010-06-04 10:47:19Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/scanning.w $";
@ @c
@@ -1556,7 +1556,6 @@ void scan_scaled(void)
arith_error = false;
negative = false;
/* Get the next non-blank non-sign... */
- negative = false;
do {
/* Get the next non-blank non-call token */
do {
diff --git a/Build/source/texk/web2c/luatexdir/tex/stringpool.h b/Build/source/texk/web2c/luatexdir/tex/stringpool.h
index 51eb4fd7195..21e031acc86 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 3395 2010-01-27 11:40:08Z taco $ */
+/* $Id: stringpool.h 3802 2010-08-07 12:03:08Z taco $ */
#ifndef STRINGPOOL_H
# define STRINGPOOL_H
@@ -115,6 +115,7 @@ extern void reset_cur_string(void);
# define restore_cur_string(u) if (u!=0) { \
unsigned l = (unsigned)str_length(u); \
+ xfree(cur_string); \
reset_cur_string(); \
str_room(l); \
memcpy(cur_string, str_string(u),l); \
diff --git a/Build/source/texk/web2c/luatexdir/tex/stringpool.w b/Build/source/texk/web2c/luatexdir/tex/stringpool.w
index d41276c819d..330ad02dee9 100644
--- a/Build/source/texk/web2c/luatexdir/tex/stringpool.w
+++ b/Build/source/texk/web2c/luatexdir/tex/stringpool.w
@@ -22,7 +22,7 @@
static const char _svn_version[] =
"$Id: stringpool.w 3587 2010-04-03 14:32:25Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/stringpool.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/stringpool.w $";
@ Control sequence names and diagnostic messages are variable-length strings
of eight-bit characters. Since PASCAL did not have a well-developed string
diff --git a/Build/source/texk/web2c/luatexdir/tex/texdeffont.w b/Build/source/texk/web2c/luatexdir/tex/texdeffont.w
index 993280def9c..10f88040be6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texdeffont.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texdeffont.w
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: texdeffont.w 3612 2010-04-13 09:29:42Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/texdeffont.w $";
+ "$Id: texdeffont.w 3615 2010-04-13 21:59:59Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/texdeffont.w $";
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.h b/Build/source/texk/web2c/luatexdir/tex/texfileio.h
index 77b7a6dd5b5..0ec6605b18c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.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: texfileio.h 3395 2010-01-27 11:40:08Z taco $ */
+/* $Id: texfileio.h 4005 2010-11-29 11:52:43Z taco $ */
#ifndef TEXFILEIO_H
# define TEXFILEIO_H
@@ -116,6 +116,7 @@ extern boolean log_opened; /* has the transcript file been opened? */
extern unsigned char *texmf_log_name; /* full name of the log file */
extern void open_log_file(void);
+extern char *get_full_log_name (void);
extern void start_input(void);
extern int open_outfile(FILE ** f, const char *name, const char *mode);
@@ -129,7 +130,6 @@ extern int readbinfile(FILE * f, unsigned char **b, int *s);
# define read_tfm_file readbinfile
# define read_vf_file readbinfile
-# define read_ocp_file readbinfile
# define read_data_file readbinfile
extern boolean openinnameok(const_string);
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
index ccae2f15433..652265d0119 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
@@ -23,12 +23,13 @@
#include <kpathsea/absolute.h>
static const char _svn_version[] =
- "$Id: texfileio.w 3719 2010-06-10 16:58:16Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/texfileio.w $";
+ "$Id: texfileio.w 4128 2011-04-11 12:37:47Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/texfileio.w $";
@ @c
#define end_line_char int_par(end_line_char_code)
+
@ The bane of portability is the fact that different operating systems treat
input and output quite differently, perhaps because computer scientists
have not given sufficient attention to this problem. People have felt somehow
@@ -163,9 +164,6 @@ char *luatex_find_file(const char *s, int callback_index)
if (ftemp == NULL)
ftemp = kpse_find_file(s, kpse_truetype_format, 0);
break;
- case find_ocp_file_callback:
- ftemp = kpse_find_file(s, kpse_ocp_format, 0);
- break;
case find_data_file_callback:
ftemp = find_in_output_directory(s);
if (!ftemp)
@@ -192,6 +190,18 @@ char *luatex_find_file(const char *s, int callback_index)
}
+@ LuaTeX used to have private functions for these that did not use kpathsea,
+but since the file paranoia tests have to come from kpathsea anyway, that is no
+longer useful. The only downside to using luatex is that if one wants to disable
+kpathsea via the Lua startup script, it is now an absolute requirement that all
+file discovery callbacks are specified. Just using the find_read_file, but not
+setting open_read_file, for example, does not work any more if kpathsea is not
+to be used at all.
+
+@c
+#define openoutnameok(A) kpse_out_name_ok (A)
+#define openinnameok(A) kpse_in_name_ok (A)
+
@ Open an input file F, using the kpathsea format FILEFMT and passing
|FOPEN_MODE| to fopen. The filename is in `fn'. We return whether or
not the open succeeded.
@@ -830,6 +840,22 @@ void open_log_file(void)
selector = old_setting + 2; /* |log_only| or |term_and_log| */
}
+@ This function is needed by synctex to make its log appear in the right
+spot when |output_directory| is set.
+
+@c
+char *get_full_log_name (void)
+{
+ if (output_directory) {
+ char *ret = xmalloc(strlen((char *)texmf_log_name)+2+strlen(output_directory));
+ ret = strcpy(ret, output_directory);
+ strcat(ret, "/");
+ strcat(ret, (char *)texmf_log_name);
+ return ret;
+ } else {
+ return xstrdup((const char*)texmf_log_name);
+ }
+}
@ Let's turn now to the procedure that is used to initiate file reading
when an `\.{\\input}' command is being processed.
@@ -858,6 +884,36 @@ void start_input(void)
fn = prompt_file_name("input file name", "");
}
iname = maketexstring(fullnameoffile);
+ /* Now that we have |fullnameoffile|, it is time to post-adjust
+ |cur_name| and |cur_ext| for trailing |.tex| */
+ {
+ char *n, *p;
+ n = p = fullnameoffile + strlen(fullnameoffile);
+ while (p>fullnameoffile) {
+ p--;
+ if (IS_DIR_SEP(*p)) {
+ break;
+ }
+ }
+ if (IS_DIR_SEP(*p)) {
+ p++;
+ }
+ while (n>fullnameoffile) {
+ n--;
+ if (*n == '.') {
+ break;
+ }
+ }
+ if (n>p) {
+ int q = *n;
+ cur_ext = maketexstring(n);
+ *n = 0;
+ cur_name = maketexstring(p);
+ *n = q;
+ }
+ }
+
+
source_filename_stack[in_open] = iname;
full_source_filename_stack[in_open] = xstrdup(fullnameoffile);
/* we can try to conserve string pool space now */
@@ -1086,187 +1142,6 @@ static FILE *runpopen(char *cmd, const char *mode)
return f;
}
-@ Return true if FNAME is acceptable as a name for \.{\\openout}, \.{\\openin}, or
- \.{\\input}.
-
-@c
-typedef enum ok_type {
- ok_reading,
- ok_writing
-} ok_type;
-
-static const_string ok_type_name[] = {
- "reading",
- "writing"
-};
-
-static boolean
-opennameok(const_string fname, const_string check_var,
- const_string default_choice, ok_type action)
-{
- /* We distinguish three cases:
- 'a' (any) allows any file to be opened.
- 'r' (restricted) means disallowing special file names.
- 'p' (paranoid) means being really paranoid: disallowing special file
- names and restricting output files to be in or below
- the working directory or $TEXMFOUTPUT, while input files
- must be below the current directory, $TEXMFOUTPUT, or
- (implicitly) in the system areas.
- We default to "paranoid". The error messages from TeX will be somewhat
- puzzling...
- This function contains several return statements... */
-
- const_string open_choice = kpse_var_value(check_var);
-
- if (!open_choice)
- open_choice = default_choice;
-
- if (*open_choice == 'a' || *open_choice == 'y' || *open_choice == '1')
- return true;
-
-#if defined (unix) && !defined (MSDOS)
- {
- const_string base = xbasename(fname);
- /* Disallow .rhosts, .login, etc. Allow .tex (for LaTeX). */
- if (base[0] == 0 ||
- (base[0] == '.' && !IS_DIR_SEP(base[1]) && !STREQ(base, ".tex"))) {
- fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
- kpse_invocation_name, ok_type_name[action], fname,
- check_var, open_choice);
- return false;
- }
- }
-#else
- /* Other OSs don't have special names? */
-#endif
-
- if (*open_choice == 'r' || *open_choice == 'n' || *open_choice == '0')
- return true;
-
- /* Paranoia supplied by Charles Karney... */
- if (kpse_absolute_p(fname, false)) {
- const_string texmfoutput = kpse_var_value("TEXMFOUTPUT");
- /* Absolute pathname is only OK if TEXMFOUTPUT is set, it's not empty,
- fname begins the TEXMFOUTPUT, and is followed by / */
- if (!texmfoutput || *texmfoutput == '\0'
- || fname != strstr(fname, texmfoutput)
- || !IS_DIR_SEP(fname[strlen(texmfoutput)])) {
- fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
- kpse_invocation_name, ok_type_name[action], fname,
- check_var, open_choice);
- return false;
- }
- }
- /* For all pathnames, we disallow "../" at the beginning or "/../"
- anywhere. */
- if (fname[0] == '.' && fname[1] == '.' && IS_DIR_SEP(fname[2])) {
- fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
- kpse_invocation_name, ok_type_name[action], fname,
- check_var, open_choice);
- return false;
- } else {
- /* Check for "/../". Since more than one characted can be matched
- by |IS_DIR_SEP|, we cannot use "/../" itself. */
- const_string dotpair = strstr(fname, "..");
- while (dotpair) {
- /* If dotpair[2] == |DIR_SEP|, then dotpair[-1] is well-defined,
- because the "../" case was handled above. */
- if (IS_DIR_SEP(dotpair[2]) && IS_DIR_SEP(dotpair[-1])) {
- fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
- kpse_invocation_name, ok_type_name[action], fname,
- check_var, open_choice);
- return false;
- }
- /* Continue after the dotpair. */
- dotpair = strstr(dotpair + 2, "..");
- }
- }
-
- /* We passed all tests. */
- return true;
-}
-
-boolean openinnameok(const_string fname)
-{
- /* For input default to all. */
- return opennameok(fname, "openin_any", "a", ok_reading);
-}
-
-#if defined(WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
-
-static int Isspace(char c)
-{
- return (c == ' ' || c == '\t');
-}
-
-static boolean executable_filep(const_string fname)
-{
- string p, q, base;
- string *pp;
-
- /* check |openout_any| */
- p = kpse_var_value("openout_any");
- if (p && *p == 'p') {
- free(p);
-/* get base name
- we cannot use xbasename() for abnormal names.
-*/
- base = xstrdup(fname);
- p = strrchr(fname, '/');
- if (p) {
- p++;
- strcpy(base, p);
- }
- p = strrchr(base, '\\');
- if (p) {
- p++;
- strcpy(base, p);
- }
-# if defined(__CYGWIN__)
- for (p = base; *p; p++)
- *p = tolower(*p);
- p = base;
-# else
- p = (char *) strlwr(base);
-# endif
- for (q = p + strlen(p) - 1;
- (q >= p) && ((*q == '.') || (Isspace(*q))); q--) {
- *q = '\0'; /* remove trailing '.' , ' ' and '\t' */
- }
- q = strrchr(p, '.'); /* get extension part */
- pp = suffixlist;
- if (pp && q) {
- while (*pp) {
- if (strchr(fname, ':') || !strcmp(q, *pp)) {
- fprintf(stderr,
- "\nThe name %s is forbidden to open for writing.\n",
- fname);
- free(base);
- return true;
- }
- pp++;
- }
- }
- free(base);
- } else if (p) {
- free(p);
- }
- return false;
-}
-#endif
-
-boolean openoutnameok(const_string fname)
-{
-#if defined(WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
- /* Output of an executable file is restricted on Windows */
- if (executable_filep(fname))
- return false;
-#endif
- /* For output, default to paranoid. */
- return opennameok(fname, "openout_any", "p", ok_writing);
-}
-
-
@ piped I/O
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w
index f435ddb312f..47ed05d2651 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: texmath.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/texmath.w $";
+ "$Id: texmath.w 3981 2010-11-26 12:26:44Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/texmath.w $";
@ @c
#define mode cur_list.mode_field
@@ -715,20 +715,62 @@ void display_normal_noad(pointer p)
}
break;
case accent_noad:
+ if (accent_chr(p) != null) {
+ if (bot_accent_chr(p) != null) {
+ tprint_esc("Umathaccent both");
+ } else {
+ tprint_esc("Umathaccent");
+ }
+ } else {
+ tprint_esc("Umathaccent bottom");
+ }
+ switch (subtype(p)) {
+ case 0:
if (accent_chr(p) != null) {
if (bot_accent_chr(p) != null) {
- tprint_esc("Umathaccents");
print_fam_and_char(accent_chr(p));
print_fam_and_char(bot_accent_chr(p));
} else {
- tprint_esc("accent");
print_fam_and_char(accent_chr(p));
}
} else {
- tprint_esc("Umathbotaccent");
print_fam_and_char(bot_accent_chr(p));
}
break;
+ case 1:
+ if (accent_chr(p) != null) {
+ tprint(" fixed ");
+ print_fam_and_char(accent_chr(p));
+ if (bot_accent_chr(p) != null) {
+ print_fam_and_char(bot_accent_chr(p));
+ }
+ } else {
+ confusion("display_accent_noad");
+ }
+ break;
+ case 2:
+ if (bot_accent_chr(p) != null) {
+ if (accent_chr(p) != null) {
+ print_fam_and_char(accent_chr(p));
+ }
+ tprint(" fixed ");
+ print_fam_and_char(bot_accent_chr(p));
+ } else{
+ confusion("display_accent_noad");
+ }
+ break;
+ case 3:
+ if (accent_chr(p) != null && bot_accent_chr(p) != null) {
+ tprint(" fixed ");
+ print_fam_and_char(accent_chr(p));
+ tprint(" fixed ");
+ print_fam_and_char(bot_accent_chr(p));
+ } else {
+ confusion("display_accent_noad");
+ }
+ break;
+ }
+ break;
}
print_subsidiary_data(nucleus(p), '.');
print_subsidiary_data(supscr(p), '^');
@@ -1556,10 +1598,31 @@ void math_ac(void)
} else if (cur_chr == 1) { /* \.{\\omathaccent} */
t = scan_mathchar(aleph_mathcode);
} else if (cur_chr == 2) { /* \.{\\Umathaccent} */
- t = scan_mathchar(xetex_mathcode);
- } else if (cur_chr == 3) { /* \.{\\Umathbotaccent} */
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 1;
+ t = scan_mathchar(xetex_mathcode);
+ } else if (scan_keyword("both")) {
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 1;
+ }
+ t = scan_mathchar(xetex_mathcode);
+ if (scan_keyword("fixed")) {
+ subtype(tail) += 2;
+ }
+ b = scan_mathchar(xetex_mathcode);
+ } else if (scan_keyword("bottom")) {
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 2;
+ }
+ b = scan_mathchar(xetex_mathcode);
+ } else {
+ t = scan_mathchar(xetex_mathcode);
+ }
+ } else if (cur_chr == 3) { /* deprecated: \.{\\Umathbotaccent} */
+ pdftex_warn("\\Umathbotaccent is deprecated, please update to \\Umathaccent bottom");
b = scan_mathchar(xetex_mathcode);
- } else if (cur_chr == 4) { /* \.{\\Umathaccents} */
+ } else if (cur_chr == 4) { /* deprecated: \.{\\Umathaccents} */
+ pdftex_warn("\\Umathaccents is deprecated, please update to \\Umathaccent both");
t = scan_mathchar(xetex_mathcode);
b = scan_mathchar(xetex_mathcode);
} else {
@@ -2209,15 +2272,10 @@ resulting list, and with |aux_save| holding the |prev_depth| value.
void finish_display_alignment(pointer p, pointer q, halfword saved_prevdepth)
{
do_assignments();
- if (cur_cmd != math_shift_cmd) {
- const char *hlp[] = {
- "Displays can use special alignments (like \\eqalignno)",
- "only if nothing but the alignment itself is between $$'s.",
- NULL
- };
- back_error("Missing $$ inserted", hlp);
- } else {
+ if (cur_cmd == math_shift_cmd) {
check_second_math_shift();
+ } else {
+ check_display_math_end();
}
pop_nest();
tail_append(new_penalty(int_par(pre_display_penalty_code)));
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 556f8fb2c72..45c84032fd8 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.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: texnodes.h 3552 2010-03-26 15:30:08Z taco $ */
+/* $Id: texnodes.h 4090 2011-02-28 08:51:20Z taco $ */
#include <stdarg.h>
@@ -183,13 +183,16 @@ typedef enum {
# define acc_kern 2 /*|subtype| of kern nodes from accents */
# define synctex_tag_kern(a) vinfo((a)+3)
# define synctex_line_kern(a) vlink((a)+3)
-# define ex_kern(a) vinfo((a)+4) /* expansion factor (hz) */
+# define ex_kern(a) vinfo((a)+4) /* expansion factor (hz) */
# define box_node_size 9
# define HLIST_SUBTYPE_UNKNOWN 0
-# define HLIST_SUBTYPE_LINE 1
-# define HLIST_SUBTYPE_HBOX 2
+# define HLIST_SUBTYPE_LINE 1 /* paragraph lines */
+# define HLIST_SUBTYPE_HBOX 2 /* \.{\\hbox} */
+# define HLIST_SUBTYPE_INDENT 3 /* indentation box */
+# define HLIST_SUBTYPE_ALIGNROW 4 /* row from a \.{\\halign} or \.{\\valign} */
+# define HLIST_SUBTYPE_ALIGNCELL 5 /* cell from a \.{\\halign} or \.{\\valign} */
# define width(a) varmem[(a)+2].cint
# define depth(a) varmem[(a)+3].cint
@@ -353,6 +356,9 @@ typedef enum {
# define nodetype_has_attributes(t) (((t)<=glyph_node) && ((t)!=unset_node))
+# define nodetype_has_subtype(t) ((t)!=action_node && (t)!=attribute_list_node && (t)!=attribute_node && (t)!=glue_spec_node)
+# define nodetype_has_prev(t) nodetype_has_subtype((t))
+
/* style and choice nodes */
/* style nodes can be smaller, the information is encoded in |subtype|,
but choice nodes are on-the-spot converted to style nodes */
@@ -538,6 +544,7 @@ typedef enum {
# define late_lua_data(a) vlink((a)+2)
# define late_lua_reg(a) vinfo((a)+2)
# define late_lua_name(a) vlink((a)+3)
+# define late_lua_type(a) subtype((a)+3)
# define local_par_size 6
@@ -687,7 +694,8 @@ extern pointer actual_box_width(pointer r, scaled base_width);
/* TH: these two defines still need checking. The node ordering in luatex is not
quite the same as in tex82 */
-# define precedes_break(a) (type((a))<math_node && (type(a)!=whatsit_node || subtype(a)!=dir_node))
+# define precedes_break(a) (type((a))<math_node && \
+ (type(a)!=whatsit_node || (subtype(a)!=dir_node && subtype(a)!=local_par_node)))
# define non_discardable(a) (type((a))<math_node)
/* from luanode.c */
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
index 74ee9c9bc59..3e971013d21 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: texnodes.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/texnodes.w $";
+ "$Id: texnodes.w 4139 2011-04-12 08:37:27Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/texnodes.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -72,14 +72,14 @@ int copy_error(halfword p); /* define below */
const char *node_fields_list[] =
{ "attr", "width", "depth", "height", "dir", "shift",
- "glue_order", "glue_sign", "glue_set", "list", NULL
+ "glue_order", "glue_sign", "glue_set", "head", NULL
};
const char *node_fields_rule[] =
{ "attr", "width", "depth", "height", "dir", NULL };
const char *node_fields_insert[] =
- { "attr", "cost", "depth", "height", "spec", "list", NULL };
+ { "attr", "cost", "depth", "height", "spec", "head", NULL };
const char *node_fields_mark[] = { "attr", "class", "mark", NULL };
-const char *node_fields_adjust[] = { "attr", "list", NULL };
+const char *node_fields_adjust[] = { "attr", "head", NULL };
const char *node_fields_disc[] = { "attr", "pre", "post", "replace", NULL };
const char *node_fields_math[] = { "attr", "surround", NULL };
const char *node_fields_glue[] = { "attr", "spec", "leader", NULL };
@@ -88,7 +88,7 @@ const char *node_fields_penalty[] = { "attr", "penalty", NULL };
const char *node_fields_unset[] =
{ "attr", "width", "depth", "height", "dir", "shrink",
- "glue_order", "glue_sign", "stretch", "span", "list", NULL
+ "glue_order", "glue_sign", "stretch", "span", "head", NULL
};
const char *node_fields_margin_kern[] = { "attr", "width", "glyph", NULL };
@@ -118,8 +118,8 @@ const char *node_fields_accent[] =
{ "attr", "nucleus", "sub", "sup", "accent", "bot_accent", NULL };
const char *node_fields_fence[] = { "attr", "delim", NULL };
const char *node_fields_math_char[] = { "attr", "fam", "char", NULL };
-const char *node_fields_sub_box[] = { "attr", "list", NULL };
-const char *node_fields_sub_mlist[] = { "attr", "list", NULL };
+const char *node_fields_sub_box[] = { "attr", "head", NULL };
+const char *node_fields_sub_mlist[] = { "attr", "head", NULL };
const char *node_fields_math_text_char[] = { "attr", "fam", "char", NULL };
const char *node_fields_delim[] =
{ "attr", "small_fam", "small_char", "large_fam", "large_char", NULL };
@@ -186,7 +186,7 @@ const char *node_fields_whatsit_pdf_start_thread[] =
const char *node_fields_whatsit_pdf_end_thread[] = { "attr", NULL };
const char *node_fields_whatsit_pdf_save_pos[] = { "attr", NULL };
const char *node_fields_whatsit_late_lua[] =
- { "attr", "reg", "data", "name", NULL };
+ { "attr", "reg", "data", "name", "string", NULL };
const char *node_fields_whatsit_close_lua[] = { "attr", "reg", NULL };
const char *node_fields_whatsit_pdf_colorstack[] =
{ "attr", "stack", "cmd", "data", NULL };
@@ -232,11 +232,9 @@ node_info node_data[] = {
{math_char_node, math_kernel_node_size, node_fields_math_char, "math_char"},
{sub_box_node, math_kernel_node_size, node_fields_sub_box, "sub_box"},
{sub_mlist_node, math_kernel_node_size, node_fields_sub_mlist, "sub_mlist"},
- {math_text_char_node, math_kernel_node_size, node_fields_math_text_char,
- "math_text_char"},
+ {math_text_char_node, math_kernel_node_size, node_fields_math_text_char, "math_text_char"},
{delim_node, math_shield_node_size, node_fields_delim, "delim"},
- {margin_kern_node, margin_kern_node_size, node_fields_margin_kern,
- "margin_kern"},
+ {margin_kern_node, margin_kern_node_size, node_fields_margin_kern, "margin_kern"},
{glyph_node, glyph_node_size, node_fields_glyph, "glyph"},
{align_record_node, box_node_size, NULL, "align_record"},
{pseudo_file_node, pseudo_file_node_size, NULL, "pseudo_file"},
@@ -248,8 +246,7 @@ node_info node_data[] = {
{span_node, span_node_size, NULL, "span"},
{attribute_node, attribute_node_size, node_fields_attribute, "attribute"},
{glue_spec_node, glue_spec_size, node_fields_glue_spec, "glue_spec"},
- {attribute_list_node, attribute_node_size, node_fields_attribute_list,
- "attribute_list"},
+ {attribute_list_node, attribute_node_size, node_fields_attribute_list, "attribute_list"},
{action_node, pdf_action_size, node_fields_action, "action"},
{temp_node, temp_node_size, NULL, "temp"},
{align_stack_node, align_stack_node_size, NULL, "align_stack"},
@@ -390,10 +387,12 @@ halfword new_node(int i, int j)
but the overall allocation faster then an explicit test
at the top of |new_node()|.
*/
- free_node(n, variable_node_size);
- n = slow_get_node(j);
- (void) memset((void *) (varmem + n + 1), 0,
+ if (j>0) {
+ free_node(n, variable_node_size);
+ n = slow_get_node(j);
+ (void) memset((void *) (varmem + n + 1), 0,
(sizeof(memory_word) * ((unsigned) j - 1)));
+ }
break;
default:
break;
@@ -660,9 +659,7 @@ halfword copy_node(const halfword p)
add_token_ref(pdf_setmatrix_data(p));
break;
case late_lua_node:
- if (late_lua_name(p) > 0)
- add_token_ref(late_lua_name(p));
- add_token_ref(late_lua_data(p));
+ copy_late_lua(r, p);
break;
case pdf_annot_node:
add_token_ref(pdf_annot_data(p));
@@ -957,9 +954,7 @@ void flush_node(halfword p)
delete_token_ref(pdf_setmatrix_data(p));
break;
case late_lua_node:
- if (late_lua_name(p) > 0)
- delete_token_ref(late_lua_name(p));
- delete_token_ref(late_lua_data(p));
+ free_late_lua(p);
break;
case pdf_annot_node:
delete_token_ref(pdf_annot_data(p));
@@ -1194,7 +1189,8 @@ void check_node(halfword p)
case late_lua_node:
if (late_lua_name(p) > 0)
check_token_ref(late_lua_name(p));
- check_token_ref(late_lua_data(p));
+ if (late_lua_type(p) == normal)
+ check_token_ref(late_lua_data(p));
break;
case pdf_annot_node:
check_token_ref(pdf_annot_data(p));
@@ -1575,33 +1571,43 @@ void init_node_mem(int t)
shrink_order(fil_neg_glue) = normal;
/* initialize node list heads */
vinfo(page_ins_head) = 0;
+ type(page_ins_head) = temp_node;
vlink(page_ins_head) = null;
alink(page_ins_head) = null;
vinfo(contrib_head) = 0;
+ type(contrib_head) = temp_node;
vlink(contrib_head) = null;
alink(contrib_head) = null;
vinfo(page_head) = 0;
+ type(page_head) = temp_node;
vlink(page_head) = null;
alink(page_head) = null;
vinfo(temp_head) = 0;
+ type(temp_head) = temp_node;
vlink(temp_head) = null;
alink(temp_head) = null;
vinfo(hold_head) = 0;
+ type(hold_head) = temp_node;
vlink(hold_head) = null;
alink(hold_head) = null;
vinfo(adjust_head) = 0;
+ type(adjust_head) = temp_node;
vlink(adjust_head) = null;
alink(adjust_head) = null;
vinfo(pre_adjust_head) = 0;
+ type(pre_adjust_head) = temp_node;
vlink(pre_adjust_head) = null;
alink(pre_adjust_head) = null;
vinfo(active) = 0;
+ type(active) = unhyphenated_node;
vlink(active) = null;
alink(active) = null;
vinfo(align_head) = 0;
+ type(align_head) = temp_node;
vlink(align_head) = null;
alink(align_head) = null;
vinfo(end_span) = 0;
+ type(end_span) = span_node;
vlink(end_span) = null;
alink(end_span) = null;
type(begin_point) = glyph_node;
@@ -2334,9 +2340,7 @@ static void show_whatsit_node(int p)
tprint_esc("noboundary");
break;
case late_lua_node:
- tprint_esc("latelua");
- print_int(late_lua_reg(p));
- print_mark(late_lua_data(p));
+ show_late_lua(p);
break;
case close_lua_node:
tprint_esc("closelua");
@@ -2812,6 +2816,11 @@ void show_node_list(int p)
tprint(" pre ");
node_list_display(adjust_ptr(p)); /* recursive call */
break;
+ case glue_spec_node:
+ tprint("<glue_spec ");
+ print_spec(p, NULL);
+ tprint(">");
+ break;
default:
show_math_node(p);
break;
diff --git a/Build/source/texk/web2c/luatexdir/tex/textcodes.w b/Build/source/texk/web2c/luatexdir/tex/textcodes.w
index 5f237c58481..fae9ba9ce87 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textcodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/textcodes.w
@@ -21,8 +21,8 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: textcodes.w 3612 2010-04-13 09:29:42Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/textcodes.w $";
+ "$Id: textcodes.w 3615 2010-04-13 21:59:59Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/textcodes.w $";
@ @c
#define LCCODESTACK 8
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h
index 7af0bf4ee51..b57c42282ea 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.h
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.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: textoken.h 3723 2010-06-18 09:19:27Z taco $ */
+/* $Id: textoken.h 3853 2010-09-03 18:05:14Z oneiros $ */
#ifndef TEXTOKEN_H
# define TEXTOKEN_H
@@ -48,10 +48,10 @@ typedef struct smemory_word_ {
# ifdef WORDS_BIGENDIAN
halfword hhrh;
halfword hhlh;
-#else
+# else
halfword hhlh;
halfword hhrh;
-#endif
+# endif
} smemory_word;
# define fix_mem_init 10000
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w
index 501371bc3e1..2a57eff17c5 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.w
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w
@@ -19,8 +19,8 @@
@ @c
static const char _svn_version[] =
- "$Id: textoken.w 3612 2010-04-13 09:29:42Z taco $"
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/textoken.w $";
+ "$Id: textoken.w 4032 2010-12-11 09:38:19Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/tex/textoken.w $";
#include "ptexlib.h"
@@ -480,45 +480,37 @@ boolean scan_keyword(const char *s)
halfword q; /* new node being added to the token list via |store_new_token| */
const char *k; /* index into |str_pool| */
halfword save_cur_cs = cur_cs;
- if (strlen(s) == 1) {
- /* Get the next non-blank non-call token; */
- do {
- get_x_token();
- } while ((cur_cmd == spacer_cmd) || (cur_cmd == relax_cmd));
- if ((cur_cs == 0) && ((cur_chr == *s) || (cur_chr == *s - 'a' + 'A'))) {
- return true;
- } else {
+ int saved_align_state = align_state;
+ assert (strlen(s) > 1);
+ p = backup_head;
+ token_link(p) = null;
+ k = s;
+ while (*k) {
+ get_x_token(); /* recursion is possible here */
+ if ((cur_cs == 0) &&
+ ((cur_chr == *k) || (cur_chr == *k - 'a' + 'A'))) {
+ store_new_token(cur_tok);
+ k++;
+ } else if ((cur_cmd != spacer_cmd) || (p != backup_head)) {
+ if (p != backup_head) {
+ q = get_avail();
+ token_info(q) = cur_tok;
+ token_link(q) = null;
+ token_link(p) = q;
+ begin_token_list(token_link(backup_head), backed_up);
+ if (cur_cmd != endv_cmd)
+ align_state = saved_align_state;
+ } else {
+ back_input();
+ }
cur_cs = save_cur_cs;
- back_input();
return false;
}
- } else {
- p = backup_head;
- token_link(p) = null;
- k = s;
- while (*k) {
- get_x_token(); /* recursion is possible here */
- if ((cur_cs == 0) &&
- ((cur_chr == *k) || (cur_chr == *k - 'a' + 'A'))) {
- store_new_token(cur_tok);
- k++;
- } else if ((cur_cmd != spacer_cmd) || (p != backup_head)) {
- if (p != backup_head) {
- q = get_avail();
- token_info(q) = cur_tok;
- token_link(q) = null;
- token_link(p) = q;
- begin_token_list(token_link(backup_head), backed_up);
- } else {
- back_input();
- }
- cur_cs = save_cur_cs;
- return false;
- }
- }
- flush_list(token_link(backup_head));
}
+ flush_list(token_link(backup_head));
cur_cs = save_cur_cs;
+ if (cur_cmd != endv_cmd)
+ align_state = saved_align_state;
return true;
}
@@ -949,10 +941,6 @@ static boolean get_next_file(void)
break;
}
} else {
- if (current_ocp_lstack > 0) {
- pop_input();
- return false;
- }
if (iname != 21)
istate = new_line;
@@ -1812,7 +1800,7 @@ void conv_toks(void)
break;
case pdf_xform_name_code:
scan_int();
- check_obj_exists(static_pdf, obj_type_xform, cur_val);
+ check_obj_type(static_pdf, obj_type_xform, cur_val);
break;
case pdf_creation_date_code:
ins_list(string_to_toks(getcreationdate(static_pdf)));
@@ -1920,7 +1908,7 @@ void conv_toks(void)
break;
case pdf_ximage_bbox_code:
scan_int();
- check_obj_exists(static_pdf, obj_type_ximage, cur_val);
+ check_obj_type(static_pdf, obj_type_ximage, cur_val);
i = obj_data_ptr(static_pdf, cur_val);
scan_int();
j = cur_val;
diff --git a/Build/source/texk/web2c/luatexdir/utils/avlstuff.w b/Build/source/texk/web2c/luatexdir/utils/avlstuff.w
index d46c5cabe77..81b0bd92028 100644
--- a/Build/source/texk/web2c/luatexdir/utils/avlstuff.w
+++ b/Build/source/texk/web2c/luatexdir/utils/avlstuff.w
@@ -26,7 +26,7 @@
static const char _svn_version[] =
"$Id: avlstuff.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/utils/avlstuff.w $";
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/utils/avlstuff.w $";
@ memory management functions for AVL
@c
diff --git a/Build/source/texk/web2c/luatexdir/utils/managed-sa.w b/Build/source/texk/web2c/luatexdir/utils/managed-sa.w
index 5c02f13d76d..a9cd131d64a 100644
--- a/Build/source/texk/web2c/luatexdir/utils/managed-sa.w
+++ b/Build/source/texk/web2c/luatexdir/utils/managed-sa.w
@@ -24,7 +24,7 @@
static const char _svn_version[] =
"$Id: managed-sa.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/utils/managed-sa.w $";
+"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/utils/managed-sa.w $";
@ @c
static void store_sa_stack(sa_tree a, int n, sa_tree_item v, int gl)
diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h b/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
index 9a8dba6825b..53988694299 100644
--- a/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
+++ b/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
@@ -34,7 +34,7 @@ authorization from the copyright holder.
*/
-/* $Id: synctex-luatex.h 3685 2010-05-13 07:37:47Z taco $ */
+/* $Id: synctex-luatex.h 4064 2011-01-12 22:12:22Z hhenkel $ */
#undef synchronization_field_size
#define synchronization_field_size 1
@@ -85,7 +85,7 @@ authorization from the copyright holder.
#define SYNCTEX_CURH static_pdf->posstruct->pos.h
#define SYNCTEX_GET_JOB_NAME() makecstring(job_name)
-#define SYNCTEX_GET_LOG_NAME() (char *)xstrdup((const char*)texmf_log_name)
+#define SYNCTEX_GET_LOG_NAME() get_full_log_name()
#define SYNCTEX_RULE_WD width(p)
#define SYNCTEX_RULE_HT height(p)
@@ -97,14 +97,13 @@ authorization from the copyright holder.
#include "ptexlib.h"
-/* We observe pdfoutputvalue in order to determine whether output mode is
+/* We observe static_pdf->o_mode in order to determine whether output mode is
* pdf or dvi.
- * We will assume that pdf_output_value equals pdf_output before entering
+ * We will assume that pdf->o_mode is set before entering
* the synctex_sheet function below. */
#undef SYNCTEX_OFFSET_IS_PDF
-#define SYNCTEX_OFFSET_IS_PDF (pdf_output_value>0)
+#define SYNCTEX_OFFSET_IS_PDF (static_pdf->o_mode==OMODE_PDF)
#undef SYNCTEX_OUTPUT
-#define SYNCTEX_OUTPUT ((pdf_output_value>0)?"pdf":"dvi")
+#define SYNCTEX_OUTPUT ((static_pdf->o_mode==OMODE_PDF)?"pdf":"dvi")
#define __SyncTeX__ 1
-
diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex.c b/Build/source/texk/web2c/luatexdir/utils/synctex.c
index 557c0bdae23..3b643ee064f 100644
--- a/Build/source/texk/web2c/luatexdir/utils/synctex.c
+++ b/Build/source/texk/web2c/luatexdir/utils/synctex.c
@@ -998,6 +998,12 @@ static inline void synctex_record_rule(halfword p);
# define SYNCTEX_IGNORE_RULE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
|| (0 >= SYNCTEX_TAG_MODEL(NODE,rule_node_size)) \
|| (0 >= SYNCTEX_LINE_MODEL(NODE,rule_node_size))
+# define SYNCTEX_IGNORE_GLUE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+ || (0 >= SYNCTEX_TAG_MODEL(NODE,glue_node_size)) \
+ || (0 >= SYNCTEX_LINE_MODEL(NODE,glue_node_size))
+# define SYNCTEX_IGNORE_KERN(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+ || (0 >= SYNCTEX_TAG_MODEL(NODE,kern_node_size)) \
+ || (0 >= SYNCTEX_LINE_MODEL(NODE,kern_node_size))
void synctexhorizontalruleorglue(halfword p, halfword this_box
__attribute__ ((unused)))
{
@@ -1009,8 +1015,12 @@ void synctexhorizontalruleorglue(halfword p, halfword this_box
if (SYNCTEX_IGNORE_RULE(p)) {
return;
}
- } else {
- if (SYNCTEX_IGNORE(p)) {
+ } else if (SYNCTEX_TYPE(p) == glue_node) {
+ if (SYNCTEX_IGNORE_GLUE(p)) {
+ return;
+ }
+ } else if (SYNCTEX_TYPE(p) == kern_node) {
+ if (SYNCTEX_IGNORE_KERN(p)) {
return;
}
}
@@ -1025,13 +1035,13 @@ void synctexhorizontalruleorglue(halfword p, halfword this_box
synctex_record_rule(p); /* always record synchronously: maybe some text is outside the box */
break;
case glue_node:
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, glue_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, glue_node_size);
synctex_record_glue(p); /* always record synchronously: maybe some text is outside the box */
break;
case kern_node:
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, kern_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, kern_node_size);
synctex_record_kern(p); /* always record synchronously: maybe some text is outside the box */
break;
default:
@@ -1049,7 +1059,7 @@ void synctexkern(halfword p, halfword this_box)
# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexkern\n");
# endif
- if (SYNCTEX_IGNORE(p)) {
+ if (SYNCTEX_IGNORE_KERN(p)) {
return;
}
if (SYNCTEX_CONTEXT_DID_CHANGE(p)) {
@@ -1061,13 +1071,13 @@ void synctexkern(halfword p, halfword this_box)
if (synctex_ctxt.node == this_box) {
/* first node in the list */
synctex_ctxt.node = p;
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, kern_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, kern_node_size);
synctex_ctxt.recorder = &synctex_kern_recorder;
} else {
synctex_ctxt.node = p;
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, kern_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, kern_node_size);
synctex_ctxt.recorder = NULL;
/* always record when the context has just changed
* and when not the first node */
@@ -1076,8 +1086,8 @@ void synctexkern(halfword p, halfword this_box)
} else {
/* just update the geometry and type (for future improvements) */
synctex_ctxt.node = p;
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, kern_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, kern_node_size);
synctex_ctxt.recorder = &synctex_kern_recorder;
}
}
@@ -1455,8 +1465,8 @@ static inline void synctex_record_glue(halfword p)
printf("\nSynchronize DEBUG: synctex_glue_recorder\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
- SYNCTEX_TAG_MODEL(p, medium_node_size),
- SYNCTEX_LINE_MODEL(p, medium_node_size),
+ SYNCTEX_TAG_MODEL(p, glue_node_size),
+ SYNCTEX_LINE_MODEL(p, glue_node_size),
synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1475,8 +1485,8 @@ static inline void synctex_record_kern(halfword p)
printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
- SYNCTEX_TAG_MODEL(p, medium_node_size),
- SYNCTEX_LINE_MODEL(p, medium_node_size),
+ SYNCTEX_TAG_MODEL(p, kern_node_size),
+ SYNCTEX_LINE_MODEL(p, kern_node_size),
synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
SYNCTEX_WIDTH(p) UNIT);
if (len > 0) {
@@ -1517,8 +1527,8 @@ void synctex_math_recorder(halfword p)
printf("\nSynchronize DEBUG: synctex_math_recorder\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
- SYNCTEX_TAG_MODEL(p, medium_node_size),
- SYNCTEX_LINE_MODEL(p, medium_node_size),
+ SYNCTEX_TAG_MODEL(p, math_node_size),
+ SYNCTEX_LINE_MODEL(p, math_node_size),
synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1537,8 +1547,8 @@ void synctex_kern_recorder(halfword p)
printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
- SYNCTEX_TAG_MODEL(p, medium_node_size),
- SYNCTEX_LINE_MODEL(p, medium_node_size),
+ SYNCTEX_TAG_MODEL(p, kern_node_size),
+ SYNCTEX_LINE_MODEL(p, kern_node_size),
synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
SYNCTEX_WIDTH(p) UNIT);
if (len > 0) {
diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.w b/Build/source/texk/web2c/luatexdir/utils/utils.w
index 05eca81cbc6..e3dc26bc6bf 100644
--- a/Build/source/texk/web2c/luatexdir/utils/utils.w
+++ b/Build/source/texk/web2c/luatexdir/utils/utils.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: utils.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/utils/utils.w $";
+ "$Id: utils.w 3779 2010-07-31 11:29:22Z oneiros $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/utils/utils.w $";
@ @c
#include "openbsd-compat.h"
@@ -49,13 +49,11 @@ static const char _svn_version[] =
#include "lua/luatex-api.h" /* for ptexbanner */
#include "png.h"
-#ifdef POPPLER_VERSION
-# define xpdfString "poppler"
-# include "poppler-config.h"
-# define xpdfVersion POPPLER_VERSION
-#else
-# define xpdfString "xpdf"
-# include "xpdf/config.h" /* just to get the xpdf version */
+
+#include "poppler-config.h"
+#ifndef POPPLER_VERSION
+# include "aconf.h"
+# define POPPLER_VERSION POPPLER_PACKAGE_VERSION
#endif
@ @c
@@ -354,9 +352,9 @@ void initversionstring(char **versions)
(void) asprintf(versions,
"Compiled with libpng %s; using libpng %s\n"
"Compiled with zlib %s; using zlib %s\n"
- "Compiled with %s version %s\n",
+ "Compiled with poppler version %s\n",
PNG_LIBPNG_VER_STRING, png_libpng_ver,
- ZLIB_VERSION, zlib_version, xpdfString, xpdfVersion);
+ ZLIB_VERSION, zlib_version, POPPLER_VERSION);
}
@ @c
@@ -407,7 +405,6 @@ scaled divide_scaled(scaled s, scaled m, int dd)
/* rounding */
if (2 * r >= m) {
q++;
- r -= m;
}
return sign * q;
}
diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog
index c854bf868bf..9893f36b5a3 100644
--- a/Build/source/texk/web2c/man/ChangeLog
+++ b/Build/source/texk/web2c/man/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-12 Taco Hoekwater <taco@metapost.org>
+
+ * luatex.man: update to version 0.70
+
2011-04-05 Taco Hoekwater <taco@metapost.org>
* mpost.man: update to version 1.504
diff --git a/Build/source/texk/web2c/man/Makefile.in b/Build/source/texk/web2c/man/Makefile.in
index e68e7d7e210..06178ab778f 100644
--- a/Build/source/texk/web2c/man/Makefile.in
+++ b/Build/source/texk/web2c/man/Makefile.in
@@ -68,6 +68,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -213,6 +214,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -227,6 +231,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/web2c/man/luatex.man b/Build/source/texk/web2c/man/luatex.man
index 225b4e0ae05..f11a9b8b6f2 100644
--- a/Build/source/texk/web2c/man/luatex.man
+++ b/Build/source/texk/web2c/man/luatex.man
@@ -1,4 +1,4 @@
-.TH LUATEX 1 "1 March 2011" "luatex 0.40" "Web2C @VERSION@"
+.TH LUATEX 1 "12 April 2011" "luatex 0.70" "Web2C @VERSION@"
.\"=====================================================================
.if n .ds MF Metafont
.if t .ds MF M\s-2ETAFONT\s0
diff --git a/Build/source/texk/web2c/omegafonts/Makefile.in b/Build/source/texk/web2c/omegafonts/Makefile.in
index 7e5f6f5f3a0..4035224d649 100644
--- a/Build/source/texk/web2c/omegafonts/Makefile.in
+++ b/Build/source/texk/web2c/omegafonts/Makefile.in
@@ -58,6 +58,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -221,6 +222,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -235,6 +239,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/web2c/otps/Makefile.in b/Build/source/texk/web2c/otps/Makefile.in
index 733109e7313..cf5fc7f5cc3 100644
--- a/Build/source/texk/web2c/otps/Makefile.in
+++ b/Build/source/texk/web2c/otps/Makefile.in
@@ -58,6 +58,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -242,6 +243,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -256,6 +260,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/web2c/window/Makefile.in b/Build/source/texk/web2c/window/Makefile.in
index aa0a1983cc4..38985bafd39 100644
--- a/Build/source/texk/web2c/window/Makefile.in
+++ b/Build/source/texk/web2c/window/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
$(top_srcdir)/../../m4/kpse-lt-hack.m4 \
$(top_srcdir)/../../m4/kpse-macos-framework.m4 \
$(top_srcdir)/../../m4/kpse-obsdcompat-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-poppler-flags.m4 \
$(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
$(top_srcdir)/../../m4/kpse-socket-libs.m4 \
$(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
@@ -203,6 +204,9 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+POPPLER_DEPEND = @POPPLER_DEPEND@
+POPPLER_INCLUDES = @POPPLER_INCLUDES@
+POPPLER_LIBS = @POPPLER_LIBS@
PTEXENC_DEPEND = @PTEXENC_DEPEND@
PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
PTEXENC_LIBS = @PTEXENC_LIBS@
@@ -217,6 +221,7 @@ TECKIT_DEPEND = @TECKIT_DEPEND@
TECKIT_INCLUDES = @TECKIT_INCLUDES@
TECKIT_LIBS = @TECKIT_LIBS@
TIE = @TIE@
+TXTTOZLIB = @TXTTOZLIB@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
diff --git a/Build/source/texk/xdv2pdf/configure b/Build/source/texk/xdv2pdf/configure
index 4a9ebf3697b..25768862198 100755
--- a/Build/source/texk/xdv2pdf/configure
+++ b/Build/source/texk/xdv2pdf/configure
@@ -763,7 +763,6 @@ with_sysroot
enable_libtool_lock
enable_largefile
enable_compiler_warnings
-with_gnu_ld
with_system_kpathsea
with_kpathsea_includes
with_kpathsea_libdir
@@ -777,19 +776,12 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CPPFLAGS
CXX
CXXFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
CCC
CXXCPP
OBJC
-OBJCFLAGS
-LDFLAGS
-LIBS
-OBJC'
+OBJCFLAGS'
# Initialize some variables set by options.
@@ -19527,9 +19519,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/xdvik/configure b/Build/source/texk/xdvik/configure
index 524c3eb6608..88f39ca75e7 100755
--- a/Build/source/texk/xdvik/configure
+++ b/Build/source/texk/xdvik/configure
@@ -800,7 +800,6 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CPPFLAGS
XMKMF'
ac_subdirs_all='squeeze'
@@ -18530,9 +18529,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/xdvik/squeeze/configure b/Build/source/texk/xdvik/squeeze/configure
index 4caeeeb83dc..653642c82e1 100755
--- a/Build/source/texk/xdvik/squeeze/configure
+++ b/Build/source/texk/xdvik/squeeze/configure
@@ -3948,8 +3948,8 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_commands="`echo $ac_config_commands`"
_ACEOF
diff --git a/Build/source/texk/xdvipdfmx/configure b/Build/source/texk/xdvipdfmx/configure
index 64b29a61c28..e6a1a76169a 100755
--- a/Build/source/texk/xdvipdfmx/configure
+++ b/Build/source/texk/xdvipdfmx/configure
@@ -787,8 +787,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -16325,9 +16324,9 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
+config_commands="`echo $ac_config_commands`"
_ACEOF