1% This is a change file for upTeX u1.20 2% By Takuji Tanaka. 3% 4% (02/26/2007) TTK upTeX u0.01 5% (03/18/2007) TTK upTeX u0.03 6% (04/08/2007) TTK upTeX u0.05 7% (04/15/2007) TTK upTeX u0.06 8% (05/13/2007) TTK upTeX u0.07 9% (05/28/2007) TTK upTeX u0.08 10% (06/16/2007) TTK upTeX u0.09 11% (07/28/2007) TTK upTeX u0.10 12% (08/07/2007) TTK upTeX u0.11 13% (08/25/2007) TTK upTeX u0.12 14% (09/15/2007) TTK upTeX u0.13 15% (09/25/2007) TTK upTeX u0.14 16% (10/18/2007) TTK upTeX u0.15 17% (11/10/2007) TTK upTeX u0.16 18% (11/13/2007) TTK upTeX u0.17 19% (12/08/2007) TTK upTeX u0.18 20% (12/26/2007) TTK upTeX u0.19 21% (01/12/2008) TTK upTeX u0.20 22% (03/13/2008) TTK upTeX u0.21 23% (08/03/2008) TTK upTeX u0.22 24% (09/04/2008) TTK upTeX u0.23 25% (10/18/2008) TTK upTeX u0.24 26% (12/13/2008) TTK upTeX u0.25 27% (02/21/2009) TTK upTeX u0.26 28% (03/12/2009) TTK upTeX u0.27 29% (08/23/2009) TTK upTeX u0.28 30% (01/31/2010) TTK upTeX u0.29 31% (04/10/2010) TTK upTeX u0.30 32% (01/15/2012) TTK upTeX u1.00 33% (04/29/2012) TTK upTeX u1.10 34% (08/13/2012) TTK upTeX u1.11 35% (12/29/2014) TTK upTeX u1.20 36 37@x upTeX: banner 38 {printed when p\TeX\ starts} 39@y 40 {printed when p\TeX\ starts} 41@# 42@d upTeX_version=1 43@d upTeX_revision==".20" 44@d upTeX_version_string=='-u1.20' {current up\TeX\ version} 45@# 46@d upTeX_banner=='This is upTeX, Version 3.14159265',pTeX_version_string,upTeX_version_string 47@d upTeX_banner_k==upTeX_banner 48 {printed when up\TeX\ starts} 49@z 50 51@x upTeX: banner 52@d banner==pTeX_banner 53@d banner_k==pTeX_banner_k 54@y 55@d banner==upTeX_banner 56@d banner_k==upTeX_banner_k 57@z 58 59@x 60@!KANJI_code=0..65535; {sixteen-bit numbers} 61@y 62@!KANJI_code=0..@"FFFFFF; {0..0x10FFFF: Unicode, 0x110000..0xFFFFFF: special} 63@z 64 65@x 66@!trick_buf2:array[0..ssup_error_line] of 0..2; {pTeX: buffer for KANJI} 67@!kcode_pos: 0..2; {pTeX: denotes whether first byte or second byte of KANJI} 68@y 69@!trick_buf2:array[0..ssup_error_line] of 0..@'24; {pTeX: buffer for KANJI} 70@!kcode_pos: 0..@'24; {pTeX: denotes whether first byte or second byte of KANJI 71 1..2:2byte-char, 11..13:3byte-char, 21..24:4byte-char} 72@!kcp: 0..@'24; {temporary kcode_pos} 73@z 74 75@x 76procedure print_ln; {prints an end-of-line} 77@y 78procedure print_ln; {prints an end-of-line} 79var @!ii: integer; 80@z 81 82@x 83 if kcode_pos=1 then begin wterm(' '); wlog(' '); end; 84@y 85 if nrestmultichr(kcode_pos)>0 then 86 for ii:=0 to nrestmultichr(kcode_pos)-1 do 87 begin wterm(' '); wlog(' '); end; 88@z 89 90@x 91log_only: begin if kcode_pos=1 then wlog(' '); 92@y 93log_only: begin 94 if nrestmultichr(kcode_pos)>0 then 95 for ii:=0 to nrestmultichr(kcode_pos)-1 do wlog(' '); 96@z 97 98@x 99term_only: begin if kcode_pos=1 then wterm(' '); 100@y 101term_only: begin 102 if nrestmultichr(kcode_pos)>0 then 103 for ii:=0 to nrestmultichr(kcode_pos)-1 do wterm(' '); 104@z 105 106@x 107if kcode_pos=1 then kcode_pos:=2 108@y 109if (kcode_pos=1)or((kcode_pos>=@'11)and(kcode_pos<=@'12)) 110 or((kcode_pos>=@'21)and(kcode_pos<=@'23)) then incr(kcode_pos) 111@z 112 113@x 114 begin kcode_pos:=1; 115@y 116 begin 117 if (ismultichr(4,1,xchr[s])) then kcode_pos:=@'21 118 else if (ismultichr(3,1,xchr[s])) then kcode_pos:=@'11 119 else kcode_pos:=1; 120@z 121 122@x 123 if file_offset>=max_print_line-1 then 124@y 125 if file_offset>=max_print_line-nrestmultichr(kcode_pos) then 126@z 127 128@x 129 if term_offset>=max_print_line-1 then 130@y 131 if term_offset>=max_print_line-nrestmultichr(kcode_pos) then 132@z 133 134@x 135@d min_quarterword=0 {smallest allowable value in a |quarterword|} 136@d max_quarterword=255 {largest allowable value in a |quarterword|} 137@d min_halfword==-@"FFFFFFF {smallest allowable value in a |halfword|} 138@d max_halfword==@"FFFFFFF {largest allowable value in a |halfword|} 139@y 140@d min_quarterword=0 {smallest allowable value in a |quarterword|} 141@d max_quarterword=@"FFFF {largest allowable value in a |quarterword|} 142@d min_halfword=-@"3FFFFFFF {smallest allowable value in a |halfword|} 143@d max_halfword=@"3FFFFFFF {largest allowable value in a |halfword|} 144@d max_cjk_val=@"1000000 {to separate wchar and kcatcode} 145@z 146 147@x 148@d xspace_ptr(#) == info(#+space_offset) 149@y 150@d xspace_ptr(#) == info(#+space_offset) 151@d read_sixteenx(#)==begin #:=fbyte; 152 if #>255 then abort; 153 fget; #:=#*@'400+fbyte; 154 end 155@z 156 157@x 158@d kanji=16 {kanji} 159@d kana=17 {hiragana, katakana, alphabet} 160@d other_kchar=18 {kanji codes} 161@d max_char_code=18 {largest catcode for individual characters} 162@y 163@d not_cjk=15 {is not cjk characters} 164@d kanji=16 {kanji} 165@d kana=17 {hiragana, katakana, alphabet} 166@d other_kchar=18 {cjk symbol codes} 167@d hangul=19 {hangul codes} 168@d max_char_code=19 {largest catcode for individual characters} 169@z 170 171@x 172@d math_comp=left_right+1 {component of formula ( \.{\\mathbin}, etc.~)} 173@y 174@d kchar_num=left_right+1 {cjk character specified numerically ( \.{\\kchar} )} 175@d math_comp=kchar_num+1 {component of formula ( \.{\\mathbin}, etc.~)} 176@z 177 178@x 179@d math_given=char_given+1 {math code defined by \.{\\mathchardef}} 180@y 181@d kchar_given=char_given+1 {cjk character code defined by \.{\\kchardef}} 182@d math_given=kchar_given+1 {math code defined by \.{\\mathchardef}} 183@z 184 185@x 186@d max_command=set_auto_spacing {the largest command code seen at |big_switch|} 187@y 188@d set_enable_cjk_token=set_auto_spacing+1 {set cjk mode ( \.{\\enablecjktoken}, \.{\\disablecjktoken}, \.{\\forcecjktoken} )} 189@d max_command=set_enable_cjk_token {the largest command code seen at |big_switch|} 190@z 191 192@x 193@d cat_code_base=auto_xspacing_code+1 194 {table of 256 command codes (the ``catcodes'')} 195@d kcat_code_base=cat_code_base+256 196 {table of 256 command codes for the wchar's catcodes } 197@d auto_xsp_code_base=kcat_code_base+256 {table of 256 auto spacer flag} 198@y 199@d enable_cjk_token_code=auto_xspacing_code+1 200@d cat_code_base=enable_cjk_token_code+1 201 {table of 256 command codes (the ``catcodes'')} 202@d kcat_code_base=cat_code_base+256 203 {table of 512 command codes for the wchar's catcodes } 204@d auto_xsp_code_base=kcat_code_base+512 {table of 256 auto spacer flag} 205@z 206 207@x 208@d auto_xspacing==equiv(auto_xspacing_code) 209@y 210@d auto_xspacing==equiv(auto_xspacing_code) 211@d enable_cjk_token==equiv(enable_cjk_token_code) 212@z 213 214@x 215eqtb[auto_xspacing_code]:=eqtb[cat_code_base]; 216for k:=0 to 255 do 217 begin cat_code(k):=other_char; kcat_code(k):=other_kchar; 218 math_code(k):=hi(k); sf_code(k):=1000; 219 auto_xsp_code(k):=0; inhibit_xsp_code(k):=0; inhibit_xsp_type(k):=0; 220 kinsoku_code(k):=0; kinsoku_type(k):=0; 221 end; 222@y 223eqtb[auto_xspacing_code]:=eqtb[cat_code_base]; 224eqtb[enable_cjk_token_code]:=eqtb[cat_code_base]; 225for k:=0 to 255 do 226 begin cat_code(k):=other_char; 227 math_code(k):=hi(k); sf_code(k):=1000; 228 auto_xsp_code(k):=0; inhibit_xsp_code(k):=0; inhibit_xsp_type(k):=0; 229 kinsoku_code(k):=0; kinsoku_type(k):=0; 230 end; 231for k:=0 to 512 do 232 begin kcat_code(k):=other_kchar; 233 end; 234@z 235 236@x 237@t\hskip10pt@>kcat_code(@"20+1):=other_kchar; {1 ku} 238@t\hskip10pt@>kcat_code(@"20+2):=other_kchar; {2 ku} 239@+@t\1@>for k:=3 to 6 do kcat_code(@"20+k):=kana; {3 ku ... 6 ku} 240@+@t\1@>for k:=7 to 8 do kcat_code(@"20+k):=other_kchar; {7 ku ... 8 ku} 241@+@t\1@>for k:=16 to 84 do kcat_code(@"20+k):=kanji; {16 ku ... 84 ku} 242{ $\.{@@"20}+|k| = |kcatcodekey|(|fromKUTEN|(|HILO|(k,1))$ } 243@y 244if (isinternalUPTEX) then begin 245 { default: other_kchar } 246 @t\hskip10pt@>kcat_code(@"0):=not_cjk; 247 @t\hskip10pt@>kcat_code(@"23):=hangul; { Hangul Jamo } 248 @+@t\1@>for k:=@"64 to @"66 do kcat_code(k):=kanji; { CJK Radicals Supplement .. Ideographic Description Characters } 249 @+@t\1@>for k:=@"68 to @"69 do kcat_code(k):=kana; { Hiragana, Katakana } 250 @t\hskip10pt@>kcat_code(@"6A):=kanji; { Bopomofo } 251 @t\hskip10pt@>kcat_code(@"6B):=hangul; { Hangul Compatibility Jamo } 252 @+@t\1@>for k:=@"6C to @"6E do kcat_code(k):=kanji; { Kanbun .. CJK Strokes } 253 @t\hskip10pt@>kcat_code(@"6F):=kana; { Katakana Phonetic Extensions } 254 @t\hskip10pt@>kcat_code(@"72):=kanji; { CJK Unified Ideographs Extension A } 255 @t\hskip10pt@>kcat_code(@"74):=kanji; { CJK Unified Ideographs } 256 @t\hskip10pt@>kcat_code(@"84):=hangul; { Hangul Jamo Extended-A } 257 @t\hskip10pt@>kcat_code(@"8E):=hangul; { Hangul Syllables } 258 @t\hskip10pt@>kcat_code(@"8F):=hangul; { Hangul Jamo Extended-B } 259 @t\hskip10pt@>kcat_code(@"94):=kanji; { CJK Compatibility Ideographs } 260 { @t\hskip10pt@>kcat_code(@"9D):=other_kchar; Halfwidth and Fullwidth Forms } 261 @t\hskip10pt@>kcat_code(@"DD):=kana; { Kana Supplement } 262 @+@t\1@>for k:=@"F4 to @"F7 do kcat_code(k):=kanji; { CJK Unified Ideographs Extension B .. CJK Compatibility Ideographs Supplement } 263 @t\hskip10pt@>kcat_code(@"1FE):=kana; { Fullwidth digit and latin alphabet } 264 @t\hskip10pt@>kcat_code(@"1FF):=kana; { Halfwidth katakana } 265end else begin 266 @t\hskip10pt@>kcat_code(@"20+1):=other_kchar; {1 ku} 267 @t\hskip10pt@>kcat_code(@"20+2):=other_kchar; {2 ku} 268 @+@t\1@>for k:=3 to 6 do kcat_code(@"20+k):=kana; {3 ku ... 6 ku} 269 @+@t\1@>for k:=7 to 13 do kcat_code(@"20+k):=other_kchar; {7 ku ... 13 ku} 270 @+@t\1@>for k:=14 to 120 do kcat_code(@"20+k):=kanji; {14 ku ... 120 ku} 271 { $\.{@@"20}+|k| = |kcatcodekey|(|fromKUTEN|(|HILO|(k,1))$ } 272 @+@t\1@>for k:=16 to 94 do kcat_code(@"A0+k):=kanji; {2 men 16 ku ... 94 ku} 273end; 274@z 275 276@x l.5897 - upTeX 277primitive("char",char_num,0);@/ 278@!@:char_}{\.{\\char} primitive@> 279@y 280primitive("char",char_num,0);@/ 281@!@:char_}{\.{\\char} primitive@> 282primitive("kchar",kchar_num,0);@/ 283@!@:kchar_}{\.{\\kchar} primitive@> 284@z 285 286@x 287ital_corr: print_esc("/"); 288@y 289ital_corr: print_esc("/"); 290kchar_num: print_esc("kchar"); 291@z 292 293@x 294@d cs_token_flag==@"FFFF {amount added to the |eqtb| location in a 295token that stands for a control sequence; is a multiple of~256, less~1} 296@d left_brace_token=@'0400 {$2^8\cdot|left_brace|$} 297@d left_brace_limit=@'1000 {$2^8\cdot(|left_brace|+1)$} 298@d right_brace_token=@'1000 {$2^8\cdot|right_brace|$} 299@d right_brace_limit=@'1400 {$2^8\cdot(|right_brace|+1)$} 300@d math_shift_token=@'1400 {$2^8\cdot|math_shift|$} 301@d tab_token=@'2000 {$2^8\cdot|tab_mark|$} 302@d out_param_token=@'2400 {$2^8\cdot|out_param|$} 303@d space_token=@'5040 {$2^8\cdot|spacer|+|" "|$} 304@d letter_token=@'5400 {$2^8\cdot|letter|$} 305@d other_token=@'6000 {$2^8\cdot|other_char|$} 306@d match_token=@'6400 {$2^8\cdot|match|$} 307@d end_match_token=@'7000 {$2^8\cdot|end_match|$} 308@y 309@d cs_token_flag=@"1FFFFFFF {amount added to the |eqtb| location in a 310 token that stands for a control sequence; is a multiple of~@"1000000, less~1} 311@d max_char_val=@"100 {to separate char and command code} 312@d left_brace_token=@"100 {$2^8\cdot|left_brace|$} 313@d left_brace_limit=@"200 {$2^8\cdot(|left_brace|+1)$} 314@d right_brace_token=@"200 {$2^8\cdot|right_brace|$} 315@d right_brace_limit=@"300 {$2^8\cdot(|right_brace|+1)$} 316@d math_shift_token=@"300 {$2^8\cdot|math_shift|$} 317@d tab_token=@"400 {$2^8\cdot|tab_mark|$} 318@d out_param_token=@"500 {$2^8\cdot|out_param|$} 319@d space_token=@"A20 {$2^8\cdot|spacer|+|" "|$} 320@d letter_token=@"B00 {$2^8\cdot|letter|$} 321@d other_token=@"C00 {$2^8\cdot|other_char|$} 322@d match_token=@"D00 {$2^8\cdot|match|$} 323@d end_match_token=@"E00 {$2^8\cdot|end_match|$} 324@z 325 326@x 327 if check_kanji(info(p)) then {|wchar_token|} 328 begin m:=kcat_code(kcatcodekey(info(p))); c:=info(p); 329 end 330 else begin m:=Hi(info(p)); c:=Lo(info(p)); 331@y 332 if check_kanji(info(p)) then {|wchar_token|} 333 begin m:=info(p) div max_cjk_val; c:=info(p) mod max_cjk_val; end 334 else begin m:=info(p) div max_char_val; c:=info(p) mod max_char_val; 335@z 336 337@x 338kanji,kana,other_kchar: print_kanji(KANJI(c)); 339@y 340kanji,kana,other_kchar,hangul: print_kanji(KANJI(c)); 341@z 342 343@x 344kanji,kana,other_kchar: begin print("kanji character "); 345@y 346kanji,kana,other_kchar,hangul: begin print("kanji character "); 347@z 348 349@x 350 if (first_count>0)and(trick_buf2[(first_count-1)mod error_line]=1) then 351 incr(first_count); 352@y 353 kcp:=trick_buf2[(first_count-1)mod error_line]; 354 if (first_count>0)and(kcp>0) then 355 first_count:=first_count+nrestmultichr(kcp); 356@z 357 358@x 359if trick_buf2[p mod error_line]=2 then 360 begin p:=p+1; n:=n-1; 361 end; 362@y 363kcp:=trick_buf2[p mod error_line]; 364if (kcp mod @'10)>1 then begin 365 p:=p+nrestmultichr(kcp)+1; n:=n-nrestmultichr(kcp)-1; end; 366@z 367 368@x 369if trick_buf2[(p-1) mod error_line]=1 then p:=p-1; 370@y 371kcp:=trick_buf2[(p-1) mod error_line]; 372if ((kcp mod @'10)>0)and(nrestmultichr(kcp)>0) then p:=p-(kcp mod @'10); 373@z 374 375@x 376 s:=get_avail; info(s):=Lo(info(loc)); 377@y 378 s:=get_avail; info(s):=(info(loc) mod max_char_val); 379@z 380 381@x 382 begin cur_chr:=buffer[loc]; incr(loc); 383 if multistrlen(ustringcast(buffer), limit+1, loc-1)=2 then 384 begin cur_chr:=fromBUFF(ustringcast(buffer), limit+1, loc-1); 385 cur_cmd:=kcat_code(kcatcodekey(cur_chr)); 386 incr(loc); 387 end 388 else reswitch: cur_cmd:=cat_code(cur_chr); 389@y 390 begin 391 cur_chr:=fromBUFF(ustringcast(buffer), limit, loc); 392 cur_cmd:=kcat_code(kcatcodekey(cur_chr)); 393 if (multistrlen(ustringcast(buffer), limit, loc)>1) and check_kcat_code(cur_cmd) then begin 394 if (cur_cmd=not_cjk) then cur_cmd:=other_kchar; 395 loc:=loc+multistrlen(ustringcast(buffer), limit, loc) end 396 else begin 397 cur_chr:=buffer[loc]; incr(loc); 398 reswitch: cur_cmd:=cat_code(cur_chr); 399 end; 400@z 401 402@x 403@ @d add_delims_to(#)==#+math_shift,#+tab_mark,#+mac_param, 404 #+sub_mark,#+letter,#+other_char 405@d all_jcode(#)==#+kanji,#+kana,#+other_kchar 406@y 407@ @d add_delims_to(#)==#+math_shift,#+tab_mark,#+mac_param, 408 #+sub_mark,#+letter,#+other_char 409@d all_jcode(#)==#+kanji,#+kana,#+other_kchar 410@d hangul_code(#)==#+hangul 411@z 412 413@x 414all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line): 415 state:=mid_kanji; 416@y 417all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line): 418 state:=mid_kanji; 419hangul_code(skip_blanks),hangul_code(new_line),hangul_code(mid_kanji): 420 state:=mid_line; 421@z 422 423@x 424else begin k:=loc; cur_chr:=buffer[k]; incr(k); 425 if multistrlen(ustringcast(buffer), limit+1, k-1)=2 then 426 begin cat:=kcat_code(kcatcodekey(fromBUFF(ustringcast(buffer), limit+1, k-1))); incr(k); 427 end 428 else cat:=cat_code(cur_chr); 429start_cs: 430 if (cat=letter)or(cat=kanji)or(cat=kana) then state:=skip_blanks 431@y 432else begin k:=loc; 433 cur_chr:=fromBUFF(ustringcast(buffer), limit, k); 434 cat:=kcat_code(kcatcodekey(cur_chr)); 435 if (multistrlen(ustringcast(buffer), limit, k)>1) and check_kcat_code(cat) then begin 436 if (cat=not_cjk) then cat:=other_kchar; 437 k:=k+multistrlen(ustringcast(buffer), limit, k) end 438 else begin {not multi-byte char} 439 cur_chr:=buffer[k]; 440 cat:=cat_code(cur_chr); 441 incr(k); 442 end; 443start_cs: 444 if (cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul) then state:=skip_blanks 445@z 446 447@x 448 else if ((cat=letter)or(cat=kanji)or(cat=kana))and(k<=limit) then 449@y 450 else if ((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul))and(k<=limit) then 451@z 452 453@x 454begin repeat cur_chr:=buffer[k]; incr(k); 455 if multistrlen(ustringcast(buffer), limit+1, k-1)=2 then 456 begin cat:=kcat_code(kcatcodekey(fromBUFF(ustringcast(buffer), limit+1, k-1))); incr(k); 457 end 458 else cat:=cat_code(cur_chr); 459@y 460begin repeat 461 cur_chr:=fromBUFF(ustringcast(buffer), limit, k); 462 cat:=kcat_code(kcatcodekey(cur_chr)); 463 if (multistrlen(ustringcast(buffer), limit, k)>1) and check_kcat_code(cat) then begin 464 if (cat=not_cjk) then cat:=other_kchar; 465 k:=k+multistrlen(ustringcast(buffer), limit, k) end 466 else begin {not multi-byte char} 467 cur_chr:=buffer[k]; 468 cat:=cat_code(cur_chr); 469 incr(k); 470 end; 471@z 472 473@x 474until not((cat=letter)or(cat=kanji)or(cat=kana))or(k>limit); 475{@@<If an expanded...@@>;} 476if not((cat=letter)or(cat=kanji)or(cat=kana)) then decr(k); 477if cat=other_kchar then decr(k); {now |k| points to first nonletter} 478@y 479until not((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul))or(k>limit); 480{@@<If an expanded...@@>;} 481if not((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul)) then decr(k); 482if cat=other_kchar then k:=k-multilenbuffchar(cur_chr)+1; {now |k| points to first nonletter} 483@z 484 485@x 486 else if check_kanji(t) then {|wchar_token|} 487 begin cur_chr:=t; cur_cmd:=kcat_code(kcatcodekey(t)); 488 end 489 else 490 begin cur_cmd:=Hi(t); cur_chr:=Lo(t); 491@y 492 else if check_kanji(t) then {|wchar_token|} 493 begin cur_cmd:=t div max_cjk_val; cur_chr:=t mod max_cjk_val; end 494 else 495 begin cur_cmd:=t div max_char_val; cur_chr:=t mod max_char_val; 496@z 497 498@x 499 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|} 500 cur_tok:=cur_chr 501 else cur_tok:=(cur_cmd*@'400)+cur_chr 502@y 503 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|} 504 cur_tok:=(cur_cmd*max_cjk_val)+cur_chr 505 else cur_tok:=(cur_cmd*max_char_val)+cur_chr 506@z 507 508@x 509 if check_kanji(info(p)) then {|wchar_token|} 510 begin buffer[j]:=Hi(info(p)); incr(j); 511 end; 512 buffer[j]:=Lo(info(p)); incr(j); p:=link(p); 513@y 514 if check_kanji(info(p)) then {|wchar_token|} 515 begin t:=toBUFF(info(p) mod max_cjk_val); 516 if BYTE1(t)<>0 then begin buffer[j]:=BYTE1(t); incr(j); end; 517 if BYTE2(t)<>0 then begin buffer[j]:=BYTE2(t); incr(j); end; 518 if BYTE3(t)<>0 then begin buffer[j]:=BYTE3(t); incr(j); end; 519 buffer[j]:=BYTE4(t); incr(j); 520 p:=link(p); 521 end 522 else 523 begin buffer[j]:=info(p) mod max_char_val; incr(j); p:=link(p); 524 end; 525@z 526 527@x 528 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 529 cur_tok:=cur_chr 530 else cur_tok:=(cur_cmd*@'400)+cur_chr 531@y 532 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 533 cur_tok:=(cur_cmd*max_cjk_val)+cur_chr 534 else cur_tok:=(cur_cmd*max_char_val)+cur_chr 535@z 536 537@x 538 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 539 cur_tok:=cur_chr 540 else cur_tok:=(cur_cmd*@'400)+cur_chr 541@y 542 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 543 cur_tok:=(cur_cmd*max_cjk_val)+cur_chr 544 else cur_tok:=(cur_cmd*max_char_val)+cur_chr 545@z 546 547@x 548char_given,math_given: scanned_result(cur_chr)(int_val); 549@y 550kchar_given, 551char_given,math_given: scanned_result(cur_chr)(int_val); 552@z 553 554@x 555 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|} 556@y 557 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|} 558@z 559 560@x 561@!t:halfword; {token being appended} 562@!k:pool_pointer; {index into |str_pool|} 563begin str_room(1); 564p:=temp_head; link(p):=null; k:=b; 565while k<pool_ptr do 566 begin t:=so(str_pool[k]); 567 if multistrlen(ustringcast(str_pool), pool_ptr, k)=2 then 568 begin t:=fromBUFF(ustringcast(str_pool), pool_ptr, k); incr(k); 569 end 570 else if t=" " then t:=space_token 571 else t:=other_token+t; 572@y 573@!t:halfword; {token being appended} 574@!k:pool_pointer; {index into |str_pool|} 575@!cc:escape..max_char_code; 576begin str_room(1); 577p:=temp_head; link(p):=null; k:=b; 578while k<pool_ptr do 579 begin t:=fromBUFF(ustringcast(str_pool), pool_ptr, k); 580 cc:=kcat_code(kcatcodekey(t)); 581 if (multistrlen(ustringcast(str_pool), pool_ptr, k)>1)and 582 check_kcat_code(cc) then 583 begin if (cc=not_cjk) then cc:=other_kchar; 584 t:=t+cc*max_cjk_val; 585 k:=k+multistrlen(ustringcast(str_pool), pool_ptr, k)-1; 586 end 587 else begin t:=so(str_pool[k]); 588 if t=" " then t:=space_token 589 else t:=other_token+t; 590 end; 591@z 592 593@x 594@d ptex_convert_codes=10 {end of \pTeX's command codes} 595@y 596@d ucs_code=10 {command code for \.{\\ucs}} 597@d ptex_convert_codes=11 {end of \pTeX's command codes} 598@z 599 600@x 601@!@:kuten_}{\.{\\kuten} primitive@> 602@y 603@!@:kuten_}{\.{\\kuten} primitive@> 604primitive("ucs",convert,ucs_code); 605@!@:ucs_}{\.{\\ucs} primitive@> 606@z 607 608@x 609 kuten_code:print_esc("kuten"); 610@y 611 kuten_code:print_esc("kuten"); 612 ucs_code:print_esc("ucs"); 613@z 614 615@x 616kansuji_code,euc_code,sjis_code,jis_code,kuten_code: scan_int; 617string_code, meaning_code: begin save_scanner_status:=scanner_status; 618 scanner_status:=normal; get_token; 619 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|} 620@y 621kansuji_code,euc_code,sjis_code,jis_code,kuten_code,ucs_code: scan_int; 622string_code, meaning_code: begin save_scanner_status:=scanner_status; 623 scanner_status:=normal; get_token; 624 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|} 625@z 626 627@x 628kuten_code: print_int(fromKUTEN(cur_val)); 629@y 630kuten_code: print_int(fromKUTEN(cur_val)); 631ucs_code: print_int(fromUCS(cur_val)); 632@z 633 634@x 635if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 636@y 637if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 638@z 639 640@x 641get_x_token_or_active_char; 642if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 643@y 644get_x_token_or_active_char; 645if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 646@z 647 648@x 649 if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {is kanji} 650 begin str_room(2); 651 append_char(Hi(cur_chr)); {kanji upper byte} 652 append_char(Lo(cur_chr)); {kanji lower byte} 653@y 654 if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|} 655 begin str_room(4); {4 is maximum} 656 cur_chr:=toBUFF(cur_chr); 657 if BYTE1(cur_chr)<>0 then append_char(BYTE1(cur_chr)); 658 if BYTE2(cur_chr)<>0 then append_char(BYTE2(cur_chr)); 659 if BYTE3(cur_chr)<>0 then append_char(BYTE3(cur_chr)); 660 append_char(BYTE4(cur_chr)); 661@z 662 663@x 664 fget; read_sixteen(cx); font_info[k].hh.rh:=tokanji(cx); {|kchar_code|} 665@y 666 fget; read_sixteenx(cx); font_info[k].hh.rh:=tokanji(cx); {|kchar_code|} 667@z 668 669@x 670@d set2=129 {typeset a character and move right} 671@y 672@d set2=129 {typeset a character and move right} 673@d set3=130 {typeset a character and move right} 674@z 675 676@x 677 jc:=toDVI(KANJI(info(p))); 678 dvi_out(set2); dvi_out(Hi(jc)); dvi_out(Lo(jc)); 679@y 680 jc:=toDVI(KANJI(info(p)) mod max_cjk_val); 681 if (jc<@"10000) then begin 682 dvi_out(set2); 683 end else begin 684 dvi_out(set3); dvi_out(BYTE2(jc)); 685 end; 686 dvi_out(BYTE3(jc)); dvi_out(BYTE4(jc)); 687@z 688 689@x 690loop@+ begin get_x_token; 691 reswitch: case cur_cmd of 692 letter,other_char,char_given:@<Append a new letter or hyphen@>; 693 char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given; 694 goto reswitch; 695 end; 696@y 697loop@+ begin get_x_token; 698 reswitch: case cur_cmd of 699 letter,other_char,char_given,kchar_given:@<Append a new letter or hyphen@>; 700 char_num,kchar_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given; 701 goto reswitch; 702 end; 703@z 704 705@x 706hmode+kanji,hmode+kana,hmode+other_kchar: goto main_loop_j; 707hmode+char_given: 708 if is_char_ascii(cur_chr) then goto main_loop else goto main_loop_j; 709hmode+char_num: begin scan_char_num; cur_chr:=cur_val; 710 if is_char_ascii(cur_chr) then goto main_loop else goto main_loop_j; 711 end; 712hmode+no_boundary: begin get_x_token; 713 if (cur_cmd=letter)or(cur_cmd=other_char)or 714 (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar)or 715 (cur_cmd=char_given)or(cur_cmd=char_num) then cancel_boundary:=true; 716@y 717hmode+kanji,hmode+kana,hmode+other_kchar,hmode+hangul,hmode+kchar_given: goto main_loop_j; 718hmode+char_given: 719 if check_echar_range(cur_chr) then goto main_loop else goto main_loop_j; 720hmode+char_num: begin scan_char_num; cur_chr:=cur_val; 721 if check_echar_range(cur_chr) then goto main_loop else goto main_loop_j; 722 end; 723hmode+kchar_num: begin scan_char_num; cur_chr:=cur_val; 724 goto main_loop_j; 725 end; 726hmode+no_boundary: begin get_x_token; 727 if (cur_cmd=letter)or(cur_cmd=other_char)or 728 ((cur_cmd>=kanji)and(cur_cmd<=hangul))or 729 (cur_cmd=char_given)or(cur_cmd=char_num)or 730 (cur_cmd=kchar_given)or(cur_cmd=kchar_num) then cancel_boundary:=true; 731@z 732 733@x 734if cur_cmd=letter then goto main_loop_lookahead+1; 735if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 736 @<goto |main_lig_loop|@>; 737if cur_cmd=other_char then goto main_loop_lookahead+1; 738if cur_cmd=char_given then 739 begin if is_char_ascii(cur_chr) then goto main_loop_lookahead+1 740 else @<goto |main_lig_loop|@>; 741 end; 742x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|} 743if cur_cmd=letter then goto main_loop_lookahead+1; 744if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 745 @<goto |main_lig_loop|@>; 746if cur_cmd=other_char then goto main_loop_lookahead+1; 747if cur_cmd=char_given then 748 begin if is_char_ascii(cur_chr) then goto main_loop_lookahead+1 749 else @<goto |main_lig_loop|@>; 750 end; 751if cur_cmd=char_num then 752 begin scan_char_num; cur_chr:=cur_val; 753 if is_char_ascii(cur_chr) then goto main_loop_lookahead+1 754 else @<goto |main_lig_loop|@>; 755 end; 756@y 757if cur_cmd=letter then goto main_loop_lookahead+1; 758if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 759 @<goto |main_lig_loop|@>; 760if cur_cmd=other_char then goto main_loop_lookahead+1; 761if cur_cmd=char_given then 762 begin if check_echar_range(cur_chr) then goto main_loop_lookahead+1 763 else @<goto |main_lig_loop|@>; 764 end; 765if cur_cmd=kchar_given then 766 @<goto |main_lig_loop|@>; 767x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|} 768if cur_cmd=letter then goto main_loop_lookahead+1; 769if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 770 @<goto |main_lig_loop|@>; 771if cur_cmd=other_char then goto main_loop_lookahead+1; 772if cur_cmd=char_given then 773 begin if check_echar_range(cur_chr) then goto main_loop_lookahead+1 774 else @<goto |main_lig_loop|@>; 775 end; 776if cur_cmd=char_num then 777 begin scan_char_num; cur_chr:=cur_val; 778 if check_echar_range(cur_chr) then goto main_loop_lookahead+1 779 else @<goto |main_lig_loop|@>; 780 end; 781if cur_cmd=kchar_num then 782 begin scan_char_num; cur_chr:=cur_val; 783 @<goto |main_lig_loop|@>; 784 end; 785@z 786 787@x 788vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given, 789 vmode+math_shift,vmode+un_hbox,vmode+vrule, 790 vmode+accent,vmode+discretionary,vmode+hskip,vmode+valign, 791 vmode+kanji,vmode+kana,vmode+other_kchar, 792@y 793vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given, 794 vmode+kchar_num,vmode+kchar_given, 795 vmode+math_shift,vmode+un_hbox,vmode+vrule, 796 vmode+accent,vmode+discretionary,vmode+hskip,vmode+valign, 797 vmode+kanji,vmode+kana,vmode+other_kchar,vmode+hangul, 798@z 799 800@x 801if not is_char_ascii(cur_val) then 802 begin KANJI(cx):=cur_val; 803 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 804 p:=new_character(f,get_jfm_pos(KANJI(cx),f)); 805 if p<>null then 806 begin 807 link(p):=get_avail; info(link(p)):=KANJI(cx); 808 end; 809@y 810if check_echar_range(cur_val)=0 then 811 begin KANJI(cx):=cur_val; 812 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 813 p:=new_character(f,get_jfm_pos(KANJI(cx),f)); 814 if p<>null then 815 begin 816 link(p):=get_avail; 817 info(link(p)):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val; 818 end; 819@z 820 821@x 822if (cur_cmd=letter)or(cur_cmd=other_char) then 823 q:=new_character(f,cur_chr) 824else if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then 825 begin if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 826 cx:=cur_chr; 827 end 828else if cur_cmd=char_given then 829 if is_char_ascii(cur_chr) then q:=new_character(f,cur_chr) 830 else begin 831 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 832 KANJI(cx):=cur_chr 833 end 834 else if cur_cmd=char_num then 835 begin scan_char_num; 836 if is_char_ascii(cur_val) then q:=new_character(f,cur_val) 837 else begin 838 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 839 KANJI(cx):=cur_val 840 end 841 end 842@y 843if (cur_cmd=letter)or(cur_cmd=other_char) then 844 q:=new_character(f,cur_chr) 845else if (cur_cmd>=kanji)and(cur_cmd<=hangul) then 846 begin if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 847 cx:=cur_chr; 848 end 849else if cur_cmd=char_given then 850 if check_echar_range(cur_chr) then q:=new_character(f,cur_chr) 851 else begin 852 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 853 KANJI(cx):=cur_chr 854 end 855else if cur_cmd=char_num then 856 begin scan_char_num; 857 if check_echar_range(cur_val) then q:=new_character(f,cur_val) 858 else begin 859 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 860 KANJI(cx):=cur_val 861 end 862 end 863else if cur_cmd=kchar_given then 864 begin 865 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 866 KANJI(cx):=cur_chr 867 end 868else if cur_cmd=kchar_num then 869 begin scan_char_num; 870 if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; 871 KANJI(cx):=cur_val 872 end 873@z 874 875@x 876 begin q:=new_character(f,get_jfm_pos(KANJI(cx),f)); 877 link(q):=get_avail; info(link(q)):=KANJI(cx); last_jchr:=q; 878@y 879 begin q:=new_character(f,get_jfm_pos(KANJI(cx),f)); 880 link(q):=get_avail; 881 info(link(q)):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val; 882 last_jchr:=q; 883@z 884 885@x 886letter,other_char,char_given: 887 if (is_char_ascii(cur_chr) or (cur_chr=256)) then begin 888@y 889letter,other_char,char_given: 890 if (cur_chr>=0)and(cur_chr<=256) then begin 891@z 892 893@x 894 KANJI(cx):=cur_chr; 895kanji,kana,other_kchar: cx:=cur_chr; 896@y 897 KANJI(cx):=cur_chr; 898kchar_given: 899 KANJI(cx):=cur_chr; 900kanji,kana,other_kchar,hangul: cx:=cur_chr; 901@z 902 903@x 904 math_type(p):=math_jchar; fam(p):=cur_jfam; character(p):=qi(0); 905 math_kcode(p-1):=KANJI(cx); 906@y 907 math_type(p):=math_jchar; fam(p):=cur_jfam; character(p):=qi(0); 908 math_kcode(p-1):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val; 909@z 910 911@x 912mmode+letter,mmode+other_char,mmode+char_given: 913 if is_char_ascii(cur_chr) then 914 if cur_chr<128 then set_math_char(ho(math_code(cur_chr))) 915 else set_math_char(cur_chr) 916 else set_math_kchar(cur_chr); 917mmode+kanji,mmode+kana,mmode+other_kchar: begin 918 cx:=cur_chr; set_math_kchar(KANJI(cx)); 919 end; 920mmode+char_num: begin scan_char_num; cur_chr:=cur_val; 921 if is_char_ascii(cur_chr) then 922 if cur_chr<128 then set_math_char(ho(math_code(cur_chr))) 923 else set_math_char(cur_chr) 924 else set_math_kchar(cur_chr); 925 end; 926@y 927mmode+letter,mmode+other_char,mmode+char_given: 928 if check_echar_range(cur_chr) then 929 if cur_chr<128 then set_math_char(ho(math_code(cur_chr))) 930 else set_math_char(cur_chr) 931 else set_math_kchar(cur_chr); 932mmode+kanji,mmode+kana,mmode+other_kchar,mmode+hangul: begin 933 cx:=cur_chr; set_math_kchar(KANJI(cx)); 934 end; 935mmode+char_num: begin scan_char_num; cur_chr:=cur_val; 936 if check_echar_range(cur_chr) then 937 if cur_chr<128 then set_math_char(ho(math_code(cur_chr))) 938 else set_math_char(cur_chr) 939 else set_math_kchar(cur_chr); 940 end; 941mmode+kchar_given: 942 set_math_kchar(cur_chr); 943mmode+kchar_num: begin scan_char_num; cur_chr:=cur_val; 944 set_math_kchar(cur_chr); 945 end; 946@z 947 948@x 949any_mode(assign_inhibit_xsp_code), 950any_mode(set_auto_spacing), 951@y 952any_mode(assign_inhibit_xsp_code), 953any_mode(set_auto_spacing), 954any_mode(set_enable_cjk_token), 955@z 956 957@x l.23666 - upTeX 958@d char_sub_def_code=7 {|shorthand_def| for \.{\\charsubdef}} 959 960@<Put each...@>= 961primitive("chardef",shorthand_def,char_def_code);@/ 962@!@:char_def_}{\.{\\chardef} primitive@> 963@y 964@d char_sub_def_code=7 {|shorthand_def| for \.{\\charsubdef}} 965@d kchar_def_code=char_sub_def_code+1 {|shorthand_def| for \.{\\kchardef}} 966 967@<Put each...@>= 968primitive("chardef",shorthand_def,char_def_code);@/ 969@!@:char_def_}{\.{\\chardef} primitive@> 970primitive("kchardef",shorthand_def,kchar_def_code);@/ 971@!@:kchar_def_}{\.{\\kchardef} primitive@> 972@z 973 974@x 975shorthand_def: case chr_code of 976 char_def_code: print_esc("chardef"); 977 math_char_def_code: print_esc("mathchardef"); 978@y 979shorthand_def: case chr_code of 980 char_def_code: print_esc("chardef"); 981 kchar_def_code: print_esc("kchardef"); 982 math_char_def_code: print_esc("mathchardef"); 983@z 984 985@x l.23698 - upTeX 986char_given: begin print_esc("char"); print_hex(chr_code); 987 end; 988@y 989char_given: begin print_esc("char"); print_hex(chr_code); 990 end; 991kchar_given: begin print_esc("kchar"); print_hex(chr_code); 992 end; 993@z 994 995@x l.23729 - upTeX 996 char_def_code: begin scan_char_num; define(p,char_given,cur_val); 997 end; 998@y 999 char_def_code: begin scan_char_num; define(p,char_given,cur_val); 1000 end; 1001 kchar_def_code: begin scan_char_num; define(p,kchar_given,cur_val); 1002 end; 1003@z 1004 1005@x 1006@ @<Let |m| be the minimal...@>= 1007if cur_chr=kcat_code_base then m:=kanji else m:=0 1008@y 1009@ @<Let |m| be the minimal...@>= 1010if cur_chr=kcat_code_base then m:=not_cjk else m:=0 1011@z 1012 1013@x 1014@<Change the case of the token in |p|, if a change is appropriate@>= 1015t:=info(p); 1016if (t<cs_token_flag+single_base)and(not check_kanji(t)) then 1017 begin c:=t mod 256; 1018@y 1019@<Change the case of the token in |p|, if a change is appropriate@>= 1020t:=info(p); 1021if (t<cs_token_flag+single_base)and(not check_kanji(t)) then 1022 begin c:=t mod max_char_val; 1023@z 1024 1025@x 1026libc_free(format_engine);@/ 1027@y 1028libc_free(format_engine);@/ 1029dump_kanji(fmt_file); 1030@z 1031 1032@x 1033libc_free(format_engine); 1034@y 1035libc_free(format_engine); 1036undump_kanji(fmt_file); 1037@z 1038 1039@x 1040@d set_auto_xspacing_code=3 1041@y 1042@d set_auto_xspacing_code=3 1043@d reset_enable_cjk_token_code=0 1044@d set_enable_cjk_token_code=1 1045@d set_force_cjk_token_code=2 1046@z 1047 1048@x 1049@!@:no_auto_xspacing_}{\.{\\noautoxspacing} primitive@> 1050@y 1051@!@:no_auto_xspacing_}{\.{\\noautoxspacing} primitive@> 1052primitive("enablecjktoken",set_enable_cjk_token,reset_enable_cjk_token_code); 1053@!@:enable_cjk_token_}{\.{\\enablecjktoken} primitive@> 1054primitive("disablecjktoken",set_enable_cjk_token,set_enable_cjk_token_code); 1055@!@:disable_cjk_token_}{\.{\\disablecjktoken} primitive@> 1056primitive("forcecjktoken",set_enable_cjk_token,set_force_cjk_token_code); 1057@!@:force_cjk_token_}{\.{\\forcecjktoken} primitive@> 1058@z 1059 1060@x 1061 if (chr_code mod 2)=0 then print_esc("noauto") else print_esc("auto"); 1062 if chr_code<2 then print("spacing") else print("xspacing"); 1063end; 1064@y 1065 if (chr_code mod 2)=0 then print_esc("noauto") else print_esc("auto"); 1066 if chr_code<2 then print("spacing") else print("xspacing"); 1067end; 1068set_enable_cjk_token:begin 1069 if chr_code=0 then print_esc("enable") 1070 else if chr_code=1 then print_esc("disable") else print_esc("force"); 1071 print("cjktoken"); 1072end; 1073@z 1074 1075@x 1076 else begin p:=auto_xspacing_code; cur_chr:=(cur_chr mod 2); end; 1077 define(p,data,cur_chr); 1078end; 1079@y 1080 else begin p:=auto_xspacing_code; cur_chr:=(cur_chr mod 2); end; 1081 define(p,data,cur_chr); 1082end; 1083set_enable_cjk_token: define(enable_cjk_token_code,data,cur_chr); 1084@z 1085 1086@x 1087@ @<Insert a space around the character |p|@>= 1088if font_dir[font(p)]<>dir_default then 1089 begin KANJI(cx):=info(link(p)); 1090@y 1091@ @<Insert a space around the character |p|@>= 1092if font_dir[font(p)]<>dir_default then 1093 begin KANJI(cx):=info(link(p)) mod max_cjk_val; 1094@z 1095 1096@x 1097else if font_dir[font(first_char)]<>dir_default then 1098 begin KANJI(cx):=info(link(first_char)); 1099@y 1100else if font_dir[font(first_char)]<>dir_default then 1101 begin KANJI(cx):=info(link(first_char)) mod max_cjk_val; 1102@z 1103 1104@x 1105begin if is_char_node(link(p)) then 1106 begin q:=p; p:=link(p); 1107 if font_dir[font(p)]<>dir_default then 1108 begin KANJI(cx):=info(link(p)); 1109@y 1110begin if is_char_node(link(p)) then 1111 begin q:=p; p:=link(p); 1112 if font_dir[font(p)]<>dir_default then 1113 begin KANJI(cx):=info(link(p)) mod max_cjk_val; 1114@z 1115 1116@x 1117 begin KANJI(cx):=info(link(p)); i:=kcat_code(kcatcodekey(cx)); k:=0; 1118 if (i=kanji)or(i=kana) then begin t:=q; s:=p; end; 1119@y 1120 begin KANJI(cx):=info(link(p)) mod max_cjk_val; 1121 i:=info(link(p)) div max_cjk_val; k:=0; 1122 if (i=kanji)or(i=kana)or(i=hangul) then begin t:=q; s:=p; end; 1123@z 1124 1125@x 1126 begin fast_get_avail(main_p); font(main_p):=main_f; character(main_p):=cur_l; 1127 link(tail):=main_p; tail:=main_p; last_jchr:=tail; 1128 fast_get_avail(main_p); info(main_p):=KANJI(cur_chr); 1129@y 1130 begin fast_get_avail(main_p); font(main_p):=main_f; character(main_p):=cur_l; 1131 link(tail):=main_p; tail:=main_p; last_jchr:=tail; 1132 fast_get_avail(main_p); info(main_p):=KANJI(cur_chr)+cur_cmd*max_cjk_val; 1133@z 1134 1135@x 1136 main_i:=orig_char_info(main_f)(cur_l); 1137 case cur_cmd of 1138 kanji,kana,other_kchar: begin 1139@y 1140 main_i:=orig_char_info(main_f)(cur_l); 1141 case cur_cmd of 1142 kanji,kana,other_kchar,hangul: begin 1143@z 1144 1145@x 1146 kanji,kana,other_kchar: cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1147 letter,other_char: begin ins_kp:=true; cur_l:=qi(0); end; 1148 char_given: begin 1149 if is_char_ascii(cur_chr) then 1150 begin ins_kp:=true; cur_l:=qi(0); 1151 end 1152 else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1153 end; 1154 char_num: begin scan_char_num; cur_chr:=cur_val; 1155 if is_char_ascii(cur_chr) then 1156 begin ins_kp:=true; cur_l:=qi(0); 1157 end 1158 else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1159 end; 1160@y 1161 kanji,kana,other_kchar,hangul: cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1162 letter,other_char: begin ins_kp:=true; cur_l:=qi(0); end; 1163 char_given: begin 1164 if check_echar_range(cur_chr) then 1165 begin ins_kp:=true; cur_l:=qi(0); 1166 end 1167 else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1168 end; 1169 char_num: begin scan_char_num; cur_chr:=cur_val; 1170 if check_echar_range(cur_chr) then 1171 begin ins_kp:=true; cur_l:=qi(0); 1172 end 1173 else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1174 end; 1175 kchar_given: begin 1176 cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1177 end; 1178 kchar_num: begin scan_char_num; cur_chr:=cur_val; 1179 cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f)); 1180 end; 1181@z 1182 1183@x 1184procedure print_kanji(@!s:KANJI_code); {prints a single character} 1185begin 1186if s>255 then 1187 begin print_char(Hi(s)); print_char(Lo(s)); 1188 end else print_char(s); 1189@y 1190procedure print_kanji(@!s:KANJI_code); {prints a single character} 1191begin 1192s:=toBUFF(s mod max_cjk_val); 1193if BYTE1(s)<>0 then print_char(BYTE1(s)); 1194if BYTE2(s)<>0 then print_char(BYTE2(s)); 1195if BYTE3(s)<>0 then print_char(BYTE3(s)); 1196 print_char(BYTE4(s)); 1197end; 1198 1199function check_kcat_code(@!ct:integer):integer; 1200begin 1201if ((ct>=kanji)and(enable_cjk_token=0))or(enable_cjk_token=2)then 1202 check_kcat_code:=1 1203else check_kcat_code:=0; 1204end; 1205 1206function check_echar_range(@!c:integer):integer; 1207begin 1208if (c>=0)and(c<256)then 1209 check_echar_range:=1 1210else check_echar_range:=0; 1211@z 1212