summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ptexdir/pbibtex.ch
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/ptexdir/pbibtex.ch')
-rw-r--r--Build/source/texk/web2c/ptexdir/pbibtex.ch61
1 files changed, 38 insertions, 23 deletions
diff --git a/Build/source/texk/web2c/ptexdir/pbibtex.ch b/Build/source/texk/web2c/ptexdir/pbibtex.ch
index d1bcc9a554d..501ff28bc54 100644
--- a/Build/source/texk/web2c/ptexdir/pbibtex.ch
+++ b/Build/source/texk/web2c/ptexdir/pbibtex.ch
@@ -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 @@ init_kanji;
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 @@ begin
procedure x_substring;
label exit;
var tps,tpe:pool_pointer; {temporary pointer}
+@!pop_lit2_saved: integer;
begin
@z
-@x Changes for JBibTeX by Shouichi Matsui [438]
+@x
+@<Form the appropriate substring@>=
+begin
+@y
+@<Form the appropriate substring@>=
+begin
+pop_lit2_saved := pop_lit2; {save before negate}
+@z
+
+@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 @@ while (sp_ptr < sp_end) do {shift the substring}
@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);
-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);
+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 (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}