xref: /freebsd/contrib/bc/src/data.c (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
1 /*
2  * *****************************************************************************
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  *
6  * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * * Redistributions of source code must retain the above copyright notice, this
12  *   list of conditions and the following disclaimer.
13  *
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  *   this list of conditions and the following disclaimer in the documentation
16  *   and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * *****************************************************************************
31  *
32  * Constant data for bc.
33  *
34  */
35 
36 #include <assert.h>
37 
38 #include <opt.h>
39 #include <args.h>
40 #include <lex.h>
41 #include <parse.h>
42 #include <bc.h>
43 #include <dc.h>
44 #include <num.h>
45 #include <rand.h>
46 #include <program.h>
47 #include <history.h>
48 #include <library.h>
49 #include <vm.h>
50 
51 #if !BC_ENABLE_LIBRARY
52 
53 #if BC_ENABLED
54 
55 /// The bc signal message and its length.
56 const char bc_sig_msg[] = "\ninterrupt (type \"quit\" to exit)\n";
57 const uchar bc_sig_msg_len = (uchar) (sizeof(bc_sig_msg) - 1);
58 
59 #endif // BC_ENABLED
60 
61 #if DC_ENABLED
62 
63 /// The dc signal message and its length.
64 const char dc_sig_msg[] = "\ninterrupt (type \"q\" to exit)\n";
65 const uchar dc_sig_msg_len = (uchar) (sizeof(dc_sig_msg) - 1);
66 
67 #endif // DC_ENABLED
68 
69 // clang-format off
70 
71 /// The copyright banner.
72 const char bc_copyright[] =
73 	"Copyright (c) 2018-2024 Gavin D. Howard and contributors\n"
74 	"Report bugs at: https://git.gavinhoward.com/gavin/bc\n\n"
75 	"This is free software with ABSOLUTELY NO WARRANTY.\n";
76 
77 // clang-format on
78 
79 #ifdef __OpenBSD__
80 
81 #if BC_ENABLE_EXTRA_MATH
82 
83 #if BC_ENABLE_HISTORY
84 
85 /// The pledges for starting bc.
86 const char bc_pledge_start[] = "rpath stdio tty unveil";
87 
88 /// The final pledges with history enabled.
89 const char bc_pledge_end_history[] = "rpath stdio tty";
90 
91 #else // BC_ENABLE_HISTORY
92 
93 /// The pledges for starting bc.
94 const char bc_pledge_start[] = "rpath stdio unveil";
95 
96 #endif // BC_ENABLE_HISTORY
97 
98 /// The final pledges with history history disabled.
99 const char bc_pledge_end[] = "rpath stdio";
100 
101 #else // BC_ENABLE_EXTRA_MATH
102 
103 #if BC_ENABLE_HISTORY
104 
105 /// The pledges for starting bc.
106 const char bc_pledge_start[] = "rpath stdio tty";
107 
108 /// The final pledges with history enabled.
109 const char bc_pledge_end_history[] = "stdio tty";
110 
111 #else // BC_ENABLE_HISTORY
112 
113 /// The pledges for starting bc.
114 const char bc_pledge_start[] = "rpath stdio";
115 
116 #endif // BC_ENABLE_HISTORY
117 
118 /// The final pledges with history history disabled.
119 const char bc_pledge_end[] = "stdio";
120 
121 #endif // BC_ENABLE_EXTRA_MATH
122 
123 #else // __OpenBSD__
124 
125 /// The pledges for starting bc.
126 const char bc_pledge_start[] = "";
127 
128 #if BC_ENABLE_HISTORY
129 
130 /// The final pledges with history enabled.
131 const char bc_pledge_end_history[] = "";
132 
133 #endif // BC_ENABLE_HISTORY
134 
135 /// The final pledges with history history disabled.
136 const char bc_pledge_end[] = "";
137 
138 #endif // __OpenBSD__
139 
140 /// The list of long options. There is a zero set at the end for detecting the
141 /// end.
142 const BcOptLong bc_args_lopt[] = {
143 
144 	{ "digit-clamp", BC_OPT_NONE, 'c' },
145 	{ "expression", BC_OPT_REQUIRED, 'e' },
146 	{ "file", BC_OPT_REQUIRED, 'f' },
147 	{ "help", BC_OPT_NONE, 'h' },
148 	{ "interactive", BC_OPT_NONE, 'i' },
149 	{ "ibase", BC_OPT_REQUIRED, 'I' },
150 	{ "leading-zeroes", BC_OPT_NONE, 'z' },
151 	{ "no-line-length", BC_OPT_NONE, 'L' },
152 	{ "obase", BC_OPT_REQUIRED, 'O' },
153 	{ "no-digit-clamp", BC_OPT_NONE, 'C' },
154 	{ "no-prompt", BC_OPT_NONE, 'P' },
155 	{ "no-read-prompt", BC_OPT_NONE, 'R' },
156 	{ "scale", BC_OPT_REQUIRED, 'S' },
157 #if BC_ENABLE_EXTRA_MATH
158 	{ "seed", BC_OPT_REQUIRED, 'E' },
159 #endif // BC_ENABLE_EXTRA_MATH
160 #if BC_ENABLED
161 	{ "global-stacks", BC_OPT_BC_ONLY, 'g' },
162 	{ "mathlib", BC_OPT_BC_ONLY, 'l' },
163 	{ "quiet", BC_OPT_BC_ONLY, 'q' },
164 	{ "redefine", BC_OPT_REQUIRED_BC_ONLY, 'r' },
165 	{ "standard", BC_OPT_BC_ONLY, 's' },
166 	{ "warn", BC_OPT_BC_ONLY, 'w' },
167 #endif // BC_ENABLED
168 	{ "version", BC_OPT_NONE, 'v' },
169 	{ "version", BC_OPT_NONE, 'V' },
170 #if DC_ENABLED
171 	{ "extended-register", BC_OPT_DC_ONLY, 'x' },
172 #endif // DC_ENABLED
173 	{ NULL, 0, 0 },
174 
175 };
176 
177 #if BC_ENABLE_OSSFUZZ
178 
179 const char* bc_fuzzer_args_c[] = {
180 	"bc",
181 	"-lqc",
182 	"-e",
183 	"seed = 82507683022933941343198991100880559238.7080266844215897551270760113"
184 	"4734858017748592704189096562163085637164174146616055338762825421827784"
185 	"566630725748836994171142578125",
186 	NULL,
187 };
188 
189 const char* dc_fuzzer_args_c[] = {
190 	"dc",
191 	"-xc",
192 	"-e",
193 	"82507683022933941343198991100880559238.7080266844215897551270760113"
194 	"4734858017748592704189096562163085637164174146616055338762825421827784"
195 	"566630725748836994171142578125j",
196 	NULL,
197 };
198 
199 const char* bc_fuzzer_args_C[] = {
200 	"bc",
201 	"-lqC",
202 	"-e",
203 	"seed = 82507683022933941343198991100880559238.7080266844215897551270760113"
204 	"4734858017748592704189096562163085637164174146616055338762825421827784"
205 	"566630725748836994171142578125",
206 	NULL,
207 };
208 
209 const char* dc_fuzzer_args_C[] = {
210 	"dc",
211 	"-xC",
212 	"-e",
213 	"82507683022933941343198991100880559238.7080266844215897551270760113"
214 	"4734858017748592704189096562163085637164174146616055338762825421827784"
215 	"566630725748836994171142578125j",
216 	NULL,
217 };
218 
219 const size_t bc_fuzzer_args_len = sizeof(bc_fuzzer_args_c) / sizeof(char*);
220 
221 #if BC_C11
222 
223 _Static_assert(sizeof(bc_fuzzer_args_C) / sizeof(char*) == bc_fuzzer_args_len,
224                "Wrong number of bc fuzzer args");
225 
226 _Static_assert(sizeof(dc_fuzzer_args_c) / sizeof(char*) == bc_fuzzer_args_len,
227                "Wrong number of dc fuzzer args");
228 
229 _Static_assert(sizeof(dc_fuzzer_args_C) / sizeof(char*) == bc_fuzzer_args_len,
230                "Wrong number of dc fuzzer args");
231 
232 #endif // BC_C11
233 
234 #endif // BC_ENABLE_OSSFUZZ
235 
236 // clang-format off
237 
238 /// The default error category strings.
239 const char *bc_errs[] = {
240 	"Math error:",
241 	"Parse error:",
242 	"Runtime error:",
243 	"Fatal error:",
244 #if BC_ENABLED
245 	"Warning:",
246 #endif // BC_ENABLED
247 };
248 
249 // clang-format on
250 
251 /// The error category for each error.
252 const uchar bc_err_ids[] = {
253 
254 	BC_ERR_IDX_MATH,  BC_ERR_IDX_MATH,  BC_ERR_IDX_MATH,  BC_ERR_IDX_MATH,
255 
256 	BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL,
257 	BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL, BC_ERR_IDX_FATAL,
258 	BC_ERR_IDX_FATAL,
259 
260 	BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,
261 	BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,
262 	BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,  BC_ERR_IDX_EXEC,
263 
264 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
265 	BC_ERR_IDX_PARSE,
266 #if BC_ENABLED
267 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
268 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
269 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
270 
271 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
272 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
273 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
274 	BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE, BC_ERR_IDX_PARSE,
275 #endif // BC_ENABLED
276 
277 };
278 
279 /// The default error messages. There are NULL pointers because the positions
280 /// must be preserved for the locales.
281 const char* const bc_err_msgs[] = {
282 
283 	"negative number",
284 	"non-integer number",
285 	"overflow: number cannot fit",
286 	"divide by 0",
287 
288 	"memory allocation failed",
289 	"I/O error",
290 	"cannot open file: %s",
291 	"file is not text: %s",
292 	"path is a directory: %s",
293 	"bad command-line option: \"%s\"",
294 	"option requires an argument: '%c' (\"%s\")",
295 	"option takes no arguments: '%c' (\"%s\")",
296 	"bad option argument: \"%s\"",
297 
298 	"bad ibase: must be [%lu, %lu]",
299 	"bad obase: must be [%lu, %lu]",
300 	"bad scale: must be [%lu, %lu]",
301 	"bad read() expression",
302 	"read() call inside of a read() call",
303 	"variable or array element is the wrong type",
304 #if DC_ENABLED
305 	"stack has too few elements",
306 	"stack for register \"%s\" has too few elements",
307 #else // DC_ENABLED
308 	NULL,
309 	NULL,
310 #endif // DC_ENABLED
311 #if BC_ENABLED
312 	"wrong number of parameters; need %zu, have %zu",
313 	"undefined function: %s()",
314 	"cannot use a void value in an expression",
315 #else
316 	NULL,
317 	NULL,
318 	NULL,
319 #endif // BC_ENABLED
320 
321 	"end of file",
322 	"bad character '%c'",
323 	"string end cannot be found",
324 	"comment end cannot be found",
325 	"bad token",
326 #if BC_ENABLED
327 	"bad expression",
328 	"empty expression",
329 	"bad print or stream statement",
330 	"bad function definition",
331 	("bad assignment: left side must be scale, ibase, "
332 	 "obase, seed, last, var, or array element"),
333 	"no auto variable found",
334 	"function parameter or auto \"%s%s\" already exists",
335 	"block end cannot be found",
336 	"cannot return a value from void function: %s()",
337 	"var cannot be a reference: %s",
338 
339 	"POSIX does not allow names longer than 1 character: %s",
340 	"POSIX does not allow '#' script comments",
341 	"POSIX does not allow the following keyword: %s",
342 	"POSIX does not allow a period ('.') as a shortcut for the last result",
343 	"POSIX requires parentheses around return expressions",
344 	"POSIX does not allow the following operator: %s",
345 	"POSIX does not allow comparison operators outside if statements or loops",
346 	"POSIX requires 0 or 1 comparison operators per condition",
347 	"POSIX requires all 3 parts of a for loop to be non-empty",
348 	"POSIX requires a newline between a semicolon and a function definition",
349 #if BC_ENABLE_EXTRA_MATH
350 	"POSIX does not allow exponential notation",
351 #else
352 	NULL,
353 #endif // BC_ENABLE_EXTRA_MATH
354 	"POSIX does not allow array references as function parameters",
355 	"POSIX does not allow void functions",
356 	"POSIX requires the left brace be on the same line as the function header",
357 	"POSIX does not allow strings to be assigned to variables or arrays",
358 #endif // BC_ENABLED
359 
360 };
361 
362 #endif // !BC_ENABLE_LIBRARY
363 
364 /// The destructors corresponding to BcDtorType enum items.
365 const BcVecFree bc_vec_dtors[] = {
366 	NULL,
367 	bc_vec_free,
368 	bc_num_free,
369 #if !BC_ENABLE_LIBRARY
370 #if BC_DEBUG
371 	bc_func_free,
372 #endif // BC_DEBUG
373 	bc_slab_free,
374 	bc_const_free,
375 	bc_result_free,
376 #if BC_ENABLE_HISTORY && !BC_ENABLE_LINE_LIB
377 	bc_history_string_free,
378 #endif // BC_ENABLE_HISTORY && !BC_ENABLE_LINE_LIB
379 #else // !BC_ENABLE_LIBRARY
380 	bcl_num_destruct,
381 #endif // !BC_ENABLE_LIBRARY
382 };
383 
384 #if !BC_ENABLE_LIBRARY
385 
386 #if BC_ENABLE_EDITLINE
387 
388 /// The normal path to the editrc.
389 const char bc_history_editrc[] = "/.editrc";
390 
391 /// The length of the normal path to the editrc.
392 const size_t bc_history_editrc_len = sizeof(bc_history_editrc) - 1;
393 
394 #endif // BC_ENABLE_EDITLINE
395 
396 #if BC_ENABLE_HISTORY && !BC_ENABLE_LINE_LIB
397 
398 /// A flush type for not clearing current extras but not saving new ones either.
399 const BcFlushType bc_flush_none = BC_FLUSH_NO_EXTRAS_NO_CLEAR;
400 
401 /// A flush type for clearing extras and not saving new ones.
402 const BcFlushType bc_flush_err = BC_FLUSH_NO_EXTRAS_CLEAR;
403 
404 /// A flush type for clearing previous extras and saving new ones.
405 const BcFlushType bc_flush_save = BC_FLUSH_SAVE_EXTRAS_CLEAR;
406 
407 /// A list of known bad terminals.
408 const char* bc_history_bad_terms[] = { "dumb", "cons25", "emacs", NULL };
409 
410 /// A constant for tabs and its length. My tab handling is dumb and always
411 /// outputs the entire thing.
412 const char bc_history_tab[] = "\t";
413 const size_t bc_history_tab_len = sizeof(bc_history_tab) - 1;
414 
415 /// A list of wide chars. These are listed in ascending order for efficiency.
416 const uint32_t bc_history_wchars[][2] = {
417 	{ 0x1100, 0x115F },   { 0x231A, 0x231B },   { 0x2329, 0x232A },
418 	{ 0x23E9, 0x23EC },   { 0x23F0, 0x23F0 },   { 0x23F3, 0x23F3 },
419 	{ 0x25FD, 0x25FE },   { 0x2614, 0x2615 },   { 0x2648, 0x2653 },
420 	{ 0x267F, 0x267F },   { 0x2693, 0x2693 },   { 0x26A1, 0x26A1 },
421 	{ 0x26AA, 0x26AB },   { 0x26BD, 0x26BE },   { 0x26C4, 0x26C5 },
422 	{ 0x26CE, 0x26CE },   { 0x26D4, 0x26D4 },   { 0x26EA, 0x26EA },
423 	{ 0x26F2, 0x26F3 },   { 0x26F5, 0x26F5 },   { 0x26FA, 0x26FA },
424 	{ 0x26FD, 0x26FD },   { 0x2705, 0x2705 },   { 0x270A, 0x270B },
425 	{ 0x2728, 0x2728 },   { 0x274C, 0x274C },   { 0x274E, 0x274E },
426 	{ 0x2753, 0x2755 },   { 0x2757, 0x2757 },   { 0x2795, 0x2797 },
427 	{ 0x27B0, 0x27B0 },   { 0x27BF, 0x27BF },   { 0x2B1B, 0x2B1C },
428 	{ 0x2B50, 0x2B50 },   { 0x2B55, 0x2B55 },   { 0x2E80, 0x2E99 },
429 	{ 0x2E9B, 0x2EF3 },   { 0x2F00, 0x2FD5 },   { 0x2FF0, 0x2FFB },
430 	{ 0x3001, 0x303E },   { 0x3041, 0x3096 },   { 0x3099, 0x30FF },
431 	{ 0x3105, 0x312D },   { 0x3131, 0x318E },   { 0x3190, 0x31BA },
432 	{ 0x31C0, 0x31E3 },   { 0x31F0, 0x321E },   { 0x3220, 0x3247 },
433 	{ 0x3250, 0x32FE },   { 0x3300, 0x4DBF },   { 0x4E00, 0xA48C },
434 	{ 0xA490, 0xA4C6 },   { 0xA960, 0xA97C },   { 0xAC00, 0xD7A3 },
435 	{ 0xF900, 0xFAFF },   { 0xFE10, 0xFE19 },   { 0xFE30, 0xFE52 },
436 	{ 0xFE54, 0xFE66 },   { 0xFE68, 0xFE6B },   { 0x16FE0, 0x16FE0 },
437 	{ 0x17000, 0x187EC }, { 0x18800, 0x18AF2 }, { 0x1B000, 0x1B001 },
438 	{ 0x1F004, 0x1F004 }, { 0x1F0CF, 0x1F0CF }, { 0x1F18E, 0x1F18E },
439 	{ 0x1F191, 0x1F19A }, { 0x1F200, 0x1F202 }, { 0x1F210, 0x1F23B },
440 	{ 0x1F240, 0x1F248 }, { 0x1F250, 0x1F251 }, { 0x1F300, 0x1F320 },
441 	{ 0x1F32D, 0x1F335 }, { 0x1F337, 0x1F37C }, { 0x1F37E, 0x1F393 },
442 	{ 0x1F3A0, 0x1F3CA }, { 0x1F3CF, 0x1F3D3 }, { 0x1F3E0, 0x1F3F0 },
443 	{ 0x1F3F4, 0x1F3F4 }, { 0x1F3F8, 0x1F43E }, { 0x1F440, 0x1F440 },
444 	{ 0x1F442, 0x1F4FC }, { 0x1F4FF, 0x1F53D }, { 0x1F54B, 0x1F54E },
445 	{ 0x1F550, 0x1F567 }, { 0x1F57A, 0x1F57A }, { 0x1F595, 0x1F596 },
446 	{ 0x1F5A4, 0x1F5A4 }, { 0x1F5FB, 0x1F64F }, { 0x1F680, 0x1F6C5 },
447 	{ 0x1F6CC, 0x1F6CC }, { 0x1F6D0, 0x1F6D2 }, { 0x1F6EB, 0x1F6EC },
448 	{ 0x1F6F4, 0x1F6F6 }, { 0x1F910, 0x1F91E }, { 0x1F920, 0x1F927 },
449 	{ 0x1F930, 0x1F930 }, { 0x1F933, 0x1F93E }, { 0x1F940, 0x1F94B },
450 	{ 0x1F950, 0x1F95E }, { 0x1F980, 0x1F991 }, { 0x1F9C0, 0x1F9C0 },
451 	{ 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD },
452 };
453 
454 /// The length of the wide chars list.
455 const size_t bc_history_wchars_len = sizeof(bc_history_wchars) /
456                                      sizeof(bc_history_wchars[0]);
457 
458 /// A list of combining characters in Unicode. These are listed in ascending
459 /// order for efficiency.
460 const uint32_t bc_history_combo_chars[] = {
461 	0x0300,  0x0301,  0x0302,  0x0303,  0x0304,  0x0305,  0x0306,  0x0307,
462 	0x0308,  0x0309,  0x030A,  0x030B,  0x030C,  0x030D,  0x030E,  0x030F,
463 	0x0310,  0x0311,  0x0312,  0x0313,  0x0314,  0x0315,  0x0316,  0x0317,
464 	0x0318,  0x0319,  0x031A,  0x031B,  0x031C,  0x031D,  0x031E,  0x031F,
465 	0x0320,  0x0321,  0x0322,  0x0323,  0x0324,  0x0325,  0x0326,  0x0327,
466 	0x0328,  0x0329,  0x032A,  0x032B,  0x032C,  0x032D,  0x032E,  0x032F,
467 	0x0330,  0x0331,  0x0332,  0x0333,  0x0334,  0x0335,  0x0336,  0x0337,
468 	0x0338,  0x0339,  0x033A,  0x033B,  0x033C,  0x033D,  0x033E,  0x033F,
469 	0x0340,  0x0341,  0x0342,  0x0343,  0x0344,  0x0345,  0x0346,  0x0347,
470 	0x0348,  0x0349,  0x034A,  0x034B,  0x034C,  0x034D,  0x034E,  0x034F,
471 	0x0350,  0x0351,  0x0352,  0x0353,  0x0354,  0x0355,  0x0356,  0x0357,
472 	0x0358,  0x0359,  0x035A,  0x035B,  0x035C,  0x035D,  0x035E,  0x035F,
473 	0x0360,  0x0361,  0x0362,  0x0363,  0x0364,  0x0365,  0x0366,  0x0367,
474 	0x0368,  0x0369,  0x036A,  0x036B,  0x036C,  0x036D,  0x036E,  0x036F,
475 	0x0483,  0x0484,  0x0485,  0x0486,  0x0487,  0x0591,  0x0592,  0x0593,
476 	0x0594,  0x0595,  0x0596,  0x0597,  0x0598,  0x0599,  0x059A,  0x059B,
477 	0x059C,  0x059D,  0x059E,  0x059F,  0x05A0,  0x05A1,  0x05A2,  0x05A3,
478 	0x05A4,  0x05A5,  0x05A6,  0x05A7,  0x05A8,  0x05A9,  0x05AA,  0x05AB,
479 	0x05AC,  0x05AD,  0x05AE,  0x05AF,  0x05B0,  0x05B1,  0x05B2,  0x05B3,
480 	0x05B4,  0x05B5,  0x05B6,  0x05B7,  0x05B8,  0x05B9,  0x05BA,  0x05BB,
481 	0x05BC,  0x05BD,  0x05BF,  0x05C1,  0x05C2,  0x05C4,  0x05C5,  0x05C7,
482 	0x0610,  0x0611,  0x0612,  0x0613,  0x0614,  0x0615,  0x0616,  0x0617,
483 	0x0618,  0x0619,  0x061A,  0x064B,  0x064C,  0x064D,  0x064E,  0x064F,
484 	0x0650,  0x0651,  0x0652,  0x0653,  0x0654,  0x0655,  0x0656,  0x0657,
485 	0x0658,  0x0659,  0x065A,  0x065B,  0x065C,  0x065D,  0x065E,  0x065F,
486 	0x0670,  0x06D6,  0x06D7,  0x06D8,  0x06D9,  0x06DA,  0x06DB,  0x06DC,
487 	0x06DF,  0x06E0,  0x06E1,  0x06E2,  0x06E3,  0x06E4,  0x06E7,  0x06E8,
488 	0x06EA,  0x06EB,  0x06EC,  0x06ED,  0x0711,  0x0730,  0x0731,  0x0732,
489 	0x0733,  0x0734,  0x0735,  0x0736,  0x0737,  0x0738,  0x0739,  0x073A,
490 	0x073B,  0x073C,  0x073D,  0x073E,  0x073F,  0x0740,  0x0741,  0x0742,
491 	0x0743,  0x0744,  0x0745,  0x0746,  0x0747,  0x0748,  0x0749,  0x074A,
492 	0x07A6,  0x07A7,  0x07A8,  0x07A9,  0x07AA,  0x07AB,  0x07AC,  0x07AD,
493 	0x07AE,  0x07AF,  0x07B0,  0x07EB,  0x07EC,  0x07ED,  0x07EE,  0x07EF,
494 	0x07F0,  0x07F1,  0x07F2,  0x07F3,  0x0816,  0x0817,  0x0818,  0x0819,
495 	0x081B,  0x081C,  0x081D,  0x081E,  0x081F,  0x0820,  0x0821,  0x0822,
496 	0x0823,  0x0825,  0x0826,  0x0827,  0x0829,  0x082A,  0x082B,  0x082C,
497 	0x082D,  0x0859,  0x085A,  0x085B,  0x08D4,  0x08D5,  0x08D6,  0x08D7,
498 	0x08D8,  0x08D9,  0x08DA,  0x08DB,  0x08DC,  0x08DD,  0x08DE,  0x08DF,
499 	0x08E0,  0x08E1,  0x08E3,  0x08E4,  0x08E5,  0x08E6,  0x08E7,  0x08E8,
500 	0x08E9,  0x08EA,  0x08EB,  0x08EC,  0x08ED,  0x08EE,  0x08EF,  0x08F0,
501 	0x08F1,  0x08F2,  0x08F3,  0x08F4,  0x08F5,  0x08F6,  0x08F7,  0x08F8,
502 	0x08F9,  0x08FA,  0x08FB,  0x08FC,  0x08FD,  0x08FE,  0x08FF,  0x0900,
503 	0x0901,  0x0902,  0x093A,  0x093C,  0x0941,  0x0942,  0x0943,  0x0944,
504 	0x0945,  0x0946,  0x0947,  0x0948,  0x094D,  0x0951,  0x0952,  0x0953,
505 	0x0954,  0x0955,  0x0956,  0x0957,  0x0962,  0x0963,  0x0981,  0x09BC,
506 	0x09C1,  0x09C2,  0x09C3,  0x09C4,  0x09CD,  0x09E2,  0x09E3,  0x0A01,
507 	0x0A02,  0x0A3C,  0x0A41,  0x0A42,  0x0A47,  0x0A48,  0x0A4B,  0x0A4C,
508 	0x0A4D,  0x0A51,  0x0A70,  0x0A71,  0x0A75,  0x0A81,  0x0A82,  0x0ABC,
509 	0x0AC1,  0x0AC2,  0x0AC3,  0x0AC4,  0x0AC5,  0x0AC7,  0x0AC8,  0x0ACD,
510 	0x0AE2,  0x0AE3,  0x0B01,  0x0B3C,  0x0B3F,  0x0B41,  0x0B42,  0x0B43,
511 	0x0B44,  0x0B4D,  0x0B56,  0x0B62,  0x0B63,  0x0B82,  0x0BC0,  0x0BCD,
512 	0x0C00,  0x0C3E,  0x0C3F,  0x0C40,  0x0C46,  0x0C47,  0x0C48,  0x0C4A,
513 	0x0C4B,  0x0C4C,  0x0C4D,  0x0C55,  0x0C56,  0x0C62,  0x0C63,  0x0C81,
514 	0x0CBC,  0x0CBF,  0x0CC6,  0x0CCC,  0x0CCD,  0x0CE2,  0x0CE3,  0x0D01,
515 	0x0D41,  0x0D42,  0x0D43,  0x0D44,  0x0D4D,  0x0D62,  0x0D63,  0x0DCA,
516 	0x0DD2,  0x0DD3,  0x0DD4,  0x0DD6,  0x0E31,  0x0E34,  0x0E35,  0x0E36,
517 	0x0E37,  0x0E38,  0x0E39,  0x0E3A,  0x0E47,  0x0E48,  0x0E49,  0x0E4A,
518 	0x0E4B,  0x0E4C,  0x0E4D,  0x0E4E,  0x0EB1,  0x0EB4,  0x0EB5,  0x0EB6,
519 	0x0EB7,  0x0EB8,  0x0EB9,  0x0EBB,  0x0EBC,  0x0EC8,  0x0EC9,  0x0ECA,
520 	0x0ECB,  0x0ECC,  0x0ECD,  0x0F18,  0x0F19,  0x0F35,  0x0F37,  0x0F39,
521 	0x0F71,  0x0F72,  0x0F73,  0x0F74,  0x0F75,  0x0F76,  0x0F77,  0x0F78,
522 	0x0F79,  0x0F7A,  0x0F7B,  0x0F7C,  0x0F7D,  0x0F7E,  0x0F80,  0x0F81,
523 	0x0F82,  0x0F83,  0x0F84,  0x0F86,  0x0F87,  0x0F8D,  0x0F8E,  0x0F8F,
524 	0x0F90,  0x0F91,  0x0F92,  0x0F93,  0x0F94,  0x0F95,  0x0F96,  0x0F97,
525 	0x0F99,  0x0F9A,  0x0F9B,  0x0F9C,  0x0F9D,  0x0F9E,  0x0F9F,  0x0FA0,
526 	0x0FA1,  0x0FA2,  0x0FA3,  0x0FA4,  0x0FA5,  0x0FA6,  0x0FA7,  0x0FA8,
527 	0x0FA9,  0x0FAA,  0x0FAB,  0x0FAC,  0x0FAD,  0x0FAE,  0x0FAF,  0x0FB0,
528 	0x0FB1,  0x0FB2,  0x0FB3,  0x0FB4,  0x0FB5,  0x0FB6,  0x0FB7,  0x0FB8,
529 	0x0FB9,  0x0FBA,  0x0FBB,  0x0FBC,  0x0FC6,  0x102D,  0x102E,  0x102F,
530 	0x1030,  0x1032,  0x1033,  0x1034,  0x1035,  0x1036,  0x1037,  0x1039,
531 	0x103A,  0x103D,  0x103E,  0x1058,  0x1059,  0x105E,  0x105F,  0x1060,
532 	0x1071,  0x1072,  0x1073,  0x1074,  0x1082,  0x1085,  0x1086,  0x108D,
533 	0x109D,  0x135D,  0x135E,  0x135F,  0x1712,  0x1713,  0x1714,  0x1732,
534 	0x1733,  0x1734,  0x1752,  0x1753,  0x1772,  0x1773,  0x17B4,  0x17B5,
535 	0x17B7,  0x17B8,  0x17B9,  0x17BA,  0x17BB,  0x17BC,  0x17BD,  0x17C6,
536 	0x17C9,  0x17CA,  0x17CB,  0x17CC,  0x17CD,  0x17CE,  0x17CF,  0x17D0,
537 	0x17D1,  0x17D2,  0x17D3,  0x17DD,  0x180B,  0x180C,  0x180D,  0x1885,
538 	0x1886,  0x18A9,  0x1920,  0x1921,  0x1922,  0x1927,  0x1928,  0x1932,
539 	0x1939,  0x193A,  0x193B,  0x1A17,  0x1A18,  0x1A1B,  0x1A56,  0x1A58,
540 	0x1A59,  0x1A5A,  0x1A5B,  0x1A5C,  0x1A5D,  0x1A5E,  0x1A60,  0x1A62,
541 	0x1A65,  0x1A66,  0x1A67,  0x1A68,  0x1A69,  0x1A6A,  0x1A6B,  0x1A6C,
542 	0x1A73,  0x1A74,  0x1A75,  0x1A76,  0x1A77,  0x1A78,  0x1A79,  0x1A7A,
543 	0x1A7B,  0x1A7C,  0x1A7F,  0x1AB0,  0x1AB1,  0x1AB2,  0x1AB3,  0x1AB4,
544 	0x1AB5,  0x1AB6,  0x1AB7,  0x1AB8,  0x1AB9,  0x1ABA,  0x1ABB,  0x1ABC,
545 	0x1ABD,  0x1B00,  0x1B01,  0x1B02,  0x1B03,  0x1B34,  0x1B36,  0x1B37,
546 	0x1B38,  0x1B39,  0x1B3A,  0x1B3C,  0x1B42,  0x1B6B,  0x1B6C,  0x1B6D,
547 	0x1B6E,  0x1B6F,  0x1B70,  0x1B71,  0x1B72,  0x1B73,  0x1B80,  0x1B81,
548 	0x1BA2,  0x1BA3,  0x1BA4,  0x1BA5,  0x1BA8,  0x1BA9,  0x1BAB,  0x1BAC,
549 	0x1BAD,  0x1BE6,  0x1BE8,  0x1BE9,  0x1BED,  0x1BEF,  0x1BF0,  0x1BF1,
550 	0x1C2C,  0x1C2D,  0x1C2E,  0x1C2F,  0x1C30,  0x1C31,  0x1C32,  0x1C33,
551 	0x1C36,  0x1C37,  0x1CD0,  0x1CD1,  0x1CD2,  0x1CD4,  0x1CD5,  0x1CD6,
552 	0x1CD7,  0x1CD8,  0x1CD9,  0x1CDA,  0x1CDB,  0x1CDC,  0x1CDD,  0x1CDE,
553 	0x1CDF,  0x1CE0,  0x1CE2,  0x1CE3,  0x1CE4,  0x1CE5,  0x1CE6,  0x1CE7,
554 	0x1CE8,  0x1CED,  0x1CF4,  0x1CF8,  0x1CF9,  0x1DC0,  0x1DC1,  0x1DC2,
555 	0x1DC3,  0x1DC4,  0x1DC5,  0x1DC6,  0x1DC7,  0x1DC8,  0x1DC9,  0x1DCA,
556 	0x1DCB,  0x1DCC,  0x1DCD,  0x1DCE,  0x1DCF,  0x1DD0,  0x1DD1,  0x1DD2,
557 	0x1DD3,  0x1DD4,  0x1DD5,  0x1DD6,  0x1DD7,  0x1DD8,  0x1DD9,  0x1DDA,
558 	0x1DDB,  0x1DDC,  0x1DDD,  0x1DDE,  0x1DDF,  0x1DE0,  0x1DE1,  0x1DE2,
559 	0x1DE3,  0x1DE4,  0x1DE5,  0x1DE6,  0x1DE7,  0x1DE8,  0x1DE9,  0x1DEA,
560 	0x1DEB,  0x1DEC,  0x1DED,  0x1DEE,  0x1DEF,  0x1DF0,  0x1DF1,  0x1DF2,
561 	0x1DF3,  0x1DF4,  0x1DF5,  0x1DFB,  0x1DFC,  0x1DFD,  0x1DFE,  0x1DFF,
562 	0x20D0,  0x20D1,  0x20D2,  0x20D3,  0x20D4,  0x20D5,  0x20D6,  0x20D7,
563 	0x20D8,  0x20D9,  0x20DA,  0x20DB,  0x20DC,  0x20E1,  0x20E5,  0x20E6,
564 	0x20E7,  0x20E8,  0x20E9,  0x20EA,  0x20EB,  0x20EC,  0x20ED,  0x20EE,
565 	0x20EF,  0x20F0,  0x2CEF,  0x2CF0,  0x2CF1,  0x2D7F,  0x2DE0,  0x2DE1,
566 	0x2DE2,  0x2DE3,  0x2DE4,  0x2DE5,  0x2DE6,  0x2DE7,  0x2DE8,  0x2DE9,
567 	0x2DEA,  0x2DEB,  0x2DEC,  0x2DED,  0x2DEE,  0x2DEF,  0x2DF0,  0x2DF1,
568 	0x2DF2,  0x2DF3,  0x2DF4,  0x2DF5,  0x2DF6,  0x2DF7,  0x2DF8,  0x2DF9,
569 	0x2DFA,  0x2DFB,  0x2DFC,  0x2DFD,  0x2DFE,  0x2DFF,  0x302A,  0x302B,
570 	0x302C,  0x302D,  0x3099,  0x309A,  0xA66F,  0xA674,  0xA675,  0xA676,
571 	0xA677,  0xA678,  0xA679,  0xA67A,  0xA67B,  0xA67C,  0xA67D,  0xA69E,
572 	0xA69F,  0xA6F0,  0xA6F1,  0xA802,  0xA806,  0xA80B,  0xA825,  0xA826,
573 	0xA8C4,  0xA8C5,  0xA8E0,  0xA8E1,  0xA8E2,  0xA8E3,  0xA8E4,  0xA8E5,
574 	0xA8E6,  0xA8E7,  0xA8E8,  0xA8E9,  0xA8EA,  0xA8EB,  0xA8EC,  0xA8ED,
575 	0xA8EE,  0xA8EF,  0xA8F0,  0xA8F1,  0xA926,  0xA927,  0xA928,  0xA929,
576 	0xA92A,  0xA92B,  0xA92C,  0xA92D,  0xA947,  0xA948,  0xA949,  0xA94A,
577 	0xA94B,  0xA94C,  0xA94D,  0xA94E,  0xA94F,  0xA950,  0xA951,  0xA980,
578 	0xA981,  0xA982,  0xA9B3,  0xA9B6,  0xA9B7,  0xA9B8,  0xA9B9,  0xA9BC,
579 	0xA9E5,  0xAA29,  0xAA2A,  0xAA2B,  0xAA2C,  0xAA2D,  0xAA2E,  0xAA31,
580 	0xAA32,  0xAA35,  0xAA36,  0xAA43,  0xAA4C,  0xAA7C,  0xAAB0,  0xAAB2,
581 	0xAAB3,  0xAAB4,  0xAAB7,  0xAAB8,  0xAABE,  0xAABF,  0xAAC1,  0xAAEC,
582 	0xAAED,  0xAAF6,  0xABE5,  0xABE8,  0xABED,  0xFB1E,  0xFE00,  0xFE01,
583 	0xFE02,  0xFE03,  0xFE04,  0xFE05,  0xFE06,  0xFE07,  0xFE08,  0xFE09,
584 	0xFE0A,  0xFE0B,  0xFE0C,  0xFE0D,  0xFE0E,  0xFE0F,  0xFE20,  0xFE21,
585 	0xFE22,  0xFE23,  0xFE24,  0xFE25,  0xFE26,  0xFE27,  0xFE28,  0xFE29,
586 	0xFE2A,  0xFE2B,  0xFE2C,  0xFE2D,  0xFE2E,  0xFE2F,  0x101FD, 0x102E0,
587 	0x10376, 0x10377, 0x10378, 0x10379, 0x1037A, 0x10A01, 0x10A02, 0x10A03,
588 	0x10A05, 0x10A06, 0x10A0C, 0x10A0D, 0x10A0E, 0x10A0F, 0x10A38, 0x10A39,
589 	0x10A3A, 0x10A3F, 0x10AE5, 0x10AE6, 0x11001, 0x11038, 0x11039, 0x1103A,
590 	0x1103B, 0x1103C, 0x1103D, 0x1103E, 0x1103F, 0x11040, 0x11041, 0x11042,
591 	0x11043, 0x11044, 0x11045, 0x11046, 0x1107F, 0x11080, 0x11081, 0x110B3,
592 	0x110B4, 0x110B5, 0x110B6, 0x110B9, 0x110BA, 0x11100, 0x11101, 0x11102,
593 	0x11127, 0x11128, 0x11129, 0x1112A, 0x1112B, 0x1112D, 0x1112E, 0x1112F,
594 	0x11130, 0x11131, 0x11132, 0x11133, 0x11134, 0x11173, 0x11180, 0x11181,
595 	0x111B6, 0x111B7, 0x111B8, 0x111B9, 0x111BA, 0x111BB, 0x111BC, 0x111BD,
596 	0x111BE, 0x111CA, 0x111CB, 0x111CC, 0x1122F, 0x11230, 0x11231, 0x11234,
597 	0x11236, 0x11237, 0x1123E, 0x112DF, 0x112E3, 0x112E4, 0x112E5, 0x112E6,
598 	0x112E7, 0x112E8, 0x112E9, 0x112EA, 0x11300, 0x11301, 0x1133C, 0x11340,
599 	0x11366, 0x11367, 0x11368, 0x11369, 0x1136A, 0x1136B, 0x1136C, 0x11370,
600 	0x11371, 0x11372, 0x11373, 0x11374, 0x11438, 0x11439, 0x1143A, 0x1143B,
601 	0x1143C, 0x1143D, 0x1143E, 0x1143F, 0x11442, 0x11443, 0x11444, 0x11446,
602 	0x114B3, 0x114B4, 0x114B5, 0x114B6, 0x114B7, 0x114B8, 0x114BA, 0x114BF,
603 	0x114C0, 0x114C2, 0x114C3, 0x115B2, 0x115B3, 0x115B4, 0x115B5, 0x115BC,
604 	0x115BD, 0x115BF, 0x115C0, 0x115DC, 0x115DD, 0x11633, 0x11634, 0x11635,
605 	0x11636, 0x11637, 0x11638, 0x11639, 0x1163A, 0x1163D, 0x1163F, 0x11640,
606 	0x116AB, 0x116AD, 0x116B0, 0x116B1, 0x116B2, 0x116B3, 0x116B4, 0x116B5,
607 	0x116B7, 0x1171D, 0x1171E, 0x1171F, 0x11722, 0x11723, 0x11724, 0x11725,
608 	0x11727, 0x11728, 0x11729, 0x1172A, 0x1172B, 0x11C30, 0x11C31, 0x11C32,
609 	0x11C33, 0x11C34, 0x11C35, 0x11C36, 0x11C38, 0x11C39, 0x11C3A, 0x11C3B,
610 	0x11C3C, 0x11C3D, 0x11C3F, 0x11C92, 0x11C93, 0x11C94, 0x11C95, 0x11C96,
611 	0x11C97, 0x11C98, 0x11C99, 0x11C9A, 0x11C9B, 0x11C9C, 0x11C9D, 0x11C9E,
612 	0x11C9F, 0x11CA0, 0x11CA1, 0x11CA2, 0x11CA3, 0x11CA4, 0x11CA5, 0x11CA6,
613 	0x11CA7, 0x11CAA, 0x11CAB, 0x11CAC, 0x11CAD, 0x11CAE, 0x11CAF, 0x11CB0,
614 	0x11CB2, 0x11CB3, 0x11CB5, 0x11CB6, 0x16AF0, 0x16AF1, 0x16AF2, 0x16AF3,
615 	0x16AF4, 0x16B30, 0x16B31, 0x16B32, 0x16B33, 0x16B34, 0x16B35, 0x16B36,
616 	0x16F8F, 0x16F90, 0x16F91, 0x16F92, 0x1BC9D, 0x1BC9E, 0x1D167, 0x1D168,
617 	0x1D169, 0x1D17B, 0x1D17C, 0x1D17D, 0x1D17E, 0x1D17F, 0x1D180, 0x1D181,
618 	0x1D182, 0x1D185, 0x1D186, 0x1D187, 0x1D188, 0x1D189, 0x1D18A, 0x1D18B,
619 	0x1D1AA, 0x1D1AB, 0x1D1AC, 0x1D1AD, 0x1D242, 0x1D243, 0x1D244, 0x1DA00,
620 	0x1DA01, 0x1DA02, 0x1DA03, 0x1DA04, 0x1DA05, 0x1DA06, 0x1DA07, 0x1DA08,
621 	0x1DA09, 0x1DA0A, 0x1DA0B, 0x1DA0C, 0x1DA0D, 0x1DA0E, 0x1DA0F, 0x1DA10,
622 	0x1DA11, 0x1DA12, 0x1DA13, 0x1DA14, 0x1DA15, 0x1DA16, 0x1DA17, 0x1DA18,
623 	0x1DA19, 0x1DA1A, 0x1DA1B, 0x1DA1C, 0x1DA1D, 0x1DA1E, 0x1DA1F, 0x1DA20,
624 	0x1DA21, 0x1DA22, 0x1DA23, 0x1DA24, 0x1DA25, 0x1DA26, 0x1DA27, 0x1DA28,
625 	0x1DA29, 0x1DA2A, 0x1DA2B, 0x1DA2C, 0x1DA2D, 0x1DA2E, 0x1DA2F, 0x1DA30,
626 	0x1DA31, 0x1DA32, 0x1DA33, 0x1DA34, 0x1DA35, 0x1DA36, 0x1DA3B, 0x1DA3C,
627 	0x1DA3D, 0x1DA3E, 0x1DA3F, 0x1DA40, 0x1DA41, 0x1DA42, 0x1DA43, 0x1DA44,
628 	0x1DA45, 0x1DA46, 0x1DA47, 0x1DA48, 0x1DA49, 0x1DA4A, 0x1DA4B, 0x1DA4C,
629 	0x1DA4D, 0x1DA4E, 0x1DA4F, 0x1DA50, 0x1DA51, 0x1DA52, 0x1DA53, 0x1DA54,
630 	0x1DA55, 0x1DA56, 0x1DA57, 0x1DA58, 0x1DA59, 0x1DA5A, 0x1DA5B, 0x1DA5C,
631 	0x1DA5D, 0x1DA5E, 0x1DA5F, 0x1DA60, 0x1DA61, 0x1DA62, 0x1DA63, 0x1DA64,
632 	0x1DA65, 0x1DA66, 0x1DA67, 0x1DA68, 0x1DA69, 0x1DA6A, 0x1DA6B, 0x1DA6C,
633 	0x1DA75, 0x1DA84, 0x1DA9B, 0x1DA9C, 0x1DA9D, 0x1DA9E, 0x1DA9F, 0x1DAA1,
634 	0x1DAA2, 0x1DAA3, 0x1DAA4, 0x1DAA5, 0x1DAA6, 0x1DAA7, 0x1DAA8, 0x1DAA9,
635 	0x1DAAA, 0x1DAAB, 0x1DAAC, 0x1DAAD, 0x1DAAE, 0x1DAAF, 0x1E000, 0x1E001,
636 	0x1E002, 0x1E003, 0x1E004, 0x1E005, 0x1E006, 0x1E008, 0x1E009, 0x1E00A,
637 	0x1E00B, 0x1E00C, 0x1E00D, 0x1E00E, 0x1E00F, 0x1E010, 0x1E011, 0x1E012,
638 	0x1E013, 0x1E014, 0x1E015, 0x1E016, 0x1E017, 0x1E018, 0x1E01B, 0x1E01C,
639 	0x1E01D, 0x1E01E, 0x1E01F, 0x1E020, 0x1E021, 0x1E023, 0x1E024, 0x1E026,
640 	0x1E027, 0x1E028, 0x1E029, 0x1E02A, 0x1E8D0, 0x1E8D1, 0x1E8D2, 0x1E8D3,
641 	0x1E8D4, 0x1E8D5, 0x1E8D6, 0x1E944, 0x1E945, 0x1E946, 0x1E947, 0x1E948,
642 	0x1E949, 0x1E94A, 0xE0100, 0xE0101, 0xE0102, 0xE0103, 0xE0104, 0xE0105,
643 	0xE0106, 0xE0107, 0xE0108, 0xE0109, 0xE010A, 0xE010B, 0xE010C, 0xE010D,
644 	0xE010E, 0xE010F, 0xE0110, 0xE0111, 0xE0112, 0xE0113, 0xE0114, 0xE0115,
645 	0xE0116, 0xE0117, 0xE0118, 0xE0119, 0xE011A, 0xE011B, 0xE011C, 0xE011D,
646 	0xE011E, 0xE011F, 0xE0120, 0xE0121, 0xE0122, 0xE0123, 0xE0124, 0xE0125,
647 	0xE0126, 0xE0127, 0xE0128, 0xE0129, 0xE012A, 0xE012B, 0xE012C, 0xE012D,
648 	0xE012E, 0xE012F, 0xE0130, 0xE0131, 0xE0132, 0xE0133, 0xE0134, 0xE0135,
649 	0xE0136, 0xE0137, 0xE0138, 0xE0139, 0xE013A, 0xE013B, 0xE013C, 0xE013D,
650 	0xE013E, 0xE013F, 0xE0140, 0xE0141, 0xE0142, 0xE0143, 0xE0144, 0xE0145,
651 	0xE0146, 0xE0147, 0xE0148, 0xE0149, 0xE014A, 0xE014B, 0xE014C, 0xE014D,
652 	0xE014E, 0xE014F, 0xE0150, 0xE0151, 0xE0152, 0xE0153, 0xE0154, 0xE0155,
653 	0xE0156, 0xE0157, 0xE0158, 0xE0159, 0xE015A, 0xE015B, 0xE015C, 0xE015D,
654 	0xE015E, 0xE015F, 0xE0160, 0xE0161, 0xE0162, 0xE0163, 0xE0164, 0xE0165,
655 	0xE0166, 0xE0167, 0xE0168, 0xE0169, 0xE016A, 0xE016B, 0xE016C, 0xE016D,
656 	0xE016E, 0xE016F, 0xE0170, 0xE0171, 0xE0172, 0xE0173, 0xE0174, 0xE0175,
657 	0xE0176, 0xE0177, 0xE0178, 0xE0179, 0xE017A, 0xE017B, 0xE017C, 0xE017D,
658 	0xE017E, 0xE017F, 0xE0180, 0xE0181, 0xE0182, 0xE0183, 0xE0184, 0xE0185,
659 	0xE0186, 0xE0187, 0xE0188, 0xE0189, 0xE018A, 0xE018B, 0xE018C, 0xE018D,
660 	0xE018E, 0xE018F, 0xE0190, 0xE0191, 0xE0192, 0xE0193, 0xE0194, 0xE0195,
661 	0xE0196, 0xE0197, 0xE0198, 0xE0199, 0xE019A, 0xE019B, 0xE019C, 0xE019D,
662 	0xE019E, 0xE019F, 0xE01A0, 0xE01A1, 0xE01A2, 0xE01A3, 0xE01A4, 0xE01A5,
663 	0xE01A6, 0xE01A7, 0xE01A8, 0xE01A9, 0xE01AA, 0xE01AB, 0xE01AC, 0xE01AD,
664 	0xE01AE, 0xE01AF, 0xE01B0, 0xE01B1, 0xE01B2, 0xE01B3, 0xE01B4, 0xE01B5,
665 	0xE01B6, 0xE01B7, 0xE01B8, 0xE01B9, 0xE01BA, 0xE01BB, 0xE01BC, 0xE01BD,
666 	0xE01BE, 0xE01BF, 0xE01C0, 0xE01C1, 0xE01C2, 0xE01C3, 0xE01C4, 0xE01C5,
667 	0xE01C6, 0xE01C7, 0xE01C8, 0xE01C9, 0xE01CA, 0xE01CB, 0xE01CC, 0xE01CD,
668 	0xE01CE, 0xE01CF, 0xE01D0, 0xE01D1, 0xE01D2, 0xE01D3, 0xE01D4, 0xE01D5,
669 	0xE01D6, 0xE01D7, 0xE01D8, 0xE01D9, 0xE01DA, 0xE01DB, 0xE01DC, 0xE01DD,
670 	0xE01DE, 0xE01DF, 0xE01E0, 0xE01E1, 0xE01E2, 0xE01E3, 0xE01E4, 0xE01E5,
671 	0xE01E6, 0xE01E7, 0xE01E8, 0xE01E9, 0xE01EA, 0xE01EB, 0xE01EC, 0xE01ED,
672 	0xE01EE, 0xE01EF,
673 };
674 
675 /// The length of the combining characters list.
676 const size_t bc_history_combo_chars_len = sizeof(bc_history_combo_chars) /
677                                           sizeof(bc_history_combo_chars[0]);
678 #endif // BC_ENABLE_HISTORY && !BC_ENABLE_LINE_LIB
679 
680 /// The human-readable name of the main function in bc source code.
681 const char bc_func_main[] = "(main)";
682 
683 /// The human-readable name of the read function in bc source code.
684 const char bc_func_read[] = "(read)";
685 
686 #if BC_DEBUG_CODE
687 
688 /// A list of names of instructions for easy debugging output.
689 const char* bc_inst_names[] = {
690 
691 #if BC_ENABLED
692 	"BC_INST_INC",
693 	"BC_INST_DEC",
694 #endif // BC_ENABLED
695 
696 	"BC_INST_NEG",
697 	"BC_INST_BOOL_NOT",
698 #if BC_ENABLE_EXTRA_MATH
699 	"BC_INST_TRUNC",
700 #endif // BC_ENABLE_EXTRA_MATH
701 
702 	"BC_INST_POWER",
703 	"BC_INST_MULTIPLY",
704 	"BC_INST_DIVIDE",
705 	"BC_INST_MODULUS",
706 	"BC_INST_PLUS",
707 	"BC_INST_MINUS",
708 
709 #if BC_ENABLE_EXTRA_MATH
710 	"BC_INST_PLACES",
711 
712 	"BC_INST_LSHIFT",
713 	"BC_INST_RSHIFT",
714 #endif // BC_ENABLE_EXTRA_MATH
715 
716 	"BC_INST_REL_EQ",
717 	"BC_INST_REL_LE",
718 	"BC_INST_REL_GE",
719 	"BC_INST_REL_NE",
720 	"BC_INST_REL_LT",
721 	"BC_INST_REL_GT",
722 
723 	"BC_INST_BOOL_OR",
724 	"BC_INST_BOOL_AND",
725 
726 #if BC_ENABLED
727 	"BC_INST_ASSIGN_POWER",
728 	"BC_INST_ASSIGN_MULTIPLY",
729 	"BC_INST_ASSIGN_DIVIDE",
730 	"BC_INST_ASSIGN_MODULUS",
731 	"BC_INST_ASSIGN_PLUS",
732 	"BC_INST_ASSIGN_MINUS",
733 #if BC_ENABLE_EXTRA_MATH
734 	"BC_INST_ASSIGN_PLACES",
735 	"BC_INST_ASSIGN_LSHIFT",
736 	"BC_INST_ASSIGN_RSHIFT",
737 #endif // BC_ENABLE_EXTRA_MATH
738 	"BC_INST_ASSIGN",
739 
740 	"BC_INST_ASSIGN_POWER_NO_VAL",
741 	"BC_INST_ASSIGN_MULTIPLY_NO_VAL",
742 	"BC_INST_ASSIGN_DIVIDE_NO_VAL",
743 	"BC_INST_ASSIGN_MODULUS_NO_VAL",
744 	"BC_INST_ASSIGN_PLUS_NO_VAL",
745 	"BC_INST_ASSIGN_MINUS_NO_VAL",
746 #if BC_ENABLE_EXTRA_MATH
747 	"BC_INST_ASSIGN_PLACES_NO_VAL",
748 	"BC_INST_ASSIGN_LSHIFT_NO_VAL",
749 	"BC_INST_ASSIGN_RSHIFT_NO_VAL",
750 #endif // BC_ENABLE_EXTRA_MATH
751 #endif // BC_ENABLED
752 	"BC_INST_ASSIGN_NO_VAL",
753 
754 	"BC_INST_NUM",
755 	"BC_INST_VAR",
756 	"BC_INST_ARRAY_ELEM",
757 	"BC_INST_ARRAY",
758 
759 	"BC_INST_ZERO",
760 	"BC_INST_ONE",
761 
762 #if BC_ENABLED
763 	"BC_INST_LAST",
764 #endif // BC_ENABLED
765 	"BC_INST_IBASE",
766 	"BC_INST_OBASE",
767 	"BC_INST_SCALE",
768 #if BC_ENABLE_EXTRA_MATH
769 	"BC_INST_SEED",
770 #endif // BC_ENABLE_EXTRA_MATH
771 	"BC_INST_LENGTH",
772 	"BC_INST_SCALE_FUNC",
773 	"BC_INST_SQRT",
774 	"BC_INST_ABS",
775 	"BC_INST_IS_NUMBER",
776 	"BC_INST_IS_STRING",
777 #if BC_ENABLE_EXTRA_MATH
778 	"BC_INST_IRAND",
779 #endif // BC_ENABLE_EXTRA_MATH
780 	"BC_INST_ASCIIFY",
781 	"BC_INST_READ",
782 #if BC_ENABLE_EXTRA_MATH
783 	"BC_INST_RAND",
784 #endif // BC_ENABLE_EXTRA_MATH
785 	"BC_INST_MAXIBASE",
786 	"BC_INST_MAXOBASE",
787 	"BC_INST_MAXSCALE",
788 #if BC_ENABLE_EXTRA_MATH
789 	"BC_INST_MAXRAND",
790 #endif // BC_ENABLE_EXTRA_MATH
791 
792 	"BC_INST_PRINT",
793 	"BC_INST_PRINT_POP",
794 	"BC_INST_STR",
795 #if BC_ENABLED
796 	"BC_INST_PRINT_STR",
797 
798 	"BC_INST_JUMP",
799 	"BC_INST_JUMP_ZERO",
800 
801 	"BC_INST_CALL",
802 
803 	"BC_INST_RET",
804 	"BC_INST_RET0",
805 	"BC_INST_RET_VOID",
806 
807 	"BC_INST_HALT",
808 #endif // BC_ENABLED
809 
810 	"BC_INST_POP",
811 	"BC_INST_SWAP",
812 	"BC_INST_MODEXP",
813 	"BC_INST_DIVMOD",
814 	"BC_INST_PRINT_STREAM",
815 
816 #if DC_ENABLED
817 	"BC_INST_POP_EXEC",
818 
819 	"BC_INST_EXECUTE",
820 	"BC_INST_EXEC_COND",
821 
822 	"BC_INST_PRINT_STACK",
823 	"BC_INST_CLEAR_STACK",
824 	"BC_INST_REG_STACK_LEN",
825 	"BC_INST_STACK_LEN",
826 	"BC_INST_DUPLICATE",
827 
828 	"BC_INST_LOAD",
829 	"BC_INST_PUSH_VAR",
830 	"BC_INST_PUSH_TO_VAR",
831 
832 	"BC_INST_QUIT",
833 	"BC_INST_NQUIT",
834 
835 	"BC_INST_EXEC_STACK_LEN",
836 #endif // DC_ENABLED
837 
838 	"BC_INST_INVALID",
839 };
840 
841 #endif // BC_DEBUG_CODE
842 
843 /// A constant string for 0.
844 const char bc_parse_zero[2] = "0";
845 
846 /// A constant string for 1.
847 const char bc_parse_one[2] = "1";
848 
849 #if BC_ENABLED
850 
851 /// A list of keywords for bc. This needs to be updated if keywords change.
852 const BcLexKeyword bc_lex_kws[] = {
853 	BC_LEX_KW_ENTRY("auto", 4, true),
854 	BC_LEX_KW_ENTRY("break", 5, true),
855 	BC_LEX_KW_ENTRY("continue", 8, false),
856 	BC_LEX_KW_ENTRY("define", 6, true),
857 	BC_LEX_KW_ENTRY("for", 3, true),
858 	BC_LEX_KW_ENTRY("if", 2, true),
859 	BC_LEX_KW_ENTRY("limits", 6, false),
860 	BC_LEX_KW_ENTRY("return", 6, true),
861 	BC_LEX_KW_ENTRY("while", 5, true),
862 	BC_LEX_KW_ENTRY("halt", 4, false),
863 	BC_LEX_KW_ENTRY("last", 4, false),
864 	BC_LEX_KW_ENTRY("ibase", 5, true),
865 	BC_LEX_KW_ENTRY("obase", 5, true),
866 	BC_LEX_KW_ENTRY("scale", 5, true),
867 #if BC_ENABLE_EXTRA_MATH
868 	BC_LEX_KW_ENTRY("seed", 4, false),
869 #endif // BC_ENABLE_EXTRA_MATH
870 	BC_LEX_KW_ENTRY("length", 6, true),
871 	BC_LEX_KW_ENTRY("print", 5, false),
872 	BC_LEX_KW_ENTRY("sqrt", 4, true),
873 	BC_LEX_KW_ENTRY("abs", 3, false),
874 	BC_LEX_KW_ENTRY("is_number", 9, false),
875 	BC_LEX_KW_ENTRY("is_string", 9, false),
876 #if BC_ENABLE_EXTRA_MATH
877 	BC_LEX_KW_ENTRY("irand", 5, false),
878 #endif // BC_ENABLE_EXTRA_MATH
879 	BC_LEX_KW_ENTRY("asciify", 7, false),
880 	BC_LEX_KW_ENTRY("modexp", 6, false),
881 	BC_LEX_KW_ENTRY("divmod", 6, false),
882 	BC_LEX_KW_ENTRY("quit", 4, true),
883 	BC_LEX_KW_ENTRY("read", 4, false),
884 #if BC_ENABLE_EXTRA_MATH
885 	BC_LEX_KW_ENTRY("rand", 4, false),
886 #endif // BC_ENABLE_EXTRA_MATH
887 	BC_LEX_KW_ENTRY("maxibase", 8, false),
888 	BC_LEX_KW_ENTRY("maxobase", 8, false),
889 	BC_LEX_KW_ENTRY("maxscale", 8, false),
890 #if BC_ENABLE_EXTRA_MATH
891 	BC_LEX_KW_ENTRY("maxrand", 7, false),
892 #endif // BC_ENABLE_EXTRA_MATH
893 	BC_LEX_KW_ENTRY("line_length", 11, false),
894 	BC_LEX_KW_ENTRY("global_stacks", 13, false),
895 	BC_LEX_KW_ENTRY("leading_zero", 12, false),
896 	BC_LEX_KW_ENTRY("stream", 6, false),
897 	BC_LEX_KW_ENTRY("else", 4, false),
898 };
899 
900 /// The length of the list of bc keywords.
901 const size_t bc_lex_kws_len = sizeof(bc_lex_kws) / sizeof(BcLexKeyword);
902 
903 #if BC_C11
904 
905 // This is here to ensure that BC_LEX_NKWS, which is needed for the
906 // redefined_kws in BcVm, is correct. If it's correct under C11, it will be
907 // correct under C99, and I did not know any other way of ensuring they remained
908 // synchronized.
909 _Static_assert(sizeof(bc_lex_kws) / sizeof(BcLexKeyword) == BC_LEX_NKWS,
910                "BC_LEX_NKWS is wrong.");
911 
912 #endif // BC_C11
913 
914 /// An array of booleans that correspond to token types. An entry is true if the
915 /// token is valid in an expression, false otherwise. This will need to change
916 /// if tokens change.
917 const uint8_t bc_parse_exprs[] = {
918 
919 	// Starts with BC_LEX_EOF.
920 	BC_PARSE_EXPR_ENTRY(false, false, true, true, true, true, true, true),
921 
922 	// Starts with BC_LEX_OP_MULTIPLY if extra math is enabled, BC_LEX_OP_DIVIDE
923 	// otherwise.
924 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, true),
925 
926 	// Starts with BC_LEX_OP_REL_EQ if extra math is enabled, BC_LEX_OP_REL_LT
927 	// otherwise.
928 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, true),
929 
930 #if BC_ENABLE_EXTRA_MATH
931 
932 	// Starts with BC_LEX_OP_ASSIGN_POWER.
933 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, true),
934 
935 	// Starts with BC_LEX_OP_ASSIGN_RSHIFT.
936 	BC_PARSE_EXPR_ENTRY(true, true, false, false, true, true, false, false),
937 
938 	// Starts with BC_LEX_RBRACKET.
939 	BC_PARSE_EXPR_ENTRY(false, false, false, false, true, true, true, false),
940 
941 	// Starts with BC_LEX_KW_BREAK.
942 	BC_PARSE_EXPR_ENTRY(false, false, false, false, false, false, false, false),
943 
944 	// Starts with BC_LEX_KW_HALT.
945 	BC_PARSE_EXPR_ENTRY(false, true, true, true, true, true, true, false),
946 
947 	// Starts with BC_LEX_KW_SQRT.
948 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, true),
949 
950 	// Starts with BC_LEX_KW_QUIT.
951 	BC_PARSE_EXPR_ENTRY(false, true, true, true, true, true, true, true),
952 
953 	// Starts with BC_LEX_KW_GLOBAL_STACKS.
954 	BC_PARSE_EXPR_ENTRY(true, true, false, false, 0, 0, 0, 0)
955 
956 #else // BC_ENABLE_EXTRA_MATH
957 
958 	// Starts with BC_LEX_OP_ASSIGN_PLUS.
959 	BC_PARSE_EXPR_ENTRY(true, true, true, false, false, true, true, false),
960 
961 	// Starts with BC_LEX_COMMA.
962 	BC_PARSE_EXPR_ENTRY(false, false, false, false, false, true, true, true),
963 
964 	// Starts with BC_LEX_KW_AUTO.
965 	BC_PARSE_EXPR_ENTRY(false, false, false, false, false, false, false, false),
966 
967 	// Starts with BC_LEX_KW_WHILE.
968 	BC_PARSE_EXPR_ENTRY(false, false, true, true, true, true, true, false),
969 
970 	// Starts with BC_LEX_KW_SQRT.
971 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, false),
972 
973 	// Starts with BC_LEX_KW_MAXIBASE.
974 	BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, false),
975 
976 	// Starts with  BC_LEX_KW_ELSE.
977 	BC_PARSE_EXPR_ENTRY(false, 0, 0, 0, 0, 0, 0, 0)
978 
979 #endif // BC_ENABLE_EXTRA_MATH
980 };
981 
982 /// An array of data for operators that correspond to token types. Note that a
983 /// lower precedence *value* means a higher precedence.
984 const uchar bc_parse_ops[] = {
985 	BC_PARSE_OP(0, false), BC_PARSE_OP(0, false), BC_PARSE_OP(1, false),
986 	BC_PARSE_OP(1, false),
987 #if BC_ENABLE_EXTRA_MATH
988 	BC_PARSE_OP(2, false),
989 #endif // BC_ENABLE_EXTRA_MATH
990 	BC_PARSE_OP(4, false), BC_PARSE_OP(5, true),  BC_PARSE_OP(5, true),
991 	BC_PARSE_OP(5, true),  BC_PARSE_OP(6, true),  BC_PARSE_OP(6, true),
992 #if BC_ENABLE_EXTRA_MATH
993 	BC_PARSE_OP(3, false), BC_PARSE_OP(7, true),  BC_PARSE_OP(7, true),
994 #endif // BC_ENABLE_EXTRA_MATH
995 	BC_PARSE_OP(9, true),  BC_PARSE_OP(9, true),  BC_PARSE_OP(9, true),
996 	BC_PARSE_OP(9, true),  BC_PARSE_OP(9, true),  BC_PARSE_OP(9, true),
997 	BC_PARSE_OP(11, true), BC_PARSE_OP(10, true), BC_PARSE_OP(8, false),
998 	BC_PARSE_OP(8, false), BC_PARSE_OP(8, false), BC_PARSE_OP(8, false),
999 	BC_PARSE_OP(8, false), BC_PARSE_OP(8, false),
1000 #if BC_ENABLE_EXTRA_MATH
1001 	BC_PARSE_OP(8, false), BC_PARSE_OP(8, false), BC_PARSE_OP(8, false),
1002 #endif // BC_ENABLE_EXTRA_MATH
1003 	BC_PARSE_OP(8, false),
1004 };
1005 
1006 // These identify what tokens can come after expressions in certain cases.
1007 
1008 /// The valid next tokens for normal expressions.
1009 const BcParseNext bc_parse_next_expr = BC_PARSE_NEXT(4, BC_LEX_NLINE,
1010                                                      BC_LEX_SCOLON,
1011                                                      BC_LEX_RBRACE, BC_LEX_EOF);
1012 
1013 /// The valid next tokens for function argument expressions.
1014 const BcParseNext bc_parse_next_arg = BC_PARSE_NEXT(2, BC_LEX_RPAREN,
1015                                                     BC_LEX_COMMA);
1016 
1017 /// The valid next tokens for expressions in print statements.
1018 const BcParseNext bc_parse_next_print = BC_PARSE_NEXT(4, BC_LEX_COMMA,
1019                                                       BC_LEX_NLINE,
1020                                                       BC_LEX_SCOLON,
1021                                                       BC_LEX_EOF);
1022 
1023 /// The valid next tokens for if statement conditions or loop conditions. This
1024 /// is used in for loops for the update expression and for builtin function.
1025 ///
1026 /// The name is an artifact of history, and is related to @a BC_PARSE_REL (see
1027 /// include/parse.h). It refers to how POSIX only allows some operators as part
1028 /// of the conditional of for loops, while loops, and if statements.
1029 const BcParseNext bc_parse_next_rel = BC_PARSE_NEXT(1, BC_LEX_RPAREN);
1030 
1031 /// The valid next tokens for array element expressions.
1032 const BcParseNext bc_parse_next_elem = BC_PARSE_NEXT(1, BC_LEX_RBRACKET);
1033 
1034 /// The valid next tokens for for loop initialization expressions and condition
1035 /// expressions.
1036 const BcParseNext bc_parse_next_for = BC_PARSE_NEXT(1, BC_LEX_SCOLON);
1037 
1038 /// The valid next tokens for read expressions.
1039 const BcParseNext bc_parse_next_read = BC_PARSE_NEXT(2, BC_LEX_NLINE,
1040                                                      BC_LEX_EOF);
1041 
1042 /// The valid next tokens for the arguments of a builtin function with multiple
1043 /// arguments.
1044 const BcParseNext bc_parse_next_builtin = BC_PARSE_NEXT(1, BC_LEX_COMMA);
1045 
1046 #endif // BC_ENABLED
1047 
1048 #if DC_ENABLED
1049 
1050 /// A list of instructions that need register arguments in dc.
1051 const uint8_t dc_lex_regs[] = {
1052 	BC_LEX_OP_REL_EQ,  BC_LEX_OP_REL_LE,       BC_LEX_OP_REL_GE,
1053 	BC_LEX_OP_REL_NE,  BC_LEX_OP_REL_LT,       BC_LEX_OP_REL_GT,
1054 	BC_LEX_SCOLON,     BC_LEX_COLON,           BC_LEX_KW_ELSE,
1055 	BC_LEX_LOAD,       BC_LEX_LOAD_POP,        BC_LEX_OP_ASSIGN,
1056 	BC_LEX_STORE_PUSH, BC_LEX_REG_STACK_LEVEL, BC_LEX_ARRAY_LENGTH,
1057 };
1058 
1059 /// The length of the list of register instructions.
1060 const size_t dc_lex_regs_len = sizeof(dc_lex_regs) / sizeof(uint8_t);
1061 
1062 /// A list corresponding to characters starting at double quote ("). If an entry
1063 /// is BC_LEX_INVALID, then that character needs extra lexing in dc. If it does
1064 /// not, the character can trivially be replaced by the entry. Positions are
1065 /// kept because it corresponds to the ASCII table. This may need to be changed
1066 /// if tokens change.
1067 const uchar dc_lex_tokens[] = {
1068 #if BC_ENABLE_EXTRA_MATH
1069 	BC_LEX_KW_IRAND,
1070 #else // BC_ENABLE_EXTRA_MATH
1071 	BC_LEX_INVALID,
1072 #endif // BC_ENABLE_EXTRA_MATH
1073 	BC_LEX_INVALID,
1074 #if BC_ENABLE_EXTRA_MATH
1075 	BC_LEX_OP_TRUNC,
1076 #else // BC_ENABLE_EXTRA_MATH
1077 	BC_LEX_INVALID,
1078 #endif // BC_ENABLE_EXTRA_MATH
1079 	BC_LEX_OP_MODULUS,
1080 	BC_LEX_INVALID,
1081 #if BC_ENABLE_EXTRA_MATH
1082 	BC_LEX_KW_RAND,
1083 #else // BC_ENABLE_EXTRA_MATH
1084 	BC_LEX_INVALID,
1085 #endif // BC_ENABLE_EXTRA_MATH
1086 	BC_LEX_LPAREN,
1087 	BC_LEX_RPAREN,
1088 	BC_LEX_OP_MULTIPLY,
1089 	BC_LEX_OP_PLUS,
1090 	BC_LEX_EXEC_STACK_LENGTH,
1091 	BC_LEX_OP_MINUS,
1092 	BC_LEX_INVALID,
1093 	BC_LEX_OP_DIVIDE,
1094 	BC_LEX_INVALID,
1095 	BC_LEX_INVALID,
1096 	BC_LEX_INVALID,
1097 	BC_LEX_INVALID,
1098 	BC_LEX_INVALID,
1099 	BC_LEX_INVALID,
1100 	BC_LEX_INVALID,
1101 	BC_LEX_INVALID,
1102 	BC_LEX_INVALID,
1103 	BC_LEX_INVALID,
1104 	BC_LEX_COLON,
1105 	BC_LEX_SCOLON,
1106 	BC_LEX_OP_REL_GT,
1107 	BC_LEX_OP_REL_EQ,
1108 	BC_LEX_OP_REL_LT,
1109 	BC_LEX_KW_READ,
1110 #if BC_ENABLE_EXTRA_MATH
1111 	BC_LEX_OP_PLACES,
1112 #else // BC_ENABLE_EXTRA_MATH
1113 	BC_LEX_INVALID,
1114 #endif // BC_ENABLE_EXTRA_MATH
1115 	BC_LEX_INVALID,
1116 	BC_LEX_INVALID,
1117 	BC_LEX_INVALID,
1118 	BC_LEX_INVALID,
1119 	BC_LEX_INVALID,
1120 	BC_LEX_INVALID,
1121 	BC_LEX_EQ_NO_REG,
1122 #if BC_ENABLE_EXTRA_MATH
1123 	BC_LEX_OP_LSHIFT,
1124 #else // BC_ENABLE_EXTRA_MATH
1125 	BC_LEX_INVALID,
1126 #endif // BC_ENABLE_EXTRA_MATH
1127 	BC_LEX_KW_IBASE,
1128 #if BC_ENABLE_EXTRA_MATH
1129 	BC_LEX_KW_SEED,
1130 #else // BC_ENABLE_EXTRA_MATH
1131 	BC_LEX_INVALID,
1132 #endif // BC_ENABLE_EXTRA_MATH
1133 	BC_LEX_KW_SCALE,
1134 	BC_LEX_LOAD_POP,
1135 	BC_LEX_OP_BOOL_AND,
1136 	BC_LEX_OP_BOOL_NOT,
1137 	BC_LEX_KW_OBASE,
1138 	BC_LEX_KW_STREAM,
1139 	BC_LEX_NQUIT,
1140 	BC_LEX_POP,
1141 	BC_LEX_STORE_PUSH,
1142 	BC_LEX_KW_MAXIBASE,
1143 	BC_LEX_KW_MAXOBASE,
1144 	BC_LEX_KW_MAXSCALE,
1145 #if BC_ENABLE_EXTRA_MATH
1146 	BC_LEX_KW_MAXRAND,
1147 #else // BC_ENABLE_EXTRA_MATH
1148 	BC_LEX_INVALID,
1149 #endif // BC_ENABLE_EXTRA_MATH
1150 	BC_LEX_SCALE_FACTOR,
1151 	BC_LEX_ARRAY_LENGTH,
1152 	BC_LEX_KW_LENGTH,
1153 	BC_LEX_INVALID,
1154 	BC_LEX_INVALID,
1155 	BC_LEX_INVALID,
1156 	BC_LEX_OP_POWER,
1157 	BC_LEX_NEG,
1158 	BC_LEX_INVALID,
1159 	BC_LEX_KW_ASCIIFY,
1160 	BC_LEX_KW_ABS,
1161 	BC_LEX_CLEAR_STACK,
1162 	BC_LEX_DUPLICATE,
1163 	BC_LEX_KW_ELSE,
1164 	BC_LEX_PRINT_STACK,
1165 	BC_LEX_INVALID,
1166 #if BC_ENABLE_EXTRA_MATH
1167 	BC_LEX_OP_RSHIFT,
1168 #else // BC_ENABLE_EXTRA_MATH
1169 	BC_LEX_INVALID,
1170 #endif // BC_ENABLE_EXTRA_MATH
1171 	BC_LEX_STORE_IBASE,
1172 #if BC_ENABLE_EXTRA_MATH
1173 	BC_LEX_STORE_SEED,
1174 #else // BC_ENABLE_EXTRA_MATH
1175 	BC_LEX_INVALID,
1176 #endif // BC_ENABLE_EXTRA_MATH
1177 	BC_LEX_STORE_SCALE,
1178 	BC_LEX_LOAD,
1179 	BC_LEX_OP_BOOL_OR,
1180 	BC_LEX_PRINT_POP,
1181 	BC_LEX_STORE_OBASE,
1182 	BC_LEX_KW_PRINT,
1183 	BC_LEX_KW_QUIT,
1184 	BC_LEX_SWAP,
1185 	BC_LEX_OP_ASSIGN,
1186 	BC_LEX_KW_IS_STRING,
1187 	BC_LEX_KW_IS_NUMBER,
1188 	BC_LEX_KW_SQRT,
1189 	BC_LEX_INVALID,
1190 	BC_LEX_EXECUTE,
1191 	BC_LEX_REG_STACK_LEVEL,
1192 	BC_LEX_STACK_LEVEL,
1193 	BC_LEX_LBRACE,
1194 	BC_LEX_KW_MODEXP,
1195 	BC_LEX_RBRACE,
1196 	BC_LEX_KW_DIVMOD,
1197 	BC_LEX_INVALID
1198 };
1199 
1200 /// A list of instructions that correspond to lex tokens. If an entry is
1201 /// @a BC_INST_INVALID, that lex token needs extra parsing in the dc parser.
1202 /// Otherwise, the token can trivially be replaced by the entry. This needs to
1203 /// be updated if the tokens change.
1204 const uchar dc_parse_insts[] = {
1205 	BC_INST_INVALID,      BC_INST_INVALID,
1206 #if BC_ENABLED
1207 	BC_INST_INVALID,      BC_INST_INVALID,
1208 #endif // BC_ENABLED
1209 	BC_INST_INVALID,      BC_INST_BOOL_NOT,
1210 #if BC_ENABLE_EXTRA_MATH
1211 	BC_INST_TRUNC,
1212 #endif // BC_ENABLE_EXTRA_MATH
1213 	BC_INST_POWER,        BC_INST_MULTIPLY,
1214 	BC_INST_DIVIDE,       BC_INST_MODULUS,
1215 	BC_INST_PLUS,         BC_INST_MINUS,
1216 #if BC_ENABLE_EXTRA_MATH
1217 	BC_INST_PLACES,       BC_INST_LSHIFT,
1218 	BC_INST_RSHIFT,
1219 #endif // BC_ENABLE_EXTRA_MATH
1220 	BC_INST_INVALID,      BC_INST_INVALID,
1221 	BC_INST_INVALID,      BC_INST_INVALID,
1222 	BC_INST_INVALID,      BC_INST_INVALID,
1223 	BC_INST_BOOL_OR,      BC_INST_BOOL_AND,
1224 #if BC_ENABLED
1225 	BC_INST_INVALID,      BC_INST_INVALID,
1226 	BC_INST_INVALID,      BC_INST_INVALID,
1227 	BC_INST_INVALID,      BC_INST_INVALID,
1228 #if BC_ENABLE_EXTRA_MATH
1229 	BC_INST_INVALID,      BC_INST_INVALID,
1230 	BC_INST_INVALID,
1231 #endif // BC_ENABLE_EXTRA_MATH
1232 #endif // BC_ENABLED
1233 	BC_INST_INVALID,      BC_INST_INVALID,
1234 	BC_INST_INVALID,      BC_INST_REL_GT,
1235 	BC_INST_REL_LT,       BC_INST_INVALID,
1236 	BC_INST_INVALID,      BC_INST_INVALID,
1237 	BC_INST_REL_GE,       BC_INST_INVALID,
1238 	BC_INST_REL_LE,       BC_INST_INVALID,
1239 	BC_INST_INVALID,      BC_INST_INVALID,
1240 #if BC_ENABLED
1241 	BC_INST_INVALID,      BC_INST_INVALID,
1242 	BC_INST_INVALID,      BC_INST_INVALID,
1243 	BC_INST_INVALID,      BC_INST_INVALID,
1244 	BC_INST_INVALID,      BC_INST_INVALID,
1245 	BC_INST_INVALID,      BC_INST_INVALID,
1246 	BC_INST_INVALID,
1247 #endif // BC_ENABLED
1248 	BC_INST_IBASE,        BC_INST_OBASE,
1249 	BC_INST_SCALE,
1250 #if BC_ENABLE_EXTRA_MATH
1251 	BC_INST_SEED,
1252 #endif // BC_ENABLE_EXTRA_MATH
1253 	BC_INST_LENGTH,       BC_INST_PRINT,
1254 	BC_INST_SQRT,         BC_INST_ABS,
1255 	BC_INST_IS_NUMBER,    BC_INST_IS_STRING,
1256 #if BC_ENABLE_EXTRA_MATH
1257 	BC_INST_IRAND,
1258 #endif // BC_ENABLE_EXTRA_MATH
1259 	BC_INST_ASCIIFY,      BC_INST_MODEXP,
1260 	BC_INST_DIVMOD,       BC_INST_QUIT,
1261 	BC_INST_INVALID,
1262 #if BC_ENABLE_EXTRA_MATH
1263 	BC_INST_RAND,
1264 #endif // BC_ENABLE_EXTRA_MATH
1265 	BC_INST_MAXIBASE,     BC_INST_MAXOBASE,
1266 	BC_INST_MAXSCALE,
1267 #if BC_ENABLE_EXTRA_MATH
1268 	BC_INST_MAXRAND,
1269 #endif // BC_ENABLE_EXTRA_MATH
1270 	BC_INST_LINE_LENGTH,
1271 #if BC_ENABLED
1272 	BC_INST_INVALID,
1273 #endif // BC_ENABLED
1274 	BC_INST_LEADING_ZERO, BC_INST_PRINT_STREAM,
1275 	BC_INST_INVALID,      BC_INST_EXTENDED_REGISTERS,
1276 	BC_INST_REL_EQ,       BC_INST_INVALID,
1277 	BC_INST_EXECUTE,      BC_INST_PRINT_STACK,
1278 	BC_INST_CLEAR_STACK,  BC_INST_INVALID,
1279 	BC_INST_STACK_LEN,    BC_INST_DUPLICATE,
1280 	BC_INST_SWAP,         BC_INST_POP,
1281 	BC_INST_INVALID,      BC_INST_INVALID,
1282 	BC_INST_INVALID,
1283 #if BC_ENABLE_EXTRA_MATH
1284 	BC_INST_INVALID,
1285 #endif // BC_ENABLE_EXTRA_MATH
1286 	BC_INST_INVALID,      BC_INST_INVALID,
1287 	BC_INST_INVALID,      BC_INST_PRINT_POP,
1288 	BC_INST_NQUIT,        BC_INST_EXEC_STACK_LEN,
1289 	BC_INST_SCALE_FUNC,   BC_INST_INVALID,
1290 };
1291 #endif // DC_ENABLED
1292 
1293 #endif // !BC_ENABLE_LIBRARY
1294 
1295 #if BC_ENABLE_EXTRA_MATH
1296 
1297 /// A constant for the rand multiplier.
1298 const BcRandState bc_rand_multiplier = BC_RAND_MULTIPLIER;
1299 
1300 #endif // BC_ENABLE_EXTRA_MATH
1301 
1302 // clang-format off
1303 
1304 #if BC_LONG_BIT >= 64
1305 
1306 /// A constant array for the max of a bigdig number as a BcDig array.
1307 const BcDig bc_num_bigdigMax[] = {
1308 	709551616U,
1309 	446744073U,
1310 	18U,
1311 };
1312 
1313 /// A constant array for the max of 2 times a bigdig number as a BcDig array.
1314 const BcDig bc_num_bigdigMax2[] = {
1315 	768211456U,
1316 	374607431U,
1317 	938463463U,
1318 	282366920U,
1319 	340U,
1320 };
1321 
1322 #else // BC_LONG_BIT >= 64
1323 
1324 /// A constant array for the max of a bigdig number as a BcDig array.
1325 const BcDig bc_num_bigdigMax[] = {
1326 	7296U,
1327 	9496U,
1328 	42U,
1329 };
1330 
1331 /// A constant array for the max of 2 times a bigdig number as a BcDig array.
1332 const BcDig bc_num_bigdigMax2[] = {
1333 	1616U,
1334 	955U,
1335 	737U,
1336 	6744U,
1337 	1844U,
1338 };
1339 
1340 #endif // BC_LONG_BIT >= 64
1341 
1342 // clang-format on
1343 
1344 /// The size of the bigdig max array.
1345 const size_t bc_num_bigdigMax_size = sizeof(bc_num_bigdigMax) / sizeof(BcDig);
1346 
1347 /// The size of the bigdig max times 2 array.
1348 const size_t bc_num_bigdigMax2_size = sizeof(bc_num_bigdigMax2) / sizeof(BcDig);
1349 
1350 /// A string of digits for easy conversion from characters to digits.
1351 const char bc_num_hex_digits[] = "0123456789ABCDEF";
1352 
1353 // clang-format off
1354 
1355 /// An array for easy conversion from exponent to power of 10.
1356 const BcBigDig bc_num_pow10[BC_BASE_DIGS + 1] = {
1357 	1,
1358 	10,
1359 	100,
1360 	1000,
1361 	10000,
1362 #if BC_BASE_DIGS > 4
1363 	100000,
1364 	1000000,
1365 	10000000,
1366 	100000000,
1367 	1000000000,
1368 #endif // BC_BASE_DIGS > 4
1369 };
1370 
1371 // clang-format on
1372 
1373 #if !BC_ENABLE_LIBRARY
1374 
1375 /// An array of functions for binary operators corresponding to the order of
1376 /// the instructions for the operators.
1377 const BcNumBinaryOp bc_program_ops[] = {
1378 	bc_num_pow,    bc_num_mul,    bc_num_div,
1379 	bc_num_mod,    bc_num_add,    bc_num_sub,
1380 #if BC_ENABLE_EXTRA_MATH
1381 	bc_num_places, bc_num_lshift, bc_num_rshift,
1382 #endif // BC_ENABLE_EXTRA_MATH
1383 };
1384 
1385 /// An array of functions for binary operators allocation requests corresponding
1386 /// to the order of the instructions for the operators.
1387 const BcNumBinaryOpReq bc_program_opReqs[] = {
1388 	bc_num_powReq,    bc_num_mulReq,    bc_num_divReq,
1389 	bc_num_divReq,    bc_num_addReq,    bc_num_addReq,
1390 #if BC_ENABLE_EXTRA_MATH
1391 	bc_num_placesReq, bc_num_placesReq, bc_num_placesReq,
1392 #endif // BC_ENABLE_EXTRA_MATH
1393 };
1394 
1395 /// An array of unary operator functions corresponding to the order of the
1396 /// instructions.
1397 const BcProgramUnary bc_program_unarys[] = {
1398 	bc_program_negate,
1399 	bc_program_not,
1400 #if BC_ENABLE_EXTRA_MATH
1401 	bc_program_trunc,
1402 #endif // BC_ENABLE_EXTRA_MATH
1403 };
1404 
1405 /// A filename for when parsing expressions.
1406 const char bc_program_exprs_name[] = "<exprs>";
1407 
1408 /// A filename for when parsing stdin..
1409 const char bc_program_stdin_name[] = "<stdin>";
1410 
1411 /// A ready message for SIGINT catching.
1412 const char bc_program_ready_msg[] = "ready for more input\n";
1413 
1414 /// The length of the ready message.
1415 const size_t bc_program_ready_msg_len = sizeof(bc_program_ready_msg) - 1;
1416 
1417 /// A list of escape characters that a print statement should treat specially.
1418 const char bc_program_esc_chars[] = "ab\\efnqrt";
1419 
1420 /// A list of characters corresponding to the escape characters above.
1421 const char bc_program_esc_seqs[] = "\a\b\\\\\f\n\"\r\t";
1422 
1423 #endif // !BC_ENABLE_LIBRARY
1424