texlive[62032] Build/source/texk/web2c: ptex: revised state after
commits+hironobu at tug.org
commits+hironobu at tug.org
Tue Feb 15 14:56:06 CET 2022
Revision: 62032
http://tug.org/svn/texlive?view=revision&revision=62032
Author: hironobu
Date: 2022-02-15 14:56:05 +0100 (Tue, 15 Feb 2022)
Log Message:
-----------
ptex: revised state after csword with jchar (H. Kitagawa)
Modified Paths:
--------------
trunk/Build/source/texk/web2c/ptexdir/ChangeLog
trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
trunk/Build/source/texk/web2c/uptexdir/ChangeLog
trunk/Build/source/texk/web2c/uptexdir/uptex-m.ch
Added Paths:
-----------
trunk/Build/source/texk/web2c/ptexdir/tests/ptexlineendmode.tex
Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-02-15 01:54:19 UTC (rev 62031)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-02-15 13:56:05 UTC (rev 62032)
@@ -1,3 +1,27 @@
+2022-02-15 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * ptex-base.ch: Revised state after a control word which ends
+ with a Japanese character. Starting from pTeX version p4.0.0,
+ newline char after "a control word ending with a Japanese
+ character + {}" is ignored. To emulate older behavior, a new
+ primitive \ptexendlinemode is added.
+ The new primitive is an internal integer which means:
+ - When the least significant bit is set,
+ a blank is generated when the line ends with
+ "a control word ending with a Japanese character + {}".
+ - When the second significant bit is set,
+ a blank is generated when the line ends with
+ "a Japanese control symbol".
+ - When the third significant bit is set,
+ a blank is generated when the line ends with
+ "a Japanese character (which is not part of a CS) + {}".
+ By setting \ptexendlinemode to the following values,
+ old versions of pTeX can be restored:
+ - p4.0.0 or later : default 0.
+ - p3.8.2-3.10.0 : similar to 1.
+ - p3.8.1 or older : similar to 3.
+ More info: https://github.com/texjporg/tex-jp-build/issues/87
+
2022-02-13 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
* ptex-base.ch: \write18 in '^^' format. (Thanks Yukimasa Morimi)
Modified: trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2022-02-15 01:54:19 UTC (rev 62031)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2022-02-15 13:56:05 UTC (rev 62032)
@@ -1435,7 +1435,8 @@
@d text_baseline_shift_factor_code=57
@d script_baseline_shift_factor_code=58
@d scriptscript_baseline_shift_factor_code=59
- at d tex_int_pars=60 {total number of \TeX's integer parameters}
+ at d ptex_lineend_code=60
+ at d tex_int_pars=61 {total number of \TeX's integer parameters}
@z
@x [17.236] l.5167 - pTeX: cur_jfam, |jchr_widow_penalty|
@@ -1449,6 +1450,7 @@
@d text_baseline_shift_factor==int_par(text_baseline_shift_factor_code)
@d script_baseline_shift_factor==int_par(script_baseline_shift_factor_code)
@d scriptscript_baseline_shift_factor==int_par(scriptscript_baseline_shift_factor_code)
+ at d ptex_lineend==int_par(ptex_lineend_code)
@z
@x [17.237] l.5244 - pTeX: cur_jfam_code, jchr_window_penalty_code
@@ -1460,6 +1462,7 @@
text_baseline_shift_factor_code:print_esc("textbaselineshiftfactor");
script_baseline_shift_factor_code:print_esc("scriptbaselineshiftfactor");
scriptscript_baseline_shift_factor_code:print_esc("scriptscriptbaselineshiftfactor");
+ptex_lineend_code:print_esc("ptexlineendmode");
@z
@x [17.238] l.5365 - pTeX: cur_jfam_code, jchr_window_penalty_code
@@ -1478,6 +1481,8 @@
@!@:script_baseline_shift_factor}{\.{\\scriptbaselineshiftfactor} primitive@>
primitive("scriptscriptbaselineshiftfactor",assign_int,int_base+scriptscript_baseline_shift_factor_code);@/
@!@:scriptscript_baseline_shift_factor}{\.{\\scriptscriptbaselineshiftfactor} primitive@>
+primitive("ptexlineendmode",assign_int,int_base+ptex_lineend_code);@/
+@!@:ptex_lineend_mode_}{\.{\\ptexlineendmode} primitive@>
@z
@x [17.247] l.5490 - pTeX: kinsoku, t_baseline_shift, y_baseline_shift
@@ -1691,9 +1696,24 @@
1) |state=mid_line| is the normal state.\cr
2) |state=mid_kanji| is like |mid_line|, and internal KANJI string.\cr
3) |state=skip_blanks| is like |mid_line|, but blanks are ignored.\cr
-4) |state=new_line| is the state at the beginning of a line.\cr}}$$
+4) |state=skip_blanks_kanji| is like |mid_kanji|, but blanks are ignored.\cr
+5) |state=new_line| is the state at the beginning of a line.\cr}}$$
@z
+ at x
+ignored; after this case is processed, the next value of |state| will
+be |skip_blanks|.
+ at y
+ignored; after this case is processed, the next value of |state| will
+be |skip_blanks|.
+
+If \.{\\ptexlineendmode} is odd, the |state| become |skip_blanks_kanji|
+after a control word which ends with a Japanese character. This is
+similar to |skip_blanks|, but the |state| will be |mid_kanji| after
+|skip_blanks_kanji+left_brace| and |skip_blanks_kanji+right_brace|,
+instead of |mid_line|.
+ at z
+
@x [22.303] l.6736 - pTeX: state mid_kanji
@d mid_line=1 {|state| code when scanning a line of characters}
@d skip_blanks=2+max_char_code {|state| code when ignoring blanks}
@@ -1702,7 +1722,9 @@
@d mid_line=1 {|state| code when scanning a line of characters}
@d mid_kanji=2+max_char_code {|state| code when scanning a line of characters}
@d skip_blanks=3+max_char_code+max_char_code {|state| code when ignoring blanks}
- at d new_line=4+max_char_code+max_char_code+max_char_code
+ at d skip_blanks_kanji=4+max_char_code+max_char_code+max_char_code
+ {|state| code when ignoring blanks}
+ at d new_line=5+max_char_code+max_char_code+max_char_code+max_char_code
{|state| code at start of line}
@z
@@ -1846,9 +1868,18 @@
@x [24.344] l.7535 - pTeX: ASCII-KANJI space handling
@d any_state_plus(#) == mid_line+#,skip_blanks+#,new_line+#
@y
- at d any_state_plus(#) == mid_line+#,mid_kanji+#,skip_blanks+#,new_line+#
+ at d any_state_plus(#) ==
+ mid_line+#,mid_kanji+#,skip_blanks+#,skip_blanks_kanji+#,new_line+#
@z
+ at x
+@ @<Cases where character is ignored@>=
+any_state_plus(ignore),skip_blanks+spacer,new_line+spacer
+ at y
+@ @<Cases where character is ignored@>=
+any_state_plus(ignore),skip_blanks+spacer,skip_blanks_kanji+spacer,new_line+spacer
+ at z
+
@x [24.347] l.7569 - pTeX: scaner
@ @d add_delims_to(#)==#+math_shift,#+tab_mark,#+mac_param,
#+sub_mark,#+letter,#+other_char
@@ -1878,20 +1909,34 @@
mid_line+car_ret:@<Finish line, emit a space@>;
mid_kanji+car_ret: if skip_mode then @<Finish line, |goto switch|@>
else @<Finish line, emit a space@>;
-skip_blanks+car_ret,any_state_plus(comment):
+skip_blanks+car_ret,skip_blanks_kanji+car_ret,any_state_plus(comment):
@<Finish line, |goto switch|@>;
new_line+car_ret:@<Finish line, emit a \.{\\par}@>;
-mid_line+left_brace,mid_kanji+left_brace: incr(align_state);
+mid_line+left_brace: incr(align_state);
+mid_kanji+left_brace: begin incr(align_state);
+ if ((ptex_lineend div 4) mod 2)=1 then state:=mid_line;
+ end;
skip_blanks+left_brace,new_line+left_brace: begin
state:=mid_line; incr(align_state);
end;
-mid_line+right_brace,mid_kanji+right_brace: decr(align_state);
+skip_blanks_kanji+left_brace: begin
+ state:=mid_kanji; incr(align_state);
+ end;
+mid_line+right_brace: decr(align_state);
+mid_kanji+right_brace: begin decr(align_state);
+ if ((ptex_lineend div 4) mod 2)=1 then state:=mid_line;
+ end;
skip_blanks+right_brace,new_line+right_brace: begin
state:=mid_line; decr(align_state);
end;
-add_delims_to(skip_blanks),add_delims_to(new_line),add_delims_to(mid_kanji):
+skip_blanks_kanji+right_brace: begin
+ state:=mid_kanji; decr(align_state);
+ end;
+add_delims_to(skip_blanks),add_delims_to(skip_blanks_kanji),
+add_delims_to(new_line),add_delims_to(mid_kanji):
state:=mid_line;
-all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line):
+all_jcode(skip_blanks),all_jcode(skip_blanks_kanji),all_jcode(new_line),
+all_jcode(mid_line):
state:=mid_kanji;
@ @<Global...@>=
@@ -1933,9 +1978,14 @@
end
else cat:=cat_code(cur_chr);
start_cs:
- if (cat=letter)or(cat=kanji)or(cat=kana) then state:=skip_blanks
+ if cat=letter then state:=skip_blanks
+ else if (cat=kanji)or(cat=kana) then
+ begin if (ptex_lineend mod 2)=0 then state:=skip_blanks_kanji
+ else state:=skip_blanks end
else if cat=spacer then state:=skip_blanks
- else if cat=other_kchar then state:=mid_kanji
+ else if cat=other_kchar then
+ begin if ((ptex_lineend div 2) mod 2)=0 then state:=mid_kanji
+ else state:=mid_line end
else state:=mid_line;
if cat=other_kchar then
begin cur_cs:=id_lookup(loc,k-loc); loc:=k; goto found;
@@ -2022,6 +2072,9 @@
for l:=k-1 to k-2+multistrlen(ustringcast(buffer), limit+1, k-1) do
buffer2[l]:=1;
incr(k);
+ if (cat=kanji)or(cat=kana) then
+ begin if (ptex_lineend mod 2)=0 then state:=skip_blanks_kanji
+ else state:=skip_blanks end;
end
else cat:=cat_code(cur_chr);
while (buffer[k]=cur_chr)and(cat=sup_mark)and(k<limit) do
@@ -2046,6 +2099,7 @@
end;
end;
end;
+ if cat=letter then state:=skip_blanks;
until not((cat=letter)or(cat=kanji)or(cat=kana))or(k>limit);
{@@<If an expanded...@@>;}
if not((cat=letter)or(cat=kanji)or(cat=kana)) then decr(k);
Added: trunk/Build/source/texk/web2c/ptexdir/tests/ptexlineendmode.tex
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/tests/ptexlineendmode.tex (rev 0)
+++ trunk/Build/source/texk/web2c/ptexdir/tests/ptexlineendmode.tex 2022-02-15 13:56:05 UTC (rev 62032)
@@ -0,0 +1,60 @@
+\font\fn=ec-lmr10\fn\catcode`\^^9f=11
+\def\◆{◇}\def\漢{◇}\def\^^9f{S}
+
+\ptexlineendmode=0 % p4.0.0標準
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a\quad p4.0.0以降
+
+\ptexlineendmode=1 % p3.8.2標準
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a\quad p3.8.2以降
+
+\ptexlineendmode=2
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a
+
+\ptexlineendmode=3
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a\quad p3.8.1以前
+
+\ptexlineendmode=4
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a
+
+\ptexlineendmode=5
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a
+
+\ptexlineendmode=6
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a
+
+\ptexlineendmode=7
+{{{\the\ptexlineendmode ◆}
+◆\◆
+あ\◆}
+い◆\漢}
+◆\漢 漢字\^^9f a
+
+\bye
Property changes on: trunk/Build/source/texk/web2c/ptexdir/tests/ptexlineendmode.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Build/source/texk/web2c/uptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2022-02-15 01:54:19 UTC (rev 62031)
+++ trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2022-02-15 13:56:05 UTC (rev 62032)
@@ -1,3 +1,8 @@
+2022-02-15 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * uptex-m.ch: Adapt to ptex-base.ch.
+ More info: https://github.com/texjporg/tex-jp-build/issues/87
+
2022-02-13 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
* upbibtex.ch: Adapt to pbibtex.ch (version number).
Modified: trunk/Build/source/texk/web2c/uptexdir/uptex-m.ch
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/uptex-m.ch 2022-02-15 01:54:19 UTC (rev 62031)
+++ trunk/Build/source/texk/web2c/uptexdir/uptex-m.ch 2022-02-15 13:56:05 UTC (rev 62032)
@@ -421,12 +421,15 @@
@z
@x
-all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line):
+all_jcode(skip_blanks),all_jcode(skip_blanks_kanji),all_jcode(new_line),
+all_jcode(mid_line):
state:=mid_kanji;
@y
-all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line):
+all_jcode(skip_blanks),all_jcode(skip_blanks_kanji),all_jcode(new_line),
+all_jcode(mid_line):
state:=mid_kanji;
-hangul_code(skip_blanks),hangul_code(new_line),hangul_code(mid_kanji):
+hangul_code(skip_blanks),hangul_code(skip_blanks_kanji),hangul_code(new_line),
+hangul_code(mid_kanji):
state:=mid_line;
@z
@@ -440,7 +443,7 @@
end
else cat:=cat_code(cur_chr);
start_cs:
- if (cat=letter)or(cat=kanji)or(cat=kana) then state:=skip_blanks
+ if cat=letter then state:=skip_blanks
@y
else begin k:=loc;
cur_chr:=fromBUFF(ustringcast(buffer), limit+1, k);
@@ -456,7 +459,7 @@
incr(k);
end;
start_cs:
- if (cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul) then state:=skip_blanks
+ if (cat=letter)or(cat=hangul) then state:=skip_blanks
@z
@x
@@ -478,6 +481,9 @@
for l:=k-1 to k-2+multistrlen(ustringcast(buffer), limit+1, k-1) do
buffer2[l]:=1;
incr(k);
+ if (cat=kanji)or(cat=kana) then
+ begin if (ptex_lineend mod 2)=0 then state:=skip_blanks_kanji
+ else state:=skip_blanks end;
end
else cat:=cat_code(cur_chr);
@y
@@ -488,7 +494,12 @@
if (cat=not_cjk) then cat:=other_kchar;
for l:=k to k-1+multistrlen(ustringcast(buffer), limit+1, k) do
buffer2[l]:=1;
- k:=k+multistrlen(ustringcast(buffer), limit+1, k) end
+ k:=k+multistrlen(ustringcast(buffer), limit+1, k);
+ if (cat=kanji)or(cat=kana) then
+ begin if (ptex_lineend mod 2)=0 then state:=skip_blanks_kanji
+ else state:=skip_blanks end
+ else if cat=hangul then state:=skip_blanks;
+ end
else begin {not multi-byte char}
cur_chr:=buffer[k];
cat:=cat_code(cur_chr);
More information about the tex-live-commits
mailing list.