Skip to content

Commit

Permalink
updated tests (desc. in uchar.tex)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-kitagawa committed Oct 31, 2019
1 parent a7d8800 commit c994855
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 28 deletions.
9 changes: 6 additions & 3 deletions source/texk/web2c/eptexdir/pdfutils.ch
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,9 @@ function str_toks_cat(@!b:pool_pointer;@!cat:small_number):pointer;
else t:=other_token+t;
@y
else if (t=" ")and(cat=0) then t:=space_token
else if cat=0 then t:=other_token+t else t:=left_brace_token*cat+t;
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
Expand Down Expand Up @@ -1128,9 +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,
Ucharcat_convert_code:
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
Expand Down
123 changes: 103 additions & 20 deletions source/texk/web2c/eptexdir/tests/uchar.tex
Original file line number Diff line number Diff line change
@@ -1,41 +1,124 @@
% euptex

\kcatcode`α=15
\def\KCAT{%
\message{\expandafter\ifcat\x 空 [kanji]\fi}%
\message{\expandafter\ifcat\x ア [kana]\fi}%
\message{\expandafter\ifcat\x { [other\string_kchar]\fi}%
\message{\expandafter\ifcat\x 한 [hangul]\fi}%
}
% 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`\$}
\expandafter\show\x

\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
\edef\x{\Uchar"03B1}\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%"}
\edef\x{\Ucharcat`\# 3}
\expandafter\show\x
{\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)"
\expandafter\show\x
\KCAT
\edef\x{\Ucharcat`漢 3} % error "! Bad character code" in eptex
\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
\edef\x{\Ucharcat"03B1 17}\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
Expand Down
23 changes: 18 additions & 5 deletions source/texk/web2c/euptexdir/pdfstrcmp-eup-post.ch
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
@x
else if (t=" ")and(cat=0) then t:=space_token
else if cat=0 then t:=other_token+t else t:=left_brace_token*cat+t;
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;
@y
if (t=" ")and(cat=0) then t:=space_token
else if cat=0 then t:=other_token+t else t:=left_brace_token*cat+t;
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
Expand Down Expand Up @@ -61,20 +65,29 @@ Ucharcat_convert_code:
error; cat:=12;
end else cat:=cur_val;
@y
if is_char_ascii(i) then
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);
@.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
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);
@.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);
@.Invalid code@>
print("), should be in the ranges 16..19");
help1("I'm going to use 12 instead of that illegal code value.");@/
help1("I'm going to use 18 instead of that illegal code value.");@/
error; cat:=other_kchar;
end else cat:=cur_val;
end;
Expand Down

0 comments on commit c994855

Please sign in to comment.