summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/syst-chr.tex
blob: 085d7429f0dcf1520cea3e079d74d21626d0ba46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
%D \module
%D   [       file=syst-chr,
%D        version=1997.01.03, % moved code
%D          title=\CONTEXT\ System Macros,
%D       subtitle=Character Related Things,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

%D We want to have access to the raw alternatives of the
%D special characters. We use a \type {\xdef} instead of
%D \type {\let} because we need an expandable token in a
%D \type {\write}.

\bgroup

\catcode`B=\@@begingroup
\catcode`E=\@@endgroup
\catcode`.=\@@escape

.catcode `.{ 12 .xdef .letteropenbrace       B.string{E
.catcode `.} 12 .xdef .letterclosebrace      B.string}E
.catcode `.& 12 .xdef .letterampersand       B.string&E
.catcode `.< 12 .xdef .letterless            B.string<E
.catcode `.> 12 .xdef .lettermore            B.string>E
.catcode `.# 12 .xdef .letterhash            B.string#E
.catcode `." 12 .xdef .letterdoublequote     B.string"E
.catcode `.' 12 .xdef .lettersinglequote     B.string'E
.catcode `.$ 12 .xdef .letterdollar          B.string$E
.catcode `.% 12 .xdef .letterpercent         B.string%E
.catcode `.^ 12 .xdef .letterhat             B.string^E
.catcode `._ 12 .xdef .letterunderscore      B.string_E
.catcode `.| 12 .xdef .letterbar             B.string|E
.catcode `.~ 12 .xdef .lettertilde           B.string~E
.catcode `.\ 12 .xdef .letterbackslash       B.string\E
.catcode `./ 12 .xdef .letterslash           B.string/E
.catcode `.? 12 .xdef .letterquestionmark    B.string?E
.catcode `.! 12 .xdef .letterexclamationmark B.string!E
.catcode `.@ 12 .xdef .letterat              B.string@E
.catcode `.: 12 .xdef .lettercolon           B.string:E

         .global .let .letterescape     .letterbackslash
         .global .let .letterbgroup     .letteropenbrace
         .global .let .letteregroup     .letterclosebrace
         .global .let .letterleftbrace  .letteropenbrace
         .global .let .letterrightbrace .letterclosebrace

.egroup

%D \macros % check this one
%D   {setcatcodes,uncatcodespecials,
%D    uncatcodecharacters,uncatcodespacetokens,
%D    setnaturalcatcodes,
%D    setverbosecscharacters}
%D
%D As its name says, \type{\uncatcodecharacters} resets the
%D \CATCODE\ of characters. When we use an upper bound of
%D 127 or 255, depending in \type{\ifeightbitcharacters}. By
%D counting down, we only have to use one counter. The
%D macro \type{\setcatcodes} can be uses to set alternative
%D values. The macro \type{\resetspecialcharacters} resets
%D characters with special meanings. This macro is not used
%D in the verbatim macros, but is best defined in this module.

\newtoks\everycommoncatcodes   % gone
\newtoks\everynaturalcatcodes  % gone
\newtoks\everynormalcatcodes   % gone

\def\uncatcodespacetokens
  {\catcode`\   =\@@space
   \catcode`\^^L=\@@ignore
   \catcode`\^^M=\@@endofline
   \catcode`\^^?=\@@ignore}

\def\uncatcodespecials     {\setcatcodetable\nilcatcodes \uncatcodespacetokens}
\def\setnaturalcatcodes    {\setcatcodetable\nilcatcodes}
\def\setnormalcatcodes     {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes
\def\uncatcodecharacters   {\setcatcodetable\nilcatcodes} % was fast version, gone now
\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore

%D Next follows a definition that lets some shortcuts expand to
%D themselves.

\def\setverbosecscharacter#1%
  {\edef#1{\string#1}}

\bgroup \catcode`\|=13 \catcode`\~=13

\gdef\setverbosecscharacters % temporary hack
  {\setverbosecscharacter |\setverbosecscharacter ~% context specific
   \setverbosecscharacter\|\setverbosecscharacter\~%
   \setverbosecscharacter\:\setverbosecscharacter\;%
   \setverbosecscharacter\+\setverbosecscharacter\-%
   \setverbosecscharacter\[\setverbosecscharacter\]%
   \setverbosecscharacter\.\setverbosecscharacter\\%
   \setverbosecscharacter\)\setverbosecscharacter\(%
   \setverbosecscharacter\0\setverbosecscharacter\1%
   \setverbosecscharacter\2\setverbosecscharacter\3%
   \setverbosecscharacter\4\setverbosecscharacter\5%
   \setverbosecscharacter\6\setverbosecscharacter\7%
   \setverbosecscharacter\8\setverbosecscharacter\9%
   \setverbosecscharacter\n\setverbosecscharacter\s%
   \setverbosecscharacter\/}

\egroup

%D \macros
%D   {frenchspacing,nonfrenchspacing}
%D
%D This code should move.

\def\setfrenchspacing#1%
  {\sfcode`\.#1 \sfcode`\,#1\relax
   \sfcode`\?#1 \sfcode`\!#1\relax
   \sfcode`\:#1 \sfcode`\;#1\relax}

\def\frenchspacing
  {\setfrenchspacing{1000}}

\def\resetfrenchspacing
  {\sfcode`\.3000 \sfcode`\,1250
   \sfcode`\?3000 \sfcode`\!3000
   \sfcode`\:2000 \sfcode`\;1500 }

\protect \endinput