prism 0.17.1 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -1
- data/Makefile +5 -5
- data/README.md +4 -3
- data/config.yml +214 -68
- data/docs/build_system.md +6 -6
- data/docs/building.md +10 -3
- data/docs/configuration.md +11 -9
- data/docs/encoding.md +92 -88
- data/docs/heredocs.md +1 -1
- data/docs/javascript.md +29 -1
- data/docs/local_variable_depth.md +229 -0
- data/docs/ruby_api.md +16 -0
- data/docs/serialization.md +18 -13
- data/ext/prism/api_node.c +411 -240
- data/ext/prism/extconf.rb +97 -127
- data/ext/prism/extension.c +97 -33
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +377 -159
- data/include/prism/defines.h +17 -0
- data/include/prism/diagnostic.h +38 -6
- data/include/prism/{enc/pm_encoding.h → encoding.h} +126 -64
- data/include/prism/options.h +2 -2
- data/include/prism/parser.h +62 -36
- data/include/prism/regexp.h +2 -2
- data/include/prism/util/pm_buffer.h +9 -1
- data/include/prism/util/pm_memchr.h +2 -2
- data/include/prism/util/pm_strpbrk.h +3 -3
- data/include/prism/version.h +3 -3
- data/include/prism.h +13 -15
- data/lib/prism/compiler.rb +15 -3
- data/lib/prism/debug.rb +13 -4
- data/lib/prism/desugar_compiler.rb +4 -3
- data/lib/prism/dispatcher.rb +70 -14
- data/lib/prism/dot_visitor.rb +4612 -0
- data/lib/prism/dsl.rb +77 -57
- data/lib/prism/ffi.rb +19 -6
- data/lib/prism/lex_compat.rb +19 -9
- data/lib/prism/mutation_compiler.rb +26 -6
- data/lib/prism/node.rb +1314 -522
- data/lib/prism/node_ext.rb +102 -19
- data/lib/prism/parse_result.rb +58 -27
- data/lib/prism/ripper_compat.rb +49 -34
- data/lib/prism/serialize.rb +251 -227
- data/lib/prism/visitor.rb +15 -3
- data/lib/prism.rb +21 -4
- data/prism.gemspec +7 -9
- data/rbi/prism.rbi +688 -284
- data/rbi/prism_static.rbi +3 -0
- data/sig/prism.rbs +426 -156
- data/sig/prism_static.rbs +1 -0
- data/src/diagnostic.c +280 -216
- data/src/encoding.c +5137 -0
- data/src/node.c +99 -21
- data/src/options.c +21 -2
- data/src/prettyprint.c +1743 -1241
- data/src/prism.c +1774 -831
- data/src/regexp.c +15 -15
- data/src/serialize.c +261 -164
- data/src/util/pm_buffer.c +10 -1
- data/src/util/pm_memchr.c +1 -1
- data/src/util/pm_strpbrk.c +4 -4
- metadata +8 -10
- data/src/enc/pm_big5.c +0 -53
- data/src/enc/pm_euc_jp.c +0 -59
- data/src/enc/pm_gbk.c +0 -62
- data/src/enc/pm_shift_jis.c +0 -57
- data/src/enc/pm_tables.c +0 -743
- data/src/enc/pm_unicode.c +0 -2369
- data/src/enc/pm_windows_31j.c +0 -57
data/src/enc/pm_tables.c
DELETED
@@ -1,743 +0,0 @@
|
|
1
|
-
#include "prism/enc/pm_encoding.h"
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Each element of the following table contains a bitfield that indicates a
|
5
|
-
* piece of information about the corresponding ASCII character.
|
6
|
-
*/
|
7
|
-
static uint8_t pm_encoding_ascii_table[256] = {
|
8
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
9
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
10
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
11
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
12
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
13
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
14
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
15
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
16
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
17
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
18
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
19
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
|
20
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
|
21
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
|
22
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
|
23
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
|
24
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
|
25
|
-
};
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Each element of the following table contains a bitfield that indicates a
|
29
|
-
* piece of information about the corresponding ISO-8859-1 character.
|
30
|
-
*/
|
31
|
-
static uint8_t pm_encoding_iso_8859_1_table[256] = {
|
32
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
33
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
34
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
35
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
36
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
37
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
38
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
39
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
40
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
41
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
42
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
43
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
|
44
|
-
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
|
45
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
46
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
47
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
48
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
49
|
-
};
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Each element of the following table contains a bitfield that indicates a
|
53
|
-
* piece of information about the corresponding ISO-8859-2 character.
|
54
|
-
*/
|
55
|
-
static uint8_t pm_encoding_iso_8859_2_table[256] = {
|
56
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
57
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
58
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
59
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
60
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
61
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
62
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
63
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
64
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
65
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
66
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
67
|
-
0, 7, 0, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 7, // Ax
|
68
|
-
0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 3, 3, // Bx
|
69
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
70
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
71
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
72
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
|
73
|
-
};
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Each element of the following table contains a bitfield that indicates a
|
77
|
-
* piece of information about the corresponding ISO-8859-3 character.
|
78
|
-
*/
|
79
|
-
static uint8_t pm_encoding_iso_8859_3_table[256] = {
|
80
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
81
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
82
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
83
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
84
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
85
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
86
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
87
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
88
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
89
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
90
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
91
|
-
0, 7, 0, 0, 0, 0, 7, 0, 0, 7, 7, 7, 7, 0, 0, 7, // Ax
|
92
|
-
0, 3, 0, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3, // Bx
|
93
|
-
7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
94
|
-
0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
95
|
-
3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
96
|
-
0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
|
97
|
-
};
|
98
|
-
|
99
|
-
/**
|
100
|
-
* Each element of the following table contains a bitfield that indicates a
|
101
|
-
* piece of information about the corresponding ISO-8859-4 character.
|
102
|
-
*/
|
103
|
-
static uint8_t pm_encoding_iso_8859_4_table[256] = {
|
104
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
105
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
106
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
107
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
108
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
109
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
110
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
111
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
112
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
113
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
114
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
115
|
-
0, 7, 3, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 0, // Ax
|
116
|
-
0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 7, 3, 3, // Bx
|
117
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
118
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
119
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
120
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
|
121
|
-
};
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Each element of the following table contains a bitfield that indicates a
|
125
|
-
* piece of information about the corresponding ISO-8859-5 character.
|
126
|
-
*/
|
127
|
-
static uint8_t pm_encoding_iso_8859_5_table[256] = {
|
128
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
129
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
130
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
131
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
132
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
133
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
134
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
135
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
136
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
137
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
138
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
139
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
|
140
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Bx
|
141
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
142
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
|
143
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
144
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, // Fx
|
145
|
-
};
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Each element of the following table contains a bitfield that indicates a
|
149
|
-
* piece of information about the corresponding ISO-8859-6 character.
|
150
|
-
*/
|
151
|
-
static uint8_t pm_encoding_iso_8859_6_table[256] = {
|
152
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
153
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
154
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
155
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
156
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
157
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
158
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
159
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
160
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
161
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
162
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
163
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
|
164
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
|
165
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
|
166
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Dx
|
167
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
168
|
-
3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
|
169
|
-
};
|
170
|
-
|
171
|
-
/**
|
172
|
-
* Each element of the following table contains a bitfield that indicates a
|
173
|
-
* piece of information about the corresponding ISO-8859-7 character.
|
174
|
-
*/
|
175
|
-
static uint8_t pm_encoding_iso_8859_7_table[256] = {
|
176
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
177
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
178
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
179
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
180
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
181
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
182
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
183
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
184
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
185
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
186
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
187
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
|
188
|
-
0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 0, 7, 0, 7, 7, // Bx
|
189
|
-
3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
190
|
-
7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, // Dx
|
191
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
192
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
|
193
|
-
};
|
194
|
-
|
195
|
-
/**
|
196
|
-
* Each element of the following table contains a bitfield that indicates a
|
197
|
-
* piece of information about the corresponding ISO-8859-8 character.
|
198
|
-
*/
|
199
|
-
static uint8_t pm_encoding_iso_8859_8_table[256] = {
|
200
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
201
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
202
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
203
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
204
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
205
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
206
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
207
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
208
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
209
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
210
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
211
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
|
212
|
-
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
|
213
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
|
214
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
|
215
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
216
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Fx
|
217
|
-
};
|
218
|
-
|
219
|
-
/**
|
220
|
-
* Each element of the following table contains a bitfield that indicates a
|
221
|
-
* piece of information about the corresponding ISO-8859-9 character.
|
222
|
-
*/
|
223
|
-
static uint8_t pm_encoding_iso_8859_9_table[256] = {
|
224
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
225
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
226
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
227
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
228
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
229
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
230
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
231
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
232
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
233
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
234
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
235
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
|
236
|
-
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
|
237
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
238
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
239
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
240
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
241
|
-
};
|
242
|
-
|
243
|
-
/**
|
244
|
-
* Each element of the following table contains a bitfield that indicates a
|
245
|
-
* piece of information about the corresponding ISO-8859-10 character.
|
246
|
-
*/
|
247
|
-
static uint8_t pm_encoding_iso_8859_10_table[256] = {
|
248
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
249
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
250
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
251
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
252
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
253
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
254
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
255
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
256
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
257
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
258
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
259
|
-
0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
|
260
|
-
0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, // Bx
|
261
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
262
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
263
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
264
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
265
|
-
};
|
266
|
-
|
267
|
-
/**
|
268
|
-
* Each element of the following table contains a bitfield that indicates a
|
269
|
-
* piece of information about the corresponding ISO-8859-11 character.
|
270
|
-
*/
|
271
|
-
static uint8_t pm_encoding_iso_8859_11_table[256] = {
|
272
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
273
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
274
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
275
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
276
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
277
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
278
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
279
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
280
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
281
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
282
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
283
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ax
|
284
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Bx
|
285
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
|
286
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, // Dx
|
287
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
288
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, // Fx
|
289
|
-
};
|
290
|
-
|
291
|
-
/**
|
292
|
-
* Each element of the following table contains a bitfield that indicates a
|
293
|
-
* piece of information about the corresponding ISO-8859-13 character.
|
294
|
-
*/
|
295
|
-
static uint8_t pm_encoding_iso_8859_13_table[256] = {
|
296
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
297
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
298
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
299
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
300
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
301
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
302
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
303
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
304
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
305
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
306
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
307
|
-
0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
|
308
|
-
0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 0, 3, // Bx
|
309
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
310
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
311
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
312
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
|
313
|
-
};
|
314
|
-
|
315
|
-
/**
|
316
|
-
* Each element of the following table contains a bitfield that indicates a
|
317
|
-
* piece of information about the corresponding ISO-8859-14 character.
|
318
|
-
*/
|
319
|
-
static uint8_t pm_encoding_iso_8859_14_table[256] = {
|
320
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
321
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
322
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
323
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
324
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
325
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
326
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
327
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
328
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
329
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
330
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
331
|
-
0, 7, 3, 0, 7, 3, 7, 0, 7, 0, 7, 3, 7, 0, 0, 7, // Ax
|
332
|
-
7, 3, 7, 3, 7, 3, 0, 7, 3, 3, 3, 7, 3, 7, 3, 3, // Bx
|
333
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
334
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
335
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
336
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
337
|
-
};
|
338
|
-
|
339
|
-
/**
|
340
|
-
* Each element of the following table contains a bitfield that indicates a
|
341
|
-
* piece of information about the corresponding ISO-8859-15 character.
|
342
|
-
*/
|
343
|
-
static uint8_t pm_encoding_iso_8859_15_table[256] = {
|
344
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
345
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
346
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
347
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
348
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
349
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
350
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
351
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
352
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
353
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
354
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
355
|
-
0, 0, 0, 0, 0, 0, 7, 0, 3, 0, 3, 0, 0, 0, 0, 0, // Ax
|
356
|
-
0, 0, 0, 0, 7, 3, 0, 0, 3, 0, 3, 0, 7, 3, 7, 0, // Bx
|
357
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
358
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
359
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
360
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
361
|
-
};
|
362
|
-
|
363
|
-
/**
|
364
|
-
* Each element of the following table contains a bitfield that indicates a
|
365
|
-
* piece of information about the corresponding ISO-8859-16 character.
|
366
|
-
*/
|
367
|
-
static uint8_t pm_encoding_iso_8859_16_table[256] = {
|
368
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
369
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
370
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
371
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
372
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
373
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
374
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
375
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
376
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
377
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
378
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
379
|
-
0, 7, 3, 7, 0, 0, 7, 0, 3, 0, 7, 0, 7, 0, 3, 7, // Ax
|
380
|
-
0, 0, 7, 3, 7, 0, 0, 0, 3, 3, 3, 0, 7, 3, 7, 3, // Bx
|
381
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
382
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
383
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
384
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
385
|
-
};
|
386
|
-
|
387
|
-
/**
|
388
|
-
* Each element of the following table contains a bitfield that indicates a
|
389
|
-
* piece of information about the corresponding KOI8-R character.
|
390
|
-
*/
|
391
|
-
static uint8_t pm_encoding_koi8_r_table[256] = {
|
392
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
393
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
394
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
395
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
396
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
397
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
398
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
399
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
400
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
401
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
|
402
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
|
403
|
-
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
|
404
|
-
0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
|
405
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
|
406
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
|
407
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Ex
|
408
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
|
409
|
-
};
|
410
|
-
|
411
|
-
/**
|
412
|
-
* Each element of the following table contains a bitfield that indicates a
|
413
|
-
* piece of information about the corresponding windows-1251 character.
|
414
|
-
*/
|
415
|
-
static uint8_t pm_encoding_windows_1251_table[256] = {
|
416
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
417
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
418
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
419
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
420
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
421
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
422
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
423
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
424
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
425
|
-
7, 7, 0, 3, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, // 8x
|
426
|
-
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, // 9x
|
427
|
-
0, 7, 3, 7, 0, 7, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
|
428
|
-
0, 0, 7, 3, 3, 3, 0, 0, 3, 0, 3, 0, 3, 7, 3, 3, // Bx
|
429
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
430
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Dx
|
431
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
432
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
433
|
-
};
|
434
|
-
|
435
|
-
/**
|
436
|
-
* Each element of the following table contains a bitfield that indicates a
|
437
|
-
* piece of information about the corresponding windows-1252 character.
|
438
|
-
*/
|
439
|
-
static uint8_t pm_encoding_windows_1252_table[256] = {
|
440
|
-
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
441
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
442
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
443
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
|
444
|
-
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
|
445
|
-
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
|
446
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
|
447
|
-
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
|
448
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
|
449
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 7, 0, // 8x
|
450
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 3, 7, // 9x
|
451
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
|
452
|
-
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
|
453
|
-
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
|
454
|
-
7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
|
455
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
|
456
|
-
3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
|
457
|
-
};
|
458
|
-
|
459
|
-
/**
|
460
|
-
* Returns the size of the next character in the ASCII encoding. This basically
|
461
|
-
* means that if the top bit is not set, the character is 1 byte long.
|
462
|
-
*/
|
463
|
-
static size_t
|
464
|
-
pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
465
|
-
return *b < 0x80 ? 1 : 0;
|
466
|
-
}
|
467
|
-
|
468
|
-
/**
|
469
|
-
* Return the size of the next character in the ASCII encoding if it is an
|
470
|
-
* alphabetical character.
|
471
|
-
*/
|
472
|
-
size_t
|
473
|
-
pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
474
|
-
return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT);
|
475
|
-
}
|
476
|
-
|
477
|
-
/**
|
478
|
-
* Return the size of the next character in the ASCII encoding if it is an
|
479
|
-
* alphanumeric character.
|
480
|
-
*/
|
481
|
-
size_t
|
482
|
-
pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
483
|
-
return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0;
|
484
|
-
}
|
485
|
-
|
486
|
-
/**
|
487
|
-
* Return true if the next character in the ASCII encoding if it is an uppercase
|
488
|
-
* character.
|
489
|
-
*/
|
490
|
-
bool
|
491
|
-
pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
492
|
-
return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT);
|
493
|
-
}
|
494
|
-
|
495
|
-
/**
|
496
|
-
* For a lot of encodings the default is that they are a single byte long no
|
497
|
-
* matter what the codepoint, so this function is shared between them.
|
498
|
-
*/
|
499
|
-
static size_t
|
500
|
-
pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
501
|
-
return 1;
|
502
|
-
}
|
503
|
-
|
504
|
-
/**
|
505
|
-
* Returns the size of the next character in the KOI-8 encoding. This means
|
506
|
-
* checking if it's a valid codepoint in KOI-8 and if it is returning 1.
|
507
|
-
*/
|
508
|
-
static size_t
|
509
|
-
pm_encoding_koi8_r_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
|
510
|
-
return ((*b >= 0x20 && *b <= 0x7E) || (*b >= 0x80)) ? 1 : 0;
|
511
|
-
}
|
512
|
-
|
513
|
-
#define PRISM_ENCODING_TABLE(name) \
|
514
|
-
static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
|
515
|
-
return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); \
|
516
|
-
} \
|
517
|
-
static size_t pm_encoding_ ##name ## _alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
|
518
|
-
return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; \
|
519
|
-
} \
|
520
|
-
static bool pm_encoding_ ##name ## _isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
|
521
|
-
return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT); \
|
522
|
-
}
|
523
|
-
|
524
|
-
PRISM_ENCODING_TABLE(iso_8859_1)
|
525
|
-
PRISM_ENCODING_TABLE(iso_8859_2)
|
526
|
-
PRISM_ENCODING_TABLE(iso_8859_3)
|
527
|
-
PRISM_ENCODING_TABLE(iso_8859_4)
|
528
|
-
PRISM_ENCODING_TABLE(iso_8859_5)
|
529
|
-
PRISM_ENCODING_TABLE(iso_8859_6)
|
530
|
-
PRISM_ENCODING_TABLE(iso_8859_7)
|
531
|
-
PRISM_ENCODING_TABLE(iso_8859_8)
|
532
|
-
PRISM_ENCODING_TABLE(iso_8859_9)
|
533
|
-
PRISM_ENCODING_TABLE(iso_8859_10)
|
534
|
-
PRISM_ENCODING_TABLE(iso_8859_11)
|
535
|
-
PRISM_ENCODING_TABLE(iso_8859_13)
|
536
|
-
PRISM_ENCODING_TABLE(iso_8859_14)
|
537
|
-
PRISM_ENCODING_TABLE(iso_8859_15)
|
538
|
-
PRISM_ENCODING_TABLE(iso_8859_16)
|
539
|
-
PRISM_ENCODING_TABLE(koi8_r)
|
540
|
-
PRISM_ENCODING_TABLE(windows_1251)
|
541
|
-
PRISM_ENCODING_TABLE(windows_1252)
|
542
|
-
|
543
|
-
#undef PRISM_ENCODING_TABLE
|
544
|
-
|
545
|
-
/** ASCII encoding */
|
546
|
-
pm_encoding_t pm_encoding_ascii = {
|
547
|
-
.name = "ascii",
|
548
|
-
.char_width = pm_encoding_ascii_char_width,
|
549
|
-
.alnum_char = pm_encoding_ascii_alnum_char,
|
550
|
-
.alpha_char = pm_encoding_ascii_alpha_char,
|
551
|
-
.isupper_char = pm_encoding_ascii_isupper_char,
|
552
|
-
.multibyte = false
|
553
|
-
};
|
554
|
-
|
555
|
-
/** ASCII-8BIT encoding */
|
556
|
-
pm_encoding_t pm_encoding_ascii_8bit = {
|
557
|
-
.name = "ascii-8bit",
|
558
|
-
.char_width = pm_encoding_single_char_width,
|
559
|
-
.alnum_char = pm_encoding_ascii_alnum_char,
|
560
|
-
.alpha_char = pm_encoding_ascii_alpha_char,
|
561
|
-
.isupper_char = pm_encoding_ascii_isupper_char,
|
562
|
-
.multibyte = false
|
563
|
-
};
|
564
|
-
|
565
|
-
/** ISO-8859-1 */
|
566
|
-
pm_encoding_t pm_encoding_iso_8859_1 = {
|
567
|
-
.name = "iso-8859-1",
|
568
|
-
.char_width = pm_encoding_single_char_width,
|
569
|
-
.alnum_char = pm_encoding_iso_8859_1_alnum_char,
|
570
|
-
.alpha_char = pm_encoding_iso_8859_1_alpha_char,
|
571
|
-
.isupper_char = pm_encoding_iso_8859_1_isupper_char,
|
572
|
-
.multibyte = false
|
573
|
-
};
|
574
|
-
|
575
|
-
/** ISO-8859-2 */
|
576
|
-
pm_encoding_t pm_encoding_iso_8859_2 = {
|
577
|
-
.name = "iso-8859-2",
|
578
|
-
.char_width = pm_encoding_single_char_width,
|
579
|
-
.alnum_char = pm_encoding_iso_8859_2_alnum_char,
|
580
|
-
.alpha_char = pm_encoding_iso_8859_2_alpha_char,
|
581
|
-
.isupper_char = pm_encoding_iso_8859_2_isupper_char,
|
582
|
-
.multibyte = false
|
583
|
-
};
|
584
|
-
|
585
|
-
/** ISO-8859-3 */
|
586
|
-
pm_encoding_t pm_encoding_iso_8859_3 = {
|
587
|
-
.name = "iso-8859-3",
|
588
|
-
.char_width = pm_encoding_single_char_width,
|
589
|
-
.alnum_char = pm_encoding_iso_8859_3_alnum_char,
|
590
|
-
.alpha_char = pm_encoding_iso_8859_3_alpha_char,
|
591
|
-
.isupper_char = pm_encoding_iso_8859_3_isupper_char,
|
592
|
-
.multibyte = false
|
593
|
-
};
|
594
|
-
|
595
|
-
/** ISO-8859-4 */
|
596
|
-
pm_encoding_t pm_encoding_iso_8859_4 = {
|
597
|
-
.name = "iso-8859-4",
|
598
|
-
.char_width = pm_encoding_single_char_width,
|
599
|
-
.alnum_char = pm_encoding_iso_8859_4_alnum_char,
|
600
|
-
.alpha_char = pm_encoding_iso_8859_4_alpha_char,
|
601
|
-
.isupper_char = pm_encoding_iso_8859_4_isupper_char,
|
602
|
-
.multibyte = false
|
603
|
-
};
|
604
|
-
|
605
|
-
/** ISO-8859-5 */
|
606
|
-
pm_encoding_t pm_encoding_iso_8859_5 = {
|
607
|
-
.name = "iso-8859-5",
|
608
|
-
.char_width = pm_encoding_single_char_width,
|
609
|
-
.alnum_char = pm_encoding_iso_8859_5_alnum_char,
|
610
|
-
.alpha_char = pm_encoding_iso_8859_5_alpha_char,
|
611
|
-
.isupper_char = pm_encoding_iso_8859_5_isupper_char,
|
612
|
-
.multibyte = false
|
613
|
-
};
|
614
|
-
|
615
|
-
/** ISO-8859-6 */
|
616
|
-
pm_encoding_t pm_encoding_iso_8859_6 = {
|
617
|
-
.name = "iso-8859-6",
|
618
|
-
.char_width = pm_encoding_single_char_width,
|
619
|
-
.alnum_char = pm_encoding_iso_8859_6_alnum_char,
|
620
|
-
.alpha_char = pm_encoding_iso_8859_6_alpha_char,
|
621
|
-
.isupper_char = pm_encoding_iso_8859_6_isupper_char,
|
622
|
-
.multibyte = false
|
623
|
-
};
|
624
|
-
|
625
|
-
/** ISO-8859-7 */
|
626
|
-
pm_encoding_t pm_encoding_iso_8859_7 = {
|
627
|
-
.name = "iso-8859-7",
|
628
|
-
.char_width = pm_encoding_single_char_width,
|
629
|
-
.alnum_char = pm_encoding_iso_8859_7_alnum_char,
|
630
|
-
.alpha_char = pm_encoding_iso_8859_7_alpha_char,
|
631
|
-
.isupper_char = pm_encoding_iso_8859_7_isupper_char,
|
632
|
-
.multibyte = false
|
633
|
-
};
|
634
|
-
|
635
|
-
/** ISO-8859-8 */
|
636
|
-
pm_encoding_t pm_encoding_iso_8859_8 = {
|
637
|
-
.name = "iso-8859-8",
|
638
|
-
.char_width = pm_encoding_single_char_width,
|
639
|
-
.alnum_char = pm_encoding_iso_8859_8_alnum_char,
|
640
|
-
.alpha_char = pm_encoding_iso_8859_8_alpha_char,
|
641
|
-
.isupper_char = pm_encoding_iso_8859_8_isupper_char,
|
642
|
-
.multibyte = false
|
643
|
-
};
|
644
|
-
|
645
|
-
/** ISO-8859-9 */
|
646
|
-
pm_encoding_t pm_encoding_iso_8859_9 = {
|
647
|
-
.name = "iso-8859-9",
|
648
|
-
.char_width = pm_encoding_single_char_width,
|
649
|
-
.alnum_char = pm_encoding_iso_8859_9_alnum_char,
|
650
|
-
.alpha_char = pm_encoding_iso_8859_9_alpha_char,
|
651
|
-
.isupper_char = pm_encoding_iso_8859_9_isupper_char,
|
652
|
-
.multibyte = false
|
653
|
-
};
|
654
|
-
|
655
|
-
/** ISO-8859-10 */
|
656
|
-
pm_encoding_t pm_encoding_iso_8859_10 = {
|
657
|
-
.name = "iso-8859-10",
|
658
|
-
.char_width = pm_encoding_single_char_width,
|
659
|
-
.alnum_char = pm_encoding_iso_8859_10_alnum_char,
|
660
|
-
.alpha_char = pm_encoding_iso_8859_10_alpha_char,
|
661
|
-
.isupper_char = pm_encoding_iso_8859_10_isupper_char,
|
662
|
-
.multibyte = false
|
663
|
-
};
|
664
|
-
|
665
|
-
/** ISO-8859-11 */
|
666
|
-
pm_encoding_t pm_encoding_iso_8859_11 = {
|
667
|
-
.name = "iso-8859-11",
|
668
|
-
.char_width = pm_encoding_single_char_width,
|
669
|
-
.alnum_char = pm_encoding_iso_8859_11_alnum_char,
|
670
|
-
.alpha_char = pm_encoding_iso_8859_11_alpha_char,
|
671
|
-
.isupper_char = pm_encoding_iso_8859_11_isupper_char,
|
672
|
-
.multibyte = false
|
673
|
-
};
|
674
|
-
|
675
|
-
/** ISO-8859-13 */
|
676
|
-
pm_encoding_t pm_encoding_iso_8859_13 = {
|
677
|
-
.name = "iso-8859-13",
|
678
|
-
.char_width = pm_encoding_single_char_width,
|
679
|
-
.alnum_char = pm_encoding_iso_8859_13_alnum_char,
|
680
|
-
.alpha_char = pm_encoding_iso_8859_13_alpha_char,
|
681
|
-
.isupper_char = pm_encoding_iso_8859_13_isupper_char,
|
682
|
-
.multibyte = false
|
683
|
-
};
|
684
|
-
|
685
|
-
/** ISO-8859-14 */
|
686
|
-
pm_encoding_t pm_encoding_iso_8859_14 = {
|
687
|
-
.name = "iso-8859-14",
|
688
|
-
.char_width = pm_encoding_single_char_width,
|
689
|
-
.alnum_char = pm_encoding_iso_8859_14_alnum_char,
|
690
|
-
.alpha_char = pm_encoding_iso_8859_14_alpha_char,
|
691
|
-
.isupper_char = pm_encoding_iso_8859_14_isupper_char,
|
692
|
-
.multibyte = false
|
693
|
-
};
|
694
|
-
|
695
|
-
/** ISO-8859-15 */
|
696
|
-
pm_encoding_t pm_encoding_iso_8859_15 = {
|
697
|
-
.name = "iso-8859-15",
|
698
|
-
.char_width = pm_encoding_single_char_width,
|
699
|
-
.alnum_char = pm_encoding_iso_8859_15_alnum_char,
|
700
|
-
.alpha_char = pm_encoding_iso_8859_15_alpha_char,
|
701
|
-
.isupper_char = pm_encoding_iso_8859_15_isupper_char,
|
702
|
-
.multibyte = false
|
703
|
-
};
|
704
|
-
|
705
|
-
/** ISO-8859-16 */
|
706
|
-
pm_encoding_t pm_encoding_iso_8859_16 = {
|
707
|
-
.name = "iso-8859-16",
|
708
|
-
.char_width = pm_encoding_single_char_width,
|
709
|
-
.alnum_char = pm_encoding_iso_8859_16_alnum_char,
|
710
|
-
.alpha_char = pm_encoding_iso_8859_16_alpha_char,
|
711
|
-
.isupper_char = pm_encoding_iso_8859_16_isupper_char,
|
712
|
-
.multibyte = false
|
713
|
-
};
|
714
|
-
|
715
|
-
/** KOI8-R */
|
716
|
-
pm_encoding_t pm_encoding_koi8_r = {
|
717
|
-
.name = "koi8-r",
|
718
|
-
.char_width = pm_encoding_koi8_r_char_width,
|
719
|
-
.alnum_char = pm_encoding_koi8_r_alnum_char,
|
720
|
-
.alpha_char = pm_encoding_koi8_r_alpha_char,
|
721
|
-
.isupper_char = pm_encoding_koi8_r_isupper_char,
|
722
|
-
.multibyte = false
|
723
|
-
};
|
724
|
-
|
725
|
-
/** Windows-1251 */
|
726
|
-
pm_encoding_t pm_encoding_windows_1251 = {
|
727
|
-
.name = "windows-1251",
|
728
|
-
.char_width = pm_encoding_single_char_width,
|
729
|
-
.alnum_char = pm_encoding_windows_1251_alnum_char,
|
730
|
-
.alpha_char = pm_encoding_windows_1251_alpha_char,
|
731
|
-
.isupper_char = pm_encoding_windows_1251_isupper_char,
|
732
|
-
.multibyte = false
|
733
|
-
};
|
734
|
-
|
735
|
-
/** Windows-1252 */
|
736
|
-
pm_encoding_t pm_encoding_windows_1252 = {
|
737
|
-
.name = "windows-1252",
|
738
|
-
.char_width = pm_encoding_single_char_width,
|
739
|
-
.alnum_char = pm_encoding_windows_1252_alnum_char,
|
740
|
-
.alpha_char = pm_encoding_windows_1252_alpha_char,
|
741
|
-
.isupper_char = pm_encoding_windows_1252_isupper_char,
|
742
|
-
.multibyte = false
|
743
|
-
};
|