mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
Refactored additional constants.
This commit is contained in:
parent
aca2589061
commit
6ebfea6730
@ -222,15 +222,15 @@ static nc_utf8proc_ssize_t nc_unsafe_encode_char(nc_utf8proc_int32_t uc, nc_utf8
|
||||
/* internal "unsafe" version that does not check whether uc is in range */
|
||||
static const nc_utf8proc_property_t *nc_unsafe_get_property(nc_utf8proc_int32_t uc) {
|
||||
/* ASSERT: uc >= 0 && uc < 0x110000 */
|
||||
return utf8proc_properties + (
|
||||
utf8proc_stage2table[
|
||||
utf8proc_stage1table[uc >> 8] + (uc & 0xFF)
|
||||
return nc_utf8proc_properties + (
|
||||
nc_utf8proc_stage2table[
|
||||
nc_utf8proc_stage1table[uc >> 8] + (uc & 0xFF)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
const nc_utf8proc_property_t *nc_utf8proc_get_property(nc_utf8proc_int32_t uc) {
|
||||
return uc < 0 || uc >= 0x110000 ? utf8proc_properties : nc_unsafe_get_property(uc);
|
||||
return uc < 0 || uc >= 0x110000 ? nc_utf8proc_properties : nc_unsafe_get_property(uc);
|
||||
}
|
||||
|
||||
/* return whether there is a grapheme break between boundclasses lbc and tbc
|
||||
@ -335,13 +335,13 @@ static nc_utf8proc_int32_t nc_seqindex_decode_entry(const nc_utf8proc_uint16_t *
|
||||
|
||||
static nc_utf8proc_int32_t nc_seqindex_decode_index(const nc_utf8proc_uint32_t seqindex)
|
||||
{
|
||||
const nc_utf8proc_uint16_t *entry = &utf8proc_sequences[seqindex];
|
||||
const nc_utf8proc_uint16_t *entry = &nc_utf8proc_sequences[seqindex];
|
||||
return nc_seqindex_decode_entry(&entry);
|
||||
}
|
||||
|
||||
static nc_utf8proc_ssize_t nc_seqindex_write_char_decomposed(nc_utf8proc_uint16_t seqindex, nc_utf8proc_int32_t *dst, nc_utf8proc_ssize_t bufsize, nc_utf8proc_option_t options, int *last_boundclass) {
|
||||
nc_utf8proc_ssize_t written = 0;
|
||||
const nc_utf8proc_uint16_t *entry = &utf8proc_sequences[seqindex & 0x1FFF];
|
||||
const nc_utf8proc_uint16_t *entry = &nc_utf8proc_sequences[seqindex & 0x1FFF];
|
||||
int len = seqindex >> 13;
|
||||
if (len >= 7) {
|
||||
len = *entry;
|
||||
@ -632,13 +632,13 @@ static nc_utf8proc_ssize_t nc_seqindex_write_char_decomposed(nc_utf8proc_uint16_
|
||||
current_property->comb_index != UINT16_MAX &&
|
||||
current_property->comb_index >= 0x8000) {
|
||||
int sidx = starter_property->comb_index;
|
||||
int idx = (current_property->comb_index & 0x3FFF) - utf8proc_combinations[sidx];
|
||||
if (idx >= 0 && idx <= utf8proc_combinations[sidx + 1] ) {
|
||||
int idx = (current_property->comb_index & 0x3FFF) - nc_utf8proc_combinations[sidx];
|
||||
if (idx >= 0 && idx <= nc_utf8proc_combinations[sidx + 1] ) {
|
||||
idx += sidx + 2;
|
||||
if (current_property->comb_index & 0x4000) {
|
||||
composition = (utf8proc_combinations[idx] << 16) | utf8proc_combinations[idx+1];
|
||||
composition = (nc_utf8proc_combinations[idx] << 16) | nc_utf8proc_combinations[idx+1];
|
||||
} else
|
||||
composition = utf8proc_combinations[idx];
|
||||
composition = nc_utf8proc_combinations[idx];
|
||||
|
||||
if (composition > 0 && (!(options & UTF8PROC_STABLE) ||
|
||||
!(nc_unsafe_get_property(composition)->comp_exclusion))) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const nc_utf8proc_uint16_t utf8proc_sequences[] = {
|
||||
const nc_utf8proc_uint16_t nc_utf8proc_sequences[] = {
|
||||
97, 98, 99, 100, 101, 102, 103,
|
||||
104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119,
|
||||
@ -1176,7 +1176,7 @@ const nc_utf8proc_uint16_t utf8proc_sequences[] = {
|
||||
56603, 55354, 56604, 55354, 56605, 55354, 56606, 55354,
|
||||
56607, 55354, 56608, 55354, 56609, };
|
||||
|
||||
const nc_utf8proc_uint16_t utf8proc_stage1table[] = {
|
||||
const nc_utf8proc_uint16_t nc_utf8proc_stage1table[] = {
|
||||
0, 256, 512, 768, 1024, 1280, 1536,
|
||||
1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584,
|
||||
3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632,
|
||||
@ -1723,7 +1723,7 @@ const nc_utf8proc_uint16_t utf8proc_stage1table[] = {
|
||||
18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432,
|
||||
38656, };
|
||||
|
||||
const nc_utf8proc_uint16_t utf8proc_stage2table[] = {
|
||||
const nc_utf8proc_uint16_t nc_utf8proc_stage2table[] = {
|
||||
1, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 3, 4, 3, 5, 6, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -6590,7 +6590,7 @@ const nc_utf8proc_uint16_t utf8proc_stage2table[] = {
|
||||
3984, 3984, 3984, 3984, 3984, 3984, 3984, 0,
|
||||
0, };
|
||||
|
||||
const nc_utf8proc_property_t utf8proc_properties[] = {
|
||||
const nc_utf8proc_property_t nc_utf8proc_properties[] = {
|
||||
{0, 0, 0, 0, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, false,false,false,false, 0, 0, UTF8PROC_BOUNDCLASS_OTHER},
|
||||
{UTF8PROC_CATEGORY_CC, 0, UTF8PROC_BIDI_CLASS_BN, 0, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, false, true, false, true, 0, 0, UTF8PROC_BOUNDCLASS_CONTROL},
|
||||
{UTF8PROC_CATEGORY_CC, 0, UTF8PROC_BIDI_CLASS_BN, 0, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, false, false, false, true, 0, 0, UTF8PROC_BOUNDCLASS_CONTROL},
|
||||
@ -13420,7 +13420,7 @@ const nc_utf8proc_property_t utf8proc_properties[] = {
|
||||
{UTF8PROC_CATEGORY_LO, 0, UTF8PROC_BIDI_CLASS_L, 0, 7975, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, false, false, false, false, 2, 0, UTF8PROC_BOUNDCLASS_OTHER},
|
||||
};
|
||||
|
||||
const nc_utf8proc_uint16_t utf8proc_combinations[] = {
|
||||
const nc_utf8proc_uint16_t nc_utf8proc_combinations[] = {
|
||||
0, 46, 192, 193, 194, 195, 196, 197, 0,
|
||||
256, 258, 260, 550, 461, 0, 0, 512,
|
||||
514, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user