diff options
author | Karl Berry <karl@freefriends.org> | 2018-05-17 21:37:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-05-17 21:37:18 +0000 |
commit | 35f7fd5d9d549dd4d75f8bb75bc99aac680f3d76 (patch) | |
tree | 606e6c384989ad8c2018cba73d2cedf8c7edcca3 /Build/source/texk/web2c | |
parent | 6523183e9bf0cb9c831adaa6eed6cac3b3c9d207 (diff) |
new primitive \expanded, pdftex r801, https://mailman.ntg.nl/pipermail/ntg-pdftex/2018-May/004233.html
git-svn-id: svn://tug.org/texlive/trunk@47741 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/Makefile.in | 28 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/NEWS | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/am/pdftex.am | 14 | ||||
-rwxr-xr-x | Build/source/texk/web2c/pdftexdir/expanded.test | 19 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftex.web | 21 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/tests/expanded.tex | 46 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/tests/expanded.txt | 61 |
8 files changed, 183 insertions, 17 deletions
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 643502cdc5c..1ed0c3ce030 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -3080,13 +3080,13 @@ EXTRA_DIST = PROJECTS cftests cpascal.h help.h w2c/config.h \ pdftexdir/NEWS pdftexdir/README pdftexdir/change-files.txt \ $(pdftex_tests) tests/wprob.tex pdftexdir/tests/pdfimage.tex \ tests/1-4.jpg tests/B.pdf tests/basic.tex \ - tests/lily-ledger-broken.png $(ttf2afm_tests) \ - pdftexdir/tests/postV3.afm pdftexdir/tests/postV3.ttf \ - pdftexdir/tests/postV7.afm pdftexdir/tests/postV7.ttf \ - $(pdftosrc_tests) pdftexdir/tests/test-13.pdf \ - pdftexdir/tests/test-13.xref pdftexdir/tests/test-15.pdf \ - pdftexdir/tests/test-15.xref $(libluasocket_sources) \ - luatexdir/luasocket/src/ftp_lua.c \ + tests/lily-ledger-broken.png tests/expanded.tex \ + $(ttf2afm_tests) pdftexdir/tests/postV3.afm \ + pdftexdir/tests/postV3.ttf pdftexdir/tests/postV7.afm \ + pdftexdir/tests/postV7.ttf $(pdftosrc_tests) \ + pdftexdir/tests/test-13.pdf pdftexdir/tests/test-13.xref \ + pdftexdir/tests/test-15.pdf pdftexdir/tests/test-15.xref \ + $(libluasocket_sources) luatexdir/luasocket/src/ftp_lua.c \ luatexdir/luasocket/src/headers_lua.c \ luatexdir/luasocket/src/http_lua.c \ luatexdir/luasocket/src/ltn12_lua.c \ @@ -3362,8 +3362,8 @@ DISTCLEANFILES = CXXLD.sh tangle.c tangle.h tangle.p tangle-web2c \ euptex-tangle euptrip.diffs pdfprimitive-euptex.* \ $(nodist_pdftex_SOURCES) pdftex.ch pdftex-web2c pdftex.p \ pdftex.pool pdftex-tangle pwprob.log pwprob.tex pdfimage.fmt \ - pdfimage.log pdfimage.pdf postV3.afm postV7.afm test-13.pdf \ - test-13.xref test-15.pdf test-15.xref \ + pdfimage.log pdfimage.pdf expanded.log postV3.afm postV7.afm \ + test-13.pdf test-13.xref test-15.pdf test-15.xref \ $(nodist_libluatex_sources) luaimage.* luajitimage.* \ $(nodist_xetex_SOURCES) xetex.web xetex.ch xetex-web2c xetex.p \ xetex.pool xetex-tangle bug73.fmt bug73.log bug73.out \ @@ -4016,9 +4016,11 @@ pdftex_ch_srcs = \ tex-binpool.ch -# pdfTeX Tests +# pdfTeX tests # -pdftex_tests = pdftexdir/wprob.test pdftexdir/pdftex.test pdftexdir/pdfimage.test +pdftex_tests = pdftexdir/wprob.test pdftexdir/pdftex.test \ + pdftexdir/pdfimage.test pdftexdir/expanded.test + ttf2afm_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/pdftexdir ttf2afm_SOURCES = pdftexdir/ttf2afm.c ttf2afm_DEPENDENCIES = $(default_dependencies) @@ -19714,7 +19716,9 @@ pdftex.pdf: pdftex.tex env MKTEXFMT=0 pdftex '\nonstopmode\input pdftex.tex' pdftex.tex: $(srcdir)/pdftexdir/pdftex.web weave $(srcdir)/pdftexdir/pdftex.web -pdftexdir/wprob.log pdftexdir/pdftex.log pdftexdir/pdfimage.log: pdftex$(EXEEXT) + +pdftexdir/wprob.log pdftexdir/pdftex.log \ + pdftexdir/pdfimage.log pdftexdir/expanded.log: pdftex$(EXEEXT) pdftexdir/ttf2afm.log: ttf2afm$(EXEEXT) $(pdftosrc_OBJECTS): $(ZLIB_DEPEND) $(LIBPNG_DEPEND) $(XPDF_DEPEND) diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index d92a00e9864..819066f815b 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,11 @@ +2018-05-13 Joseph Wright <joseph.wright@morningstar2.co.uk> + + * pdftex.web: New primitive \expanded based on original + suggestion by Heiko Oberdiek, and with work by + Bruno Le Floch and David Carlisle (on behalf of The LaTeX Project). + (expanded_code): new @d, new cases. + https://mailman.ntg.nl/pipermail/ntg-pdftex/2018-May/004233.html + 2018-05-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * ptexlib.h: Allow non-ascii file names in pdfTeX (w32 only). diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS index 9f9a08cde92..e4aa0d04661 100644 --- a/Build/source/texk/web2c/pdftexdir/NEWS +++ b/Build/source/texk/web2c/pdftexdir/NEWS @@ -1,3 +1,6 @@ +- changes: + - new primitive \expanded (from unreleased pdftex 1.50 branch + luatex). + pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018) (April 14, 2018) - changes: - do not hash current directory into PDF ID, for more reproducible builds diff --git a/Build/source/texk/web2c/pdftexdir/am/pdftex.am b/Build/source/texk/web2c/pdftexdir/am/pdftex.am index 5239b2f1183..152787d77b3 100644 --- a/Build/source/texk/web2c/pdftexdir/am/pdftex.am +++ b/Build/source/texk/web2c/pdftexdir/am/pdftex.am @@ -1,6 +1,6 @@ ## texk/web2c/pdftexdir/am/pdftex.am: Makefile fragment for pdfTeX. ## -## Copyright 2016-2017 Karl Berry <tex-live@tug.org> +## Copyright 2016-2018 Karl Berry <tex-live@tug.org> ## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. @@ -92,10 +92,13 @@ EXTRA_DIST += \ pdftexdir/README \ pdftexdir/change-files.txt -# pdfTeX Tests +# pdfTeX tests # -pdftex_tests = pdftexdir/wprob.test pdftexdir/pdftex.test pdftexdir/pdfimage.test -pdftexdir/wprob.log pdftexdir/pdftex.log pdftexdir/pdfimage.log: pdftex$(EXEEXT) +pdftex_tests = pdftexdir/wprob.test pdftexdir/pdftex.test \ + pdftexdir/pdfimage.test pdftexdir/expanded.test + +pdftexdir/wprob.log pdftexdir/pdftex.log \ + pdftexdir/pdfimage.log pdftexdir/expanded.log: pdftex$(EXEEXT) EXTRA_DIST += $(pdftex_tests) @@ -112,3 +115,6 @@ EXTRA_DIST += pdftexdir/tests/pdfimage.tex \ tests/1-4.jpg tests/B.pdf tests/basic.tex tests/lily-ledger-broken.png DISTCLEANFILES += pdfimage.fmt pdfimage.log pdfimage.pdf +## expanded.test +EXTRA_DIST += tests/expanded.tex +DISTCLEANFILES += expanded.log diff --git a/Build/source/texk/web2c/pdftexdir/expanded.test b/Build/source/texk/web2c/pdftexdir/expanded.test new file mode 100755 index 00000000000..819b09bf6cc --- /dev/null +++ b/Build/source/texk/web2c/pdftexdir/expanded.test @@ -0,0 +1,19 @@ +#! /bin/sh -vx +# $Id$ +# Public domain +# David Carlisle: version for \expanded based on existing test scripts +# by Peter Breitenlohner and Karl Berry. + +TEXMFCNF=$srcdir/../kpathsea +export TEXMFCNF +TEXINPUTS=$srcdir/pdftexdir/tests:. +export TEXINPUTS + +./pdftex -ini -etex --interaction batchmode expanded.tex +sed -n -e 's/[\\]pdf/\\/g' -e '/START/,/END/p' expanded.log \ + >expanded_pdftex.log || exit 1 + +diff "$srcdir/pdftexdir/tests/expanded.txt" expanded_pdftex.log || exit 1 + +exit 0 + diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web index 86bd827890e..56895e908af 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.web +++ b/Build/source/texk/web2c/pdftexdir/pdftex.web @@ -10748,7 +10748,8 @@ such that |job_name_code| remains last. @d etex_convert_base=5 {base for \eTeX's command codes} @d eTeX_revision_code=etex_convert_base {command code for \.{\\eTeXrevision}} @d etex_convert_codes=etex_convert_base+1 {end of \eTeX's command codes} -@d pdftex_first_expand_code = etex_convert_codes {base for \pdfTeX's command codes} +@d expanded_code = etex_convert_codes {command code for \.{\\expanded}} +@d pdftex_first_expand_code = expanded_code + 1 {base for \pdfTeX's command codes} @d pdftex_revision_code = pdftex_first_expand_code + 0 {command code for \.{\\pdftexrevision}} @d pdftex_banner_code = pdftex_first_expand_code + 1 {command code for \.{\\pdftexbanner}} @d pdf_font_name_code = pdftex_first_expand_code + 2 {command code for \.{\\pdffontname}} @@ -10790,6 +10791,9 @@ primitive("meaning",convert,meaning_code);@/ primitive("fontname",convert,font_name_code);@/ @!@:font_name_}{\.{\\fontname} primitive@> @# +primitive("expanded",convert,expanded_code);@/ +@!@:expanded_}{\.{\\expanded} primitive@> +@# primitive("pdftexrevision",convert,pdftex_revision_code);@/ @!@:pdftex_revision_}{\.{\\pdftexrevision} primitive@> primitive("pdftexbanner",convert,pdftex_banner_code);@/ @@ -10854,6 +10858,7 @@ convert: case chr_code of meaning_code: print_esc("meaning"); font_name_code: print_esc("fontname"); eTeX_revision_code: print_esc("eTeXrevision"); + expanded_code: print_esc("expanded"); pdftex_revision_code: print_esc("pdftexrevision"); pdftex_banner_code: print_esc("pdftexbanner"); pdf_font_name_code: print_esc("pdffontname"); @@ -10926,6 +10931,20 @@ string_code, meaning_code: begin save_scanner_status:=scanner_status; end; font_name_code: scan_font_ident; eTeX_revision_code: do_nothing; +expanded_code: + begin + save_scanner_status := scanner_status; + save_warning_index := warning_index; + save_def_ref := def_ref; + save_cur_string; + scan_pdf_ext_toks; + warning_index := save_warning_index; + scanner_status := save_scanner_status; + ins_list(link(def_ref)); + def_ref := save_def_ref; + restore_cur_string; + return; + end; pdftex_revision_code: do_nothing; pdftex_banner_code: do_nothing; pdf_font_name_code, pdf_font_objnum_code, pdf_font_size_code: begin diff --git a/Build/source/texk/web2c/pdftexdir/tests/expanded.tex b/Build/source/texk/web2c/pdftexdir/tests/expanded.tex new file mode 100644 index 00000000000..50484cb9533 --- /dev/null +++ b/Build/source/texk/web2c/pdftexdir/tests/expanded.tex @@ -0,0 +1,46 @@ +% $Id$ +% Public domain. +% Originally written 2018 by David Carlisle, Bruno Le Floch. + +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 +\def\typ#1{\immediate\write-1 {#1}} +\def\space{ } +\let\bgroup{ \let\egroup} + +\typ{START} +\typ{EXPANDED TEST 1} +% Check the primitive exists +\show\expanded + +\typ{EXPANDED TEST 2} +% Simple expansion test +\def\aaa{x} +\def\bbb{\aaa\aaa} +\expandafter\def\expandafter\ccc\expandafter{\expanded{\bbb,\aaa}} +\show\ccc + +\typ{EXPANDED TEST 3: the} +% Expanding \the +\typ{\expanded{\bbb,\the\numexpr100+20+3\relax}} + +\typ{EXPANDED TEST 4: macro param} +% Constructed #1 is still #1 +\expandafter\def\expandafter\ddd\expandafter#\expanded{1{#\number--1}} +\show\ddd + +\typ{EXPANDED TEST 5: torture} +% Torture test from Bruno Le Floch testing various tricky interactions +\expanded\relax\space\ifincsname \BOOM\fi{\ifincsname \BOOM\fi} +\showtokens\expandafter{\expanded{#,\noexpand\aaa,\unexpanded{\aaa}}} +\showtokens\expandafter{\expanded{#,\unexpanded{#}}} +\showtokens\expandafter{\expanded\expandafter{\noexpand\aaa}} +\showtokens\expandafter{\expanded\expandafter{\unexpanded{\aaa}}} +\showtokens\expanded{{\expanded{\aaa\noexpand\aaa\noexpand\noexpand\noexpand\aaa}}} +\toks0{\aaa} +\showtokens\expanded{{\the\toks0}} +\expanded\bgroup\show\egroup} +\edef\foo{\expanded{##}} +\show\foo + +\typ{END} +\end diff --git a/Build/source/texk/web2c/pdftexdir/tests/expanded.txt b/Build/source/texk/web2c/pdftexdir/tests/expanded.txt new file mode 100644 index 00000000000..d9b7c275c36 --- /dev/null +++ b/Build/source/texk/web2c/pdftexdir/tests/expanded.txt @@ -0,0 +1,61 @@ +START +EXPANDED TEST 1 +> \expanded=\expanded. +l.13 \show\expanded + + +EXPANDED TEST 2 +> \ccc=macro: +->xx,x. +l.20 \show\ccc + + +EXPANDED TEST 3: the +xx,123 +EXPANDED TEST 4: macro param +> \ddd=macro: +#1->#1. +l.29 \show\ddd + + +EXPANDED TEST 5: torture +> ##,\aaa ,\aaa . +l.34 ...panded{#,\noexpand\aaa,\unexpanded{\aaa}}} + + +> ##,##. +l.35 ...s\expandafter{\expanded{#,\unexpanded{#}}} + + +> \aaa . +l.36 ...fter{\expanded\expandafter{\noexpand\aaa}} + + +> x. +l.37 ...{\expanded\expandafter{\unexpanded{\aaa}}} + + +> xx\aaa . +<inserted text> {xx\aaa } + +l.38 ...pand\aaa\noexpand\noexpand\noexpand\aaa}}} + + +> \aaa . +<inserted text> {\aaa } + +l.40 \showtokens\expanded{{\the\toks0}} + + +> \egroup=end-group character }. +<inserted text> \show \egroup + +l.41 \expanded\bgroup\show\egroup} + + +> \foo=macro: +->##. +l.43 \show\foo + + +END |