6#ifndef PRISM_ENCODING_H
7#define PRISM_ENCODING_H
68#define PRISM_ENCODING_ALPHABETIC_BIT 1 << 0
74#define PRISM_ENCODING_ALPHANUMERIC_BIT 1 << 1
80#define PRISM_ENCODING_UPPERCASE_BIT 1 << 2
121extern const uint8_t pm_encoding_unicode_table[256];
127 PM_ENCODING_UTF_8 = 0,
128 PM_ENCODING_ASCII_8BIT,
130 PM_ENCODING_BIG5_HKSCS,
131 PM_ENCODING_BIG5_UAO,
140 PM_ENCODING_EMACS_MULE,
142 PM_ENCODING_EUC_JP_MS,
143 PM_ENCODING_EUC_JIS_2004,
166 PM_ENCODING_ISO_8859_1,
167 PM_ENCODING_ISO_8859_2,
168 PM_ENCODING_ISO_8859_3,
169 PM_ENCODING_ISO_8859_4,
170 PM_ENCODING_ISO_8859_5,
171 PM_ENCODING_ISO_8859_6,
172 PM_ENCODING_ISO_8859_7,
173 PM_ENCODING_ISO_8859_8,
174 PM_ENCODING_ISO_8859_9,
175 PM_ENCODING_ISO_8859_10,
176 PM_ENCODING_ISO_8859_11,
177 PM_ENCODING_ISO_8859_13,
178 PM_ENCODING_ISO_8859_14,
179 PM_ENCODING_ISO_8859_15,
180 PM_ENCODING_ISO_8859_16,
183 PM_ENCODING_MAC_CENT_EURO,
184 PM_ENCODING_MAC_CROATIAN,
185 PM_ENCODING_MAC_CYRILLIC,
186 PM_ENCODING_MAC_GREEK,
187 PM_ENCODING_MAC_ICELAND,
188 PM_ENCODING_MAC_JAPANESE,
189 PM_ENCODING_MAC_ROMAN,
190 PM_ENCODING_MAC_ROMANIA,
191 PM_ENCODING_MAC_THAI,
192 PM_ENCODING_MAC_TURKISH,
193 PM_ENCODING_MAC_UKRAINE,
194 PM_ENCODING_SHIFT_JIS,
195 PM_ENCODING_SJIS_DOCOMO,
196 PM_ENCODING_SJIS_KDDI,
197 PM_ENCODING_SJIS_SOFTBANK,
198 PM_ENCODING_STATELESS_ISO_2022_JP,
199 PM_ENCODING_STATELESS_ISO_2022_JP_KDDI,
201 PM_ENCODING_US_ASCII,
202 PM_ENCODING_UTF8_MAC,
203 PM_ENCODING_UTF8_DOCOMO,
204 PM_ENCODING_UTF8_KDDI,
205 PM_ENCODING_UTF8_SOFTBANK,
206 PM_ENCODING_WINDOWS_1250,
207 PM_ENCODING_WINDOWS_1251,
208 PM_ENCODING_WINDOWS_1252,
209 PM_ENCODING_WINDOWS_1253,
210 PM_ENCODING_WINDOWS_1254,
211 PM_ENCODING_WINDOWS_1255,
212 PM_ENCODING_WINDOWS_1256,
213 PM_ENCODING_WINDOWS_1257,
214 PM_ENCODING_WINDOWS_1258,
215 PM_ENCODING_WINDOWS_31J,
216 PM_ENCODING_WINDOWS_874,
229#define PM_ENCODING_UTF_8_ENTRY (&pm_encodings[PM_ENCODING_UTF_8])
236#define PM_ENCODING_US_ASCII_ENTRY (&pm_encodings[PM_ENCODING_US_ASCII])
A custom strncasecmp implementation.
Macro definitions used throughout the prism library.
bool pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n)
Return true if the next character in the UTF-8 encoding if it is an uppercase character.
pm_encoding_type_t
These are all of the encodings that prism supports.
const pm_encoding_t * pm_encoding_find(const uint8_t *start, const uint8_t *end)
Parse the given name of an encoding and return a pointer to the corresponding encoding struct if one ...
size_t pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n)
Return the size of the next character in the UTF-8 encoding if it is an alphabetical character.
size_t pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n)
Return the size of the next character in the UTF-8 encoding if it is an alphanumeric character.
This struct defines the functions necessary to implement the encoding interface so we can determine h...
size_t(* alpha_char)(const uint8_t *b, ptrdiff_t n)
Return the number of bytes that the next character takes if it is valid in the encoding and is alphab...
size_t(* char_width)(const uint8_t *b, ptrdiff_t n)
Return the number of bytes that the next character takes if it is valid in the encoding.
bool multibyte
Return true if the encoding is a multibyte encoding.
bool(* isupper_char)(const uint8_t *b, ptrdiff_t n)
Return true if the next character is valid in the encoding and is an uppercase character.
const char * name
The name of the encoding.
size_t(* alnum_char)(const uint8_t *b, ptrdiff_t n)
Return the number of bytes that the next character takes if it is valid in the encoding and is alphan...