texlive[59700] Build/source/texk/web2c: ptex: fix searching in
commits+hironobu at tug.org
commits+hironobu at tug.org
Fri Jun 25 11:24:54 CEST 2021
Revision: 59700
http://tug.org/svn/texlive?view=revision&revision=59700
Author: hironobu
Date: 2021-06-25 11:24:54 +0200 (Fri, 25 Jun 2021)
Log Message:
-----------
ptex: fix searching in inhibit/kinsoku tables
Modified Paths:
--------------
trunk/Build/source/texk/web2c/ptexdir/ChangeLog
trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex
trunk/Build/source/texk/web2c/uptexdir/ChangeLog
Added Paths:
-----------
trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_search.tex
Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2021-06-25 09:14:15 UTC (rev 59699)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2021-06-25 09:24:54 UTC (rev 59700)
@@ -7,8 +7,14 @@
and it is a disp_node.
https://github.com/texjporg/tex-jp-build/issues/123
* ptex-base.ch: Partially revert the commit on 2019-05-06;
- no re-eval kcatcode of Japanese character token in \if and \ifcat.
- This is because the behavior was inconsistent against \ifx.
+ no re-eval kcatcode of \let-copied Japanese character token in
+ \if and \ifcat, because the behavior was inconsistent against \ifx.
+ https://github.com/texjporg/ptex-manual/issues/4
+ * ptex-base.ch: Fix searching in inhibit/kinsoku tables, because
+ the fix on 2018-04-14 was still incomplete.
+ https://github.com/texjporg/tex-jp-build/issues/113
+ * tests/kinsoku_search.tex: New test file.
+ * tests/kinsoku_table.tex: Update.
2021-03-23 Karl Berry <karl at tug.org>
Modified: trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2021-06-25 09:14:15 UTC (rev 59699)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2021-06-25 09:24:54 UTC (rev 59700)
@@ -1249,10 +1249,27 @@
begin print_esc("xspcode"); print_int(n-auto_xsp_code_base);
end
else if n<kinsoku_base then
- begin print("(inhibitxspcode table) "); print_int(n-inhibit_xsp_code_base);
+ begin print("inhibitxspcode table "); print_int(n-inhibit_xsp_code_base);
+ print(", type=");
+ case eq_type(n) of
+ 0: print("both"); { |inhibit_both| }
+ 1: print("before"); { |inhibit_previous| }
+ 2: print("after"); { |inhibit_after| }
+ 3: print("none"); { |inhibit_none| }
+ 4: print("unused"); { |inhibit_unused| }
+ end; {there are no other cases}
+ print(", code");
end
else if n<kansuji_base then
- begin print("(kinsoku table) "); print_int(n-kinsoku_base);
+ begin print("kinsoku table "); print_int(n-kinsoku_base);
+ print(", type=");
+ case eq_type(n) of
+ 0: print("no");
+ 1: print("pre"); { |pre_break_penalty_code| }
+ 2: print("post"); { |post_break_penalty_code| }
+ 3: print("unused"); { |kinsoku_unused_code| }
+ end; {there are no other cases}
+ print(", code");
end
else if n<lc_code_base then
begin print_esc("kansujichar"); print_int(n-kansuji_base);
@@ -1412,7 +1429,10 @@
tats
@y
else if n<kinsoku_penalty_base then @<Show equivalent |n|, in region 6@>
-else if n<=eqtb_size then print("kinsoku")
+else if n<=eqtb_size then begin
+ print("kinsoku table "); print_int(n-kinsoku_penalty_base);
+ print(", penalty="); print_int(eqtb[n].int);
+ end
else print_char("?"); {this can't happen either}
end;
tats
@@ -6582,19 +6602,23 @@
@ @<Declare procedures needed in |scan_something_internal|@>=
function get_inhibit_pos(c:KANJI_code; n:small_number):pointer;
label done, done1;
-var p,s:pointer;
-begin s:=calc_pos(c); p:=s;
+var p,pp,s:pointer;
+begin s:=calc_pos(c); p:=s; pp:=no_entry;
if n=new_pos then
begin repeat
- if (inhibit_xsp_type(p)=inhibit_unused)or(inhibit_xsp_code(p)=0)
- or(inhibit_xsp_code(p)=c) then goto done;
+ if inhibit_xsp_code(p)=c then goto done; { found, update there }
+ if inhibit_xsp_code(p)=0 then { no further scan needed }
+ begin if pp<>no_entry then p:=pp; goto done; end;
+ if inhibit_xsp_type(p)=inhibit_unused then
+ if pp=no_entry then pp:=p; { save the nearest unused hash }
incr(p); if p>255 then p:=0;
- until s=p; p:=no_entry;
+ until s=p;
+ p:=pp;
end
else
begin repeat
- if inhibit_xsp_code(p)=0 then goto done1
- else if (inhibit_xsp_type(p)<>inhibit_unused)and(inhibit_xsp_code(p)=c) then goto done;
+ if inhibit_xsp_code(p)=0 then goto done1;
+ if inhibit_xsp_code(p)=c then goto done;
incr(p); if p>255 then p:=0;
until s=p;
done1: p:=no_entry;
@@ -6629,6 +6653,7 @@
begin scan_int; q:=get_inhibit_pos(tokanji(cur_val),cur_pos);
cur_val_level:=int_val; cur_val:=inhibit_none;
if q<>no_entry then cur_val:=inhibit_xsp_type(q);
+if cur_val>inhibit_none then cur_val:=inhibit_none;
end
@ The \.{\\prebreakpenalty} is used to specified amount of penalties inserted
@@ -6654,8 +6679,8 @@
@ @<Declare procedures needed in |scan_something_internal|@>=
function get_kinsoku_pos(c:KANJI_code; n:small_number):pointer;
label done, done1;
-var p,s:pointer;
-begin s:=calc_pos(c); p:=s;
+var p,pp,s:pointer;
+begin s:=calc_pos(c); p:=s; pp:=no_entry;
@!debug
print_ln; print("c:="); print_int(c); print(", p:="); print_int(s);
if p+kinsoku_base<0 then
@@ -6664,16 +6689,19 @@
gubed
if n=new_pos then
begin repeat
- if (kinsoku_type(p)=0)or(kinsoku_type(p)=kinsoku_unused_code)
- or(kinsoku_code(p)=c) then goto done;
+ if kinsoku_code(p)=c then goto done; { found, update there }
+ if kinsoku_type(p)=0 then { no further scan needed }
+ begin if pp<>no_entry then p:=pp; goto done; end;
+ if kinsoku_type(p)=kinsoku_unused_code then
+ if pp=no_entry then pp:=p; { save the nearest unused hash }
incr(p); if p>255 then p:=0;
until s=p;
- p:=no_entry;
+ p:=pp;
end
else
begin repeat
- if kinsoku_type(p)=0 then goto done1
- else if (kinsoku_type(p)<>kinsoku_unused_code)and(kinsoku_code(p)=c) then goto done;
+ if kinsoku_type(p)=0 then goto done1;
+ if kinsoku_code(p)=c then goto done;
incr(p); if p>255 then p:=0;
until s=p;
done1: p:=no_entry;
Added: trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_search.tex
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_search.tex (rev 0)
+++ trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_search.tex 2021-06-25 09:24:54 UTC (rev 59700)
@@ -0,0 +1,43 @@
+%#!euptex -ini -etex
+\tracingonline1
+\tracingassigns1
+
+% 最優先hashはコードポイントから一意に決まる値(jtex.pdfも参照)
+\prebreakpenalty`、=10000 % code=12289, 最優先hash=1
+\prebreakpenalty`。=10000 % code=12290, 最優先hash=2
+\prebreakpenalty`ぁ=150 % code=12353, 最優先hash=1だが埋まってしまったので3に分配
+\prebreakpenalty`ぃ=150 % code=12355, 最優先hash=3だが埋まってしまったので4に分配
+
+\showthe\currentgrouplevel % > 0.
+\showthe\prebreakpenalty`ぃ % > 150.
+
+\prebreakpenalty`ぃ=0 % changing hash=4
+\showthe\prebreakpenalty`ぃ % > 0. ← OK(hash=4読出)
+
+\prebreakpenalty`ぃ=123 % changing hash=4
+\showthe\prebreakpenalty`ぃ % > 123. ← OK(hash=4読出)
+
+\prebreakpenalty`ぁ=0 % changing hash=3
+\showthe\prebreakpenalty`ぃ % > 123. ← OK(hash=4読出)
+
+% この時点で "ぁ" が消えてhash=3が空いている。
+% 一方,"ぃ"はフォールバックしたhash=4に格納されている。
+
+\prebreakpenalty`ぃ=0 % changing hash=4
+\showthe\prebreakpenalty`ぃ % > 0. ← 修正(削除済み)
+
+\prebreakpenalty`ぃ=234 % changing hash=3
+\showthe\prebreakpenalty`ぃ % > 234. ← OK(hash=3読出)
+
+\prebreakpenalty`ぃ=0 % changing hash=3
+\showthe\prebreakpenalty`ぃ % > 0. ← 修正(削除済み)
+
+\prebreakpenalty`ぁ=345 % changing hash=3
+\showthe\prebreakpenalty`ぃ % > 0. ← 修正(削除済み)
+
+% この時点で "ぁ" が再びhash=3を埋めている。
+
+\prebreakpenalty`ぃ=0 % reassigning hash=4
+\showthe\prebreakpenalty`ぃ % > 0. ← OK(削除済み)
+
+\end
Property changes on: trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_search.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex 2021-06-25 09:14:15 UTC (rev 59699)
+++ trunk/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex 2021-06-25 09:24:54 UTC (rev 59700)
@@ -1,10 +1,13 @@
-%#!uptex
+%#!uptex -ini
+\let\dump\relax
+\input plain
\newcount\fuga\newcount\dflt
+\fuga="3300
\iffalse
\global\let\prebreakpenalty=\inhibitxspcode
- \fuga="30D3 \dflt=3
+ \dflt=3
\else
- \fuga="3090 \dflt=0
+ \dflt=0
\fi
\scrollmode
@@ -11,27 +14,27 @@
\newcount\hoge\hoge="3000
\loop\ifnum\hoge<\fuga
\message{\the\hoge}\prebreakpenalty\hoge=2
- \advance\hoge 1\relax \repeat
+ \advance\hoge 3\relax \repeat
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% 2, D
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000>}% 2, D
{
- \prebreakpenalty"3001=\dflt\relax
+ \prebreakpenalty"3003=\dflt\relax
\global\prebreakpenalty"4000=1\relax% error
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, D
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000>}% D, D
}
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% 2, D
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000>}% 2, D
{
- \global\prebreakpenalty"3001=\dflt\relax
+ \global\prebreakpenalty"3003=\dflt\relax
\prebreakpenalty"4000=1\relax% no error
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, 1
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000>}% D, 1
}
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, D
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000>}% D, D
\prebreakpenalty"4000=1\relax% no error
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000,
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000,
\the\prebreakpenalty"3549>}% D, 1, D
\prebreakpenalty"4000=\dflt\relax
@@ -38,7 +41,7 @@
\prebreakpenalty"3549=1\relax% no error
-\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000,
+\message{<\the\prebreakpenalty"3003, \the\prebreakpenalty"4000,
\the\prebreakpenalty"3549>}% D, D, 1
Modified: trunk/Build/source/texk/web2c/uptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2021-06-25 09:14:15 UTC (rev 59699)
+++ trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2021-06-25 09:24:54 UTC (rev 59700)
@@ -71,7 +71,7 @@
2019-05-06 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
* uptex-m.ch:
- Make appropreate comparison of U+0100 by \if.
+ Make appropriate comparison of U+0100 by \if.
https://github.com/texjporg/tex-jp-build/issues/68
* tests/test_if.tex: Test case.
More information about the tex-live-commits
mailing list.