summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakuji Tanaka <KXD02663@nifty.ne.jp>2017-01-14 15:10:11 +0000
committerTakuji Tanaka <KXD02663@nifty.ne.jp>2017-01-14 15:10:11 +0000
commitc6ec6310a150e1d191b4e3dbfb9073f319c46b11 (patch)
tree4076a4549c26544042e32c446498c0633280a0e0
parenta6bfaf32342fb5fb35874ed8d5b5f92b1ea30c60 (diff)
upbibtex: fix bug on substring$
git-svn-id: svn://tug.org/texlive/trunk@42954 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/uptexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/uptexdir/kanji.h7
-rw-r--r--Build/source/texk/web2c/uptexdir/upbibtex.ch63
3 files changed, 55 insertions, 21 deletions
diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog
index ef4999d8833..2fb54ed2eab 100644
--- a/Build/source/texk/web2c/uptexdir/ChangeLog
+++ b/Build/source/texk/web2c/uptexdir/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-14 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+ * upbibtex.ch, kanji.h: Fix bug on "substring$".
+ Thanks to Takeda Shiro san.
+
2016-12-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch:
@@ -130,7 +134,7 @@
* kanji.c (init_default_kanji): Set defaults before testing
PTEX_KANJI_ENC from the environment.
- * kanji.c: All programs use init_default_kanji("utf8","uptex").
+ * kanji.c: All programs use init_default_kanji("utf8","uptex").
2012-08-13 TANAKA Takuji <KXD02663@nifty.ne.jp>
diff --git a/Build/source/texk/web2c/uptexdir/kanji.h b/Build/source/texk/web2c/uptexdir/kanji.h
index 4ee9beffac4..a00f41d9eff 100644
--- a/Build/source/texk/web2c/uptexdir/kanji.h
+++ b/Build/source/texk/web2c/uptexdir/kanji.h
@@ -42,13 +42,8 @@ extern integer kcatcodekey (integer c);
extern integer multilenbuffchar (integer c);
extern void init_default_kanji (const_string file_str, const_string internal_str);
-#ifdef UPBIBTEX
-/* for upBibTeX */
-#define initkanji() init_default_kanji("utf8", "euc")
-#else
-/* for upTeX, e-upTeX, upDVItype, upPLtoTF, and upTFtoPL */
+/* for upTeX, e-upTeX, upBibTeX, upDVItype, upPLtoTF, and upTFtoPL */
#define initkanji() init_default_kanji("utf8", "uptex")
-#endif
/* for upDVItype */
#define setpriorfileenc() set_prior_file_enc()
diff --git a/Build/source/texk/web2c/uptexdir/upbibtex.ch b/Build/source/texk/web2c/uptexdir/upbibtex.ch
index 59e734adc56..e582e7d69c8 100644
--- a/Build/source/texk/web2c/uptexdir/upbibtex.ch
+++ b/Build/source/texk/web2c/uptexdir/upbibtex.ch
@@ -3,7 +3,7 @@
@d banner=='This is pBibTeX, Version 0.99d-j0.33'
@y
@d my_name=='upbibtex'
-@d banner=='This is upBibTeX, Version 0.99d-j0.33-u1.21'
+@d banner=='This is upBibTeX, Version 0.99d-j0.33-u1.22'
@z
@x
@@ -233,22 +233,60 @@ var i:0..last_text_char; {this is the first one declared}
@x
{ 2 bytes Kanji code break check }
-@y
-{ |2..4| bytes Kanji code break check }
-@z
-@x
+tps:=str_start[pop_lit3];
+while (tps < sp_ptr) do begin
if str_pool[tps] > 127
then tps := tps + 2
else incr(tps);
-@y
- tps := tps + multibytelen(str_pool[tps]);
-@z
-@x
+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);
+end;
@y
- tpe := tpe + multibytelen(str_pool[tpe]);
+{ |2..4| bytes Kanji code break check }
+tps:=str_start[pop_lit3];
+while (tps < sp_ptr) do begin
+ tps := tps + multibytelen(str_pool[tps])
+end;
+tpe:=tps;
+while (tpe < sp_end) do begin
+ tpe := tpe + multibytelen(str_pool[tpe])
+end;
+if tps<>sp_ptr then begin
+ if (is_internalUPTEX) then begin
+ if tps>str_start[pop_lit3]
+ then while (multibytelen(str_pool[sp_ptr])<0) do decr(sp_ptr)
+ else while (multibytelen(str_pool[sp_ptr])<0) do incr(sp_ptr)
+ end else begin
+ if tps>str_start[pop_lit3]
+ then decr(sp_ptr)
+ else incr(sp_ptr)
+ end;
+end;
+if tpe<>sp_end then begin
+ if (is_internalUPTEX) then begin
+ if tpe<str_start[pop_lit3+1]
+ then while (multibytelen(str_pool[sp_end])<0) do incr(sp_end)
+ else while (multibytelen(str_pool[sp_end])<0) do decr(sp_end)
+ end else begin
+ if tpe<str_start[pop_lit3+1]
+ then incr(sp_end)
+ else decr(sp_end)
+ end;
+end;
@z
@x
@@ -267,10 +305,7 @@ var i:0..last_text_char; {this is the first one declared}
append_char (str_pool[sp_ptr+2]);
if multibytelen(str_pool[sp_ptr]) > 3 then
append_char (str_pool[sp_ptr+3]);
- if multibytelen(str_pool[sp_ptr]) > 0 then
- sp_ptr := sp_ptr + multibytelen(str_pool[sp_ptr])
- else
- incr(sp_ptr);
+ sp_ptr := sp_ptr + multibytelen(str_pool[sp_ptr])
@z
@x