summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/eptexdir
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-11-13 10:14:26 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-11-13 10:14:26 +0000
commit5f94645f37aef24b6a3a1952b0724f4782fe99de (patch)
treef97f7ac5fe4eee8f96c9b257fa6e8839f1958c49 /Build/source/texk/web2c/eptexdir
parentfebfa49f76b9698e3362af058db3ab357e3712fe (diff)
e[u]ptex: add \Uchar and \Ucharcat (H. Kitagawa)
git-svn-id: svn://tug.org/texlive/trunk@52771 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/eptexdir')
-rw-r--r--Build/source/texk/web2c/eptexdir/ChangeLog10
-rw-r--r--Build/source/texk/web2c/eptexdir/eptex.ech4
-rw-r--r--Build/source/texk/web2c/eptexdir/eptex_version.h2
-rw-r--r--Build/source/texk/web2c/eptexdir/etex.ch12
-rw-r--r--Build/source/texk/web2c/eptexdir/pdfutils.ch80
-rw-r--r--Build/source/texk/web2c/eptexdir/tests/uchar.tex127
6 files changed, 215 insertions, 10 deletions
diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog
index 3b5a30a8f1b..74adf83c2a8 100644
--- a/Build/source/texk/web2c/eptexdir/ChangeLog
+++ b/Build/source/texk/web2c/eptexdir/ChangeLog
@@ -1,3 +1,13 @@
+2019-11-12 Hironori Kitagawa <h_kitagawa2001@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@gmail.com>
+
+ * eptex.ech: Add primitives \current(x)spacingmode.
+
2019-09-08 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
* eptex.ech: \readline correctly handles Japanese characters.
diff --git a/Build/source/texk/web2c/eptexdir/eptex.ech b/Build/source/texk/web2c/eptexdir/eptex.ech
index c38831367f6..c9d94603d1d 100644
--- a/Build/source/texk/web2c/eptexdir/eptex.ech
+++ b/Build/source/texk/web2c/eptexdir/eptex.ech
@@ -26,8 +26,8 @@
@y
@d eTeX_version_string=='-2.6' {current \eTeX\ version}
@#
-@d epTeX_version_string=='-190908'
-@d epTeX_version_number==190908
+@d epTeX_version_string=='-191112'
+@d epTeX_version_number==191112
@z
@x e-pTeX: banner
diff --git a/Build/source/texk/web2c/eptexdir/eptex_version.h b/Build/source/texk/web2c/eptexdir/eptex_version.h
index c0034c25103..2081950eb22 100644
--- a/Build/source/texk/web2c/eptexdir/eptex_version.h
+++ b/Build/source/texk/web2c/eptexdir/eptex_version.h
@@ -1 +1 @@
-#define EPTEX_VERSION "190908"
+#define EPTEX_VERSION "191112"
diff --git a/Build/source/texk/web2c/eptexdir/etex.ch1 b/Build/source/texk/web2c/eptexdir/etex.ch1
index 94415743937..14b10a2925e 100644
--- a/Build/source/texk/web2c/eptexdir/etex.ch1
+++ b/Build/source/texk/web2c/eptexdir/etex.ch1
@@ -109,7 +109,7 @@ disp_node: begin disp:=disp_dimen(p); revdisp:=disp; cur_v:=base_line+disp; end;
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
diff --git a/Build/source/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch
index 88f80935ebc..36e821d1f9a 100644
--- a/Build/source/texk/web2c/eptexdir/pdfutils.ch
+++ b/Build/source/texk/web2c/eptexdir/pdfutils.ch
@@ -27,6 +27,8 @@
%% \expanded
%%
%% \ifincsname
+%%
+%% \Uchar, \Ucharcat
@x
@* \[8] Packed data.
@@ -830,6 +832,33 @@ else if cur_tok=cs_token_flag+frozen_primitive then
@<Reset |cur_tok| for unexpandable primitives, goto restart@>
@z
+@x \Ucharcat: str_toks_cat
+function str_toks(@!b:pool_pointer):pointer;
+@y
+function str_toks_cat(@!b:pool_pointer;@!cat:small_number):pointer;
+@z
+
+@x \Ucharcat: str_toks_cat
+ else if t=" " then t:=space_token
+ else t:=other_token+t;
+@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;
+@z
+
+@x \Ucharcat: str_toks_cat
+pool_ptr:=b; str_toks:=p;
+end;
+@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;
+@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,15 +875,18 @@ else if cur_tok=cs_token_flag+frozen_primitive then
@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}
-@d job_name_code=pdf_convert_codes {command code for \.{\\jobname}}
+@d Uchar_convert_code = pdf_convert_codes {command code for \.{\\Uchar}}
+@d Ucharcat_convert_code = pdf_convert_codes+1 {command code for \.{\\Ucharcat}}
+@d eptex_convert_codes = pdf_convert_codes+2 {end of \epTeX's command codes}
+@d job_name_code=eptex_convert_codes {command code for \.{\\jobname}}
@z
@x
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 @@ primitive("jobname",convert,job_name_code);@/
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 @@ we have to create a temporary string that is destroyed immediately after.
@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}:
+@d illegal_Ucharcat_ascii_catcode(#)==(#<left_brace)or(#>active_char)or(#=out_param)or(#=ignore)
+@d illegal_Ucharcat_wchar_catcode(#)==(#<kanji)or(#>other_kchar)
+
@p procedure conv_toks;
@z
@@ -899,16 +937,23 @@ we have to create a temporary string that is destroyed immediately after.
@!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));
+@y
+selector:=old_setting; link(garbage):=str_toks_cat(b,cat); ins_list(link(temp_head));
+@z
+
+@x
eTeX_revision_code: do_nothing;
@y
eTeX_revision_code: do_nothing;
@@ -1061,6 +1106,21 @@ pdf_file_dump_code:
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);
+@.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 @@ eTeX_revision_code: print(eTeX_revision);
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 @@ primitive("pdfelapsedtime",last_item,elapsed_time_code);
@!@: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 @@ s:=0; t:=0; bl:=true;
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 @@ ifps(1) sop(k)='.' then
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;
diff --git a/Build/source/texk/web2c/eptexdir/tests/uchar.tex b/Build/source/texk/web2c/eptexdir/tests/uchar.tex
new file mode 100644
index 00000000000..35d29693343
--- /dev/null
+++ b/Build/source/texk/web2c/eptexdir/tests/uchar.tex
@@ -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
+