-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathASCII.def
216 lines (179 loc) · 4.73 KB
/
ASCII.def
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
(*!m2r10*) (* Copyright (c) 2015 B.Kowarsch. All rights reserved. *)
DEFINITION MODULE ASCII;
(* Mnemonics and Tests for 7-bit ISO-646 code points *)
(* Control Codes *)
CONST
NUL = 0u0;
SOH = 0u01;
STX = 0u02;
ETX = 0u03;
EOL = 0u04;
ENQ = 0u05;
ACK = 0u06;
BEL = 0u07;
BS = 0u08;
HT = 0u09;
LF = 0u0A;
VT = 0u0B;
FF = 0u0C;
CR = 0u0D;
SO = 0u0E;
SI = 0u0F;
DLE = 0u10;
DC1 = 0u11;
DC2 = 0u12;
DC3 = 0u13;
DC4 = 0u14;
NAK = 0u15;
SYN = 0u16;
ETB = 0u17;
CAN = 0u18;
EM = 0u19;
SUB = 0u1A;
ESC = 0u1B;
FS = 0u1C;
GS = 0u1D;
RS = 0u1E;
US = 0u1F;
DEL = 0u7F;
(* Whitespace *)
SP = 0u20;
(* Digits *)
DIGIT_ZERO = 0u30;
DIGIT_ONE = 0u31;
DIGIT_TWO = 0u32;
DIGIT_THREE = 0u33;
DIGIT_FOUR = 0u34;
DIGIT_FIVE = 0u35;
DIGIT_SIX = 0u36;
DIGIT_SEVEN = 0u37;
DIGIT_EIGHT = 0u38;
DIGIT_NINE = 0u39;
(* Letters *)
SMALL_LETTER_A = 0u61;
SMALL_LETTER_B = 0u62;
SMALL_LETTER_C = 0u63;
SMALL_LETTER_D = 0u64;
SMALL_LETTER_E = 0u65;
SMALL_LETTER_F = 0u66;
SMALL_LETTER_G = 0u67;
SMALL_LETTER_H = 0u68;
SMALL_LETTER_I = 0u69;
SMALL_LETTER_J = 0u6A;
SMALL_LETTER_K = 0u6B;
SMALL_LETTER_L = 0u6C;
SMALL_LETTER_M = 0u6D;
SMALL_LETTER_N = 0u6E;
SMALL_LETTER_O = 0u6F;
SMALL_LETTER_P = 0u70;
SMALL_LETTER_Q = 0u71;
SMALL_LETTER_R = 0u72;
SMALL_LETTER_S = 0u73;
SMALL_LETTER_T = 0u74;
SMALL_LETTER_U = 0u75;
SMALL_LETTER_V = 0u76;
SMALL_LETTER_W = 0u77;
SMALL_LETTER_X = 0u78;
SMALL_LETTER_Y = 0u79;
SMALL_LETTER_Z = 0u7A;
CAPITAL_LETTER_A = 0u41;
CAPITAL_LETTER_B = 0u42;
CAPITAL_LETTER_C = 0u43;
CAPITAL_LETTER_D = 0u44;
CAPITAL_LETTER_E = 0u45;
CAPITAL_LETTER_F = 0u46;
CAPITAL_LETTER_G = 0u47;
CAPITAL_LETTER_H = 0u48;
CAPITAL_LETTER_I = 0u49;
CAPITAL_LETTER_J = 0u4A;
CAPITAL_LETTER_K = 0u4B;
CAPITAL_LETTER_L = 0u4C;
CAPITAL_LETTER_M = 0u4D;
CAPITAL_LETTER_N = 0u4E;
CAPITAL_LETTER_O = 0u4F;
CAPITAL_LETTER_P = 0u50;
CAPITAL_LETTER_Q = 0u51;
CAPITAL_LETTER_R = 0u52;
CAPITAL_LETTER_S = 0u53;
CAPITAL_LETTER_T = 0u54;
CAPITAL_LETTER_U = 0u55;
CAPITAL_LETTER_V = 0u56;
CAPITAL_LETTER_W = 0u57;
CAPITAL_LETTER_X = 0u58;
CAPITAL_LETTER_Y = 0u59;
CAPITAL_LETTER_Z = 0u5A;
(* Non-Alphanumeric *)
EXCLAMATION_MARK = 0u21;
QUOTATION_MARK = 0u22;
NUMBER_SIGN = 0u23;
DOLLAR_SIGN = 0u24;
PERCENT_SIGN = 0u25;
AMPERSAND = 0u26;
APOSTROPHE = 0u27;
LEFT_PARENTHESIS = 0u28;
RIGHT_PARENTHESIS = 0u29;
ASTERISK = 0u2A;
PLUS = 0u2B;
COMMA = 0u2C;
HYPHEN_MINUS = 0u2D;
FULLSTOP = 0u2E;
SOLIDUS = 0u2F;
COLON = 0u3A;
SEMICOLON = 0u3B;
LESS_THAN_SIGN = 0u3C;
EQUALS_SIGN = 0u3D;
GREATER_THAN_SIGN = 0u3E;
QUESTION_MARK = 0u3F;
COMMERCIAL_AT = 0u40;
LEFT_SQUARE_BRACKET = 0u5B;
REVERSE_SOLIDUS = 0u5C;
RIGHT_SQUARE_BRACKET = 0u5D;
CIRCUMFLEX_ACCENT = 0u5E;
LOW_LINE = 0u5F;
GRAVE_ACCENT = 0u60;
LEFT_CURLY_BRACKET = 0u7B;
VERTICAL_LINE = 0u7C;
RIGHT_CURLY_BRACKET = 0u7D;
TILDE = 0u7E;
(* Aliases *)
NEWLINE = LF;
TAB = HT;
SPACE = SP;
EXCLAMATION = EXCLAMATION_MARK;
QUOTATION = QUOTATION_MARK;
SINGLEQUOTE = APOSTROPHE;
DOUBLEQUOTE = QUOTATION_MARK;
OCTOTHORPE = NUMBER_SIGN;
MINUS = HYPHEN_MINUS;
SLASH = SOLIDUS;
LESS = LESS_THAN_SIGN;
EQUALS = EQUALS_SIGN;
GREATER = GREATER_THAN_SIGN;
QMARK = QUESTION_MARK;
BACKSLASH = REVERSE_SOLIDUS;
CARET = CIRCUMFLEX_ACCENT;
BACKQUOTE = GRAVE_ACCENT;
LPAREN = LEFT_PARENTHESIS;
RPAREN = RIGHT_PARENTHESIS;
LBRACKET = LEFT_SQUARE_BRACKET;
RBRACKET = RIGHT_SQUARE_BRACKET;
LBRACE = LEFT_CURLY_BRACKET;
RBRACE = RIGHT_CURLY_BRACKET;
(* Operations *)
PROCEDURE isControl ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is a control code, otherwise FALSE. *)
PROCEDURE isDigit ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is a digit, otherwise FALSE. *)
PROCEDURE isLetter ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is a letter, otherwise FALSE. *)
PROCEDURE isAlphaNum ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is alpha-numeric, otherwise FALSE. *)
PROCEDURE isUpper ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is an uppercase letter, otherwise FALSE. *)
PROCEDURE isLower ( ch : CHAR ) : BOOLEAN;
(* Returns TRUE if ch is a lowercase letter, otherwise FALSE. *)
PROCEDURE toUpper ( VAR ch : CHAR );
(* Passes back the uppercase equivalent of ch if ch is a lowercase letter. *)
PROCEDURE toLower ( VAR ch : CHAR );
(* Passes back the lowercase equivalent of ch if ch is an uppercase letter. *)
END ASCII.