texlive[63305] Build/source/texk/web2c: (u)pbibtex: j0.35, accept

commits+takuji at tug.org commits+takuji at tug.org
Sun May 15 13:23:41 CEST 2022


Revision: 63305
          http://tug.org/svn/texlive?view=revision&revision=63305
Author:   takuji
Date:     2022-05-15 13:23:40 +0200 (Sun, 15 May 2022)
Log Message:
-----------
(u)pbibtex: j0.35, accept multibyte chars by int.to.chr$ & chr.to.int$

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ptexdir/ChangeLog
    trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch
    trunk/Build/source/texk/web2c/ptexdir/ptex.defines
    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-05-14 23:49:19 UTC (rev 63304)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog	2022-05-15 11:23:40 UTC (rev 63305)
@@ -1,3 +1,10 @@
+2022-05-15  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* pbibtex.ch, ptex.defines:
+	Accept multibyte characters by int.to.chr$ and chr.to.int$, i.e.
+	chr is corresponding to one single character multibyte string.
+	Bump version to j0.35
+
 2022-05-06  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* pbibtex.test: Update a test.

Modified: trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch	2022-05-14 23:49:19 UTC (rev 63304)
+++ trunk/Build/source/texk/web2c/ptexdir/pbibtex.ch	2022-05-15 11:23:40 UTC (rev 63305)
@@ -30,12 +30,14 @@
 % 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.
+% 2022-05-15    Version 0.35 by Takuji Tanaka (-> TL'23 version)
+%   * Accept multibyte characters by int.to.chr$ and chr.to.int$.
 
 @x [0] only print chnages
 \def\title{\BibTeX\ }
 @y
 \let\maybe=\iffalse
-\def\title{J\BibTeX\ 0.34 Changes for C Version \BibTeX\ }
+\def\title{J\BibTeX\ 0.35 Changes for C Version \BibTeX\ }
 @z
 
 @x
@@ -45,7 +47,7 @@
 @y
  \def\titlepage{F}
  \centerline{\:\titlefont The {\:\ttitlefont J\BibTeX} preprocessor}
- \vskip 15pt \centerline{(Version 0.99d-j0.34---\today)} \vfill}
+ \vskip 15pt \centerline{(Version 0.99d-j0.35---\today)} \vfill}
 @z
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -56,7 +58,7 @@
 @d banner=='This is BibTeX, Version 0.99d' {printed when the program starts}
 @y
 @d my_name=='pbibtex'
- at d banner=='This is pBibTeX, Version 0.99d-j0.34'
+ at d banner=='This is pBibTeX, Version 0.99d-j0.35'
   {printed when the program starts}
 @z
 
@@ -339,7 +341,7 @@
         @<Add the |period| (it's necessary) and push@>
 @z
 
- at x Changes for JBibTeX by Shouichi Matsui [377]
+ at x x_chr_to_int
 else if (length(pop_lit1) <> 1) then
     begin
     print ('"');
@@ -347,16 +349,26 @@
     bst_ex_warn ('" isn''t a single character');
     push_lit_stk (0, stk_int);
     end
+else
+    push_lit_stk (str_pool[str_start[pop_lit1]], stk_int);
+                                        {push the (|ASCII_code|) integer}
 @y
-else if (length(pop_lit1) <> 1) then
-    if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is 2byte long }
+else if (length(pop_lit1) = multibytelen(str_pool[str_start[pop_lit1]])) then
+    begin
+    if (length(pop_lit1) = 1) then
         push_lit_stk(str_pool[str_start[pop_lit1]],stk_int)
-    else begin
-        print ('"');
-        print_pool_str (pop_lit1);
-        bst_ex_warn ('" isn''t a single character');
-        push_lit_stk (0, stk_int);
+                                        {push the (|ASCII_code|) integer}
+    else
+        push_lit_stk(toDVI(fromBUFF(str_pool, str_start[pop_lit1]+2, str_start[pop_lit1])),stk_int)
+                                        { a KANJI char is 2byte long }
     end
+else
+    begin
+    print ('"');
+    print_pool_str (pop_lit1);
+    bst_ex_warn ('" isn''t a single character');
+    push_lit_stk (0, stk_int);
+    end
 @z
 
 @x by Shouichi Matsui for Zenkaku comma
@@ -462,6 +474,60 @@
     else if ((name_buf[name_bf_ptr] = left_brace) and
 @z
 
+ at x x_int_to_chr
+procedure x_int_to_chr;
+begin
+pop_lit_stk (pop_lit1,pop_typ1);
+if (pop_typ1 <> stk_int) then
+    begin
+    print_wrong_stk_lit (pop_lit1,pop_typ1,stk_int);
+    push_lit_stk (s_null, stk_str);
+    end
+else if ((pop_lit1 < 0) or (pop_lit1 > 127)) then
+    begin
+    bst_ex_warn (pop_lit1:0,' isn''t valid ASCII');
+    push_lit_stk (s_null, stk_str);
+    end
+else
+    begin
+    str_room(1);
+    append_char (pop_lit1);
+    push_lit_stk (make_string, stk_str);
+    end;
+end;
+ at y
+procedure x_int_to_chr;
+var k:integer;
+begin
+pop_lit_stk (pop_lit1,pop_typ1);
+if (pop_typ1 <> stk_int) then
+    begin
+    print_wrong_stk_lit (pop_lit1,pop_typ1,stk_int);
+    push_lit_stk (s_null, stk_str);
+    end
+else begin
+k:=pop_lit1;
+if (pop_lit1 > 127) then k:=fromDVI(pop_lit1);
+if ((pop_lit1 < 0) or ((pop_lit1 > 127) and (k = 0))) then
+    begin
+    bst_ex_warn (pop_lit1:0,' isn''t valid character code');
+    push_lit_stk (s_null, stk_str);
+    end
+else
+    begin
+    str_room(2);
+    if (pop_lit1>127) then begin
+        append_char (Hi(k));
+        append_char (Lo(k));
+    end
+    else
+        append_char (pop_lit1);
+    push_lit_stk (make_string, stk_str);
+    end;
+end;
+end;
+ at z
+
 @x Changes for JBibTeX by Shouichi Matsui [437]
 @<|execute_fn|({\.{substring\$}})@>=
 procedure x_substring;

Modified: trunk/Build/source/texk/web2c/ptexdir/ptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex.defines	2022-05-14 23:49:19 UTC (rev 63304)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex.defines	2022-05-15 11:23:40 UTC (rev 63305)
@@ -11,6 +11,7 @@
 @define function multistrlen ();
 @define function multistrlenshort ();
 @define function multistrlenfilename ();
+ at define function multibytelen ();
 @define function fromBUFF ();
 @define function fromBUFFshort ();
 @define function toBUFF ();

Modified: trunk/Build/source/texk/web2c/uptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/ChangeLog	2022-05-14 23:49:19 UTC (rev 63304)
+++ trunk/Build/source/texk/web2c/uptexdir/ChangeLog	2022-05-15 11:23:40 UTC (rev 63305)
@@ -1,3 +1,9 @@
+2022-05-15  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* upbibtex.ch:
+	Accept multibyte characters by int.to.chr$ and chr.to.int$, i.e.
+	chr is corresponding to one single character multibyte string.
+
 2022-05-07  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* upbibtex.ch:

Modified: trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch	2022-05-14 23:49:19 UTC (rev 63304)
+++ trunk/Build/source/texk/web2c/uptexdir/upbibtex.ch	2022-05-15 11:23:40 UTC (rev 63305)
@@ -1,9 +1,9 @@
 @x
 @d my_name=='pbibtex'
- at d banner=='This is pBibTeX, Version 0.99d-j0.34'
+ at d banner=='This is pBibTeX, Version 0.99d-j0.35'
 @y
 @d my_name=='upbibtex'
- at d banner=='This is upBibTeX, Version 0.99d-j0.34-u1.28'
+ at d banner=='This is upBibTeX, Version 0.99d-j0.35-u1.28'
 @z
 
 @x
@@ -258,10 +258,12 @@
         end;
 @z
 
- at x
-    if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is 2byte long }
+ at x x_chr_to_int
+        push_lit_stk(toDVI(fromBUFF(str_pool, str_start[pop_lit1]+2, str_start[pop_lit1])),stk_int)
+                                        { a KANJI char is 2byte long }
 @y
-    if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is |2..4|byte long }
+        push_lit_stk(toDVI(fromBUFF(str_pool, str_start[pop_lit1]+length(pop_lit1), str_start[pop_lit1])),stk_int)
+                                        { a KANJI char is |2..4|byte long }
 @z
 
 @x
@@ -357,6 +359,31 @@
         name_bf_ptr := name_bf_ptr + multibytelen(name_buf[name_bf_ptr])-1;
 @z
 
+ at x x_int_to_chr
+    str_room(2);
+    if (pop_lit1>127) then begin
+        append_char (Hi(k));
+        append_char (Lo(k));
+    end
+    else
+        append_char (pop_lit1);
+    push_lit_stk (make_string, stk_str);
+    end;
+ at y
+    str_room(4);
+    k:=toBUFF(k);
+    if (BYTE1(k)>0) then
+        append_char (BYTE1(k));
+    if (BYTE2(k)>0) then
+        append_char (BYTE2(k));
+    if (BYTE3(k)>0) then
+        append_char (BYTE3(k));
+    { always }
+        append_char (BYTE4(k));
+    push_lit_stk (make_string, stk_str);
+    end;
+ at z
+
 @x
 @!pop_lit2_saved: integer;
 @y



More information about the tex-live-commits mailing list.