From de01a65eb905c4bd5f128b5a5ab21ca8303ac0ae Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Mon, 18 Sep 2017 13:21:43 +0000 Subject: ptex-base.ch: frees table entry, if the default value is assigned globally (H. Kitagawa) git-svn-id: svn://tug.org/texlive/trunk@45331 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ptexdir/ChangeLog | 6 +++ Build/source/texk/web2c/ptexdir/ptex-base.ch | 33 +++++++++------- .../texk/web2c/ptexdir/tests/kinsoku_table.tex | 46 ++++++++++++++++++++++ 3 files changed, 71 insertions(+), 14 deletions(-) create mode 100644 Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex (limited to 'Build/source/texk') diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index 5c665d79988..540b61801a2 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,9 @@ +2017-09-11 Hironori Kitagawa + + * ptex-base.ch: Assigning the default value frees the KINSOKU table + and inhibit table, only if global or \currentgrouplevel=0. + * tests/kinsoku_table.tex: Added. + 2017-09-09 Hironori Kitagawa * ptex-base.ch: Remove JFM glue after kinsoku penalty at the top diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch index 3a2afb8b0fa..57ef1bc3d6a 100644 --- a/Build/source/texk/web2c/ptexdir/ptex-base.ch +++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch @@ -6292,11 +6292,13 @@ assign_inhibit_xsp_code: begin p:=cur_chr; scan_int; n:=cur_val; scan_optional_equals; scan_int; if is_char_kanji(n) then begin j:=get_inhibit_pos(tokanji(n),new_pos); - if j=no_entry then + if (j<>no_entry)and(cur_val>inhibit_after)and(global or cur_level=level_one) then + begin n:=0; cur_val:=0 end + { remove the entry from inhibit table } + else if j=no_entry then begin print_err("Inhibit table is full!!"); help1("I'm skipping this control sequences.");@/ - error; return; - end; + error; return; end; define(inhibit_xsp_code_base+j,cur_val,n); end else @@ -6366,17 +6368,20 @@ assign_kinsoku: begin p:=cur_chr; scan_int; n:=cur_val; scan_optional_equals; scan_int; if is_char_ascii(n) or is_char_kanji(n) then begin j:=get_kinsoku_pos(tokanji(n),new_pos); - if j=no_entry then - begin print_err("KINSOKU table is full!!"); - help1("I'm skipping this control sequences.");@/ - error; return; - end; - if (p=pre_break_penalty_code)or(p=post_break_penalty_code) then - begin define(kinsoku_base+j,p,tokanji(n)); - word_define(kinsoku_penalty_base+j,cur_val); - end - else confusion("kinsoku"); + if (j<>no_entry)and(cur_val=0)and(global or cur_level=level_one) then + define(kinsoku_base+j,0,0) { remove the entry from KINSOKU table } + else begin + if j=no_entry then begin + print_err("KINSOKU table is full!!"); + help1("I'm skipping this control sequences.");@/ + error; return; end; + if (p=pre_break_penalty_code)or(p=post_break_penalty_code) then + begin define(kinsoku_base+j,p,tokanji(n)); + word_define(kinsoku_penalty_base+j,cur_val); + end + else confusion("kinsoku"); @:this can't happen kinsoku}{\quad kinsoku@> + end end else begin print_err("Invalid KANJI code for "); @@ -6725,7 +6730,7 @@ else @ @= if type(last_char)=math_node then - begin ax:=qo("0"); + begin ax:=qo("0"); if auto_xsp_code(ax)>=2 then insert_skip:=after_schar else insert_skip:=no_skip; end diff --git a/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex b/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex new file mode 100644 index 00000000000..bece61cd0c6 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/tests/kinsoku_table.tex @@ -0,0 +1,46 @@ +%#!uptex +\newcount\fuga\newcount\dflt +\iffalse + \global\let\prebreakpenalty=\inhibitxspcode + \fuga="30D3 \dflt=3 +\else + \fuga="3090 \dflt=0 +\fi + +\scrollmode +\newcount\hoge\hoge="3000 +\loop\ifnum\hoge<\fuga + \message{\the\hoge}\prebreakpenalty\hoge=2 + \advance\hoge 1\relax \repeat + +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% 2, D +{ + \prebreakpenalty"3001=\dflt\relax + \global\prebreakpenalty"4000=1\relax% error +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, D +} + +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% 2, D + +{ + \global\prebreakpenalty"3001=\dflt\relax + \prebreakpenalty"4000=1\relax% no error +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, 1 +} +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000>}% D, D + +\prebreakpenalty"4000=1\relax% no error + +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000, + \the\prebreakpenalty"3549>}% D, 1, D + +\prebreakpenalty"4000=\dflt\relax + +\prebreakpenalty"3549=1\relax% no error + +\message{<\the\prebreakpenalty"3001, \the\prebreakpenalty"4000, + \the\prebreakpenalty"3549>}% D, D, 1 + + +\end + -- cgit v1.2.3