texlive[52771] Build/source/texk/web2c: e[u]ptex: add \Uchar and

commits+hironobu at tug.org commits+hironobu at tug.org
Wed Nov 13 11:14:27 CET 2019


Revision: 52771
          http://tug.org/svn/texlive?view=revision&revision=52771
Author:   hironobu
Date:     2019-11-13 11:14:26 +0100 (Wed, 13 Nov 2019)
Log Message:
-----------
e[u]ptex: add \Uchar and \Ucharcat (H. Kitagawa)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/eptexdir/ChangeLog
    trunk/Build/source/texk/web2c/eptexdir/eptex.ech
    trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
    trunk/Build/source/texk/web2c/eptexdir/etex.ch1
    trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch
    trunk/Build/source/texk/web2c/euptexdir/ChangeLog
    trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-post.ch
    trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-pre.ch

Added Paths:
-----------
    trunk/Build/source/texk/web2c/eptexdir/tests/uchar.tex

Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2019-11-13 10:14:26 UTC (rev 52771)
@@ -1,3 +1,13 @@
+2019-11-12  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* pdfutils.ch: Add primitives \Uchar and \Ucharcat.
+	* tests/uchar.tex: Added.
+	* eptex.ech, eptex_version.h: e-pTeX version 191112.
+
+2019-10-28  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* eptex.ech: Add primitives \current(x)spacingmode.
+
 2019-09-08  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* eptex.ech: \readline correctly handles Japanese characters.

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.ech
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2019-11-13 10:14:26 UTC (rev 52771)
@@ -26,8 +26,8 @@
 @y
 @d eTeX_version_string=='-2.6' {current \eTeX\ version}
 @#
- at d epTeX_version_string=='-190908'
- at d epTeX_version_number==190908
+ at d epTeX_version_string=='-191112'
+ at d epTeX_version_number==191112
 @z
 
 @x e-pTeX: banner

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2019-11-13 10:14:26 UTC (rev 52771)
@@ -1 +1 @@
-#define EPTEX_VERSION "190908"
+#define EPTEX_VERSION "191112"

Modified: trunk/Build/source/texk/web2c/eptexdir/etex.ch1
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/etex.ch1	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/eptexdir/etex.ch1	2019-11-13 10:14:26 UTC (rev 52771)
@@ -109,7 +109,7 @@
 exit: last_disp:=disp; hpack:=r;
 @y
 exit: last_disp:=disp;
-if TeXXeT_en then @<Check for LR anomalies at the end of |hpack|@>; 
+if TeXXeT_en then @<Check for LR anomalies at the end of |hpack|@>;
 hpack:=r;
 @z
 

Modified: trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2019-11-13 10:14:26 UTC (rev 52771)
@@ -27,6 +27,8 @@
 %% \expanded
 %%
 %% \ifincsname
+%%
+%% \Uchar, \Ucharcat
 
 @x
 @* \[8] Packed data.
@@ -830,6 +832,33 @@
   @<Reset |cur_tok| for unexpandable primitives, goto restart@>
 @z
 
+ at x \Ucharcat: str_toks_cat
+function str_toks(@!b:pool_pointer):pointer;
+ at y
+function str_toks_cat(@!b:pool_pointer;@!cat:small_number):pointer;
+ at z
+
+ at x \Ucharcat: str_toks_cat
+  else if t=" " then t:=space_token
+  else t:=other_token+t;
+ at y
+  else if (t=" ")and(cat=0) then t:=space_token
+  else if (cat=0)or(cat>=kanji) then t:=other_token+t
+  else if cat=active_char then t:= cs_token_flag + active_base + t
+  else t:=left_brace_token*cat+t;
+ at z
+
+ at x \Ucharcat: str_toks_cat
+pool_ptr:=b; str_toks:=p;
+end;
+ at y
+pool_ptr:=b; str_toks_cat:=p;
+end;
+
+function str_toks(@!b:pool_pointer):pointer;
+begin str_toks:=str_toks_cat(b,0); end;
+ at z
+
 @x
 @d etex_convert_codes=etex_convert_base+1 {end of \eTeX's command codes}
 @d job_name_code=etex_convert_codes {command code for \.{\\jobname}}
@@ -846,7 +875,10 @@
 @d uniform_deviate_code     = pdf_first_expand_code+6 {command code for \.{\\pdfuniformdeviate}}
 @d normal_deviate_code      = pdf_first_expand_code+7 {command code for \.{\\pdfnormaldeviate}}
 @d pdf_convert_codes        = pdf_first_expand_code+8 {end of \pdfTeX-like command codes}
- at d job_name_code=pdf_convert_codes {command code for \.{\\jobname}}
+ at d Uchar_convert_code       = pdf_convert_codes   {command code for \.{\\Uchar}}
+ at d Ucharcat_convert_code    = pdf_convert_codes+1 {command code for \.{\\Ucharcat}}
+ at d eptex_convert_codes      = pdf_convert_codes+2 {end of \epTeX's command codes}
+ at d job_name_code=eptex_convert_codes {command code for \.{\\jobname}}
 @z
 
 @x
@@ -853,8 +885,8 @@
 primitive("jobname",convert,job_name_code);@/
 @y
 @#
-primitive("expanded",convert,expanded_code);@/ 
-@!@:expanded_}{\.{\\expanded} primitive@> 
+primitive("expanded",convert,expanded_code);@/
+@!@:expanded_}{\.{\\expanded} primitive@>
 @#
 primitive("jobname",convert,job_name_code);@/
 @z
@@ -872,6 +904,8 @@
   pdf_file_dump_code:     print_esc("pdffiledump");
   uniform_deviate_code:   print_esc("pdfuniformdeviate");
   normal_deviate_code:    print_esc("pdfnormaldeviate");
+  Uchar_convert_code:     print_esc("Uchar");
+  Ucharcat_convert_code:  print_esc("Ucharcat");
 @z
 
 @x
@@ -885,6 +919,10 @@
 @d save_cur_string==if str_start[str_ptr]<pool_ptr then u:=make_string else u:=0
 @d restore_cur_string==if u<>0 then decr(str_ptr)
 
+@ Not all catcode values are allowed by \.{\\Ucharcat}:
+ at d illegal_Ucharcat_ascii_catcode(#)==(#<left_brace)or(#>active_char)or(#=out_param)or(#=ignore)
+ at d illegal_Ucharcat_wchar_catcode(#)==(#<kanji)or(#>other_kchar)
+
 @p procedure conv_toks;
 @z
 
@@ -899,16 +937,23 @@
 @!s: str_number; {first temp string}
 @!i: integer;
 @!j: integer;
+@!cat:small_number; {desired catcode, or 0 for automatic |spacer|/|other_char| selection}
 @z
 
 @x
 begin c:=cur_chr; @<Scan the argument for command |c|@>;
 @y
-begin c:=cur_chr; @<Scan the argument for command |c|@>;
+begin cat:=0; c:=cur_chr; @<Scan the argument for command |c|@>;
 u:=0; { will become non-nil if a string is already being built}
 @z
 
 @x
+selector:=old_setting; link(garbage):=str_toks(b); ins_list(link(temp_head));
+ at y
+selector:=old_setting; link(garbage):=str_toks_cat(b,cat); ins_list(link(temp_head));
+ at z
+
+ at x
 eTeX_revision_code: do_nothing;
 @y
 eTeX_revision_code: do_nothing;
@@ -1061,6 +1106,21 @@
   end;
 uniform_deviate_code:     scan_int;
 normal_deviate_code:      do_nothing;
+Uchar_convert_code:       scan_char_num;
+Ucharcat_convert_code:
+  begin
+    scan_ascii_num;
+    i:=cur_val;
+    scan_int;
+    if illegal_Ucharcat_ascii_catcode(cur_val) then
+      begin print_err("Invalid code ("); print_int(cur_val);
+ at .Invalid code@>
+      print("), should be in the ranges 1..4, 6..8, 10..13");
+      help1("I'm going to use 12 instead of that illegal code value.");@/
+      error; cat:=12;
+    end else cat:=cur_val;
+    cur_val:=i;
+    end;
 @z
 
 @x
@@ -1070,6 +1130,10 @@
 pdf_strcmp_code: print_int(cur_val);
 uniform_deviate_code:     print_int(unif_rand(cur_val));
 normal_deviate_code:      print_int(norm_rand);
+Uchar_convert_code:
+if is_char_ascii(cur_val) then print_char(cur_val) else print_kanji(cur_val);
+Ucharcat_convert_code:
+if cat<kanji then print_char(cur_val) else print_kanji(cur_val);
 @z
 
 @x e-pTeX: if primitives - leave room for \ifincsname
@@ -1313,6 +1377,10 @@
 @!@:elapsed_time_}{\.{\\pdfelapsedtime} primitive@>
 primitive("pdfresettimer",extension,reset_timer_code);@/
 @!@:reset_timer_}{\.{\\pdfresettimer} primitive@>
+primitive("Uchar",convert,Uchar_convert_code);@/
+@!@:Uchar_}{\.{\\Uchar} primitive@>
+primitive("Ucharcat",convert,Ucharcat_convert_code);@/
+@!@:Ucharcat_}{\.{\\Ucharcat} primitive@>
 @z
 
 @x
@@ -1599,7 +1667,7 @@
 while (k<pool_ptr)and bl do
   if (sop(k)>='0')and (sop(k)<='9') then begin s:=10*s+sop(k)-'0'; incr(k); @+end
   else bl:=false;
-ifps(1) sop(k)='.' then 
+ifps(1) sop(k)='.' then
   begin incr(k); bl:=true; i:=0; dig[0]:=0;
   while (k<pool_ptr)and bl do begin
     if (sop(k)>='0')and (sop(k)<='9') then
@@ -1612,7 +1680,7 @@
 if k+4>pool_ptr then
   if (sop(k)='t')and(sop(k+1)='r')and(sop(k+2)='u')and(sop(k+3)='e') then
     k:=k+4;
-if mag<>1000 then 
+if mag<>1000 then
   begin s:=xn_over_d(s,1000,mag);
   t:=(1000*t+@'200000*remainder) div mag;
   s:=s+(t div @'200000); t:=t mod @'200000;

Added: trunk/Build/source/texk/web2c/eptexdir/tests/uchar.tex
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/tests/uchar.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/eptexdir/tests/uchar.tex	2019-11-13 10:14:26 UTC (rev 52771)
@@ -0,0 +1,127 @@
+% eptex
+
+% \Uchar <chr_code>
+%  0--255:常に欧文文字トークン
+%  256以上の,内部コードで許される値:常に和文文字トークン
+% \Ucharcat <chr_code> <catcode>
+% <chr_code> in [0,128): 欧文文字トークンを生成.<catcode> in {1..4, 6..8, 10..13}
+% <chr_code> in [128,256)
+%    e-pTeX の場合:欧文文字トークンを生成.<catcode> in {1..4, 6..8, 10..13}
+%    e-upTeX の場合:欧文/和文文字トークンを生成.<catcode> in {1..4, 6..8, 10..13, 16..19}
+% <chr_code> >=256: 和文文字トークンを生成.
+%    e-pTeX の場合: <catcode> in {16..18}
+%    e-upTeX の場合:<catcode> in {16..19}
+
+
+% e-upTeX:
+
+
+\let\bg={ \let\eg=}
+{\catcode`\ =9\relax
+\gdef\KCAT{%
+  \immediate\write17{%
+    [\expandafter\string\x\space
+    \expandafter\ifcat\x$   math\space shift\fi
+    \expandafter\ifcat\x&   alignment\fi
+    \expandafter\ifcat\x^   superscript\fi
+    \expandafter\ifcat\x_   subscript\fi
+    \expandafter\ifcat\x\space space\fi
+    \expandafter\ifcat\x a  letter\fi
+    \expandafter\ifcat\x 1  other\space char\fi
+    \expandafter\ifcat\x ~  active\fi
+    \expandafter\ifcat\x 空 kanji\fi
+    \expandafter\ifcat\x ア kana\fi
+    \expandafter\ifcat\x { other\space kchar\fi
+    \ifdefined\ucs
+      \expandafter\ifcat\x 한 hangul\fi
+    \fi]}%
+}}
+\let\sharp=#
+\font\x=ec-lmtt10 \x
+\scrollmode
+
+\edef\x{\Uchar`\{}\KCAT
+\edef\x{\Uchar`\}}\KCAT
+\edef\x{\Uchar`\$}\KCAT
+\edef\x{\Uchar`\&}\KCAT
+\edef\x{\Uchar`\#}\KCAT
+\edef\x{\Uchar`\^}\KCAT
+\edef\x{\Uchar`\_}\KCAT
+\edef\x{\Uchar`\ }\KCAT
+\edef\x{\Uchar`\a}\KCAT
+\edef\x{\Uchar`\1}\KCAT
+\edef\x{\Uchar`~}\KCAT
+\edef\x{\Uchar`漢}\KCAT
+\edef\x{\Uchar`あ}\KCAT
+\edef\x{\Uchar`)}\KCAT
+
+\ifdefined\ucs %======
+\immediate\write0{■\string\Uchar\space and \string\kcatcode}
+{\kcatcode"03B1=15 \kcatcode"FF=15
+\edef\x{\Uchar"FF}\KCAT%"
+\edef\x{\Uchar"03B1}\KCAT%"
+}
+
+{\kcatcode"03B1=17 \kcatcode"FF=17
+\edef\x{\Uchar"FF}\KCAT%"
+\edef\x{\Uchar"03B1}\KCAT%"
+}
+\fi %======
+
+\immediate\write0{■\string\Ucharcat.}
+
+\edef\x{\Ucharcat`\# 0}\KCAT % error "! Invalid code"
+\edef\x{\Ucharcat`\# 3}\KCAT
+\edef\x{\Ucharcat`\# 4}\KCAT
+\edef\x{\Ucharcat`\# 5}\KCAT % error "! Invalid code"
+\edef\x{\Ucharcat`\# 7}\KCAT
+\edef\x{\Ucharcat`\# 8}\KCAT
+\edef\x{\Ucharcat`\# 9}\KCAT % error "! Invalid code"
+\edef\x{\Ucharcat`\# 10}\KCAT
+\edef\x{\Ucharcat`\# 11}\KCAT
+\edef\x{\Ucharcat`\# 12}\KCAT
+\edef\x{\unexpanded\expandafter{\Ucharcat`\# 13}}
+\message{\expandafter\meaning\unexpanded\expandafter{\x}} % undefined
+\edef\x{\Ucharcat`\# 14}\KCAT % error "! Invalid code"
+\edef\x{\Ucharcat`\# 15}\KCAT % error "! Invalid code"
+
+\edef\x{\Ucharcat`\# 16} % error "! Invalid code (16)"
+\KCAT
+
+\ifdefined\ucs %======
+\edef\x{\Ucharcat`漢 3} % error "! Invalid code (3)"
+\KCAT
+
+\edef\x{\Ucharcat`$ 16}\KCAT
+\edef\x{\Ucharcat`: 17}\KCAT
+\edef\x{\Ucharcat`あ 18}\KCAT
+\edef\x{\Ucharcat`漢 19}\KCAT
+
+{\kcatcode"03B1=15 %"
+\edef\x{\Ucharcat"03B1 12}\KCAT%" error "! Invalid code (12)"
+\edef\x{\Ucharcat"03B1 17}\KCAT%"
+}
+
+{\kcatcode"03B1=16 %"
+\edef\x{\Ucharcat"03B1 12}\KCAT%" error "! Invalid code (12)"
+\edef\x{\Ucharcat"03B1 17}\KCAT%"
+}
+
+{\kcatcode"FF=15 %"
+\edef\x{\Ucharcat"FF 12}\KCAT%"
+\edef\x{\Ucharcat"FF 17}\KCAT%"
+}
+
+{\kcatcode"FF=16 %"
+\edef\x{\Ucharcat"FF 12}\KCAT%"
+\edef\x{\Ucharcat"FF 17}\KCAT%"
+}
+\else
+
+\edef\x{\Ucharcat`漢 3} % error "! Bad character code" in eptex
+
+\fi % ======
+
+
+\end
+


Property changes on: trunk/Build/source/texk/web2c/eptexdir/tests/uchar.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Build/source/texk/web2c/euptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/ChangeLog	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/euptexdir/ChangeLog	2019-11-13 10:14:26 UTC (rev 52771)
@@ -1,3 +1,11 @@
+2019-11-12  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* pdfstrcmp-eup-{pre,post}.ch: Adapt to e-pTeX 191112.
+
+2019-10-28  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* euptex.ch1: Add a primitive \currentcjktoken.
+
 2019-09-08  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* euptex.ch1: Adapt to changes in eptexdir/.

Modified: trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-post.ch
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-post.ch	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-post.ch	2019-11-13 10:14:26 UTC (rev 52771)
@@ -17,6 +17,84 @@
 @z
 
 @x
+       check_kcat_code(cc) then
+    begin if (cc=not_cjk) then cc:=other_kchar;
+ at y
+       ((cat>=kanji)or check_kcat_code(cc)) then
+    begin if cat>=kanji then cc:=cat else if (cc=not_cjk) then cc:=other_kchar;
+ at z
+
+ at x
+  else if (t=" ")and(cat=0) then t:=space_token
+  else if (cat=0)or(cat>=kanji) then t:=other_token+t
+  else if cat=active_char then t:= cs_token_flag + active_base + t
+  else t:=left_brace_token*cat+t;
+ at y
+    if (t=" ")and(cat=0) then t:=space_token
+    else if (cat=0)or(cat>=kanji) then t:=other_token+t
+    else if cat=active_char then t:= cs_token_flag + active_base + t
+    else t:=left_brace_token*cat+t;
+ at z
+
+ at x
+ at d illegal_Ucharcat_wchar_catcode(#)==(#<kanji)or(#>other_kchar)
+ at y
+ at d illegal_Ucharcat_wchar_catcode(#)==(#<kanji)or(#>hangul)
+ at z
+
+ at x
+Uchar_convert_code:       scan_char_num;
+Ucharcat_convert_code:
+  begin
+    scan_ascii_num;
+ at y
+Uchar_convert_code: begin scan_char_num;
+    if not is_char_ascii(cur_val) then
+	  if kcat_code(kcatcodekey(cur_val))=not_cjk then cat:=other_kchar;
+    end;
+Ucharcat_convert_code:
+  begin
+    scan_char_num;
+ at z
+
+ at x
+    if illegal_Ucharcat_ascii_catcode(cur_val) then
+      begin print_err("Invalid code ("); print_int(cur_val);
+ at .Invalid code@>
+      print("), should be in the ranges 1..4, 6..8, 10..13");
+      help1("I'm going to use 12 instead of that illegal code value.");@/
+      error; cat:=12;
+    end else cat:=cur_val;
+ at y
+    if i<=@"7F then { no |wchar_token| }
+      begin if illegal_Ucharcat_ascii_catcode(cur_val) then
+        begin print_err("Invalid code ("); print_int(cur_val);
+ at .Invalid code@>
+        print("), should be in the ranges 1..4, 6..8, 10..13");
+        help1("I'm going to use 12 instead of that illegal code value.");@/
+        error; cat:=12;
+      end else cat:=cur_val;
+    end else if i<=@"FF then
+      begin if (illegal_Ucharcat_ascii_catcode(cur_val))
+        and (illegal_Ucharcat_wchar_catcode(cur_val)) then
+        begin print_err("Invalid code ("); print_int(cur_val);
+ at .Invalid code@>
+        print("), should be in the ranges 1..4, 6..8, 10..13, 16..19");
+        help1("I'm going to use 12 instead of that illegal code value.");@/
+        error; cat:=12;
+      end else cat:=cur_val;
+    end else { |wchar_token| only }
+      begin if illegal_Ucharcat_wchar_catcode(cur_val) then
+        begin print_err("Invalid code ("); print_int(cur_val);
+ at .Invalid code@>
+        print("), should be in the ranges 16..19");
+        help1("I'm going to use 18 instead of that illegal code value.");@/
+        error; cat:=other_kchar;
+      end else cat:=cur_val;
+	end;
+ at z
+
+ at x
 procedure print_kanji(@!s:integer); {prints a single character}
 begin
 if s>255 then begin

Modified: trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-pre.ch
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-pre.ch	2019-11-13 10:13:31 UTC (rev 52770)
+++ trunk/Build/source/texk/web2c/euptexdir/pdfstrcmp-eup-pre.ch	2019-11-13 10:14:26 UTC (rev 52771)
@@ -1,4 +1,12 @@
 @x
+    if t=" " then t:=space_token
+    else t:=other_token+t;
+ at y
+  else if t=" " then t:=space_token
+  else t:=other_token+t;
+ at z
+
+ at x
 procedure print_kanji(@!s:KANJI_code); {prints a single character}
 begin
 s:=toBUFF(s mod max_cjk_val);



More information about the tex-live-commits mailing list