1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17\unprotect
18
19
20
21
22
23
24\let\m_syst_catcodes_temp\empty
25
26\protected\def\installactivecharacter#1
27 {\edef\m_syst_catcodes_temp{\detokenize{#1}}
28 \c_syst_catcodes_c\expandafter\m_syst_catcodes_temp\relax
29 \expandafter\startextendcatcodetable
30 \expandafter\ctxcatcodes\expandafter\catcode\the\c_syst_catcodes_c\activecatcode
31 \stopextendcatcodetable
32 \letcatcodecommand \ctxcatcodes \c_syst_catcodes_c \m_syst_catcodes_temp \relax
33 \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi
34 \let\m_syst_catcodes_temp\empty}
35
36
37
38
39
40
41
42\setnewconstant\c_syst_catcodes_hack\tildeasciicode
43
44\protected\def\defineactivecharacter #1#2 #3
45 {\c_syst_catcodes_c\uccode\c_syst_catcodes_hack
46 \if#1"\uccode\c_syst_catcodes_hack\expandafter\doifelsenumber\expandafter{\string#1#2}\empty #1#2\else
47 \uccode\c_syst_catcodes_hack\expandafter\doifelsenumber\expandafter{\string#1#2}\empty#1#2\fi
48 \catcode\uccode\c_syst_catcodes_hack\activecatcode
49 \uppercase{\def\m_syst_catcodes_temp{}}
50 \uccode\c_syst_catcodes_hack\c_syst_catcodes_c
51 \expandafter\expandafter\expandafter\def\expandafter\m_syst_catcodes_temp\expandafter
52 {\expandafter\syst_catcodes_handle\m_syst_catcodes_temp{#3}}
53 \let\m_syst_catcodes_temp\empty}
54
55\chardef\activecharactermode\plusone
56
57\def\syst_catcodes_handle
58 {\ifcase\activecharactermode
59 \expandafter\syst_catcodes_handle_nop
60 \else
61 \expandafter\syst_catcodes_handle_yes
62 \fi}
63
64\def\syst_catcodes_handle_yes#1#2{#2}
65\def\syst_catcodes_handle_nop#1#2{\noexpand#1}
66
67\protected\def\makecharacteractive #1
68 {\catcode#1\activecatcode}
69
70\protected\def\installanddefineactivecharacter #1
71 {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }
72 \defineactivecharacter #1 }
73
74\protect \endinput
75 |