Skip to content

Commit

Permalink
[uptex] revert latin_ucs_flag (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-tk committed Jun 26, 2024
1 parent e2e161c commit 0fa0c33
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion source/texk/web2c/euptexdir/eptex.ech
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ if j=1 then
check_kcat_code(cur_tok,cur_chr) then
begin if (cur_tok=not_cjk) then cur_tok:=other_kchar;
if (cur_tok=latin_ucs) then cur_tok:=other_token;
cur_tok:=cur_chr+cur_tok*max_cjk_val+latin_ucs_flag;
cur_tok:=cur_chr+cur_tok*max_cjk_val;
loc:=loc+multistrlen(ustringcast(buffer), limit+1,loc);
end
else begin cur_chr:=buffer[loc]; incr(loc);
Expand Down
13 changes: 5 additions & 8 deletions source/texk/web2c/uptexdir/kanji.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define IVS_CHAR_LIMIT 0x4400000
#define CJK_CHAR_LIMIT 0x1000000
#define LATIN_CHAR_LIMIT 0x2E80
#define LATIN_UCS_FLAG 0x800000
#define CJK_TOKEN_FLAG 0xFFFFFF
#define CAT_LEFT_BRACE 1
#define CAT_DELIM_NUM 15
#define KCAT_KANJI 16
#define KCAT_MODIFIER 20
Expand All @@ -25,9 +25,9 @@ boolean check_kanji (integer c)

c0 = c & CJK_TOKEN_FLAG;
c1 = XXHi(c);
if (c1<=CAT_DELIM_NUM && (c0 & LATIN_UCS_FLAG) &&
(c0 - LATIN_UCS_FLAG) < LATIN_CHAR_LIMIT) { /* kcatcode latin_ucs */
return is_char_kanji(c0 - LATIN_UCS_FLAG);
if (c1>=CAT_LEFT_BRACE && c1<=CAT_DELIM_NUM &&
c0 < LATIN_CHAR_LIMIT) { /* kcatcode latin_ucs */
return is_char_kanji(c0);
}
else if (c1>=KCAT_KANJI && c1<=KCAT_MODIFIER) {
return is_char_kanji(c0);
Expand Down Expand Up @@ -86,11 +86,8 @@ integer ktoken_to_chr(integer c)
{
if (c > KCAT_KANJI_IVS * CJK_CHAR_LIMIT)
return (c - KCAT_KANJI_IVS * CJK_CHAR_LIMIT);
else {
if (XXHi(c)<=CAT_DELIM_NUM && (c & LATIN_UCS_FLAG))
c = c - LATIN_UCS_FLAG;
else
return (c % CJK_CHAR_LIMIT);
}
}

/* Ref. http://www.unicode.org/Public/UNIDATA/Blocks.txt */
Expand Down
11 changes: 5 additions & 6 deletions source/texk/web2c/uptexdir/uptex-m.ch
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ else if (kcode_pos=1)or((kcode_pos>=@'11)and(kcode_pos<=@'12))
@d max_ivs_val=@"4400000 {to separate wchar with ivs and kcatcode}
@d max_ucs_val=@"110000 {largest Unicode Scalar Value}
@d max_latin_val=@"2E80
@d latin_ucs_flag=@"800000
@z

@x
Expand Down Expand Up @@ -639,7 +638,7 @@ if cat=other_kchar then k:=k-multilenbuffchar(cur_chr)+1; {now |k| points to fir
else
cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
else if (cur_cmd=latin_ucs) then
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr+latin_ucs_flag
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr
else cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z

Expand Down Expand Up @@ -674,7 +673,7 @@ if cat=other_kchar then k:=k-multilenbuffchar(cur_chr)+1; {now |k| points to fir
else
cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
else if (cur_cmd=latin_ucs) then
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr+latin_ucs_flag
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr
else cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z
Expand All @@ -689,7 +688,7 @@ if cat=other_kchar then k:=k-multilenbuffchar(cur_chr)+1; {now |k| points to fir
else
cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
else if (cur_cmd=latin_ucs) then
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr+latin_ucs_flag
cur_tok:=(cat_code(cur_chr)*max_cjk_val)+cur_chr
else cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z

Expand Down Expand Up @@ -808,7 +807,7 @@ while k<pool_ptr do
begin t:=so(str_pool[k]);
if t>=@"180 then { there is no |wchar_token| whose code is 0--127. }
begin t:=fromBUFFshort(str_pool, pool_ptr, k); cc:=kcat_code(kcatcodekey(t));
if (cc=latin_ucs) then begin cc:=other_char; t:=t+latin_ucs_flag; end;
if (cc=latin_ucs) then cc:=other_char;
if (cc=not_cjk) then cc:=other_kchar;
if (cc=kanji)and(t>=max_cjk_val) then cc:=kanji_ivs;
t:=t+cc*max_cjk_val;
Expand Down Expand Up @@ -2126,7 +2125,7 @@ begin if is_char_node(link(p)) then
else if cur_cmd=not_cjk then
info(main_p):=KANJI(cur_chr)+other_kchar*max_cjk_val
else if cur_cmd=latin_ucs then
info(main_p):=KANJI(cur_chr)+cat_code(cur_chr)*max_cjk_val+latin_ucs_flag
info(main_p):=KANJI(cur_chr)+cat_code(cur_chr)*max_cjk_val
else { Does this case occur? }
info(main_p):=KANJI(cur_chr)+kcat_code(kcatcodekey(KANJI(cur_chr)))*max_cjk_val;
@z
Expand Down

0 comments on commit 0fa0c33

Please sign in to comment.