summaryrefslogtreecommitdiff
path: root/prism/enc
diff options
context:
space:
mode:
Diffstat (limited to 'prism/enc')
-rw-r--r--prism/enc/pm_big5.c32
-rw-r--r--prism/enc/pm_encoding.h80
-rw-r--r--prism/enc/pm_euc_jp.c32
-rw-r--r--prism/enc/pm_gbk.c32
-rw-r--r--prism/enc/pm_shift_jis.c32
-rw-r--r--prism/enc/pm_tables.c138
-rw-r--r--prism/enc/pm_unicode.c80
-rw-r--r--prism/enc/pm_windows_31j.c32
8 files changed, 229 insertions, 229 deletions
diff --git a/prism/enc/pm_big5.c b/prism/enc/pm_big5.c
index a7c879cd0a..deaa3afb3f 100644
--- a/prism/enc/pm_big5.c
+++ b/prism/enc/pm_big5.c
@@ -1,7 +1,7 @@
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
static size_t
-yp_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
// These are the single byte characters.
if (*b < 0x80) {
return 1;
@@ -16,37 +16,37 @@ yp_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
}
static size_t
-yp_encoding_big5_alpha_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_big5_char_width(b, n) == 1) {
- return yp_encoding_ascii_alpha_char(b, n);
+pm_encoding_big5_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_big5_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alpha_char(b, n);
} else {
return 0;
}
}
static size_t
-yp_encoding_big5_alnum_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_big5_char_width(b, n) == 1) {
- return yp_encoding_ascii_alnum_char(b, n);
+pm_encoding_big5_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_big5_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alnum_char(b, n);
} else {
return 0;
}
}
static bool
-yp_encoding_big5_isupper_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_big5_char_width(b, n) == 1) {
- return yp_encoding_ascii_isupper_char(b, n);
+pm_encoding_big5_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_big5_char_width(b, n) == 1) {
+ return pm_encoding_ascii_isupper_char(b, n);
} else {
return false;
}
}
-yp_encoding_t yp_encoding_big5 = {
+pm_encoding_t pm_encoding_big5 = {
.name = "big5",
- .char_width = yp_encoding_big5_char_width,
- .alnum_char = yp_encoding_big5_alnum_char,
- .alpha_char = yp_encoding_big5_alpha_char,
- .isupper_char = yp_encoding_big5_isupper_char,
+ .char_width = pm_encoding_big5_char_width,
+ .alnum_char = pm_encoding_big5_alnum_char,
+ .alpha_char = pm_encoding_big5_alpha_char,
+ .isupper_char = pm_encoding_big5_isupper_char,
.multibyte = true
};
diff --git a/prism/enc/pm_encoding.h b/prism/enc/pm_encoding.h
index d8563bd54a..5236a0b3c4 100644
--- a/prism/enc/pm_encoding.h
+++ b/prism/enc/pm_encoding.h
@@ -1,7 +1,7 @@
-#ifndef YARP_ENCODING_H
-#define YARP_ENCODING_H
+#ifndef PRISM_ENCODING_H
+#define PRISM_ENCODING_H
-#include "yarp/defines.h"
+#include "prism/defines.h"
#include <assert.h>
#include <stdbool.h>
@@ -39,57 +39,57 @@ typedef struct {
// Return true if the encoding is a multibyte encoding.
bool multibyte;
-} yp_encoding_t;
+} pm_encoding_t;
// These bits define the location of each bit of metadata within the various
// lookup tables that are used to determine the properties of a character.
-#define YP_ENCODING_ALPHABETIC_BIT 1 << 0
-#define YP_ENCODING_ALPHANUMERIC_BIT 1 << 1
-#define YP_ENCODING_UPPERCASE_BIT 1 << 2
+#define PRISM_ENCODING_ALPHABETIC_BIT 1 << 0
+#define PRISM_ENCODING_ALPHANUMERIC_BIT 1 << 1
+#define PRISM_ENCODING_UPPERCASE_BIT 1 << 2
// These functions are reused by some other encodings, so they are defined here
// so they can be shared.
-size_t yp_encoding_ascii_alpha_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n);
-size_t yp_encoding_ascii_alnum_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n);
-bool yp_encoding_ascii_isupper_char(const uint8_t *b, YP_ATTRIBUTE_UNUSED ptrdiff_t n);
+size_t pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n);
+size_t pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n);
+bool pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n);
// These functions are shared between the actual encoding and the fast path in
// the parser so they need to be internally visible.
-size_t yp_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n);
-size_t yp_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n);
+size_t pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n);
+size_t pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n);
// This lookup table is referenced in both the UTF-8 encoding file and the
// parser directly in order to speed up the default encoding processing.
-extern const uint8_t yp_encoding_unicode_table[256];
+extern const uint8_t pm_encoding_unicode_table[256];
// These are the encodings that are supported by the parser. They are defined in
// their own files in the src/enc directory.
-extern yp_encoding_t yp_encoding_ascii;
-extern yp_encoding_t yp_encoding_ascii_8bit;
-extern yp_encoding_t yp_encoding_big5;
-extern yp_encoding_t yp_encoding_euc_jp;
-extern yp_encoding_t yp_encoding_gbk;
-extern yp_encoding_t yp_encoding_iso_8859_1;
-extern yp_encoding_t yp_encoding_iso_8859_2;
-extern yp_encoding_t yp_encoding_iso_8859_3;
-extern yp_encoding_t yp_encoding_iso_8859_4;
-extern yp_encoding_t yp_encoding_iso_8859_5;
-extern yp_encoding_t yp_encoding_iso_8859_6;
-extern yp_encoding_t yp_encoding_iso_8859_7;
-extern yp_encoding_t yp_encoding_iso_8859_8;
-extern yp_encoding_t yp_encoding_iso_8859_9;
-extern yp_encoding_t yp_encoding_iso_8859_10;
-extern yp_encoding_t yp_encoding_iso_8859_11;
-extern yp_encoding_t yp_encoding_iso_8859_13;
-extern yp_encoding_t yp_encoding_iso_8859_14;
-extern yp_encoding_t yp_encoding_iso_8859_15;
-extern yp_encoding_t yp_encoding_iso_8859_16;
-extern yp_encoding_t yp_encoding_koi8_r;
-extern yp_encoding_t yp_encoding_shift_jis;
-extern yp_encoding_t yp_encoding_utf_8;
-extern yp_encoding_t yp_encoding_utf8_mac;
-extern yp_encoding_t yp_encoding_windows_31j;
-extern yp_encoding_t yp_encoding_windows_1251;
-extern yp_encoding_t yp_encoding_windows_1252;
+extern pm_encoding_t pm_encoding_ascii;
+extern pm_encoding_t pm_encoding_ascii_8bit;
+extern pm_encoding_t pm_encoding_big5;
+extern pm_encoding_t pm_encoding_euc_jp;
+extern pm_encoding_t pm_encoding_gbk;
+extern pm_encoding_t pm_encoding_iso_8859_1;
+extern pm_encoding_t pm_encoding_iso_8859_2;
+extern pm_encoding_t pm_encoding_iso_8859_3;
+extern pm_encoding_t pm_encoding_iso_8859_4;
+extern pm_encoding_t pm_encoding_iso_8859_5;
+extern pm_encoding_t pm_encoding_iso_8859_6;
+extern pm_encoding_t pm_encoding_iso_8859_7;
+extern pm_encoding_t pm_encoding_iso_8859_8;
+extern pm_encoding_t pm_encoding_iso_8859_9;
+extern pm_encoding_t pm_encoding_iso_8859_10;
+extern pm_encoding_t pm_encoding_iso_8859_11;
+extern pm_encoding_t pm_encoding_iso_8859_13;
+extern pm_encoding_t pm_encoding_iso_8859_14;
+extern pm_encoding_t pm_encoding_iso_8859_15;
+extern pm_encoding_t pm_encoding_iso_8859_16;
+extern pm_encoding_t pm_encoding_koi8_r;
+extern pm_encoding_t pm_encoding_shift_jis;
+extern pm_encoding_t pm_encoding_utf_8;
+extern pm_encoding_t pm_encoding_utf8_mac;
+extern pm_encoding_t pm_encoding_windows_31j;
+extern pm_encoding_t pm_encoding_windows_1251;
+extern pm_encoding_t pm_encoding_windows_1252;
#endif
diff --git a/prism/enc/pm_euc_jp.c b/prism/enc/pm_euc_jp.c
index f6f80d528b..13d3662455 100644
--- a/prism/enc/pm_euc_jp.c
+++ b/prism/enc/pm_euc_jp.c
@@ -1,7 +1,7 @@
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
static size_t
-yp_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
// These are the single byte characters.
if (*b < 0x80) {
return 1;
@@ -22,37 +22,37 @@ yp_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
}
static size_t
-yp_encoding_euc_jp_alpha_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_euc_jp_char_width(b, n) == 1) {
- return yp_encoding_ascii_alpha_char(b, n);
+pm_encoding_euc_jp_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_euc_jp_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alpha_char(b, n);
} else {
return 0;
}
}
static size_t
-yp_encoding_euc_jp_alnum_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_euc_jp_char_width(b, n) == 1) {
- return yp_encoding_ascii_alnum_char(b, n);
+pm_encoding_euc_jp_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_euc_jp_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alnum_char(b, n);
} else {
return 0;
}
}
static bool
-yp_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_euc_jp_char_width(b, n) == 1) {
- return yp_encoding_ascii_isupper_char(b, n);
+pm_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_euc_jp_char_width(b, n) == 1) {
+ return pm_encoding_ascii_isupper_char(b, n);
} else {
return 0;
}
}
-yp_encoding_t yp_encoding_euc_jp = {
+pm_encoding_t pm_encoding_euc_jp = {
.name = "euc-jp",
- .char_width = yp_encoding_euc_jp_char_width,
- .alnum_char = yp_encoding_euc_jp_alnum_char,
- .alpha_char = yp_encoding_euc_jp_alpha_char,
- .isupper_char = yp_encoding_euc_jp_isupper_char,
+ .char_width = pm_encoding_euc_jp_char_width,
+ .alnum_char = pm_encoding_euc_jp_alnum_char,
+ .alpha_char = pm_encoding_euc_jp_alpha_char,
+ .isupper_char = pm_encoding_euc_jp_isupper_char,
.multibyte = true
};
diff --git a/prism/enc/pm_gbk.c b/prism/enc/pm_gbk.c
index 71de318612..2fc67b47a4 100644
--- a/prism/enc/pm_gbk.c
+++ b/prism/enc/pm_gbk.c
@@ -1,7 +1,7 @@
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
static size_t
-yp_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
// These are the single byte characters.
if (*b < 0x80) {
return 1;
@@ -25,37 +25,37 @@ yp_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
}
static size_t
-yp_encoding_gbk_alpha_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_gbk_char_width(b, n) == 1) {
- return yp_encoding_ascii_alpha_char(b, n);
+pm_encoding_gbk_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_gbk_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alpha_char(b, n);
} else {
return 0;
}
}
static size_t
-yp_encoding_gbk_alnum_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_gbk_char_width(b, n) == 1) {
- return yp_encoding_ascii_alnum_char(b, n);
+pm_encoding_gbk_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_gbk_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alnum_char(b, n);
} else {
return 0;
}
}
static bool
-yp_encoding_gbk_isupper_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_gbk_char_width(b, n) == 1) {
- return yp_encoding_ascii_isupper_char(b, n);
+pm_encoding_gbk_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_gbk_char_width(b, n) == 1) {
+ return pm_encoding_ascii_isupper_char(b, n);
} else {
return false;
}
}
-yp_encoding_t yp_encoding_gbk = {
+pm_encoding_t pm_encoding_gbk = {
.name = "gbk",
- .char_width = yp_encoding_gbk_char_width,
- .alnum_char = yp_encoding_gbk_alnum_char,
- .alpha_char = yp_encoding_gbk_alpha_char,
- .isupper_char = yp_encoding_gbk_isupper_char,
+ .char_width = pm_encoding_gbk_char_width,
+ .alnum_char = pm_encoding_gbk_alnum_char,
+ .alpha_char = pm_encoding_gbk_alpha_char,
+ .isupper_char = pm_encoding_gbk_isupper_char,
.multibyte = true
};
diff --git a/prism/enc/pm_shift_jis.c b/prism/enc/pm_shift_jis.c
index e6ca10d1fd..3c93937efc 100644
--- a/prism/enc/pm_shift_jis.c
+++ b/prism/enc/pm_shift_jis.c
@@ -1,7 +1,7 @@
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
static size_t
-yp_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
// These are the single byte characters.
if (*b < 0x80 || (*b >= 0xA1 && *b <= 0xDF)) {
return 1;
@@ -20,37 +20,37 @@ yp_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
}
static size_t
-yp_encoding_shift_jis_alpha_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_shift_jis_char_width(b, n) == 1) {
- return yp_encoding_ascii_alpha_char(b, n);
+pm_encoding_shift_jis_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_shift_jis_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alpha_char(b, n);
} else {
return 0;
}
}
static size_t
-yp_encoding_shift_jis_alnum_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_shift_jis_char_width(b, n) == 1) {
- return yp_encoding_ascii_alnum_char(b, n);
+pm_encoding_shift_jis_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_shift_jis_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alnum_char(b, n);
} else {
return 0;
}
}
static bool
-yp_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_shift_jis_char_width(b, n) == 1) {
- return yp_encoding_ascii_isupper_char(b, n);
+pm_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_shift_jis_char_width(b, n) == 1) {
+ return pm_encoding_ascii_isupper_char(b, n);
} else {
return 0;
}
}
-yp_encoding_t yp_encoding_shift_jis = {
+pm_encoding_t pm_encoding_shift_jis = {
.name = "shift_jis",
- .char_width = yp_encoding_shift_jis_char_width,
- .alnum_char = yp_encoding_shift_jis_alnum_char,
- .alpha_char = yp_encoding_shift_jis_alpha_char,
- .isupper_char = yp_encoding_shift_jis_isupper_char,
+ .char_width = pm_encoding_shift_jis_char_width,
+ .alnum_char = pm_encoding_shift_jis_alnum_char,
+ .alpha_char = pm_encoding_shift_jis_alpha_char,
+ .isupper_char = pm_encoding_shift_jis_isupper_char,
.multibyte = true
};
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
diff --git a/prism/enc/pm_unicode.c b/prism/enc/pm_unicode.c
index 196955d483..ab10044424 100644
--- a/prism/enc/pm_unicode.c
+++ b/prism/enc/pm_unicode.c
@@ -1,16 +1,16 @@
// Note that the UTF-8 decoding code is based on Bjoern Hoehrmann's UTF-8 DFA
// decoder. See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
-typedef uint32_t yp_unicode_codepoint_t;
+typedef uint32_t pm_unicode_codepoint_t;
// Each element of the following table contains a bitfield that indicates a
// piece of information about the corresponding unicode codepoint. Note that
// this table is different from other encodings where we used a lookup table
// because the indices of those tables are the byte representations, not the
// codepoints themselves.
-const uint8_t yp_encoding_unicode_table[256] = {
+const uint8_t pm_encoding_unicode_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
@@ -31,7 +31,7 @@ const uint8_t yp_encoding_unicode_table[256] = {
};
#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
-static const yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
+static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
0x100, 0x2C1,
0x2C6, 0x2D1,
0x2E0, 0x2E4,
@@ -760,7 +760,7 @@ static const yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP
};
#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528
-static const yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
+static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
0x100, 0x2C1,
0x2C6, 0x2D1,
0x2E0, 0x2E4,
@@ -1528,7 +1528,7 @@ static const yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP
};
#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1296
-static const yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
+static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
0x100, 0x100,
0x102, 0x102,
0x104, 0x104,
@@ -2180,7 +2180,7 @@ static const yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_C
};
static bool
-yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, const yp_unicode_codepoint_t *codepoints, size_t size) {
+pm_unicode_codepoint_match(pm_unicode_codepoint_t codepoint, const pm_unicode_codepoint_t *codepoints, size_t size) {
size_t start = 0;
size_t end = size;
@@ -2202,7 +2202,7 @@ yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, const yp_unicode_co
return false;
}
-static const uint8_t yp_utf_8_dfa[] = {
+static const uint8_t pm_utf_8_dfa[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f
@@ -2219,8 +2219,8 @@ static const uint8_t yp_utf_8_dfa[] = {
1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8
};
-static yp_unicode_codepoint_t
-yp_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
+static pm_unicode_codepoint_t
+pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
assert(n >= 1);
size_t maximum = (size_t) n;
@@ -2229,16 +2229,16 @@ yp_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
for (size_t index = 0; index < 4 && index < maximum; index++) {
uint32_t byte = b[index];
- uint32_t type = yp_utf_8_dfa[byte];
+ uint32_t type = pm_utf_8_dfa[byte];
codepoint = (state != 0) ?
(byte & 0x3fu) | (codepoint << 6) :
(0xffu >> type) & (byte);
- state = yp_utf_8_dfa[256 + (state * 16) + type];
+ state = pm_utf_8_dfa[256 + (state * 16) + type];
if (!state) {
*width = index + 1;
- return (yp_unicode_codepoint_t) codepoint;
+ return (pm_unicode_codepoint_t) codepoint;
}
}
@@ -2247,57 +2247,57 @@ yp_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
}
static size_t
-yp_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
size_t width;
- yp_utf_8_codepoint(b, n, &width);
+ pm_utf_8_codepoint(b, n, &width);
return width;
}
size_t
-yp_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
if (*b < 0x80) {
- return (yp_encoding_unicode_table[*b] & YP_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0;
}
size_t width;
- yp_unicode_codepoint_t codepoint = yp_utf_8_codepoint(b, n, &width);
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
if (codepoint <= 0xFF) {
- return (yp_encoding_unicode_table[(uint8_t) codepoint] & YP_ENCODING_ALPHABETIC_BIT) ? width : 0;
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
} else {
- return yp_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
+ return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
}
}
size_t
-yp_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
if (*b < 0x80) {
- return (yp_encoding_unicode_table[*b] & (YP_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
+ return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0;
}
size_t width;
- yp_unicode_codepoint_t codepoint = yp_utf_8_codepoint(b, n, &width);
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
if (codepoint <= 0xFF) {
- return (yp_encoding_unicode_table[(uint8_t) codepoint] & (YP_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
} else {
- return yp_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
+ return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
}
}
static bool
-yp_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
if (*b < 0x80) {
- return (yp_encoding_unicode_table[*b] & YP_ENCODING_UPPERCASE_BIT) ? true : false;
+ return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
}
size_t width;
- yp_unicode_codepoint_t codepoint = yp_utf_8_codepoint(b, n, &width);
+ pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
if (codepoint <= 0xFF) {
- return (yp_encoding_unicode_table[(uint8_t) codepoint] & YP_ENCODING_UPPERCASE_BIT) ? true : false;
+ return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
} else {
- return yp_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
+ return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
}
}
@@ -2305,20 +2305,20 @@ yp_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
#undef UNICODE_ALNUM_CODEPOINTS_LENGTH
#undef UNICODE_ISUPPER_CODEPOINTS_LENGTH
-yp_encoding_t yp_encoding_utf_8 = {
+pm_encoding_t pm_encoding_utf_8 = {
.name = "utf-8",
- .char_width = yp_encoding_utf_8_char_width,
- .alnum_char = yp_encoding_utf_8_alnum_char,
- .alpha_char = yp_encoding_utf_8_alpha_char,
- .isupper_char = yp_encoding_utf_8_isupper_char,
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
.multibyte = true
};
-yp_encoding_t yp_encoding_utf8_mac = {
+pm_encoding_t pm_encoding_utf8_mac = {
.name = "utf8-mac",
- .char_width = yp_encoding_utf_8_char_width,
- .alnum_char = yp_encoding_utf_8_alnum_char,
- .alpha_char = yp_encoding_utf_8_alpha_char,
- .isupper_char = yp_encoding_utf_8_isupper_char,
+ .char_width = pm_encoding_utf_8_char_width,
+ .alnum_char = pm_encoding_utf_8_alnum_char,
+ .alpha_char = pm_encoding_utf_8_alpha_char,
+ .isupper_char = pm_encoding_utf_8_isupper_char,
.multibyte = true
};
diff --git a/prism/enc/pm_windows_31j.c b/prism/enc/pm_windows_31j.c
index 0d34639535..cf7eb46864 100644
--- a/prism/enc/pm_windows_31j.c
+++ b/prism/enc/pm_windows_31j.c
@@ -1,7 +1,7 @@
-#include "yarp/enc/yp_encoding.h"
+#include "prism/enc/pm_encoding.h"
static size_t
-yp_encoding_windows_31j_char_width(const uint8_t *b, ptrdiff_t n) {
+pm_encoding_windows_31j_char_width(const uint8_t *b, ptrdiff_t n) {
// These are the single byte characters.
if (*b < 0x80 || (*b >= 0xA1 && *b <= 0xDF)) {
return 1;
@@ -20,37 +20,37 @@ yp_encoding_windows_31j_char_width(const uint8_t *b, ptrdiff_t n) {
}
static size_t
-yp_encoding_windows_31j_alpha_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_windows_31j_char_width(b, n) == 1) {
- return yp_encoding_ascii_alpha_char(b, n);
+pm_encoding_windows_31j_alpha_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_windows_31j_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alpha_char(b, n);
} else {
return 0;
}
}
static size_t
-yp_encoding_windows_31j_alnum_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_windows_31j_char_width(b, n) == 1) {
- return yp_encoding_ascii_alnum_char(b, n);
+pm_encoding_windows_31j_alnum_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_windows_31j_char_width(b, n) == 1) {
+ return pm_encoding_ascii_alnum_char(b, n);
} else {
return 0;
}
}
static bool
-yp_encoding_windows_31j_isupper_char(const uint8_t *b, ptrdiff_t n) {
- if (yp_encoding_windows_31j_char_width(b, n) == 1) {
- return yp_encoding_ascii_isupper_char(b, n);
+pm_encoding_windows_31j_isupper_char(const uint8_t *b, ptrdiff_t n) {
+ if (pm_encoding_windows_31j_char_width(b, n) == 1) {
+ return pm_encoding_ascii_isupper_char(b, n);
} else {
return false;
}
}
-yp_encoding_t yp_encoding_windows_31j = {
+pm_encoding_t pm_encoding_windows_31j = {
.name = "windows-31j",
- .char_width = yp_encoding_windows_31j_char_width,
- .alnum_char = yp_encoding_windows_31j_alnum_char,
- .alpha_char = yp_encoding_windows_31j_alpha_char,
- .isupper_char = yp_encoding_windows_31j_isupper_char,
+ .char_width = pm_encoding_windows_31j_char_width,
+ .alnum_char = pm_encoding_windows_31j_alnum_char,
+ .alpha_char = pm_encoding_windows_31j_alpha_char,
+ .isupper_char = pm_encoding_windows_31j_isupper_char,
.multibyte = true
};