summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2021-07-01 09:30:47 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2021-07-01 09:30:47 +0000
commitc4f2890e544be37f5d4e414b07693e12fbc66cd3 (patch)
treefec31e6704d33540fe1ea918f6f756392ebf1168
parent20f2c6d062a96bf124ee7a42fd2f677ec84378d6 (diff)
e-pTeX 210701 (\lastnodesubtype for math noads, \vadjust pre)
git-svn-id: svn://tug.org/texlive/trunk@59787 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/eptexdir/ChangeLog8
-rw-r--r--Build/source/texk/web2c/eptexdir/eptex.ech20
-rw-r--r--Build/source/texk/web2c/eptexdir/eptex_version.h2
-rw-r--r--Build/source/texk/web2c/eptexdir/pdfutils.ch327
-rw-r--r--Build/source/texk/web2c/eptexdir/tests/lastnodesubtype_math.tex29
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch5
7 files changed, 389 insertions, 6 deletions
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 <h_kitagawa2001@yahoo.co.jp>
+
+ * 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 <h_kitagawa2001@yahoo.co.jp>
* 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 <euc|sjis|jis|utf8>
+%%
+%% \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_val<unset_node+4 then cur_val:=cur_val-unset_node-1
+ { |style_noad|, |choice_noad|, |ord_noad| }
+ else if cur_val=unset_node+4 then cur_val:=cur_val-unset_node-1+subtype(tx)
+ else cur_val:=cur_val-unset_node+1;
+ end;
last_node_char_code: ignore_font_kerning;
@z
diff --git a/Build/source/texk/web2c/eptexdir/eptex_version.h b/Build/source/texk/web2c/eptexdir/eptex_version.h
index 51cc8d04803..76fb09486f3 100644
--- a/Build/source/texk/web2c/eptexdir/eptex_version.h
+++ b/Build/source/texk/web2c/eptexdir/eptex_version.h
@@ -1 +1 @@
-#define EPTEX_VERSION "210629"
+#define EPTEX_VERSION "210701"
diff --git a/Build/source/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch
index cfb228eb48a..71493201cb9 100644
--- a/Build/source/texk/web2c/eptexdir/pdfutils.ch
+++ b/Build/source/texk/web2c/eptexdir/pdfutils.ch
@@ -29,6 +29,8 @@
%% \ifincsname
%%
%% \Uchar, \Ucharcat
+%%
+%% \vadjust pre (2021-07-01)
@x
@* \[8] Packed data.
@@ -396,6 +398,32 @@ end;
@* \[8] Packed data.
@z
+% [10] \vadjust pre
+@x
+@d adjust_ptr(#)==mem[#+1].int
+ {vertical list to be moved out of horizontal list}
+@y
+@d adjust_pre == subtype {<>0 => 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
+@ @<Display adjustment |p|@>=
+begin print_esc("vadjust"); node_list_display(adjust_ptr(p)); {recursive call}
+end
+@y
+@ @<Display adjustment |p|@>=
+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
@<Calculate DVI page dimensions and margins@>;
@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@>
+
+@<Glob...@>=
+@!pre_adjust_tail: pointer;
+
+@ @<Set init...@>=
+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
+@<Transfer node |p| to the adjustment list@>=
+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
+@<Transfer node |p| to the adjustment list@>=
+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 the new box to the current vertical list...@>=
+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
+@ @<Append the new box to the current vertical list...@>=
+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 @<Get the next non-blank non-call...@>;
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
@<Dump the hash 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
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index 54a43e3cabc..cc9ee72ca37 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,7 @@
+2021-07-01 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * ptex-base.ch: Set subtype=0 for adjust_node.
+
2021-06-29 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
and Hironobu Yamashita <h.y.acetaminophen@gmail.com>
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index be88cd51309..6613cb295dc 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -3501,8 +3501,8 @@ if p<>null then
hlist_node,vlist_node,dir_node,rule_node,unset_node:
@<Incorporate box dimensions into the dimensions of
the hbox that will contain~it@>;
- ins_node,mark_node,adjust_node:
- if adjust_tail<>null then @<Transfer node |p| to the adjustment list@>;
+ ins_node,mark_node,adjust_node: if adjust_tail<>null then
+ @<Transfer node |p| to the adjustment list@>;
whatsit_node:@<Incorporate a whatsit node into an hbox@>;
disp_node:disp:=disp_dimen(p);
@z
@@ -5381,6 +5381,7 @@ insert_group: begin end_graf; q:=split_top_skip; add_glue_ref(q);
end
else begin
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);
if not is_char_node(tail)and(type(tail)=disp_node) then
prev_append(r)