mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 03:07:36 +02:00
Improve naming
This commit is contained in:
@ -229,25 +229,25 @@ template <typename OutputIt> OutputIt write_delimiter(OutputIt out) {
|
|||||||
|
|
||||||
struct singleton {
|
struct singleton {
|
||||||
unsigned char upper;
|
unsigned char upper;
|
||||||
unsigned char lowercount;
|
unsigned char lower_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline auto check(uint16_t x, const singleton* singletonuppers,
|
inline auto check(uint16_t x, const singleton* singleton_uppers,
|
||||||
size_t singletonuppers_size,
|
size_t singleton_uppers_size,
|
||||||
const unsigned char* singletonlowers,
|
const unsigned char* singleton_lowers,
|
||||||
const unsigned char* normal, size_t normal_size) -> bool {
|
const unsigned char* normal, size_t normal_size) -> bool {
|
||||||
auto xupper = x >> 8;
|
auto upper = x >> 8;
|
||||||
auto lowerstart = 0;
|
auto lower_start = 0;
|
||||||
for (size_t i = 0; i < singletonuppers_size; ++i) {
|
for (size_t i = 0; i < singleton_uppers_size; ++i) {
|
||||||
auto su = singletonuppers[i];
|
auto su = singleton_uppers[i];
|
||||||
auto lowerend = lowerstart + su.lowercount;
|
auto lower_end = lower_start + su.lower_count;
|
||||||
if (xupper < su.upper) break;
|
if (upper < su.upper) break;
|
||||||
if (xupper == su.upper) {
|
if (upper == su.upper) {
|
||||||
for (auto j = lowerstart; j < lowerend; ++j) {
|
for (auto j = lower_start; j < lower_end; ++j) {
|
||||||
if (singletonlowers[j] == (x & 0xff)) return false;
|
if (singleton_lowers[j] == (x & 0xff)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lowerstart = lowerend;
|
lower_start = lower_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto xsigned = static_cast<int>(x);
|
auto xsigned = static_cast<int>(x);
|
||||||
@ -265,7 +265,7 @@ inline auto check(uint16_t x, const singleton* singletonuppers,
|
|||||||
// Returns true iff the code point cp is printable.
|
// Returns true iff the code point cp is printable.
|
||||||
// This code is generated by support/printable.py.
|
// This code is generated by support/printable.py.
|
||||||
inline auto is_printable(uint32_t cp) -> bool {
|
inline auto is_printable(uint32_t cp) -> bool {
|
||||||
static constexpr singleton singletons0u[] = {
|
static constexpr singleton singletons0_upper[] = {
|
||||||
{0x00, 1}, {0x03, 5}, {0x05, 6}, {0x06, 3}, {0x07, 6}, {0x08, 8},
|
{0x00, 1}, {0x03, 5}, {0x05, 6}, {0x06, 3}, {0x07, 6}, {0x08, 8},
|
||||||
{0x09, 17}, {0x0a, 28}, {0x0b, 25}, {0x0c, 20}, {0x0d, 16}, {0x0e, 13},
|
{0x09, 17}, {0x0a, 28}, {0x0b, 25}, {0x0c, 20}, {0x0d, 16}, {0x0e, 13},
|
||||||
{0x0f, 4}, {0x10, 3}, {0x12, 18}, {0x13, 9}, {0x16, 1}, {0x17, 5},
|
{0x0f, 4}, {0x10, 3}, {0x12, 18}, {0x13, 9}, {0x16, 1}, {0x17, 5},
|
||||||
@ -274,7 +274,7 @@ inline auto is_printable(uint32_t cp) -> bool {
|
|||||||
{0x31, 2}, {0x32, 1}, {0xa7, 2}, {0xa9, 2}, {0xaa, 4}, {0xab, 8},
|
{0x31, 2}, {0x32, 1}, {0xa7, 2}, {0xa9, 2}, {0xaa, 4}, {0xab, 8},
|
||||||
{0xfa, 2}, {0xfb, 5}, {0xfd, 4}, {0xfe, 3}, {0xff, 9},
|
{0xfa, 2}, {0xfb, 5}, {0xfd, 4}, {0xfe, 3}, {0xff, 9},
|
||||||
};
|
};
|
||||||
static constexpr unsigned char singletons0l[] = {
|
static constexpr unsigned char singletons0_lower[] = {
|
||||||
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90,
|
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90,
|
||||||
0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
|
0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
|
||||||
0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e, 0x91, 0x92, 0xa9, 0xb1,
|
0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e, 0x91, 0x92, 0xa9, 0xb1,
|
||||||
@ -301,7 +301,7 @@ inline auto is_printable(uint32_t cp) -> bool {
|
|||||||
0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7,
|
0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7,
|
||||||
0xfe, 0xff,
|
0xfe, 0xff,
|
||||||
};
|
};
|
||||||
static constexpr singleton singletons1u[] = {
|
static constexpr singleton singletons1_upper[] = {
|
||||||
{0x00, 6}, {0x01, 1}, {0x03, 1}, {0x04, 2}, {0x08, 8}, {0x09, 2},
|
{0x00, 6}, {0x01, 1}, {0x03, 1}, {0x04, 2}, {0x08, 8}, {0x09, 2},
|
||||||
{0x0a, 5}, {0x0b, 2}, {0x0e, 4}, {0x10, 1}, {0x11, 2}, {0x12, 5},
|
{0x0a, 5}, {0x0b, 2}, {0x0e, 4}, {0x10, 1}, {0x11, 2}, {0x12, 5},
|
||||||
{0x13, 17}, {0x14, 1}, {0x15, 2}, {0x17, 2}, {0x19, 13}, {0x1c, 5},
|
{0x13, 17}, {0x14, 1}, {0x15, 2}, {0x17, 2}, {0x19, 13}, {0x1c, 5},
|
||||||
@ -310,7 +310,7 @@ inline auto is_printable(uint32_t cp) -> bool {
|
|||||||
{0xe1, 2}, {0xe8, 2}, {0xee, 32}, {0xf0, 4}, {0xf8, 2}, {0xf9, 2},
|
{0xe1, 2}, {0xe8, 2}, {0xee, 32}, {0xf0, 4}, {0xf8, 2}, {0xf9, 2},
|
||||||
{0xfa, 2}, {0xfb, 1},
|
{0xfa, 2}, {0xfb, 1},
|
||||||
};
|
};
|
||||||
static constexpr unsigned char singletons1l[] = {
|
static constexpr unsigned char singletons1_lower[] = {
|
||||||
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07,
|
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07,
|
||||||
0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
|
0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
|
||||||
0x37, 0x56, 0x57, 0x7f, 0xaa, 0xae, 0xaf, 0xbd, 0x35, 0xe0, 0x12, 0x87,
|
0x37, 0x56, 0x57, 0x7f, 0xaa, 0xae, 0xaf, 0xbd, 0x35, 0xe0, 0x12, 0x87,
|
||||||
@ -394,14 +394,14 @@ inline auto is_printable(uint32_t cp) -> bool {
|
|||||||
};
|
};
|
||||||
auto lower = static_cast<uint16_t>(cp);
|
auto lower = static_cast<uint16_t>(cp);
|
||||||
if (cp < 0x10000) {
|
if (cp < 0x10000) {
|
||||||
return check(lower, singletons0u,
|
return check(lower, singletons0_upper,
|
||||||
sizeof(singletons0u) / sizeof(*singletons0u), singletons0l,
|
sizeof(singletons0_upper) / sizeof(*singletons0_upper),
|
||||||
normal0, sizeof(normal0));
|
singletons0_lower, normal0, sizeof(normal0));
|
||||||
}
|
}
|
||||||
if (cp < 0x20000) {
|
if (cp < 0x20000) {
|
||||||
return check(lower, singletons1u,
|
return check(lower, singletons1_upper,
|
||||||
sizeof(singletons1u) / sizeof(*singletons1u), singletons1l,
|
sizeof(singletons1_upper) / sizeof(*singletons1_upper),
|
||||||
normal1, sizeof(normal1));
|
singletons1_lower, normal1, sizeof(normal1));
|
||||||
}
|
}
|
||||||
if (0x2a6de <= cp && cp < 0x2a700) return false;
|
if (0x2a6de <= cp && cp < 0x2a700) return false;
|
||||||
if (0x2b735 <= cp && cp < 0x2b740) return false;
|
if (0x2b735 <= cp && cp < 0x2b740) return false;
|
||||||
|
@ -173,21 +173,21 @@ def main():
|
|||||||
print("""\
|
print("""\
|
||||||
inline auto is_printable(uint32_t cp) -> bool {\
|
inline auto is_printable(uint32_t cp) -> bool {\
|
||||||
""")
|
""")
|
||||||
print_singletons(singletons0u, singletons0l, 'singletons0u', 'singletons0l')
|
print_singletons(singletons0u, singletons0l, 'singletons0_upper', 'singletons0_lower')
|
||||||
print_singletons(singletons1u, singletons1l, 'singletons1u', 'singletons1l')
|
print_singletons(singletons1u, singletons1l, 'singletons1_upper', 'singletons1_lower')
|
||||||
print_normal(normal0, 'normal0')
|
print_normal(normal0, 'normal0')
|
||||||
print_normal(normal1, 'normal1')
|
print_normal(normal1, 'normal1')
|
||||||
print("""\
|
print("""\
|
||||||
auto lower = static_cast<uint16_t>(cp);
|
auto lower = static_cast<uint16_t>(cp);
|
||||||
if (cp < 0x10000) {
|
if (cp < 0x10000) {
|
||||||
return check(lower, singletons0u,
|
return check(lower, singletons0_upper,
|
||||||
sizeof(singletons0u) / sizeof(*singletons0u), singletons0l,
|
sizeof(singletons0_upper) / sizeof(*singletons0_upper),
|
||||||
normal0, sizeof(normal0));
|
singletons0_lower, normal0, sizeof(normal0));
|
||||||
}
|
}
|
||||||
if (cp < 0x20000) {
|
if (cp < 0x20000) {
|
||||||
return check(lower, singletons1u,
|
return check(lower, singletons1_upper,
|
||||||
sizeof(singletons1u) / sizeof(*singletons1u), singletons1l,
|
sizeof(singletons1_upper) / sizeof(*singletons1_upper),
|
||||||
normal1, sizeof(normal1));
|
singletons1_lower, normal1, sizeof(normal1));
|
||||||
}\
|
}\
|
||||||
""")
|
""")
|
||||||
for a, b in extra:
|
for a, b in extra:
|
||||||
|
Reference in New Issue
Block a user