annotate uptools/libcoding/gsm7_encode_table.c @ 465:003e48f8ebe1

rvinterf/etmsync/fsnew.c: cast 0 to (char *) for execl sentinel I generally don't use NULL and use plain 0 instead, based on a "NULL considered harmful" discussion on the classiccmp mailing list many aeons ago (I couldn't find it, and I reason that it must have been 2005 or earlier), but a recent complaint by a packager sent me searching, and I found this: https://ewontfix.com/11/ While I don't give a @#$% about "modern" systems and code-nazi tools, I realized that passing a plain 0 as a pointer sentinel in execl is wrong because it will break on systems where pointers are longer than the plain int type. Again, I don't give a @#$% about the abomination of x86_64 and the like, but if anyone ever manages to port my code to something like a PDP-11 (16-bit int, 32-bit long and pointers), then passing a plain 0 as a function argument where a pointer is expected most definitely won't work: if the most natural stack slot and SP alignment unit is 16 bits, fitting an int, with longs and pointers taking up two such slots, then the call stack will be totally wrong with a plain 0 passed for a pointer. Casting the 0 to (char *) ought to be the most kosher solution for the most retro systems possible.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 11 Feb 2019 00:00:19 +0000
parents 8fee530f7850
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
355
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This library module contains the table for encoding from ISO 8859-1
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * into the GSM 7-bit default alphabet (03.38 or 23.038). High bit set
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * in the output indicates escape encoding, used for ASCII characters
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * [\]^ and {|}~. 0xFF indicates invalid chars.
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/types.h>
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 u_char gsm7_encode_table[256] = {
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x00 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 0xFF, 0xFF, '\n', 0xFF, 0xFF, '\r', 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x10 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 ' ', '!', '"', '#', 0x02, '%', '&', 0x27, /* 0x20 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 '(', ')', '*', '+', ',', '-', '.', '/',
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 '0', '1', '2', '3', '4', '5', '6', '7', /* 0x30 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 '8', '9', ':', ';', '<', '=', '>', '?',
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 0x40 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 0x50 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 'X', 'Y', 'Z', 0xBC, 0xAF, 0xBE, 0x94, 0x11,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 0xFF, 'a', 'b', 'c', 'd', 'e', 'f', 'g', /* 0x60 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 0x70 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 'x', 'y', 'z', 0xA8, 0xC0, 0xA9, 0xBD, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x80 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x90 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 0xFF, 0x40, 0xFF, 0x01, 0x24, 0x03, 0xFF, 0x5F, /* 0xA0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0xB0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x60,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 0xFF, 0xFF, 0xFF, 0xFF, 0x5B, 0x0E, 0x1C, 0x09, /* 0xC0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 0xFF, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 0xFF, 0x5D, 0xFF, 0xFF, 0xFF, 0xFF, 0x5C, 0xFF, /* 0xD0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 0x0B, 0xFF, 0xFF, 0xFF, 0x5E, 0xFF, 0xFF, 0x1E,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 0x7F, 0xFF, 0xFF, 0xFF, 0x7B, 0x0F, 0x1D, 0xFF, /* 0xE0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 0x04, 0x05, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF,
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 0xFF, 0x7D, 0x08, 0xFF, 0xFF, 0xFF, 0x7C, 0xFF, /* 0xF0 */
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 0x0C, 0x06, 0xFF, 0xFF, 0x7E, 0xFF, 0xFF, 0xFF
8fee530f7850 uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 };