Skip to content

Commit

Permalink
[uptex] implement ^^^^xxyy (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-tk committed Jun 23, 2024
1 parent 5a74e9a commit 8d3be7e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
6 changes: 3 additions & 3 deletions source/texk/web2c/euptexdir/tests/eup-ofm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
\catcode"C6=11 \catcode"D8=11 \catcode"DF=11
\catcode"E6=11 \catcode"F8=11

\char"C6\char"D8\char"DF\char"E6\char"F8
\char"C6\char"D8\char"DF^^e6^^^^00f8

ÆØßæø

Expand All @@ -54,14 +54,14 @@
\catcode"393=11 \catcode"394=11 \catcode"398=11
\catcode"39B=11 \catcode"39E=11

\char"393\char"394\char"398\char"39B\char"39E
\char"393\char"394\char"398\char"39B^^^^039e

ΓΔΘΛΞ

\kcatcode"2010=14
\catcode"2010=11 \catcode"2018=11 \catcode"2019=11

\char"2010\char"2018\char"2019
\char"2010\char"2018^^^^2019

‐‘’

Expand Down
6 changes: 3 additions & 3 deletions source/texk/web2c/uptexdir/tests/up-ofm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
\catcode"C6=11 \catcode"D8=11 \catcode"DF=11
\catcode"E6=11 \catcode"F8=11

\char"C6\char"D8\char"DF\char"E6\char"F8
\char"C6\char"D8\char"DF^^e6^^^^00f8

ÆØßæø

Expand All @@ -54,14 +54,14 @@
\catcode"393=11 \catcode"394=11 \catcode"398=11
\catcode"39B=11 \catcode"39E=11

\char"393\char"394\char"398\char"39B\char"39E
\char"393\char"394\char"398\char"39B^^^^039e

ΓΔΘΛΞ

\kcatcode"2010=14
\catcode"2010=11 \catcode"2018=11 \catcode"2019=11

\char"2010\char"2018\char"2019
\char"2010\char"2018^^^^2019

‐‘’

Expand Down
42 changes: 42 additions & 0 deletions source/texk/web2c/uptexdir/uptex-m.ch
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ if ((kcp mod @'10)>0)and(nrestmultichr(kcp)>0) then p:=p-(kcp mod @'10);
s:=get_avail; info(s):=ktokentochr(info(loc));
@z
@x
@!c,@!cc:ASCII_code; {constituents of a possible expanded code}
@!d:2..3; {number of excess characters in an expanded code}
@y
@!c,@!cc,@!cd,@!ce:ASCII_code; {constituents of a possible expanded code}
@!d:2..7; {number of excess characters in an expanded code}
@z
@x
begin cur_chr:=buffer[loc]; incr(loc);
if multistrlen(ustringcast(buffer), limit+1, loc-1)=2 then
Expand Down Expand Up @@ -481,6 +489,40 @@ hangul_code(mid_kanji):
state:=mid_line;
@z
@x
@d hex_to_cur_chr==
if c<="9" then cur_chr:=c-"0" @+else cur_chr:=c-"a"+10;
if cc<="9" then cur_chr:=16*cur_chr+cc-"0"
else cur_chr:=16*cur_chr+cc-"a"+10
@y
@d hex_to_cur_chr==
if c<="9" then cur_chr:=c-"0" @+else cur_chr:=c-"a"+10;
if cc<="9" then cur_chr:=16*cur_chr+cc-"0"
else cur_chr:=16*cur_chr+cc-"a"+10
@d long_hex_to_cur_chr==
if c<="9" then cur_chr:=c-"0" @+else cur_chr:=c-"a"+10;
if cc<="9" then cur_chr:=16*cur_chr+cc-"0"
else cur_chr:=16*cur_chr+cc-"a"+10;
if cd<="9" then cur_chr:=16*cur_chr+cd-"0"
else cur_chr:=16*cur_chr+cd-"a"+10;
if ce<="9" then cur_chr:=16*cur_chr+ce-"0"
else cur_chr:=16*cur_chr+ce-"a"+10
@z
@x
begin c:=buffer[loc+1]; @+if c<@'200 then {yes we have an expanded char}
@y
begin if (cur_chr=buffer[loc+1]) and (cur_chr=buffer[loc+2]) and
((loc+6)<=limit) then
begin c:=buffer[loc+3]; cc:=buffer[loc+4];
cd:=buffer[loc+5]; ce:=buffer[loc+6];
if is_hex(c) and is_hex(cc) and is_hex(cd) and is_hex(ce) then
begin loc:=loc+7; long_hex_to_cur_chr; goto reswitch;
end
end;
c:=buffer[loc+1]; @+if c<@'200 then {yes we have an expanded char}
@z
@x
else begin k:=loc; cur_chr:=buffer[k]; incr(k);
if multistrlen(ustringcast(buffer), limit+1, k-1)=2 then
Expand Down

0 comments on commit 8d3be7e

Please sign in to comment.