From c4f2890e544be37f5d4e414b07693e12fbc66cd3 Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Thu, 1 Jul 2021 09:30:47 +0000 Subject: e-pTeX 210701 (\lastnodesubtype for math noads, \vadjust pre) git-svn-id: svn://tug.org/texlive/trunk@59787 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/eptexdir/ChangeLog | 8 + Build/source/texk/web2c/eptexdir/eptex.ech | 20 +- Build/source/texk/web2c/eptexdir/eptex_version.h | 2 +- Build/source/texk/web2c/eptexdir/pdfutils.ch | 327 +++++++++++++++++++++ .../web2c/eptexdir/tests/lastnodesubtype_math.tex | 29 ++ 5 files changed, 382 insertions(+), 4 deletions(-) create mode 100644 Build/source/texk/web2c/eptexdir/tests/lastnodesubtype_math.tex (limited to 'Build/source/texk/web2c/eptexdir') diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog index 7b6041c0e07..9b38c0d0738 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog +++ b/Build/source/texk/web2c/eptexdir/ChangeLog @@ -1,3 +1,11 @@ +2021-07-01 Hironori Kitagawa + + * eptex.ech: Revise \lastnodesubtype to show math "noad" types, + because \lastnodetype returns 15 for all math "noads". + * pdfutils.ch: Add \vadjust pre (by Hironobu Yamashita). + * eptex.ech, eptex_version.h: e-pTeX version 210701. + * tests/lastnodesubtype_math.tex: Added. + 2021-06-29 Hironori Kitagawa * eptex.defines: Add fromUCS(). diff --git a/Build/source/texk/web2c/eptexdir/eptex.ech b/Build/source/texk/web2c/eptexdir/eptex.ech index aed42a75c38..669a70ee88c 100644 --- a/Build/source/texk/web2c/eptexdir/eptex.ech +++ b/Build/source/texk/web2c/eptexdir/eptex.ech @@ -3,9 +3,15 @@ %% new primitives by e-pTeX %% +%% \epTeXversion +%% \epTeXinputencoding +%% +%% \currentspacingmode: 1 iff auto_spacing +%% \currentxspacingmode: 1 iff auto_xspacing %% \lastnodechar: the (internal) character code of the last node %% -1: non-character or null %% \lastnodesubtype: the (internal) subtype of the last node +%% note: returns a value from the type if the node is s math noad. %% -1: null %% fallback to 0 if not explicitly set %% \readpapersizespecial @@ -26,8 +32,8 @@ @y @d eTeX_version_string=='-2.6' {current \eTeX\ version} @# -@d epTeX_version_string=='-210629' -@d epTeX_version_number==210629 +@d epTeX_version_string=='-210701' +@d epTeX_version_number==210701 @z @x e-pTeX: banner @@ -239,7 +245,15 @@ end else if cur_val>disp_node then cur_val:=cur_val-1; end else cur_val:=unset_node; {\epTeX's |unset_node| is \eTeX's |unset_node+2|} - last_node_subtype_code: cur_val:=subtype(tx); + last_node_subtype_code: if type(tx)<=unset_node then cur_val:=subtype(tx) + { non-math nodes } + else begin + cur_val:=type(tx); + if cur_val0 => pre-adjustment} +@#{|append_list| is used to append a list to |tail|} +@d append_list(#) == begin link(tail) := link(#); append_list_end +@d append_list_end(#) == tail := #; end + +@d adjust_ptr(#)==mem[#+1].int + {vertical list to be moved out of horizontal list} +@z + +% [11] \vadjust pre +@x +@d hi_mem_stat_min==mem_top-13 {smallest statically allocated word in + the one-word |mem|} +@d hi_mem_stat_usage=14 {the number of one-word nodes always present} +@y +@d pre_adjust_head==mem_top-14 {head of pre-adjustment list returned by |hpack|} +@d hi_mem_stat_min==mem_top-14 {smallest statically allocated word in + the one-word |mem|} +@d hi_mem_stat_usage=15 {the number of one-word nodes always present} +@z + @x @* \[12] Displaying boxes. @y @@ -404,6 +432,18 @@ end; @* \[12] Displaying boxes. @z +% [12] \vadjust pre +@x +@ @= +begin print_esc("vadjust"); node_list_display(adjust_ptr(p)); {recursive call} +end +@y +@ @= +begin print_esc("vadjust"); if adjust_pre(p) <> 0 then print(" pre "); +node_list_display(adjust_ptr(p)); {recursive call} +end +@z + @x \[if]pdfprimitive @d frozen_special=frozen_control_sequence+10 {permanent `\.{\\special}'} @@ -1191,6 +1231,190 @@ if_pdfprimitive_code: begin @; @z +% [33] \vadjust pre +@x +if adjust_tail<>null then link(adjust_tail):=null; +@y +if adjust_tail<>null then link(adjust_tail):=null; +if pre_adjust_tail<>null then link(pre_adjust_tail):=null; +@z + +% [33] \vadjust pre +@x + ins_node,mark_node,adjust_node: if adjust_tail<>null then +@y + ins_node,mark_node,adjust_node: if (adjust_tail<>null) or (pre_adjust_tail<> null) then +@z + +% [33] \vadjust pre +@x +to make a deletion. +@^inner loop@> +@y +to make a deletion. +@^inner loop@> + +@= +@!pre_adjust_tail: pointer; + +@ @= +pre_adjust_tail := null; + +@ Materials in \.{\\vadjust} used with \.{pre} keyword will be appended to +|pre_adjust_tail| instead of |adjust_tail|. + +@d update_adjust_list(#) == begin + if # = null then + confusion("pre vadjust"); + link(#) := adjust_ptr(p); + while link(#) <> null do + # := link(#); +end +@z + +% [33] \vadjust pre +@x +@= +begin while link(q)<>p do q:=link(q); +if type(p)=adjust_node then + begin link(adjust_tail):=adjust_ptr(p); + while link(adjust_tail)<>null do adjust_tail:=link(adjust_tail); + p:=link(p); free_node(link(q),small_node_size); + end +else begin link(adjust_tail):=p; adjust_tail:=p; p:=link(p); + end; +link(q):=p; p:=q; +@y +@= +begin while link(q)<>p do q:=link(q); + if type(p) = adjust_node then begin + if adjust_pre(p) <> 0 then + update_adjust_list(pre_adjust_tail) + else + update_adjust_list(adjust_tail); + p := link(p); free_node(link(q), small_node_size); + end +else begin link(adjust_tail):=p; adjust_tail:=p; p:=link(p); + end; +link(q):=p; p:=q; +@z + +% [37] \vadjust pre +@x +@d align_stack_node_size=5 {number of |mem| words to save alignment states} +@y +@d align_stack_node_size=6 {number of |mem| words to save alignment states} +@z + +% [37] \vadjust pre +@x +@!cur_head,@!cur_tail:pointer; {adjustment list pointers} +@y +@!cur_head,@!cur_tail:pointer; {adjustment list pointers} +@!cur_pre_head,@!cur_pre_tail:pointer; {pre-adjustment list pointers} +@z + +% [37] \vadjust pre +@x +cur_head:=null; cur_tail:=null; +@y +cur_head:=null; cur_tail:=null; +cur_pre_head:=null; cur_pre_tail:=null; +@z + +% [37] procedure |push_alignment|: \vadjust pre +@x +info(p+4):=cur_head; link(p+4):=cur_tail; +align_ptr:=p; +cur_head:=get_avail; +@y +info(p+4):=cur_head; link(p+4):=cur_tail; +info(p+5):=cur_pre_head; link(p+5):=cur_pre_tail; +align_ptr:=p; +cur_head:=get_avail; +cur_pre_head:=get_avail; +@z + +% [37] procedure |pop_alignment|: \vadjust pre +@x +begin free_avail(cur_head); +p:=align_ptr; +cur_tail:=link(p+4); cur_head:=info(p+4); +@y +begin free_avail(cur_head); +free_avail(cur_pre_head); +p:=align_ptr; +cur_tail:=link(p+4); cur_head:=info(p+4); +cur_pre_tail:=link(p+5); cur_pre_head:=info(p+5); +@z + +% [37] \vadjust pre +@x +cur_align:=link(preamble); cur_tail:=cur_head; init_span(cur_align); +@y +cur_align:=link(preamble); cur_tail:=cur_head; cur_pre_tail:=cur_pre_head; +init_span(cur_align); +@z + +% [37] \vadjust pre + pTeX +@x + begin adjust_tail:=cur_tail; adjust_hlist(head,false); +@y + begin adjust_tail:=cur_tail; pre_adjust_tail:=cur_pre_tail; + adjust_hlist(head,false); +@z + +% [37] \vadjust pre +@x + cur_tail:=adjust_tail; adjust_tail:=null; +@y + cur_tail:=adjust_tail; adjust_tail:=null; + cur_pre_tail:=pre_adjust_tail; pre_adjust_tail:=null; +@z + +% [37] \vadjust pre +@x + pop_nest; append_to_vlist(p); + if cur_head<>cur_tail then + begin link(tail):=link(cur_head); tail:=cur_tail; + end; +@y + pop_nest; + if cur_pre_head <> cur_pre_tail then + append_list(cur_pre_head)(cur_pre_tail); + append_to_vlist(p); + if cur_head <> cur_tail then + append_list(cur_head)(cur_tail); +@z + +% [39] \vadjust pre +@x +@ @= +append_to_vlist(just_box); +if adjust_head<>adjust_tail then + begin link(tail):=link(adjust_head); tail:=adjust_tail; + end; +adjust_tail:=null +@y +@ @= +if pre_adjust_head <> pre_adjust_tail then + append_list(pre_adjust_head)(pre_adjust_tail); +pre_adjust_tail := null; +append_to_vlist(just_box); +if adjust_head <> adjust_tail then + append_list(adjust_head)(adjust_tail); +adjust_tail := null +@z + +% [39] \vadjust pre +@x +adjust_tail:=adjust_head; just_box:=hpack(q,cur_width,exactly); +@y +adjust_tail:=adjust_head; +pre_adjust_tail := pre_adjust_head; +just_box:=hpack(q,cur_width,exactly); +@z + @x \[if]pdfprimitive: main_loop any_mode(ignore_spaces): begin @; goto reswitch; @@ -1220,6 +1444,109 @@ any_mode(ignore_spaces): begin end; @z +% [47] \vadjust pre +@x + if abs(mode)=vmode then + begin append_to_vlist(cur_box); + if adjust_tail<>null then + begin if adjust_head<>adjust_tail then + begin link(tail):=link(adjust_head); tail:=adjust_tail; + end; + adjust_tail:=null; + end; + if mode>0 then build_page; + end +@y + if abs(mode)=vmode then + begin + if pre_adjust_tail <> null then begin + if pre_adjust_head <> pre_adjust_tail then + append_list(pre_adjust_head)(pre_adjust_tail); + pre_adjust_tail := null; + end; + append_to_vlist(cur_box); + if adjust_tail <> null then begin + if adjust_head <> adjust_tail then + append_list(adjust_head)(adjust_tail); + adjust_tail := null; + end; + if mode>0 then build_page; + end +@z + +% [47] \vadjust pre + pTeX +@x +adjusted_hbox_group: begin adjust_hlist(head,false); + adjust_tail:=adjust_head; package(0); +@y +adjusted_hbox_group: begin adjust_hlist(head,false); + adjust_tail:=adjust_head; + pre_adjust_tail:=pre_adjust_head; package(0); +@z + +% [47] \vadjust pre +@x +saved(0):=cur_val; incr(save_ptr); +@y +saved(0) := cur_val; +if (cur_cmd = vadjust) and scan_keyword("pre") then + saved(1) := 1 +else + saved(1) := 0; +save_ptr := save_ptr + 2; +@z + +% [47] \vadjust pre +@x + d:=split_max_depth; f:=floating_penalty; unsave; decr(save_ptr); +@y + d:=split_max_depth; f:=floating_penalty; unsave; save_ptr := save_ptr - 2; +@z + +% [47] \vadjust pre + pTeX +@x + r:=get_node(small_node_size); type(r):=adjust_node;@/ + subtype(r):=0; {the |subtype| is not used} + adjust_ptr(r):=list_ptr(p); delete_glue_ref(q); +@y + r:=get_node(small_node_size); type(r):=adjust_node;@/ + adjust_pre(r) := saved(1); {the |subtype| is used for |adjust_pre|} + adjust_ptr(r):=list_ptr(p); delete_glue_ref(q); +@z + +% [48] \vadjust pre +@x +@!t:pointer; {tail of adjustment list} +@y +@!t:pointer; {tail of adjustment list} +@!pre_t:pointer; {tail of pre-adjustment list} +@z + +% [48] \vadjust pre +@x +adjust_tail:=adjust_head; b:=hpack(p,natural); p:=list_ptr(b); +t:=adjust_tail; adjust_tail:=null;@/ +@y +adjust_tail:=adjust_head; pre_adjust_tail:=pre_adjust_head; +b:=hpack(p,natural); p:=list_ptr(b); +t:=adjust_tail; adjust_tail:=null;@/ +pre_t:=pre_adjust_tail; pre_adjust_tail:=null;@/ +@z + +% [48] \vadjust pre +@x +if t<>adjust_head then {migrating material comes after equation number} + begin link(tail):=link(adjust_head); tail:=t; + end; +@y +if t<>adjust_head then {migrating material comes after equation number} + begin link(tail):=link(adjust_head); tail:=t; + end; +if pre_t<>pre_adjust_head then + begin link(tail):=link(pre_adjust_head); tail:=pre_t; + end; +@z + @x \[if]pdfprimitive: dump prim table @= @y diff --git a/Build/source/texk/web2c/eptexdir/tests/lastnodesubtype_math.tex b/Build/source/texk/web2c/eptexdir/tests/lastnodesubtype_math.tex new file mode 100644 index 00000000000..fd1d0c2d4cd --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/tests/lastnodesubtype_math.tex @@ -0,0 +1,29 @@ +\def\typeout{\immediate\write17} +\newcount\CNT\newcount\CNTs +\def\TEST#1#2#3{\par$#1{xyz}#2\CNT=\lastnodetype\CNTs=\lastnodesubtype\typeout{\string #1: (\the\CNT,\the\CNTs)}#3$} + +\TEST\displaystyle\displaystyle{} +\TEST\textstyle\textstyle{} +\TEST\mathchoice{{a}{a}{a}}{} +\TEST\mathord{}{} +\TEST\mathop\displaylimits{} +\TEST\mathop\limits{} +\TEST\mathop\nolimits{} +\TEST\mathbin{}{} +\TEST\mathrel{}{} +\TEST\mathopen{}{} +\TEST\mathclose{}{} +\TEST\mathpunct{}{} +\TEST\mathinner{}{} +\TEST\sqrt{}{}% radical +\TEST\underline{}{} +\TEST\overline{}{} +\TEST\vcenter{}{} +\TEST\dot{}{}% accent + +\TEST{left}{\left[}{\right]} +\TEST{middle}{\left(\middle|}{\right)} +\TEST{\left[\right]}{}{} +% TODO: right, fraction + +\bye -- cgit v1.2.3