diff options
author | Kevin Newton <[email protected]> | 2023-09-27 12:24:48 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2023-09-27 13:57:38 -0400 |
commit | 4f73a7c2f7ff16aa78cf0dec2d4c7f90a2c41c9b (patch) | |
tree | 3b6f0cedc858d46d30a28c6d03439d653884a915 /prism/enc/pm_tables.c | |
parent | 8ab56869a64fdccc094f4a83c6367fb23b72d38b (diff) |
Sync to prism rename commits
Diffstat (limited to 'prism/enc/pm_tables.c')
-rw-r--r-- | prism/enc/pm_tables.c | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/prism/enc/pm_tables.c b/prism/enc/pm_tables.c index 5504cd5419..c6bb4dce65 100644 --- a/prism/enc/pm_tables.c +++ b/prism/enc/pm_tables.c @@ -1,8 +1,8 @@ -#include "yarp/enc/yp_encoding.h" +#include "prism/enc/pm_encoding.h" // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ASCII character. -static uint8_t yp_encoding_ascii_table[256] = { +static uint8_t pm_encoding_ascii_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -24,7 +24,7 @@ static uint8_t yp_encoding_ascii_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-1 character. -static uint8_t yp_encoding_iso_8859_1_table[256] = { +static uint8_t pm_encoding_iso_8859_1_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -46,7 +46,7 @@ static uint8_t yp_encoding_iso_8859_1_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-2 character. -static uint8_t yp_encoding_iso_8859_2_table[256] = { +static uint8_t pm_encoding_iso_8859_2_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -68,7 +68,7 @@ static uint8_t yp_encoding_iso_8859_2_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-3 character. -static uint8_t yp_encoding_iso_8859_3_table[256] = { +static uint8_t pm_encoding_iso_8859_3_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -90,7 +90,7 @@ static uint8_t yp_encoding_iso_8859_3_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-4 character. -static uint8_t yp_encoding_iso_8859_4_table[256] = { +static uint8_t pm_encoding_iso_8859_4_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -112,7 +112,7 @@ static uint8_t yp_encoding_iso_8859_4_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-5 character. -static uint8_t yp_encoding_iso_8859_5_table[256] = { +static uint8_t pm_encoding_iso_8859_5_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -134,7 +134,7 @@ static uint8_t yp_encoding_iso_8859_5_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-6 character. -static uint8_t yp_encoding_iso_8859_6_table[256] = { +static uint8_t pm_encoding_iso_8859_6_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -156,7 +156,7 @@ static uint8_t yp_encoding_iso_8859_6_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-7 character. -static uint8_t yp_encoding_iso_8859_7_table[256] = { +static uint8_t pm_encoding_iso_8859_7_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -178,7 +178,7 @@ static uint8_t yp_encoding_iso_8859_7_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-8 character. -static uint8_t yp_encoding_iso_8859_8_table[256] = { +static uint8_t pm_encoding_iso_8859_8_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -200,7 +200,7 @@ static uint8_t yp_encoding_iso_8859_8_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-9 character. -static uint8_t yp_encoding_iso_8859_9_table[256] = { +static uint8_t pm_encoding_iso_8859_9_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -222,7 +222,7 @@ static uint8_t yp_encoding_iso_8859_9_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-10 character. -static uint8_t yp_encoding_iso_8859_10_table[256] = { +static uint8_t pm_encoding_iso_8859_10_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -244,7 +244,7 @@ static uint8_t yp_encoding_iso_8859_10_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-11 character. -static uint8_t yp_encoding_iso_8859_11_table[256] = { +static uint8_t pm_encoding_iso_8859_11_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -266,7 +266,7 @@ static uint8_t yp_encoding_iso_8859_11_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-13 character. -static uint8_t yp_encoding_iso_8859_13_table[256] = { +static uint8_t pm_encoding_iso_8859_13_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -288,7 +288,7 @@ static uint8_t yp_encoding_iso_8859_13_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-14 character. -static uint8_t yp_encoding_iso_8859_14_table[256] = { +static uint8_t pm_encoding_iso_8859_14_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -310,7 +310,7 @@ static uint8_t yp_encoding_iso_8859_14_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-15 character. -static uint8_t yp_encoding_iso_8859_15_table[256] = { +static uint8_t pm_encoding_iso_8859_15_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -332,7 +332,7 @@ static uint8_t yp_encoding_iso_8859_15_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding ISO-8859-16 character. -static uint8_t yp_encoding_iso_8859_16_table[256] = { +static uint8_t pm_encoding_iso_8859_16_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -354,7 +354,7 @@ static uint8_t yp_encoding_iso_8859_16_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding KOI8-R character. -static uint8_t yp_encoding_koi8_r_table[256] = { +static uint8_t pm_encoding_koi8_r_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -376,7 +376,7 @@ static uint8_t yp_encoding_koi8_r_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding windows-1251 character. -static uint8_t yp_encoding_windows_1251_table[256] = { +static uint8_t pm_encoding_windows_1251_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -398,7 +398,7 @@ static uint8_t yp_encoding_windows_1251_table[256] = { // Each element of the following table contains a bitfield that indicates a // piece of information about the corresponding windows-1252 character. -static uint8_t yp_encoding_windows_1252_table[256] = { +static uint8_t pm_encoding_windows_1252_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x @@ -419,89 +419,89 @@ static uint8_t yp_encoding_windows_1252_table[256] = { }; static size_t -yp_encoding_ascii_char_width(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { +pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { return *b < 0x80 ? 1 : 0; } size_t -yp_encoding_ascii_alpha_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (yp_encoding_ascii_table[*b] & YP_ENCODING_ALPHABETIC_BIT); +pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { + return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); } size_t -yp_encoding_ascii_alnum_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (yp_encoding_ascii_table[*b] & YP_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; +pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { + return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; } bool -yp_encoding_ascii_isupper_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (yp_encoding_ascii_table[*b] & YP_ENCODING_UPPERCASE_BIT); +pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { + return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT); } static size_t -yp_encoding_koi8_r_char_width(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { +pm_encoding_koi8_r_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { return ((*b >= 0x20 && *b <= 0x7E) || (*b >= 0x80)) ? 1 : 0; } static size_t -yp_encoding_single_char_width(YP_ATTRIBUTE_UNUSED const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { +pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { return 1; } -yp_encoding_t yp_encoding_ascii = { +pm_encoding_t pm_encoding_ascii = { .name = "ascii", - .char_width = yp_encoding_ascii_char_width, - .alnum_char = yp_encoding_ascii_alnum_char, - .alpha_char = yp_encoding_ascii_alpha_char, - .isupper_char = yp_encoding_ascii_isupper_char, + .char_width = pm_encoding_ascii_char_width, + .alnum_char = pm_encoding_ascii_alnum_char, + .alpha_char = pm_encoding_ascii_alpha_char, + .isupper_char = pm_encoding_ascii_isupper_char, .multibyte = false }; -yp_encoding_t yp_encoding_ascii_8bit = { +pm_encoding_t pm_encoding_ascii_8bit = { .name = "ascii-8bit", - .char_width = yp_encoding_single_char_width, - .alnum_char = yp_encoding_ascii_alnum_char, - .alpha_char = yp_encoding_ascii_alpha_char, - .isupper_char = yp_encoding_ascii_isupper_char, + .char_width = pm_encoding_single_char_width, + .alnum_char = pm_encoding_ascii_alnum_char, + .alpha_char = pm_encoding_ascii_alpha_char, + .isupper_char = pm_encoding_ascii_isupper_char, .multibyte = false }; -#define YP_ENCODING_TABLE(s, i, w) \ - static size_t yp_encoding_ ##i ## _alpha_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (yp_encoding_ ##i ## _table[*b] & YP_ENCODING_ALPHABETIC_BIT); \ +#define PRISM_ENCODING_TABLE(s, i, w) \ + static size_t pm_encoding_ ##i ## _alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ + return (pm_encoding_ ##i ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); \ } \ - static size_t yp_encoding_ ##i ## _alnum_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (yp_encoding_ ##i ## _table[*b] & YP_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; \ + static size_t pm_encoding_ ##i ## _alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ + return (pm_encoding_ ##i ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; \ } \ - static bool yp_encoding_ ##i ## _isupper_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (yp_encoding_ ##i ## _table[*b] & YP_ENCODING_UPPERCASE_BIT); \ + static bool pm_encoding_ ##i ## _isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ + return (pm_encoding_ ##i ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT); \ } \ - yp_encoding_t yp_encoding_ ##i = { \ + pm_encoding_t pm_encoding_ ##i = { \ .name = s, \ .char_width = w, \ - .alnum_char = yp_encoding_ ##i ## _alnum_char, \ - .alpha_char = yp_encoding_ ##i ## _alpha_char, \ - .isupper_char = yp_encoding_ ##i ## _isupper_char, \ + .alnum_char = pm_encoding_ ##i ## _alnum_char, \ + .alpha_char = pm_encoding_ ##i ## _alpha_char, \ + .isupper_char = pm_encoding_ ##i ## _isupper_char, \ .multibyte = false, \ }; -YP_ENCODING_TABLE("iso-8859-1", iso_8859_1, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-2", iso_8859_2, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-3", iso_8859_3, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-4", iso_8859_4, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-5", iso_8859_5, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-6", iso_8859_6, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-7", iso_8859_7, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-8", iso_8859_8, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-9", iso_8859_9, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-10", iso_8859_10, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-11", iso_8859_11, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-13", iso_8859_13, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-14", iso_8859_14, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-15", iso_8859_15, yp_encoding_single_char_width) -YP_ENCODING_TABLE("iso-8859-16", iso_8859_16, yp_encoding_single_char_width) -YP_ENCODING_TABLE("koi8-r", koi8_r, yp_encoding_koi8_r_char_width) -YP_ENCODING_TABLE("windows-1251", windows_1251, yp_encoding_single_char_width) -YP_ENCODING_TABLE("windows-1252", windows_1252, yp_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-1", iso_8859_1, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-2", iso_8859_2, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-3", iso_8859_3, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-4", iso_8859_4, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-5", iso_8859_5, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-6", iso_8859_6, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-7", iso_8859_7, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-8", iso_8859_8, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-9", iso_8859_9, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-10", iso_8859_10, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-11", iso_8859_11, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-13", iso_8859_13, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-14", iso_8859_14, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-15", iso_8859_15, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("iso-8859-16", iso_8859_16, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("koi8-r", koi8_r, pm_encoding_koi8_r_char_width) +PRISM_ENCODING_TABLE("windows-1251", windows_1251, pm_encoding_single_char_width) +PRISM_ENCODING_TABLE("windows-1252", windows_1252, pm_encoding_single_char_width) -#undef YP_ENCODING_TABLE +#undef PRISM_ENCODING_TABLE |