check_kanji() ¤È \kcatcode ¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯ †
UTF-8Âбþ(5) ¤Ë½ñ¤¹þ¤ß¤Î¤¢¤Ã¤¿ÏÃÂê¤Ç¤¹¤¬¡¢
ʬÎ̤¬Â¿¤¯¤Ê¤Ã¤Æ»ö¼Â´Ø·¸¤¬¤ï¤«¤êÆñ¤¯¤Ê¤Ã¤¿¤Î¤Ç¡¢
¥Ú¡¼¥¸¤òÆÈΩ¤µ¤»¤Æ¤Þ¤È¤á¤Ê¤ª¤·¤Æ¤ß¤Þ¤·¤¿¡£
ËÜÍè¤Ï \kcatcode ¤ä \catcode ¤Îʸ»ú¥³¡¼¥É¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯¤¬¤æ¤ë¤¤¤È¤¤¤¦
»ØŦ¤ò ZR »á¤Ë¤¤¤¿¤À¤¤¤¿¤Î¤Ç¤¹¤¬¡¢
"procedure scan_char_num;" ¤Ë½Ð¤Æ¤¯¤ë check_kanji() ´Ø¿ô¤Î½èÍý¤Ë
»ä¡ÊÅÚ¼¡Ë¤¬µ¿Ìä¤ò¤Ï¤µ¤ó¤À¤¿¤á¤Ë¡¢
¤«¤Ê¤êÆÈΩ¤·¤¿ÏÃÂ꤬ʹԤ·¤Æ¿Ê¤á¤é¤ì¤Æ¡¢Æɤߤˤ¯¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤½¤³¤Ç¤³¤³¤Ç¤Ï¡¢Àè¤Ë check_kanji() ¤ÎÌäÂê¤ò²ò·è¤·¡¢
¤½¤ì¤«¤é \kcatcode Åù¤Î¥Á¥§¥Ã¥¯¤ò¶¯²½¤¹¤ë¤³¤È¤Ë¤·¤Þ¤¹¡£
check_kanji() ¤ÎÌäÂê †
ptex-src ¤Î kanji.c ¤Ë¤Ï¡¢
*1
boolean check_kanji(integer c);
¤È¤¤¤¦´Ø¿ô¤¬¤¢¤ê¤Þ¤¹¡£
boolean ¤Ï kpathsea ¤Ç int ¤Ë¡¢
integer ¤Ï Web2C ¤Ç 32bit °Ê¾å¤ÎÉä¹æ¤Ä¤À°¿ô¡Êlong ¤« int¡Ë¤Ë¡¢
¤½¤ì¤¾¤ì typedef ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¤·¤«¤·¤Ê¤¬¤é¡¢check_kanji() ¤Ë¤Ï¼¡¤Î¤è¤¦¤ÊÆó¤Ä¤ÎÌäÂ꤬¤¢¤ê¤Þ¤¹¡£
¡ÊÂ礤ÊÊѹ¹¤ò¤»¤º¡¢´û¸¤Î´Ø¿ô¤Î²þ¤¤Ë¤è¤Ã¤Æ
µ¡Ç½³ÈÄ¥¤¬¹Ô¤ï¤ì¤¿¤Î¤À¤ÈÁÛÁü¤·¤Þ¤¹¡£¡Ë
- boolean ¤ÇÀë¸À¤µ¤ì¤Æ¤¤¤ë¤Î¤Ë¤â¤«¤«¤ï¤é¤º¡¢£³Ä̤ê¤ÎÃͤòÊÖ¤·¤Þ¤¹¡£
- ´Ø¿ô̾¤«¤éÁÛÁü¤µ¤ì¤ì¤ë¤â¤Î¤È¤Ï°Û¤Ê¤ëÆ°ºî¤ò¹Ô¤¤¤Þ¤¹¡£
¡ÊASCII ʸ»ú¤Ë¤â true ¤òÊÖ¤·¤Þ¤¹¡£¡Ë
check_kanji(c) ¤ÎÊÖ¤êÃͤϼ¡¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
1 .. c:´Á»ú
-1 .. c:ASCII without catcode (0¡Á255 or 256)
0 .. c:ASCII with catcode (´Á»ú¤Ç¤â 0¡Á255 ¤Ç¤â 256 ¤Ç¤â¤Ê¤¤¤â¤Î)
¤½¤³¤Ç¡¢¤³¤Î´Ø¿ô¤ò£³¤Ä¤Î´Ø¿ô¤ËʬΥ¤¹¤ë¤³¤È¤òÄó°Æ¤·¤Æ¤ß¤Þ¤¹¡£
c=256 ¤Î¾ì¹ç¤ÏÎã³°¤È¤·¤Æ¸ÄÊ̤ËÂн褹¤ë¤³¤È¤Ë¤·¤Æ¡¢
0<=c<=255 ¤Î¾ì¹ç¤ò ascii ¤È¤·¤Æ̾Á°¤ò¤Ä¤±¤Æ¤ß¤Þ¤¹¡£
boolean is_kanji(integer c) { return (iskanji1(Hi(c)) && iskanji2(Lo(c))); }
boolean is_char_ascii(integer c) { return (0 <= c && c < 0x100); }
boolean is_wchar_ascii(integer c) { return (!is_char_ascii(c) && !is_kanji(c)); }
¤³¤ì¤é¤Î£³¤Ä¤Î´Ø¿ô¤òÍѤ¤¤ë¤È¡¢
check_kanji() ¤Ï¼¡¤Î¤è¤¦¤Ë½ñ¤Ä¾¤»¤Þ¤¹¡£
¡ÊºÇ½ªÅª¤Ë¤Ï Web2C¡¢¤Ä¤Þ¤ê¤Ï Pascal ¤Ç¤Îɽµ¤ËÊÑ·Á¤·¤Æ¤ß¤Þ¤¹¡£¡Ë
check_kanji(c) <=> check_kanji(c) = 1 ¤« -1
<=> c=0¡Á255 ¤« 256 ¤« ´Á»ú
<=> is_kanji(c) or is_char_ascii(c) or c=256
not check_kanji(c) <=> (not is_kanji(c)) and (not is_char_ascii(c)) and c<>256
<=> is_wchar_ascii(c) and c<>256
check_kanji(c)>0 <=> is_kanji(c)
¤·¤«¤·¤Ê¤¬¤é¡¢¤³¤Î¤è¤¦¤Ë¸·Ì©¤Ë½ñ¤Ä¾¤·¤¿¤È¤³¤í¤Ç¡¢
»È¤ï¤ì¤Æ¤¤¤ë¾ìÌ̤ˤè¤Ã¤Æ¤ÏÀ®Î©¤·¤Ê¤¤¾ò·ï¤¬´Þ¤Þ¤ì¤Æ¤¤¤Æ¡¢
¤â¤Ã¤È´Êά²½¤Ç¤¤ë¤È¤³¤í¤â¤¢¤ê¤Þ¤¹¡£
´Êά²½ †
´Êά²½¤òÀµ¤·¤¯¹Ô¤¦¤¿¤á¤Ë¤Ï¡¢pTeX ¤ÎÆâÉô½èÍý¤Ë¿¼¤¯ÀºÄ̤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¤½¤³¤Ç¤³¤³¤Ç¤Ï¡¢¤É¤Î¤è¤¦¤Ë´Êά²½¤¹¤Ù¤¤«¡¢
Ê£¿ô¤Î¿Í¤ÎÌܤǥÁ¥§¥Ã¥¯¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¿®ÍêÀ¤ò³ÎÊݤ·¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
°ÊÁ°¤Î½ñ¤¹þ¤ß ¤«¤éÍøÍѤµ¤»¤Æ¤¤¤¿¤À¤¯¤È¡¢
ptex-base.ch ¤ÇÍѤ¤¤é¤ì¤ë check_kanji() ¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
(1) @<Display token |p|...@> [wchar_token] [check_kanji]
(2) @<Pseudoprint the token list@> [wchar_token] [check_kanji]
(3) @<Input from token list, [wchar_token] [check_kanji]
(4) @<Look up the characters of list |r| [wchar_token] [check_kanji]
(5) @ @<Fetch a character code from some table@> [char_code] [check_kanji>0]
(6) procedure scan_char_num [char_code] [not check_kanji]
(7) @<Change the case of the token in |p| [wchar_token] [not check_kanji]
(8) set_kansuji_char: [char_code] [not check_kanji]
(9) assign_inhibit_xsp_code: [char_code] [check_kanji]
(10) assign_kinsoku: [char_code] [check_kanji]
¤³¤ÎÃæ¤Ç¡¢(5) ¤Î check_kanji(c)>0 ¤Ï is_kanji(c) ¤ÈÅù²Á¤Ç¤¹¡£
¤·¤«¤·¤Ê¤¬¤é¤½¤Î¾¤Î check_kanji(c) ¤ò is_kanji(c) ¤ËÃÖ¤´¹¤¨¤Æ¤è¤¤¤«¤É¤¦¤«¤Ï¡¢
ÌÀ¤é¤«¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
not check_kanji(c) ¤â is_wchar_ascii(c) ¤ÈÃÖ¤´¹¤¨¤é¤ì¤ë¤È¤â¸Â¤ê¤Þ¤»¤ó¡£
µ¡³£Åª¤Ë½ñ¤´¹¤¨¤ì¤Ð c=256 ¤â½Ð¸½¤·¤Þ¤¹¡£
°Ê²¼¤Ë½ñ¤´¹¤¨¥Ð¥¿¡¼¥ó¤ò¤Þ¤È¤á¤Æ¤ß¤Þ¤¹¡£
ÈÖ¹æ | ¼ïÊÌ | ¸Å¤¤É½µ | ¿·¤·¤¤É½µ | ¾Êά¤·¤¿¤â¤Î | ³Îǧ |
---|
(1¡Á4) | wchar_token | check_kanji(c) | is_kanji(c) | or is_char_ascii(c) or c=256 | ¤¿¤Ö¤ó |
---|
(5) | char_code | check_kanji(c)>0 | is_kanji(c) | -- | OK |
---|
(6) | char_code | not check_kanji(c) | is_wchar_ascii(c)? | and c<>256 | ľÁ°¤Î not is_char_ascii(c) ÁêÅö¤âÉÔÍ×? |
---|
(7) | wchar_token | not check_kanji(c) | not is_kanji(c) | and (not is_char_ascii(c)) and c<>256 | ¤¿¤Ö¤ó |
---|
(8) | char_code | not check_kanji(c) | not is_kanji(c)? | and (not is_char_ascii(c)) and c<>256 | ? |
---|
(9) | char_code | check_kanji(c) | is_kanji(c)? | or is_char_ascii(c) or c=256 | ? |
---|
(10) | char_code | check_kanji(c) | is_char_ascii(c) or is_kanji(c) | or c=256 | ? |
---|
is_wchar_ascii(c) ¤Î½Ð¸½ÉÑÅÙ¤¬¾¯¤Ê¤±¤ì¤Ð¡¢¤³¤ì¤ÏÇѻߤ·¤Æ¡¢
is_char_ascii(c) ¤È is_kanji(c) ¤È¤ÇŸ³«¤·¤Æ½ñ¤±¤Ð¤è¤¤¤È»×¤¤¤Þ¤¹¡£
- (6)¤Îscan_char_num¤ÏÁ°½Ò¤Î\kcatcodeÆþÎϤ¬¤é¤ß¤Î¾¤Ë¤â\char, \chardef¤ÎÆþÎϤˤâ»È¤ï¤ì¤Æ¤¤¤Þ¤¹¡£Á´ÂΤÇ!(is_char_ascii(c) or is_kanji(c))¤Ë¤Ê¤ë¤Ù¤¤Ç¤·¤ç¤¦¡£¡ÖľÁ°¤Î not is_char_ascii(c) ÁêÅö¤âÉÔÍ×?¡×¤È¤¤¤¦¤Î¤¬Îɤ¯Ê¬¤«¤é¤Ê¤¤¤Î¤Ç¤¹¤¬¡£is_wchar_ascii(c)¤Ïis_char_ascii(c)¤Èis_kanji(c)¤ÎÆó¤Ä¤Ç½ñ¤±¤ë¤·¡¢(6)¤È(10)¤À¤±¤Ê¤Î¤ÇÉÔÍפÀ¤È»×¤¤¤Þ¤¹¡£¤½¤Î¾¡¢check_kanji¤Ç¤Ï½ñ¤¤¤Æ¤¤¤Ê¤¤¤¬¡¢(0<=cur_chr)and(cur_chr<256)¤È¤¤¤¦¤Î¤¬ÉѽФ·¤Æ¤ª¤ê¡¢\char ¤ä\chardef ¤Ê¤É¤ÇÏÂʸ¤È²¤Ê¸¤òʬΥ¤¹¤ë¤Î¤Ë»È¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£¤³¤ì¤âis_char_aschii¤ËÃÖ¤´¹¤¨¤ë¤È¥¹¥Ã¥¥ê¤¹¤ë¤È»×¤¤¤Þ¤¹¡£upTeX¤Ç¤Ï¡¢\char ¤ËÍí¤ó¤Ç¤¤¤ë¤½¤Î¤¢¤¿¤ê¤ÎÉôʬ¤Ïweb¤Î´Ø¿ô¤Ë¤·¤è¤¦¤È»×¤Ã¤Æ¤¤¤Þ¤¹¡£ (---¤È¡¢¤³¤³¤Þ¤Ç½ñ¤¹þ¤ó¤Ç¡¢download¤Î¤È¤³¤í¤ò¥Á¥§¥Ã¥¯¤·¤¿¤é¡¢¤â¤¦¤Û¤Ü¤½¤ÎÄ̤ê¤Îºî¶È¤ò¤Ê¤µ¤Ã¤Æ¤¤¤é¤Ã¤·¤ã¤¤¤Þ¤·¤¿¡£ ) -- ttk
- is_char_aschii() ¤Ï¤¹¤Ç¤Ë¿ÍѤ·¤Æ¤¤¤Þ¤¹¡£is_wchar_ascii() ¤ÏÇѻߤÎÊý¸þ¤Ç¹Í¤¨¤Þ¤¹¡£(6) ¤Î¡Ö..ÁêÅö¤âÉÔÍ×?¡×¤È¤¤¤¦¤Î¤Ï is_wchar_ascii() ¤ò»È¤Ã¤¿¾ì¹ç¤Î¤³¤È¤Ç¤¹¡£ -- ÅÚ¼
- ´Ø¿ô̾¤Ï¤â¤¦¾¯¤·¹Í¤¨¤Í¤Ð¤Ê¤é¤Ê¤¤¤È»×¤¤¤Þ¤¹¡£ascii ¤È¤¤¤¦¤È 7bit ʸ»ú¤òÁÛÁü¤¹¤ë¿Í¤â¿¤¤¤Ç¤·¤ç¤¦¡£isascii() ¤È¤¤¤¦´Ø¿ô¤â¡ÊANSI ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡ËBSD ³ÈÄ¥¤ÇÍÑ°Õ¤µ¤ì¤Æ¤¤¤Æ¡¢7bit ʸ»ú¤ÎȽÄê¤ò¤·¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£is_kanji ¤â iskanji1/iskanji2 ¤È¹ó»÷¤·¤Æ¤¤¤Þ¤¹¤·¡£ -- ÅÚ¼
\kcatcode Åù¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯ †
¾å¤ÎÌäÂ꤬²ò·è¤·¤¿¤é¡¢\kcatcode Åù¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯¤â¶¯²½¤·¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
°ÊÁ°¤Î½ñ¤¹þ¤ß †
UTF-8Âбþ(5) ¤Ë½ñ¤¹þ¤ó¤Ç夤¤¿ÆâÍƤò¡¢¤³¤³¤Ë°ÜÆ°¤·¤Æ¤ª¤¤Þ¤¹¡£
- ¤â¤¦°ì¤Ä¤Îµ¿Ìä¤Ç¤¹¡£\catcode ¤Î°·¤¤¤Ë¤Ä¤¤¤Æ¤Ï±ü¼ÀèÀ¸·Ç¼¨ÈĤÇÆɤߤޤ·¤¿¡£
¤³¤ì¤Ë´Ø¤·¤Æ¤Ç¤¹¤¬¡¢"\catcode<´Á»ú¥³¡¼¥É>" ¤ä "\kcatcode<1¥Ð¥¤¥ÈÀ°¿ô>"
¤ÎÆɤ߽ñ¤(ÌÞÏÀ̵°ÕÌ£¤ÊÁàºî¤Ç¤¢¤ë)¤Î»ÅÍͤϤɤ¦¤Ê¤ë¤Î¤Ç¤·¤ç¤¦¤«¡£
pTeX ¤Î½¾Íè¤ÎµóÆ°¤Ï¤«¤Ê¤êÉԲIJò¤Ç¡¢
¤â¤¦¾¯¤·°ÂÁ´¤Ê¤â¤Î¤Ë¤·¤Æ¤â¤è¤¤¤«¤È»×¤¤¤Þ¤¹¡£
Æäˡ¢"\catcode`¤¢=0" Åù¤Ï¥á¥â¥ê¥Ç¡¼¥¿¤òÇ˲õ¤¹¤ë¤è¤¦¤Ë¤ß¤¨¤Þ¤¹¡£--
- ¤¹¤¤¤Þ¤»¤ó¡¢ºÙ¤«¤¤¤³¤È¤Ï²¿¤â¤ï¤«¤Ã¤Æ¤Ê¤¤¤Î¤Ç¡¢°Ê²¼¤Î¥½¡¼¥¹¤ò platex ¤Ë½èÍý¤µ¤»¤Æ¡¢valgrind ¤È¤¤¤¦¥á¥â¥ê¥ê¡¼¥¯´Æ»ë¥Ä¡¼¥ë¤Ç´Ñ»¡¤·¤Æ¤ß¤Þ¤·¤¿¡£ÊÑ¿ô¤Î½é´ü²½Ëº¤ì¤ò°ì¥ö½ê¤À¤±È¯¸«¤·¤Þ¤·¤¿¤¬¡¢¤ª¤Ã¤·¤ã¤ë¤è¤¦¤ÊÌäÂê¤Î¤¢¤ê¤½¤¦¤Ê½èÍý¤Ïȯ¸«¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¤â¤·¾õ¶·¤òÇÄ°®¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤·¤¿¤é¡¢ÌäÂê¤òºÆ¸½¤Ç¤¤ëTeX¥½¡¼¥¹¤«¡¢¤½¤ì¤È¤â ptex-base.ch (?)¤Î³ºÅöÉôʬ¤ò¤ª¶µ¤¨¤¤¤¿¤À¤±¤ë¤È¤¢¤ê¤¬¤¿¤¤¤Ç¤¹¡£
\documentclass{jarticle}
\catcode`¤¢=0
\begin{document}
\noindent
¤¢=0 \newline
°¡=0
\end{document}
̤½é´ü²½ÊÑ¿ô¤ò¤Ê¤¯¤¹¤Ë¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ì¤Ð¤è¤¤¤Ç¤·¤ç¤¦¤«¡£
k ¤ò 0 ¤Ç½é´ü²½¤¹¤ì¤Ð¤è¤¤¤Î¤«¤É¤¦¤«¡¢¤¢¤Þ¤ê¼«¿®¤Ï¤¢¤ê¤Þ¤»¤ó¡£
--- ptex-base.ch~ 2007-05-04 00:55:18.000000000 +0900
+++ ptex-base.ch 2007-05-04 02:27:31.000000000 +0900
@@ -7160,7 +7160,7 @@
cx:KANJI_code; {temporaly register for KANJI character}
ax:ASCII_code; {temporaly register for ASCII character}
do_ins:boolean; {for inserting |xkanji_skip| into prevous (or after) KANJI}
-begin if link(p)=null then goto exit;
+begin k:=0; if link(p)=null then goto exit;
if auto_spacing>0 then
begin delete_glue_ref(space_ptr(p)); space_ptr(p):=kanji_skip;
add_glue_ref(kanji_skip);
-- ÅÚ¼
- tex/ptex ¤Î¥½¡¼¥¹¤Ï¤Û¤È¤ó¤ÉÆɤá¤Æ¤¤¤Ê¤¤¤Î¤Ç¤¹¤¬¡Ä¡£
¼¡¤Î plain pTeX ¤Î¥½¡¼¥¹
\catcode"ED=6
\immediate\write16{1:\the\catcode"EDCA}
\immediate\write16{2:\the\kcatcode`a}
\catcode256=10
\immediate\write16{3:\the\kcatcode`a}
\bye
¤ò ptex (p3.1.10,euc) ¤Ç½èÍý¤·¤¿»þ¤ÎüËö½ÐÎÏ(°ìÉô)¤Ï
(./test.tex
1:6
2:18
3:10
)
¤È¤Ê¤ê¤Þ¤¹¡£¤Þ¤º 1: ¤«¤é \catcode"xxyy ¤òÆɤߤÀ¤¹¤È
\catcode"xx ¤¬Ê֤뤳¤È¤¬¤ï¤«¤ê¤Þ¤¹¡£
¼¡¤Ë 2: ¤È 3: ¤Ç¤¹¤¬¡¢¸½ºß¤Î \kcatcode"xxyy ¤ÏÆɤ߽ñ¤¤È¤â
kcatcode ¤Î "xx ÈÖÌÜ(0-origin)¤ò»Ø¤¹¤Ï¤º¤Ç¤¹¡£
¤½¤·¤Æ¡¢catcode ¤Î¡Ö256 ÈÖÌܡפ¬¼ÂºÝ¤Ë¤Ï kcatcode ¤Î 0 ÈÖÌܤò»Ø¤¹¤¿¤á¡¢
\kcatcode`a ¤¬¤¤¤Ä¤Î´Ö¤Ë¤«ÊѤï¤Ã¤Æ¤·¤Þ¤Ã¤¿¤Î¤À¤È¹Í¤¨¤é¤ì¤Þ¤¹¡£
-- ZR
- ptex-base.ch (p3.1.10 ¸¶ÈÇ)¤ÎÃæ¤Î \catcode
Åù¤Î½ñ¤¹þ¤ß¤ò¤·¤Æ¤¤¤ë(¤È»×¤ï¤ì¤ë)²Õ½ê¤Ç¤¹¡£
p:=cur_chr; scan_char_num;
if p=kcat_code_base then p:=p+Hi(cur_val) else p:=p+cur_val;
([49.1232] ¤Î @y ¥Ö¥í¥Ã¥¯)
\catcode256 ¤Ø¤Î½ñ¤¹þ¤ß¤Ç¤Ï¡¢1 ¹ÔÌܤνª¤ï¤ê¤Ç
p = cat_code_base, cur_val = 256 ¤È¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
-- ZR
- ³Î¤«¤Ë¡¢¥Á¥§¥Ã¥¯¤Ï¤æ¤ë¤¤¤Ç¤¹¤Í¡£´Êñ¤Ë¥Á¥§¥Ã¥¯¤¹¤ë¤Ê¤é¼¡¤Î£¶¹Ô¤ò²Ã¤¨¤ì¤Ð¤è¤¤¤Ç¤·¤ç¤¦¤«¡£
--- ptex-base.ch~ 2007-05-04 15:09:01.000000000 +0900
+++ ptex-base.ch 2007-05-04 16:21:22.000000000 +0900
@@ -6006,6 +6006,12 @@
@<Let |m| be the minimal legal code value, based on |cur_chr|@>;
@<Let |n| be the largest legal code value, based on |cur_chr|@>;
p:=cur_chr; scan_char_num;
+ if (cur_val>=0)and(cur_val<256)and(p=kcat_code_base)then
+ begin print_err("Invalid kcatcode (");
+ print_int(cur_val);print(")"); error; end;
+ if (cur_val>=256)and(p<>kcat_code_base)then
+ begin print_err("Invalid catcode (");
+ print_int(cur_val);print(")"); error; end;
if p=kcat_code_base then p:=p+kcatcodekey(cur_val) else p:=p+cur_val;
scan_optional_equals; scan_int;
if ((cur_val<m)and(p<del_code_base))or(cur_val>n) then
ËÜÍè¤Ê¤é¤â¤Ã¤Èñ½ã¤Ë½ñ¤±¤ë¤Ï¤º¤Ê¤ó¤Ç¤¹¤¬¡¢Web2c ¤Î if ¤ÎÆþ¤ì»Ò¤¬¤è¤¯¤ï¤«¤é¤Ê¤¯¤Æ¡£
¤¿¤À¡¢¥½¡¼¥¹¤ò¸«¤Æ¤¤¤ë¤È¡¢
"if (cur_chr>=0)and(cur_chr<256) then" ¤È¤¤¤¦¥Õ¥ì¡¼¥º¤¬ÉѽФ¹¤ë¤Î¤Ç¡¢
¤Ê¤ó¤È¤«¤Ê¤é¤Ê¤¤¤Î¤«¤Ê¤¡¤È¤¤¤¦¤Î¤È¡¢
kanji.c ¤Î check_kanji() ¤¬ 256 ¤Î»þ¤â¥¢¥¹¥¡¼Ê¸»ú°·¤¤¤·¤Æ¤¤¤ë¤Î¤¬µ¤¤Ë¤Ê¤ê¤Þ¤¹¡£
-- ÅÚ¼
- º£¤Î°ìÈÖ¤ÎÌäÂê¤Ï \catcode<´Á»ú¥³¡¼¥É>
¤Î½ñ¤¹þ¤ß¤ÇÉÔ¬¤Î¥á¥â¥ê½ñ¤¹þ¤ß¤¬µ¯¤³¤ë¤³¤È¤Ç¡¢
»ä¤ÎÍý²ò¤¹¤ë¸Â¤ê¤Ç¤Ï¡¢Ãͤθ¡ºº¤Ï¤³¤ì¤Ç¤¤¤¤¤È»×¤¤¤Þ¤¹¡£
¤¿¤À¤·¡¢"invalid" ¤Ê¤Î¤Ï catcode ¤ä kcatcode ¤Ç¤Ï¤Ê¤¯
¡Öʸ»ú¥³¡¼¥É¡×¤Î¤Ï¤º¤Ç¤¹¡£
¤µ¤é¤Ë¡¢¤³¤Î¤Þ¤Þ¤Ç¤Ï¥æ¡¼¥¶¤¬¥¨¥é¡¼¤ò Enter ¤ÇÆͤÃÀÚ¤ë¤È¡¢
·ë¶É¥á¥â¥ê½ñ¤¹þ¤ß¤¬¤½¤Î¤Þ¤Þ¹Ô¤ï¤ì¤Þ¤¹¡£
scan_char_num Ãæ¤Î½èÍý¤¬»²¹Í¤Ë¤Ê¤ë¤È»×¤ï¤ì¤Þ¤¹¡£
¤¢¤È¡¢²áµî¤È¤Î¸ß´¹À¤ÎÌäÂê¤Ç¡¢
ÉÔÀµ¤Î¤È¤¤Ë¡Ö¥¨¥é¡¼¤ò½Ð¤¹¡×¤Î¤È¡ÖÌۤäÆ̵»ë¤¹¤ë¡×
¤Î¤É¤Á¤é¤¬Å¬Åö¤«¤È¤¤¤¦ÌäÂê¤â¤¢¤ê¤Þ¤¹¡£
-- ZR
- \catcode256=10¤Ç\kcatcodeɽ¤Î0ÈÖÌܤ¬½ñ¤´¹¤ï¤Ã¤Æ¤·¤Þ¤¦¤È¤¤¤¦¤ªÏäǤ¹¤¬¡¢¥ª¥ê¥¸¥Ê¥ëpTeX¤Î¾ì¹ç¤Ï¾¯¤Ê¤¯¤È¤â\kcatcodeɽ¤Î0x81ÈÖÌܰʾ塢ptetex3¤Î¸½ºß¤Î¥ô¥¡¡¼¥¸¥ç¥ó¤Ç¤â0x21ÈÖÌܰʾ夷¤«Æɤ߽Ф¹²ÄǽÀ¤Ï̵¤¯¡¢ÏÂʸ¤ÎÁÈÈǤ˺ݤ·\kcatcodeɽ¤Î0ÈÖÌܤò»²¾È¤¹¤ë²ÄǽÀ¤Ï¥¼¥í¤Ç¤¢¤ê¡¢´í¸±À¤Ï¸Â¤ê¤Ê¤¯¥¼¥í¤Ë¶á¤¤¤è¤¦¤Ë»×¤¤¤Þ¤¹(¤»¤¤¤¼¤¤¸íÆþÎϤ˥¨¥é¡¼¤ò½Ð¤»¤Ê¤¤¤³¤È¤°¤é¤¤)¡£kanji.c ¤Î check_kanji() ¤¬ 256 ¤Î»þ¤â¥¢¥¹¥¡¼Ê¸»ú°·¤¤¤·¤Æ¤¤¤ëÅÀ¤Ï¡¢²¤Ê¸TeX¤Ç¡Ö¤½¤ì°Ê¾åŸ³«¤Ç¤¤Ê¤¤¥³¥ó¥È¥í¡¼¥ë¥·¡¼¥±¥ó¥¹¡×¤¬cur_val=256¤È¤·¤ÆÎ㳰Ū¤Ë°·¤ï¤ì¤Æ¤¤¤ë¤Î¤È¡¢pTeX¤ÎÏÂʸ¤Ïcur_val>=0x8140¤Ç¤¢¤ë¤Î¤ò¤Õ¤Þ¤¨¤Æ¤¤¤ë¤ÈÁÛÁü¤·¤Æ¤¤¤Þ¤¹¡£¤·¤«¤·¡¢check_kanji¤ò¸Æ¤Ö»þÅÀ¤Çcur_val=256¤È¤¤¤¦Î㳰Ū¤Ê¥±¡¼¥¹¤ò°·¤¦²ÄǽÀ¤Ï¥¼¥í¤Î¤è¤¦¤Êµ¤¤â¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ÎÊÕ¤¬Àµ¤·¤¯Íý²ò¤Ç¤¤Ê¤¤¤³¤È¤Ë¤ÏupTeX¤â¿Ê¤Þ¤Ê¤¤¤Î¤Ç¤¹¤¬(´À)¡£ -- ttk
- ÀâÌÀÉÔ¤Ǥ¹¤ß¤Þ¤»¤ó¡£
\catcode256 ¤ÏÇ˲õŪÂåÆþ¤Î¼Â¾Ú¤Î°Ù¤Î¤ß¤ÎÎã¤Ç¤¢¤ê¡¢
»ä¤â¼Â³²¤Ï¤Ê¤¤¤È»×¤¤¤Þ¤¹¡£
ÌäÂê¤Ê¤Î¤Ï¡¢\catcode`<ÏÂʸʸ»ú> ¤Ø¤ÎÂåÆþ¤Ç¤¹¡£
ÌäÂê¤Î¸Ä½ê¤Î¥½¡¼¥¹(ptetex3 ºÇ¿·)¤òºÆ·Ç¤·¤Þ¤¹¡£
p:=cur_chr; scan_char_num;
if p=kcat_code_base then p:=p+kcatcodekey(cur_val) else p:=p+cur_val;
scan_optional_equals; scan_int;
....
if p<math_code_base then define(p,data,cur_val)
else if p<del_code_base then define(p,data,hi(cur_val))
else word_define(p,cur_val);
end;
\catcode ¤ä \kcatcode Åù¤ÎÃͤϡ¢¥×¥í¥°¥é¥àÃæ¤Ç¤ÏÇÛÎó eqtb[]
¤ÎÃæ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤Æ¡¢Î㤨¤Ð¡¢
\catcode<c> ¤ÎÂбþ¥¨¥ó¥È¥ê¤Ï eqtb[cat_code_base+c]
\kcatcode<k> ¤ÎÂбþ¥¨¥ó¥È¥ê¤Ï eqtb[kcat_code_base+kcatcodekey(k)]
(c ¤Ï 1 ¥Ð¥¤¥È, k ¤Ï´Á»ú¥³¡¼¥É; kcat_code_base = cat_codebase+256)
¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
(eqtb ¤Î¥¨¥ó¥È¥ê¤ÏÊ£»¨¤Ê¹½Â¤¤ò¤·¤Æ¤¤¤Þ¤¹¤¬¡¢
¤È¤Ë¤«¤¯¤½¤ÎÃͤΰìÉô¤Î¤Ï¤º¤Ç¤¹¡£)
¤½¤·¤Æ¡¢¾å½Ò¥³¡¼¥ÉÃæ¤Î define(p,..) ¤Ï eqtb[p] ¤ò½ñ¤´¹¤¨¤Þ¤¹¡£
½¾¤Ã¤Æ¡¢\catcode256=10 ¤Ç¤Ï eqtb[cat_code_base+256]¡¢
¤¹¤Ê¤ï¤Á eqtb[kcat_code_base+0] ¤¬½ñ¤´¹¤¨¤é¤ì¤Þ¤·¤¿¡£
¤½¤·¤Æ \catcode`¤¢=10 ¤È¤¹¤ë¤È¡¢eqtb[cat_code_base+@"2422]
¤ò½ñ¤´¹¤¨¤Þ¤¹¤¬¡¢¤³¤Îź»ú¤Ï eqtb ¤ÎÍ×ÁÇ¿ô¤òĶ¤¨¤Æ¤¤¤ë¤Î¤Ç¡¢
ÉÔ¬¤Î·ë²Ì¤òµ¯¤³¤¹¤Ï¤º¤Ç¤¹¡£ -- ZR
- ¤â¤·¡¢(̵°ÕÌ£¤ÊÁàºî¤Î)·ë²Ì¤Î¸ß´¹À¤òµ¤¤Ë¤·¤Ê¤¤¤Ê¤é¡¢
¡Öʸ»ú¥³¡¼¥É¤òɽ¤¹À°¿ô¤òÆɤà¡×¥ë¡¼¥Á¥ó scan_char_num ¤ò
ASCII ÍѤȴÁ»úÍѤËʬ¤±¤ë
(¤â¤·ÍøÍѲÁÃͤ¬¤¢¤ë¤Ê¤é½¾Íè¤Î¤â¤Î¤â»Ä¤¹)
¤Î¤¬°ìÈ֤褤¤È¹Í¤¨¤Æ¤¤¤Þ¤¹¡£
¤¤¤º¤ì¤Ë¤·¤Æ¤â¡¢TeX ¥½¡¼¥¹Ãæ¤Ç "256" ¤¬Ê¸»ú¥³¡¼¥É¤òɽ¤¹¤³¤È¤Ï¤Ê¤¤¤Î¤Ç¡¢
scan_char_num ¤Ï 256 ¤òµñÈݤ¹¤ë¤Ù¤¤Ç¤·¤ç¤¦¡£
(ÌÞÏÀ tex ¤Î scan_char_num ¤Ï 0..255
¤·¤«¼õ¤±ÉÕ¤±¤Ê¤¤¡£) -- ZR
- ¤Ê¤ë¤Û¤É¡¢¡Ö\catcode`¤¢=10¡×¤Ï¤Þ¤º¤½¤¦¤Ç¤¹¤Í¡£¥½¡¼¥¹¤ò¤è¤¯¤è¤¯Äɤ¤¤«¤±¤Æ¤ß¤ë¤È¡¢¥ª¥ê¥¸¥Ê¥ëpTeX¤Ç¾¤Ë¤â¤Þ¤º¤½¤¦¤Ê¤È¤³¤í¤¬¤¢¤ê¤Þ¤·¤¿¡£¡Ö\kansujichar1=`a \kansuji1¡×¤Ï¥¨¥é¡¼¤â·Ù¹ð¤â̵¤¯°Û¾ï¤Ê·ë²Ì¤¬ÆÀ¤é¤ì¤Þ¤·¤¿¡£\catcode¤ÈƱÍͤˡÖ\xspcode`¤¢=0¡×¤â¤Þ¤º¤½¤¦¤Ç¤¹¡£ÆþÎϤΥÁ¥§¥Ã¥¯¤Ï¸·¤·¤¯¤¹¤Ù¤¤È¤¤¤¦¤´°Õ¸«¤Ë»¿Æ±¤·¤Þ¤¹¡£ -- ttk
- int check_kanji(int c) ¤È¤·¡¢ check_kanji(x) ---> check_kanji(x)>0, not check_kanji(x) ---> check_kanji(x)<=0 ¤È¤¹¤ë¤È¡¢¤É¤³¤«¤Ç¤Þ¤º¤¤¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¤«¡© -- kakuto
- ¼ºÎ餷¤Þ¤·¤¿¡£¤³¤ì¤Ç¤ÏÌÀ¤é¤«¤Ë¤Þ¤º¤¤¤è¤¦¤Ç¤¹¡£ -- kakuto
- check_kanji¼þ¤ê¤òÄ´ºº¤·¤Þ¤·¤¿¡£check_kanji¤Ïptex-base.ch¤ÎÃæ¤Ç10²ó¤Û¤É½Ð¤Æ¤¤Þ¤¹¡£²¤Ê¸¤¬catcodeÉդΤâ¤Î¤È¤ÎÈæ³Ó¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥±¡¼¥¹[wchar_token]¤È¡¢catcode¤ÎÉÕ¤«¤Ê¤¤Íç¤Îʸ»ú¥³¡¼¥É¤ò°·¤¦¥±¡¼¥¹[char_code]¤ÎξÊý¤¬¤¢¤ë¤è¤¦¤Ç¤¹¡£ÌäÂ꤬ȯÀ¸¤·¤Æ¤¤¤ë¤Î¤Ï[char_code]¤ÎÊý¤Ç¤¹¡£¤Þ¤È¤á¤ë¤È¡¢
(1) @<Display token |p|...@> [wchar_token]
(2) @<Pseudoprint the token list@> [wchar_token]
(3) @<Input from token list, [wchar_token]
(4) @<Look up the characters of list |r| [wchar_token]
(5) @ @<Fetch a character code from some table@> [char_code] [ck>0] (*1)
(6) procedure scan_char_num [char_code] [not ck] (*2)
(7) @<Change the case of the token in |p| [wchar_token]
(8) set_kansuji_char: [char_code] [not ck] (*3)
(9) assign_inhibit_xsp_code: [char_code] [ck] (*4)
(10) assign_kinsoku: [char_code] [ck] (*5)
*1 ¤Ï¸½¾õ°Ý»ý¤¬É¬¿Ü
*2 ¤Ï (not check_kanji(cur_val)) ¢ª (check_kanji(cur_val)<>1) ¤¬¥Ù¥¿¡¼
*3 ¤Ï (not check_kanji(t)) ¢ª (check_kanji(t)<>1) ¤¬¥Ù¥¿¡¼
*4 ¤Ï check_kanji(n) ¢ª check_kanji(n)>0 ¤¬¥Ù¥¿¡¼
*5 ¤ÏÎ㳰Ū¤Ë ¡Þ1 ¤ÎÊÖ¤êÃͤò´üÂÔ¤·¤Æ¤¤¤ë¡£¸½¾õ°Ý»ý¤¬É¬¿Ü
check_kanji() ¤Çcatcode¤¬¤Ä¤«¤Ê¤¤²¤Ê¸Ê¸»ú¥³¡¼¥É¤ò¼õ¤±ÉÕ¤±¤ë¤Î¤Ï
(10)¤Î¤È¤¤À¤±¤Ç¡¢c==256¤¬Àµ¾ïÆþÎϤµ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤¨¤Ê¤¤¡£
if (0 <= c && c <= 256) ¢ª if (0 <= c && c < 256) ¤¬¥Ù¥¿¡¼
check_kanji() ¤ÎÊÖ¤êÃͤÎboolean, integer¤Ï¤É¤Ã¤Á¤Ç¤âƱ¤¸¤è¤¦¤Ë¸«¤¨¤ë¡£
¤È¤ê¤¢¤¨¤º¡¢*2,*3,*4¤ÎÊѹ¹¤ò»Ü¤»¤Ð¡¢ZR¤µ¤ó¤´»ØŦ¤ÎÌäÂêÅÀ¤Î¤¦¤Á°ìÉôʬ¤Ï²ò¾Ã¤¹¤ë¤È»×¤¤¤Þ¤¹¡£\catcode`<ÏÂʸ>=<¿ô> ¤ä \xspcode`<ÏÂʸ>=<¿ô> ¤Î̵·Ù¹ð¥ª¡¼¥Ð¡¼¥é¥ó¤Ïľ¤ê¤Þ¤»¤ó¤¬¡£°Ê¾å¤ÎÄ´ºº·ë²Ì¤Ï¤½¤ì¤Û¤É¼«¿®¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¤Î¤Ç¤´ÍøÍѤκݤˤϤ褯¤è¤¯ÄÉ»î¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£ -- ttk
- ¤É¤³¤Þ¤Çľ¤¹¤Ù¤¤«¤ÎÌäÂê¤ÏÊÝα¤·¤Æ¡¢¸½¾õÇÄ°®¤ò¤·¤Æ¤ª¤¤Þ¤¹¡£
- ¥Æ¡¼¥Ö¥ë¤Ø¤ÎÉÔÀµ¤Ê½ñ¤¹þ¤ß¤òËɤ°¤Ë¤Ï¡¢
Î㤨¤Ð¼¡¤Î¤è¤¦¤Ë¤¹¤ì¤Ð¤è¤¤¤Ç¤·¤ç¤¦¡£
@<Let |m| be the minimal legal code value, based on |cur_chr|@>;
@<Let |n| be the largest legal code value, based on |cur_chr|@>;
p:=cur_chr; scan_int; {*a}
if p=kcat_code_base then { \kcatcode }
if <cur_val ¤¬´Á»ú¥³¡¼¥É> then p:=p+kcatcodekey(cur_val)
else begin print_err(...); help1(...); error; end {*b}
else { \catcode, \mathcode, \delcode Åù }
if <cur_val ¤¬ 0..255 ¤ÎÈÏ°Ï> then p:=p+cur_val
else begin print_err(...); help1(...); error; end; {*c}
scan_optional_equals; scan_int;
(Ãí°Õ)
*a scan_char_num ¤Ï¡Ö¿ôÃͤ¬ 0..255 ¤«´Á»ú¥³¡¼¥É¤Ç¤Ê¤¤¡×¤È
¤¤¤¦¥¨¥é¡¼¤ò½Ð¤¹¤¬¡¢¤³¤ì¤ÏÉÔŬÅö¡£
*b ¤³¤Î¥¨¥é¡¼¤òÆͤÃÀÚ¤ë¤È¡¢kcatcode ¤Î 0 ÈÖÌܤ˽ñ¤¹þ¤à¤¬¡¢
¤³¤ì¤Ï¸å¤ÎÆ°ºî¤Ë±Æ¶Á¤·¤Ê¤¤¡£
*c ¤³¤Î¥¨¥é¡¼¤òÆͤÃÀÚ¤ë¤È¡¢³ºÅö¥Æ¡¼¥Ö¥ë¤Î 0 ÈÖÌܤ˽ñ¤¹þ¤à¡£
¤³¤ì¤Ï²¤Ê¸ TeX ¤ÎÆ°ºî¤ÈƱ¤¸¡£
-- ZR
- *5 ¤Î \prebreakpenalty, \postbreakpenalty ¤Ï¡¢Î㤨¤Ð texmf/ptex/plain/base/kinsoku.tex ¤ÎÃæ¤Ë²¤Ê¸8bit¥³¡¼¥É¤ò°ú¿ô¤Ë¼è¤Ã¤¿»ÈÍÑÎ㤬¤¢¤ê¤Þ¤¹¡£ -- ttk
- ¤½¤ÎÄ̤ê¤Ç¤·¤¿¡£³Î¤«¤Ë¤³¤ì¤¬»ØÄê¤Ç¤¤Ê¤¤¤Èº¤¤ê¤Þ¤¹¤Í¡£¼ºÎ餷¤Þ¤·¤¿¡£ -- ZR
¤´°Õ¸«¤ò¤É¤¦¤¾ †
¤³¤Î¥Ú¡¼¥¸Á´È̤Τ´°Õ¸«¤ò²¼¤µ¤¤¡£
¸ÄÊ̤ÎÏÃÂê¤Ë¤Ï¡¢¤½¤ì¤¾¤ì½ñ¤¹þ¤à¾ì½ê¤òÍÑ°Õ¤·¤Æ¤¤¤Þ¤¹¡£