texlive[62095] Build/source/texk/web2c: pbibtex: fix for substring,
commits+hironobu at tug.org
commits+hironobu at tug.org
Sun Feb 20 12:11:09 CET 2022
Revision: 62095
http://tug.org/svn/texlive?view=revision&revision=62095
Author: hironobu
Date: 2022-02-20 12:11:09 +0100 (Sun, 20 Feb 2022)
Log Message:
-----------
pbibtex: fix for substring, [u]pbibtex: truncate at least one
Modified Paths:
--------------
trunk/Build/source/texk/web2c/ptexdir/ChangeLog
trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch
trunk/Build/source/texk/web2c/uptexdir/ChangeLog
trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch
Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-02-20 01:17:14 UTC (rev 62094)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-02-20 11:11:09 UTC (rev 62095)
@@ -1,3 +1,11 @@
+2022-02-20 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
+
+ * pbibtex.ch: Improve substring$ to truncate at least one
+ character when trying to start counting from the middle
+ byte of the first or last Japanese character.
+ Still version j0.34.
+ https://github.com/texjporg/tex-jp-build/issues/133
+
2022-02-15 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
* ptex-base.ch: Revised state after a control word which ends
Modified: trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch 2022-02-20 01:17:14 UTC (rev 62094)
+++ trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch 2022-02-20 11:11:09 UTC (rev 62095)
@@ -25,8 +25,11 @@
% 2010 Version 0.99d of BibTeX for TeX Live
%
% 2022-02-08 Version 0.34 by H. Yamashita
-% Do not break at white space after Japanese, to preserve spacing
-% within BIB entry spacing to BBL for subsequent pTeX line-end operations
+% * Avoid breaking BBL lines at white space after a Japanese character, to
+% preserve spacing within BIB entry for subsequent pTeX line-end operations.
+% 2022-02-20 Still version 0.34 by H. Yamashita (-> TL'22 version)
+% * Improve substring$ to truncate at least one character when trying to
+% start counting from the middle byte of the first or last Japanese character.
@x [0] only print chnages
\def\title{\BibTeX\ }
@@ -240,7 +243,7 @@
parse_arguments;
@z
-% pBibTeX: do not break at |white_space| after Japanese characters
+% pBibTeX: do not break at |white_space| after Japanese characters (2022-02-08 j0.34)
@x "Break that line"
while ((lex_class[out_buf[out_buf_ptr]] <> white_space) and
(out_buf_ptr >= min_print_line)) do
@@ -469,10 +472,20 @@
procedure x_substring;
label exit;
var tps,tpe:pool_pointer; {temporary pointer}
+@!pop_lit2_saved: integer;
begin
@z
- at x Changes for JBibTeX by Shouichi Matsui [438]
+ at x
+@<Form the appropriate substring@>=
+begin
+ at y
+@<Form the appropriate substring@>=
+begin
+pop_lit2_saved := pop_lit2; {save before negate}
+ at z
+
+ at x Changes for JBibTeX by Shouichi Matsui [438] + fix (2022-02-20 j0.34)
str_room(sp_end - sp_ptr);
while (sp_ptr < sp_end) do {shift the substring}
begin
@@ -482,27 +495,29 @@
@y
{ 2 bytes Kanji code break check }
tps:=str_start[pop_lit3];
-while (tps < sp_ptr) do begin
- if str_pool[tps] > 127
- then tps := tps + 2
- else incr(tps);
-end;
tpe:=tps;
-while (tpe < sp_end) do begin
- if str_pool[tpe] > 127
- then tpe := tpe+2
- else incr(tpe);
+while tpe < str_start[pop_lit3+1] do begin
+ if str_pool[tpe] > 127 then begin
+ if str_start[pop_lit3+1] < tpe+2 then
+ break;
+ tpe := tpe + 2;
+ end
+ else begin
+ if str_start[pop_lit3+1] < tpe+1 then
+ break;
+ tpe := tpe + 1;
+ end;
+ if tpe<=sp_ptr then
+ tps := tpe;
+ if sp_end<=tpe then break;
end;
-if tps<>sp_ptr then begin
- if tps>str_start[pop_lit3]
- then decr(sp_ptr)
- else incr(sp_ptr);
-end;
-if tpe<>sp_end then begin
- if tpe<str_start[pop_lit3+1]
- then incr(sp_end)
- else decr(sp_end);
-end;
+if (pop_lit2_saved > 1) and (tps = str_start[pop_lit3])
+ then tps := tps + 2; {truncate at least one}
+if (pop_lit2_saved < -1) and (tpe = str_start[pop_lit3+1])
+ then tpe := tpe - 2; {truncate at least one}
+if tps > tpe then tpe := tps;
+sp_ptr := tps;
+sp_end := tpe;
str_room(sp_end - sp_ptr);
while (sp_ptr < sp_end) do {shift the substring}
Modified: trunk/Build/source/texk/web2c/uptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2022-02-20 01:17:14 UTC (rev 62094)
+++ trunk/Build/source/texk/web2c/uptexdir/ChangeLog 2022-02-20 11:11:09 UTC (rev 62095)
@@ -1,3 +1,8 @@
+2022-02-20 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
+
+ * upbibtex.ch: Adapt to pbibtex.ch.
+ https://github.com/texjporg/tex-jp-build/issues/133
+
2022-02-15 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
* uptex-m.ch: Adapt to ptex-base.ch.
Modified: trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch 2022-02-20 01:17:14 UTC (rev 62094)
+++ trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch 2022-02-20 11:11:09 UTC (rev 62095)
@@ -232,42 +232,58 @@
@z
@x
+@!pop_lit2_saved: integer;
+ at y
+@!pop_lit2_saved,@!mbl_tpe: integer;
+ at z
+
+ at x
{ 2 bytes Kanji code break check }
tps:=str_start[pop_lit3];
-while (tps < sp_ptr) do begin
- if str_pool[tps] > 127
- then tps := tps + 2
- else incr(tps);
-end;
tpe:=tps;
-while (tpe < sp_end) do begin
- if str_pool[tpe] > 127
- then tpe := tpe+2
- else incr(tpe);
+while tpe < str_start[pop_lit3+1] do begin
+ if str_pool[tpe] > 127 then begin
+ if str_start[pop_lit3+1] < tpe+2 then
+ break;
+ tpe := tpe + 2;
+ end
+ else begin
+ if str_start[pop_lit3+1] < tpe+1 then
+ break;
+ tpe := tpe + 1;
+ end;
+ if tpe<=sp_ptr then
+ tps := tpe;
+ if sp_end<=tpe then break;
end;
-if tps<>sp_ptr then begin
- if tps>str_start[pop_lit3]
- then decr(sp_ptr)
- else incr(sp_ptr);
-end;
-if tpe<>sp_end then begin
- if tpe<str_start[pop_lit3+1]
- then incr(sp_end)
- else decr(sp_end);
-end;
+if (pop_lit2_saved > 1) and (tps = str_start[pop_lit3])
+ then tps := tps + 2; {truncate at least one}
+if (pop_lit2_saved < -1) and (tpe = str_start[pop_lit3+1])
+ then tpe := tpe - 2; {truncate at least one}
+if tps > tpe then tpe := tps;
+sp_ptr := tps;
+sp_end := tpe;
@y
{ |2..4| bytes Kanji code break check }
tps:=str_start[pop_lit3];
tpe:=tps;
+mbl_tpe:=0;
while tpe < str_start[pop_lit3+1] do begin
- if multibytelen(str_pool[tpe])<0
+ if multibytelen(str_pool[tpe])<0 {just in case}
or (str_start[pop_lit3+1] < tpe+multibytelen(str_pool[tpe])) then
break;
- tpe := tpe + multibytelen(str_pool[tpe]);
+ mbl_tpe := multibytelen(str_pool[tpe]);
+ tpe := tpe + mbl_tpe;
if tpe<=sp_ptr then
tps := tpe;
if sp_end<=tpe then break;
end;
+if (pop_lit2_saved > 1) and (tps = str_start[pop_lit3]) then
+ if multibytelen(str_pool[tps])>=0 then {just in case}
+ tps := tps + multibytelen(str_pool[tps]); {truncate at least one}
+if (pop_lit2_saved < -1) and (tpe = str_start[pop_lit3+1]) then
+ tpe := tpe - mbl_tpe; {truncate at least one}
+if tps > tpe then tpe := tps;
sp_ptr := tps;
sp_end := tpe;
@z
More information about the tex-live-commits
mailing list.