mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Make improvements
- wcsstr() is now linearly complex - strstr16() is now linearly complex - strstr() is now vectorized on aarch64 (10x) - strstr() now uses KMP on pathological cases - memmem() is now vectorized on aarch64 (10x) - memmem() now uses KMP on pathological cases - Disable shared_ptr::owner_before until fixed - Make iswlower(), iswupper() consistent with glibc - Remove figure space from iswspace() implementation - Include line and paragraph separator in iswcntrl() - Use Musl wcwidth(), iswalpha(), iswpunct(), towlower(), towupper()
This commit is contained in:
parent
e1528a71e2
commit
7c83f4abc8
67 changed files with 5602 additions and 5165 deletions
|
@ -335,6 +335,7 @@ class shared_ptr
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // TODO(mrdomino): find a different way
|
||||||
template<typename U>
|
template<typename U>
|
||||||
bool owner_before(const shared_ptr<U>& r) const noexcept
|
bool owner_before(const shared_ptr<U>& r) const noexcept
|
||||||
{
|
{
|
||||||
|
@ -346,6 +347,7 @@ class shared_ptr
|
||||||
{
|
{
|
||||||
return !r.owner_before(*this);
|
return !r.owner_before(*this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename U>
|
template<typename U>
|
||||||
|
|
|
@ -40,7 +40,7 @@ LIBC_FMT_A_DIRECTDEPS = \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
THIRD_PARTY_COMPILER_RT
|
THIRD_PARTY_COMPILER_RT \
|
||||||
|
|
||||||
LIBC_FMT_A_DEPS := \
|
LIBC_FMT_A_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(LIBC_FMT_A_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(LIBC_FMT_A_DIRECTDEPS),$($(x))))
|
||||||
|
|
|
@ -16,15 +16,23 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/thread/thread.h"
|
#ifdef _MSC_VER
|
||||||
|
#include <intrin.h>
|
||||||
|
#else
|
||||||
|
#include <xmmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Yields hyperthread.
|
* Yields hyperthread.
|
||||||
*/
|
*/
|
||||||
void pthread_pause_np(void) {
|
void pthread_pause_np(void) {
|
||||||
#if defined(__GNUC__) && defined(__aarch64__)
|
#if defined(__GNUC__) && defined(__aarch64__)
|
||||||
__asm__ volatile("yield");
|
__asm__("yield");
|
||||||
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
|
#elif defined(__x86_64__) || defined(__i386__)
|
||||||
__asm__ volatile("pause");
|
_mm_pause();
|
||||||
|
#elif defined(__GNUC__) && (defined(__PPC__) || defined(__PPC64__))
|
||||||
|
__asm__("or 27,27,27");
|
||||||
|
#else
|
||||||
|
// do nothing
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,6 @@ COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
void *bsearch(const void *, const void *, size_t, size_t,
|
void *bsearch(const void *, const void *, size_t, size_t,
|
||||||
int (*)(const void *, const void *)) paramsnonnull() nosideeffect;
|
int (*)(const void *, const void *)) paramsnonnull() nosideeffect;
|
||||||
void *bsearch_r(const void *, const void *, size_t, size_t,
|
|
||||||
int (*)(const void *, const void *, void *), void *)
|
|
||||||
paramsnonnull((1, 2, 5)) nosideeffect;
|
|
||||||
void qsort3(void *, size_t, size_t, int (*)(const void *, const void *))
|
void qsort3(void *, size_t, size_t, int (*)(const void *, const void *))
|
||||||
paramsnonnull();
|
paramsnonnull();
|
||||||
void qsort(void *, size_t, size_t, int (*)(const void *, const void *))
|
void qsort(void *, size_t, size_t, int (*)(const void *, const void *))
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ALG_BISECT_H_
|
|
||||||
#define COSMOPOLITAN_LIBC_ALG_BISECT_H_
|
|
||||||
COSMOPOLITAN_C_START_
|
|
||||||
|
|
||||||
forceinline void *bisect(const void *k, const void *data, size_t n, size_t size,
|
|
||||||
int cmp(const void *a, const void *b, void *arg),
|
|
||||||
void *arg) {
|
|
||||||
int c;
|
|
||||||
const char *p;
|
|
||||||
ssize_t m, l, r;
|
|
||||||
if (n) {
|
|
||||||
l = 0;
|
|
||||||
r = n - 1;
|
|
||||||
p = data;
|
|
||||||
while (l <= r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1);
|
|
||||||
c = cmp(k, p + m * size, arg);
|
|
||||||
if (c > 0) {
|
|
||||||
l = m + 1;
|
|
||||||
} else if (c < 0) {
|
|
||||||
r = m - 1;
|
|
||||||
} else {
|
|
||||||
return (char *)p + m * size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_ALG_BISECT_H_ */
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/mem/alg.h"
|
|
||||||
#include "libc/mem/bisect.internal.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Searches sorted array for exact item in logarithmic time.
|
|
||||||
* @see bsearch()
|
|
||||||
*/
|
|
||||||
void *bsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
|
|
||||||
int cmp(const void *a, const void *b, void *arg), void *arg) {
|
|
||||||
return bisect(key, base, nmemb, size, cmp, arg);
|
|
||||||
}
|
|
|
@ -71,8 +71,6 @@ o/$(MODE)/libc/nexgen32e/ksha512.o: libc/nexgen32e/ksha512.S
|
||||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||||
o/$(MODE)/libc/nexgen32e/kcp437.o: libc/nexgen32e/kcp437.S
|
o/$(MODE)/libc/nexgen32e/kcp437.o: libc/nexgen32e/kcp437.S
|
||||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||||
o/$(MODE)/libc/nexgen32e/kreversebits.o: libc/nexgen32e/kreversebits.S
|
|
||||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
|
||||||
o/$(MODE)/libc/nexgen32e/ktensindex.o: libc/nexgen32e/ktensindex.S
|
o/$(MODE)/libc/nexgen32e/ktensindex.o: libc/nexgen32e/ktensindex.S
|
||||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||||
o/$(MODE)/libc/nexgen32e/longjmp.o: libc/nexgen32e/longjmp.S
|
o/$(MODE)/libc/nexgen32e/longjmp.o: libc/nexgen32e/longjmp.S
|
||||||
|
|
|
@ -65,7 +65,6 @@ struct X86ProcessorModel {
|
||||||
unsigned char grade;
|
unsigned char grade;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const size_t kX86ProcessorModelCount;
|
|
||||||
extern const struct X86ProcessorModel kX86ProcessorModels[];
|
extern const struct X86ProcessorModel kX86ProcessorModels[];
|
||||||
|
|
||||||
const struct X86ProcessorModel *getx86processormodel(short) nosideeffect;
|
const struct X86ProcessorModel *getx86processormodel(short) nosideeffect;
|
||||||
|
|
|
@ -33,24 +33,22 @@ privileged int __get_symbol(struct SymbolTable *t, intptr_t a) {
|
||||||
// we don't want function tracing because:
|
// we don't want function tracing because:
|
||||||
// function tracing depends on this function via kprintf
|
// function tracing depends on this function via kprintf
|
||||||
unsigned l, m, r, n, k;
|
unsigned l, m, r, n, k;
|
||||||
if (!t && __symtab) {
|
if (!t && __symtab)
|
||||||
t = __symtab;
|
t = __symtab;
|
||||||
}
|
|
||||||
if (t) {
|
if (t) {
|
||||||
l = 0;
|
l = 0;
|
||||||
r = n = t->count;
|
r = n = t->count;
|
||||||
k = a - t->addr_base;
|
k = a - t->addr_base;
|
||||||
while (l < r) {
|
while (l < r) {
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
||||||
if (t->symbols[m].y < k) {
|
if (k < t->symbols[m].x) {
|
||||||
|
r = m;
|
||||||
|
} else if (k > t->symbols[m].y) {
|
||||||
l = m + 1;
|
l = m + 1;
|
||||||
} else {
|
} else {
|
||||||
r = m;
|
return m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l < n && t->symbols[l].x <= k && k <= t->symbols[l].y) {
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,19 @@ LIBC_STR_A_INCS = $(filter %.inc,$(LIBC_STR_A_FILES))
|
||||||
LIBC_STR_A_SRCS_A = $(filter %.s,$(LIBC_STR_A_FILES))
|
LIBC_STR_A_SRCS_A = $(filter %.s,$(LIBC_STR_A_FILES))
|
||||||
LIBC_STR_A_SRCS_S = $(filter %.S,$(LIBC_STR_A_FILES))
|
LIBC_STR_A_SRCS_S = $(filter %.S,$(LIBC_STR_A_FILES))
|
||||||
LIBC_STR_A_SRCS_C = $(filter %.c,$(LIBC_STR_A_FILES))
|
LIBC_STR_A_SRCS_C = $(filter %.c,$(LIBC_STR_A_FILES))
|
||||||
|
LIBC_STR_A_SRCS_CC = $(filter %.cc,$(LIBC_STR_A_FILES))
|
||||||
|
|
||||||
LIBC_STR_A_SRCS = \
|
LIBC_STR_A_SRCS = \
|
||||||
$(LIBC_STR_A_SRCS_A) \
|
$(LIBC_STR_A_SRCS_A) \
|
||||||
$(LIBC_STR_A_SRCS_S) \
|
$(LIBC_STR_A_SRCS_S) \
|
||||||
$(LIBC_STR_A_SRCS_C)
|
$(LIBC_STR_A_SRCS_C) \
|
||||||
|
$(LIBC_STR_A_SRCS_CC)
|
||||||
|
|
||||||
LIBC_STR_A_OBJS = \
|
LIBC_STR_A_OBJS = \
|
||||||
$(LIBC_STR_A_SRCS_A:%.s=o/$(MODE)/%.o) \
|
$(LIBC_STR_A_SRCS_A:%.s=o/$(MODE)/%.o) \
|
||||||
$(LIBC_STR_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
$(LIBC_STR_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||||
$(LIBC_STR_A_SRCS_C:%.c=o/$(MODE)/%.o)
|
$(LIBC_STR_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||||
|
$(LIBC_STR_A_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
||||||
|
|
||||||
LIBC_STR_A_CHECKS = \
|
LIBC_STR_A_CHECKS = \
|
||||||
$(LIBC_STR_A).pkg \
|
$(LIBC_STR_A).pkg \
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,6 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/mem/bisect.internal.h"
|
|
||||||
#include "libc/nexgen32e/x86info.h"
|
#include "libc/nexgen32e/x86info.h"
|
||||||
|
|
||||||
static int CmpX86ProcModelKey(const struct X86ProcessorModel *a,
|
static int CmpX86ProcModelKey(const struct X86ProcessorModel *a,
|
||||||
|
@ -32,7 +31,8 @@ static int CmpX86ProcModelKey(const struct X86ProcessorModel *a,
|
||||||
* @see https://a4lg.com/tech/x86/database/x86-families-and-models.en.html
|
* @see https://a4lg.com/tech/x86/database/x86-families-and-models.en.html
|
||||||
*/
|
*/
|
||||||
const struct X86ProcessorModel *getx86processormodel(short key) {
|
const struct X86ProcessorModel *getx86processormodel(short key) {
|
||||||
return bisect(&(struct X86ProcessorModel){key}, kX86ProcessorModels,
|
for (int i = 0; kX86ProcessorModels[i].key; ++i)
|
||||||
kX86ProcessorModelCount, sizeof(struct X86ProcessorModel),
|
if (kX86ProcessorModels[i].key == key)
|
||||||
(void *)CmpX86ProcModelKey, NULL);
|
return &kX86ProcessorModels[i];
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
24
libc/str/has_char.h
Normal file
24
libc/str/has_char.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// -*- c++ -*-
|
||||||
|
#ifndef COSMOPOLITAN_LIBC_STR_HAS_CHAR_H_
|
||||||
|
#define COSMOPOLITAN_LIBC_STR_HAS_CHAR_H_
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static bool has_char(const T (*ranges)[2], size_t n, T c) {
|
||||||
|
unsigned l = 0;
|
||||||
|
unsigned r = n;
|
||||||
|
while (l < r) {
|
||||||
|
unsigned m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
||||||
|
if (c < ranges[m][0]) {
|
||||||
|
r = m;
|
||||||
|
} else if (c > ranges[m][1]) {
|
||||||
|
l = m + 1;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif /* COSMOPOLITAN_LIBC_STR_HAS_CHAR_H_ */
|
|
@ -19,10 +19,15 @@
|
||||||
#include "libc/wctype.h"
|
#include "libc/wctype.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns nonzero if c is C0 or C1 control code.
|
* Returns nonzero if `c` is control code.
|
||||||
|
*
|
||||||
|
* This includes C0 or C1 control codes, in addition to the "LINE
|
||||||
|
* SEPARATOR" and "PARAGRAPH SEPARATOR" characters.
|
||||||
*/
|
*/
|
||||||
int iswcntrl(wint_t c) {
|
int iswcntrl(wint_t c) {
|
||||||
return (0x00 <= c && c <= 0x1F) || (0x7F <= c && c <= 0x9F);
|
return (0x0000 <= c && c <= 0x001F) || //
|
||||||
|
(0x007F <= c && c <= 0x009F) || //
|
||||||
|
(0x2028 <= c && c <= 0x2029);
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak_reference(iswcntrl, iswcntrl_l);
|
__weak_reference(iswcntrl, iswcntrl_l);
|
||||||
|
|
|
@ -1,520 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/wctype.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns nonzero if c is lowercase letter.
|
|
||||||
*/
|
|
||||||
int iswlower(wint_t c) {
|
|
||||||
if (c < 0200) {
|
|
||||||
return 'a' <= c && c <= 'z';
|
|
||||||
} else {
|
|
||||||
if (towupper(c) != c)
|
|
||||||
return 1;
|
|
||||||
switch (c) {
|
|
||||||
case 0x00df: /* ß Watin */
|
|
||||||
case 0x0138: /* ĸ Watin-A */
|
|
||||||
case 0x0149: /* ʼn Watin-A */
|
|
||||||
case 0x018d: /* ƍ Watin-B */
|
|
||||||
case 0x019b: /* ƛ Watin-B */
|
|
||||||
case 0x01aa: /* ƪ Watin-B */
|
|
||||||
case 0x01ab: /* ƫ Watin-B */
|
|
||||||
case 0x01ba: /* ƺ Watin-B */
|
|
||||||
case 0x01be: /* ƾ Watin-B */
|
|
||||||
case 0x01f0: /* ǰ Watin-B */
|
|
||||||
case 0x0221: /* ȡ Watin-B */
|
|
||||||
case 0x0234: /* ȴ Watin-B */
|
|
||||||
case 0x0235: /* ȵ Watin-B */
|
|
||||||
case 0x0236: /* ȶ Watin-B */
|
|
||||||
case 0x0237: /* ȷ Watin-B */
|
|
||||||
case 0x0238: /* ȸ Watin-B */
|
|
||||||
case 0x0239: /* ȹ Watin-B */
|
|
||||||
case 0x0255: /* ɕ IPA */
|
|
||||||
case 0x0258: /* ɘ IPA */
|
|
||||||
case 0x025a: /* ɚ IPA */
|
|
||||||
case 0x025d: /* ɝ IPA */
|
|
||||||
case 0x025e: /* ɞ IPA */
|
|
||||||
case 0x025f: /* ɟ IPA */
|
|
||||||
case 0x0262: /* ɢ IPA */
|
|
||||||
case 0x0264: /* ɤ IPA */
|
|
||||||
case 0x0267: /* ɧ IPA */
|
|
||||||
case 0x026d: /* ɭ IPA */
|
|
||||||
case 0x026e: /* ɮ IPA */
|
|
||||||
case 0x0270: /* ɰ IPA */
|
|
||||||
case 0x0273: /* ɳ IPA */
|
|
||||||
case 0x0274: /* ɴ IPA */
|
|
||||||
case 0x0276: /* ɶ IPA */
|
|
||||||
case 0x0277: /* ɷ IPA */
|
|
||||||
case 0x0278: /* ɸ IPA */
|
|
||||||
case 0x0279: /* ɹ IPA */
|
|
||||||
case 0x027a: /* ɺ IPA */
|
|
||||||
case 0x027b: /* ɻ IPA */
|
|
||||||
case 0x027c: /* ɼ IPA */
|
|
||||||
case 0x027e: /* ɾ IPA */
|
|
||||||
case 0x027f: /* ɿ IPA */
|
|
||||||
case 0x0281: /* ʁ IPA */
|
|
||||||
case 0x0284: /* ʄ IPA */
|
|
||||||
case 0x0285: /* ʅ IPA */
|
|
||||||
case 0x0286: /* ʆ IPA */
|
|
||||||
case 0x028d: /* ʍ IPA */
|
|
||||||
case 0x028e: /* ʎ IPA */
|
|
||||||
case 0x028f: /* ʏ IPA */
|
|
||||||
case 0x0290: /* ʐ IPA */
|
|
||||||
case 0x0291: /* ʑ IPA */
|
|
||||||
case 0x0293: /* ʓ IPA */
|
|
||||||
case 0x0295: /* ʕ IPA */
|
|
||||||
case 0x0296: /* ʖ IPA */
|
|
||||||
case 0x0297: /* ʗ IPA */
|
|
||||||
case 0x0298: /* ʘ IPA */
|
|
||||||
case 0x0299: /* ʙ IPA */
|
|
||||||
case 0x029a: /* ʚ IPA */
|
|
||||||
case 0x029b: /* ʛ IPA */
|
|
||||||
case 0x029c: /* ʜ IPA */
|
|
||||||
case 0x029f: /* ʟ IPA */
|
|
||||||
case 0x02a0: /* ʠ IPA */
|
|
||||||
case 0x02a1: /* ʡ IPA */
|
|
||||||
case 0x02a2: /* ʢ IPA */
|
|
||||||
case 0x02a3: /* ʣ IPA */
|
|
||||||
case 0x02a4: /* ʤ IPA */
|
|
||||||
case 0x02a5: /* ʥ IPA */
|
|
||||||
case 0x02a6: /* ʦ IPA */
|
|
||||||
case 0x02a7: /* ʧ IPA */
|
|
||||||
case 0x02a8: /* ʨ IPA */
|
|
||||||
case 0x02a9: /* ʩ IPA */
|
|
||||||
case 0x02aa: /* ʪ IPA */
|
|
||||||
case 0x02ab: /* ʫ IPA */
|
|
||||||
case 0x02ac: /* ʬ IPA */
|
|
||||||
case 0x02ad: /* ʭ IPA */
|
|
||||||
case 0x02ae: /* ʮ IPA */
|
|
||||||
case 0x02af: /* ʯ IPA */
|
|
||||||
case 0x0390: /* ΐ Greek */
|
|
||||||
case 0x03b0: /* ΰ Greek */
|
|
||||||
case 0x03fc: /* ϼ Greek */
|
|
||||||
case 0x0560: /* ՠ Armenian */
|
|
||||||
case 0x0587: /* և Armenian */
|
|
||||||
case 0x0588: /* ֈ Armenian */
|
|
||||||
case 0x1d00: /* ᴀ Phonetic Extensions */
|
|
||||||
case 0x1d01: /* ᴁ Phonetic Extensions */
|
|
||||||
case 0x1d02: /* ᴂ Phonetic Extensions */
|
|
||||||
case 0x1d03: /* ᴃ Phonetic Extensions */
|
|
||||||
case 0x1d04: /* ᴄ Phonetic Extensions */
|
|
||||||
case 0x1d05: /* ᴅ Phonetic Extensions */
|
|
||||||
case 0x1d06: /* ᴆ Phonetic Extensions */
|
|
||||||
case 0x1d07: /* ᴇ Phonetic Extensions */
|
|
||||||
case 0x1d08: /* ᴈ Phonetic Extensions */
|
|
||||||
case 0x1d09: /* ᴉ Phonetic Extensions */
|
|
||||||
case 0x1d0a: /* ᴊ Phonetic Extensions */
|
|
||||||
case 0x1d0b: /* ᴋ Phonetic Extensions */
|
|
||||||
case 0x1d0c: /* ᴌ Phonetic Extensions */
|
|
||||||
case 0x1d0d: /* ᴍ Phonetic Extensions */
|
|
||||||
case 0x1d0e: /* ᴎ Phonetic Extensions */
|
|
||||||
case 0x1d0f: /* ᴏ Phonetic Extensions */
|
|
||||||
case 0x1d10: /* ᴐ Phonetic Extensions */
|
|
||||||
case 0x1d11: /* ᴑ Phonetic Extensions */
|
|
||||||
case 0x1d12: /* ᴒ Phonetic Extensions */
|
|
||||||
case 0x1d13: /* ᴓ Phonetic Extensions */
|
|
||||||
case 0x1d14: /* ᴔ Phonetic Extensions */
|
|
||||||
case 0x1d15: /* ᴕ Phonetic Extensions */
|
|
||||||
case 0x1d16: /* ᴖ Phonetic Extensions */
|
|
||||||
case 0x1d17: /* ᴗ Phonetic Extensions */
|
|
||||||
case 0x1d18: /* ᴘ Phonetic Extensions */
|
|
||||||
case 0x1d19: /* ᴙ Phonetic Extensions */
|
|
||||||
case 0x1d1a: /* ᴚ Phonetic Extensions */
|
|
||||||
case 0x1d1b: /* ᴛ Phonetic Extensions */
|
|
||||||
case 0x1d1c: /* ᴜ Phonetic Extensions */
|
|
||||||
case 0x1d1d: /* ᴝ Phonetic Extensions */
|
|
||||||
case 0x1d1e: /* ᴞ Phonetic Extensions */
|
|
||||||
case 0x1d1f: /* ᴟ Phonetic Extensions */
|
|
||||||
case 0x1d20: /* ᴠ Phonetic Extensions */
|
|
||||||
case 0x1d21: /* ᴡ Phonetic Extensions */
|
|
||||||
case 0x1d22: /* ᴢ Phonetic Extensions */
|
|
||||||
case 0x1d23: /* ᴣ Phonetic Extensions */
|
|
||||||
case 0x1d24: /* ᴤ Phonetic Extensions */
|
|
||||||
case 0x1d25: /* ᴥ Phonetic Extensions */
|
|
||||||
case 0x1d26: /* ᴦ Phonetic Extensions */
|
|
||||||
case 0x1d27: /* ᴧ Phonetic Extensions */
|
|
||||||
case 0x1d28: /* ᴨ Phonetic Extensions */
|
|
||||||
case 0x1d29: /* ᴩ Phonetic Extensions */
|
|
||||||
case 0x1d2a: /* ᴪ Phonetic Extensions */
|
|
||||||
case 0x1d2b: /* ᴫ Phonetic Extensions */
|
|
||||||
case 0x1d6b: /* ᵫ Phonetic Extensions */
|
|
||||||
case 0x1d6c: /* ᵬ Phonetic Extensions */
|
|
||||||
case 0x1d6d: /* ᵭ Phonetic Extensions */
|
|
||||||
case 0x1d6e: /* ᵮ Phonetic Extensions */
|
|
||||||
case 0x1d6f: /* ᵯ Phonetic Extensions */
|
|
||||||
case 0x1d70: /* ᵰ Phonetic Extensions */
|
|
||||||
case 0x1d71: /* ᵱ Phonetic Extensions */
|
|
||||||
case 0x1d72: /* ᵲ Phonetic Extensions */
|
|
||||||
case 0x1d73: /* ᵳ Phonetic Extensions */
|
|
||||||
case 0x1d74: /* ᵴ Phonetic Extensions */
|
|
||||||
case 0x1d75: /* ᵵ Phonetic Extensions */
|
|
||||||
case 0x1d76: /* ᵶ Phonetic Extensions */
|
|
||||||
case 0x1d77: /* ᵷ Phonetic Extensions */
|
|
||||||
case 0x1d7a: /* ᵺ Phonetic Extensions */
|
|
||||||
case 0x1d7b: /* ᵻ Phonetic Extensions */
|
|
||||||
case 0x1d7c: /* ᵼ Phonetic Extensions */
|
|
||||||
case 0x1d7e: /* ᵾ Phonetic Extensions */
|
|
||||||
case 0x1d7f: /* ᵿ Phonetic Extensions */
|
|
||||||
case 0x1d80: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d81: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d82: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d83: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d84: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d85: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d86: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d87: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d88: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d89: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d8a: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d8b: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d8c: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d8d: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d8f: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d90: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d91: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d92: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d93: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d94: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d95: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d96: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d97: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d98: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d99: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1d9a: /* . Phonetic Extensions Supplement */
|
|
||||||
case 0x1e96: /* ẖ Watin-C */
|
|
||||||
case 0x1e97: /* ẗ Watin-C */
|
|
||||||
case 0x1e98: /* ẘ Watin-C */
|
|
||||||
case 0x1e99: /* ẙ Watin-C */
|
|
||||||
case 0x1e9a: /* ẚ Watin-C */
|
|
||||||
case 0x1e9c: /* ẜ Watin-C */
|
|
||||||
case 0x1e9d: /* ẝ Watin-C */
|
|
||||||
case 0x1e9f: /* ẟ Watin-C */
|
|
||||||
case 0x1f50: /* ὐ Greek2 */
|
|
||||||
case 0x1f52: /* ὒ Greek2 */
|
|
||||||
case 0x1f54: /* ὔ Greek2 */
|
|
||||||
case 0x1f56: /* ὖ Greek2 */
|
|
||||||
case 0x1fb2: /* ᾲ Greek2 */
|
|
||||||
case 0x1fb4: /* ᾴ Greek2 */
|
|
||||||
case 0x1fb6: /* ᾶ Greek2 */
|
|
||||||
case 0x1fb7: /* ᾷ Greek2 */
|
|
||||||
case 0x1fc2: /* ῂ Greek2 */
|
|
||||||
case 0x1fc4: /* ῄ Greek2 */
|
|
||||||
case 0x1fc6: /* ῆ Greek2 */
|
|
||||||
case 0x1fc7: /* ῇ Greek2 */
|
|
||||||
case 0x1fd2: /* ῒ Greek2 */
|
|
||||||
case 0x1fd3: /* ΐ Greek2 */
|
|
||||||
case 0x1fd6: /* ῖ Greek2 */
|
|
||||||
case 0x1fd7: /* ῗ Greek2 */
|
|
||||||
case 0x1fe2: /* ῢ Greek2 */
|
|
||||||
case 0x1fe3: /* ΰ Greek2 */
|
|
||||||
case 0x1fe4: /* ῤ Greek2 */
|
|
||||||
case 0x1fe6: /* ῦ Greek2 */
|
|
||||||
case 0x1fe7: /* ῧ Greek2 */
|
|
||||||
case 0x1ff2: /* ῲ Greek2 */
|
|
||||||
case 0x1ff4: /* ῴ Greek2 */
|
|
||||||
case 0x1ff6: /* ῶ Greek2 */
|
|
||||||
case 0x1ff7: /* ῷ Greek2 */
|
|
||||||
case 0x210a: /* ℊ Letterlike */
|
|
||||||
case 0x210e: /* ℎ Letterlike */
|
|
||||||
case 0x210f: /* ℏ Letterlike */
|
|
||||||
case 0x2113: /* ℓ Letterlike */
|
|
||||||
case 0x212f: /* ℯ Letterlike */
|
|
||||||
case 0x2134: /* ℴ Letterlike */
|
|
||||||
case 0x2139: /* ℹ Letterlike */
|
|
||||||
case 0x213c: /* ℼ Letterlike */
|
|
||||||
case 0x213d: /* ℽ Letterlike */
|
|
||||||
case 0x2146: /* ⅆ Letterlike */
|
|
||||||
case 0x2147: /* ⅇ Letterlike */
|
|
||||||
case 0x2148: /* ⅈ Letterlike */
|
|
||||||
case 0x2149: /* ⅉ Letterlike */
|
|
||||||
case 0x2c71: /* . Watin-D */
|
|
||||||
case 0x2c74: /* . Watin-D */
|
|
||||||
case 0x2c77: /* . Watin-D */
|
|
||||||
case 0x2c78: /* . Watin-D */
|
|
||||||
case 0x2c79: /* . Watin-D */
|
|
||||||
case 0x2c7a: /* . Watin-D */
|
|
||||||
case 0x2c7b: /* . Watin-D */
|
|
||||||
case 0x2ce4: /* . Coptic */
|
|
||||||
case 0xa730: /* . Latin Extended-D */
|
|
||||||
case 0xa731: /* . Latin Extended-D */
|
|
||||||
case 0xa771: /* . Latin Extended-D */
|
|
||||||
case 0xa772: /* . Latin Extended-D */
|
|
||||||
case 0xa773: /* . Latin Extended-D */
|
|
||||||
case 0xa774: /* . Latin Extended-D */
|
|
||||||
case 0xa775: /* . Latin Extended-D */
|
|
||||||
case 0xa776: /* . Latin Extended-D */
|
|
||||||
case 0xa777: /* . Latin Extended-D */
|
|
||||||
case 0xa778: /* . Latin Extended-D */
|
|
||||||
case 0xa78e: /* . Latin Extended-D */
|
|
||||||
case 0xa795: /* . Latin Extended-D */
|
|
||||||
case 0xa7af: /* . Latin Extended-D */
|
|
||||||
case 0xa7fa: /* . Latin Extended-D */
|
|
||||||
case 0xab30: /* . Latin Extended-E */
|
|
||||||
case 0xab31: /* . Latin Extended-E */
|
|
||||||
case 0xab32: /* . Latin Extended-E */
|
|
||||||
case 0xab33: /* . Latin Extended-E */
|
|
||||||
case 0xab34: /* . Latin Extended-E */
|
|
||||||
case 0xab35: /* . Latin Extended-E */
|
|
||||||
case 0xab36: /* . Latin Extended-E */
|
|
||||||
case 0xab37: /* . Latin Extended-E */
|
|
||||||
case 0xab38: /* . Latin Extended-E */
|
|
||||||
case 0xab39: /* . Latin Extended-E */
|
|
||||||
case 0xab3a: /* . Latin Extended-E */
|
|
||||||
case 0xab3b: /* . Latin Extended-E */
|
|
||||||
case 0xab3c: /* . Latin Extended-E */
|
|
||||||
case 0xab3d: /* . Latin Extended-E */
|
|
||||||
case 0xab3e: /* . Latin Extended-E */
|
|
||||||
case 0xab3f: /* . Latin Extended-E */
|
|
||||||
case 0xab40: /* . Latin Extended-E */
|
|
||||||
case 0xab41: /* . Latin Extended-E */
|
|
||||||
case 0xab42: /* . Latin Extended-E */
|
|
||||||
case 0xab43: /* . Latin Extended-E */
|
|
||||||
case 0xab44: /* . Latin Extended-E */
|
|
||||||
case 0xab45: /* . Latin Extended-E */
|
|
||||||
case 0xab46: /* . Latin Extended-E */
|
|
||||||
case 0xab47: /* . Latin Extended-E */
|
|
||||||
case 0xab48: /* . Latin Extended-E */
|
|
||||||
case 0xab49: /* . Latin Extended-E */
|
|
||||||
case 0xab4a: /* . Latin Extended-E */
|
|
||||||
case 0xab4b: /* . Latin Extended-E */
|
|
||||||
case 0xab4c: /* . Latin Extended-E */
|
|
||||||
case 0xab4d: /* . Latin Extended-E */
|
|
||||||
case 0xab4e: /* . Latin Extended-E */
|
|
||||||
case 0xab4f: /* . Latin Extended-E */
|
|
||||||
case 0xab50: /* . Latin Extended-E */
|
|
||||||
case 0xab51: /* . Latin Extended-E */
|
|
||||||
case 0xab52: /* . Latin Extended-E */
|
|
||||||
case 0xab54: /* . Latin Extended-E */
|
|
||||||
case 0xab55: /* . Latin Extended-E */
|
|
||||||
case 0xab56: /* . Latin Extended-E */
|
|
||||||
case 0xab57: /* . Latin Extended-E */
|
|
||||||
case 0xab58: /* . Latin Extended-E */
|
|
||||||
case 0xab59: /* . Latin Extended-E */
|
|
||||||
case 0xab5a: /* . Latin Extended-E */
|
|
||||||
case 0xab60: /* . Latin Extended-E */
|
|
||||||
case 0xab61: /* . Latin Extended-E */
|
|
||||||
case 0xab62: /* . Latin Extended-E */
|
|
||||||
case 0xab63: /* . Latin Extended-E */
|
|
||||||
case 0xab64: /* . Latin Extended-E */
|
|
||||||
case 0xab65: /* . Latin Extended-E */
|
|
||||||
case 0xab66: /* . Latin Extended-E */
|
|
||||||
case 0xab67: /* . Latin Extended-E */
|
|
||||||
case 0xfb00: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb01: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb02: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb03: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb04: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb05: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb06: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb13: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb14: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb15: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb16: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0xfb17: /* . Alphabetic Presentation Forms */
|
|
||||||
case 0x1d44e: /* 𝑎 Math */
|
|
||||||
case 0x1d44f: /* 𝑏 Math */
|
|
||||||
case 0x1d450: /* 𝑐 Math */
|
|
||||||
case 0x1d451: /* 𝑑 Math */
|
|
||||||
case 0x1d452: /* 𝑒 Math */
|
|
||||||
case 0x1d453: /* 𝑓 Math */
|
|
||||||
case 0x1d454: /* 𝑔 Math */
|
|
||||||
case 0x1d45e: /* 𝑞 Math */
|
|
||||||
case 0x1d45f: /* 𝑟 Math */
|
|
||||||
case 0x1d460: /* 𝑠 Math */
|
|
||||||
case 0x1d461: /* 𝑡 Math */
|
|
||||||
case 0x1d462: /* 𝑢 Math */
|
|
||||||
case 0x1d463: /* 𝑣 Math */
|
|
||||||
case 0x1d464: /* 𝑤 Math */
|
|
||||||
case 0x1d465: /* 𝑥 Math */
|
|
||||||
case 0x1d466: /* 𝑦 Math */
|
|
||||||
case 0x1d467: /* 𝑧 Math */
|
|
||||||
case 0x1d4b6: /* 𝒶 Math */
|
|
||||||
case 0x1d4b7: /* 𝒷 Math */
|
|
||||||
case 0x1d4b8: /* 𝒸 Math */
|
|
||||||
case 0x1d4b9: /* 𝒹 Math */
|
|
||||||
case 0x1d4bb: /* 𝒻 Math */
|
|
||||||
case 0x1d4bd: /* 𝒽 Math */
|
|
||||||
case 0x1d4be: /* 𝒾 Math */
|
|
||||||
case 0x1d4bf: /* 𝒿 Math */
|
|
||||||
case 0x1d4c0: /* 𝓀 Math */
|
|
||||||
case 0x1d4c1: /* 𝓁 Math */
|
|
||||||
case 0x1d4c2: /* 𝓂 Math */
|
|
||||||
case 0x1d4c3: /* 𝓃 Math */
|
|
||||||
case 0x1d4c5: /* 𝓅 Math */
|
|
||||||
case 0x1d4c6: /* 𝓆 Math */
|
|
||||||
case 0x1d4c7: /* 𝓇 Math */
|
|
||||||
case 0x1d51e: /* 𝔞 Math */
|
|
||||||
case 0x1d51f: /* 𝔟 Math */
|
|
||||||
case 0x1d520: /* 𝔠 Math */
|
|
||||||
case 0x1d521: /* 𝔡 Math */
|
|
||||||
case 0x1d522: /* 𝔢 Math */
|
|
||||||
case 0x1d523: /* 𝔣 Math */
|
|
||||||
case 0x1d524: /* 𝔤 Math */
|
|
||||||
case 0x1d525: /* 𝔥 Math */
|
|
||||||
case 0x1d526: /* 𝔦 Math */
|
|
||||||
case 0x1d52f: /* 𝔯 Math */
|
|
||||||
case 0x1d530: /* 𝔰 Math */
|
|
||||||
case 0x1d531: /* 𝔱 Math */
|
|
||||||
case 0x1d532: /* 𝔲 Math */
|
|
||||||
case 0x1d533: /* 𝔳 Math */
|
|
||||||
case 0x1d534: /* 𝔴 Math */
|
|
||||||
case 0x1d535: /* 𝔵 Math */
|
|
||||||
case 0x1d536: /* 𝔶 Math */
|
|
||||||
case 0x1d537: /* 𝔷 Math */
|
|
||||||
case 0x1d552: /* 𝕒 Math */
|
|
||||||
case 0x1d553: /* 𝕓 Math */
|
|
||||||
case 0x1d554: /* 𝕔 Math */
|
|
||||||
case 0x1d555: /* 𝕕 Math */
|
|
||||||
case 0x1d556: /* 𝕖 Math */
|
|
||||||
case 0x1d557: /* 𝕗 Math */
|
|
||||||
case 0x1d558: /* 𝕘 Math */
|
|
||||||
case 0x1d559: /* 𝕙 Math */
|
|
||||||
case 0x1d55a: /* 𝕚 Math */
|
|
||||||
case 0x1d55b: /* 𝕛 Math */
|
|
||||||
case 0x1d55c: /* 𝕜 Math */
|
|
||||||
case 0x1d55d: /* 𝕝 Math */
|
|
||||||
case 0x1d55e: /* 𝕞 Math */
|
|
||||||
case 0x1d55f: /* 𝕟 Math */
|
|
||||||
case 0x1d560: /* 𝕠 Math */
|
|
||||||
case 0x1d561: /* 𝕡 Math */
|
|
||||||
case 0x1d562: /* 𝕢 Math */
|
|
||||||
case 0x1d563: /* 𝕣 Math */
|
|
||||||
case 0x1d564: /* 𝕤 Math */
|
|
||||||
case 0x1d565: /* 𝕥 Math */
|
|
||||||
case 0x1d566: /* 𝕦 Math */
|
|
||||||
case 0x1d567: /* 𝕧 Math */
|
|
||||||
case 0x1d568: /* 𝕨 Math */
|
|
||||||
case 0x1d569: /* 𝕩 Math */
|
|
||||||
case 0x1d56a: /* 𝕪 Math */
|
|
||||||
case 0x1d56b: /* 𝕫 Math */
|
|
||||||
case 0x1d656: /* 𝙖 Math */
|
|
||||||
case 0x1d657: /* 𝙗 Math */
|
|
||||||
case 0x1d658: /* 𝙘 Math */
|
|
||||||
case 0x1d659: /* 𝙙 Math */
|
|
||||||
case 0x1d65a: /* 𝙚 Math */
|
|
||||||
case 0x1d65b: /* 𝙛 Math */
|
|
||||||
case 0x1d65c: /* 𝙜 Math */
|
|
||||||
case 0x1d65d: /* 𝙝 Math */
|
|
||||||
case 0x1d65e: /* 𝙞 Math */
|
|
||||||
case 0x1d65f: /* 𝙟 Math */
|
|
||||||
case 0x1d660: /* 𝙠 Math */
|
|
||||||
case 0x1d661: /* 𝙡 Math */
|
|
||||||
case 0x1d662: /* 𝙢 Math */
|
|
||||||
case 0x1d663: /* 𝙣 Math */
|
|
||||||
case 0x1d664: /* 𝙤 Math */
|
|
||||||
case 0x1d665: /* 𝙥 Math */
|
|
||||||
case 0x1d666: /* 𝙦 Math */
|
|
||||||
case 0x1d667: /* 𝙧 Math */
|
|
||||||
case 0x1d668: /* 𝙨 Math */
|
|
||||||
case 0x1d669: /* 𝙩 Math */
|
|
||||||
case 0x1d66a: /* 𝙪 Math */
|
|
||||||
case 0x1d66b: /* 𝙫 Math */
|
|
||||||
case 0x1d66c: /* 𝙬 Math */
|
|
||||||
case 0x1d66d: /* 𝙭 Math */
|
|
||||||
case 0x1d66e: /* 𝙮 Math */
|
|
||||||
case 0x1d66f: /* 𝙯 Math */
|
|
||||||
case 0x1d6da: /* 𝛚 Math */
|
|
||||||
case 0x1d6dc: /* 𝛜 Math */
|
|
||||||
case 0x1d6dd: /* 𝛝 Math */
|
|
||||||
case 0x1d6de: /* 𝛞 Math */
|
|
||||||
case 0x1d6df: /* 𝛟 Math */
|
|
||||||
case 0x1d6e0: /* 𝛠 Math */
|
|
||||||
case 0x1d6e1: /* 𝛡 Math */
|
|
||||||
case 0x1d70d: /* 𝜍 Math */
|
|
||||||
case 0x1d70e: /* 𝜎 Math */
|
|
||||||
case 0x1d70f: /* 𝜏 Math */
|
|
||||||
case 0x1d710: /* 𝜐 Math */
|
|
||||||
case 0x1d711: /* 𝜑 Math */
|
|
||||||
case 0x1d712: /* 𝜒 Math */
|
|
||||||
case 0x1d713: /* 𝜓 Math */
|
|
||||||
case 0x1d714: /* 𝜔 Math */
|
|
||||||
case 0x1d716: /* 𝜖 Math */
|
|
||||||
case 0x1d717: /* 𝜗 Math */
|
|
||||||
case 0x1d718: /* 𝜘 Math */
|
|
||||||
case 0x1d719: /* 𝜙 Math */
|
|
||||||
case 0x1d71a: /* 𝜚 Math */
|
|
||||||
case 0x1d71b: /* 𝜛 Math */
|
|
||||||
case 0x1d747: /* 𝝇 Math */
|
|
||||||
case 0x1d748: /* 𝝈 Math */
|
|
||||||
case 0x1d749: /* 𝝉 Math */
|
|
||||||
case 0x1d74a: /* 𝝊 Math */
|
|
||||||
case 0x1d74b: /* 𝝋 Math */
|
|
||||||
case 0x1d74c: /* 𝝌 Math */
|
|
||||||
case 0x1d74d: /* 𝝍 Math */
|
|
||||||
case 0x1d74e: /* 𝝎 Math */
|
|
||||||
case 0x1d750: /* 𝝐 Math */
|
|
||||||
case 0x1d751: /* 𝝑 Math */
|
|
||||||
case 0x1d752: /* 𝝒 Math */
|
|
||||||
case 0x1d753: /* 𝝓 Math */
|
|
||||||
case 0x1d754: /* 𝝔 Math */
|
|
||||||
case 0x1d755: /* 𝝕 Math */
|
|
||||||
case 0x1d781: /* 𝞁 Math */
|
|
||||||
case 0x1d782: /* 𝞂 Math */
|
|
||||||
case 0x1d783: /* 𝞃 Math */
|
|
||||||
case 0x1d784: /* 𝞄 Math */
|
|
||||||
case 0x1d785: /* 𝞅 Math */
|
|
||||||
case 0x1d786: /* 𝞆 Math */
|
|
||||||
case 0x1d787: /* 𝞇 Math */
|
|
||||||
case 0x1d788: /* 𝞈 Math */
|
|
||||||
case 0x1d78a: /* 𝞊 Math */
|
|
||||||
case 0x1d78b: /* 𝞋 Math */
|
|
||||||
case 0x1d78c: /* 𝞌 Math */
|
|
||||||
case 0x1d78d: /* 𝞍 Math */
|
|
||||||
case 0x1d78e: /* 𝞎 Math */
|
|
||||||
case 0x1d78f: /* 𝞏 Math */
|
|
||||||
case 0x1d7aa: /* 𝞪 Math */
|
|
||||||
case 0x1d7ab: /* 𝞫 Math */
|
|
||||||
case 0x1d7ac: /* 𝞬 Math */
|
|
||||||
case 0x1d7ad: /* 𝞭 Math */
|
|
||||||
case 0x1d7ae: /* 𝞮 Math */
|
|
||||||
case 0x1d7af: /* 𝞯 Math */
|
|
||||||
case 0x1d7b0: /* 𝞰 Math */
|
|
||||||
case 0x1d7b1: /* 𝞱 Math */
|
|
||||||
case 0x1d7b2: /* 𝞲 Math */
|
|
||||||
case 0x1d7b3: /* 𝞳 Math */
|
|
||||||
case 0x1d7b4: /* 𝞴 Math */
|
|
||||||
case 0x1d7b5: /* 𝞵 Math */
|
|
||||||
case 0x1d7b6: /* 𝞶 Math */
|
|
||||||
case 0x1d7b7: /* 𝞷 Math */
|
|
||||||
case 0x1d7b8: /* 𝞸 Math */
|
|
||||||
case 0x1d7b9: /* 𝞹 Math */
|
|
||||||
case 0x1d7ba: /* 𝞺 Math */
|
|
||||||
case 0x1d7bb: /* 𝞻 Math */
|
|
||||||
case 0x1d7bc: /* 𝞼 Math */
|
|
||||||
case 0x1d7bd: /* 𝞽 Math */
|
|
||||||
case 0x1d7be: /* 𝞾 Math */
|
|
||||||
case 0x1d7bf: /* 𝞿 Math */
|
|
||||||
case 0x1d7c0: /* 𝟀 Math */
|
|
||||||
case 0x1d7c1: /* 𝟁 Math */
|
|
||||||
case 0x1d7c2: /* 𝟂 Math */
|
|
||||||
case 0x1d7c4: /* 𝟄 Math */
|
|
||||||
case 0x1d7c5: /* 𝟅 Math */
|
|
||||||
case 0x1d7c6: /* 𝟆 Math */
|
|
||||||
case 0x1d7c7: /* 𝟇 Math */
|
|
||||||
case 0x1d7c8: /* 𝟈 Math */
|
|
||||||
case 0x1d7c9: /* 𝟉 Math */
|
|
||||||
case 0x1d7cb: /* 𝟋 Math */
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak_reference(iswlower, iswlower_l);
|
|
712
libc/str/iswlower.cc
Normal file
712
libc/str/iswlower.cc
Normal file
|
@ -0,0 +1,712 @@
|
||||||
|
/*-*-mode:c++;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8-*-│
|
||||||
|
│ vi: set et ft=c++ ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
|
│ │
|
||||||
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
│ above copyright notice and this permission notice appear in all copies. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||||
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||||
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||||
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||||
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||||
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||||
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/dce.h"
|
||||||
|
#include "libc/macros.h"
|
||||||
|
#include "libc/str/has_char.h"
|
||||||
|
#include "libc/wctype.h"
|
||||||
|
|
||||||
|
static const unsigned short kLower[][2] = {
|
||||||
|
{0x61, 0x7a}, //
|
||||||
|
{0xaa, 0xaa}, //
|
||||||
|
{0xb5, 0xb5}, //
|
||||||
|
{0xba, 0xba}, //
|
||||||
|
{0xdf, 0xf6}, //
|
||||||
|
{0xf8, 0xff}, //
|
||||||
|
{0x101, 0x101}, //
|
||||||
|
{0x103, 0x103}, //
|
||||||
|
{0x105, 0x105}, //
|
||||||
|
{0x107, 0x107}, //
|
||||||
|
{0x109, 0x109}, //
|
||||||
|
{0x10b, 0x10b}, //
|
||||||
|
{0x10d, 0x10d}, //
|
||||||
|
{0x10f, 0x10f}, //
|
||||||
|
{0x111, 0x111}, //
|
||||||
|
{0x113, 0x113}, //
|
||||||
|
{0x115, 0x115}, //
|
||||||
|
{0x117, 0x117}, //
|
||||||
|
{0x119, 0x119}, //
|
||||||
|
{0x11b, 0x11b}, //
|
||||||
|
{0x11d, 0x11d}, //
|
||||||
|
{0x11f, 0x11f}, //
|
||||||
|
{0x121, 0x121}, //
|
||||||
|
{0x123, 0x123}, //
|
||||||
|
{0x125, 0x125}, //
|
||||||
|
{0x127, 0x127}, //
|
||||||
|
{0x129, 0x129}, //
|
||||||
|
{0x12b, 0x12b}, //
|
||||||
|
{0x12d, 0x12d}, //
|
||||||
|
{0x12f, 0x12f}, //
|
||||||
|
{0x131, 0x131}, //
|
||||||
|
{0x133, 0x133}, //
|
||||||
|
{0x135, 0x135}, //
|
||||||
|
{0x137, 0x138}, //
|
||||||
|
{0x13a, 0x13a}, //
|
||||||
|
{0x13c, 0x13c}, //
|
||||||
|
{0x13e, 0x13e}, //
|
||||||
|
{0x140, 0x140}, //
|
||||||
|
{0x142, 0x142}, //
|
||||||
|
{0x144, 0x144}, //
|
||||||
|
{0x146, 0x146}, //
|
||||||
|
{0x148, 0x149}, //
|
||||||
|
{0x14b, 0x14b}, //
|
||||||
|
{0x14d, 0x14d}, //
|
||||||
|
{0x14f, 0x14f}, //
|
||||||
|
{0x151, 0x151}, //
|
||||||
|
{0x153, 0x153}, //
|
||||||
|
{0x155, 0x155}, //
|
||||||
|
{0x157, 0x157}, //
|
||||||
|
{0x159, 0x159}, //
|
||||||
|
{0x15b, 0x15b}, //
|
||||||
|
{0x15d, 0x15d}, //
|
||||||
|
{0x15f, 0x15f}, //
|
||||||
|
{0x161, 0x161}, //
|
||||||
|
{0x163, 0x163}, //
|
||||||
|
{0x165, 0x165}, //
|
||||||
|
{0x167, 0x167}, //
|
||||||
|
{0x169, 0x169}, //
|
||||||
|
{0x16b, 0x16b}, //
|
||||||
|
{0x16d, 0x16d}, //
|
||||||
|
{0x16f, 0x16f}, //
|
||||||
|
{0x171, 0x171}, //
|
||||||
|
{0x173, 0x173}, //
|
||||||
|
{0x175, 0x175}, //
|
||||||
|
{0x177, 0x177}, //
|
||||||
|
{0x17a, 0x17a}, //
|
||||||
|
{0x17c, 0x17c}, //
|
||||||
|
{0x17e, 0x180}, //
|
||||||
|
{0x183, 0x183}, //
|
||||||
|
{0x185, 0x185}, //
|
||||||
|
{0x188, 0x188}, //
|
||||||
|
{0x18c, 0x18d}, //
|
||||||
|
{0x192, 0x192}, //
|
||||||
|
{0x195, 0x195}, //
|
||||||
|
{0x199, 0x19b}, //
|
||||||
|
{0x19e, 0x19e}, //
|
||||||
|
{0x1a1, 0x1a1}, //
|
||||||
|
{0x1a3, 0x1a3}, //
|
||||||
|
{0x1a5, 0x1a5}, //
|
||||||
|
{0x1a8, 0x1a8}, //
|
||||||
|
{0x1aa, 0x1ab}, //
|
||||||
|
{0x1ad, 0x1ad}, //
|
||||||
|
{0x1b0, 0x1b0}, //
|
||||||
|
{0x1b4, 0x1b4}, //
|
||||||
|
{0x1b6, 0x1b6}, //
|
||||||
|
{0x1b9, 0x1ba}, //
|
||||||
|
{0x1bd, 0x1bf}, //
|
||||||
|
{0x1c5, 0x1c6}, //
|
||||||
|
{0x1c8, 0x1c9}, //
|
||||||
|
{0x1cb, 0x1cc}, //
|
||||||
|
{0x1ce, 0x1ce}, //
|
||||||
|
{0x1d0, 0x1d0}, //
|
||||||
|
{0x1d2, 0x1d2}, //
|
||||||
|
{0x1d4, 0x1d4}, //
|
||||||
|
{0x1d6, 0x1d6}, //
|
||||||
|
{0x1d8, 0x1d8}, //
|
||||||
|
{0x1da, 0x1da}, //
|
||||||
|
{0x1dc, 0x1dd}, //
|
||||||
|
{0x1df, 0x1df}, //
|
||||||
|
{0x1e1, 0x1e1}, //
|
||||||
|
{0x1e3, 0x1e3}, //
|
||||||
|
{0x1e5, 0x1e5}, //
|
||||||
|
{0x1e7, 0x1e7}, //
|
||||||
|
{0x1e9, 0x1e9}, //
|
||||||
|
{0x1eb, 0x1eb}, //
|
||||||
|
{0x1ed, 0x1ed}, //
|
||||||
|
{0x1ef, 0x1f0}, //
|
||||||
|
{0x1f2, 0x1f3}, //
|
||||||
|
{0x1f5, 0x1f5}, //
|
||||||
|
{0x1f9, 0x1f9}, //
|
||||||
|
{0x1fb, 0x1fb}, //
|
||||||
|
{0x1fd, 0x1fd}, //
|
||||||
|
{0x1ff, 0x1ff}, //
|
||||||
|
{0x201, 0x201}, //
|
||||||
|
{0x203, 0x203}, //
|
||||||
|
{0x205, 0x205}, //
|
||||||
|
{0x207, 0x207}, //
|
||||||
|
{0x209, 0x209}, //
|
||||||
|
{0x20b, 0x20b}, //
|
||||||
|
{0x20d, 0x20d}, //
|
||||||
|
{0x20f, 0x20f}, //
|
||||||
|
{0x211, 0x211}, //
|
||||||
|
{0x213, 0x213}, //
|
||||||
|
{0x215, 0x215}, //
|
||||||
|
{0x217, 0x217}, //
|
||||||
|
{0x219, 0x219}, //
|
||||||
|
{0x21b, 0x21b}, //
|
||||||
|
{0x21d, 0x21d}, //
|
||||||
|
{0x21f, 0x21f}, //
|
||||||
|
{0x221, 0x221}, //
|
||||||
|
{0x223, 0x223}, //
|
||||||
|
{0x225, 0x225}, //
|
||||||
|
{0x227, 0x227}, //
|
||||||
|
{0x229, 0x229}, //
|
||||||
|
{0x22b, 0x22b}, //
|
||||||
|
{0x22d, 0x22d}, //
|
||||||
|
{0x22f, 0x22f}, //
|
||||||
|
{0x231, 0x231}, //
|
||||||
|
{0x233, 0x239}, //
|
||||||
|
{0x23c, 0x23c}, //
|
||||||
|
{0x23f, 0x240}, //
|
||||||
|
{0x242, 0x242}, //
|
||||||
|
{0x247, 0x247}, //
|
||||||
|
{0x249, 0x249}, //
|
||||||
|
{0x24b, 0x24b}, //
|
||||||
|
{0x24d, 0x24d}, //
|
||||||
|
{0x24f, 0x293}, //
|
||||||
|
{0x295, 0x2b8}, //
|
||||||
|
{0x2c0, 0x2c1}, //
|
||||||
|
{0x2e0, 0x2e4}, //
|
||||||
|
{0x345, 0x345}, //
|
||||||
|
{0x371, 0x371}, //
|
||||||
|
{0x373, 0x373}, //
|
||||||
|
{0x377, 0x377}, //
|
||||||
|
{0x37a, 0x37d}, //
|
||||||
|
{0x390, 0x390}, //
|
||||||
|
{0x3ac, 0x3ce}, //
|
||||||
|
{0x3d0, 0x3d1}, //
|
||||||
|
{0x3d5, 0x3d7}, //
|
||||||
|
{0x3d9, 0x3d9}, //
|
||||||
|
{0x3db, 0x3db}, //
|
||||||
|
{0x3dd, 0x3dd}, //
|
||||||
|
{0x3df, 0x3df}, //
|
||||||
|
{0x3e1, 0x3e1}, //
|
||||||
|
{0x3e3, 0x3e3}, //
|
||||||
|
{0x3e5, 0x3e5}, //
|
||||||
|
{0x3e7, 0x3e7}, //
|
||||||
|
{0x3e9, 0x3e9}, //
|
||||||
|
{0x3eb, 0x3eb}, //
|
||||||
|
{0x3ed, 0x3ed}, //
|
||||||
|
{0x3ef, 0x3f3}, //
|
||||||
|
{0x3f5, 0x3f5}, //
|
||||||
|
{0x3f8, 0x3f8}, //
|
||||||
|
{0x3fb, 0x3fc}, //
|
||||||
|
{0x430, 0x45f}, //
|
||||||
|
{0x461, 0x461}, //
|
||||||
|
{0x463, 0x463}, //
|
||||||
|
{0x465, 0x465}, //
|
||||||
|
{0x467, 0x467}, //
|
||||||
|
{0x469, 0x469}, //
|
||||||
|
{0x46b, 0x46b}, //
|
||||||
|
{0x46d, 0x46d}, //
|
||||||
|
{0x46f, 0x46f}, //
|
||||||
|
{0x471, 0x471}, //
|
||||||
|
{0x473, 0x473}, //
|
||||||
|
{0x475, 0x475}, //
|
||||||
|
{0x477, 0x477}, //
|
||||||
|
{0x479, 0x479}, //
|
||||||
|
{0x47b, 0x47b}, //
|
||||||
|
{0x47d, 0x47d}, //
|
||||||
|
{0x47f, 0x47f}, //
|
||||||
|
{0x481, 0x481}, //
|
||||||
|
{0x48b, 0x48b}, //
|
||||||
|
{0x48d, 0x48d}, //
|
||||||
|
{0x48f, 0x48f}, //
|
||||||
|
{0x491, 0x491}, //
|
||||||
|
{0x493, 0x493}, //
|
||||||
|
{0x495, 0x495}, //
|
||||||
|
{0x497, 0x497}, //
|
||||||
|
{0x499, 0x499}, //
|
||||||
|
{0x49b, 0x49b}, //
|
||||||
|
{0x49d, 0x49d}, //
|
||||||
|
{0x49f, 0x49f}, //
|
||||||
|
{0x4a1, 0x4a1}, //
|
||||||
|
{0x4a3, 0x4a3}, //
|
||||||
|
{0x4a5, 0x4a5}, //
|
||||||
|
{0x4a7, 0x4a7}, //
|
||||||
|
{0x4a9, 0x4a9}, //
|
||||||
|
{0x4ab, 0x4ab}, //
|
||||||
|
{0x4ad, 0x4ad}, //
|
||||||
|
{0x4af, 0x4af}, //
|
||||||
|
{0x4b1, 0x4b1}, //
|
||||||
|
{0x4b3, 0x4b3}, //
|
||||||
|
{0x4b5, 0x4b5}, //
|
||||||
|
{0x4b7, 0x4b7}, //
|
||||||
|
{0x4b9, 0x4b9}, //
|
||||||
|
{0x4bb, 0x4bb}, //
|
||||||
|
{0x4bd, 0x4bd}, //
|
||||||
|
{0x4bf, 0x4bf}, //
|
||||||
|
{0x4c2, 0x4c2}, //
|
||||||
|
{0x4c4, 0x4c4}, //
|
||||||
|
{0x4c6, 0x4c6}, //
|
||||||
|
{0x4c8, 0x4c8}, //
|
||||||
|
{0x4ca, 0x4ca}, //
|
||||||
|
{0x4cc, 0x4cc}, //
|
||||||
|
{0x4ce, 0x4cf}, //
|
||||||
|
{0x4d1, 0x4d1}, //
|
||||||
|
{0x4d3, 0x4d3}, //
|
||||||
|
{0x4d5, 0x4d5}, //
|
||||||
|
{0x4d7, 0x4d7}, //
|
||||||
|
{0x4d9, 0x4d9}, //
|
||||||
|
{0x4db, 0x4db}, //
|
||||||
|
{0x4dd, 0x4dd}, //
|
||||||
|
{0x4df, 0x4df}, //
|
||||||
|
{0x4e1, 0x4e1}, //
|
||||||
|
{0x4e3, 0x4e3}, //
|
||||||
|
{0x4e5, 0x4e5}, //
|
||||||
|
{0x4e7, 0x4e7}, //
|
||||||
|
{0x4e9, 0x4e9}, //
|
||||||
|
{0x4eb, 0x4eb}, //
|
||||||
|
{0x4ed, 0x4ed}, //
|
||||||
|
{0x4ef, 0x4ef}, //
|
||||||
|
{0x4f1, 0x4f1}, //
|
||||||
|
{0x4f3, 0x4f3}, //
|
||||||
|
{0x4f5, 0x4f5}, //
|
||||||
|
{0x4f7, 0x4f7}, //
|
||||||
|
{0x4f9, 0x4f9}, //
|
||||||
|
{0x4fb, 0x4fb}, //
|
||||||
|
{0x4fd, 0x4fd}, //
|
||||||
|
{0x4ff, 0x4ff}, //
|
||||||
|
{0x501, 0x501}, //
|
||||||
|
{0x503, 0x503}, //
|
||||||
|
{0x505, 0x505}, //
|
||||||
|
{0x507, 0x507}, //
|
||||||
|
{0x509, 0x509}, //
|
||||||
|
{0x50b, 0x50b}, //
|
||||||
|
{0x50d, 0x50d}, //
|
||||||
|
{0x50f, 0x50f}, //
|
||||||
|
{0x511, 0x511}, //
|
||||||
|
{0x513, 0x513}, //
|
||||||
|
{0x515, 0x515}, //
|
||||||
|
{0x517, 0x517}, //
|
||||||
|
{0x519, 0x519}, //
|
||||||
|
{0x51b, 0x51b}, //
|
||||||
|
{0x51d, 0x51d}, //
|
||||||
|
{0x51f, 0x51f}, //
|
||||||
|
{0x521, 0x521}, //
|
||||||
|
{0x523, 0x523}, //
|
||||||
|
{0x525, 0x525}, //
|
||||||
|
{0x527, 0x527}, //
|
||||||
|
{0x529, 0x529}, //
|
||||||
|
{0x52b, 0x52b}, //
|
||||||
|
{0x52d, 0x52d}, //
|
||||||
|
{0x52f, 0x52f}, //
|
||||||
|
{0x560, 0x588}, //
|
||||||
|
{0x10d0, 0x10fa}, //
|
||||||
|
{0x10fc, 0x10ff}, //
|
||||||
|
{0x13f8, 0x13fd}, //
|
||||||
|
{0x1c80, 0x1c88}, //
|
||||||
|
{0x1d00, 0x1dbf}, //
|
||||||
|
{0x1e01, 0x1e01}, //
|
||||||
|
{0x1e03, 0x1e03}, //
|
||||||
|
{0x1e05, 0x1e05}, //
|
||||||
|
{0x1e07, 0x1e07}, //
|
||||||
|
{0x1e09, 0x1e09}, //
|
||||||
|
{0x1e0b, 0x1e0b}, //
|
||||||
|
{0x1e0d, 0x1e0d}, //
|
||||||
|
{0x1e0f, 0x1e0f}, //
|
||||||
|
{0x1e11, 0x1e11}, //
|
||||||
|
{0x1e13, 0x1e13}, //
|
||||||
|
{0x1e15, 0x1e15}, //
|
||||||
|
{0x1e17, 0x1e17}, //
|
||||||
|
{0x1e19, 0x1e19}, //
|
||||||
|
{0x1e1b, 0x1e1b}, //
|
||||||
|
{0x1e1d, 0x1e1d}, //
|
||||||
|
{0x1e1f, 0x1e1f}, //
|
||||||
|
{0x1e21, 0x1e21}, //
|
||||||
|
{0x1e23, 0x1e23}, //
|
||||||
|
{0x1e25, 0x1e25}, //
|
||||||
|
{0x1e27, 0x1e27}, //
|
||||||
|
{0x1e29, 0x1e29}, //
|
||||||
|
{0x1e2b, 0x1e2b}, //
|
||||||
|
{0x1e2d, 0x1e2d}, //
|
||||||
|
{0x1e2f, 0x1e2f}, //
|
||||||
|
{0x1e31, 0x1e31}, //
|
||||||
|
{0x1e33, 0x1e33}, //
|
||||||
|
{0x1e35, 0x1e35}, //
|
||||||
|
{0x1e37, 0x1e37}, //
|
||||||
|
{0x1e39, 0x1e39}, //
|
||||||
|
{0x1e3b, 0x1e3b}, //
|
||||||
|
{0x1e3d, 0x1e3d}, //
|
||||||
|
{0x1e3f, 0x1e3f}, //
|
||||||
|
{0x1e41, 0x1e41}, //
|
||||||
|
{0x1e43, 0x1e43}, //
|
||||||
|
{0x1e45, 0x1e45}, //
|
||||||
|
{0x1e47, 0x1e47}, //
|
||||||
|
{0x1e49, 0x1e49}, //
|
||||||
|
{0x1e4b, 0x1e4b}, //
|
||||||
|
{0x1e4d, 0x1e4d}, //
|
||||||
|
{0x1e4f, 0x1e4f}, //
|
||||||
|
{0x1e51, 0x1e51}, //
|
||||||
|
{0x1e53, 0x1e53}, //
|
||||||
|
{0x1e55, 0x1e55}, //
|
||||||
|
{0x1e57, 0x1e57}, //
|
||||||
|
{0x1e59, 0x1e59}, //
|
||||||
|
{0x1e5b, 0x1e5b}, //
|
||||||
|
{0x1e5d, 0x1e5d}, //
|
||||||
|
{0x1e5f, 0x1e5f}, //
|
||||||
|
{0x1e61, 0x1e61}, //
|
||||||
|
{0x1e63, 0x1e63}, //
|
||||||
|
{0x1e65, 0x1e65}, //
|
||||||
|
{0x1e67, 0x1e67}, //
|
||||||
|
{0x1e69, 0x1e69}, //
|
||||||
|
{0x1e6b, 0x1e6b}, //
|
||||||
|
{0x1e6d, 0x1e6d}, //
|
||||||
|
{0x1e6f, 0x1e6f}, //
|
||||||
|
{0x1e71, 0x1e71}, //
|
||||||
|
{0x1e73, 0x1e73}, //
|
||||||
|
{0x1e75, 0x1e75}, //
|
||||||
|
{0x1e77, 0x1e77}, //
|
||||||
|
{0x1e79, 0x1e79}, //
|
||||||
|
{0x1e7b, 0x1e7b}, //
|
||||||
|
{0x1e7d, 0x1e7d}, //
|
||||||
|
{0x1e7f, 0x1e7f}, //
|
||||||
|
{0x1e81, 0x1e81}, //
|
||||||
|
{0x1e83, 0x1e83}, //
|
||||||
|
{0x1e85, 0x1e85}, //
|
||||||
|
{0x1e87, 0x1e87}, //
|
||||||
|
{0x1e89, 0x1e89}, //
|
||||||
|
{0x1e8b, 0x1e8b}, //
|
||||||
|
{0x1e8d, 0x1e8d}, //
|
||||||
|
{0x1e8f, 0x1e8f}, //
|
||||||
|
{0x1e91, 0x1e91}, //
|
||||||
|
{0x1e93, 0x1e93}, //
|
||||||
|
{0x1e95, 0x1e9d}, //
|
||||||
|
{0x1e9f, 0x1e9f}, //
|
||||||
|
{0x1ea1, 0x1ea1}, //
|
||||||
|
{0x1ea3, 0x1ea3}, //
|
||||||
|
{0x1ea5, 0x1ea5}, //
|
||||||
|
{0x1ea7, 0x1ea7}, //
|
||||||
|
{0x1ea9, 0x1ea9}, //
|
||||||
|
{0x1eab, 0x1eab}, //
|
||||||
|
{0x1ead, 0x1ead}, //
|
||||||
|
{0x1eaf, 0x1eaf}, //
|
||||||
|
{0x1eb1, 0x1eb1}, //
|
||||||
|
{0x1eb3, 0x1eb3}, //
|
||||||
|
{0x1eb5, 0x1eb5}, //
|
||||||
|
{0x1eb7, 0x1eb7}, //
|
||||||
|
{0x1eb9, 0x1eb9}, //
|
||||||
|
{0x1ebb, 0x1ebb}, //
|
||||||
|
{0x1ebd, 0x1ebd}, //
|
||||||
|
{0x1ebf, 0x1ebf}, //
|
||||||
|
{0x1ec1, 0x1ec1}, //
|
||||||
|
{0x1ec3, 0x1ec3}, //
|
||||||
|
{0x1ec5, 0x1ec5}, //
|
||||||
|
{0x1ec7, 0x1ec7}, //
|
||||||
|
{0x1ec9, 0x1ec9}, //
|
||||||
|
{0x1ecb, 0x1ecb}, //
|
||||||
|
{0x1ecd, 0x1ecd}, //
|
||||||
|
{0x1ecf, 0x1ecf}, //
|
||||||
|
{0x1ed1, 0x1ed1}, //
|
||||||
|
{0x1ed3, 0x1ed3}, //
|
||||||
|
{0x1ed5, 0x1ed5}, //
|
||||||
|
{0x1ed7, 0x1ed7}, //
|
||||||
|
{0x1ed9, 0x1ed9}, //
|
||||||
|
{0x1edb, 0x1edb}, //
|
||||||
|
{0x1edd, 0x1edd}, //
|
||||||
|
{0x1edf, 0x1edf}, //
|
||||||
|
{0x1ee1, 0x1ee1}, //
|
||||||
|
{0x1ee3, 0x1ee3}, //
|
||||||
|
{0x1ee5, 0x1ee5}, //
|
||||||
|
{0x1ee7, 0x1ee7}, //
|
||||||
|
{0x1ee9, 0x1ee9}, //
|
||||||
|
{0x1eeb, 0x1eeb}, //
|
||||||
|
{0x1eed, 0x1eed}, //
|
||||||
|
{0x1eef, 0x1eef}, //
|
||||||
|
{0x1ef1, 0x1ef1}, //
|
||||||
|
{0x1ef3, 0x1ef3}, //
|
||||||
|
{0x1ef5, 0x1ef5}, //
|
||||||
|
{0x1ef7, 0x1ef7}, //
|
||||||
|
{0x1ef9, 0x1ef9}, //
|
||||||
|
{0x1efb, 0x1efb}, //
|
||||||
|
{0x1efd, 0x1efd}, //
|
||||||
|
{0x1eff, 0x1f07}, //
|
||||||
|
{0x1f10, 0x1f15}, //
|
||||||
|
{0x1f20, 0x1f27}, //
|
||||||
|
{0x1f30, 0x1f37}, //
|
||||||
|
{0x1f40, 0x1f45}, //
|
||||||
|
{0x1f50, 0x1f57}, //
|
||||||
|
{0x1f60, 0x1f67}, //
|
||||||
|
{0x1f70, 0x1f7d}, //
|
||||||
|
{0x1f80, 0x1f87}, //
|
||||||
|
{0x1f90, 0x1f97}, //
|
||||||
|
{0x1fa0, 0x1fa7}, //
|
||||||
|
{0x1fb0, 0x1fb4}, //
|
||||||
|
{0x1fb6, 0x1fb7}, //
|
||||||
|
{0x1fbe, 0x1fbe}, //
|
||||||
|
{0x1fc2, 0x1fc4}, //
|
||||||
|
{0x1fc6, 0x1fc7}, //
|
||||||
|
{0x1fd0, 0x1fd3}, //
|
||||||
|
{0x1fd6, 0x1fd7}, //
|
||||||
|
{0x1fe0, 0x1fe7}, //
|
||||||
|
{0x1ff2, 0x1ff4}, //
|
||||||
|
{0x1ff6, 0x1ff7}, //
|
||||||
|
{0x2071, 0x2071}, //
|
||||||
|
{0x207f, 0x207f}, //
|
||||||
|
{0x2090, 0x209c}, //
|
||||||
|
{0x210a, 0x210a}, //
|
||||||
|
{0x210e, 0x210f}, //
|
||||||
|
{0x2113, 0x2113}, //
|
||||||
|
{0x212f, 0x212f}, //
|
||||||
|
{0x2134, 0x2134}, //
|
||||||
|
{0x2139, 0x2139}, //
|
||||||
|
{0x213c, 0x213d}, //
|
||||||
|
{0x2146, 0x2149}, //
|
||||||
|
{0x214e, 0x214e}, //
|
||||||
|
{0x2170, 0x217f}, //
|
||||||
|
{0x2184, 0x2184}, //
|
||||||
|
{0x24d0, 0x24e9}, //
|
||||||
|
{0x2c30, 0x2c5f}, //
|
||||||
|
{0x2c61, 0x2c61}, //
|
||||||
|
{0x2c65, 0x2c66}, //
|
||||||
|
{0x2c68, 0x2c68}, //
|
||||||
|
{0x2c6a, 0x2c6a}, //
|
||||||
|
{0x2c6c, 0x2c6c}, //
|
||||||
|
{0x2c71, 0x2c71}, //
|
||||||
|
{0x2c73, 0x2c74}, //
|
||||||
|
{0x2c76, 0x2c7d}, //
|
||||||
|
{0x2c81, 0x2c81}, //
|
||||||
|
{0x2c83, 0x2c83}, //
|
||||||
|
{0x2c85, 0x2c85}, //
|
||||||
|
{0x2c87, 0x2c87}, //
|
||||||
|
{0x2c89, 0x2c89}, //
|
||||||
|
{0x2c8b, 0x2c8b}, //
|
||||||
|
{0x2c8d, 0x2c8d}, //
|
||||||
|
{0x2c8f, 0x2c8f}, //
|
||||||
|
{0x2c91, 0x2c91}, //
|
||||||
|
{0x2c93, 0x2c93}, //
|
||||||
|
{0x2c95, 0x2c95}, //
|
||||||
|
{0x2c97, 0x2c97}, //
|
||||||
|
{0x2c99, 0x2c99}, //
|
||||||
|
{0x2c9b, 0x2c9b}, //
|
||||||
|
{0x2c9d, 0x2c9d}, //
|
||||||
|
{0x2c9f, 0x2c9f}, //
|
||||||
|
{0x2ca1, 0x2ca1}, //
|
||||||
|
{0x2ca3, 0x2ca3}, //
|
||||||
|
{0x2ca5, 0x2ca5}, //
|
||||||
|
{0x2ca7, 0x2ca7}, //
|
||||||
|
{0x2ca9, 0x2ca9}, //
|
||||||
|
{0x2cab, 0x2cab}, //
|
||||||
|
{0x2cad, 0x2cad}, //
|
||||||
|
{0x2caf, 0x2caf}, //
|
||||||
|
{0x2cb1, 0x2cb1}, //
|
||||||
|
{0x2cb3, 0x2cb3}, //
|
||||||
|
{0x2cb5, 0x2cb5}, //
|
||||||
|
{0x2cb7, 0x2cb7}, //
|
||||||
|
{0x2cb9, 0x2cb9}, //
|
||||||
|
{0x2cbb, 0x2cbb}, //
|
||||||
|
{0x2cbd, 0x2cbd}, //
|
||||||
|
{0x2cbf, 0x2cbf}, //
|
||||||
|
{0x2cc1, 0x2cc1}, //
|
||||||
|
{0x2cc3, 0x2cc3}, //
|
||||||
|
{0x2cc5, 0x2cc5}, //
|
||||||
|
{0x2cc7, 0x2cc7}, //
|
||||||
|
{0x2cc9, 0x2cc9}, //
|
||||||
|
{0x2ccb, 0x2ccb}, //
|
||||||
|
{0x2ccd, 0x2ccd}, //
|
||||||
|
{0x2ccf, 0x2ccf}, //
|
||||||
|
{0x2cd1, 0x2cd1}, //
|
||||||
|
{0x2cd3, 0x2cd3}, //
|
||||||
|
{0x2cd5, 0x2cd5}, //
|
||||||
|
{0x2cd7, 0x2cd7}, //
|
||||||
|
{0x2cd9, 0x2cd9}, //
|
||||||
|
{0x2cdb, 0x2cdb}, //
|
||||||
|
{0x2cdd, 0x2cdd}, //
|
||||||
|
{0x2cdf, 0x2cdf}, //
|
||||||
|
{0x2ce1, 0x2ce1}, //
|
||||||
|
{0x2ce3, 0x2ce4}, //
|
||||||
|
{0x2cec, 0x2cec}, //
|
||||||
|
{0x2cee, 0x2cee}, //
|
||||||
|
{0x2cf3, 0x2cf3}, //
|
||||||
|
{0x2d00, 0x2d25}, //
|
||||||
|
{0x2d27, 0x2d27}, //
|
||||||
|
{0x2d2d, 0x2d2d}, //
|
||||||
|
{0xa641, 0xa641}, //
|
||||||
|
{0xa643, 0xa643}, //
|
||||||
|
{0xa645, 0xa645}, //
|
||||||
|
{0xa647, 0xa647}, //
|
||||||
|
{0xa649, 0xa649}, //
|
||||||
|
{0xa64b, 0xa64b}, //
|
||||||
|
{0xa64d, 0xa64d}, //
|
||||||
|
{0xa64f, 0xa64f}, //
|
||||||
|
{0xa651, 0xa651}, //
|
||||||
|
{0xa653, 0xa653}, //
|
||||||
|
{0xa655, 0xa655}, //
|
||||||
|
{0xa657, 0xa657}, //
|
||||||
|
{0xa659, 0xa659}, //
|
||||||
|
{0xa65b, 0xa65b}, //
|
||||||
|
{0xa65d, 0xa65d}, //
|
||||||
|
{0xa65f, 0xa65f}, //
|
||||||
|
{0xa661, 0xa661}, //
|
||||||
|
{0xa663, 0xa663}, //
|
||||||
|
{0xa665, 0xa665}, //
|
||||||
|
{0xa667, 0xa667}, //
|
||||||
|
{0xa669, 0xa669}, //
|
||||||
|
{0xa66b, 0xa66b}, //
|
||||||
|
{0xa66d, 0xa66d}, //
|
||||||
|
{0xa681, 0xa681}, //
|
||||||
|
{0xa683, 0xa683}, //
|
||||||
|
{0xa685, 0xa685}, //
|
||||||
|
{0xa687, 0xa687}, //
|
||||||
|
{0xa689, 0xa689}, //
|
||||||
|
{0xa68b, 0xa68b}, //
|
||||||
|
{0xa68d, 0xa68d}, //
|
||||||
|
{0xa68f, 0xa68f}, //
|
||||||
|
{0xa691, 0xa691}, //
|
||||||
|
{0xa693, 0xa693}, //
|
||||||
|
{0xa695, 0xa695}, //
|
||||||
|
{0xa697, 0xa697}, //
|
||||||
|
{0xa699, 0xa699}, //
|
||||||
|
{0xa69b, 0xa69d}, //
|
||||||
|
{0xa723, 0xa723}, //
|
||||||
|
{0xa725, 0xa725}, //
|
||||||
|
{0xa727, 0xa727}, //
|
||||||
|
{0xa729, 0xa729}, //
|
||||||
|
{0xa72b, 0xa72b}, //
|
||||||
|
{0xa72d, 0xa72d}, //
|
||||||
|
{0xa72f, 0xa731}, //
|
||||||
|
{0xa733, 0xa733}, //
|
||||||
|
{0xa735, 0xa735}, //
|
||||||
|
{0xa737, 0xa737}, //
|
||||||
|
{0xa739, 0xa739}, //
|
||||||
|
{0xa73b, 0xa73b}, //
|
||||||
|
{0xa73d, 0xa73d}, //
|
||||||
|
{0xa73f, 0xa73f}, //
|
||||||
|
{0xa741, 0xa741}, //
|
||||||
|
{0xa743, 0xa743}, //
|
||||||
|
{0xa745, 0xa745}, //
|
||||||
|
{0xa747, 0xa747}, //
|
||||||
|
{0xa749, 0xa749}, //
|
||||||
|
{0xa74b, 0xa74b}, //
|
||||||
|
{0xa74d, 0xa74d}, //
|
||||||
|
{0xa74f, 0xa74f}, //
|
||||||
|
{0xa751, 0xa751}, //
|
||||||
|
{0xa753, 0xa753}, //
|
||||||
|
{0xa755, 0xa755}, //
|
||||||
|
{0xa757, 0xa757}, //
|
||||||
|
{0xa759, 0xa759}, //
|
||||||
|
{0xa75b, 0xa75b}, //
|
||||||
|
{0xa75d, 0xa75d}, //
|
||||||
|
{0xa75f, 0xa75f}, //
|
||||||
|
{0xa761, 0xa761}, //
|
||||||
|
{0xa763, 0xa763}, //
|
||||||
|
{0xa765, 0xa765}, //
|
||||||
|
{0xa767, 0xa767}, //
|
||||||
|
{0xa769, 0xa769}, //
|
||||||
|
{0xa76b, 0xa76b}, //
|
||||||
|
{0xa76d, 0xa76d}, //
|
||||||
|
{0xa76f, 0xa778}, //
|
||||||
|
{0xa77a, 0xa77a}, //
|
||||||
|
{0xa77c, 0xa77c}, //
|
||||||
|
{0xa77f, 0xa77f}, //
|
||||||
|
{0xa781, 0xa781}, //
|
||||||
|
{0xa783, 0xa783}, //
|
||||||
|
{0xa785, 0xa785}, //
|
||||||
|
{0xa787, 0xa787}, //
|
||||||
|
{0xa78c, 0xa78c}, //
|
||||||
|
{0xa78e, 0xa78e}, //
|
||||||
|
{0xa791, 0xa791}, //
|
||||||
|
{0xa793, 0xa795}, //
|
||||||
|
{0xa797, 0xa797}, //
|
||||||
|
{0xa799, 0xa799}, //
|
||||||
|
{0xa79b, 0xa79b}, //
|
||||||
|
{0xa79d, 0xa79d}, //
|
||||||
|
{0xa79f, 0xa79f}, //
|
||||||
|
{0xa7a1, 0xa7a1}, //
|
||||||
|
{0xa7a3, 0xa7a3}, //
|
||||||
|
{0xa7a5, 0xa7a5}, //
|
||||||
|
{0xa7a7, 0xa7a7}, //
|
||||||
|
{0xa7a9, 0xa7a9}, //
|
||||||
|
{0xa7af, 0xa7af}, //
|
||||||
|
{0xa7b5, 0xa7b5}, //
|
||||||
|
{0xa7b7, 0xa7b7}, //
|
||||||
|
{0xa7b9, 0xa7b9}, //
|
||||||
|
{0xa7bb, 0xa7bb}, //
|
||||||
|
{0xa7bd, 0xa7bd}, //
|
||||||
|
{0xa7bf, 0xa7bf}, //
|
||||||
|
{0xa7c1, 0xa7c1}, //
|
||||||
|
{0xa7c3, 0xa7c3}, //
|
||||||
|
{0xa7c8, 0xa7c8}, //
|
||||||
|
{0xa7ca, 0xa7ca}, //
|
||||||
|
{0xa7d1, 0xa7d1}, //
|
||||||
|
{0xa7d3, 0xa7d3}, //
|
||||||
|
{0xa7d5, 0xa7d5}, //
|
||||||
|
{0xa7d7, 0xa7d7}, //
|
||||||
|
{0xa7d9, 0xa7d9}, //
|
||||||
|
{0xa7f2, 0xa7f4}, //
|
||||||
|
{0xa7f6, 0xa7f6}, //
|
||||||
|
{0xa7f8, 0xa7fa}, //
|
||||||
|
{0xab30, 0xab5a}, //
|
||||||
|
{0xab5c, 0xab69}, //
|
||||||
|
{0xab70, 0xabbf}, //
|
||||||
|
{0xfb00, 0xfb06}, //
|
||||||
|
{0xfb13, 0xfb17}, //
|
||||||
|
{0xff41, 0xff5a}, //
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned kLowerAstral[][2] = {
|
||||||
|
{0x10428, 0x1044f}, //
|
||||||
|
{0x104d8, 0x104fb}, //
|
||||||
|
{0x10597, 0x105a1}, //
|
||||||
|
{0x105a3, 0x105b1}, //
|
||||||
|
{0x105b3, 0x105b9}, //
|
||||||
|
{0x105bb, 0x105bc}, //
|
||||||
|
{0x10780, 0x10780}, //
|
||||||
|
{0x10783, 0x10785}, //
|
||||||
|
{0x10787, 0x107b0}, //
|
||||||
|
{0x107b2, 0x107ba}, //
|
||||||
|
{0x10cc0, 0x10cf2}, //
|
||||||
|
{0x118c0, 0x118df}, //
|
||||||
|
{0x16e60, 0x16e7f}, //
|
||||||
|
{0x1d41a, 0x1d433}, //
|
||||||
|
{0x1d44e, 0x1d454}, //
|
||||||
|
{0x1d456, 0x1d467}, //
|
||||||
|
{0x1d482, 0x1d49b}, //
|
||||||
|
{0x1d4b6, 0x1d4b9}, //
|
||||||
|
{0x1d4bb, 0x1d4bb}, //
|
||||||
|
{0x1d4bd, 0x1d4c3}, //
|
||||||
|
{0x1d4c5, 0x1d4cf}, //
|
||||||
|
{0x1d4ea, 0x1d503}, //
|
||||||
|
{0x1d51e, 0x1d537}, //
|
||||||
|
{0x1d552, 0x1d56b}, //
|
||||||
|
{0x1d586, 0x1d59f}, //
|
||||||
|
{0x1d5ba, 0x1d5d3}, //
|
||||||
|
{0x1d5ee, 0x1d607}, //
|
||||||
|
{0x1d622, 0x1d63b}, //
|
||||||
|
{0x1d656, 0x1d66f}, //
|
||||||
|
{0x1d68a, 0x1d6a5}, //
|
||||||
|
{0x1d6c2, 0x1d6da}, //
|
||||||
|
{0x1d6dc, 0x1d6e1}, //
|
||||||
|
{0x1d6fc, 0x1d714}, //
|
||||||
|
{0x1d716, 0x1d71b}, //
|
||||||
|
{0x1d736, 0x1d74e}, //
|
||||||
|
{0x1d750, 0x1d755}, //
|
||||||
|
{0x1d770, 0x1d788}, //
|
||||||
|
{0x1d78a, 0x1d78f}, //
|
||||||
|
{0x1d7aa, 0x1d7c2}, //
|
||||||
|
{0x1d7c4, 0x1d7c9}, //
|
||||||
|
{0x1d7cb, 0x1d7cb}, //
|
||||||
|
{0x1df00, 0x1df09}, //
|
||||||
|
{0x1df0b, 0x1df1e}, //
|
||||||
|
{0x1df25, 0x1df2a}, //
|
||||||
|
{0x1e030, 0x1e06d}, //
|
||||||
|
{0x1e922, 0x1e943}, //
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns nonzero if c is lowercase letter.
|
||||||
|
*/
|
||||||
|
int iswlower(wint_t c) {
|
||||||
|
if (!IsTiny() && c < 128)
|
||||||
|
return 'a' <= c && c <= 'z';
|
||||||
|
if (c < 65536)
|
||||||
|
return has_char(kLower, ARRAYLEN(kLower), (unsigned short)c);
|
||||||
|
return has_char(kLowerAstral, ARRAYLEN(kLowerAstral), (unsigned)c);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(iswlower, iswlower_l);
|
|
@ -22,8 +22,11 @@
|
||||||
* Returns nonzero if c is printable.
|
* Returns nonzero if c is printable.
|
||||||
*/
|
*/
|
||||||
int iswprint(wint_t c) {
|
int iswprint(wint_t c) {
|
||||||
return !((0x00 <= c && c <= 0x1F) || (0x7F <= c && c <= 0x9F) ||
|
return (0 <= c && c <= 0x10FFFD) && // legal unicode
|
||||||
(0xFFF9 <= c && c <= 0xFFFB) || c == 0x2028 || c == 0x2029);
|
!(0x0000 <= c && c <= 0x001F) && // c0 control codes
|
||||||
|
!(0x007F <= c && c <= 0x009F) && // c1 control codes
|
||||||
|
!(0x2028 <= c && c <= 0x2029) && // line / paragraph separator
|
||||||
|
!(0xFFF9 <= c && c <= 0xFFFB); // interlinear annotation controls
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak_reference(iswprint, iswprint_l);
|
__weak_reference(iswprint, iswprint_l);
|
||||||
|
|
|
@ -1,543 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/wctype.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns nonzero if c is punctuation mark.
|
|
||||||
*/
|
|
||||||
int iswpunct(wint_t c) {
|
|
||||||
if (c < 0xa0) {
|
|
||||||
switch (c) {
|
|
||||||
case '!':
|
|
||||||
case '"':
|
|
||||||
case '#':
|
|
||||||
case '$':
|
|
||||||
case '%':
|
|
||||||
case '&':
|
|
||||||
case '\'':
|
|
||||||
case '(':
|
|
||||||
case ')':
|
|
||||||
case '*':
|
|
||||||
case '+':
|
|
||||||
case ',':
|
|
||||||
case '-':
|
|
||||||
case '.':
|
|
||||||
case '/':
|
|
||||||
case ':':
|
|
||||||
case ';':
|
|
||||||
case '<':
|
|
||||||
case '=':
|
|
||||||
case '>':
|
|
||||||
case '?':
|
|
||||||
case '@':
|
|
||||||
case '[':
|
|
||||||
case '\\':
|
|
||||||
case ']':
|
|
||||||
case '^':
|
|
||||||
case '_':
|
|
||||||
case '`':
|
|
||||||
case '{':
|
|
||||||
case '|':
|
|
||||||
case '}':
|
|
||||||
case '~':
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (c) {
|
|
||||||
case u'¡': // INVERTED EXCLAMATION MARK (0x00a1 Po)
|
|
||||||
case u'§': // SECTION SIGN (0x00a7 Po)
|
|
||||||
case u'«': // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (0x00ab Pi)
|
|
||||||
case u'¶': // PILCROW SIGN (0x00b6 Po)
|
|
||||||
case u'·': // MIDDLE DOT (0x00b7 Po)
|
|
||||||
case u'»': // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (0x00bb Pf)
|
|
||||||
case u'¿': // INVERTED QUESTION MARK (0x00bf Po)
|
|
||||||
case u';': // GREEK QUESTION MARK (0x037e Po)
|
|
||||||
case u'·': // GREEK ANO TELEIA (0x0387 Po)
|
|
||||||
case u'՚': // ARMENIAN APOSTROPHE (0x055a Po)
|
|
||||||
case u'՛': // ARMENIAN EMPHASIS MARK (0x055b Po)
|
|
||||||
case u'՜': // ARMENIAN EXCLAMATION MARK (0x055c Po)
|
|
||||||
case u'՝': // ARMENIAN COMMA (0x055d Po)
|
|
||||||
case u'՞': // ARMENIAN QUESTION MARK (0x055e Po)
|
|
||||||
case u'՟': // ARMENIAN ABBREVIATION MARK (0x055f Po)
|
|
||||||
case u'։': // ARMENIAN FULL STOP (0x0589 Po)
|
|
||||||
case u'֊': // ARMENIAN HYPHEN (0x058a Pd)
|
|
||||||
case 0x05be: // HEBREW PUNCTUATION MAQAF (0x05be Pd)
|
|
||||||
case 0x05c0: // HEBREW PUNCTUATION PASEQ (0x05c0 Po)
|
|
||||||
case 0x05c3: // HEBREW PUNCTUATION SOF PASUQ (0x05c3 Po)
|
|
||||||
case 0x05c6: // HEBREW PUNCTUATION NUN HAFUKHA (0x05c6 Po)
|
|
||||||
case 0x05f3: // HEBREW PUNCTUATION GERESH (0x05f3 Po)
|
|
||||||
case 0x05f4: // HEBREW PUNCTUATION GERSHAYIM (0x05f4 Po)
|
|
||||||
case 0x0609: // ARABIC-INDIC PER MILLE SIGN (0x0609 Po)
|
|
||||||
case 0x060a: // ARABIC-INDIC PER TEN THOUSAND SIGN (0x060a Po)
|
|
||||||
case 0x060c: // ARABIC COMMA (0x060c Po)
|
|
||||||
case 0x060d: // ARABIC DATE SEPARATOR (0x060d Po)
|
|
||||||
case 0x061b: // ARABIC SEMICOLON (0x061b Po)
|
|
||||||
case u'؞': // ARABIC TRIPLE DOT PUNCTUATION MARK (0x061e Po)
|
|
||||||
case u'؟': // ARABIC QUESTION MARK (0x061f Po)
|
|
||||||
case u'٪': // ARABIC PERCENT SIGN (0x066a Po)
|
|
||||||
case u'٫': // ARABIC DECIMAL SEPARATOR (0x066b Po)
|
|
||||||
case u'٬': // ARABIC THOUSANDS SEPARATOR (0x066c Po)
|
|
||||||
case u'٭': // ARABIC FIVE POINTED STAR (0x066d Po)
|
|
||||||
case u'۔': // ARABIC FULL STOP (0x06d4 Po)
|
|
||||||
case u'߷': // NKO SYMBOL GBAKURUNEN (0x07f7 Po)
|
|
||||||
case u'߸': // NKO COMMA (0x07f8 Po)
|
|
||||||
case u'߹': // NKO EXCLAMATION MARK (0x07f9 Po)
|
|
||||||
case u'।': // DEVANAGARI DANDA (0x0964 Po)
|
|
||||||
case u'॥': // DEVANAGARI DOUBLE DANDA (0x0965 Po)
|
|
||||||
case u'॰': // DEVANAGARI ABBREVIATION SIGN (0x0970 Po)
|
|
||||||
case 0x09fd: // BENGALI ABBREVIATION SIGN (0x09fd Po)
|
|
||||||
case 0x0a76: // GURMUKHI ABBREVIATION SIGN (0x0a76 Po)
|
|
||||||
case 0x0af0: // GUJARATI ABBREVIATION SIGN (0x0af0 Po)
|
|
||||||
case 0x0c77: // TELUGU SIGN SIDDHAM (0x0c77 Po)
|
|
||||||
case 0x0c84: // KANNADA SIGN SIDDHAM (0x0c84 Po)
|
|
||||||
case u'෴': // SINHALA PUNCTUATION KUNDDALIYA (0x0df4 Po)
|
|
||||||
case u'๏': // THAI CHARACTER FONGMAN (0x0e4f Po)
|
|
||||||
case u'๚': // THAI CHARACTER ANGKHANKHU (0x0e5a Po)
|
|
||||||
case u'๛': // THAI CHARACTER KHOMUT (0x0e5b Po)
|
|
||||||
case u'༄': // TIBETAN MARK INITIAL YIG MGO MDUN MA (0x0f04 Po)
|
|
||||||
case u'༅': // TIBETAN MARK CLOSING YIG MGO SGAB MA (0x0f05 Po)
|
|
||||||
case u'༆': // TIBETAN MARK CARET YIG MGO PHUR SHAD MA (0x0f06 Po)
|
|
||||||
case u'༇': // TIBETAN MARK YIG MGO TSHEG SHAD MA (0x0f07 Po)
|
|
||||||
case u'༈': // TIBETAN MARK SBRUL SHAD (0x0f08 Po)
|
|
||||||
case u'༉': // TIBETAN MARK BSKUR YIG MGO (0x0f09 Po)
|
|
||||||
case u'༊': // TIBETAN MARK BKA- SHOG YIG MGO (0x0f0a Po)
|
|
||||||
case u'་': // TIBETAN MARK INTERSYLLABIC TSHEG (0x0f0b Po)
|
|
||||||
case u'༌': // TIBETAN MARK DELIMITER TSHEG BSTAR (0x0f0c Po)
|
|
||||||
case u'།': // TIBETAN MARK SHAD (0x0f0d Po)
|
|
||||||
case u'༎': // TIBETAN MARK NYIS SHAD (0x0f0e Po)
|
|
||||||
case u'༏': // TIBETAN MARK TSHEG SHAD (0x0f0f Po)
|
|
||||||
case u'༐': // TIBETAN MARK NYIS TSHEG SHAD (0x0f10 Po)
|
|
||||||
case u'༑': // TIBETAN MARK RIN CHEN SPUNGS SHAD (0x0f11 Po)
|
|
||||||
case u'༒': // TIBETAN MARK RGYA GRAM SHAD (0x0f12 Po)
|
|
||||||
case u'༔': // TIBETAN MARK GTER TSHEG (0x0f14 Po)
|
|
||||||
case u'༺': // TIBETAN MARK GUG RTAGS GYON (0x0f3a Ps)
|
|
||||||
case u'༻': // TIBETAN MARK GUG RTAGS GYAS (0x0f3b Pe)
|
|
||||||
case u'༼': // TIBETAN MARK ANG KHANG GYON (0x0f3c Ps)
|
|
||||||
case u'༽': // TIBETAN MARK ANG KHANG GYAS (0x0f3d Pe)
|
|
||||||
case u'྅': // TIBETAN MARK PALUTA (0x0f85 Po)
|
|
||||||
case u'࿐': // TIBETAN MARK BSKA- SHOG GI MGO RGYAN (0x0fd0 Po)
|
|
||||||
case u'࿑': // TIBETAN MARK MNYAM YIG GI MGO RGYAN (0x0fd1 Po)
|
|
||||||
case u'࿒': // TIBETAN MARK NYIS TSHEG (0x0fd2 Po)
|
|
||||||
case u'࿓': // TIBETAN MARK INITIAL BRDA RNYING YIG MGO MDUN MA (0x0fd3 Po)
|
|
||||||
case u'࿔': // TIBETAN MARK CLOSING BRDA RNYING YIG MGO SGAB MA (0x0fd4 Po)
|
|
||||||
case u'࿙': // TIBETAN MARK LEADING MCHAN RTAGS (0x0fd9 Po)
|
|
||||||
case u'࿚': // TIBETAN MARK TRAILING MCHAN RTAGS (0x0fda Po)
|
|
||||||
case u'၊': // MYANMAR SIGN LITTLE SECTION (0x104a Po)
|
|
||||||
case u'။': // MYANMAR SIGN SECTION (0x104b Po)
|
|
||||||
case u'၌': // MYANMAR SYMBOL LOCATIVE (0x104c Po)
|
|
||||||
case u'၍': // MYANMAR SYMBOL COMPLETED (0x104d Po)
|
|
||||||
case u'၎': // MYANMAR SYMBOL AFOREMENTIONED (0x104e Po)
|
|
||||||
case u'၏': // MYANMAR SYMBOL GENITIVE (0x104f Po)
|
|
||||||
case u'჻': // GEORGIAN PARAGRAPH SEPARATOR (0x10fb Po)
|
|
||||||
case u'፠': // ETHIOPIC SECTION MARK (0x1360 Po)
|
|
||||||
case u'፡': // ETHIOPIC WORDSPACE (0x1361 Po)
|
|
||||||
case u'።': // ETHIOPIC FULL STOP (0x1362 Po)
|
|
||||||
case u'፣': // ETHIOPIC COMMA (0x1363 Po)
|
|
||||||
case u'፤': // ETHIOPIC SEMICOLON (0x1364 Po)
|
|
||||||
case u'፥': // ETHIOPIC COLON (0x1365 Po)
|
|
||||||
case u'፦': // ETHIOPIC PREFACE COLON (0x1366 Po)
|
|
||||||
case u'፧': // ETHIOPIC QUESTION MARK (0x1367 Po)
|
|
||||||
case u'፨': // ETHIOPIC PARAGRAPH SEPARATOR (0x1368 Po)
|
|
||||||
case u'᐀': // CANADIAN SYLLABICS HYPHEN (0x1400 Pd)
|
|
||||||
case u'᙮': // CANADIAN SYLLABICS FULL STOP (0x166e Po)
|
|
||||||
case u'᚛': // OGHAM FEATHER MARK (0x169b Ps)
|
|
||||||
case u'᚜': // OGHAM REVERSED FEATHER MARK (0x169c Pe)
|
|
||||||
case u'᛫': // RUNIC SINGLE PUNCTUATION (0x16eb Po)
|
|
||||||
case u'᛬': // RUNIC MULTIPLE PUNCTUATION (0x16ec Po)
|
|
||||||
case u'᛭': // RUNIC CROSS PUNCTUATION (0x16ed Po)
|
|
||||||
case u'᜵': // PHILIPPINE SINGLE PUNCTUATION (0x1735 Po)
|
|
||||||
case u'᜶': // PHILIPPINE DOUBLE PUNCTUATION (0x1736 Po)
|
|
||||||
case u'។': // KHMER SIGN KHAN (0x17d4 Po)
|
|
||||||
case u'៕': // KHMER SIGN BARIYOOSAN (0x17d5 Po)
|
|
||||||
case u'៖': // KHMER SIGN CAMNUC PII KUUH (0x17d6 Po)
|
|
||||||
case u'៘': // KHMER SIGN BEYYAL (0x17d8 Po)
|
|
||||||
case u'៙': // KHMER SIGN PHNAEK MUAN (0x17d9 Po)
|
|
||||||
case u'៚': // KHMER SIGN KOOMUUT (0x17da Po)
|
|
||||||
case u'᠀': // MONGOLIAN BIRGA (0x1800 Po)
|
|
||||||
case u'᠁': // MONGOLIAN ELLIPSIS (0x1801 Po)
|
|
||||||
case u'᠂': // MONGOLIAN COMMA (0x1802 Po)
|
|
||||||
case u'᠃': // MONGOLIAN FULL STOP (0x1803 Po)
|
|
||||||
case u'᠄': // MONGOLIAN COLON (0x1804 Po)
|
|
||||||
case u'᠅': // MONGOLIAN FOUR DOTS (0x1805 Po)
|
|
||||||
case u'᠆': // MONGOLIAN TODO SOFT HYPHEN (0x1806 Pd)
|
|
||||||
case u'᠇': // MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER (0x1807 Po)
|
|
||||||
case u'᠈': // MONGOLIAN MANCHU COMMA (0x1808 Po)
|
|
||||||
case u'᠉': // MONGOLIAN MANCHU FULL STOP (0x1809 Po)
|
|
||||||
case u'᠊': // MONGOLIAN NIRUGU (0x180a Po)
|
|
||||||
case u'᥄': // LIMBU EXCLAMATION MARK (0x1944 Po)
|
|
||||||
case u'᥅': // LIMBU QUESTION MARK (0x1945 Po)
|
|
||||||
case u'᨞': // BUGINESE PALLAWA (0x1a1e Po)
|
|
||||||
case u'᨟': // BUGINESE END OF SECTION (0x1a1f Po)
|
|
||||||
case u'᱾': // OL CHIKI PUNCTUATION MUCAAD (0x1c7e Po)
|
|
||||||
case u'᱿': // OL CHIKI PUNCTUATION DOUBLE MUCAAD (0x1c7f Po)
|
|
||||||
case u'‐': // HYPHEN (0x2010 Pd)
|
|
||||||
case u'‑': // NON-BREAKING HYPHEN (0x2011 Pd)
|
|
||||||
case u'‒': // FIGURE DASH (0x2012 Pd)
|
|
||||||
case u'–': // EN DASH (0x2013 Pd)
|
|
||||||
case u'—': // EM DASH (0x2014 Pd)
|
|
||||||
case u'―': // HORIZONTAL BAR (0x2015 Pd)
|
|
||||||
case u'‖': // DOUBLE VERTICAL LINE (0x2016 Po)
|
|
||||||
case u'‗': // DOUBLE LOW LINE (0x2017 Po)
|
|
||||||
case u'‘': // LEFT SINGLE QUOTATION MARK (0x2018 Pi)
|
|
||||||
case u'’': // RIGHT SINGLE QUOTATION MARK (0x2019 Pf)
|
|
||||||
case u'‚': // SINGLE LOW-9 QUOTATION MARK (0x201a Ps)
|
|
||||||
case u'‛': // SINGLE HIGH-REVERSED-9 QUOTATION MARK (0x201b Pi)
|
|
||||||
case u'“': // LEFT DOUBLE QUOTATION MARK (0x201c Pi)
|
|
||||||
case u'”': // RIGHT DOUBLE QUOTATION MARK (0x201d Pf)
|
|
||||||
case u'„': // DOUBLE LOW-9 QUOTATION MARK (0x201e Ps)
|
|
||||||
case u'‟': // DOUBLE HIGH-REVERSED-9 QUOTATION MARK (0x201f Pi)
|
|
||||||
case u'†': // DAGGER (0x2020 Po)
|
|
||||||
case u'‡': // DOUBLE DAGGER (0x2021 Po)
|
|
||||||
case u'•': // BULLET (0x2022 Po)
|
|
||||||
case u'‣': // TRIANGULAR BULLET (0x2023 Po)
|
|
||||||
case u'․': // ONE DOT LEADER (0x2024 Po)
|
|
||||||
case u'‥': // TWO DOT LEADER (0x2025 Po)
|
|
||||||
case u'…': // HORIZONTAL ELLIPSIS (0x2026 Po)
|
|
||||||
case u'‧': // HYPHENATION POINT (0x2027 Po)
|
|
||||||
case u'‰': // PER MILLE SIGN (0x2030 Po)
|
|
||||||
case u'‱': // PER TEN THOUSAND SIGN (0x2031 Po)
|
|
||||||
case u'′': // PRIME (0x2032 Po)
|
|
||||||
case u'″': // DOUBLE PRIME (0x2033 Po)
|
|
||||||
case u'‴': // TRIPLE PRIME (0x2034 Po)
|
|
||||||
case u'‵': // REVERSED PRIME (0x2035 Po)
|
|
||||||
case u'‶': // REVERSED DOUBLE PRIME (0x2036 Po)
|
|
||||||
case u'‷': // REVERSED TRIPLE PRIME (0x2037 Po)
|
|
||||||
case u'‸': // CARET (0x2038 Po)
|
|
||||||
case u'‹': // SINGLE LEFT-POINTING ANGLE QUOTATION MARK (0x2039 Pi)
|
|
||||||
case u'›': // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (0x203a Pf)
|
|
||||||
case u'※': // REFERENCE MARK (0x203b Po)
|
|
||||||
case u'‼': // DOUBLE EXCLAMATION MARK (0x203c Po)
|
|
||||||
case u'‽': // INTERROBANG (0x203d Po)
|
|
||||||
case u'‾': // OVERLINE (0x203e Po)
|
|
||||||
case u'‿': // UNDERTIE (0x203f Pc)
|
|
||||||
case u'⁀': // CHARACTER TIE (0x2040 Pc)
|
|
||||||
case u'⁁': // CARET INSERTION POINT (0x2041 Po)
|
|
||||||
case u'⁂': // ASTERISM (0x2042 Po)
|
|
||||||
case u'⁃': // HYPHEN BULLET (0x2043 Po)
|
|
||||||
case u'⁅': // LEFT SQUARE BRACKET WITH QUILL (0x2045 Ps)
|
|
||||||
case u'⁆': // RIGHT SQUARE BRACKET WITH QUILL (0x2046 Pe)
|
|
||||||
case u'⁇': // DOUBLE QUESTION MARK (0x2047 Po)
|
|
||||||
case u'⁈': // QUESTION EXCLAMATION MARK (0x2048 Po)
|
|
||||||
case u'⁉': // EXCLAMATION QUESTION MARK (0x2049 Po)
|
|
||||||
case u'⁊': // TIRONIAN SIGN ET (0x204a Po)
|
|
||||||
case u'⁋': // REVERSED PILCROW SIGN (0x204b Po)
|
|
||||||
case u'⁌': // BLACK LEFTWARDS BULLET (0x204c Po)
|
|
||||||
case u'⁍': // BLACK RIGHTWARDS BULLET (0x204d Po)
|
|
||||||
case u'⁎': // LOW ASTERISK (0x204e Po)
|
|
||||||
case u'⁏': // REVERSED SEMICOLON (0x204f Po)
|
|
||||||
case u'⁐': // CLOSE UP (0x2050 Po)
|
|
||||||
case u'⁑': // TWO ASTERISKS ALIGNED VERTICALLY (0x2051 Po)
|
|
||||||
case u'⁓': // SWUNG DASH (0x2053 Po)
|
|
||||||
case u'⁔': // INVERTED UNDERTIE (0x2054 Pc)
|
|
||||||
case u'⁕': // FLOWER PUNCTUATION MARK (0x2055 Po)
|
|
||||||
case u'⁖': // THREE DOT PUNCTUATION (0x2056 Po)
|
|
||||||
case u'⁗': // QUADRUPLE PRIME (0x2057 Po)
|
|
||||||
case u'⁘': // FOUR DOT PUNCTUATION (0x2058 Po)
|
|
||||||
case u'⁙': // FIVE DOT PUNCTUATION (0x2059 Po)
|
|
||||||
case u'⁚': // TWO DOT PUNCTUATION (0x205a Po)
|
|
||||||
case u'⁛': // FOUR DOT MARK (0x205b Po)
|
|
||||||
case u'⁜': // DOTTED CROSS (0x205c Po)
|
|
||||||
case u'⁝': // TRICOLON (0x205d Po)
|
|
||||||
case u'⁞': // VERTICAL FOUR DOTS (0x205e Po)
|
|
||||||
case u'⁽': // SUPERSCRIPT LEFT PARENTHESIS (0x207d Ps)
|
|
||||||
case u'⁾': // SUPERSCRIPT RIGHT PARENTHESIS (0x207e Pe)
|
|
||||||
case u'₍': // SUBSCRIPT LEFT PARENTHESIS (0x208d Ps)
|
|
||||||
case u'₎': // SUBSCRIPT RIGHT PARENTHESIS (0x208e Pe)
|
|
||||||
case u'⌈': // LEFT CEILING (0x2308 Ps)
|
|
||||||
case u'⌉': // RIGHT CEILING (0x2309 Pe)
|
|
||||||
case u'⌊': // LEFT FLOOR (0x230a Ps)
|
|
||||||
case u'⌋': // RIGHT FLOOR (0x230b Pe)
|
|
||||||
case u'〈': // LEFT-POINTING ANGLE BRACKET (0x2329 Ps)
|
|
||||||
case u'〉': // RIGHT-POINTING ANGLE BRACKET (0x232a Pe)
|
|
||||||
case u'❨': // MEDIUM LEFT PARENTHESIS ORNAMENT (0x2768 Ps)
|
|
||||||
case u'❩': // MEDIUM RIGHT PARENTHESIS ORNAMENT (0x2769 Pe)
|
|
||||||
case u'❪': // MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT (0x276a Ps)
|
|
||||||
case u'❫': // MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT (0x276b Pe)
|
|
||||||
case u'❬': // MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT (0x276c Ps)
|
|
||||||
case u'❭': // MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT (0x276d Pe)
|
|
||||||
case u'❮': // HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT (0x276e Ps)
|
|
||||||
case u'❯': // HEAVY RIGHT-POINTING ANGLE QUOT MARK ORNAMENT (0x276f Pe)
|
|
||||||
case u'❰': // HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT (0x2770 Ps)
|
|
||||||
case u'❱': // HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT (0x2771 Pe)
|
|
||||||
case u'❲': // LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT (0x2772 Ps)
|
|
||||||
case u'❳': // LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT (0x2773 Pe)
|
|
||||||
case u'❴': // MEDIUM LEFT CURLY BRACKET ORNAMENT (0x2774 Ps)
|
|
||||||
case u'❵': // MEDIUM RIGHT CURLY BRACKET ORNAMENT (0x2775 Pe)
|
|
||||||
case u'⟅': // LEFT S-SHAPED BAG DELIMITER (0x27c5 Ps)
|
|
||||||
case u'⟆': // RIGHT S-SHAPED BAG DELIMITER (0x27c6 Pe)
|
|
||||||
case u'⟦': // MATHEMATICAL LEFT WHITE SQUARE BRACKET (0x27e6 Ps)
|
|
||||||
case u'⟧': // MATHEMATICAL RIGHT WHITE SQUARE BRACKET (0x27e7 Pe)
|
|
||||||
case u'⟨': // MATHEMATICAL LEFT ANGLE BRACKET (0x27e8 Ps)
|
|
||||||
case u'⟩': // MATHEMATICAL RIGHT ANGLE BRACKET (0x27e9 Pe)
|
|
||||||
case u'⟪': // MATHEMATICAL LEFT DOUBLE ANGLE BRACKET (0x27ea Ps)
|
|
||||||
case u'⟫': // MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET (0x27eb Pe)
|
|
||||||
case u'⟬': // MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET (0x27ec Ps)
|
|
||||||
case u'⟭': // MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET (0x27ed Pe)
|
|
||||||
case u'⟮': // MATHEMATICAL LEFT FLATTENED PARENTHESIS (0x27ee Ps)
|
|
||||||
case u'⟯': // MATHEMATICAL RIGHT FLATTENED PARENTHESIS (0x27ef Pe)
|
|
||||||
case u'⦃': // LEFT WHITE CURLY BRACKET (0x2983 Ps)
|
|
||||||
case u'⦄': // RIGHT WHITE CURLY BRACKET (0x2984 Pe)
|
|
||||||
case u'⦅': // LEFT WHITE PARENTHESIS (0x2985 Ps)
|
|
||||||
case u'⦆': // RIGHT WHITE PARENTHESIS (0x2986 Pe)
|
|
||||||
case u'⦇': // Z NOTATION LEFT IMAGE BRACKET (0x2987 Ps)
|
|
||||||
case u'⦈': // Z NOTATION RIGHT IMAGE BRACKET (0x2988 Pe)
|
|
||||||
case u'⦉': // Z NOTATION LEFT BINDING BRACKET (0x2989 Ps)
|
|
||||||
case u'⦊': // Z NOTATION RIGHT BINDING BRACKET (0x298a Pe)
|
|
||||||
case u'⦋': // LEFT SQUARE BRACKET WITH UNDERBAR (0x298b Ps)
|
|
||||||
case u'⦌': // RIGHT SQUARE BRACKET WITH UNDERBAR (0x298c Pe)
|
|
||||||
case u'⦍': // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER (0x298d Ps)
|
|
||||||
case u'⦎': // RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER (0x298e Pe)
|
|
||||||
case u'⦏': // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER (0x298f Ps)
|
|
||||||
case u'⦐': // RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER (0x2990 Pe)
|
|
||||||
case u'⦑': // LEFT ANGLE BRACKET WITH DOT (0x2991 Ps)
|
|
||||||
case u'⦒': // RIGHT ANGLE BRACKET WITH DOT (0x2992 Pe)
|
|
||||||
case u'⦓': // LEFT ARC LESS-THAN BRACKET (0x2993 Ps)
|
|
||||||
case u'⦔': // RIGHT ARC GREATER-THAN BRACKET (0x2994 Pe)
|
|
||||||
case u'⦗': // LEFT BLACK TORTOISE SHELL BRACKET (0x2997 Ps)
|
|
||||||
case u'⦘': // RIGHT BLACK TORTOISE SHELL BRACKET (0x2998 Pe)
|
|
||||||
case u'⧘': // LEFT WIGGLY FENCE (0x29d8 Ps)
|
|
||||||
case u'⧙': // RIGHT WIGGLY FENCE (0x29d9 Pe)
|
|
||||||
case u'⧚': // LEFT DOUBLE WIGGLY FENCE (0x29da Ps)
|
|
||||||
case u'⧛': // RIGHT DOUBLE WIGGLY FENCE (0x29db Pe)
|
|
||||||
case u'⧼': // LEFT-POINTING CURVED ANGLE BRACKET (0x29fc Ps)
|
|
||||||
case u'⧽': // RIGHT-POINTING CURVED ANGLE BRACKET (0x29fd Pe)
|
|
||||||
case u'⵰': // TIFINAGH SEPARATOR MARK (0x2d70 Po)
|
|
||||||
case u'⸎': // EDITORIAL CORONIS (0x2e0e Po)
|
|
||||||
case u'⸏': // PARAGRAPHOS (0x2e0f Po)
|
|
||||||
case u'⸐': // FORKED PARAGRAPHOS (0x2e10 Po)
|
|
||||||
case u'⸑': // REVERSED FORKED PARAGRAPHOS (0x2e11 Po)
|
|
||||||
case u'⸒': // HYPODIASTOLE (0x2e12 Po)
|
|
||||||
case u'⸓': // DOTTED OBELOS (0x2e13 Po)
|
|
||||||
case u'⸔': // DOWNWARDS ANCORA (0x2e14 Po)
|
|
||||||
case u'⸕': // UPWARDS ANCORA (0x2e15 Po)
|
|
||||||
case u'⸖': // DOTTED RIGHT-POINTING ANGLE (0x2e16 Po)
|
|
||||||
case u'⸗': // DOUBLE OBLIQUE HYPHEN (0x2e17 Pd)
|
|
||||||
case u'⸙': // PALM BRANCH (0x2e19 Po)
|
|
||||||
case u'⸚': // HYPHEN WITH DIAERESIS (0x2e1a Pd)
|
|
||||||
case u'⸛': // TILDE WITH RING ABOVE (0x2e1b Po)
|
|
||||||
case u'⸞': // TILDE WITH DOT ABOVE (0x2e1e Po)
|
|
||||||
case u'⸟': // TILDE WITH DOT BELOW (0x2e1f Po)
|
|
||||||
case u'⸪': // TWO DOTS OVER ONE DOT PUNCTUATION (0x2e2a Po)
|
|
||||||
case u'⸫': // ONE DOT OVER TWO DOTS PUNCTUATION (0x2e2b Po)
|
|
||||||
case u'⸬': // SQUARED FOUR DOT PUNCTUATION (0x2e2c Po)
|
|
||||||
case u'⸭': // FIVE DOT MARK (0x2e2d Po)
|
|
||||||
case u'⸮': // REVERSED QUESTION MARK (0x2e2e Po)
|
|
||||||
case u'⸰': // RING POINT (0x2e30 Po)
|
|
||||||
case u'⸱': // WORD SEPARATOR MIDDLE DOT (0x2e31 Po)
|
|
||||||
case u'⸲': // TURNED COMMA (0x2e32 Po)
|
|
||||||
case u'⸳': // RAISED DOT (0x2e33 Po)
|
|
||||||
case u'⸴': // RAISED COMMA (0x2e34 Po)
|
|
||||||
case u'⸵': // TURNED SEMICOLON (0x2e35 Po)
|
|
||||||
case u'⸶': // DAGGER WITH LEFT GUARD (0x2e36 Po)
|
|
||||||
case u'⸷': // DAGGER WITH RIGHT GUARD (0x2e37 Po)
|
|
||||||
case u'⸸': // TURNED DAGGER (0x2e38 Po)
|
|
||||||
case u'⸹': // TOP HALF SECTION SIGN (0x2e39 Po)
|
|
||||||
case u'⸺': // TWO-EM DASH (0x2e3a Pd)
|
|
||||||
case u'⸻': // THREE-EM DASH (0x2e3b Pd)
|
|
||||||
case u'⸼': // STENOGRAPHIC FULL STOP (0x2e3c Po)
|
|
||||||
case u'⸽': // VERTICAL SIX DOTS (0x2e3d Po)
|
|
||||||
case u'⸾': // WIGGLY VERTICAL LINE (0x2e3e Po)
|
|
||||||
case u'⸿': // CAPITULUM (0x2e3f Po)
|
|
||||||
case u'⹀': // DOUBLE HYPHEN (0x2e40 Pd)
|
|
||||||
case u'⹁': // REVERSED COMMA (0x2e41 Po)
|
|
||||||
case u'⹂': // DOUBLE LOW-REVERSED-9 QUOTATION MARK (0x2e42 Ps)
|
|
||||||
case u'⹃': // DASH WITH LEFT UPTURN (0x2e43 Po)
|
|
||||||
case u'⹄': // DOUBLE SUSPENSION MARK (0x2e44 Po)
|
|
||||||
case u'⹅': // INVERTED LOW KAVYKA (0x2e45 Po)
|
|
||||||
case u'⹆': // INVERTED LOW KAVYKA WITH KAVYKA ABOVE (0x2e46 Po)
|
|
||||||
case u'⹇': // LOW KAVYKA (0x2e47 Po)
|
|
||||||
case u'⹈': // LOW KAVYKA WITH DOT (0x2e48 Po)
|
|
||||||
case u'⹉': // DOUBLE STACKED COMMA (0x2e49 Po)
|
|
||||||
case u'⹊': // DOTTED SOLIDUS (0x2e4a Po)
|
|
||||||
case u'⹋': // TRIPLE DAGGER (0x2e4b Po)
|
|
||||||
case u'⹌': // MEDIEVAL COMMA (0x2e4c Po)
|
|
||||||
case u'⹍': // PARAGRAPHUS MARK (0x2e4d Po)
|
|
||||||
case u'⹎': // PUNCTUS ELEVATUS MARK (0x2e4e Po)
|
|
||||||
case u'⹏': // CORNISH VERSE DIVIDER (0x2e4f Po)
|
|
||||||
case u'、': // IDEOGRAPHIC COMMA (0x3001 Po)
|
|
||||||
case u'。': // IDEOGRAPHIC FULL STOP (0x3002 Po)
|
|
||||||
case u'〃': // DITTO MARK (0x3003 Po)
|
|
||||||
case u'〈': // LEFT ANGLE BRACKET (0x3008 Ps)
|
|
||||||
case u'〉': // RIGHT ANGLE BRACKET (0x3009 Pe)
|
|
||||||
case u'《': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps)
|
|
||||||
case u'》': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe)
|
|
||||||
case u'「': // LEFT CORNER BRACKET (0x300c Ps)
|
|
||||||
case u'」': // RIGHT CORNER BRACKET (0x300d Pe)
|
|
||||||
case u'『': // LEFT WHITE CORNER BRACKET (0x300e Ps)
|
|
||||||
case u'』': // RIGHT WHITE CORNER BRACKET (0x300f Pe)
|
|
||||||
case u'【': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps)
|
|
||||||
case u'】': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe)
|
|
||||||
case u'〔': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps)
|
|
||||||
case u'〕': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe)
|
|
||||||
case u'〖': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps)
|
|
||||||
case u'〗': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe)
|
|
||||||
case u'〘': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps)
|
|
||||||
case u'〙': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe)
|
|
||||||
case u'〚': // LEFT WHITE SQUARE BRACKET (0x301a Ps)
|
|
||||||
case u'〛': // RIGHT WHITE SQUARE BRACKET (0x301b Pe)
|
|
||||||
case u'〜': // WAVE DASH (0x301c Pd)
|
|
||||||
case u'〝': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps)
|
|
||||||
case u'〞': // DOUBLE PRIME QUOTATION MARK (0x301e Pe)
|
|
||||||
case u'〟': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe)
|
|
||||||
case u'〰': // WAVY DASH (0x3030 Pd)
|
|
||||||
case u'〽': // PART ALTERNATION MARK (0x303d Po)
|
|
||||||
case u'゠': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd)
|
|
||||||
case u'・': // KATAKANA MIDDLE DOT (0x30fb Po)
|
|
||||||
case u'꓾': // LISU PUNCTUATION COMMA (0xa4fe Po)
|
|
||||||
case u'꓿': // LISU PUNCTUATION FULL STOP (0xa4ff Po)
|
|
||||||
case u'꘍': // VAI COMMA (0xa60d Po)
|
|
||||||
case u'꘎': // VAI FULL STOP (0xa60e Po)
|
|
||||||
case u'꘏': // VAI QUESTION MARK (0xa60f Po)
|
|
||||||
case u'꙾': // CYRILLIC KAVYKA (0xa67e Po)
|
|
||||||
case u'꡴': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po)
|
|
||||||
case u'꡵': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po)
|
|
||||||
case u'꡶': // PHAGS-PA MARK SHAD (0xa876 Po)
|
|
||||||
case u'꡷': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po)
|
|
||||||
case u'꣎': // SAURASHTRA DANDA (0xa8ce Po)
|
|
||||||
case u'꣏': // SAURASHTRA DOUBLE DANDA (0xa8cf Po)
|
|
||||||
case u'꣸': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po)
|
|
||||||
case u'꣹': // DEVANAGARI GAP FILLER (0xa8f9 Po)
|
|
||||||
case u'꣺': // DEVANAGARI CARET (0xa8fa Po)
|
|
||||||
case u'꣼': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po)
|
|
||||||
case u'꧁': // JAVANESE LEFT RERENGGAN (0xa9c1 Po)
|
|
||||||
case u'꧂': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po)
|
|
||||||
case u'꧃': // JAVANESE PADA ANDAP (0xa9c3 Po)
|
|
||||||
case u'꧄': // JAVANESE PADA MADYA (0xa9c4 Po)
|
|
||||||
case u'꧅': // JAVANESE PADA LUHUR (0xa9c5 Po)
|
|
||||||
case u'꧆': // JAVANESE PADA WINDU (0xa9c6 Po)
|
|
||||||
case u'꧇': // JAVANESE PADA PANGKAT (0xa9c7 Po)
|
|
||||||
case u'꧈': // JAVANESE PADA LINGSA (0xa9c8 Po)
|
|
||||||
case u'꧉': // JAVANESE PADA LUNGSI (0xa9c9 Po)
|
|
||||||
case u'꧊': // JAVANESE PADA ADEG (0xa9ca Po)
|
|
||||||
case u'꧋': // JAVANESE PADA ADEG ADEG (0xa9cb Po)
|
|
||||||
case u'꧌': // JAVANESE PADA PISELEH (0xa9cc Po)
|
|
||||||
case u'꧍': // JAVANESE TURNED PADA PISELEH (0xa9cd Po)
|
|
||||||
case u'꧞': // JAVANESE PADA TIRTA TUMETES (0xa9de Po)
|
|
||||||
case u'꧟': // JAVANESE PADA ISEN-ISEN (0xa9df Po)
|
|
||||||
case u'꩜': // CHAM PUNCTUATION SPIRAL (0xaa5c Po)
|
|
||||||
case u'꩝': // CHAM PUNCTUATION DANDA (0xaa5d Po)
|
|
||||||
case u'꩞': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po)
|
|
||||||
case u'꩟': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po)
|
|
||||||
case u'꫞': // TAI VIET SYMBOL HO HOI (0xaade Po)
|
|
||||||
case u'꫟': // TAI VIET SYMBOL KOI KOI (0xaadf Po)
|
|
||||||
case u'꫰': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po)
|
|
||||||
case u'꫱': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po)
|
|
||||||
case u'꯫': // MEETEI MAYEK CHEIKHEI (0xabeb Po)
|
|
||||||
case u'︐': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po)
|
|
||||||
case u'︑': // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (0xfe11 Po)
|
|
||||||
case u'︒': // PRESENTATION FORM FOR VERTICAL IDEO FULL STOP (0xfe12 Po)
|
|
||||||
case u'︓': // PRESENTATION FORM FOR VERTICAL COLON (0xfe13 Po)
|
|
||||||
case u'︔': // PRESENTATION FORM FOR VERTICAL SEMICOLON (0xfe14 Po)
|
|
||||||
case u'︕': // PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK (0xfe15 Po)
|
|
||||||
case u'︖': // PRESENTATION FORM FOR VERTICAL QUESTION MARK (0xfe16 Po)
|
|
||||||
case u'︗': // PRESENTATION ... LEFT WHITE LENTICULAR BRACKET (0xfe17 Ps)
|
|
||||||
case u'︘': // PRESENTATION ... RIGHT WHITE LENTICULAR BRAKCET (0xfe18 Pe)
|
|
||||||
case u'︙': // PRESENTATION ... VERTICAL HORIZONTAL ELLIPSIS (0xfe19 Po)
|
|
||||||
case u'︰': // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER (0xfe30 Po)
|
|
||||||
case u'︱': // PRESENTATION FORM FOR VERTICAL EM DASH (0xfe31 Pd)
|
|
||||||
case u'︲': // PRESENTATION FORM FOR VERTICAL EN DASH (0xfe32 Pd)
|
|
||||||
case u'︳': // PRESENTATION FORM FOR VERTICAL LOW LINE (0xfe33 Pc)
|
|
||||||
case u'︴': // PRESENTATION FORM FOR VERTICAL WAVY LOW LINE (0xfe34 Pc)
|
|
||||||
case u'︵': // PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS (0xfe35 Ps)
|
|
||||||
case u'︶': // PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS (0xfe36 Pe)
|
|
||||||
case u'︷': // PRESENTATION ... VERTICAL LEFT CURLY BRACKET (0xfe37 Ps)
|
|
||||||
case u'︸': // PRESENTATION ... VERTICAL RIGHT CURLY BRACKET (0xfe38 Pe)
|
|
||||||
case u'︹': // PRESENTATION ... LEFT TORTOISE SHELL BRACKET (0xfe39 Ps)
|
|
||||||
case u'︺': // PRESENTATION ... RIGHT TORTOISE SHELL BRACKET (0xfe3a Pe)
|
|
||||||
case u'︻': // PRESENTATION ... LEFT BLACK LENTICULAR BRACKET (0xfe3b Ps)
|
|
||||||
case u'︼': // PRESENTATION ... RIGHT BLACK LENTICULAR BRACKET (0xfe3c Pe)
|
|
||||||
case u'︽': // PRESENTATION ... LEFT DOUBLE ANGLE BRACKET (0xfe3d Ps)
|
|
||||||
case u'︾': // PRESENTATION ... RIGHT DOUBLE ANGLE BRACKET (0xfe3e Pe)
|
|
||||||
case u'︿': // PRESENTATION ... LEFT ANGLE BRACKET (0xfe3f Ps)
|
|
||||||
case u'﹀': // PRESENTATION ... RIGHT ANGLE BRACKET (0xfe40 Pe)
|
|
||||||
case u'﹁': // PRESENTATION ... LEFT CORNER BRACKET (0xfe41 Ps)
|
|
||||||
case u'﹂': // PRESENTATION ... RIGHT CORNER BRACKET (0xfe42 Pe)
|
|
||||||
case u'﹃': // PRESENTATION ... LEFT WHITE CORNER BRACKET (0xfe43 Ps)
|
|
||||||
case u'﹄': // PRESENTATION ... RIGHT WHITE CORNER BRACKET Pe)
|
|
||||||
case u'﹅': // SESAME DOT (0xfe45 Po)
|
|
||||||
case u'﹆': // WHITE SESAME DOT (0xfe46 Po)
|
|
||||||
case u'﹇': // PRESENTATION ... VERTICAL LEFT SQUARE BRACKET (0xfe47 Ps)
|
|
||||||
case u'﹈': // PRESENTATION ... VERTICAL RIGHT SQUARE BRACKET (0xfe48 Pe)
|
|
||||||
case u'﹉': // DASHED OVERLINE (0xfe49 Po)
|
|
||||||
case u'﹊': // CENTRELINE OVERLINE (0xfe4a Po)
|
|
||||||
case u'﹋': // WAVY OVERLINE (0xfe4b Po)
|
|
||||||
case u'﹌': // DOUBLE WAVY OVERLINE (0xfe4c Po)
|
|
||||||
case u'﹍': // DASHED LOW LINE (0xfe4d Pc)
|
|
||||||
case u'﹎': // CENTRELINE LOW LINE (0xfe4e Pc)
|
|
||||||
case u'﹏': // WAVY LOW LINE (0xfe4f Pc)
|
|
||||||
case u'﹐': // SMALL COMMA (0xfe50 Po)
|
|
||||||
case u'﹑': // SMALL IDEOGRAPHIC COMMA (0xfe51 Po)
|
|
||||||
case u'﹒': // SMALL FULL STOP (0xfe52 Po)
|
|
||||||
case u'﹔': // SMALL SEMICOLON (0xfe54 Po)
|
|
||||||
case u'﹕': // SMALL COLON (0xfe55 Po)
|
|
||||||
case u'﹖': // SMALL QUESTION MARK (0xfe56 Po)
|
|
||||||
case u'﹗': // SMALL EXCLAMATION MARK (0xfe57 Po)
|
|
||||||
case u'﹘': // SMALL EM DASH (0xfe58 Pd)
|
|
||||||
case u'﹙': // SMALL LEFT PARENTHESIS (0xfe59 Ps)
|
|
||||||
case u'﹚': // SMALL RIGHT PARENTHESIS (0xfe5a Pe)
|
|
||||||
case u'﹛': // SMALL LEFT CURLY BRACKET (0xfe5b Ps)
|
|
||||||
case u'﹜': // SMALL RIGHT CURLY BRACKET (0xfe5c Pe)
|
|
||||||
case u'﹝': // SMALL LEFT TORTOISE SHELL BRACKET (0xfe5d Ps)
|
|
||||||
case u'﹞': // SMALL RIGHT TORTOISE SHELL BRACKET (0xfe5e Pe)
|
|
||||||
case u'﹟': // SMALL NUMBER SIGN (0xfe5f Po)
|
|
||||||
case u'﹠': // SMALL AMPERSAND (0xfe60 Po)
|
|
||||||
case u'﹡': // SMALL ASTERISK (0xfe61 Po)
|
|
||||||
case u'﹣': // SMALL HYPHEN-MINUS (0xfe63 Pd)
|
|
||||||
case u'﹨': // SMALL REVERSE SOLIDUS (0xfe68 Po)
|
|
||||||
case u'﹪': // SMALL PERCENT SIGN (0xfe6a Po)
|
|
||||||
case u'﹫': // SMALL COMMERCIAL AT (0xfe6b Po)
|
|
||||||
case u'!': // FULLWIDTH EXCLAMATION MARK (0xff01 Po)
|
|
||||||
case u'"': // FULLWIDTH QUOTATION MARK (0xff02 Po)
|
|
||||||
case u'#': // FULLWIDTH NUMBER SIGN (0xff03 Po)
|
|
||||||
case u'%': // FULLWIDTH PERCENT SIGN (0xff05 Po)
|
|
||||||
case u'&': // FULLWIDTH AMPERSAND (0xff06 Po)
|
|
||||||
case u''': // FULLWIDTH APOSTROPHE (0xff07 Po)
|
|
||||||
case u'(': // FULLWIDTH LEFT PARENTHESIS (0xff08 Ps)
|
|
||||||
case u')': // FULLWIDTH RIGHT PARENTHESIS (0xff09 Pe)
|
|
||||||
case u'*': // FULLWIDTH ASTERISK (0xff0a Po)
|
|
||||||
case u',': // FULLWIDTH COMMA (0xff0c Po)
|
|
||||||
case u'-': // FULLWIDTH HYPHEN-MINUS (0xff0d Pd)
|
|
||||||
case u'.': // FULLWIDTH FULL STOP (0xff0e Po)
|
|
||||||
case u'/': // FULLWIDTH SOLIDUS (0xff0f Po)
|
|
||||||
case u':': // FULLWIDTH COLON (0xff1a Po)
|
|
||||||
case u';': // FULLWIDTH SEMICOLON (0xff1b Po)
|
|
||||||
case u'?': // FULLWIDTH QUESTION MARK (0xff1f Po)
|
|
||||||
case u'@': // FULLWIDTH COMMERCIAL AT (0xff20 Po)
|
|
||||||
case u'[': // FULLWIDTH LEFT SQUARE BRACKET (0xff3b Ps)
|
|
||||||
case u'\': // FULLWIDTH REVERSE SOLIDUS (0xff3c Po)
|
|
||||||
case u']': // FULLWIDTH RIGHT SQUARE BRACKET (0xff3d Pe)
|
|
||||||
case u'_': // FULLWIDTH LOW LINE (0xff3f Pc)
|
|
||||||
case u'{': // FULLWIDTH LEFT CURLY BRACKET (0xff5b Ps)
|
|
||||||
case u'}': // FULLWIDTH RIGHT CURLY BRACKET (0xff5d Pe)
|
|
||||||
case u'⦅': // FULLWIDTH LEFT WHITE PARENTHESIS (0xff5f Ps)
|
|
||||||
case u'⦆': // FULLWIDTH RIGHT WHITE PARENTHESIS (0xff60 Pe)
|
|
||||||
case u'。': // HALFWIDTH IDEOGRAPHIC FULL STOP (0xff61 Po)
|
|
||||||
case u'「': // HALFWIDTH LEFT CORNER BRACKET (0xff62 Ps)
|
|
||||||
case u'」': // HALFWIDTH RIGHT CORNER BRACKET (0xff63 Pe)
|
|
||||||
case u'、': // HALFWIDTH IDEOGRAPHIC COMMA (0xff64 Po)
|
|
||||||
case u'・': // HALFWIDTH KATAKANA MIDDLE DOT (0xff65 Po)
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak_reference(iswpunct, iswpunct_l);
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
/*-*-mode:c++;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8-*-│
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
│ vi: set et ft=c++ ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
│ │
|
│ │
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
@ -16,9 +16,11 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/macros.h"
|
||||||
|
#include "libc/str/has_char.h"
|
||||||
#include "libc/wctype.h"
|
#include "libc/wctype.h"
|
||||||
|
|
||||||
static const unsigned short kCodes[][2] = {
|
static const unsigned short kSeparators[][2] = {
|
||||||
{0x00aa, 0x00aa}, /* 1x English */
|
{0x00aa, 0x00aa}, /* 1x English */
|
||||||
{0x00b2, 0x00b3}, /* 2x English Arabic */
|
{0x00b2, 0x00b3}, /* 2x English Arabic */
|
||||||
{0x00b5, 0x00b5}, /* 1x Greek */
|
{0x00b5, 0x00b5}, /* 1x Greek */
|
||||||
|
@ -172,7 +174,7 @@ static const unsigned short kCodes[][2] = {
|
||||||
{0xffda, 0xffdc}, /* 3x Dubs */
|
{0xffda, 0xffdc}, /* 3x Dubs */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned kAstralCodes[][2] = {
|
static const unsigned kAstralSeparators[][2] = {
|
||||||
{0x10107, 0x10133}, /* 45x Aegean */
|
{0x10107, 0x10133}, /* 45x Aegean */
|
||||||
{0x10140, 0x10178}, /* 57x Ancient Greek Numbers */
|
{0x10140, 0x10178}, /* 57x Ancient Greek Numbers */
|
||||||
{0x1018a, 0x1018b}, /* 2x Ancient Greek Numbers */
|
{0x1018a, 0x1018b}, /* 2x Ancient Greek Numbers */
|
||||||
|
@ -390,34 +392,11 @@ static const unsigned kAstralCodes[][2] = {
|
||||||
* other things like blocks and emoji (So).
|
* other things like blocks and emoji (So).
|
||||||
*/
|
*/
|
||||||
int iswseparator(wint_t c) {
|
int iswseparator(wint_t c) {
|
||||||
int m, l, r, n;
|
if (c < 128)
|
||||||
if (c < 0200) {
|
return !(('0' <= c && c <= '9') || //
|
||||||
return !(('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') ||
|
('A' <= c && c <= 'Z') || //
|
||||||
('a' <= c && c <= 'z'));
|
('a' <= c && c <= 'z'));
|
||||||
}
|
if (c < 65536)
|
||||||
if (c <= 0xffff) {
|
return has_char(kSeparators, ARRAYLEN(kSeparators), (unsigned short)c);
|
||||||
l = 0;
|
return has_char(kAstralSeparators, ARRAYLEN(kAstralSeparators), (unsigned)c);
|
||||||
r = n = sizeof(kCodes) / sizeof(kCodes[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kCodes[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !(l < n && kCodes[l][0] <= c && c <= kCodes[l][1]);
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kAstralCodes) / sizeof(kAstralCodes[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kAstralCodes[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !(l < n && kAstralCodes[l][0] <= c && c <= kAstralCodes[l][1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -41,7 +41,6 @@ int iswspace(wint_t c) {
|
||||||
case 0x2004: // THREE-PER-EM SPACE (Zs)
|
case 0x2004: // THREE-PER-EM SPACE (Zs)
|
||||||
case 0x2005: // FOUR-PER-EM SPACE (Zs)
|
case 0x2005: // FOUR-PER-EM SPACE (Zs)
|
||||||
case 0x2006: // SIX-PER-EM SPACE (Zs)
|
case 0x2006: // SIX-PER-EM SPACE (Zs)
|
||||||
case 0x2007: // FIGURE SPACE (Zs)
|
|
||||||
case 0x2008: // PUNCTUATION SPACE (Zs)
|
case 0x2008: // PUNCTUATION SPACE (Zs)
|
||||||
case 0x2009: // THIN SPACE (Zs)
|
case 0x2009: // THIN SPACE (Zs)
|
||||||
case 0x200a: // HAIR SPACE (Zs)
|
case 0x200a: // HAIR SPACE (Zs)
|
||||||
|
|
|
@ -1,164 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/wctype.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns nonzero if c is uppercase letter.
|
|
||||||
*/
|
|
||||||
int iswupper(wint_t c) {
|
|
||||||
if (c < 0200) {
|
|
||||||
return 'A' <= c && c <= 'Z';
|
|
||||||
} else {
|
|
||||||
if (towlower(c) != c)
|
|
||||||
return 1;
|
|
||||||
switch (c) {
|
|
||||||
case 0x03d2: /* ϒ Greek */
|
|
||||||
case 0x03d3: /* ϓ Greek */
|
|
||||||
case 0x03d4: /* ϔ Greek */
|
|
||||||
case 0x2102: /* ℂ Letterlike */
|
|
||||||
case 0x2107: /* ℇ Letterlike */
|
|
||||||
case 0x210b: /* ℋ Letterlike */
|
|
||||||
case 0x210c: /* ℌ Letterlike */
|
|
||||||
case 0x210d: /* ℍ Letterlike */
|
|
||||||
case 0x2110: /* ℐ Letterlike */
|
|
||||||
case 0x2111: /* ℑ Letterlike */
|
|
||||||
case 0x2112: /* ℒ Letterlike */
|
|
||||||
case 0x2115: /* ℕ Letterlike */
|
|
||||||
case 0x2119: /* ℙ Letterlike */
|
|
||||||
case 0x211a: /* ℚ Letterlike */
|
|
||||||
case 0x211b: /* ℛ Letterlike */
|
|
||||||
case 0x211c: /* ℜ Letterlike */
|
|
||||||
case 0x211d: /* ℝ Letterlike */
|
|
||||||
case 0x2124: /* ℤ Letterlike */
|
|
||||||
case 0x2128: /* ℨ Letterlike */
|
|
||||||
case 0x212c: /* ℬ Letterlike */
|
|
||||||
case 0x212d: /* ℭ Letterlike */
|
|
||||||
case 0x2130: /* ℰ Letterlike */
|
|
||||||
case 0x2131: /* ℱ Letterlike */
|
|
||||||
case 0x2133: /* ℳ Letterlike */
|
|
||||||
case 0x213e: /* ℾ Letterlike */
|
|
||||||
case 0x213f: /* ℿ Letterlike */
|
|
||||||
case 0x2145: /* ⅅ Letterlike */
|
|
||||||
case 0x1d434: /* 𝐴 Math */
|
|
||||||
case 0x1d435: /* 𝐵 Math */
|
|
||||||
case 0x1d436: /* 𝐶 Math */
|
|
||||||
case 0x1d437: /* 𝐷 Math */
|
|
||||||
case 0x1d438: /* 𝐸 Math */
|
|
||||||
case 0x1d439: /* 𝐹 Math */
|
|
||||||
case 0x1d43a: /* 𝐺 Math */
|
|
||||||
case 0x1d43b: /* 𝐻 Math */
|
|
||||||
case 0x1d49c: /* 𝒜 Math */
|
|
||||||
case 0x1d49e: /* 𝒞 Math */
|
|
||||||
case 0x1d49f: /* 𝒟 Math */
|
|
||||||
case 0x1d4a2: /* 𝒢 Math */
|
|
||||||
case 0x1d4a5: /* 𝒥 Math */
|
|
||||||
case 0x1d4a6: /* 𝒦 Math */
|
|
||||||
case 0x1d4a9: /* 𝒩 Math */
|
|
||||||
case 0x1d4aa: /* 𝒪 Math */
|
|
||||||
case 0x1d4ab: /* 𝒫 Math */
|
|
||||||
case 0x1d4ac: /* 𝒬 Math */
|
|
||||||
case 0x1d504: /* 𝔄 Math */
|
|
||||||
case 0x1d505: /* 𝔅 Math */
|
|
||||||
case 0x1d507: /* 𝔇 Math */
|
|
||||||
case 0x1d508: /* 𝔈 Math */
|
|
||||||
case 0x1d509: /* 𝔉 Math */
|
|
||||||
case 0x1d50a: /* 𝔊 Math */
|
|
||||||
case 0x1d516: /* 𝔖 Math */
|
|
||||||
case 0x1d517: /* 𝔗 Math */
|
|
||||||
case 0x1d518: /* 𝔘 Math */
|
|
||||||
case 0x1d519: /* 𝔙 Math */
|
|
||||||
case 0x1d51a: /* 𝔚 Math */
|
|
||||||
case 0x1d51b: /* 𝔛 Math */
|
|
||||||
case 0x1d51c: /* 𝔜 Math */
|
|
||||||
case 0x1d538: /* 𝔸 Math */
|
|
||||||
case 0x1d539: /* 𝔹 Math */
|
|
||||||
case 0x1d53b: /* 𝔻 Math */
|
|
||||||
case 0x1d53c: /* 𝔼 Math */
|
|
||||||
case 0x1d53d: /* 𝔽 Math */
|
|
||||||
case 0x1d53e: /* 𝔾 Math */
|
|
||||||
case 0x1d540: /* 𝕀 Math */
|
|
||||||
case 0x1d541: /* 𝕁 Math */
|
|
||||||
case 0x1d542: /* 𝕂 Math */
|
|
||||||
case 0x1d543: /* 𝕃 Math */
|
|
||||||
case 0x1d544: /* 𝕄 Math */
|
|
||||||
case 0x1d546: /* 𝕆 Math */
|
|
||||||
case 0x1d54a: /* 𝕊 Math */
|
|
||||||
case 0x1d54b: /* 𝕋 Math */
|
|
||||||
case 0x1d54c: /* 𝕌 Math */
|
|
||||||
case 0x1d54d: /* 𝕍 Math */
|
|
||||||
case 0x1d54e: /* 𝕎 Math */
|
|
||||||
case 0x1d54f: /* 𝕏 Math */
|
|
||||||
case 0x1d550: /* 𝕐 Math */
|
|
||||||
case 0x1d6e3: /* 𝛣 Math */
|
|
||||||
case 0x1d6e4: /* 𝛤 Math */
|
|
||||||
case 0x1d6e5: /* 𝛥 Math */
|
|
||||||
case 0x1d6e6: /* 𝛦 Math */
|
|
||||||
case 0x1d6e7: /* 𝛧 Math */
|
|
||||||
case 0x1d6e8: /* 𝛨 Math */
|
|
||||||
case 0x1d6e9: /* 𝛩 Math */
|
|
||||||
case 0x1d6ea: /* 𝛪 Math */
|
|
||||||
case 0x1d6eb: /* 𝛫 Math */
|
|
||||||
case 0x1d6ec: /* 𝛬 Math */
|
|
||||||
case 0x1d6ed: /* 𝛭 Math */
|
|
||||||
case 0x1d6ee: /* 𝛮 Math */
|
|
||||||
case 0x1d6ef: /* 𝛯 Math */
|
|
||||||
case 0x1d6f0: /* 𝛰 Math */
|
|
||||||
case 0x1d6f1: /* 𝛱 Math */
|
|
||||||
case 0x1d6f2: /* 𝛲 Math */
|
|
||||||
case 0x1d6f3: /* 𝛳 Math */
|
|
||||||
case 0x1d6f4: /* 𝛴 Math */
|
|
||||||
case 0x1d6f5: /* 𝛵 Math */
|
|
||||||
case 0x1d6f6: /* 𝛶 Math */
|
|
||||||
case 0x1d6f7: /* 𝛷 Math */
|
|
||||||
case 0x1d6f8: /* 𝛸 Math */
|
|
||||||
case 0x1d6f9: /* 𝛹 Math */
|
|
||||||
case 0x1d6fa: /* 𝛺 Math */
|
|
||||||
case 0x1d72d: /* 𝜭 Math */
|
|
||||||
case 0x1d72e: /* 𝜮 Math */
|
|
||||||
case 0x1d72f: /* 𝜯 Math */
|
|
||||||
case 0x1d730: /* 𝜰 Math */
|
|
||||||
case 0x1d731: /* 𝜱 Math */
|
|
||||||
case 0x1d732: /* 𝜲 Math */
|
|
||||||
case 0x1d733: /* 𝜳 Math */
|
|
||||||
case 0x1d734: /* 𝜴 Math */
|
|
||||||
case 0x1d767: /* 𝝧 Math */
|
|
||||||
case 0x1d768: /* 𝝨 Math */
|
|
||||||
case 0x1d769: /* 𝝩 Math */
|
|
||||||
case 0x1d76a: /* 𝝪 Math */
|
|
||||||
case 0x1d76b: /* 𝝫 Math */
|
|
||||||
case 0x1d76c: /* 𝝬 Math */
|
|
||||||
case 0x1d76d: /* 𝝭 Math */
|
|
||||||
case 0x1d76e: /* 𝝮 Math */
|
|
||||||
case 0x1d7a1: /* 𝞡 Math */
|
|
||||||
case 0x1d7a2: /* 𝞢 Math */
|
|
||||||
case 0x1d7a3: /* 𝞣 Math */
|
|
||||||
case 0x1d7a4: /* 𝞤 Math */
|
|
||||||
case 0x1d7a5: /* 𝞥 Math */
|
|
||||||
case 0x1d7a6: /* 𝞦 Math */
|
|
||||||
case 0x1d7a7: /* 𝞧 Math */
|
|
||||||
case 0x1d7a8: /* 𝞨 Math */
|
|
||||||
case 0x1d7ca: /* 𝟊 Math */
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak_reference(iswupper, iswupper_l);
|
|
695
libc/str/iswupper.cc
Normal file
695
libc/str/iswupper.cc
Normal file
|
@ -0,0 +1,695 @@
|
||||||
|
/*-*-mode:c++;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8-*-│
|
||||||
|
│ vi: set et ft=c++ ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
|
│ │
|
||||||
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
│ above copyright notice and this permission notice appear in all copies. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||||
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||||
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||||
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||||
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||||
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||||
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/dce.h"
|
||||||
|
#include "libc/macros.h"
|
||||||
|
#include "libc/str/has_char.h"
|
||||||
|
#include "libc/wctype.h"
|
||||||
|
|
||||||
|
static const unsigned short kUpper[][2] = {
|
||||||
|
{0x41, 0x5a}, //
|
||||||
|
{0xc0, 0xd6}, //
|
||||||
|
{0xd8, 0xde}, //
|
||||||
|
{0x100, 0x100}, //
|
||||||
|
{0x102, 0x102}, //
|
||||||
|
{0x104, 0x104}, //
|
||||||
|
{0x106, 0x106}, //
|
||||||
|
{0x108, 0x108}, //
|
||||||
|
{0x10a, 0x10a}, //
|
||||||
|
{0x10c, 0x10c}, //
|
||||||
|
{0x10e, 0x10e}, //
|
||||||
|
{0x110, 0x110}, //
|
||||||
|
{0x112, 0x112}, //
|
||||||
|
{0x114, 0x114}, //
|
||||||
|
{0x116, 0x116}, //
|
||||||
|
{0x118, 0x118}, //
|
||||||
|
{0x11a, 0x11a}, //
|
||||||
|
{0x11c, 0x11c}, //
|
||||||
|
{0x11e, 0x11e}, //
|
||||||
|
{0x120, 0x120}, //
|
||||||
|
{0x122, 0x122}, //
|
||||||
|
{0x124, 0x124}, //
|
||||||
|
{0x126, 0x126}, //
|
||||||
|
{0x128, 0x128}, //
|
||||||
|
{0x12a, 0x12a}, //
|
||||||
|
{0x12c, 0x12c}, //
|
||||||
|
{0x12e, 0x12e}, //
|
||||||
|
{0x130, 0x130}, //
|
||||||
|
{0x132, 0x132}, //
|
||||||
|
{0x134, 0x134}, //
|
||||||
|
{0x136, 0x136}, //
|
||||||
|
{0x139, 0x139}, //
|
||||||
|
{0x13b, 0x13b}, //
|
||||||
|
{0x13d, 0x13d}, //
|
||||||
|
{0x13f, 0x13f}, //
|
||||||
|
{0x141, 0x141}, //
|
||||||
|
{0x143, 0x143}, //
|
||||||
|
{0x145, 0x145}, //
|
||||||
|
{0x147, 0x147}, //
|
||||||
|
{0x14a, 0x14a}, //
|
||||||
|
{0x14c, 0x14c}, //
|
||||||
|
{0x14e, 0x14e}, //
|
||||||
|
{0x150, 0x150}, //
|
||||||
|
{0x152, 0x152}, //
|
||||||
|
{0x154, 0x154}, //
|
||||||
|
{0x156, 0x156}, //
|
||||||
|
{0x158, 0x158}, //
|
||||||
|
{0x15a, 0x15a}, //
|
||||||
|
{0x15c, 0x15c}, //
|
||||||
|
{0x15e, 0x15e}, //
|
||||||
|
{0x160, 0x160}, //
|
||||||
|
{0x162, 0x162}, //
|
||||||
|
{0x164, 0x164}, //
|
||||||
|
{0x166, 0x166}, //
|
||||||
|
{0x168, 0x168}, //
|
||||||
|
{0x16a, 0x16a}, //
|
||||||
|
{0x16c, 0x16c}, //
|
||||||
|
{0x16e, 0x16e}, //
|
||||||
|
{0x170, 0x170}, //
|
||||||
|
{0x172, 0x172}, //
|
||||||
|
{0x174, 0x174}, //
|
||||||
|
{0x176, 0x176}, //
|
||||||
|
{0x178, 0x179}, //
|
||||||
|
{0x17b, 0x17b}, //
|
||||||
|
{0x17d, 0x17d}, //
|
||||||
|
{0x181, 0x182}, //
|
||||||
|
{0x184, 0x184}, //
|
||||||
|
{0x186, 0x187}, //
|
||||||
|
{0x189, 0x18b}, //
|
||||||
|
{0x18e, 0x191}, //
|
||||||
|
{0x193, 0x194}, //
|
||||||
|
{0x196, 0x198}, //
|
||||||
|
{0x19c, 0x19d}, //
|
||||||
|
{0x19f, 0x1a0}, //
|
||||||
|
{0x1a2, 0x1a2}, //
|
||||||
|
{0x1a4, 0x1a4}, //
|
||||||
|
{0x1a6, 0x1a7}, //
|
||||||
|
{0x1a9, 0x1a9}, //
|
||||||
|
{0x1ac, 0x1ac}, //
|
||||||
|
{0x1ae, 0x1af}, //
|
||||||
|
{0x1b1, 0x1b3}, //
|
||||||
|
{0x1b5, 0x1b5}, //
|
||||||
|
{0x1b7, 0x1b8}, //
|
||||||
|
{0x1bc, 0x1bc}, //
|
||||||
|
{0x1c4, 0x1c5}, //
|
||||||
|
{0x1c7, 0x1c8}, //
|
||||||
|
{0x1ca, 0x1cb}, //
|
||||||
|
{0x1cd, 0x1cd}, //
|
||||||
|
{0x1cf, 0x1cf}, //
|
||||||
|
{0x1d1, 0x1d1}, //
|
||||||
|
{0x1d3, 0x1d3}, //
|
||||||
|
{0x1d5, 0x1d5}, //
|
||||||
|
{0x1d7, 0x1d7}, //
|
||||||
|
{0x1d9, 0x1d9}, //
|
||||||
|
{0x1db, 0x1db}, //
|
||||||
|
{0x1de, 0x1de}, //
|
||||||
|
{0x1e0, 0x1e0}, //
|
||||||
|
{0x1e2, 0x1e2}, //
|
||||||
|
{0x1e4, 0x1e4}, //
|
||||||
|
{0x1e6, 0x1e6}, //
|
||||||
|
{0x1e8, 0x1e8}, //
|
||||||
|
{0x1ea, 0x1ea}, //
|
||||||
|
{0x1ec, 0x1ec}, //
|
||||||
|
{0x1ee, 0x1ee}, //
|
||||||
|
{0x1f1, 0x1f2}, //
|
||||||
|
{0x1f4, 0x1f4}, //
|
||||||
|
{0x1f6, 0x1f8}, //
|
||||||
|
{0x1fa, 0x1fa}, //
|
||||||
|
{0x1fc, 0x1fc}, //
|
||||||
|
{0x1fe, 0x1fe}, //
|
||||||
|
{0x200, 0x200}, //
|
||||||
|
{0x202, 0x202}, //
|
||||||
|
{0x204, 0x204}, //
|
||||||
|
{0x206, 0x206}, //
|
||||||
|
{0x208, 0x208}, //
|
||||||
|
{0x20a, 0x20a}, //
|
||||||
|
{0x20c, 0x20c}, //
|
||||||
|
{0x20e, 0x20e}, //
|
||||||
|
{0x210, 0x210}, //
|
||||||
|
{0x212, 0x212}, //
|
||||||
|
{0x214, 0x214}, //
|
||||||
|
{0x216, 0x216}, //
|
||||||
|
{0x218, 0x218}, //
|
||||||
|
{0x21a, 0x21a}, //
|
||||||
|
{0x21c, 0x21c}, //
|
||||||
|
{0x21e, 0x21e}, //
|
||||||
|
{0x220, 0x220}, //
|
||||||
|
{0x222, 0x222}, //
|
||||||
|
{0x224, 0x224}, //
|
||||||
|
{0x226, 0x226}, //
|
||||||
|
{0x228, 0x228}, //
|
||||||
|
{0x22a, 0x22a}, //
|
||||||
|
{0x22c, 0x22c}, //
|
||||||
|
{0x22e, 0x22e}, //
|
||||||
|
{0x230, 0x230}, //
|
||||||
|
{0x232, 0x232}, //
|
||||||
|
{0x23a, 0x23b}, //
|
||||||
|
{0x23d, 0x23e}, //
|
||||||
|
{0x241, 0x241}, //
|
||||||
|
{0x243, 0x246}, //
|
||||||
|
{0x248, 0x248}, //
|
||||||
|
{0x24a, 0x24a}, //
|
||||||
|
{0x24c, 0x24c}, //
|
||||||
|
{0x24e, 0x24e}, //
|
||||||
|
{0x370, 0x370}, //
|
||||||
|
{0x372, 0x372}, //
|
||||||
|
{0x376, 0x376}, //
|
||||||
|
{0x37f, 0x37f}, //
|
||||||
|
{0x386, 0x386}, //
|
||||||
|
{0x388, 0x38a}, //
|
||||||
|
{0x38c, 0x38c}, //
|
||||||
|
{0x38e, 0x38f}, //
|
||||||
|
{0x391, 0x3a1}, //
|
||||||
|
{0x3a3, 0x3ab}, //
|
||||||
|
{0x3cf, 0x3cf}, //
|
||||||
|
{0x3d2, 0x3d4}, //
|
||||||
|
{0x3d8, 0x3d8}, //
|
||||||
|
{0x3da, 0x3da}, //
|
||||||
|
{0x3dc, 0x3dc}, //
|
||||||
|
{0x3de, 0x3de}, //
|
||||||
|
{0x3e0, 0x3e0}, //
|
||||||
|
{0x3e2, 0x3e2}, //
|
||||||
|
{0x3e4, 0x3e4}, //
|
||||||
|
{0x3e6, 0x3e6}, //
|
||||||
|
{0x3e8, 0x3e8}, //
|
||||||
|
{0x3ea, 0x3ea}, //
|
||||||
|
{0x3ec, 0x3ec}, //
|
||||||
|
{0x3ee, 0x3ee}, //
|
||||||
|
{0x3f4, 0x3f4}, //
|
||||||
|
{0x3f7, 0x3f7}, //
|
||||||
|
{0x3f9, 0x3fa}, //
|
||||||
|
{0x3fd, 0x42f}, //
|
||||||
|
{0x460, 0x460}, //
|
||||||
|
{0x462, 0x462}, //
|
||||||
|
{0x464, 0x464}, //
|
||||||
|
{0x466, 0x466}, //
|
||||||
|
{0x468, 0x468}, //
|
||||||
|
{0x46a, 0x46a}, //
|
||||||
|
{0x46c, 0x46c}, //
|
||||||
|
{0x46e, 0x46e}, //
|
||||||
|
{0x470, 0x470}, //
|
||||||
|
{0x472, 0x472}, //
|
||||||
|
{0x474, 0x474}, //
|
||||||
|
{0x476, 0x476}, //
|
||||||
|
{0x478, 0x478}, //
|
||||||
|
{0x47a, 0x47a}, //
|
||||||
|
{0x47c, 0x47c}, //
|
||||||
|
{0x47e, 0x47e}, //
|
||||||
|
{0x480, 0x480}, //
|
||||||
|
{0x48a, 0x48a}, //
|
||||||
|
{0x48c, 0x48c}, //
|
||||||
|
{0x48e, 0x48e}, //
|
||||||
|
{0x490, 0x490}, //
|
||||||
|
{0x492, 0x492}, //
|
||||||
|
{0x494, 0x494}, //
|
||||||
|
{0x496, 0x496}, //
|
||||||
|
{0x498, 0x498}, //
|
||||||
|
{0x49a, 0x49a}, //
|
||||||
|
{0x49c, 0x49c}, //
|
||||||
|
{0x49e, 0x49e}, //
|
||||||
|
{0x4a0, 0x4a0}, //
|
||||||
|
{0x4a2, 0x4a2}, //
|
||||||
|
{0x4a4, 0x4a4}, //
|
||||||
|
{0x4a6, 0x4a6}, //
|
||||||
|
{0x4a8, 0x4a8}, //
|
||||||
|
{0x4aa, 0x4aa}, //
|
||||||
|
{0x4ac, 0x4ac}, //
|
||||||
|
{0x4ae, 0x4ae}, //
|
||||||
|
{0x4b0, 0x4b0}, //
|
||||||
|
{0x4b2, 0x4b2}, //
|
||||||
|
{0x4b4, 0x4b4}, //
|
||||||
|
{0x4b6, 0x4b6}, //
|
||||||
|
{0x4b8, 0x4b8}, //
|
||||||
|
{0x4ba, 0x4ba}, //
|
||||||
|
{0x4bc, 0x4bc}, //
|
||||||
|
{0x4be, 0x4be}, //
|
||||||
|
{0x4c0, 0x4c1}, //
|
||||||
|
{0x4c3, 0x4c3}, //
|
||||||
|
{0x4c5, 0x4c5}, //
|
||||||
|
{0x4c7, 0x4c7}, //
|
||||||
|
{0x4c9, 0x4c9}, //
|
||||||
|
{0x4cb, 0x4cb}, //
|
||||||
|
{0x4cd, 0x4cd}, //
|
||||||
|
{0x4d0, 0x4d0}, //
|
||||||
|
{0x4d2, 0x4d2}, //
|
||||||
|
{0x4d4, 0x4d4}, //
|
||||||
|
{0x4d6, 0x4d6}, //
|
||||||
|
{0x4d8, 0x4d8}, //
|
||||||
|
{0x4da, 0x4da}, //
|
||||||
|
{0x4dc, 0x4dc}, //
|
||||||
|
{0x4de, 0x4de}, //
|
||||||
|
{0x4e0, 0x4e0}, //
|
||||||
|
{0x4e2, 0x4e2}, //
|
||||||
|
{0x4e4, 0x4e4}, //
|
||||||
|
{0x4e6, 0x4e6}, //
|
||||||
|
{0x4e8, 0x4e8}, //
|
||||||
|
{0x4ea, 0x4ea}, //
|
||||||
|
{0x4ec, 0x4ec}, //
|
||||||
|
{0x4ee, 0x4ee}, //
|
||||||
|
{0x4f0, 0x4f0}, //
|
||||||
|
{0x4f2, 0x4f2}, //
|
||||||
|
{0x4f4, 0x4f4}, //
|
||||||
|
{0x4f6, 0x4f6}, //
|
||||||
|
{0x4f8, 0x4f8}, //
|
||||||
|
{0x4fa, 0x4fa}, //
|
||||||
|
{0x4fc, 0x4fc}, //
|
||||||
|
{0x4fe, 0x4fe}, //
|
||||||
|
{0x500, 0x500}, //
|
||||||
|
{0x502, 0x502}, //
|
||||||
|
{0x504, 0x504}, //
|
||||||
|
{0x506, 0x506}, //
|
||||||
|
{0x508, 0x508}, //
|
||||||
|
{0x50a, 0x50a}, //
|
||||||
|
{0x50c, 0x50c}, //
|
||||||
|
{0x50e, 0x50e}, //
|
||||||
|
{0x510, 0x510}, //
|
||||||
|
{0x512, 0x512}, //
|
||||||
|
{0x514, 0x514}, //
|
||||||
|
{0x516, 0x516}, //
|
||||||
|
{0x518, 0x518}, //
|
||||||
|
{0x51a, 0x51a}, //
|
||||||
|
{0x51c, 0x51c}, //
|
||||||
|
{0x51e, 0x51e}, //
|
||||||
|
{0x520, 0x520}, //
|
||||||
|
{0x522, 0x522}, //
|
||||||
|
{0x524, 0x524}, //
|
||||||
|
{0x526, 0x526}, //
|
||||||
|
{0x528, 0x528}, //
|
||||||
|
{0x52a, 0x52a}, //
|
||||||
|
{0x52c, 0x52c}, //
|
||||||
|
{0x52e, 0x52e}, //
|
||||||
|
{0x531, 0x556}, //
|
||||||
|
{0x10a0, 0x10c5}, //
|
||||||
|
{0x10c7, 0x10c7}, //
|
||||||
|
{0x10cd, 0x10cd}, //
|
||||||
|
{0x13a0, 0x13f5}, //
|
||||||
|
{0x1c90, 0x1cba}, //
|
||||||
|
{0x1cbd, 0x1cbf}, //
|
||||||
|
{0x1e00, 0x1e00}, //
|
||||||
|
{0x1e02, 0x1e02}, //
|
||||||
|
{0x1e04, 0x1e04}, //
|
||||||
|
{0x1e06, 0x1e06}, //
|
||||||
|
{0x1e08, 0x1e08}, //
|
||||||
|
{0x1e0a, 0x1e0a}, //
|
||||||
|
{0x1e0c, 0x1e0c}, //
|
||||||
|
{0x1e0e, 0x1e0e}, //
|
||||||
|
{0x1e10, 0x1e10}, //
|
||||||
|
{0x1e12, 0x1e12}, //
|
||||||
|
{0x1e14, 0x1e14}, //
|
||||||
|
{0x1e16, 0x1e16}, //
|
||||||
|
{0x1e18, 0x1e18}, //
|
||||||
|
{0x1e1a, 0x1e1a}, //
|
||||||
|
{0x1e1c, 0x1e1c}, //
|
||||||
|
{0x1e1e, 0x1e1e}, //
|
||||||
|
{0x1e20, 0x1e20}, //
|
||||||
|
{0x1e22, 0x1e22}, //
|
||||||
|
{0x1e24, 0x1e24}, //
|
||||||
|
{0x1e26, 0x1e26}, //
|
||||||
|
{0x1e28, 0x1e28}, //
|
||||||
|
{0x1e2a, 0x1e2a}, //
|
||||||
|
{0x1e2c, 0x1e2c}, //
|
||||||
|
{0x1e2e, 0x1e2e}, //
|
||||||
|
{0x1e30, 0x1e30}, //
|
||||||
|
{0x1e32, 0x1e32}, //
|
||||||
|
{0x1e34, 0x1e34}, //
|
||||||
|
{0x1e36, 0x1e36}, //
|
||||||
|
{0x1e38, 0x1e38}, //
|
||||||
|
{0x1e3a, 0x1e3a}, //
|
||||||
|
{0x1e3c, 0x1e3c}, //
|
||||||
|
{0x1e3e, 0x1e3e}, //
|
||||||
|
{0x1e40, 0x1e40}, //
|
||||||
|
{0x1e42, 0x1e42}, //
|
||||||
|
{0x1e44, 0x1e44}, //
|
||||||
|
{0x1e46, 0x1e46}, //
|
||||||
|
{0x1e48, 0x1e48}, //
|
||||||
|
{0x1e4a, 0x1e4a}, //
|
||||||
|
{0x1e4c, 0x1e4c}, //
|
||||||
|
{0x1e4e, 0x1e4e}, //
|
||||||
|
{0x1e50, 0x1e50}, //
|
||||||
|
{0x1e52, 0x1e52}, //
|
||||||
|
{0x1e54, 0x1e54}, //
|
||||||
|
{0x1e56, 0x1e56}, //
|
||||||
|
{0x1e58, 0x1e58}, //
|
||||||
|
{0x1e5a, 0x1e5a}, //
|
||||||
|
{0x1e5c, 0x1e5c}, //
|
||||||
|
{0x1e5e, 0x1e5e}, //
|
||||||
|
{0x1e60, 0x1e60}, //
|
||||||
|
{0x1e62, 0x1e62}, //
|
||||||
|
{0x1e64, 0x1e64}, //
|
||||||
|
{0x1e66, 0x1e66}, //
|
||||||
|
{0x1e68, 0x1e68}, //
|
||||||
|
{0x1e6a, 0x1e6a}, //
|
||||||
|
{0x1e6c, 0x1e6c}, //
|
||||||
|
{0x1e6e, 0x1e6e}, //
|
||||||
|
{0x1e70, 0x1e70}, //
|
||||||
|
{0x1e72, 0x1e72}, //
|
||||||
|
{0x1e74, 0x1e74}, //
|
||||||
|
{0x1e76, 0x1e76}, //
|
||||||
|
{0x1e78, 0x1e78}, //
|
||||||
|
{0x1e7a, 0x1e7a}, //
|
||||||
|
{0x1e7c, 0x1e7c}, //
|
||||||
|
{0x1e7e, 0x1e7e}, //
|
||||||
|
{0x1e80, 0x1e80}, //
|
||||||
|
{0x1e82, 0x1e82}, //
|
||||||
|
{0x1e84, 0x1e84}, //
|
||||||
|
{0x1e86, 0x1e86}, //
|
||||||
|
{0x1e88, 0x1e88}, //
|
||||||
|
{0x1e8a, 0x1e8a}, //
|
||||||
|
{0x1e8c, 0x1e8c}, //
|
||||||
|
{0x1e8e, 0x1e8e}, //
|
||||||
|
{0x1e90, 0x1e90}, //
|
||||||
|
{0x1e92, 0x1e92}, //
|
||||||
|
{0x1e94, 0x1e94}, //
|
||||||
|
{0x1e9e, 0x1e9e}, //
|
||||||
|
{0x1ea0, 0x1ea0}, //
|
||||||
|
{0x1ea2, 0x1ea2}, //
|
||||||
|
{0x1ea4, 0x1ea4}, //
|
||||||
|
{0x1ea6, 0x1ea6}, //
|
||||||
|
{0x1ea8, 0x1ea8}, //
|
||||||
|
{0x1eaa, 0x1eaa}, //
|
||||||
|
{0x1eac, 0x1eac}, //
|
||||||
|
{0x1eae, 0x1eae}, //
|
||||||
|
{0x1eb0, 0x1eb0}, //
|
||||||
|
{0x1eb2, 0x1eb2}, //
|
||||||
|
{0x1eb4, 0x1eb4}, //
|
||||||
|
{0x1eb6, 0x1eb6}, //
|
||||||
|
{0x1eb8, 0x1eb8}, //
|
||||||
|
{0x1eba, 0x1eba}, //
|
||||||
|
{0x1ebc, 0x1ebc}, //
|
||||||
|
{0x1ebe, 0x1ebe}, //
|
||||||
|
{0x1ec0, 0x1ec0}, //
|
||||||
|
{0x1ec2, 0x1ec2}, //
|
||||||
|
{0x1ec4, 0x1ec4}, //
|
||||||
|
{0x1ec6, 0x1ec6}, //
|
||||||
|
{0x1ec8, 0x1ec8}, //
|
||||||
|
{0x1eca, 0x1eca}, //
|
||||||
|
{0x1ecc, 0x1ecc}, //
|
||||||
|
{0x1ece, 0x1ece}, //
|
||||||
|
{0x1ed0, 0x1ed0}, //
|
||||||
|
{0x1ed2, 0x1ed2}, //
|
||||||
|
{0x1ed4, 0x1ed4}, //
|
||||||
|
{0x1ed6, 0x1ed6}, //
|
||||||
|
{0x1ed8, 0x1ed8}, //
|
||||||
|
{0x1eda, 0x1eda}, //
|
||||||
|
{0x1edc, 0x1edc}, //
|
||||||
|
{0x1ede, 0x1ede}, //
|
||||||
|
{0x1ee0, 0x1ee0}, //
|
||||||
|
{0x1ee2, 0x1ee2}, //
|
||||||
|
{0x1ee4, 0x1ee4}, //
|
||||||
|
{0x1ee6, 0x1ee6}, //
|
||||||
|
{0x1ee8, 0x1ee8}, //
|
||||||
|
{0x1eea, 0x1eea}, //
|
||||||
|
{0x1eec, 0x1eec}, //
|
||||||
|
{0x1eee, 0x1eee}, //
|
||||||
|
{0x1ef0, 0x1ef0}, //
|
||||||
|
{0x1ef2, 0x1ef2}, //
|
||||||
|
{0x1ef4, 0x1ef4}, //
|
||||||
|
{0x1ef6, 0x1ef6}, //
|
||||||
|
{0x1ef8, 0x1ef8}, //
|
||||||
|
{0x1efa, 0x1efa}, //
|
||||||
|
{0x1efc, 0x1efc}, //
|
||||||
|
{0x1efe, 0x1efe}, //
|
||||||
|
{0x1f08, 0x1f0f}, //
|
||||||
|
{0x1f18, 0x1f1d}, //
|
||||||
|
{0x1f28, 0x1f2f}, //
|
||||||
|
{0x1f38, 0x1f3f}, //
|
||||||
|
{0x1f48, 0x1f4d}, //
|
||||||
|
{0x1f59, 0x1f59}, //
|
||||||
|
{0x1f5b, 0x1f5b}, //
|
||||||
|
{0x1f5d, 0x1f5d}, //
|
||||||
|
{0x1f5f, 0x1f5f}, //
|
||||||
|
{0x1f68, 0x1f6f}, //
|
||||||
|
{0x1f88, 0x1f8f}, //
|
||||||
|
{0x1f98, 0x1f9f}, //
|
||||||
|
{0x1fa8, 0x1faf}, //
|
||||||
|
{0x1fb8, 0x1fbc}, //
|
||||||
|
{0x1fc8, 0x1fcc}, //
|
||||||
|
{0x1fd8, 0x1fdb}, //
|
||||||
|
{0x1fe8, 0x1fec}, //
|
||||||
|
{0x1ff8, 0x1ffc}, //
|
||||||
|
{0x2102, 0x2102}, //
|
||||||
|
{0x2107, 0x2107}, //
|
||||||
|
{0x210b, 0x210d}, //
|
||||||
|
{0x2110, 0x2112}, //
|
||||||
|
{0x2115, 0x2115}, //
|
||||||
|
{0x2119, 0x211d}, //
|
||||||
|
{0x2124, 0x2124}, //
|
||||||
|
{0x2126, 0x2126}, //
|
||||||
|
{0x2128, 0x2128}, //
|
||||||
|
{0x212a, 0x212d}, //
|
||||||
|
{0x2130, 0x2133}, //
|
||||||
|
{0x213e, 0x213f}, //
|
||||||
|
{0x2145, 0x2145}, //
|
||||||
|
{0x2160, 0x216f}, //
|
||||||
|
{0x2183, 0x2183}, //
|
||||||
|
{0x24b6, 0x24cf}, //
|
||||||
|
{0x2c00, 0x2c2f}, //
|
||||||
|
{0x2c60, 0x2c60}, //
|
||||||
|
{0x2c62, 0x2c64}, //
|
||||||
|
{0x2c67, 0x2c67}, //
|
||||||
|
{0x2c69, 0x2c69}, //
|
||||||
|
{0x2c6b, 0x2c6b}, //
|
||||||
|
{0x2c6d, 0x2c70}, //
|
||||||
|
{0x2c72, 0x2c72}, //
|
||||||
|
{0x2c75, 0x2c75}, //
|
||||||
|
{0x2c7e, 0x2c80}, //
|
||||||
|
{0x2c82, 0x2c82}, //
|
||||||
|
{0x2c84, 0x2c84}, //
|
||||||
|
{0x2c86, 0x2c86}, //
|
||||||
|
{0x2c88, 0x2c88}, //
|
||||||
|
{0x2c8a, 0x2c8a}, //
|
||||||
|
{0x2c8c, 0x2c8c}, //
|
||||||
|
{0x2c8e, 0x2c8e}, //
|
||||||
|
{0x2c90, 0x2c90}, //
|
||||||
|
{0x2c92, 0x2c92}, //
|
||||||
|
{0x2c94, 0x2c94}, //
|
||||||
|
{0x2c96, 0x2c96}, //
|
||||||
|
{0x2c98, 0x2c98}, //
|
||||||
|
{0x2c9a, 0x2c9a}, //
|
||||||
|
{0x2c9c, 0x2c9c}, //
|
||||||
|
{0x2c9e, 0x2c9e}, //
|
||||||
|
{0x2ca0, 0x2ca0}, //
|
||||||
|
{0x2ca2, 0x2ca2}, //
|
||||||
|
{0x2ca4, 0x2ca4}, //
|
||||||
|
{0x2ca6, 0x2ca6}, //
|
||||||
|
{0x2ca8, 0x2ca8}, //
|
||||||
|
{0x2caa, 0x2caa}, //
|
||||||
|
{0x2cac, 0x2cac}, //
|
||||||
|
{0x2cae, 0x2cae}, //
|
||||||
|
{0x2cb0, 0x2cb0}, //
|
||||||
|
{0x2cb2, 0x2cb2}, //
|
||||||
|
{0x2cb4, 0x2cb4}, //
|
||||||
|
{0x2cb6, 0x2cb6}, //
|
||||||
|
{0x2cb8, 0x2cb8}, //
|
||||||
|
{0x2cba, 0x2cba}, //
|
||||||
|
{0x2cbc, 0x2cbc}, //
|
||||||
|
{0x2cbe, 0x2cbe}, //
|
||||||
|
{0x2cc0, 0x2cc0}, //
|
||||||
|
{0x2cc2, 0x2cc2}, //
|
||||||
|
{0x2cc4, 0x2cc4}, //
|
||||||
|
{0x2cc6, 0x2cc6}, //
|
||||||
|
{0x2cc8, 0x2cc8}, //
|
||||||
|
{0x2cca, 0x2cca}, //
|
||||||
|
{0x2ccc, 0x2ccc}, //
|
||||||
|
{0x2cce, 0x2cce}, //
|
||||||
|
{0x2cd0, 0x2cd0}, //
|
||||||
|
{0x2cd2, 0x2cd2}, //
|
||||||
|
{0x2cd4, 0x2cd4}, //
|
||||||
|
{0x2cd6, 0x2cd6}, //
|
||||||
|
{0x2cd8, 0x2cd8}, //
|
||||||
|
{0x2cda, 0x2cda}, //
|
||||||
|
{0x2cdc, 0x2cdc}, //
|
||||||
|
{0x2cde, 0x2cde}, //
|
||||||
|
{0x2ce0, 0x2ce0}, //
|
||||||
|
{0x2ce2, 0x2ce2}, //
|
||||||
|
{0x2ceb, 0x2ceb}, //
|
||||||
|
{0x2ced, 0x2ced}, //
|
||||||
|
{0x2cf2, 0x2cf2}, //
|
||||||
|
{0xa640, 0xa640}, //
|
||||||
|
{0xa642, 0xa642}, //
|
||||||
|
{0xa644, 0xa644}, //
|
||||||
|
{0xa646, 0xa646}, //
|
||||||
|
{0xa648, 0xa648}, //
|
||||||
|
{0xa64a, 0xa64a}, //
|
||||||
|
{0xa64c, 0xa64c}, //
|
||||||
|
{0xa64e, 0xa64e}, //
|
||||||
|
{0xa650, 0xa650}, //
|
||||||
|
{0xa652, 0xa652}, //
|
||||||
|
{0xa654, 0xa654}, //
|
||||||
|
{0xa656, 0xa656}, //
|
||||||
|
{0xa658, 0xa658}, //
|
||||||
|
{0xa65a, 0xa65a}, //
|
||||||
|
{0xa65c, 0xa65c}, //
|
||||||
|
{0xa65e, 0xa65e}, //
|
||||||
|
{0xa660, 0xa660}, //
|
||||||
|
{0xa662, 0xa662}, //
|
||||||
|
{0xa664, 0xa664}, //
|
||||||
|
{0xa666, 0xa666}, //
|
||||||
|
{0xa668, 0xa668}, //
|
||||||
|
{0xa66a, 0xa66a}, //
|
||||||
|
{0xa66c, 0xa66c}, //
|
||||||
|
{0xa680, 0xa680}, //
|
||||||
|
{0xa682, 0xa682}, //
|
||||||
|
{0xa684, 0xa684}, //
|
||||||
|
{0xa686, 0xa686}, //
|
||||||
|
{0xa688, 0xa688}, //
|
||||||
|
{0xa68a, 0xa68a}, //
|
||||||
|
{0xa68c, 0xa68c}, //
|
||||||
|
{0xa68e, 0xa68e}, //
|
||||||
|
{0xa690, 0xa690}, //
|
||||||
|
{0xa692, 0xa692}, //
|
||||||
|
{0xa694, 0xa694}, //
|
||||||
|
{0xa696, 0xa696}, //
|
||||||
|
{0xa698, 0xa698}, //
|
||||||
|
{0xa69a, 0xa69a}, //
|
||||||
|
{0xa722, 0xa722}, //
|
||||||
|
{0xa724, 0xa724}, //
|
||||||
|
{0xa726, 0xa726}, //
|
||||||
|
{0xa728, 0xa728}, //
|
||||||
|
{0xa72a, 0xa72a}, //
|
||||||
|
{0xa72c, 0xa72c}, //
|
||||||
|
{0xa72e, 0xa72e}, //
|
||||||
|
{0xa732, 0xa732}, //
|
||||||
|
{0xa734, 0xa734}, //
|
||||||
|
{0xa736, 0xa736}, //
|
||||||
|
{0xa738, 0xa738}, //
|
||||||
|
{0xa73a, 0xa73a}, //
|
||||||
|
{0xa73c, 0xa73c}, //
|
||||||
|
{0xa73e, 0xa73e}, //
|
||||||
|
{0xa740, 0xa740}, //
|
||||||
|
{0xa742, 0xa742}, //
|
||||||
|
{0xa744, 0xa744}, //
|
||||||
|
{0xa746, 0xa746}, //
|
||||||
|
{0xa748, 0xa748}, //
|
||||||
|
{0xa74a, 0xa74a}, //
|
||||||
|
{0xa74c, 0xa74c}, //
|
||||||
|
{0xa74e, 0xa74e}, //
|
||||||
|
{0xa750, 0xa750}, //
|
||||||
|
{0xa752, 0xa752}, //
|
||||||
|
{0xa754, 0xa754}, //
|
||||||
|
{0xa756, 0xa756}, //
|
||||||
|
{0xa758, 0xa758}, //
|
||||||
|
{0xa75a, 0xa75a}, //
|
||||||
|
{0xa75c, 0xa75c}, //
|
||||||
|
{0xa75e, 0xa75e}, //
|
||||||
|
{0xa760, 0xa760}, //
|
||||||
|
{0xa762, 0xa762}, //
|
||||||
|
{0xa764, 0xa764}, //
|
||||||
|
{0xa766, 0xa766}, //
|
||||||
|
{0xa768, 0xa768}, //
|
||||||
|
{0xa76a, 0xa76a}, //
|
||||||
|
{0xa76c, 0xa76c}, //
|
||||||
|
{0xa76e, 0xa76e}, //
|
||||||
|
{0xa779, 0xa779}, //
|
||||||
|
{0xa77b, 0xa77b}, //
|
||||||
|
{0xa77d, 0xa77e}, //
|
||||||
|
{0xa780, 0xa780}, //
|
||||||
|
{0xa782, 0xa782}, //
|
||||||
|
{0xa784, 0xa784}, //
|
||||||
|
{0xa786, 0xa786}, //
|
||||||
|
{0xa78b, 0xa78b}, //
|
||||||
|
{0xa78d, 0xa78d}, //
|
||||||
|
{0xa790, 0xa790}, //
|
||||||
|
{0xa792, 0xa792}, //
|
||||||
|
{0xa796, 0xa796}, //
|
||||||
|
{0xa798, 0xa798}, //
|
||||||
|
{0xa79a, 0xa79a}, //
|
||||||
|
{0xa79c, 0xa79c}, //
|
||||||
|
{0xa79e, 0xa79e}, //
|
||||||
|
{0xa7a0, 0xa7a0}, //
|
||||||
|
{0xa7a2, 0xa7a2}, //
|
||||||
|
{0xa7a4, 0xa7a4}, //
|
||||||
|
{0xa7a6, 0xa7a6}, //
|
||||||
|
{0xa7a8, 0xa7a8}, //
|
||||||
|
{0xa7aa, 0xa7ae}, //
|
||||||
|
{0xa7b0, 0xa7b4}, //
|
||||||
|
{0xa7b6, 0xa7b6}, //
|
||||||
|
{0xa7b8, 0xa7b8}, //
|
||||||
|
{0xa7ba, 0xa7ba}, //
|
||||||
|
{0xa7bc, 0xa7bc}, //
|
||||||
|
{0xa7be, 0xa7be}, //
|
||||||
|
{0xa7c0, 0xa7c0}, //
|
||||||
|
{0xa7c2, 0xa7c2}, //
|
||||||
|
{0xa7c4, 0xa7c7}, //
|
||||||
|
{0xa7c9, 0xa7c9}, //
|
||||||
|
{0xa7d0, 0xa7d0}, //
|
||||||
|
{0xa7d6, 0xa7d6}, //
|
||||||
|
{0xa7d8, 0xa7d8}, //
|
||||||
|
{0xa7f5, 0xa7f5}, //
|
||||||
|
{0xff21, 0xff3a}, //
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned kUpperAstral[][2] = {
|
||||||
|
{0x10400, 0x10427}, //
|
||||||
|
{0x104b0, 0x104d3}, //
|
||||||
|
{0x10570, 0x1057a}, //
|
||||||
|
{0x1057c, 0x1058a}, //
|
||||||
|
{0x1058c, 0x10592}, //
|
||||||
|
{0x10594, 0x10595}, //
|
||||||
|
{0x10c80, 0x10cb2}, //
|
||||||
|
{0x118a0, 0x118bf}, //
|
||||||
|
{0x16e40, 0x16e5f}, //
|
||||||
|
{0x1d400, 0x1d419}, //
|
||||||
|
{0x1d434, 0x1d44d}, //
|
||||||
|
{0x1d468, 0x1d481}, //
|
||||||
|
{0x1d49c, 0x1d49c}, //
|
||||||
|
{0x1d49e, 0x1d49f}, //
|
||||||
|
{0x1d4a2, 0x1d4a2}, //
|
||||||
|
{0x1d4a5, 0x1d4a6}, //
|
||||||
|
{0x1d4a9, 0x1d4ac}, //
|
||||||
|
{0x1d4ae, 0x1d4b5}, //
|
||||||
|
{0x1d4d0, 0x1d4e9}, //
|
||||||
|
{0x1d504, 0x1d505}, //
|
||||||
|
{0x1d507, 0x1d50a}, //
|
||||||
|
{0x1d50d, 0x1d514}, //
|
||||||
|
{0x1d516, 0x1d51c}, //
|
||||||
|
{0x1d538, 0x1d539}, //
|
||||||
|
{0x1d53b, 0x1d53e}, //
|
||||||
|
{0x1d540, 0x1d544}, //
|
||||||
|
{0x1d546, 0x1d546}, //
|
||||||
|
{0x1d54a, 0x1d550}, //
|
||||||
|
{0x1d56c, 0x1d585}, //
|
||||||
|
{0x1d5a0, 0x1d5b9}, //
|
||||||
|
{0x1d5d4, 0x1d5ed}, //
|
||||||
|
{0x1d608, 0x1d621}, //
|
||||||
|
{0x1d63c, 0x1d655}, //
|
||||||
|
{0x1d670, 0x1d689}, //
|
||||||
|
{0x1d6a8, 0x1d6c0}, //
|
||||||
|
{0x1d6e2, 0x1d6fa}, //
|
||||||
|
{0x1d71c, 0x1d734}, //
|
||||||
|
{0x1d756, 0x1d76e}, //
|
||||||
|
{0x1d790, 0x1d7a8}, //
|
||||||
|
{0x1d7ca, 0x1d7ca}, //
|
||||||
|
{0x1e900, 0x1e921}, //
|
||||||
|
{0x1f130, 0x1f149}, //
|
||||||
|
{0x1f150, 0x1f169}, //
|
||||||
|
{0x1f170, 0x1f189}, //
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns nonzero if c is uppercase letter.
|
||||||
|
*/
|
||||||
|
int iswupper(wint_t c) {
|
||||||
|
if (!IsTiny() && c < 128)
|
||||||
|
return 'A' <= c && c <= 'Z';
|
||||||
|
if (c < 65536)
|
||||||
|
return has_char(kUpper, ARRAYLEN(kUpper), (unsigned short)c);
|
||||||
|
return has_char(kUpperAstral, ARRAYLEN(kUpperAstral), (unsigned)c);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(iswupper, iswupper_l);
|
|
@ -22,7 +22,8 @@
|
||||||
* Returns nonzero if c is ascii hex digit.
|
* Returns nonzero if c is ascii hex digit.
|
||||||
*/
|
*/
|
||||||
int iswxdigit(wint_t c) {
|
int iswxdigit(wint_t c) {
|
||||||
return ('0' <= c && c <= '9') || ('A' <= c && c <= 'F') ||
|
return ('0' <= c && c <= '9') || //
|
||||||
|
('A' <= c && c <= 'F') || //
|
||||||
('a' <= c && c <= 'f');
|
('a' <= c && c <= 'f');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
* Returns true if c is hexadecimal digit.
|
* Returns true if c is hexadecimal digit.
|
||||||
*/
|
*/
|
||||||
int isxdigit(int c) {
|
int isxdigit(int c) {
|
||||||
return ('0' <= c && c <= '9') || ('A' <= c && c <= 'F') ||
|
return ('0' <= c && c <= '9') || //
|
||||||
|
('A' <= c && c <= 'F') || //
|
||||||
('a' <= c && c <= 'f');
|
('a' <= c && c <= 'f');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,32 +24,23 @@
|
||||||
*/
|
*/
|
||||||
int IsZipEocd32(const uint8_t *p, size_t n, size_t i) {
|
int IsZipEocd32(const uint8_t *p, size_t n, size_t i) {
|
||||||
size_t offset;
|
size_t offset;
|
||||||
if (i > n || n - i < kZipCdirHdrMinSize) {
|
if (i > n || n - i < kZipCdirHdrMinSize)
|
||||||
return kZipErrorEocdOffsetOverflow;
|
return kZipErrorEocdOffsetOverflow;
|
||||||
}
|
if (ZIP_READ32(p + i) != kZipCdirHdrMagic)
|
||||||
if (ZIP_READ32(p + i) != kZipCdirHdrMagic) {
|
|
||||||
return kZipErrorEocdMagicNotFound;
|
return kZipErrorEocdMagicNotFound;
|
||||||
}
|
if (i + ZIP_CDIR_HDRSIZE(p + i) > n)
|
||||||
if (i + ZIP_CDIR_HDRSIZE(p + i) > n) {
|
|
||||||
return kZipErrorEocdSizeOverflow;
|
return kZipErrorEocdSizeOverflow;
|
||||||
}
|
if (ZIP_CDIR_DISK(p + i) != ZIP_CDIR_STARTINGDISK(p + i))
|
||||||
if (ZIP_CDIR_DISK(p + i) != ZIP_CDIR_STARTINGDISK(p + i)) {
|
|
||||||
return kZipErrorEocdDiskMismatch;
|
return kZipErrorEocdDiskMismatch;
|
||||||
}
|
if (ZIP_CDIR_RECORDSONDISK(p + i) != ZIP_CDIR_RECORDS(p + i))
|
||||||
if (ZIP_CDIR_RECORDSONDISK(p + i) != ZIP_CDIR_RECORDS(p + i)) {
|
|
||||||
return kZipErrorEocdRecordsMismatch;
|
return kZipErrorEocdRecordsMismatch;
|
||||||
}
|
if (ZIP_CDIR_RECORDS(p + i) * kZipCfileHdrMinSize > ZIP_CDIR_SIZE(p + i))
|
||||||
if (ZIP_CDIR_RECORDS(p + i) * kZipCfileHdrMinSize > ZIP_CDIR_SIZE(p + i)) {
|
|
||||||
return kZipErrorEocdRecordsOverflow;
|
return kZipErrorEocdRecordsOverflow;
|
||||||
}
|
if (ZIP_CDIR_OFFSET(p + i) == 0xFFFFFFFFu)
|
||||||
if (ZIP_CDIR_OFFSET(p + i) == 0xFFFFFFFFu) {
|
|
||||||
return kZipErrorEocdRecordsOverflow;
|
return kZipErrorEocdRecordsOverflow;
|
||||||
}
|
if (ckd_add(&offset, ZIP_CDIR_OFFSET(p + i), ZIP_CDIR_SIZE(p + i)))
|
||||||
if (ckd_add(&offset, ZIP_CDIR_OFFSET(p + i), ZIP_CDIR_SIZE(p + i))) {
|
|
||||||
return kZipErrorEocdOffsetSizeOverflow;
|
return kZipErrorEocdOffsetSizeOverflow;
|
||||||
}
|
if (offset > i)
|
||||||
if (offset > i) {
|
|
||||||
return kZipErrorCdirOffsetPastEocd;
|
return kZipErrorCdirOffsetPastEocd;
|
||||||
}
|
|
||||||
return kZipOk;
|
return kZipOk;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
│ │
|
│ │
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
@ -16,13 +16,59 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/wctype.h"
|
#include "libc/str/kmp.h"
|
||||||
|
#include "libc/mem/alloca.h"
|
||||||
|
#include "libc/runtime/stack.h"
|
||||||
|
|
||||||
/**
|
static void computeLPS(const char *pattern, long M, long *lps) {
|
||||||
* Returns nonzero if c is alphabetical.
|
long len = 0;
|
||||||
*/
|
lps[0] = 0;
|
||||||
int iswalpha(wint_t c) {
|
long i = 1;
|
||||||
return iswupper(c) || iswlower(c);
|
while (i < M) {
|
||||||
|
if (pattern[i] == pattern[len]) {
|
||||||
|
len++;
|
||||||
|
lps[i] = len;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
if (len != 0) {
|
||||||
|
len = lps[len - 1];
|
||||||
|
} else {
|
||||||
|
lps[i] = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak_reference(iswalpha, iswalpha_l);
|
char *__memmem_kmp(const char *s, size_t n, const char *ss, size_t m) {
|
||||||
|
if (!m)
|
||||||
|
return (char *)s;
|
||||||
|
if (n < m)
|
||||||
|
return NULL;
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-out-of-bounds"
|
||||||
|
long need = sizeof(long) * m;
|
||||||
|
long *lps = (long *)alloca(need);
|
||||||
|
CheckLargeStackAllocation(lps, need);
|
||||||
|
#pragma GCC pop_options
|
||||||
|
computeLPS(ss, m, lps);
|
||||||
|
long i = 0;
|
||||||
|
long j = 0;
|
||||||
|
while (i < n) {
|
||||||
|
if (ss[j] == s[i]) {
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (j == m) {
|
||||||
|
return (char *)(s + i - j);
|
||||||
|
} else if (i < n && ss[j] != s[i]) {
|
||||||
|
if (j != 0) {
|
||||||
|
j = lps[j - 1];
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
10
libc/str/kmp.h
Normal file
10
libc/str/kmp.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef COSMOPOLITAN_LIBC_STR_KMP_H_
|
||||||
|
#define COSMOPOLITAN_LIBC_STR_KMP_H_
|
||||||
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
char *__memmem_kmp(const char *, size_t, const char *, size_t);
|
||||||
|
char16_t *__memmem_kmp16(const char16_t *, size_t, const char16_t *, size_t);
|
||||||
|
wchar_t *__memmem_kmp32(const wchar_t *, size_t, const wchar_t *, size_t);
|
||||||
|
|
||||||
|
COSMOPOLITAN_C_END_
|
||||||
|
#endif /* COSMOPOLITAN_LIBC_STR_KMP_H_ */
|
|
@ -1,7 +1,7 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
│ │
|
│ │
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
@ -16,14 +16,60 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/mem/alg.h"
|
#include "libc/mem/alloca.h"
|
||||||
#include "libc/mem/bisect.internal.h"
|
#include "libc/runtime/stack.h"
|
||||||
|
#include "libc/str/kmp.h"
|
||||||
|
|
||||||
/**
|
static void computeLPS(const char16_t *pattern, long M, long *lps) {
|
||||||
* Searches sorted array for exact item in logarithmic time.
|
long len = 0;
|
||||||
* @see bsearch_r()
|
lps[0] = 0;
|
||||||
*/
|
long i = 1;
|
||||||
void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
|
while (i < M) {
|
||||||
int cmp(const void *a, const void *b)) {
|
if (pattern[i] == pattern[len]) {
|
||||||
return bisect(key, base, nmemb, size, (void *)cmp, NULL);
|
len++;
|
||||||
|
lps[i] = len;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
if (len != 0) {
|
||||||
|
len = lps[len - 1];
|
||||||
|
} else {
|
||||||
|
lps[i] = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char16_t *__memmem_kmp16(const char16_t *s, size_t n, const char16_t *ss,
|
||||||
|
size_t m) {
|
||||||
|
if (!m)
|
||||||
|
return (char16_t *)s;
|
||||||
|
if (n < m)
|
||||||
|
return NULL;
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-out-of-bounds"
|
||||||
|
long need = sizeof(long) * m;
|
||||||
|
long *lps = (long *)alloca(need);
|
||||||
|
CheckLargeStackAllocation(lps, need);
|
||||||
|
#pragma GCC pop_options
|
||||||
|
computeLPS(ss, m, lps);
|
||||||
|
long i = 0;
|
||||||
|
long j = 0;
|
||||||
|
while (i < n) {
|
||||||
|
if (ss[j] == s[i]) {
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (j == m) {
|
||||||
|
return (char16_t *)(s + i - j);
|
||||||
|
} else if (i < n && ss[j] != s[i]) {
|
||||||
|
if (j != 0) {
|
||||||
|
j = lps[j - 1];
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||||
│ │
|
│ │
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
@ -16,12 +16,60 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/wctype.h"
|
#include "libc/mem/alloca.h"
|
||||||
|
#include "libc/runtime/stack.h"
|
||||||
|
#include "libc/str/kmp.h"
|
||||||
|
|
||||||
wint_t towctrans(wint_t c, wctrans_t t) {
|
static void computeLPS(const wchar_t *pattern, long M, long *lps) {
|
||||||
if (t == (wctrans_t)1)
|
long len = 0;
|
||||||
return towupper(c);
|
lps[0] = 0;
|
||||||
if (t == (wctrans_t)2)
|
long i = 1;
|
||||||
return towlower(c);
|
while (i < M) {
|
||||||
return c;
|
if (pattern[i] == pattern[len]) {
|
||||||
|
len++;
|
||||||
|
lps[i] = len;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
if (len != 0) {
|
||||||
|
len = lps[len - 1];
|
||||||
|
} else {
|
||||||
|
lps[i] = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t *__memmem_kmp32(const wchar_t *s, size_t n, const wchar_t *ss,
|
||||||
|
size_t m) {
|
||||||
|
if (!m)
|
||||||
|
return (wchar_t *)s;
|
||||||
|
if (n < m)
|
||||||
|
return NULL;
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-out-of-bounds"
|
||||||
|
long need = sizeof(long) * m;
|
||||||
|
long *lps = (long *)alloca(need);
|
||||||
|
CheckLargeStackAllocation(lps, need);
|
||||||
|
#pragma GCC pop_options
|
||||||
|
computeLPS(ss, m, lps);
|
||||||
|
long i = 0;
|
||||||
|
long j = 0;
|
||||||
|
while (i < n) {
|
||||||
|
if (ss[j] == s[i]) {
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (j == m) {
|
||||||
|
return (wchar_t *)(s + i - j);
|
||||||
|
} else if (i < n && ss[j] != s[i]) {
|
||||||
|
if (j != 0) {
|
||||||
|
j = lps[j - 1];
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
|
@ -20,7 +20,6 @@
|
||||||
#include "libc/nexgen32e/x86info.h"
|
#include "libc/nexgen32e/x86info.h"
|
||||||
|
|
||||||
const struct X86ProcessorModel kX86ProcessorModels[] = {
|
const struct X86ProcessorModel kX86ProcessorModels[] = {
|
||||||
/* <SORTED> */
|
|
||||||
{0x060F, X86_MARCH_CORE2, X86_GRADE_CLIENT},
|
{0x060F, X86_MARCH_CORE2, X86_GRADE_CLIENT},
|
||||||
{0x0616, X86_MARCH_CORE2, X86_GRADE_MOBILE},
|
{0x0616, X86_MARCH_CORE2, X86_GRADE_MOBILE},
|
||||||
{0x0617, X86_MARCH_CORE2, X86_GRADE_SERVER},
|
{0x0617, X86_MARCH_CORE2, X86_GRADE_SERVER},
|
||||||
|
@ -85,7 +84,5 @@ const struct X86ProcessorModel kX86ProcessorModels[] = {
|
||||||
{0x06A7, X86_MARCH_ROCKETLAKE, X86_GRADE_CLIENT},
|
{0x06A7, X86_MARCH_ROCKETLAKE, X86_GRADE_CLIENT},
|
||||||
{0x06B7, X86_MARCH_RAPTORLAKE, X86_GRADE_CLIENT},
|
{0x06B7, X86_MARCH_RAPTORLAKE, X86_GRADE_CLIENT},
|
||||||
{0x06BA, X86_MARCH_RAPTORLAKE, X86_GRADE_CLIENT},
|
{0x06BA, X86_MARCH_RAPTORLAKE, X86_GRADE_CLIENT},
|
||||||
/* </SORTED> */
|
{0},
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t kX86ProcessorModelCount = ARRAYLEN(kX86ProcessorModels);
|
|
||||||
|
|
|
@ -16,49 +16,60 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/dce.h"
|
|
||||||
#include "libc/intrin/likely.h"
|
#include "libc/intrin/likely.h"
|
||||||
|
#include "libc/str/kmp.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "third_party/aarch64/arm_neon.internal.h"
|
||||||
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(16)));
|
#include "third_party/intel/emmintrin.internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for fixed-length substring in memory region.
|
* Searches for fixed-length substring in memory region.
|
||||||
*
|
*
|
||||||
|
* This function offers assurances against pathological cases, using KMP
|
||||||
|
* if no progress is being made on the O(nm) vectorized fast path. It is
|
||||||
|
* important to note that, if `needle` is untrusted, that it not be long
|
||||||
|
* enough to overflow the stack. That's because KMP needs to allocate an
|
||||||
|
* array of longs the same length as `needle` and it needs to do it with
|
||||||
|
* stack memory because this function is safe to call in signal handlers
|
||||||
|
*
|
||||||
* @param haystack is the region of memory to be searched
|
* @param haystack is the region of memory to be searched
|
||||||
* @param haystacklen is its character count
|
* @param haystacklen is its character count
|
||||||
* @param needle contains the memory for which we're searching
|
* @param needle contains the memory for which we're searching
|
||||||
* @param needlelen is its character count
|
* @param needlelen is its character count
|
||||||
* @return pointer to first result or NULL if not found
|
* @return pointer to first result or NULL if not found
|
||||||
|
* @asyncsignalsafe
|
||||||
*/
|
*/
|
||||||
__vex void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
__vex void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
||||||
size_t needlelen) {
|
size_t needlelen) {
|
||||||
#if defined(__x86_64__) && !defined(__chibicc__)
|
#if defined(__x86_64__) && !defined(__chibicc__)
|
||||||
char c;
|
char c;
|
||||||
xmm_t n;
|
__m128i n;
|
||||||
const xmm_t *v;
|
const __m128i *v;
|
||||||
unsigned i, k, m;
|
unsigned i, k, m;
|
||||||
|
long progress = 0;
|
||||||
const char *p, *q, *e;
|
const char *p, *q, *e;
|
||||||
|
long scare = -(needlelen * 10);
|
||||||
if (!needlelen)
|
if (!needlelen)
|
||||||
return (void *)haystack;
|
return (void *)haystack;
|
||||||
if (UNLIKELY(needlelen > haystacklen))
|
if (UNLIKELY(needlelen > haystacklen))
|
||||||
return 0;
|
return 0;
|
||||||
q = needle;
|
q = needle;
|
||||||
c = *q;
|
c = *q;
|
||||||
n = (xmm_t){c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c};
|
n = _mm_set1_epi8(c);
|
||||||
p = haystack;
|
p = haystack;
|
||||||
e = p + haystacklen;
|
e = p + haystacklen;
|
||||||
k = (uintptr_t)p & 15;
|
k = (uintptr_t)p & 15;
|
||||||
v = (const xmm_t *)((uintptr_t)p & -16);
|
v = (const __m128i *)((uintptr_t)p & -16);
|
||||||
m = __builtin_ia32_pmovmskb128(*v == n);
|
m = _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_load_si128(v), n));
|
||||||
m >>= k;
|
m >>= k;
|
||||||
m <<= k;
|
m <<= k;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (!m) {
|
while (!m) {
|
||||||
++v;
|
++v;
|
||||||
|
progress += 16;
|
||||||
if ((const char *)v >= e)
|
if ((const char *)v >= e)
|
||||||
return 0;
|
return 0;
|
||||||
m = __builtin_ia32_pmovmskb128(*v == n);
|
m = _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_load_si128(v), n));
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
k = __builtin_ctzl(m);
|
k = __builtin_ctzl(m);
|
||||||
|
@ -66,6 +77,8 @@ __vex void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
||||||
if (UNLIKELY(p + needlelen > e))
|
if (UNLIKELY(p + needlelen > e))
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 1;; ++i) {
|
for (i = 1;; ++i) {
|
||||||
|
if (--progress <= scare)
|
||||||
|
goto OfferPathologicalAssurances;
|
||||||
if (i == needlelen)
|
if (i == needlelen)
|
||||||
return (/*unconst*/ char *)p;
|
return (/*unconst*/ char *)p;
|
||||||
if (p[i] != q[i])
|
if (p[i] != q[i])
|
||||||
|
@ -74,22 +87,59 @@ __vex void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
||||||
m &= ~(1 << k);
|
m &= ~(1 << k);
|
||||||
} while (m);
|
} while (m);
|
||||||
}
|
}
|
||||||
#else
|
OfferPathologicalAssurances:
|
||||||
size_t i, j;
|
#elif defined(__aarch64__) && defined(__ARM_NEON)
|
||||||
|
char c;
|
||||||
|
uint8x16_t n;
|
||||||
|
const uint8x16_t *v;
|
||||||
|
size_t i, k;
|
||||||
|
uint64_t m;
|
||||||
|
long progress = 0;
|
||||||
|
const char *p, *q, *e;
|
||||||
|
long scare = -(needlelen * 10);
|
||||||
if (!needlelen)
|
if (!needlelen)
|
||||||
return (void *)haystack;
|
return (void *)haystack;
|
||||||
if (needlelen > haystacklen)
|
if (UNLIKELY(needlelen > haystacklen))
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 0; i < haystacklen; ++i) {
|
q = needle;
|
||||||
for (j = 0;; ++j) {
|
c = *q;
|
||||||
if (j == needlelen)
|
n = vdupq_n_u8(c);
|
||||||
return (/*unconst*/ char *)haystack + i;
|
p = haystack;
|
||||||
if (i + j == haystacklen)
|
e = p + haystacklen;
|
||||||
break;
|
k = (uintptr_t)p & 15;
|
||||||
if (((char *)haystack)[i + j] != ((char *)needle)[j])
|
v = (const uint8x16_t *)((uintptr_t)p & -16);
|
||||||
break;
|
uint8x16_t cmp = vceqq_u8(vld1q_u8((const uint8_t *)v), n);
|
||||||
|
uint8x8_t mask = vshrn_n_u16(vreinterpretq_u16_u8(cmp), 4);
|
||||||
|
vst1_u8((uint8_t *)&m, mask);
|
||||||
|
m >>= k * 4;
|
||||||
|
m <<= k * 4;
|
||||||
|
for (;;) {
|
||||||
|
while (!m) {
|
||||||
|
++v;
|
||||||
|
progress += 16;
|
||||||
|
if ((const char *)v >= e)
|
||||||
|
return 0;
|
||||||
|
cmp = vceqq_u8(vld1q_u8((const uint8_t *)v), n);
|
||||||
|
mask = vshrn_n_u16(vreinterpretq_u16_u8(cmp), 4);
|
||||||
|
vst1_u8((uint8_t *)&m, mask);
|
||||||
}
|
}
|
||||||
|
do {
|
||||||
|
k = __builtin_ctzll(m) >> 2;
|
||||||
|
p = (const char *)v + k;
|
||||||
|
if (UNLIKELY(p + needlelen > e))
|
||||||
|
return 0;
|
||||||
|
for (i = 1;; ++i) {
|
||||||
|
if (--progress <= scare)
|
||||||
|
goto OfferPathologicalAssurances;
|
||||||
|
if (i == needlelen)
|
||||||
|
return (/*unconst*/ char *)p;
|
||||||
|
if (p[i] != q[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m &= ~(0xFULL << (k * 4));
|
||||||
|
} while (m);
|
||||||
}
|
}
|
||||||
return 0;
|
OfferPathologicalAssurances:
|
||||||
#endif
|
#endif
|
||||||
|
return __memmem_kmp(haystack, haystacklen, needle, needlelen);
|
||||||
}
|
}
|
||||||
|
|
91
libc/str/nonspacing.inc
Normal file
91
libc/str/nonspacing.inc
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,16,33,16,16,16,34,35,36,
|
||||||
|
37,38,39,40,16,16,41,16,16,16,16,16,16,16,16,16,16,16,42,43,16,16,44,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,45,16,46,47,48,49,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,50,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,51,16,16,52,
|
||||||
|
53,16,54,55,56,16,16,16,16,16,16,57,16,16,58,16,59,60,61,62,63,64,65,66,67,68,
|
||||||
|
69,70,16,71,72,73,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,74,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,75,76,16,16,16,77,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,78,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,79,80,16,16,16,16,16,16,16,81,16,16,16,16,16,82,83,84,16,16,16,16,16,85,
|
||||||
|
86,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,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,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,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,0,0,248,3,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,254,255,255,255,255,191,182,0,0,0,0,0,0,0,63,0,255,23,0,0,0,0,0,248,255,
|
||||||
|
255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,192,191,159,61,0,0,0,128,2,0,0,0,255,255,255,
|
||||||
|
7,0,0,0,0,0,0,0,0,0,0,192,255,1,0,0,0,0,0,0,248,15,32,0,0,192,251,239,62,0,0,
|
||||||
|
0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,
|
||||||
|
255,7,0,0,0,0,0,0,20,254,33,254,0,12,0,0,0,2,0,0,0,0,0,0,16,30,32,0,0,12,0,0,
|
||||||
|
64,6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,190,33,0,0,12,0,0,
|
||||||
|
252,2,0,0,0,0,0,0,144,30,32,64,0,12,0,0,0,4,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,17,
|
||||||
|
0,0,0,0,0,0,192,193,61,96,0,12,0,0,0,2,0,0,0,0,0,0,144,64,48,0,0,12,0,0,0,3,0,
|
||||||
|
0,0,0,0,0,24,30,32,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,4,92,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
242,7,128,127,0,0,0,0,0,0,0,0,0,0,0,0,242,31,0,63,0,0,0,0,0,0,0,0,0,3,0,0,160,
|
||||||
|
2,0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,28,0,0,0,28,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,
|
||||||
|
15,32,0,0,0,0,0,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,135,1,4,14,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,
|
||||||
|
128,9,0,0,0,0,0,0,64,127,229,31,248,159,0,0,0,0,0,0,255,127,0,0,0,0,0,0,0,0,
|
||||||
|
15,0,0,0,0,0,208,23,4,0,0,0,0,248,15,0,3,0,0,0,60,59,0,0,0,0,0,0,64,163,3,0,0,
|
||||||
|
0,0,0,0,240,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,
|
||||||
|
3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,
|
||||||
|
251,0,248,0,0,0,124,0,0,0,0,0,0,223,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
|
||||||
|
255,1,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,128,3,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,
|
||||||
|
0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,6,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,128,247,63,0,0,0,192,0,0,0,0,0,0,0,0,0,0,3,0,68,8,0,0,96,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,255,255,3,128,0,0,0,0,192,63,0,0,128,255,3,0,
|
||||||
|
0,0,0,0,7,0,0,0,0,0,200,51,0,0,0,0,32,0,0,
|
||||||
|
0,0,0,0,0,0,126,102,0,8,16,0,0,0,0,0,16,0,0,0,0,0,0,157,193,2,0,0,0,0,48,64,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,32,33,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,0,0,0,
|
||||||
|
64,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,255,255,0,0,255,
|
||||||
|
255,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,128,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,14,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,32,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,1,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,240,0,
|
||||||
|
0,0,0,0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,240,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,0,0,0,192,255,1,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,255,127,0,0,0,0,0,0,128,
|
||||||
|
3,0,0,0,0,0,120,38,0,32,0,0,0,0,0,0,7,0,0,0,128,239,31,0,0,0,0,0,0,0,8,0,3,0,
|
||||||
|
0,0,0,0,192,127,0,30,0,0,0,0,0,0,0,0,0,0,0,128,211,64,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,128,248,7,0,0,3,0,0,0,0,0,0,24,1,0,0,0,192,31,31,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,255,92,0,0,64,0,0,0,0,0,0,0,0,0,0,248,133,13,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,60,176,1,0,0,48,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
248,167,1,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,0,0,0,0,0,0,0,0,0,0,0,224,188,15,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,128,255,6,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,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0,126,14,0,0,0,0,0,252,
|
||||||
|
127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,0,0,0,0,0,0,0,0,0,0,252,255,
|
||||||
|
255,252,109,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,126,180,191,0,0,0,0,0,0,0,0,0,163,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,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,255,
|
||||||
|
1,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,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,127,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,0,0,128,0,0,0,0,0,0,0,128,7,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,96,15,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,231,15,0,0,0,60,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,
|
||||||
|
255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248,254,255,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,127,255,255,249,219,7,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,127,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,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,127,0,0,0,0,0,0,0,0,0,0,0,0,0,240,7,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
@ -17,74 +17,113 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/str/kmp.h"
|
||||||
|
#include "third_party/aarch64/arm_neon.internal.h"
|
||||||
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(16)));
|
#include "third_party/intel/immintrin.internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for substring.
|
* Searches for substring.
|
||||||
*
|
*
|
||||||
|
* This function offers assurances against pathological cases, using KMP
|
||||||
|
* if no progress is being made on the O(nm) vectorized fast path. It is
|
||||||
|
* important to note that, if `needle` is untrusted, that it not be long
|
||||||
|
* enough to overflow the stack. That's because KMP needs to allocate an
|
||||||
|
* array of longs the same length as `needle` and it needs to do it with
|
||||||
|
* stack memory since POSIX requires this function to be safe to call in
|
||||||
|
* signal handlers.
|
||||||
|
*
|
||||||
* @param haystack is the search area, as a NUL-terminated string
|
* @param haystack is the search area, as a NUL-terminated string
|
||||||
* @param needle is the desired substring, also NUL-terminated
|
* @param needle is the desired substring, also NUL-terminated
|
||||||
* @return pointer to first substring within haystack, or NULL
|
* @return pointer to first substring within haystack, or NULL
|
||||||
* @note this implementation goes fast in practice but isn't hardened
|
|
||||||
* against pathological cases, and therefore shouldn't be used on
|
|
||||||
* untrustworthy data
|
|
||||||
* @asyncsignalsafe
|
* @asyncsignalsafe
|
||||||
* @see strcasestr()
|
* @see strcasestr()
|
||||||
* @see memmem()
|
* @see memmem()
|
||||||
*/
|
*/
|
||||||
__vex char *strstr(const char *haystack, const char *needle) {
|
__vex char *strstr(const char *haystack, const char *needle) {
|
||||||
|
if (haystack == needle || !*needle)
|
||||||
|
return (char *)haystack;
|
||||||
#if defined(__x86_64__) && !defined(__chibicc__)
|
#if defined(__x86_64__) && !defined(__chibicc__)
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned k, m;
|
unsigned k, m;
|
||||||
const xmm_t *p;
|
const __m128i *p;
|
||||||
xmm_t v, n, z = {0};
|
long progress = 0;
|
||||||
if (haystack == needle || !*needle)
|
__m128i v, n, z = _mm_setzero_si128();
|
||||||
return (char *)haystack;
|
const char *hay = haystack;
|
||||||
n = (xmm_t){*needle, *needle, *needle, *needle, *needle, *needle,
|
n = _mm_set1_epi8(*needle);
|
||||||
*needle, *needle, *needle, *needle, *needle, *needle,
|
|
||||||
*needle, *needle, *needle, *needle};
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
k = (uintptr_t)haystack & 15;
|
k = (uintptr_t)hay & 15;
|
||||||
p = (const xmm_t *)((uintptr_t)haystack & -16);
|
p = (const __m128i *)((uintptr_t)hay & -16);
|
||||||
v = *p;
|
v = _mm_load_si128(p);
|
||||||
m = __builtin_ia32_pmovmskb128((v == z) | (v == n));
|
m = _mm_movemask_epi8(
|
||||||
|
_mm_or_si128(_mm_cmpeq_epi8(v, z), _mm_cmpeq_epi8(v, n)));
|
||||||
m >>= k;
|
m >>= k;
|
||||||
m <<= k;
|
m <<= k;
|
||||||
while (!m) {
|
while (!m) {
|
||||||
v = *++p;
|
progress += 16;
|
||||||
m = __builtin_ia32_pmovmskb128((v == z) | (v == n));
|
v = _mm_load_si128(++p);
|
||||||
|
m = _mm_movemask_epi8(
|
||||||
|
_mm_or_si128(_mm_cmpeq_epi8(v, z), _mm_cmpeq_epi8(v, n)));
|
||||||
}
|
}
|
||||||
haystack = (const char *)p + __builtin_ctzl(m);
|
int offset = __builtin_ctzl(m);
|
||||||
|
progress += offset;
|
||||||
|
hay = (const char *)p + offset;
|
||||||
for (i = 0;; ++i) {
|
for (i = 0;; ++i) {
|
||||||
|
if (--progress <= -512)
|
||||||
|
goto OfferPathologicalAssurances;
|
||||||
if (!needle[i])
|
if (!needle[i])
|
||||||
return (/*unconst*/ char *)haystack;
|
return (/*unconst*/ char *)hay;
|
||||||
if (!haystack[i])
|
if (!hay[i])
|
||||||
break;
|
break;
|
||||||
if (needle[i] != haystack[i])
|
if (needle[i] != hay[i])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!*haystack++)
|
if (!*hay++)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
OfferPathologicalAssurances:
|
||||||
|
#elif defined(__aarch64__) && defined(__ARM_NEON)
|
||||||
size_t i;
|
size_t i;
|
||||||
if (haystack == needle || !*needle)
|
const char *hay = haystack;
|
||||||
return (void *)haystack;
|
uint8x16_t n = vdupq_n_u8(*needle);
|
||||||
|
uint8x16_t z = vdupq_n_u8(0);
|
||||||
|
long progress = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
int k = (uintptr_t)hay & 15;
|
||||||
|
hay = (const char *)((uintptr_t)hay & -16);
|
||||||
|
uint8x16_t v = vld1q_u8((const uint8_t *)hay);
|
||||||
|
uint8x16_t cmp = vorrq_u8(vceqq_u8(v, z), vceqq_u8(v, n));
|
||||||
|
uint8x8_t mask = vshrn_n_u16(vreinterpretq_u16_u8(cmp), 4);
|
||||||
|
uint64_t m;
|
||||||
|
vst1_u8((uint8_t *)&m, mask);
|
||||||
|
m >>= k * 4;
|
||||||
|
m <<= k * 4;
|
||||||
|
while (!m) {
|
||||||
|
hay += 16;
|
||||||
|
progress += 16;
|
||||||
|
v = vld1q_u8((const uint8_t *)hay);
|
||||||
|
cmp = vorrq_u8(vceqq_u8(v, z), vceqq_u8(v, n));
|
||||||
|
mask = vshrn_n_u16(vreinterpretq_u16_u8(cmp), 4);
|
||||||
|
vst1_u8((uint8_t *)&m, mask);
|
||||||
|
}
|
||||||
|
int offset = __builtin_ctzll(m) >> 2;
|
||||||
|
progress += offset;
|
||||||
|
hay += offset;
|
||||||
for (i = 0;; ++i) {
|
for (i = 0;; ++i) {
|
||||||
|
if (--progress <= -512)
|
||||||
|
goto OfferPathologicalAssurances;
|
||||||
if (!needle[i])
|
if (!needle[i])
|
||||||
return (/*unconst*/ char *)haystack;
|
return (/*unconst*/ char *)hay;
|
||||||
if (!haystack[i])
|
if (!hay[i])
|
||||||
break;
|
break;
|
||||||
if (needle[i] != haystack[i])
|
if (needle[i] != hay[i])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!*haystack++)
|
if (!*hay++)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
OfferPathologicalAssurances:
|
||||||
#endif
|
#endif
|
||||||
|
return __memmem_kmp(haystack, strlen(haystack), needle, strlen(needle));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/str/kmp.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,19 +29,5 @@
|
||||||
* @see memmem()
|
* @see memmem()
|
||||||
*/
|
*/
|
||||||
char16_t *strstr16(const char16_t *haystack, const char16_t *needle) {
|
char16_t *strstr16(const char16_t *haystack, const char16_t *needle) {
|
||||||
size_t i;
|
return __memmem_kmp16(haystack, strlen16(haystack), needle, strlen16(needle));
|
||||||
for (;;) {
|
|
||||||
for (i = 0;;) {
|
|
||||||
if (!needle[i])
|
|
||||||
return (/*unconst*/ char16_t *)haystack;
|
|
||||||
if (!haystack[i])
|
|
||||||
break;
|
|
||||||
if (needle[i] != haystack[i])
|
|
||||||
break;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
if (!*haystack++)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,236 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/dce.h"
|
|
||||||
#include "libc/macros.h"
|
|
||||||
#include "libc/str/str.h"
|
|
||||||
/* clang-format off */
|
|
||||||
|
|
||||||
static const struct {
|
|
||||||
unsigned short x;
|
|
||||||
unsigned short y;
|
|
||||||
short d;
|
|
||||||
} kLower[] = {
|
|
||||||
{0x00c0, 0x00d6, +32}, /* 23x À ..Ö → à ..ö Watin */
|
|
||||||
{0x00d8, 0x00de, +32}, /* 7x Ø ..Þ → ø ..þ Watin */
|
|
||||||
{0x0178, 0x0178, -121}, /* 1x Ÿ ..Ÿ → ÿ ..ÿ Watin-A */
|
|
||||||
{0x0179, 0x0179, +1}, /* 1x Ź ..Ź → ź ..ź Watin-A */
|
|
||||||
{0x017b, 0x017b, +1}, /* 1x Ż ..Ż → ż ..ż Watin-A */
|
|
||||||
{0x017d, 0x017d, +1}, /* 1x Ž ..Ž → ž ..ž Watin-A */
|
|
||||||
{0x0181, 0x0181, +210}, /* 1x Ɓ ..Ɓ → ɓ ..ɓ Watin-B */
|
|
||||||
{0x0182, 0x0182, +1}, /* 1x Ƃ ..Ƃ → ƃ ..ƃ Watin-B */
|
|
||||||
{0x0184, 0x0184, +1}, /* 1x Ƅ ..Ƅ → ƅ ..ƅ Watin-B */
|
|
||||||
{0x0186, 0x0186, +206}, /* 1x Ɔ ..Ɔ → ɔ ..ɔ Watin-B */
|
|
||||||
{0x0187, 0x0187, +1}, /* 1x Ƈ ..Ƈ → ƈ ..ƈ Watin-B */
|
|
||||||
{0x0189, 0x018a, +205}, /* 2x Ɖ ..Ɗ → ɖ ..ɗ Watin-B */
|
|
||||||
{0x018b, 0x018b, +1}, /* 1x Ƌ ..Ƌ → ƌ ..ƌ Watin-B */
|
|
||||||
{0x018e, 0x018e, +79}, /* 1x Ǝ ..Ǝ → ǝ ..ǝ Watin-B */
|
|
||||||
{0x018f, 0x018f, +202}, /* 1x Ə ..Ə → ə ..ə Watin-B */
|
|
||||||
{0x0190, 0x0190, +203}, /* 1x Ɛ ..Ɛ → ɛ ..ɛ Watin-B */
|
|
||||||
{0x0191, 0x0191, +1}, /* 1x Ƒ ..Ƒ → ƒ ..ƒ Watin-B */
|
|
||||||
{0x0193, 0x0193, +205}, /* 1x Ɠ ..Ɠ → ɠ ..ɠ Watin-B */
|
|
||||||
{0x0194, 0x0194, +207}, /* 1x Ɣ ..Ɣ → ɣ ..ɣ Watin-B */
|
|
||||||
{0x0196, 0x0196, +211}, /* 1x Ɩ ..Ɩ → ɩ ..ɩ Watin-B */
|
|
||||||
{0x0197, 0x0197, +209}, /* 1x Ɨ ..Ɨ → ɨ ..ɨ Watin-B */
|
|
||||||
{0x0198, 0x0198, +1}, /* 1x Ƙ ..Ƙ → ƙ ..ƙ Watin-B */
|
|
||||||
{0x019c, 0x019c, +211}, /* 1x Ɯ ..Ɯ → ɯ ..ɯ Watin-B */
|
|
||||||
{0x019d, 0x019d, +213}, /* 1x Ɲ ..Ɲ → ɲ ..ɲ Watin-B */
|
|
||||||
{0x019f, 0x019f, +214}, /* 1x Ɵ ..Ɵ → ɵ ..ɵ Watin-B */
|
|
||||||
{0x01a0, 0x01a0, +1}, /* 1x Ơ ..Ơ → ơ ..ơ Watin-B */
|
|
||||||
{0x01a2, 0x01a2, +1}, /* 1x Ƣ ..Ƣ → ƣ ..ƣ Watin-B */
|
|
||||||
{0x01a4, 0x01a4, +1}, /* 1x Ƥ ..Ƥ → ƥ ..ƥ Watin-B */
|
|
||||||
{0x01a6, 0x01a6, +218}, /* 1x Ʀ ..Ʀ → ʀ ..ʀ Watin-B */
|
|
||||||
{0x01a7, 0x01a7, +1}, /* 1x Ƨ ..Ƨ → ƨ ..ƨ Watin-B */
|
|
||||||
{0x01a9, 0x01a9, +218}, /* 1x Ʃ ..Ʃ → ʃ ..ʃ Watin-B */
|
|
||||||
{0x01ac, 0x01ac, +1}, /* 1x Ƭ ..Ƭ → ƭ ..ƭ Watin-B */
|
|
||||||
{0x01ae, 0x01ae, +218}, /* 1x Ʈ ..Ʈ → ʈ ..ʈ Watin-B */
|
|
||||||
{0x01af, 0x01af, +1}, /* 1x Ư ..Ư → ư ..ư Watin-B */
|
|
||||||
{0x01b1, 0x01b2, +217}, /* 2x Ʊ ..Ʋ → ʊ ..ʋ Watin-B */
|
|
||||||
{0x01b3, 0x01b3, +1}, /* 1x Ƴ ..Ƴ → ƴ ..ƴ Watin-B */
|
|
||||||
{0x01b5, 0x01b5, +1}, /* 1x Ƶ ..Ƶ → ƶ ..ƶ Watin-B */
|
|
||||||
{0x01b7, 0x01b7, +219}, /* 1x Ʒ ..Ʒ → ʒ ..ʒ Watin-B */
|
|
||||||
{0x01b8, 0x01b8, +1}, /* 1x Ƹ ..Ƹ → ƹ ..ƹ Watin-B */
|
|
||||||
{0x01bc, 0x01bc, +1}, /* 1x Ƽ ..Ƽ → ƽ ..ƽ Watin-B */
|
|
||||||
{0x01c4, 0x01c4, +2}, /* 1x DŽ ..DŽ → dž ..dž Watin-B */
|
|
||||||
{0x01c5, 0x01c5, +1}, /* 1x Dž ..Dž → dž ..dž Watin-B */
|
|
||||||
{0x01c7, 0x01c7, +2}, /* 1x LJ ..LJ → lj ..lj Watin-B */
|
|
||||||
{0x01c8, 0x01c8, +1}, /* 1x Lj ..Lj → lj ..lj Watin-B */
|
|
||||||
{0x01ca, 0x01ca, +2}, /* 1x NJ ..NJ → nj ..nj Watin-B */
|
|
||||||
{0x01cb, 0x01cb, +1}, /* 1x Nj ..Nj → nj ..nj Watin-B */
|
|
||||||
{0x01cd, 0x01cd, +1}, /* 1x Ǎ ..Ǎ → ǎ ..ǎ Watin-B */
|
|
||||||
{0x01f1, 0x01f1, +2}, /* 1x DZ ..DZ → dz ..dz Watin-B */
|
|
||||||
{0x01f2, 0x01f2, +1}, /* 1x Dz ..Dz → dz ..dz Watin-B */
|
|
||||||
{0x01f4, 0x01f4, +1}, /* 1x Ǵ ..Ǵ → ǵ ..ǵ Watin-B */
|
|
||||||
{0x01f6, 0x01f6, -97}, /* 1x Ƕ ..Ƕ → ƕ ..ƕ Watin-B */
|
|
||||||
{0x01f7, 0x01f7, -56}, /* 1x Ƿ ..Ƿ → ƿ ..ƿ Watin-B */
|
|
||||||
{0x0220, 0x0220, -130}, /* 1x Ƞ ..Ƞ → ƞ ..ƞ Watin-B */
|
|
||||||
{0x023b, 0x023b, +1}, /* 1x Ȼ ..Ȼ → ȼ ..ȼ Watin-B */
|
|
||||||
{0x023d, 0x023d, -163}, /* 1x Ƚ ..Ƚ → ƚ ..ƚ Watin-B */
|
|
||||||
{0x0241, 0x0241, +1}, /* 1x Ɂ ..Ɂ → ɂ ..ɂ Watin-B */
|
|
||||||
{0x0243, 0x0243, -195}, /* 1x Ƀ ..Ƀ → ƀ ..ƀ Watin-B */
|
|
||||||
{0x0244, 0x0244, +69}, /* 1x Ʉ ..Ʉ → ʉ ..ʉ Watin-B */
|
|
||||||
{0x0245, 0x0245, +71}, /* 1x Ʌ ..Ʌ → ʌ ..ʌ Watin-B */
|
|
||||||
{0x0246, 0x0246, +1}, /* 1x Ɇ ..Ɇ → ɇ ..ɇ Watin-B */
|
|
||||||
{0x0248, 0x0248, +1}, /* 1x Ɉ ..Ɉ → ɉ ..ɉ Watin-B */
|
|
||||||
{0x024a, 0x024a, +1}, /* 1x Ɋ ..Ɋ → ɋ ..ɋ Watin-B */
|
|
||||||
{0x024c, 0x024c, +1}, /* 1x Ɍ ..Ɍ → ɍ ..ɍ Watin-B */
|
|
||||||
{0x024e, 0x024e, +1}, /* 1x Ɏ ..Ɏ → ɏ ..ɏ Watin-B */
|
|
||||||
{0x0386, 0x0386, +38}, /* 1x Ά ..Ά → ά ..ά Greek */
|
|
||||||
{0x0388, 0x038a, +37}, /* 3x Έ ..Ί → έ ..ί Greek */
|
|
||||||
{0x038c, 0x038c, +64}, /* 1x Ό ..Ό → ό ..ό Greek */
|
|
||||||
{0x038e, 0x038f, +63}, /* 2x Ύ ..Ώ → ύ ..ώ Greek */
|
|
||||||
{0x0391, 0x03a1, +32}, /* 17x Α ..Ρ → α ..ρ Greek */
|
|
||||||
{0x03a3, 0x03ab, +32}, /* 9x Σ ..Ϋ → σ ..ϋ Greek */
|
|
||||||
{0x03dc, 0x03dc, +1}, /* 1x Ϝ ..Ϝ → ϝ ..ϝ Greek */
|
|
||||||
{0x03f4, 0x03f4, -60}, /* 1x ϴ ..ϴ → θ ..θ Greek */
|
|
||||||
{0x0400, 0x040f, +80}, /* 16x Ѐ ..Џ → ѐ ..џ Cyrillic */
|
|
||||||
{0x0410, 0x042f, +32}, /* 32x А ..Я → а ..я Cyrillic */
|
|
||||||
{0x0460, 0x0460, +1}, /* 1x Ѡ ..Ѡ → ѡ ..ѡ Cyrillic */
|
|
||||||
{0x0462, 0x0462, +1}, /* 1x Ѣ ..Ѣ → ѣ ..ѣ Cyrillic */
|
|
||||||
{0x0464, 0x0464, +1}, /* 1x Ѥ ..Ѥ → ѥ ..ѥ Cyrillic */
|
|
||||||
{0x0472, 0x0472, +1}, /* 1x Ѳ ..Ѳ → ѳ ..ѳ Cyrillic */
|
|
||||||
{0x0490, 0x0490, +1}, /* 1x Ґ ..Ґ → ґ ..ґ Cyrillic */
|
|
||||||
{0x0498, 0x0498, +1}, /* 1x Ҙ ..Ҙ → ҙ ..ҙ Cyrillic */
|
|
||||||
{0x049a, 0x049a, +1}, /* 1x Қ ..Қ → қ ..қ Cyrillic */
|
|
||||||
{0x0531, 0x0556, +48}, /* 38x Ա ..Ֆ → ա ..ֆ Armenian */
|
|
||||||
{0x10a0, 0x10c5, +7264}, /* 38x Ⴀ ..Ⴥ → ⴀ ..ⴥ Georgian */
|
|
||||||
{0x10c7, 0x10c7, +7264}, /* 1x Ⴧ ..Ⴧ → ⴧ ..ⴧ Georgian */
|
|
||||||
{0x10cd, 0x10cd, +7264}, /* 1x Ⴭ ..Ⴭ → ⴭ ..ⴭ Georgian */
|
|
||||||
{0x13f0, 0x13f5, +8}, /* 6x Ᏸ ..Ᏽ → ᏸ ..ᏽ Cherokee */
|
|
||||||
{0x1c90, 0x1cba, -3008}, /* 43x Ა ..Ჺ → ა ..ჺ Georgian2 */
|
|
||||||
{0x1cbd, 0x1cbf, -3008}, /* 3x Ჽ ..Ჿ → ჽ ..ჿ Georgian2 */
|
|
||||||
{0x1f08, 0x1f0f, -8}, /* 8x Ἀ ..Ἇ → ἀ ..ἇ Greek2 */
|
|
||||||
{0x1f18, 0x1f1d, -8}, /* 6x Ἐ ..Ἕ → ἐ ..ἕ Greek2 */
|
|
||||||
{0x1f28, 0x1f2f, -8}, /* 8x Ἠ ..Ἧ → ἠ ..ἧ Greek2 */
|
|
||||||
{0x1f38, 0x1f3f, -8}, /* 8x Ἰ ..Ἷ → ἰ ..ἷ Greek2 */
|
|
||||||
{0x1f48, 0x1f4d, -8}, /* 6x Ὀ ..Ὅ → ὀ ..ὅ Greek2 */
|
|
||||||
{0x1f59, 0x1f59, -8}, /* 1x Ὑ ..Ὑ → ὑ ..ὑ Greek2 */
|
|
||||||
{0x1f5b, 0x1f5b, -8}, /* 1x Ὓ ..Ὓ → ὓ ..ὓ Greek2 */
|
|
||||||
{0x1f5d, 0x1f5d, -8}, /* 1x Ὕ ..Ὕ → ὕ ..ὕ Greek2 */
|
|
||||||
{0x1f5f, 0x1f5f, -8}, /* 1x Ὗ ..Ὗ → ὗ ..ὗ Greek2 */
|
|
||||||
{0x1f68, 0x1f6f, -8}, /* 8x Ὠ ..Ὧ → ὠ ..ὧ Greek2 */
|
|
||||||
{0x1f88, 0x1f8f, -8}, /* 8x ᾈ ..ᾏ → ᾀ ..ᾇ Greek2 */
|
|
||||||
{0x1f98, 0x1f9f, -8}, /* 8x ᾘ ..ᾟ → ᾐ ..ᾗ Greek2 */
|
|
||||||
{0x1fa8, 0x1faf, -8}, /* 8x ᾨ ..ᾯ → ᾠ ..ᾧ Greek2 */
|
|
||||||
{0x1fb8, 0x1fb9, -8}, /* 2x Ᾰ ..Ᾱ → ᾰ ..ᾱ Greek2 */
|
|
||||||
{0x1fba, 0x1fbb, -74}, /* 2x Ὰ ..Ά → ὰ ..ά Greek2 */
|
|
||||||
{0x1fbc, 0x1fbc, -9}, /* 1x ᾼ ..ᾼ → ᾳ ..ᾳ Greek2 */
|
|
||||||
{0x1fc8, 0x1fcb, -86}, /* 4x Ὲ ..Ή → ὲ ..ή Greek2 */
|
|
||||||
{0x1fcc, 0x1fcc, -9}, /* 1x ῌ ..ῌ → ῃ ..ῃ Greek2 */
|
|
||||||
{0x1fd8, 0x1fd9, -8}, /* 2x Ῐ ..Ῑ → ῐ ..ῑ Greek2 */
|
|
||||||
{0x1fda, 0x1fdb, -100}, /* 2x Ὶ ..Ί → ὶ ..ί Greek2 */
|
|
||||||
{0x1fe8, 0x1fe9, -8}, /* 2x Ῠ ..Ῡ → ῠ ..ῡ Greek2 */
|
|
||||||
{0x1fea, 0x1feb, -112}, /* 2x Ὺ ..Ύ → ὺ ..ύ Greek2 */
|
|
||||||
{0x1fec, 0x1fec, -7}, /* 1x Ῥ ..Ῥ → ῥ ..ῥ Greek2 */
|
|
||||||
{0x1ff8, 0x1ff9, -128}, /* 2x Ὸ ..Ό → ὸ ..ό Greek2 */
|
|
||||||
{0x1ffa, 0x1ffb, -126}, /* 2x Ὼ ..Ώ → ὼ ..ώ Greek2 */
|
|
||||||
{0x1ffc, 0x1ffc, -9}, /* 1x ῼ ..ῼ → ῳ ..ῳ Greek2 */
|
|
||||||
{0x2126, 0x2126, -7517}, /* 1x Ω ..Ω → ω ..ω Letterlike */
|
|
||||||
{0x212a, 0x212a, -8383}, /* 1x K ..K → k ..k Letterlike */
|
|
||||||
{0x212b, 0x212b, -8262}, /* 1x Å ..Å → å ..å Letterlike */
|
|
||||||
{0x2132, 0x2132, +28}, /* 1x Ⅎ ..Ⅎ → ⅎ ..ⅎ Letterlike */
|
|
||||||
{0x2160, 0x216f, +16}, /* 16x Ⅰ ..Ⅿ → ⅰ ..ⅿ Numbery */
|
|
||||||
{0x2183, 0x2183, +1}, /* 1x Ↄ ..Ↄ → ↄ ..ↄ Numbery */
|
|
||||||
{0x24b6, 0x24cf, +26}, /* 26x Ⓐ ..Ⓩ → ⓐ ..ⓩ Enclosed */
|
|
||||||
{0x2c00, 0x2c2e, +48}, /* 47x Ⰰ ..Ⱞ → ⰰ ..ⱞ Glagolitic */
|
|
||||||
{0xff21, 0xff3a, +32}, /* 26x A..Z → a..z Dubs */
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int kAstralLower[][3] = {
|
|
||||||
{0x10400, 0x10427, +40}, /* 40x 𐐀 ..𐐧 → 𐐨 ..𐑏 Deseret */
|
|
||||||
{0x104b0, 0x104d3, +40}, /* 36x 𐒰 ..𐓓 → 𐓘 ..𐓻 Osage */
|
|
||||||
{0x1d400, 0x1d419, +26}, /* 26x 𝐀 ..𝐙 → 𝐚 ..𝐳 Math */
|
|
||||||
{0x1d43c, 0x1d44d, +26}, /* 18x 𝐼 ..𝑍 → 𝑖 ..𝑧 Math */
|
|
||||||
{0x1d468, 0x1d481, +26}, /* 26x 𝑨 ..𝒁 → 𝒂 ..𝒛 Math */
|
|
||||||
{0x1d4ae, 0x1d4b5, +26}, /* 8x 𝒮 ..𝒵 → 𝓈 ..𝓏 Math */
|
|
||||||
{0x1d4d0, 0x1d4e9, +26}, /* 26x 𝓐 ..𝓩 → 𝓪 ..𝔃 Math */
|
|
||||||
{0x1d50d, 0x1d514, +26}, /* 8x 𝔍 ..𝔔 → 𝔧 ..𝔮 Math */
|
|
||||||
{0x1d56c, 0x1d585, +26}, /* 26x 𝕬 ..𝖅 → 𝖆 ..𝖟 Math */
|
|
||||||
{0x1d5a0, 0x1d5b9, +26}, /* 26x 𝖠 ..𝖹 → 𝖺 ..𝗓 Math */
|
|
||||||
{0x1d5d4, 0x1d5ed, +26}, /* 26x 𝗔 ..𝗭 → 𝗮 ..𝘇 Math */
|
|
||||||
{0x1d608, 0x1d621, +26}, /* 26x 𝘈 ..𝘡 → 𝘢 ..𝘻 Math */
|
|
||||||
{0x1d63c, 0x1d655, -442}, /* 26x 𝘼 ..𝙕 → 𝒂 ..𝒛 Math */
|
|
||||||
{0x1d670, 0x1d689, +26}, /* 26x 𝙰 ..𝚉 → 𝚊 ..𝚣 Math */
|
|
||||||
{0x1d6a8, 0x1d6b8, +26}, /* 17x 𝚨 ..𝚸 → 𝛂 ..𝛒 Math */
|
|
||||||
{0x1d6e2, 0x1d6f2, +26}, /* 17x 𝛢 ..𝛲 → 𝛼 ..𝜌 Math */
|
|
||||||
{0x1d71c, 0x1d72c, +26}, /* 17x 𝜜 ..𝜬 → 𝜶 ..𝝆 Math */
|
|
||||||
{0x1d756, 0x1d766, +26}, /* 17x 𝝖 ..𝝦 → 𝝰 ..𝞀 Math */
|
|
||||||
{0x1d790, 0x1d7a0, -90}, /* 17x 𝞐 ..𝞠 → 𝜶 ..𝝆 Math */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts wide character to lower case.
|
|
||||||
*/
|
|
||||||
wint_t towlower(wint_t c) {
|
|
||||||
int m, l, r, n;
|
|
||||||
if (c < 0200) {
|
|
||||||
if ('A' <= c && c <= 'Z') {
|
|
||||||
return c + 32;
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
} else if (c <= 0xffff) {
|
|
||||||
if ((0x0100 <= c && c <= 0x0176) || /* 60x Ā..ā → ā..ŵ Watin-A */
|
|
||||||
(0x01de <= c && c <= 0x01ee) || /* 9x Ǟ..Ǯ → ǟ..ǯ Watin-B */
|
|
||||||
(0x01f8 <= c && c <= 0x021e) || /* 20x Ǹ..Ȟ → ǹ..ȟ Watin-B */
|
|
||||||
(0x0222 <= c && c <= 0x0232) || /* 9x Ȣ..Ȳ → ȣ..ȳ Watin-B */
|
|
||||||
(0x1e00 <= c && c <= 0x1eff)) { /*256x Ḁ..Ỿ → ḁ..ỿ Watin-C */
|
|
||||||
if (c == 0x0130) return c - 199;
|
|
||||||
if (c == 0x1e9e) return c;
|
|
||||||
return c + (~c & 1);
|
|
||||||
} else if (0x01cf <= c && c <= 0x01db) {
|
|
||||||
return c + (c & 1); /* 7x Ǐ..Ǜ → ǐ..ǜ Watin-B */
|
|
||||||
} else if (0x13a0 <= c && c <= 0x13ef) {
|
|
||||||
return c + 38864; /* 80x Ꭰ ..Ꮿ → ꭰ ..ꮿ Cherokee */
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kLower) / sizeof(kLower[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kLower[m].y < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (l < n && kLower[l].x <= c && c <= kLower[l].y) {
|
|
||||||
return c + kLower[l].d;
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kAstralLower) / sizeof(kAstralLower[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kAstralLower[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (l < n && kAstralLower[l][0] <= c && c <= kAstralLower[l][1]) {
|
|
||||||
return c + kAstralLower[l][2];
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak_reference(towlower, towlower_l);
|
|
|
@ -1,199 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/dce.h"
|
|
||||||
#include "libc/macros.h"
|
|
||||||
#include "libc/str/str.h"
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
static const struct {
|
|
||||||
unsigned short x;
|
|
||||||
unsigned short y;
|
|
||||||
short d;
|
|
||||||
} kUpper[] = {
|
|
||||||
{0x00b5, 0x00b5, +743}, /* 1x µ ..µ → Μ ..Μ Watin */
|
|
||||||
{0x00e0, 0x00f6, -32}, /* 23x à ..ö → À ..Ö Watin */
|
|
||||||
{0x00f8, 0x00fe, -32}, /* 7x ø ..þ → Ø ..Þ Watin */
|
|
||||||
{0x00ff, 0x00ff, +121}, /* 1x ÿ ..ÿ → Ÿ ..Ÿ Watin */
|
|
||||||
{0x017a, 0x017a, -1}, /* 1x ź ..ź → Ź ..Ź Watin-A */
|
|
||||||
{0x017c, 0x017c, -1}, /* 1x ż ..ż → Ż ..Ż Watin-A */
|
|
||||||
{0x017e, 0x017e, -1}, /* 1x ž ..ž → Ž ..Ž Watin-A */
|
|
||||||
{0x017f, 0x017f, -300}, /* 1x ſ ..ſ → S ..S Watin-A */
|
|
||||||
{0x0180, 0x0180, +195}, /* 1x ƀ ..ƀ → Ƀ ..Ƀ Watin-B */
|
|
||||||
{0x0183, 0x0183, -1}, /* 1x ƃ ..ƃ → Ƃ ..Ƃ Watin-B */
|
|
||||||
{0x0185, 0x0185, -1}, /* 1x ƅ ..ƅ → Ƅ ..Ƅ Watin-B */
|
|
||||||
{0x0188, 0x0188, -1}, /* 1x ƈ ..ƈ → Ƈ ..Ƈ Watin-B */
|
|
||||||
{0x018c, 0x018c, -1}, /* 1x ƌ ..ƌ → Ƌ ..Ƌ Watin-B */
|
|
||||||
{0x0192, 0x0192, -1}, /* 1x ƒ ..ƒ → Ƒ ..Ƒ Watin-B */
|
|
||||||
{0x0195, 0x0195, +97}, /* 1x ƕ ..ƕ → Ƕ ..Ƕ Watin-B */
|
|
||||||
{0x0199, 0x0199, -1}, /* 1x ƙ ..ƙ → Ƙ ..Ƙ Watin-B */
|
|
||||||
{0x019a, 0x019a, +163}, /* 1x ƚ ..ƚ → Ƚ ..Ƚ Watin-B */
|
|
||||||
{0x019e, 0x019e, +130}, /* 1x ƞ ..ƞ → Ƞ ..Ƞ Watin-B */
|
|
||||||
{0x01a1, 0x01a1, -1}, /* 1x ơ ..ơ → Ơ ..Ơ Watin-B */
|
|
||||||
{0x01a3, 0x01a3, -1}, /* 1x ƣ ..ƣ → Ƣ ..Ƣ Watin-B */
|
|
||||||
{0x01a5, 0x01a5, -1}, /* 1x ƥ ..ƥ → Ƥ ..Ƥ Watin-B */
|
|
||||||
{0x01a8, 0x01a8, -1}, /* 1x ƨ ..ƨ → Ƨ ..Ƨ Watin-B */
|
|
||||||
{0x01ad, 0x01ad, -1}, /* 1x ƭ ..ƭ → Ƭ ..Ƭ Watin-B */
|
|
||||||
{0x01b0, 0x01b0, -1}, /* 1x ư ..ư → Ư ..Ư Watin-B */
|
|
||||||
{0x01b4, 0x01b4, -1}, /* 1x ƴ ..ƴ → Ƴ ..Ƴ Watin-B */
|
|
||||||
{0x01b6, 0x01b6, -1}, /* 1x ƶ ..ƶ → Ƶ ..Ƶ Watin-B */
|
|
||||||
{0x01b9, 0x01b9, -1}, /* 1x ƹ ..ƹ → Ƹ ..Ƹ Watin-B */
|
|
||||||
{0x01bd, 0x01bd, -1}, /* 1x ƽ ..ƽ → Ƽ ..Ƽ Watin-B */
|
|
||||||
{0x01bf, 0x01bf, +56}, /* 1x ƿ ..ƿ → Ƿ ..Ƿ Watin-B */
|
|
||||||
{0x01c5, 0x01c5, -1}, /* 1x Dž ..Dž → DŽ ..DŽ Watin-B */
|
|
||||||
{0x01c6, 0x01c6, -2}, /* 1x dž ..dž → DŽ ..DŽ Watin-B */
|
|
||||||
{0x01c8, 0x01c8, -1}, /* 1x Lj ..Lj → LJ ..LJ Watin-B */
|
|
||||||
{0x01c9, 0x01c9, -2}, /* 1x lj ..lj → LJ ..LJ Watin-B */
|
|
||||||
{0x01cb, 0x01cb, -1}, /* 1x Nj ..Nj → NJ ..NJ Watin-B */
|
|
||||||
{0x01cc, 0x01cc, -2}, /* 1x nj ..nj → NJ ..NJ Watin-B */
|
|
||||||
{0x01ce, 0x01ce, -1}, /* 1x ǎ ..ǎ → Ǎ ..Ǎ Watin-B */
|
|
||||||
{0x01dd, 0x01dd, -79}, /* 1x ǝ ..ǝ → Ǝ ..Ǝ Watin-B */
|
|
||||||
{0x01f2, 0x01f2, -1}, /* 1x Dz ..Dz → DZ ..DZ Watin-B */
|
|
||||||
{0x01f3, 0x01f3, -2}, /* 1x dz ..dz → DZ ..DZ Watin-B */
|
|
||||||
{0x01f5, 0x01f5, -1}, /* 1x ǵ ..ǵ → Ǵ ..Ǵ Watin-B */
|
|
||||||
{0x023c, 0x023c, -1}, /* 1x ȼ ..ȼ → Ȼ ..Ȼ Watin-B */
|
|
||||||
{0x023f, 0x0240, +10815}, /* 2x ȿ ..ɀ → Ȿ ..Ɀ Watin-B */
|
|
||||||
{0x0242, 0x0242, -1}, /* 1x ɂ ..ɂ → Ɂ ..Ɂ Watin-B */
|
|
||||||
{0x0247, 0x0247, -1}, /* 1x ɇ ..ɇ → Ɇ ..Ɇ Watin-B */
|
|
||||||
{0x0249, 0x0249, -1}, /* 1x ɉ ..ɉ → Ɉ ..Ɉ Watin-B */
|
|
||||||
{0x024b, 0x024b, -1}, /* 1x ɋ ..ɋ → Ɋ ..Ɋ Watin-B */
|
|
||||||
{0x024d, 0x024d, -1}, /* 1x ɍ ..ɍ → Ɍ ..Ɍ Watin-B */
|
|
||||||
{0x024f, 0x024f, -1}, /* 1x ɏ ..ɏ → Ɏ ..Ɏ Watin-B */
|
|
||||||
{0x037b, 0x037d, +130}, /* 3x ͻ ..ͽ → Ͻ ..Ͽ Greek */
|
|
||||||
{0x03ac, 0x03ac, -38}, /* 1x ά ..ά → Ά ..Ά Greek */
|
|
||||||
{0x03ad, 0x03af, -37}, /* 3x έ ..ί → Έ ..Ί Greek */
|
|
||||||
{0x03b1, 0x03c1, -32}, /* 17x α ..ρ → Α ..Ρ Greek */
|
|
||||||
{0x03c2, 0x03c2, -31}, /* 1x ς ..ς → Σ ..Σ Greek */
|
|
||||||
{0x03c3, 0x03cb, -32}, /* 9x σ ..ϋ → Σ ..Ϋ Greek */
|
|
||||||
{0x03cc, 0x03cc, -64}, /* 1x ό ..ό → Ό ..Ό Greek */
|
|
||||||
{0x03cd, 0x03ce, -63}, /* 2x ύ ..ώ → Ύ ..Ώ Greek */
|
|
||||||
{0x03d0, 0x03d0, -62}, /* 1x ϐ ..ϐ → Β ..Β Greek */
|
|
||||||
{0x03d1, 0x03d1, -57}, /* 1x ϑ ..ϑ → Θ ..Θ Greek */
|
|
||||||
{0x03d5, 0x03d5, -47}, /* 1x ϕ ..ϕ → Φ ..Φ Greek */
|
|
||||||
{0x03d6, 0x03d6, -54}, /* 1x ϖ ..ϖ → Π ..Π Greek */
|
|
||||||
{0x03dd, 0x03dd, -1}, /* 1x ϝ ..ϝ → Ϝ ..Ϝ Greek */
|
|
||||||
{0x03f0, 0x03f0, -86}, /* 1x ϰ ..ϰ → Κ ..Κ Greek */
|
|
||||||
{0x03f1, 0x03f1, -80}, /* 1x ϱ ..ϱ → Ρ ..Ρ Greek */
|
|
||||||
{0x03f5, 0x03f5, -96}, /* 1x ϵ ..ϵ → Ε ..Ε Greek */
|
|
||||||
{0x0430, 0x044f, -32}, /* 32x а ..я → А ..Я Cyrillic */
|
|
||||||
{0x0450, 0x045f, -80}, /* 16x ѐ ..џ → Ѐ ..Џ Cyrillic */
|
|
||||||
{0x0461, 0x0461, -1}, /* 1x ѡ ..ѡ → Ѡ ..Ѡ Cyrillic */
|
|
||||||
{0x0463, 0x0463, -1}, /* 1x ѣ ..ѣ → Ѣ ..Ѣ Cyrillic */
|
|
||||||
{0x0465, 0x0465, -1}, /* 1x ѥ ..ѥ → Ѥ ..Ѥ Cyrillic */
|
|
||||||
{0x0473, 0x0473, -1}, /* 1x ѳ ..ѳ → Ѳ ..Ѳ Cyrillic */
|
|
||||||
{0x0491, 0x0491, -1}, /* 1x ґ ..ґ → Ґ ..Ґ Cyrillic */
|
|
||||||
{0x0499, 0x0499, -1}, /* 1x ҙ ..ҙ → Ҙ ..Ҙ Cyrillic */
|
|
||||||
{0x049b, 0x049b, -1}, /* 1x қ ..қ → Қ ..Қ Cyrillic */
|
|
||||||
{0x0561, 0x0586, -48}, /* 38x ա ..ֆ → Ա ..Ֆ Armenian */
|
|
||||||
{0x10d0, 0x10fa, +3008}, /* 43x ა ..ჺ → Ა ..Ჺ Georgian */
|
|
||||||
{0x10fd, 0x10ff, +3008}, /* 3x ჽ ..ჿ → Ჽ ..Ჿ Georgian */
|
|
||||||
{0x13f8, 0x13fd, -8}, /* 6x ᏸ ..ᏽ → Ᏸ ..Ᏽ Cherokee */
|
|
||||||
{0x214e, 0x214e, -28}, /* 1x ⅎ ..ⅎ → Ⅎ ..Ⅎ Letterlike */
|
|
||||||
{0x2170, 0x217f, -16}, /* 16x ⅰ ..ⅿ → Ⅰ ..Ⅿ Numbery */
|
|
||||||
{0x2184, 0x2184, -1}, /* 1x ↄ ..ↄ → Ↄ ..Ↄ Numbery */
|
|
||||||
{0x24d0, 0x24e9, -26}, /* 26x ⓐ ..ⓩ → Ⓐ ..Ⓩ Enclosed */
|
|
||||||
{0x2c30, 0x2c5e, -48}, /* 47x ⰰ ..ⱞ → Ⰰ ..Ⱞ Glagolitic */
|
|
||||||
{0x2d00, 0x2d25, -7264}, /* 38x ⴀ ..ⴥ → Ⴀ ..Ⴥ Georgian2 */
|
|
||||||
{0x2d27, 0x2d27, -7264}, /* 1x ⴧ ..ⴧ → Ⴧ ..Ⴧ Georgian2 */
|
|
||||||
{0x2d2d, 0x2d2d, -7264}, /* 1x ⴭ ..ⴭ → Ⴭ ..Ⴭ Georgian2 */
|
|
||||||
{0xff41, 0xff5a, -32}, /* 26x a..z → A..Z Dubs */
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int kAstralUpper[][3] = {
|
|
||||||
{0x10428, 0x1044f, -40}, /* 40x 𐐨..𐑏 → 𐐀..𐐧 Deseret */
|
|
||||||
{0x104d8, 0x104fb, -40}, /* 36x 𐓘..𐓻 → 𐒰..𐓓 Osage */
|
|
||||||
{0x1d41a, 0x1d433, -26}, /* 26x 𝐚..𝐳 → 𝐀..𝐙 Math */
|
|
||||||
{0x1d456, 0x1d467, -26}, /* 18x 𝑖..𝑧 → 𝐼..𝑍 Math */
|
|
||||||
{0x1d482, 0x1d49b, -26}, /* 26x 𝒂..𝒛 → 𝑨..𝒁 Math */
|
|
||||||
{0x1d4c8, 0x1d4cf, -26}, /* 8x 𝓈..𝓏 → 𝒮..𝒵 Math */
|
|
||||||
{0x1d4ea, 0x1d503, -26}, /* 26x 𝓪..𝔃 → 𝓐..𝓩 Math */
|
|
||||||
{0x1d527, 0x1d52e, -26}, /* 8x 𝔧..𝔮 → 𝔍..𝔔 Math */
|
|
||||||
{0x1d586, 0x1d59f, -26}, /* 26x 𝖆..𝖟 → 𝕬..𝖅 Math */
|
|
||||||
{0x1d5ba, 0x1d5d3, -26}, /* 26x 𝖺..𝗓 → 𝖠..𝖹 Math */
|
|
||||||
{0x1d5ee, 0x1d607, -26}, /* 26x 𝗮..𝘇 → 𝗔..𝗭 Math */
|
|
||||||
{0x1d622, 0x1d63b, -26}, /* 26x 𝘢..𝘻 → 𝘈..𝘡 Math */
|
|
||||||
{0x1d68a, 0x1d6a3, +442}, /* 26x 𝒂..𝒛 → 𝘼..𝙕 Math */
|
|
||||||
{0x1d6c2, 0x1d6d2, -26}, /* 26x 𝚊..𝚣 → 𝙰..𝚉 Math */
|
|
||||||
{0x1d6fc, 0x1d70c, -26}, /* 17x 𝛂..𝛒 → 𝚨..𝚸 Math */
|
|
||||||
{0x1d736, 0x1d746, -26}, /* 17x 𝛼..𝜌 → 𝛢..𝛲 Math */
|
|
||||||
{0x1d770, 0x1d780, -26}, /* 17x 𝜶..𝝆 → 𝜜..𝜬 Math */
|
|
||||||
{0x1d770, 0x1d756, -26}, /* 17x 𝝰..𝞀 → 𝝖..𝝦 Math */
|
|
||||||
{0x1d736, 0x1d790, -90}, /* 17x 𝜶..𝝆 → 𝞐..𝞠 Math */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts wide character to upper case.
|
|
||||||
*/
|
|
||||||
wint_t towupper(wint_t c) {
|
|
||||||
int m, l, r, n;
|
|
||||||
if (c < 0200) {
|
|
||||||
if ('a' <= c && c <= 'z') {
|
|
||||||
return c - 32;
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
} else if (c <= 0xffff) {
|
|
||||||
if ((0x0101 <= c && c <= 0x0177) || /* 60x ā..ŵ → Ā..ā Watin-A */
|
|
||||||
(0x01df <= c && c <= 0x01ef) || /* 9x ǟ..ǯ → Ǟ..Ǯ Watin-B */
|
|
||||||
(0x01f8 <= c && c <= 0x021e) || /* 20x ǹ..ȟ → Ǹ..Ȟ Watin-B */
|
|
||||||
(0x0222 <= c && c <= 0x0232) || /* 9x ȣ..ȳ → Ȣ..Ȳ Watin-B */
|
|
||||||
(0x1e01 <= c && c <= 0x1eff)) { /*256x ḁ..ỿ → Ḁ..Ỿ Watin-C */
|
|
||||||
if (c == 0x0131) return c + 232;
|
|
||||||
if (c == 0x1e9e) return c;
|
|
||||||
return c - (c & 1);
|
|
||||||
} else if (0x01d0 <= c && c <= 0x01dc) {
|
|
||||||
return c - (~c & 1); /* 7x ǐ..ǜ → Ǐ..Ǜ Watin-B */
|
|
||||||
} else if (0xab70 <= c && c <= 0xabbf) {
|
|
||||||
return c - 38864; /* 80x ꭰ ..ꮿ → Ꭰ ..Ꮿ Cherokee Supplement */
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kUpper) / sizeof(kUpper[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kUpper[m].y < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (l < n && kUpper[l].x <= c && c <= kUpper[l].y) {
|
|
||||||
return c + kUpper[l].d;
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kAstralUpper) / sizeof(kAstralUpper[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kAstralUpper[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (l < n && kAstralUpper[l][0] <= c && c <= kAstralUpper[l][1]) {
|
|
||||||
return c + kAstralUpper[l][2];
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak_reference(towupper, towupper_l);
|
|
|
@ -16,6 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/str/kmp.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,19 +29,5 @@
|
||||||
* @see memmem()
|
* @see memmem()
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle) {
|
wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle) {
|
||||||
size_t i;
|
return __memmem_kmp32(haystack, wcslen(haystack), needle, wcslen(needle));
|
||||||
for (;;) {
|
|
||||||
for (i = 0;;) {
|
|
||||||
if (!needle[i])
|
|
||||||
return (/*unconst*/ wchar_t *)haystack;
|
|
||||||
if (!haystack[i])
|
|
||||||
break;
|
|
||||||
if (needle[i] != haystack[i])
|
|
||||||
break;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
if (!*haystack++)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
|
||||||
│ │
|
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "libc/str/str.h"
|
|
||||||
#include "libc/wctype.h"
|
|
||||||
|
|
||||||
wctrans_t wctrans(const char *s) {
|
|
||||||
if (!strcmp(s, "toupper"))
|
|
||||||
return (wctrans_t)1;
|
|
||||||
if (!strcmp(s, "tolower"))
|
|
||||||
return (wctrans_t)2;
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,44 +1,61 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
||||||
│ │
|
│ │
|
||||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
│ Musl Libc │
|
||||||
│ any purpose with or without fee is hereby granted, provided that the │
|
│ Copyright © 2005-2014 Rich Felker, et al. │
|
||||||
│ above copyright notice and this permission notice appear in all copies. │
|
│ │
|
||||||
|
│ Permission is hereby granted, free of charge, to any person obtaining │
|
||||||
|
│ a copy of this software and associated documentation files (the │
|
||||||
|
│ "Software"), to deal in the Software without restriction, including │
|
||||||
|
│ without limitation the rights to use, copy, modify, merge, publish, │
|
||||||
|
│ distribute, sublicense, and/or sell copies of the Software, and to │
|
||||||
|
│ permit persons to whom the Software is furnished to do so, subject to │
|
||||||
|
│ the following conditions: │
|
||||||
|
│ │
|
||||||
|
│ The above copyright notice and this permission notice shall be │
|
||||||
|
│ included in all copies or substantial portions of the Software. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, │
|
||||||
|
│ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF │
|
||||||
|
│ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. │
|
||||||
|
│ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY │
|
||||||
|
│ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, │
|
||||||
|
│ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE │
|
||||||
|
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||||
│ │
|
│ │
|
||||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
||||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
||||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
||||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
||||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
||||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/intrin/likely.h"
|
|
||||||
#include "libc/str/unicode.h"
|
#include "libc/str/unicode.h"
|
||||||
#include "libc/str/wcwidth_osx.internal.h"
|
__static_yoink("musl_libc_notice");
|
||||||
#include "libc/wctype.h"
|
// clang-format off
|
||||||
|
|
||||||
/**
|
static const unsigned char table[] = {
|
||||||
* Returns cell width of monospace character.
|
#include "nonspacing.inc"
|
||||||
*/
|
};
|
||||||
int wcwidth(wchar_t c) {
|
|
||||||
int res;
|
static const unsigned char wtable[] = {
|
||||||
if (LIKELY(32 <= c && c < 127))
|
#include "wide.inc"
|
||||||
return 1;
|
};
|
||||||
if (VERY_UNLIKELY((uint32_t)c >= 0x100000)) {
|
|
||||||
if ((uint32_t)c <= 0x10FFFD)
|
int wcwidth(wchar_t wc)
|
||||||
return 1;
|
{
|
||||||
return -1;
|
if (wc < 0xff) {
|
||||||
}
|
if (wc >= 0)
|
||||||
res = _wcwidth_osx(c);
|
return ((wc+1) & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0;
|
||||||
if (VERY_UNLIKELY(!res)) {
|
return -1;
|
||||||
if (!c)
|
}
|
||||||
return 0;
|
if ((wc & 0xfffeffffU) < 0xfffe) {
|
||||||
if (iswcntrl(c))
|
if ((table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
|
||||||
return -1;
|
return 0;
|
||||||
}
|
if ((wtable[wtable[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
|
||||||
return res;
|
return 2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ((wc & 0xfffe) == 0xfffe)
|
||||||
|
return -1;
|
||||||
|
if (wc-0x20000U < 0x20000)
|
||||||
|
return 2;
|
||||||
|
if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100U < 0xef)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,238 +0,0 @@
|
||||||
// Copyright (c) 2012 Byron Lai
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
// a copy of this software and associated documentation files (the
|
|
||||||
// "Software"), to deal in the Software without restriction, including
|
|
||||||
// without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
// permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
// the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be
|
|
||||||
// included in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
#include "libc/macros.h"
|
|
||||||
#include "libc/str/wcwidth_osx.internal.h"
|
|
||||||
|
|
||||||
const uint8_t kWcwidthOsxIndex1[] = {
|
|
||||||
0, 16, 26, 33, 34, 50, 56, 72, 88, 104, 107, 107, 107, 107,
|
|
||||||
115, 127, 143, 143, 143, 143, 143, 156, 160, 164, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
|
||||||
178, 178, 178, 178, 178, 178, 178, 178, 194, 194, 194, 194, 194, 194,
|
|
||||||
194, 195, 211, 211, 211, 211, 211, 211, 211, 212,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t kWcwidthOsxIndex2[] = {
|
|
||||||
0, 8, 22, 38, 54, 70, 86, 102, 118, 134, 150, 163, 179, 195, 211,
|
|
||||||
227, 243, 256, 272, 284, 299, 305, 321, 336, 352, 368, 376, 376, 376, 376,
|
|
||||||
376, 376, 379, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
|
|
||||||
393, 393, 393, 393, 396, 412, 412, 424, 439, 455, 471, 487, 487, 487, 487,
|
|
||||||
487, 487, 487, 487, 487, 487, 487, 490, 504, 504, 504, 504, 520, 520, 520,
|
|
||||||
520, 520, 520, 520, 520, 520, 520, 520, 520, 529, 544, 559, 575, 591, 607,
|
|
||||||
623, 629, 645, 661, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 680,
|
|
||||||
685, 701, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
|
|
||||||
705, 705, 705, 721, 737, 753, 764, 780, 780, 780, 780, 780, 780, 780, 780,
|
|
||||||
796, 801, 801, 801, 801, 801, 801, 801, 817, 817, 817, 817, 817, 817, 817,
|
|
||||||
817, 817, 817, 817, 817, 817, 817, 817, 817, 827, 834, 834, 834, 834, 834,
|
|
||||||
834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 850, 866, 867, 867,
|
|
||||||
867, 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, 867, 883,
|
|
||||||
883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883,
|
|
||||||
884, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900,
|
|
||||||
900, 900, 901,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint32_t kWcwidthOsxIndex3[] = {
|
|
||||||
0, 32, 32, 33, 64, 96, 96, 96, 96, 96, 96, 96,
|
|
||||||
96, 96, 96, 96, 128, 128, 128, 144, 175, 205, 208, 208,
|
|
||||||
208, 208, 237, 247, 247, 247, 247, 275, 292, 316, 340, 351,
|
|
||||||
381, 402, 428, 457, 478, 510, 527, 527, 537, 564, 582, 600,
|
|
||||||
619, 632, 632, 658, 690, 711, 738, 738, 738, 738, 738, 738,
|
|
||||||
738, 738, 767, 773, 804, 834, 866, 889, 920, 951, 980, 1003,
|
|
||||||
1034, 1065, 1094, 1117, 1148, 1180, 1210, 1233, 1263, 1294, 1323, 1355,
|
|
||||||
1384, 1410, 1441, 1464, 1495, 1527, 1559, 1582, 1611, 1643, 1673, 1696,
|
|
||||||
1727, 1759, 1791, 1817, 1849, 1881, 1912, 1927, 1958, 1986, 2017, 2049,
|
|
||||||
2081, 2111, 2143, 2169, 2195, 2214, 2240, 2252, 2282, 2303, 2335, 2354,
|
|
||||||
2380, 2406, 2412, 2442, 2468, 2484, 2516, 2516, 2522, 2554, 2554, 2554,
|
|
||||||
2554, 2554, 2586, 2586, 2609, 2641, 2664, 2680, 2710, 2734, 2749, 2773,
|
|
||||||
2778, 2810, 2813, 2845, 2845, 2856, 2887, 2888, 2888, 2888, 2888, 2888,
|
|
||||||
2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2888, 2897, 2929,
|
|
||||||
2961, 2961, 2976, 3008, 3040, 3072, 3104, 3136, 3148, 3178, 3210, 3242,
|
|
||||||
3274, 3274, 3282, 3314, 3337, 3348, 3348, 3380, 3409, 3441, 3459, 3491,
|
|
||||||
3513, 3535, 3565, 3574, 3606, 3606, 3606, 3606, 3606, 3606, 3606, 3634,
|
|
||||||
3646, 3676, 3697, 3729, 3750, 3776, 3776, 3808, 3816, 3830, 3843, 3875,
|
|
||||||
3875, 3875, 3875, 3907, 3907, 3907, 3907, 3907, 3907, 3939, 3964, 3996,
|
|
||||||
3996, 3996, 3996, 3996, 3996, 3996, 3996, 4006, 4038, 4064, 4095, 4127,
|
|
||||||
4138, 4154, 4183, 4215, 4239, 4254, 4286, 4306, 4338, 4360, 4376, 4408,
|
|
||||||
4408, 4424, 4443, 4466, 4482, 4482, 4482, 4482, 4482, 4482, 4482, 4482,
|
|
||||||
4482, 4505, 4516, 4516, 4516, 4516, 4516, 4540, 4572, 4597, 4629, 4661,
|
|
||||||
4661, 4661, 4661, 4661, 4661, 4661, 4661, 4661, 4661, 4661, 4661, 4661,
|
|
||||||
4663, 4695, 4723, 4727, 4758, 4782, 4802, 4833, 4844, 4868, 4888, 4904,
|
|
||||||
4904, 4904, 4904, 4904, 4904, 4904, 4904, 4904, 4904, 4904, 4904, 4904,
|
|
||||||
4904, 4904, 4904, 4923, 4944, 4944, 4944, 4944, 4944, 4976, 4993, 5009,
|
|
||||||
5024, 5056, 5056, 5056, 5077, 5102, 5128, 5144, 5170, 5202, 5234, 5234,
|
|
||||||
5266, 5281, 5298, 5298, 5330, 5357, 5357, 5369, 5401, 5401, 5401, 5401,
|
|
||||||
5401, 5401, 5411, 5433, 5465, 5487, 5519, 5520, 5529, 5556, 5556, 5556,
|
|
||||||
5588, 5606, 5623, 5623, 5640, 5656, 5664, 5680, 5696, 5728, 5756, 5772,
|
|
||||||
5772, 5772, 5772, 5773, 5805, 5805, 5805, 5805, 5805, 5805, 5805, 5805,
|
|
||||||
5805, 5805, 5805, 5805, 5805, 5805, 5805, 5805, 5815, 5847, 5847, 5847,
|
|
||||||
5847, 5847, 5847, 5847, 5847, 5847, 5847, 5847, 5847, 5847, 5847, 5847,
|
|
||||||
5847, 5851, 5879, 5879, 5911, 5911, 5911, 5911, 5911, 5911, 5911, 5911,
|
|
||||||
5911, 5911, 5911, 5911, 5911, 5911, 5911, 5911, 5930, 5946, 5971, 5978,
|
|
||||||
6010, 6010, 6010, 6010, 6010, 6010, 6010, 6010, 6030, 6062, 6094, 6122,
|
|
||||||
6146, 6146, 6146, 6178, 6178, 6178, 6178, 6197, 6210, 6210, 6215, 6245,
|
|
||||||
6272, 6304, 6312, 6344, 6344, 6371, 6397, 6429, 6429, 6441, 6473, 6473,
|
|
||||||
6473, 6473, 6473, 6505, 6514, 6546, 6578, 6578, 6578, 6578, 6578, 6578,
|
|
||||||
6578, 6578, 6578, 6578, 6578, 6578, 6578, 6610, 6610, 6610, 6610, 6610,
|
|
||||||
6610, 6610, 6610, 6610, 6610, 6610, 6610, 6610, 6610, 6610, 6610, 6638,
|
|
||||||
6642, 6642, 6642, 6642, 6642, 6642, 6642, 6642, 6642, 6642, 6642, 6642,
|
|
||||||
6642, 6642, 6642, 6642, 6674, 6674, 6674, 6674, 6674, 6674, 6674, 6674,
|
|
||||||
6674, 6674, 6674, 6674, 6674, 6674, 6674, 6674, 6690, 6722, 6722, 6722,
|
|
||||||
6722, 6722, 6722, 6722, 6722, 6740, 6756, 6777, 6793, 6793, 6799, 6825,
|
|
||||||
6857, 6888, 6920, 6926, 6926, 6940, 6958, 6977, 6977, 6977, 6977, 6977,
|
|
||||||
6977, 6977, 6977, 6977, 6977, 7009, 7025, 7041, 7059, 7083, 7099, 7129,
|
|
||||||
7157, 7173, 7198, 7220, 7220, 7220, 7223, 7254, 7255, 7255, 7286, 7287,
|
|
||||||
7288, 7319, 7351, 7383, 7388, 7419, 7449, 7481, 7481, 7481, 7486, 7518,
|
|
||||||
7530, 7553, 7553, 7574, 7602, 7618, 7634, 7664, 7664, 7664, 7664, 7696,
|
|
||||||
7728, 7743, 7760, 7792, 7819, 7840, 7851, 7883, 7914, 7942, 7964, 7996,
|
|
||||||
7996, 7996, 7996, 7998, 8018, 8028, 8028, 8028, 8028, 8028, 8028, 8028,
|
|
||||||
8028, 8028, 8028, 8028, 8028, 8028, 8028, 8028, 8028, 8060, 8070, 8102,
|
|
||||||
8102, 8102, 8102, 8102, 8102, 8134, 8166, 8166, 8166, 8166, 8166, 8166,
|
|
||||||
8166, 8198, 8223, 8255, 8280, 8280, 8280, 8280, 8280, 8280, 8280, 8280,
|
|
||||||
8280, 8280, 8280, 8280, 8280, 8280, 8280, 8280, 8312, 8312, 8312, 8312,
|
|
||||||
8312, 8312, 8312, 8312, 8312, 8312, 8312, 8312, 8312, 8312, 8312, 8312,
|
|
||||||
8329, 8344, 8344, 8344, 8344, 8376, 8376, 8376, 8405, 8425, 8425, 8425,
|
|
||||||
8425, 8425, 8425, 8425, 8425, 8425, 8425, 8425, 8425, 8425, 8425, 8425,
|
|
||||||
8425, 8457, 8457, 8457, 8457, 8457, 8457, 8457, 8467, 8499, 8524, 8533,
|
|
||||||
8558, 8587, 8609, 8623, 8653, 8685, 8685, 8715, 8721, 8721, 8721, 8721,
|
|
||||||
8721, 8753, 8753, 8762, 8767, 8785, 8785, 8785, 8785, 8817, 8817, 8828,
|
|
||||||
8850, 8853, 8885, 8914, 8919, 8945, 8975, 9007, 9025, 9025, 9025, 9025,
|
|
||||||
9025, 9051, 9059, 9059, 9059, 9059, 9059, 9059, 9059, 9059, 9079, 9093,
|
|
||||||
9125, 9125, 9125, 9125, 9125, 9125, 9125, 9125, 9125, 9125, 9125, 9125,
|
|
||||||
9125, 9125, 9125, 9125, 9157, 9177, 9193, 9193, 9205, 9225, 9225, 9225,
|
|
||||||
9225, 9225, 9225, 9225, 9225, 9225, 9225, 9225, 9225, 9225, 9225, 9225,
|
|
||||||
9225, 9257, 9257, 9257, 9257, 9257, 9257, 9257, 9257, 9257, 9257, 9257,
|
|
||||||
9257, 9257, 9257, 9257, 9257, 9266, 9289, 9289, 9289, 9289, 9289, 9289,
|
|
||||||
9289, 9289, 9289, 9289, 9289, 9289, 9289, 9289, 9289, 9289, 9321, 9321,
|
|
||||||
9321, 9321, 9321, 9321, 9321, 9321, 9321, 9321, 9321, 9321, 9321, 9321,
|
|
||||||
9321, 9321, 9323, 9353, 9353, 9353, 9353, 9353, 9353, 9353, 9353, 9353,
|
|
||||||
9353, 9353, 9353, 9353, 9353, 9353, 9353, 9385, 9385, 9385, 9385, 9385,
|
|
||||||
9385, 9385, 9385, 9385, 9385, 9385, 9385, 9385, 9385, 9385, 9385, 9387,
|
|
||||||
9419, 9419, 9419, 9419, 9419, 9419, 9419, 9419, 9419, 9419, 9419, 9419,
|
|
||||||
9419, 9419, 9419, 9419, 9421,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint32_t kWcwidthOsx[] = {
|
|
||||||
0x00000000, 0x00000000, 0x55555555, 0x55555555, 0x00000000, 0x00000000,
|
|
||||||
0x55555555, 0x55555555, 0x00000000, 0x00000000, 0x15505555, 0x54455540,
|
|
||||||
0x15555555, 0x55555555, 0x55555555, 0x55554000, 0x55555555, 0x00001555,
|
|
||||||
0x55555500, 0x54155555, 0x55555555, 0x14555555, 0x00000000, 0x04000000,
|
|
||||||
0x54000041, 0x01555555, 0x00001550, 0x00555550, 0x55505550, 0x55555555,
|
|
||||||
0x00015555, 0x50000000, 0x45555555, 0x55555555, 0x15555555, 0x04140000,
|
|
||||||
0x55555550, 0x55551055, 0x00005555, 0x55550000, 0x55555555, 0x00005555,
|
|
||||||
0x00000040, 0x55555550, 0x55555555, 0x55400005, 0x00000005, 0x00000000,
|
|
||||||
0x55555550, 0x15555555, 0x54000150, 0x55000101, 0x55555055, 0x54000155,
|
|
||||||
0x15554505, 0x55555414, 0x40455545, 0x40015015, 0x40001141, 0x54014500,
|
|
||||||
0x55555555, 0x15544005, 0x55554140, 0x14555455, 0x00140145, 0x00400000,
|
|
||||||
0x40011540, 0x15415555, 0x55440000, 0x55545455, 0x45554555, 0x01501551,
|
|
||||||
0x01014400, 0x05000000, 0x04555550, 0x45000000, 0x54141555, 0x55455555,
|
|
||||||
0x50155145, 0x00505040, 0x51401000, 0x55555505, 0x10000000, 0x54540555,
|
|
||||||
0x50144501, 0x55540540, 0x50140155, 0x40010151, 0x55550000, 0x01555555,
|
|
||||||
0x45555150, 0x55555545, 0x54555551, 0x00550405, 0x40000000, 0x54154001,
|
|
||||||
0x40001555, 0x55141555, 0x55545455, 0x55551555, 0x55405545, 0x00001454,
|
|
||||||
0x01440005, 0x05155554, 0x51400000, 0x55454555, 0x55515555, 0x54055555,
|
|
||||||
0x00545440, 0x40001000, 0x55555415, 0x15550155, 0x55555514, 0x55540555,
|
|
||||||
0x55155555, 0x55541155, 0x00150000, 0x00015554, 0x05400000, 0x55540000,
|
|
||||||
0x55555555, 0x00145555, 0x01555000, 0x55555400, 0x00000005, 0x00000000,
|
|
||||||
0x10450450, 0x55515400, 0x51411151, 0x10000145, 0x00004554, 0x14155554,
|
|
||||||
0x00000000, 0x40000000, 0x55555555, 0x55541555, 0x45555555, 0x55155544,
|
|
||||||
0x55555555, 0x00000015, 0x00550400, 0x00000000, 0x55500000, 0x15551554,
|
|
||||||
0x00000000, 0x40000000, 0x55555555, 0x15555555, 0x55105440, 0x55555555,
|
|
||||||
0x55555055, 0x55555555, 0x55500555, 0x55555555, 0x00055555, 0x55555500,
|
|
||||||
0x55555555, 0xaaaaaa01, 0xaaaaaaaa, 0x000800aa, 0x00000000, 0x55500000,
|
|
||||||
0x55555555, 0x15455555, 0x15445554, 0x55555554, 0x55555555, 0x55550551,
|
|
||||||
0x05515555, 0x50551555, 0x51555555, 0x55555555, 0x45555555, 0x55555415,
|
|
||||||
0x55555555, 0x55500155, 0x55555555, 0x54001555, 0x55555555, 0x01555555,
|
|
||||||
0x55550000, 0x55555555, 0x00005555, 0x55555554, 0x05555555, 0x55555554,
|
|
||||||
0x55555555, 0x00000001, 0x51555555, 0x00000005, 0x55555555, 0x00001405,
|
|
||||||
0x55555555, 0x00000005, 0x51555555, 0x00000001, 0x55555555, 0x55555555,
|
|
||||||
0x55500010, 0x50000014, 0x55501555, 0x55500055, 0x55500055, 0x55510155,
|
|
||||||
0x55500055, 0x55555555, 0x00055555, 0x55555550, 0x55555555, 0x00000045,
|
|
||||||
0x00000000, 0x55555500, 0x55555555, 0x00005501, 0x00055514, 0x55555404,
|
|
||||||
0x55555555, 0x00005541, 0x55555540, 0x55555555, 0x55540015, 0x40015555,
|
|
||||||
0x54015555, 0x55555555, 0x41555555, 0x00000505, 0x00000000, 0x55555000,
|
|
||||||
0x55555555, 0x45440045, 0x55005555, 0x00555555, 0x05555400, 0x55555554,
|
|
||||||
0x55555555, 0x55555501, 0x00000000, 0x00000000, 0x55555555, 0x55555555,
|
|
||||||
0x55555540, 0x55555555, 0x00000015, 0x00000000, 0x55555540, 0x55555555,
|
|
||||||
0x50000015, 0x55555555, 0x00000015, 0x55000000, 0x55555555, 0x50555555,
|
|
||||||
0x55555055, 0x55555555, 0x05550555, 0x44445555, 0x55555555, 0x41555555,
|
|
||||||
0x55555555, 0x15555555, 0x05555555, 0x55554555, 0x54541555, 0x55554555,
|
|
||||||
0x55554005, 0x50001555, 0x55555555, 0x05555555, 0x50000010, 0x55555550,
|
|
||||||
0x00001551, 0x55555550, 0x00005555, 0x00000000, 0x00010000, 0x55550000,
|
|
||||||
0x55555555, 0x55405555, 0x55555555, 0x00155555, 0x55555550, 0x55555555,
|
|
||||||
0x555555a5, 0x55555555, 0x00000055, 0x55000000, 0x55555555, 0x00555555,
|
|
||||||
0x00000000, 0x55555400, 0x00000000, 0x55555400, 0x55555555, 0x55554155,
|
|
||||||
0x55555555, 0x00001555, 0x00000000, 0x55154000, 0x55555550, 0x55554555,
|
|
||||||
0x45555555, 0x55510154, 0x55555551, 0x55555555, 0x55555501, 0x55555455,
|
|
||||||
0x55550115, 0x55555555, 0x55405555, 0x00000000, 0x00000000, 0x55555555,
|
|
||||||
0x55555555, 0x55555554, 0x55555555, 0x05555554, 0x55555555, 0x55555555,
|
|
||||||
0x50000000, 0x55555555, 0x05555555, 0x55550000, 0x55555555, 0x00005555,
|
|
||||||
0x00000004, 0x55555550, 0x00015555, 0x55515550, 0x55515551, 0x55555551,
|
|
||||||
0x55555555, 0x00000005, 0x00000000, 0xaaaaaaa0, 0xa8aaaaaa, 0xaaaaaaaa,
|
|
||||||
0x02aaaaaa, 0xaaa80000, 0xaaaaaaaa, 0x0002aaaa, 0xaaa80000, 0xaaa802aa,
|
|
||||||
0xaaaaaaaa, 0x8002aaaa, 0x1aaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaa00,
|
|
||||||
0xaaaaaaaa, 0xaaa800aa, 0xaaaaaaaa, 0xaaaa80aa, 0xaaaaaaaa, 0xaaaa2aaa,
|
|
||||||
0xaaaaaaaa, 0x00000000, 0xaaaaaaaa, 0x2aaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
|
|
||||||
0xaa000000, 0xaaaaaaaa, 0xa8aaaaaa, 0xaaaaaaaa, 0x02aaaaaa, 0xaaaa8000,
|
|
||||||
0xaaaaaaaa, 0x00002aaa, 0x00000000, 0xaaaa8000, 0xaaaaaaaa, 0xaaa02aaa,
|
|
||||||
0xaaaaaaaa, 0x000aaaaa, 0x00000000, 0x55500000, 0x55555555, 0x00055555,
|
|
||||||
0x50000000, 0x55555555, 0x05555555, 0x55555555, 0x55500005, 0x55555555,
|
|
||||||
0x00000005, 0x00000000, 0x55555550, 0x55555555, 0x00000005, 0x00000000,
|
|
||||||
0x55151550, 0x55555554, 0x00554155, 0x00000000, 0x55555555, 0x55555555,
|
|
||||||
0x55550000, 0x55555555, 0x00005555, 0x01555554, 0x00000000, 0x54000000,
|
|
||||||
0x55555555, 0x01555555, 0x00010000, 0x00000000, 0x55540000, 0x55555555,
|
|
||||||
0x00015555, 0x55555550, 0x50555550, 0x00000005, 0x00000000, 0xaaaaaaa0,
|
|
||||||
0xaaaaaaaa, 0x0000000a, 0x00000000, 0x55555550, 0x55555555, 0x00000005,
|
|
||||||
0xaaaaaaa0, 0xaaaaaaaa, 0xaaaaaa0a, 0xaaaaaaaa, 0xaaa800aa, 0xaaaaaaaa,
|
|
||||||
0x0002aaaa, 0x00000000, 0x55540000, 0x55000000, 0x55551001, 0x15555555,
|
|
||||||
0x51451155, 0x55555555, 0x05555555, 0x00000000, 0x55555554, 0x55555555,
|
|
||||||
0x00000001, 0x55555554, 0x55555555, 0x55555541, 0x55555555, 0x00000015,
|
|
||||||
0x55400000, 0x00015555, 0xaaa80000, 0x0054002a, 0xaaaaa800, 0xaaa8aaaa,
|
|
||||||
0x500aa2aa, 0x55555515, 0x55555555, 0xaaaa8055, 0xaaaaaaaa, 0x55556aaa,
|
|
||||||
0x55555555, 0x15541555, 0x15541554, 0x4aaa8054, 0x00000555, 0x55554140,
|
|
||||||
0x55555515, 0x55451555, 0x55415555, 0x00015555, 0x00000000, 0x55540000,
|
|
||||||
0x55555555, 0x50015555, 0x55555401, 0x05555555, 0x55555554, 0x55555555,
|
|
||||||
0x55555001, 0x00000005, 0x00000000, 0x55555550, 0x55555555, 0x00000000,
|
|
||||||
0x00000000, 0x55555555, 0x01555555, 0x55555555, 0x55555555, 0x00000000,
|
|
||||||
0x00000000, 0x55555555, 0x15555555, 0x55400000, 0x00155555, 0x00000000,
|
|
||||||
0x55400000, 0x55555555, 0x55515555, 0x55555555, 0x50055555, 0x00555555,
|
|
||||||
0x00000000, 0x55000000, 0x55555555, 0x00555555, 0x00000000, 0x55000000,
|
|
||||||
0x55555105, 0x14555555, 0x00000410, 0x00000000, 0x55555000, 0x55555555,
|
|
||||||
0x00000400, 0x00000000, 0x00001000, 0x45455000, 0x55555555, 0x40000015,
|
|
||||||
0x40001555, 0x00005555, 0x00000000, 0x55550000, 0x55555555, 0x00005555,
|
|
||||||
0x00000000, 0x55550000, 0x55555555, 0x00005555, 0x00015400, 0x00000000,
|
|
||||||
0x55540000, 0x55555555, 0x00015555, 0x55555540, 0x55555555, 0x55555415,
|
|
||||||
0x55555555, 0x55550155, 0x50000001, 0x55554000, 0x40155555, 0x55555555,
|
|
||||||
0x01555555, 0x00000000, 0x54000000, 0x55555555, 0x01555555, 0x00000001,
|
|
||||||
0x00000000, 0x55555554, 0x55555555, 0x00000001, 0x00000000, 0x55555554,
|
|
||||||
0x55555555, 0x55555551, 0x55555555, 0x50504145, 0x15555545, 0x55554551,
|
|
||||||
0x55555555, 0x50551555, 0x45554555, 0x55555555, 0x45515555, 0x55540455,
|
|
||||||
0x55555554, 0x55555555, 0x55555541, 0x55555555, 0x55555415, 0x55555555,
|
|
||||||
0x00000155, 0x00000000, 0x55555400, 0x55555555, 0x55540155, 0x55555555,
|
|
||||||
0x00015555, 0x00000000, 0xaaa80000, 0xaaaaaaaa, 0x0002aaaa, 0x00000000,
|
|
||||||
0xaaa80000, 0xaaaaaaaa, 0x0002aaaa, 0x00000000, 0x55540000, 0x55555555,
|
|
||||||
0x55415555, 0x55555555, 0x00155555,
|
|
||||||
};
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_STR_WCWIDTH_OSX_H_
|
|
||||||
#define COSMOPOLITAN_LIBC_STR_WCWIDTH_OSX_H_
|
|
||||||
COSMOPOLITAN_C_START_
|
|
||||||
|
|
||||||
extern const uint32_t kWcwidthOsx[591];
|
|
||||||
extern const uint8_t kWcwidthOsxIndex1[136];
|
|
||||||
extern const uint16_t kWcwidthOsxIndex2[228];
|
|
||||||
extern const uint32_t kWcwidthOsxIndex3[917];
|
|
||||||
|
|
||||||
static inline int _wcwidth_osx(uint32_t codePoint) {
|
|
||||||
uint32_t a, b, c, d;
|
|
||||||
a = kWcwidthOsxIndex1[codePoint >> 13];
|
|
||||||
b = kWcwidthOsxIndex2[a + ((codePoint >> 9) & 0xf)];
|
|
||||||
c = kWcwidthOsxIndex3[b + ((codePoint >> 5) & 0xf)];
|
|
||||||
d = c + (codePoint & 0x1f);
|
|
||||||
return (kWcwidthOsx[d >> 4] >> ((d & 0xf) << 1)) & 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
|
||||||
#endif /* COSMOPOLITAN_LIBC_STR_WCWIDTH_OSX_H_ */
|
|
65
libc/str/wide.inc
Normal file
65
libc/str/wide.inc
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,19,16,20,21,22,16,16,16,23,16,16,24,25,26,27,28,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,29,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,30,16,16,16,16,31,16,16,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,32,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,16,16,16,33,
|
||||||
|
34,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,35,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,36,17,17,37,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,38,39,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,40,41,42,43,44,45,46,47,16,48,49,16,16,16,16,
|
||||||
|
16,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,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,6,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,9,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,96,0,0,48,0,0,0,0,0,0,255,15,0,0,0,0,128,0,0,8,
|
||||||
|
0,2,12,0,96,48,64,16,0,0,4,44,36,32,12,0,0,0,1,0,0,0,80,184,0,0,0,0,0,0,0,224,
|
||||||
|
0,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,33,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,0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,255,255,255,255,
|
||||||
|
255,255,255,127,254,255,255,255,255,255,255,255,255,255,127,254,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,224,255,255,255,255,255,254,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,127,255,255,255,255,255,7,255,255,255,255,15,0,
|
||||||
|
255,255,255,255,255,127,255,255,255,255,255,0,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,
|
||||||
|
0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,31,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,
|
||||||
|
255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,255,3,0,0,255,255,255,255,247,255,127,15,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,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,15,0,0,0,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,7,0,255,255,255,127,0,0,0,0,0,
|
||||||
|
0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
15,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,64,254,7,0,0,0,0,0,0,0,0,0,0,0,0,7,0,255,255,255,
|
||||||
|
255,255,15,255,1,3,0,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,
|
||||||
|
1,224,191,255,255,255,255,255,255,255,255,223,255,255,15,0,255,255,255,255,
|
||||||
|
255,135,15,0,255,255,17,255,255,255,255,255,255,255,255,127,253,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
159,255,255,255,255,255,255,255,63,0,120,255,255,255,0,0,4,0,0,96,0,16,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,248,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,
|
||||||
|
255,255,255,255,255,255,63,16,39,0,0,24,240,7,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,255,15,0,
|
||||||
|
0,0,224,255,255,255,255,255,255,255,255,255,255,255,255,123,252,255,255,255,
|
||||||
|
255,231,199,255,255,255,231,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,15,7,7,0,63,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
@ -112,8 +112,9 @@ LIBC_TESTLIB_A_DIRECTDEPS = \
|
||||||
THIRD_PARTY_COMPILER_RT \
|
THIRD_PARTY_COMPILER_RT \
|
||||||
THIRD_PARTY_DLMALLOC \
|
THIRD_PARTY_DLMALLOC \
|
||||||
THIRD_PARTY_GDTOA \
|
THIRD_PARTY_GDTOA \
|
||||||
|
THIRD_PARTY_MUSL \
|
||||||
|
THIRD_PARTY_TZ \
|
||||||
THIRD_PARTY_XED \
|
THIRD_PARTY_XED \
|
||||||
THIRD_PARTY_TZ
|
|
||||||
|
|
||||||
LIBC_TESTLIB_A_DEPS := \
|
LIBC_TESTLIB_A_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(LIBC_TESTLIB_A_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(LIBC_TESTLIB_A_DIRECTDEPS),$($(x))))
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct Derived : Base
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
int a, b;
|
int a;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Shouldn't cause memory leaks.
|
// Shouldn't cause memory leaks.
|
||||||
|
@ -182,6 +182,7 @@ main()
|
||||||
return 13;
|
return 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // TODO(mrdomino): find a different way
|
||||||
{
|
{
|
||||||
// owner_before works across shared and weak pointers.
|
// owner_before works across shared and weak pointers.
|
||||||
shared_ptr<int> x(&a, CallG());
|
shared_ptr<int> x(&a, CallG());
|
||||||
|
@ -191,6 +192,7 @@ main()
|
||||||
if (!x.owner_before(weak_ptr<int>(y)))
|
if (!x.owner_before(weak_ptr<int>(y)))
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
// Use counts work like you'd expect
|
// Use counts work like you'd expect
|
||||||
|
|
|
@ -37,15 +37,16 @@ TEST_LIBC_INTRIN_DIRECTDEPS = \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
LIBC_THREAD \
|
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
|
LIBC_THREAD \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
TOOL_VIZ_LIB \
|
|
||||||
THIRD_PARTY_COMPILER_RT \
|
THIRD_PARTY_COMPILER_RT \
|
||||||
|
THIRD_PARTY_MUSL \
|
||||||
THIRD_PARTY_NSYNC \
|
THIRD_PARTY_NSYNC \
|
||||||
THIRD_PARTY_OPENMP \
|
THIRD_PARTY_OPENMP \
|
||||||
THIRD_PARTY_XED
|
THIRD_PARTY_XED \
|
||||||
|
TOOL_VIZ_LIB \
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_DEPS := \
|
TEST_LIBC_INTRIN_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(TEST_LIBC_INTRIN_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(TEST_LIBC_INTRIN_DIRECTDEPS),$($(x))))
|
||||||
|
|
|
@ -17,10 +17,17 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
|
#include "libc/assert.h"
|
||||||
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/intrin/likely.h"
|
#include "libc/intrin/likely.h"
|
||||||
|
#include "libc/intrin/safemacros.h"
|
||||||
#include "libc/mem/alg.h"
|
#include "libc/mem/alg.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/runtime/sysconf.h"
|
||||||
#include "libc/stdio/rand.h"
|
#include "libc/stdio/rand.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/sysv/consts/map.h"
|
||||||
|
#include "libc/sysv/consts/prot.h"
|
||||||
#include "libc/testlib/ezbench.h"
|
#include "libc/testlib/ezbench.h"
|
||||||
#include "libc/testlib/hyperion.h"
|
#include "libc/testlib/hyperion.h"
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
|
@ -172,6 +179,26 @@ TEST(memmem, fuzz) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(memmem, safety) {
|
||||||
|
int pagesz = sysconf(_SC_PAGESIZE);
|
||||||
|
char *map = (char *)mmap(0, pagesz * 2, PROT_READ | PROT_WRITE,
|
||||||
|
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||||
|
npassert(map != MAP_FAILED);
|
||||||
|
npassert(!mprotect(map + pagesz, pagesz, PROT_NONE));
|
||||||
|
for (int haylen = 1; haylen < 128; ++haylen) {
|
||||||
|
char *hay = map + pagesz - (haylen + 1);
|
||||||
|
for (int i = 0; i < haylen; ++i)
|
||||||
|
hay[i] = max(rand() & 255, 1);
|
||||||
|
hay[haylen] = 0;
|
||||||
|
for (int neelen = 1; neelen < haylen; ++neelen) {
|
||||||
|
char *nee = hay + (haylen + 1) - (neelen + 1);
|
||||||
|
ASSERT_EQ(memmem_naive(hay, haylen, nee, neelen),
|
||||||
|
memmem(hay, haylen, nee, neelen));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
munmap(map, pagesz * 2);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* memmem naive l: 43,783c 14,142ns m: 31,285c 10,105ns
|
* memmem naive l: 43,783c 14,142ns m: 31,285c 10,105ns
|
||||||
* memmem l: 2,597c 839ns m: 2,612c 844ns
|
* memmem l: 2,597c 839ns m: 2,612c 844ns
|
||||||
|
@ -201,7 +228,12 @@ BENCH(memmem, bench) {
|
||||||
EZBENCH2("memmem", donothing,
|
EZBENCH2("memmem", donothing,
|
||||||
__expropriate(memmem(kHyperion, kHyperionSize, "THE END", 7)));
|
__expropriate(memmem(kHyperion, kHyperionSize, "THE END", 7)));
|
||||||
EZBENCH2("memmem", donothing,
|
EZBENCH2("memmem", donothing,
|
||||||
__expropriate(memmem(
|
__expropriate(
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
memmem("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
62, "aaaaaab", 7)));
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
152,
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
81)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,23 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/assert.h"
|
||||||
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/intrin/kprintf.h"
|
||||||
|
#include "libc/intrin/safemacros.h"
|
||||||
#include "libc/mem/alg.h"
|
#include "libc/mem/alg.h"
|
||||||
#include "libc/mem/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/nexgen32e/x86feature.h"
|
#include "libc/nexgen32e/x86feature.h"
|
||||||
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/runtime/sysconf.h"
|
||||||
|
#include "libc/stdalign.h"
|
||||||
|
#include "libc/stdio/rand.h"
|
||||||
|
#include "libc/stdio/stdio.h"
|
||||||
|
#include "libc/stdio/sysparam.h"
|
||||||
|
#include "libc/sysv/consts/map.h"
|
||||||
|
#include "libc/sysv/consts/prot.h"
|
||||||
#include "libc/testlib/ezbench.h"
|
#include "libc/testlib/ezbench.h"
|
||||||
#include "libc/testlib/hyperion.h"
|
#include "libc/testlib/hyperion.h"
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
|
@ -48,6 +60,13 @@ char *strstr_naive(const char *haystack, const char *needle) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(strstr, special) {
|
||||||
|
MAKESTRING(haystack, "abc123def");
|
||||||
|
ASSERT_STREQ(&haystack[0], strstr(haystack, haystack));
|
||||||
|
ASSERT_STREQ(&haystack[0], strstr(haystack, ""));
|
||||||
|
free(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(strstr, test_emptyString_isFoundAtBeginning) {
|
TEST(strstr, test_emptyString_isFoundAtBeginning) {
|
||||||
MAKESTRING(haystack, "abc123def");
|
MAKESTRING(haystack, "abc123def");
|
||||||
ASSERT_STREQ(&haystack[0], strstr(haystack, gc(strdup(""))));
|
ASSERT_STREQ(&haystack[0], strstr(haystack, gc(strdup(""))));
|
||||||
|
@ -67,7 +86,8 @@ TEST(strstr, test_notFound1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(strstr, test_middleOfString) {
|
TEST(strstr, test_middleOfString) {
|
||||||
MAKESTRING(haystack, "abc123def");
|
alignas(16) char hog[] = "abc123def";
|
||||||
|
MAKESTRING(haystack, hog);
|
||||||
ASSERT_STREQ(&haystack[3], strstr(haystack, gc(strdup("123"))));
|
ASSERT_STREQ(&haystack[3], strstr(haystack, gc(strdup("123"))));
|
||||||
free(haystack);
|
free(haystack);
|
||||||
}
|
}
|
||||||
|
@ -98,6 +118,25 @@ TEST(strstr, test) {
|
||||||
ASSERT_STREQ("x", strstr("x", "x"));
|
ASSERT_STREQ("x", strstr("x", "x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(strstr, safety) {
|
||||||
|
int pagesz = sysconf(_SC_PAGESIZE);
|
||||||
|
char *map = (char *)mmap(0, pagesz * 2, PROT_READ | PROT_WRITE,
|
||||||
|
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||||
|
npassert(map != MAP_FAILED);
|
||||||
|
npassert(!mprotect(map + pagesz, pagesz, PROT_NONE));
|
||||||
|
for (int haylen = 1; haylen < 128; ++haylen) {
|
||||||
|
char *hay = map + pagesz - (haylen + 1);
|
||||||
|
for (int i = 0; i < haylen; ++i)
|
||||||
|
hay[i] = max(rand() & 255, 1);
|
||||||
|
hay[haylen] = 0;
|
||||||
|
for (int neelen = 1; neelen < haylen; ++neelen) {
|
||||||
|
char *nee = hay + (haylen + 1) - (neelen + 1);
|
||||||
|
ASSERT_EQ(strstr_naive(hay, nee), strstr(hay, nee));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
munmap(map, pagesz * 2);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(strstr, breakit) {
|
TEST(strstr, breakit) {
|
||||||
char *p;
|
char *p;
|
||||||
p = gc(calloc(1, 32));
|
p = gc(calloc(1, 32));
|
||||||
|
|
|
@ -30,7 +30,7 @@ TEST(towupper, test) {
|
||||||
EXPECT_EQ(u'!', towupper(u'!'));
|
EXPECT_EQ(u'!', towupper(u'!'));
|
||||||
EXPECT_EQ(u'A', towupper(u'a'));
|
EXPECT_EQ(u'A', towupper(u'a'));
|
||||||
EXPECT_EQ(u'À', towupper(u'à'));
|
EXPECT_EQ(u'À', towupper(u'à'));
|
||||||
EXPECT_EQ(L'𝛥', towupper(L'𝛿'));
|
/* EXPECT_EQ(L'𝛥', towupper(L'𝛿')); */
|
||||||
EXPECT_EQ(L'B', towupper(L'b'));
|
EXPECT_EQ(L'B', towupper(L'b'));
|
||||||
EXPECT_EQ(u'Ꭰ', towupper(u'ꭰ'));
|
EXPECT_EQ(u'Ꭰ', towupper(u'ꭰ'));
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ TEST(towlower, test) {
|
||||||
EXPECT_EQ(u'!', towlower(u'!'));
|
EXPECT_EQ(u'!', towlower(u'!'));
|
||||||
EXPECT_EQ(u'a', towlower(u'A'));
|
EXPECT_EQ(u'a', towlower(u'A'));
|
||||||
EXPECT_EQ(u'à', towlower(u'À'));
|
EXPECT_EQ(u'à', towlower(u'À'));
|
||||||
EXPECT_EQ(L'𝛿', towlower(L'𝛥'));
|
/* EXPECT_EQ(L'𝛿', towlower(L'𝛥')); */
|
||||||
EXPECT_EQ(L'b', towlower(L'B'));
|
EXPECT_EQ(L'b', towlower(L'B'));
|
||||||
EXPECT_EQ(u'ꭰ', towlower(u'Ꭰ'));
|
EXPECT_EQ(u'ꭰ', towlower(u'Ꭰ'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/str/strwidth.h"
|
#include "libc/str/strwidth.h"
|
||||||
#include "libc/str/unicode.h"
|
#include "libc/str/unicode.h"
|
||||||
|
#include "libc/testlib/benchmark.h"
|
||||||
#include "libc/testlib/ezbench.h"
|
#include "libc/testlib/ezbench.h"
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ TEST(wcwidth, test) {
|
||||||
ASSERT_EQ(-1, wcwidth(-7));
|
ASSERT_EQ(-1, wcwidth(-7));
|
||||||
ASSERT_EQ(1, wcwidth(0x10FFFD));
|
ASSERT_EQ(1, wcwidth(0x10FFFD));
|
||||||
ASSERT_EQ(-1, wcwidth(0x10FFFD + 1));
|
ASSERT_EQ(-1, wcwidth(0x10FFFD + 1));
|
||||||
|
ASSERT_EQ(2, wcwidth(L'😀'));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
||||||
|
@ -74,6 +77,12 @@ TEST(strwidth, testTextDelimitingControlCodes_dontHaveSubstance) {
|
||||||
EXPECT_EQ(0, strwidth("\1", 0));
|
EXPECT_EQ(0, strwidth("\1", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WCWIDTH(x) __expropriate(wcwidth(__veil("r", x)))
|
||||||
|
|
||||||
BENCH(wcwidth, bench) {
|
BENCH(wcwidth, bench) {
|
||||||
EZBENCH2("wcwidth", donothing, __expropriate(wcwidth(__veil("r", u'→'))));
|
BENCHMARK(1000, 1, WCWIDTH(u'a'));
|
||||||
|
BENCHMARK(1000, 1, WCWIDTH(u'a'));
|
||||||
|
BENCHMARK(1000, 1, WCWIDTH(u'→'));
|
||||||
|
BENCHMARK(1000, 1, WCWIDTH(L'😀'));
|
||||||
|
BENCHMARK(1000, 1, WCWIDTH(0));
|
||||||
}
|
}
|
||||||
|
|
13
third_party/linenoise/BUILD.mk
vendored
13
third_party/linenoise/BUILD.mk
vendored
|
@ -19,16 +19,17 @@ THIRD_PARTY_LINENOISE_A_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_LOG \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_SYSV \
|
LIBC_NEXGEN32E \
|
||||||
|
LIBC_RUNTIME \
|
||||||
LIBC_SOCK \
|
LIBC_SOCK \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_RUNTIME \
|
|
||||||
LIBC_LOG \
|
|
||||||
LIBC_SYSV_CALLS \
|
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
NET_HTTP
|
LIBC_SYSV \
|
||||||
|
LIBC_SYSV_CALLS \
|
||||||
|
NET_HTTP \
|
||||||
|
THIRD_PARTY_MUSL \
|
||||||
|
|
||||||
THIRD_PARTY_LINENOISE_A_DEPS := \
|
THIRD_PARTY_LINENOISE_A_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LINENOISE_A_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(THIRD_PARTY_LINENOISE_A_DIRECTDEPS),$($(x))))
|
||||||
|
|
3
third_party/musl/BUILD.mk
vendored
3
third_party/musl/BUILD.mk
vendored
|
@ -11,6 +11,7 @@ THIRD_PARTY_MUSL = $(THIRD_PARTY_MUSL_A_DEPS) $(THIRD_PARTY_MUSL_A)
|
||||||
THIRD_PARTY_MUSL_A = o/$(MODE)/third_party/musl/musl.a
|
THIRD_PARTY_MUSL_A = o/$(MODE)/third_party/musl/musl.a
|
||||||
THIRD_PARTY_MUSL_A_FILES := $(wildcard third_party/musl/*)
|
THIRD_PARTY_MUSL_A_FILES := $(wildcard third_party/musl/*)
|
||||||
THIRD_PARTY_MUSL_A_HDRS = $(filter %.h,$(THIRD_PARTY_MUSL_A_FILES))
|
THIRD_PARTY_MUSL_A_HDRS = $(filter %.h,$(THIRD_PARTY_MUSL_A_FILES))
|
||||||
|
THIRD_PARTY_MUSL_A_INCS = $(filter %.inc,$(THIRD_PARTY_MUSL_A_FILES))
|
||||||
THIRD_PARTY_MUSL_A_SRCS = $(filter %.c,$(THIRD_PARTY_MUSL_A_FILES))
|
THIRD_PARTY_MUSL_A_SRCS = $(filter %.c,$(THIRD_PARTY_MUSL_A_FILES))
|
||||||
|
|
||||||
THIRD_PARTY_MUSL_A_OBJS = \
|
THIRD_PARTY_MUSL_A_OBJS = \
|
||||||
|
@ -60,6 +61,8 @@ $(THIRD_PARTY_MUSL_A_OBJS): private COPTS += -Wframe-larger-than=4096 -Walloca-l
|
||||||
|
|
||||||
THIRD_PARTY_MUSL_LIBS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)))
|
THIRD_PARTY_MUSL_LIBS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)))
|
||||||
THIRD_PARTY_MUSL_SRCS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_SRCS))
|
THIRD_PARTY_MUSL_SRCS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_SRCS))
|
||||||
|
THIRD_PARTY_MUSL_HDRS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_HDRS))
|
||||||
|
THIRD_PARTY_MUSL_INCS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_INCS))
|
||||||
THIRD_PARTY_MUSL_CHECKS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_CHECKS))
|
THIRD_PARTY_MUSL_CHECKS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_CHECKS))
|
||||||
THIRD_PARTY_MUSL_OBJS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_OBJS))
|
THIRD_PARTY_MUSL_OBJS = $(foreach x,$(THIRD_PARTY_MUSL_ARTIFACTS),$($(x)_OBJS))
|
||||||
$(THIRD_PARTY_MUSL_OBJS): third_party/musl/BUILD.mk
|
$(THIRD_PARTY_MUSL_OBJS): third_party/musl/BUILD.mk
|
||||||
|
|
172
third_party/musl/alpha.inc
vendored
Normal file
172
third_party/musl/alpha.inc
vendored
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,
|
||||||
|
41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,
|
||||||
|
68,69,70,71,72,73,74,17,75,76,77,78,79,80,81,16,82,83,84,85,86,87,88,89,90,91,
|
||||||
|
92,93,16,94,95,96,16,17,17,17,97,98,99,16,16,16,16,16,16,16,16,16,16,17,17,17,
|
||||||
|
17,100,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,101,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,17,17,102,103,16,16,104,105,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
|
17,17,17,17,17,17,17,17,17,106,17,17,107,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,
|
||||||
|
108,109,16,16,16,16,16,16,16,16,16,110,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,111,112,113,114,16,16,16,16,16,16,16,16,115,116,
|
||||||
|
117,16,16,16,16,16,118,119,16,16,16,16,120,16,16,121,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,
|
||||||
|
16,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,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,
|
||||||
|
255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,188,64,215,255,255,
|
||||||
|
251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,127,2,255,255,255,
|
||||||
|
255,255,1,0,0,0,0,255,191,182,0,255,255,255,135,7,0,0,0,255,7,255,255,255,255,
|
||||||
|
255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,
|
||||||
|
31,254,225,255,
|
||||||
|
159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,
|
||||||
|
1,255,7,0,0,0,0,0,0,255,255,223,63,0,0,240,255,248,3,255,255,255,255,255,255,
|
||||||
|
255,255,255,239,255,223,225,255,207,255,254,255,239,159,249,255,255,253,197,
|
||||||
|
227,159,89,128,176,207,255,3,16,238,135,249,255,255,253,109,195,135,25,2,94,
|
||||||
|
192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,30,238,159,
|
||||||
|
249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,255,
|
||||||
|
195,199,29,129,0,192,255,0,0,239,223,253,255,255,253,255,227,223,29,96,7,207,
|
||||||
|
255,0,0,239,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,239,223,253,
|
||||||
|
255,255,255,255,231,223,93,240,128,207,255,0,252,236,255,127,252,255,255,251,
|
||||||
|
47,127,128,95,255,192,255,12,0,254,255,255,255,255,127,255,7,63,32,255,3,0,0,
|
||||||
|
0,0,214,247,255,255,175,255,255,59,95,32,255,243,0,0,0,
|
||||||
|
0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,
|
||||||
|
31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,255,255,255,
|
||||||
|
255,255,255,255,63,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,
|
||||||
|
255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,
|
||||||
|
127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,
|
||||||
|
7,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,63,63,254,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,
|
||||||
|
255,199,255,1,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,
|
||||||
|
255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,1,255,255,255,255,255,7,255,255,255,255,255,255,255,255,
|
||||||
|
63,
|
||||||
|
0,255,255,255,127,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,
|
||||||
|
255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,
|
||||||
|
127,254,255,31,0,255,3,255,3,128,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,
|
||||||
|
255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,
|
||||||
|
255,191,255,3,0,255,255,255,255,255,255,127,0,255,227,255,255,255,255,255,63,
|
||||||
|
255,1,255,255,255,255,255,231,0,0,0,0,0,222,111,4,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,
|
||||||
|
128,255,31,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,
|
||||||
|
255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,
|
||||||
|
224,67,0,0,255,255,255,255,255,1,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,0,0,0,0,192,255,255,255,255,255,255,3,0,
|
||||||
|
0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,
|
||||||
|
255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,
|
||||||
|
255,255,255,255,0,0,0,0,0,128,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,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,255,254,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,63,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,
|
||||||
|
0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,
|
||||||
|
255,127,240,143,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,
|
||||||
|
0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,249,255,255,255,
|
||||||
|
255,255,255,124,0,0,0,0,0,128,255,191,255,255,255,255,0,0,0,255,255,255,255,
|
||||||
|
255,255,15,0,255,255,255,255,255,255,255,255,47,0,255,3,0,0,252,232,255,255,
|
||||||
|
255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,
|
||||||
|
255,0,128,255,3,255,255,255,127,255,255,255,255,255,255,127,0,255,63,255,3,
|
||||||
|
255,255,127,252,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,
|
||||||
|
126,0,127,127,255,255,255,255,255,247,255,0,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,
|
||||||
|
255,
|
||||||
|
15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,
|
||||||
|
252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,
|
||||||
|
254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,
|
||||||
|
252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,
|
||||||
|
255,255,255,255,255,255,31,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,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,
|
||||||
|
0,255,255,255,255,0,224,255,255,255,7,255,255,255,255,255,7,255,255,255,63,
|
||||||
|
255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,63,255,3,255,255,255,255,15,255,255,255,
|
||||||
|
255,15,255,255,255,255,255,0,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,255,255,63,0,255,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,255,255,
|
||||||
|
127,0,255,255,255,127,0,0,0,0,0,0,0,0,255,255,55,0,255,255,63,0,255,255,255,3,
|
||||||
|
0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,
|
||||||
|
254,255,255,63,0,0,0,0,0,255,255,255,31,255,255,255,31,0,0,0,0,255,254,255,
|
||||||
|
255,31,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,255,255,3,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,255,255,255,255,255,255,7,
|
||||||
|
0,255,255,255,255,255,255,7,0,255,255,255,255,255,0,255,3,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,128,0,255,255,63,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,255,255,127,0,255,255,255,255,255,255,255,255,63,0,0,0,
|
||||||
|
192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,255,
|
||||||
|
255,255,255,199,255,112,0,255,255,255,255,71,0,255,255,255,255,255,255,255,
|
||||||
|
255,30,0,255,23,0,0,0,0,255,255,251,255,255,255,159,64,0,0,0,0,0,0,0,0,127,
|
||||||
|
189,255,191,255,1,255,255,255,255,255,255,255,1,255,3,239,159,249,255,255,253,
|
||||||
|
237,227,159,25,129,224,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,
|
||||||
|
255,255,255,255,255,187,7,255,131,0,0,0,0,255,255,255,255,255,255,255,255,179,
|
||||||
|
0,255,3,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,127,0,0,0,63,0,0,
|
||||||
|
0,0,255,255,255,255,255,255,255,127,17,0,255,3,0,0,0,0,255,255,255,255,255,
|
||||||
|
255,63,1,255,3,0,0,0,0,0,0,255,255,255,231,255,7,255,3,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,3,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,255,252,255,255,255,255,255,252,26,0,0,0,255,255,255,255,255,255,231,
|
||||||
|
127,0,0,255,255,255,255,255,255,255,255,255,32,0,0,0,0,255,255,255,255,255,
|
||||||
|
255,255,1,255,253,255,255,255,255,127,127,1,0,255,3,0,0,252,255,255,255,252,
|
||||||
|
255,255,254,127,0,0,0,0,0,0,0,0,0,127,251,255,255,255,255,127,180,203,0,255,3,
|
||||||
|
191,253,255,255,255,127,123,1,255,3,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,0,0,0,0,0,0,255,255,127,0,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,
|
||||||
|
255,255,255,127,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,255,255,
|
||||||
|
255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,
|
||||||
|
255,255,255,255,255,255,1,255,255,255,127,255,3,0,0,0,0,0,0,0,0,0,0,0,0,255,
|
||||||
|
255,255,63,0,0,255,255,255,255,255,255,0,0,15,0,255,3,248,255,255,224,255,255,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,255,255,255,255,255,255,255,255,255,135,255,255,255,255,255,255,255,128,
|
||||||
|
255,255,0,0,0,0,0,0,0,0,11,0,0,0,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,7,0,255,255,255,127,0,0,0,0,0,
|
||||||
|
0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,7,255,31,255,1,255,67,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,
|
||||||
|
255,223,100,222,255,235,239,255,255,255,255,255,255,
|
||||||
|
255,191,231,223,223,255,255,255,123,95,252,253,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,
|
||||||
|
253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,
|
||||||
|
255,255,127,255,255,255,253,255,255,255,253,255,255,247,207,255,255,255,255,
|
||||||
|
255,255,127,255,255,249,219,7,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,255,255,255,255,255,31,128,63,255,67,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,
|
||||||
|
15,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,
|
||||||
|
143,8,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,239,255,255,255,150,254,247,10,132,234,150,170,150,247,247,94,255,251,255,
|
||||||
|
15,238,251,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,
|
||||||
|
255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
20
third_party/musl/bsearch.c
vendored
Normal file
20
third_party/musl/bsearch.c
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *))
|
||||||
|
{
|
||||||
|
void *try;
|
||||||
|
int sign;
|
||||||
|
while (nel > 0) {
|
||||||
|
try = (char *)base + width*(nel/2);
|
||||||
|
sign = cmp(key, try);
|
||||||
|
if (sign < 0) {
|
||||||
|
nel /= 2;
|
||||||
|
} else if (sign > 0) {
|
||||||
|
base = (char *)try + width;
|
||||||
|
nel -= nel/2+1;
|
||||||
|
} else {
|
||||||
|
return try;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
297
third_party/musl/casemap.inc
vendored
Normal file
297
third_party/musl/casemap.inc
vendored
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
static const unsigned char tab[] = {
|
||||||
|
7, 8, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 6, 15, 16, 17, 18,
|
||||||
|
6, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 21, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 22, 23, 6, 6, 6, 24, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 25,
|
||||||
|
6, 6, 6, 6, 26, 6, 6, 6, 6, 6, 6, 6, 27, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 28, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 29, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 6, 6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 1, 0, 84, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 7, 43, 43, 91, 86, 86, 86, 86, 86, 86, 86, 74, 86, 86, 5,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
36, 80, 121, 49, 80, 49, 80, 49, 56, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 78, 49, 2, 78, 13, 13, 78, 3,
|
||||||
|
78, 0, 36, 110, 0, 78, 49, 38, 110, 81, 78, 36, 80, 78, 57, 20,
|
||||||
|
129, 27, 29, 29, 83, 49, 80, 49, 80, 13, 49, 80, 49, 80, 49, 80,
|
||||||
|
27, 83, 36, 80, 49, 2, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123,
|
||||||
|
20, 121, 92, 123, 92, 123, 92, 45, 43, 73, 3, 72, 3, 120, 92, 123,
|
||||||
|
20, 0, 150, 10, 1, 43, 40, 6, 6, 0, 42, 6, 42, 42, 43, 7,
|
||||||
|
187, 181, 43, 30, 0, 43, 7, 43, 43, 43, 1, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 205, 70, 205, 43, 0, 37, 43, 7, 1, 6, 1, 85, 86, 86, 86,
|
||||||
|
86, 86, 85, 86, 86, 2, 36, 129, 129, 129, 129, 129, 21, 129, 129, 129,
|
||||||
|
0, 0, 43, 0, 178, 209, 178, 209, 178, 209, 178, 209, 0, 0, 205, 204,
|
||||||
|
1, 0, 215, 215, 215, 215, 215, 131, 129, 129, 129, 129, 129, 129, 129, 129,
|
||||||
|
129, 129, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 28, 0, 0, 0,
|
||||||
|
0, 0, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 2, 0, 0,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 78, 49, 80, 49, 80, 78, 49, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 2, 135, 166, 135, 166, 135, 166, 135, 166,
|
||||||
|
135, 166, 135, 166, 135, 166, 135, 166, 42, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 86, 86, 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, 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, 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, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
||||||
|
12, 0, 12, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 7, 42, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 86, 86, 108, 129, 21, 0, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 7, 108, 3, 65, 43, 43, 86, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 86, 86, 86, 86, 86, 44, 86, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1,
|
||||||
|
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,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 12, 108, 0, 0, 0, 0, 0, 6,
|
||||||
|
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,
|
||||||
|
0, 0, 0, 0, 0, 0, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
||||||
|
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
||||||
|
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
||||||
|
6, 37, 6, 37, 6, 37, 6, 37, 86, 122, 158, 38, 6, 37, 6, 37,
|
||||||
|
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37,
|
||||||
|
6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 1, 43, 43, 79, 86,
|
||||||
|
86, 44, 43, 127, 86, 86, 57, 43, 43, 85, 86, 86, 43, 43, 79, 86,
|
||||||
|
86, 44, 43, 127, 86, 86, 129, 55, 117, 91, 123, 92, 43, 43, 79, 86,
|
||||||
|
86, 2, 172, 4, 0, 0, 57, 43, 43, 85, 86, 86, 43, 43, 79, 86,
|
||||||
|
86, 44, 43, 43, 86, 86, 50, 19, 129, 87, 0, 111, 129, 126, 201, 215,
|
||||||
|
126, 45, 129, 129, 14, 126, 57, 127, 111, 87, 0, 129, 129, 126, 21, 0,
|
||||||
|
126, 3, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 43,
|
||||||
|
36, 43, 151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43,
|
||||||
|
43, 43, 86, 86, 86, 86, 86, 128, 129, 129, 129, 129, 57, 187, 42, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 1, 129, 129, 129, 129, 129, 129, 129, 129,
|
||||||
|
129, 129, 129, 129, 129, 129, 129, 201, 172, 172, 172, 172, 172, 172, 172, 172,
|
||||||
|
172, 172, 172, 172, 172, 172, 172, 208, 13, 0, 78, 49, 2, 180, 193, 193,
|
||||||
|
215, 215, 36, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 49, 80, 215, 215, 83, 193, 71, 212, 215, 215, 215, 5, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 1, 0, 1, 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, 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, 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, 78, 49, 80, 49, 80, 49, 80,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 13, 0, 0, 0, 0, 0, 36, 80,
|
||||||
|
49, 80, 49, 80, 49, 80, 49, 80, 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, 0, 0, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 121, 92, 123, 92, 123, 79, 123, 92, 123, 92, 123,
|
||||||
|
92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 45,
|
||||||
|
43, 43, 121, 20, 92, 123, 92, 45, 121, 42, 92, 39, 92, 123, 92, 123,
|
||||||
|
92, 123, 164, 0, 10, 180, 92, 123, 92, 123, 79, 3, 42, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1,
|
||||||
|
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, 72, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
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,
|
||||||
|
0, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 72, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 86, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 86, 86, 86, 14, 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, 36, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
|
43, 43, 7, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
||||||
|
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,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 0,
|
||||||
|
0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 86, 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, 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, 42, 43, 43,
|
||||||
|
43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86,
|
||||||
|
86, 86, 14, 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, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86,
|
||||||
|
86, 86, 86, 86, 86, 86, 86, 86, 14, 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, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85,
|
||||||
|
86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 14, 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, 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,
|
||||||
|
};
|
||||||
|
static const int rules[] = {
|
||||||
|
0x0, 0x2001, -0x2000, 0x1dbf00, 0x2e700, 0x7900,
|
||||||
|
0x2402, 0x101, -0x100, 0x0, 0x201, -0x200,
|
||||||
|
-0xc6ff, -0xe800, -0x78ff, -0x12c00, 0xc300, 0xd201,
|
||||||
|
0xce01, 0xcd01, 0x4f01, 0xca01, 0xcb01, 0xcf01,
|
||||||
|
0x6100, 0xd301, 0xd101, 0xa300, 0xd501, 0x8200,
|
||||||
|
0xd601, 0xda01, 0xd901, 0xdb01, 0x3800, 0x3,
|
||||||
|
-0x4f00, -0x60ff, -0x37ff, 0x242802, 0x0, 0x101,
|
||||||
|
-0x100, -0xcd00, -0xda00, -0x81ff, 0x2a2b01, -0xa2ff,
|
||||||
|
0x2a2801, 0x2a3f00, -0xc2ff, 0x4501, 0x4701, 0x2a1f00,
|
||||||
|
0x2a1c00, 0x2a1e00, -0xd200, -0xce00, -0xca00, -0xcb00,
|
||||||
|
0xa54f00, 0xa54b00, -0xcf00, 0xa52800, 0xa54400, -0xd100,
|
||||||
|
-0xd300, 0x29f700, 0xa54100, 0x29fd00, -0xd500, -0xd600,
|
||||||
|
0x29e700, 0xa54300, 0xa52a00, -0x4500, -0xd900, -0x4700,
|
||||||
|
-0xdb00, 0xa51500, 0xa51200, 0x4c2402, 0x0, 0x2001,
|
||||||
|
-0x2000, 0x101, -0x100, 0x5400, 0x7401, 0x2601,
|
||||||
|
0x2501, 0x4001, 0x3f01, -0x2600, -0x2500, -0x1f00,
|
||||||
|
-0x4000, -0x3f00, 0x801, -0x3e00, -0x3900, -0x2f00,
|
||||||
|
-0x3600, -0x800, -0x5600, -0x5000, 0x700, -0x7400,
|
||||||
|
-0x3bff, -0x6000, -0x6ff, 0x701a02, 0x101, -0x100,
|
||||||
|
0x2001, -0x2000, 0x5001, 0xf01, -0xf00, 0x0,
|
||||||
|
0x3001, -0x3000, 0x101, -0x100, 0x0, 0xbc000,
|
||||||
|
0x1c6001, 0x0, 0x97d001, 0x801, -0x800, 0x8a0502,
|
||||||
|
0x0, -0xbbfff, -0x186200, 0x89c200, -0x182500, -0x186e00,
|
||||||
|
-0x186d00, -0x186400, -0x186300, -0x185c00, 0x0, 0x8a3800,
|
||||||
|
0x8a0400, 0xee600, 0x101, -0x100, 0x0, -0x3b00,
|
||||||
|
-0x1dbeff, 0x8f1d02, 0x800, -0x7ff, 0x0, 0x5600,
|
||||||
|
-0x55ff, 0x4a00, 0x6400, 0x8000, 0x7000, 0x7e00,
|
||||||
|
0x900, -0x49ff, -0x8ff, -0x1c2500, -0x63ff, -0x6fff,
|
||||||
|
-0x7fff, -0x7dff, 0xac0502, 0x0, 0x1001, -0x1000,
|
||||||
|
0x1c01, 0x101, -0x1d5cff, -0x20beff, -0x2045ff, -0x1c00,
|
||||||
|
0xb10b02, 0x101, -0x100, 0x3001, -0x3000, 0x0,
|
||||||
|
-0x29f6ff, -0xee5ff, -0x29e6ff, -0x2a2b00, -0x2a2800, -0x2a1bff,
|
||||||
|
-0x29fcff, -0x2a1eff, -0x2a1dff, -0x2a3eff, 0x0, -0x1c6000,
|
||||||
|
0x0, 0x101, -0x100, 0xbc0c02, 0x0, 0x101,
|
||||||
|
-0x100, -0xa543ff, 0x3a001, -0x8a03ff, -0xa527ff, 0x3000,
|
||||||
|
-0xa54eff, -0xa54aff, -0xa540ff, -0xa511ff, -0xa529ff, -0xa514ff,
|
||||||
|
-0x2fff, -0xa542ff, -0x8a37ff, 0x0, -0x97d000, -0x3a000,
|
||||||
|
0x0, 0x2001, -0x2000, 0x0, 0x2801, -0x2800,
|
||||||
|
0x0, 0x4001, -0x4000, 0x0, 0x2001, -0x2000,
|
||||||
|
0x0, 0x2001, -0x2000, 0x0, 0x2201, -0x2200,
|
||||||
|
};
|
||||||
|
static const unsigned char rulebases[] = {
|
||||||
|
0, 6, 39, 81, 111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
124, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 131, 142, 146, 151,
|
||||||
|
0, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 196, 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, 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, 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, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 198, 201, 0, 0, 0, 219, 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, 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, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 222,
|
||||||
|
0, 0, 0, 0, 225, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 231, 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, 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, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 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, 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, 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, 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, 237, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
};
|
||||||
|
static const unsigned char exceptions[][2] = {
|
||||||
|
{ 48, 12 }, { 49, 13 }, { 120, 14 }, { 127, 15 },
|
||||||
|
{ 128, 16 }, { 129, 17 }, { 134, 18 }, { 137, 19 },
|
||||||
|
{ 138, 19 }, { 142, 20 }, { 143, 21 }, { 144, 22 },
|
||||||
|
{ 147, 19 }, { 148, 23 }, { 149, 24 }, { 150, 25 },
|
||||||
|
{ 151, 26 }, { 154, 27 }, { 156, 25 }, { 157, 28 },
|
||||||
|
{ 158, 29 }, { 159, 30 }, { 166, 31 }, { 169, 31 },
|
||||||
|
{ 174, 31 }, { 177, 32 }, { 178, 32 }, { 183, 33 },
|
||||||
|
{ 191, 34 }, { 197, 35 }, { 200, 35 }, { 203, 35 },
|
||||||
|
{ 221, 36 }, { 242, 35 }, { 246, 37 }, { 247, 38 },
|
||||||
|
{ 32, 45 }, { 58, 46 }, { 61, 47 }, { 62, 48 },
|
||||||
|
{ 63, 49 }, { 64, 49 }, { 67, 50 }, { 68, 51 },
|
||||||
|
{ 69, 52 }, { 80, 53 }, { 81, 54 }, { 82, 55 },
|
||||||
|
{ 83, 56 }, { 84, 57 }, { 89, 58 }, { 91, 59 },
|
||||||
|
{ 92, 60 }, { 97, 61 }, { 99, 62 }, { 101, 63 },
|
||||||
|
{ 102, 64 }, { 104, 65 }, { 105, 66 }, { 106, 64 },
|
||||||
|
{ 107, 67 }, { 108, 68 }, { 111, 66 }, { 113, 69 },
|
||||||
|
{ 114, 70 }, { 117, 71 }, { 125, 72 }, { 130, 73 },
|
||||||
|
{ 135, 74 }, { 137, 75 }, { 138, 76 }, { 139, 76 },
|
||||||
|
{ 140, 77 }, { 146, 78 }, { 157, 79 }, { 158, 80 },
|
||||||
|
{ 69, 87 }, { 123, 29 }, { 124, 29 }, { 125, 29 },
|
||||||
|
{ 127, 88 }, { 134, 89 }, { 136, 90 }, { 137, 90 },
|
||||||
|
{ 138, 90 }, { 140, 91 }, { 142, 92 }, { 143, 92 },
|
||||||
|
{ 172, 93 }, { 173, 94 }, { 174, 94 }, { 175, 94 },
|
||||||
|
{ 194, 95 }, { 204, 96 }, { 205, 97 }, { 206, 97 },
|
||||||
|
{ 207, 98 }, { 208, 99 }, { 209, 100 }, { 213, 101 },
|
||||||
|
{ 214, 102 }, { 215, 103 }, { 240, 104 }, { 241, 105 },
|
||||||
|
{ 242, 106 }, { 243, 107 }, { 244, 108 }, { 245, 109 },
|
||||||
|
{ 249, 110 }, { 253, 45 }, { 254, 45 }, { 255, 45 },
|
||||||
|
{ 80, 105 }, { 81, 105 }, { 82, 105 }, { 83, 105 },
|
||||||
|
{ 84, 105 }, { 85, 105 }, { 86, 105 }, { 87, 105 },
|
||||||
|
{ 88, 105 }, { 89, 105 }, { 90, 105 }, { 91, 105 },
|
||||||
|
{ 92, 105 }, { 93, 105 }, { 94, 105 }, { 95, 105 },
|
||||||
|
{ 130, 0 }, { 131, 0 }, { 132, 0 }, { 133, 0 },
|
||||||
|
{ 134, 0 }, { 135, 0 }, { 136, 0 }, { 137, 0 },
|
||||||
|
{ 192, 117 }, { 207, 118 }, { 128, 137 }, { 129, 138 },
|
||||||
|
{ 130, 139 }, { 133, 140 }, { 134, 141 }, { 112, 157 },
|
||||||
|
{ 113, 157 }, { 118, 158 }, { 119, 158 }, { 120, 159 },
|
||||||
|
{ 121, 159 }, { 122, 160 }, { 123, 160 }, { 124, 161 },
|
||||||
|
{ 125, 161 }, { 179, 162 }, { 186, 163 }, { 187, 163 },
|
||||||
|
{ 188, 164 }, { 190, 165 }, { 195, 162 }, { 204, 164 },
|
||||||
|
{ 218, 166 }, { 219, 166 }, { 229, 106 }, { 234, 167 },
|
||||||
|
{ 235, 167 }, { 236, 110 }, { 243, 162 }, { 248, 168 },
|
||||||
|
{ 249, 168 }, { 250, 169 }, { 251, 169 }, { 252, 164 },
|
||||||
|
{ 38, 176 }, { 42, 177 }, { 43, 178 }, { 78, 179 },
|
||||||
|
{ 132, 8 }, { 98, 186 }, { 99, 187 }, { 100, 188 },
|
||||||
|
{ 101, 189 }, { 102, 190 }, { 109, 191 }, { 110, 192 },
|
||||||
|
{ 111, 193 }, { 112, 194 }, { 126, 195 }, { 127, 195 },
|
||||||
|
{ 125, 207 }, { 141, 208 }, { 148, 209 }, { 171, 210 },
|
||||||
|
{ 172, 211 }, { 173, 212 }, { 176, 213 }, { 177, 214 },
|
||||||
|
{ 178, 215 }, { 196, 216 }, { 197, 217 }, { 198, 218 },
|
||||||
|
};
|
50
third_party/musl/iswalpha.c
vendored
Normal file
50
third_party/musl/iswalpha.c
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||||
|
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||||
|
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||||
|
│ │
|
||||||
|
│ Musl Libc │
|
||||||
|
│ Copyright © 2005-2014 Rich Felker, et al. │
|
||||||
|
│ │
|
||||||
|
│ Permission is hereby granted, free of charge, to any person obtaining │
|
||||||
|
│ a copy of this software and associated documentation files (the │
|
||||||
|
│ "Software"), to deal in the Software without restriction, including │
|
||||||
|
│ without limitation the rights to use, copy, modify, merge, publish, │
|
||||||
|
│ distribute, sublicense, and/or sell copies of the Software, and to │
|
||||||
|
│ permit persons to whom the Software is furnished to do so, subject to │
|
||||||
|
│ the following conditions: │
|
||||||
|
│ │
|
||||||
|
│ The above copyright notice and this permission notice shall be │
|
||||||
|
│ included in all copies or substantial portions of the Software. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, │
|
||||||
|
│ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF │
|
||||||
|
│ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. │
|
||||||
|
│ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY │
|
||||||
|
│ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, │
|
||||||
|
│ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE │
|
||||||
|
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||||
|
│ │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <locale.h>
|
||||||
|
__static_yoink("musl_libc_notice");
|
||||||
|
|
||||||
|
static const unsigned char table[] = {
|
||||||
|
#include "alpha.inc"
|
||||||
|
};
|
||||||
|
|
||||||
|
int iswalpha(wint_t wc)
|
||||||
|
{
|
||||||
|
if (wc<0x20000U)
|
||||||
|
return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1;
|
||||||
|
if (wc<0x2fffeU)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __iswalpha_l(wint_t c, locale_t l)
|
||||||
|
{
|
||||||
|
return iswalpha(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(__iswalpha_l, iswalpha_l);
|
48
third_party/musl/iswpunct.c
vendored
Normal file
48
third_party/musl/iswpunct.c
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||||
|
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||||
|
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||||
|
│ │
|
||||||
|
│ Musl Libc │
|
||||||
|
│ Copyright © 2005-2014 Rich Felker, et al. │
|
||||||
|
│ │
|
||||||
|
│ Permission is hereby granted, free of charge, to any person obtaining │
|
||||||
|
│ a copy of this software and associated documentation files (the │
|
||||||
|
│ "Software"), to deal in the Software without restriction, including │
|
||||||
|
│ without limitation the rights to use, copy, modify, merge, publish, │
|
||||||
|
│ distribute, sublicense, and/or sell copies of the Software, and to │
|
||||||
|
│ permit persons to whom the Software is furnished to do so, subject to │
|
||||||
|
│ the following conditions: │
|
||||||
|
│ │
|
||||||
|
│ The above copyright notice and this permission notice shall be │
|
||||||
|
│ included in all copies or substantial portions of the Software. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, │
|
||||||
|
│ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF │
|
||||||
|
│ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. │
|
||||||
|
│ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY │
|
||||||
|
│ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, │
|
||||||
|
│ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE │
|
||||||
|
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||||
|
│ │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <locale.h>
|
||||||
|
__static_yoink("musl_libc_notice");
|
||||||
|
|
||||||
|
static const unsigned char table[] = {
|
||||||
|
#include "punct.inc"
|
||||||
|
};
|
||||||
|
|
||||||
|
int iswpunct(wint_t wc)
|
||||||
|
{
|
||||||
|
if (wc<0x20000U)
|
||||||
|
return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __iswpunct_l(wint_t c, locale_t l)
|
||||||
|
{
|
||||||
|
return iswpunct(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(__iswpunct_l, iswpunct_l);
|
141
third_party/musl/punct.inc
vendored
Normal file
141
third_party/musl/punct.inc
vendored
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39,
|
||||||
|
40,41,42,43,16,44,45,46,17,17,47,17,17,17,17,17,17,48,49,50,51,52,53,54,55,17,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,56,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,57,16,58,59,60,61,62,63,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,64,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,65,16,16,66,16,67,68,
|
||||||
|
69,16,70,71,72,16,73,16,16,74,75,76,77,78,16,79,80,81,82,83,84,85,86,87,88,89,
|
||||||
|
90,91,16,92,93,94,95,16,16,16,16,96,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,97,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,98,99,16,16,100,101,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,16,16,16,16,16,102,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||||
|
16,16,16,103,104,105,106,16,16,107,108,17,17,109,16,16,16,16,16,16,110,111,16,
|
||||||
|
16,16,16,16,112,113,16,16,114,115,116,16,117,118,119,17,17,17,120,121,122,123,
|
||||||
|
124,16,16,16,16,
|
||||||
|
16,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,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,254,255,0,252,1,0,0,248,1,
|
||||||
|
0,0,120,0,0,0,0,255,251,223,251,0,0,128,0,0,0,128,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,60,0,252,255,224,175,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,223,255,255,255,255,255,32,64,176,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,3,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,252,0,0,0,0,0,230,254,255,255,255,0,64,73,0,0,0,0,0,24,0,255,255,0,216,
|
||||||
|
0,0,0,0,0,0,0,1,0,60,0,0,0,0,0,0,0,0,0,0,0,0,16,224,1,30,0,
|
||||||
|
96,255,191,0,0,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,207,
|
||||||
|
227,0,0,0,3,0,32,255,127,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,7,252,0,0,0,
|
||||||
|
0,0,0,0,0,0,16,0,32,30,0,48,0,1,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,252,111,0,0,0,
|
||||||
|
0,0,0,0,16,0,32,0,0,0,0,64,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,3,224,0,0,0,0,0,0,
|
||||||
|
0,16,0,32,0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,255,7,16,0,0,0,0,0,0,0,0,
|
||||||
|
32,0,0,0,0,128,255,16,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,160,
|
||||||
|
0,127,0,0,255,3,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,0,0,0,0,128,0,128,192,223,
|
||||||
|
0,12,0,0,0,0,0,0,0,0,0,0,0,4,0,31,0,0,0,0,0,
|
||||||
|
0,254,255,255,255,0,252,255,255,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,192,255,223,
|
||||||
|
255,7,0,0,0,0,0,0,0,0,0,0,128,6,0,252,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,8,0,0,0,0,0,0,0,0,0,0,0,224,255,255,255,31,0,0,255,3,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,1,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,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,96,0,0,1,0,0,24,0,0,0,0,0,0,0,0,0,56,0,0,0,0,16,0,0,0,112,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,254,127,47,0,0,255,3,255,127,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,0,0,0,0,0,14,49,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,196,255,255,255,
|
||||||
|
255,0,0,0,192,0,0,0,0,0,0,0,0,1,0,224,159,0,0,0,0,127,63,255,127,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,16,0,16,0,0,252,255,255,255,31,0,0,0,0,0,12,0,0,0,0,0,0,64,0,
|
||||||
|
12,240,0,0,0,0,0,0,128,248,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,255,0,255,255,
|
||||||
|
255,33,144,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,
|
||||||
|
127,0,224,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,3,224,0,224,0,
|
||||||
|
224,0,96,128,248,255,255,255,252,255,255,255,255,255,127,223,255,241,127,255,
|
||||||
|
127,0,0,255,255,255,255,0,0,255,255,255,255,1,0,123,3,208,193,175,66,0,12,31,
|
||||||
|
188,255,255,0,0,0,0,0,14,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,127,0,0,0,255,7,0,0,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,63,0,0,0,0,0,0,252,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,207,255,255,255,
|
||||||
|
63,255,255,255,255,255,255,255,255,255,255,255,255,255,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,224,135,3,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
|
||||||
|
128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,255,255,255,255,0,
|
||||||
|
0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,255,255,255,15,0,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,63,0,0,0,255,15,30,255,255,255,1,252,193,224,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,30,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
255,255,0,0,0,0,255,255,255,255,15,0,0,0,255,255,255,127,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,
|
||||||
|
255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,
|
||||||
|
255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,0,0,
|
||||||
|
0,0,0,192,0,224,0,0,0,0,0,0,0,0,0,0,0,128,15,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
255,0,255,255,127,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
64,0,0,0,0,15,255,3,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,16,192,0,0,255,255,3,23,
|
||||||
|
0,0,0,0,0,248,0,0,0,0,8,128,0,0,0,0,0,0,0,0,0,0,8,0,255,63,0,192,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,240,0,0,128,3,0,0,0,0,0,0,0,128,2,0,0,192,0,0,67,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,
|
||||||
|
0,1,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,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,128,0,0,0,0,0,2,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,255,3,255,255,255,255,255,255,247,
|
||||||
|
255,127,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,254,255,0,252,1,0,0,248,1,0,
|
||||||
|
0,248,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,0,48,135,255,255,255,255,255,
|
||||||
|
143,255,0,0,0,0,0,0,224,255,255,127,255,15,1,0,0,0,0,0,255,255,255,255,255,63,
|
||||||
|
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,255,255,255,
|
||||||
|
15,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,128,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,
|
||||||
|
128,255,0,0,128,255,0,0,0,0,128,255,0,0,0,0,0,0,0,0,0,248,0,0,192,143,0,0,0,
|
||||||
|
128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,252,255,255,255,255,255,0,0,0,0,
|
||||||
|
0,0,0,135,255,1,255,1,0,0,0,224,0,0,0,224,0,0,0,0,0,1,0,0,96,248,127,0,0,0,0,
|
||||||
|
0,0,0,0,254,0,0,0,255,0,0,0,255,0,0,0,30,0,254,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,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,224,127,0,0,0,192,255,255,3,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,192,63,252,255,63,0,0,128,3,0,0,0,0,0,0,254,3,32,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,24,0,15,0,0,0,0,0,56,0,0,0,0,0,0,0,0,0,225,63,0,232,254,255,31,0,0,
|
||||||
|
0,0,0,0,0,96,63,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,
|
||||||
|
24,0,32,0,0,192,31,31,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,68,
|
||||||
|
248,0,104,0,0,0,0,0,0,0,0,0,0,0,0,76,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,128,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,128,14,0,0,0,255,
|
||||||
|
31,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,8,0,252,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,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,7,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,5,0,0,0,0,0,0,0,0,0,24,128,255,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,223,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,62,0,0,252,255,31,3,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,52,0,0,0,0,0,0,0,0,0,128,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,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,128,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,
|
||||||
|
255,3,
|
||||||
|
128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,255,1,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,0,0,
|
||||||
|
0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,0,0,0,0,0,0,0,255,255,48,0,0,248,
|
||||||
|
3,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,0,0,0,255,
|
||||||
|
255,255,7,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,0,0,
|
||||||
|
0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,15,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,63,
|
||||||
|
0,255,255,255,255,127,254,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,1,0,0,255,255,255,255,255,255,255,255,
|
||||||
|
63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,15,0,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,127,0,255,255,255,1,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,0,0,0,0,0,0,0,0,2,0,0,8,0,0,0,8,0,0,32,0,0,0,32,0,0,128,
|
||||||
|
0,0,0,128,0,0,0,2,0,0,0,2,0,0,8,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,15,0,248,254,255,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,127,0,0,128,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,
|
||||||
|
128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,127,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,112,7,0,192,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,0,0,254,255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,254,255,
|
||||||
|
255,255,255,255,255,63,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,255,255,255,255,255,
|
||||||
|
15,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,127,254,255,254,
|
||||||
|
255,254,255,255,255,63,0,255,31,255,255,255,255,0,0,0,252,0,0,0,28,0,0,0,252,
|
||||||
|
255,255,255,31,0,0,0,0,0,0,192,255,255,255,7,0,255,255,255,255,255,15,255,1,3,
|
||||||
|
0,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,63,0,255,31,255,7,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,1,
|
||||||
|
255,15,0,0,255,15,255,255,255,255,255,255,255,0,255,3,255,255,255,255,255,0,
|
||||||
|
255,255,255,63,0,0,0,0,0,0,0,0,0,0,255,239,255,255,255,255,255,255,255,255,
|
||||||
|
255,255,255,255,123,252,255,255,255,255,231,199,255,255,255,231,255,255,255,
|
||||||
|
255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,63,15,7,7,0,63,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,
|
113
third_party/musl/towctrans.c
vendored
Normal file
113
third_party/musl/towctrans.c
vendored
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||||
|
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||||
|
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||||
|
│ │
|
||||||
|
│ Musl Libc │
|
||||||
|
│ Copyright © 2005-2014 Rich Felker, et al. │
|
||||||
|
│ │
|
||||||
|
│ Permission is hereby granted, free of charge, to any person obtaining │
|
||||||
|
│ a copy of this software and associated documentation files (the │
|
||||||
|
│ "Software"), to deal in the Software without restriction, including │
|
||||||
|
│ without limitation the rights to use, copy, modify, merge, publish, │
|
||||||
|
│ distribute, sublicense, and/or sell copies of the Software, and to │
|
||||||
|
│ permit persons to whom the Software is furnished to do so, subject to │
|
||||||
|
│ the following conditions: │
|
||||||
|
│ │
|
||||||
|
│ The above copyright notice and this permission notice shall be │
|
||||||
|
│ included in all copies or substantial portions of the Software. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, │
|
||||||
|
│ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF │
|
||||||
|
│ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. │
|
||||||
|
│ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY │
|
||||||
|
│ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, │
|
||||||
|
│ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE │
|
||||||
|
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||||
|
│ │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <locale.h>
|
||||||
|
__static_yoink("musl_libc_notice");
|
||||||
|
|
||||||
|
static const unsigned char tab[];
|
||||||
|
|
||||||
|
static const unsigned char rulebases[512];
|
||||||
|
static const int rules[];
|
||||||
|
|
||||||
|
static const unsigned char exceptions[][2];
|
||||||
|
|
||||||
|
#include "casemap.inc"
|
||||||
|
|
||||||
|
static int casemap(unsigned c, int dir)
|
||||||
|
{
|
||||||
|
unsigned b, x, y, v, rt, xb, xn;
|
||||||
|
int r, rd, c0 = c;
|
||||||
|
|
||||||
|
if (c >= 0x20000) return c;
|
||||||
|
|
||||||
|
b = c>>8;
|
||||||
|
c &= 255;
|
||||||
|
x = c/3;
|
||||||
|
y = c%3;
|
||||||
|
|
||||||
|
/* lookup entry in two-level base-6 table */
|
||||||
|
v = tab[tab[b]*86+x];
|
||||||
|
static const int mt[] = { 2048, 342, 57 };
|
||||||
|
v = (v*mt[y]>>11)%6;
|
||||||
|
|
||||||
|
/* use the bit vector out of the tables as an index into
|
||||||
|
* a block-specific set of rules and decode the rule into
|
||||||
|
* a type and a case-mapping delta. */
|
||||||
|
r = rules[rulebases[b]+v];
|
||||||
|
rt = r & 255;
|
||||||
|
rd = r >> 8;
|
||||||
|
|
||||||
|
/* rules 0/1 are simple lower/upper case with a delta.
|
||||||
|
* apply according to desired mapping direction. */
|
||||||
|
if (rt < 2) return c0 + (rd & -(rt^dir));
|
||||||
|
|
||||||
|
/* binary search. endpoints of the binary search for
|
||||||
|
* this block are stored in the rule delta field. */
|
||||||
|
xn = rd & 0xff;
|
||||||
|
xb = (unsigned)rd >> 8;
|
||||||
|
while (xn) {
|
||||||
|
unsigned try = exceptions[xb+xn/2][0];
|
||||||
|
if (try == c) {
|
||||||
|
r = rules[exceptions[xb+xn/2][1]];
|
||||||
|
rt = r & 255;
|
||||||
|
rd = r >> 8;
|
||||||
|
if (rt < 2) return c0 + (rd & -(rt^dir));
|
||||||
|
/* Hard-coded for the four exceptional titlecase */
|
||||||
|
return c0 + (dir ? -1 : 1);
|
||||||
|
} else if (try > c) {
|
||||||
|
xn /= 2;
|
||||||
|
} else {
|
||||||
|
xb += xn/2;
|
||||||
|
xn -= xn/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return c0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t towlower(wint_t wc)
|
||||||
|
{
|
||||||
|
return casemap(wc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t towupper(wint_t wc)
|
||||||
|
{
|
||||||
|
return casemap(wc, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t __towupper_l(wint_t c, locale_t l)
|
||||||
|
{
|
||||||
|
return towupper(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t __towlower_l(wint_t c, locale_t l)
|
||||||
|
{
|
||||||
|
return towlower(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(__towupper_l, towupper_l);
|
||||||
|
__weak_reference(__towlower_l, towlower_l);
|
30
third_party/musl/wctrans.c
vendored
Normal file
30
third_party/musl/wctrans.c
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
wctrans_t wctrans(const char *class)
|
||||||
|
{
|
||||||
|
if (!strcmp(class, "toupper")) return (wctrans_t)1;
|
||||||
|
if (!strcmp(class, "tolower")) return (wctrans_t)2;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t towctrans(wint_t wc, wctrans_t trans)
|
||||||
|
{
|
||||||
|
if (trans == (wctrans_t)1) return towupper(wc);
|
||||||
|
if (trans == (wctrans_t)2) return towlower(wc);
|
||||||
|
return wc;
|
||||||
|
}
|
||||||
|
|
||||||
|
wctrans_t __wctrans_l(const char *s, locale_t l)
|
||||||
|
{
|
||||||
|
return wctrans(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
wint_t __towctrans_l(wint_t c, wctrans_t t, locale_t l)
|
||||||
|
{
|
||||||
|
return towctrans(c, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak_reference(__wctrans_l, wctrans_l);
|
||||||
|
__weak_reference(__towctrans_l, towctrans_l);
|
3
third_party/tr/BUILD.mk
vendored
3
third_party/tr/BUILD.mk
vendored
|
@ -22,7 +22,8 @@ THIRD_PARTY_TR_DIRECTDEPS = \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
THIRD_PARTY_GETOPT
|
THIRD_PARTY_GETOPT \
|
||||||
|
THIRD_PARTY_MUSL \
|
||||||
|
|
||||||
THIRD_PARTY_TR_DEPS := \
|
THIRD_PARTY_TR_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(THIRD_PARTY_TR_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(THIRD_PARTY_TR_DIRECTDEPS),$($(x))))
|
||||||
|
|
|
@ -16,327 +16,12 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/macros.h"
|
#include "libc/str/unicode.h"
|
||||||
#include "tool/plinko/lib/char.h"
|
#include "tool/plinko/lib/char.h"
|
||||||
|
|
||||||
static const unsigned short kWides[][2] = {
|
int GetMonospaceCharacterWidth(int c) {
|
||||||
{0x1100, 0x115F}, // HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER
|
int w = wcwidth(c);
|
||||||
{0x231A, 0x231B}, // WATCH..HOURGLASS
|
if (w < 0)
|
||||||
{0x2329, 0x2329}, // LEFT-POINTING ANGLE BRACKET
|
w = 0;
|
||||||
{0x232A, 0x232A}, // RIGHT-POINTING ANGLE BRACKET
|
return w;
|
||||||
{0x23E9, 0x23EC}, // BLACK RIGHT-POINTING DOUBLE TRIANGLE...
|
|
||||||
{0x23F0, 0x23F0}, // ALARM CLOCK
|
|
||||||
{0x23F3, 0x23F3}, // HOURGLASS WITH FLOWING SAND
|
|
||||||
{0x25FD, 0x25FE}, // WHITE MEDIUM SMALL SQUARE..BLACK MEDIUM SMALL SQUARE
|
|
||||||
{0x2614, 0x2615}, // UMBRELLA WITH RAIN DROPS..HOT BEVERAGE
|
|
||||||
{0x2648, 0x2653}, // ARIES..PISCES
|
|
||||||
{0x267F, 0x267F}, // WHEELCHAIR SYMBOL
|
|
||||||
{0x2693, 0x2693}, // ANCHOR
|
|
||||||
{0x26A1, 0x26A1}, // HIGH VOLTAGE SIGN
|
|
||||||
{0x26AA, 0x26AB}, // MEDIUM WHITE CIRCLE..MEDIUM BLACK CIRCLE
|
|
||||||
{0x26BD, 0x26BE}, // SOCCER BALL..BASEBALL
|
|
||||||
{0x26C4, 0x26C5}, // SNOWMAN WITHOUT SNOW..SUN BEHIND CLOUD
|
|
||||||
{0x26CE, 0x26CE}, // OPHIUCHUS
|
|
||||||
{0x26D4, 0x26D4}, // NO ENTRY
|
|
||||||
{0x26EA, 0x26EA}, // CHURCH
|
|
||||||
{0x26F2, 0x26F3}, // FOUNTAIN..FLAG IN HOLE
|
|
||||||
{0x26F5, 0x26F5}, // SAILBOAT
|
|
||||||
{0x26FA, 0x26FA}, // TENT
|
|
||||||
{0x26FD, 0x26FD}, // FUEL PUMP
|
|
||||||
{0x2705, 0x2705}, // WHITE HEAVY CHECK MARK
|
|
||||||
{0x270A, 0x270B}, // RaiseD FIST..RaiseD HAND
|
|
||||||
{0x2728, 0x2728}, // SPARKLES
|
|
||||||
{0x274C, 0x274C}, // CROSS MARK
|
|
||||||
{0x274E, 0x274E}, // NEGATIVE SQUARED CROSS MARK
|
|
||||||
{0x2753, 0x2755}, // BLACK QUESTION MARK ORNAMENT..WHITE EXCLAMATION MARK
|
|
||||||
{0x2757, 0x2757}, // HEAVY EXCLAMATION MARK SYMBOL
|
|
||||||
{0x2795, 0x2797}, // HEAVY PLUS SIGN..HEAVY DIVISION SIGN
|
|
||||||
{0x27B0, 0x27B0}, // CURLY LOOP
|
|
||||||
{0x27BF, 0x27BF}, // DOUBLE CURLY LOOP
|
|
||||||
{0x2B1B, 0x2B1C}, // BLACK LARGE SQUARE..WHITE LARGE SQUARE
|
|
||||||
{0x2B50, 0x2B50}, // WHITE MEDIUM STAR
|
|
||||||
{0x2B55, 0x2B55}, // HEAVY LARGE CIRCLE
|
|
||||||
{0x2E80, 0x2E99}, // CJK RADICAL REPEAT..CJK RADICAL RAP
|
|
||||||
{0x2E9B, 0x2EF3}, // CJK RADICAL CHOKE..CJK RADICAL C-SIMPLIFIED TURTLE
|
|
||||||
{0x2F00, 0x2FD5}, // KANGXI RADICAL ONE..KANGXI RADICAL FLUTE
|
|
||||||
{0x2FF0, 0x2FFB}, // IDEOGRAPHIC DESCRIPTION CHARACTER LTR..OVERLAID
|
|
||||||
{0x3000, 0x3000}, // IDEOGRAPHIC SPACE
|
|
||||||
{0x3001, 0x3003}, // IDEOGRAPHIC COMMA..DITTO MARK
|
|
||||||
{0x3004, 0x3004}, // JAPANESE INDUSTRIAL STANDARD SYMBOL
|
|
||||||
{0x3005, 0x3005}, // IDEOGRAPHIC ITERATION MARK
|
|
||||||
{0x3006, 0x3006}, // IDEOGRAPHIC CLOSING MARK
|
|
||||||
{0x3007, 0x3007}, // IDEOGRAPHIC NUMBER ZERO
|
|
||||||
{0x3008, 0x3008}, // LEFT ANGLE BRACKET
|
|
||||||
{0x3009, 0x3009}, // RIGHT ANGLE BRACKET
|
|
||||||
{0x300A, 0x300A}, // LEFT DOUBLE ANGLE BRACKET
|
|
||||||
{0x300B, 0x300B}, // RIGHT DOUBLE ANGLE BRACKET
|
|
||||||
{0x300C, 0x300C}, // LEFT CORNER BRACKET
|
|
||||||
{0x300D, 0x300D}, // RIGHT CORNER BRACKET
|
|
||||||
{0x300E, 0x300E}, // LEFT WHITE CORNER BRACKET
|
|
||||||
{0x300F, 0x300F}, // RIGHT WHITE CORNER BRACKET
|
|
||||||
{0x3010, 0x3010}, // LEFT BLACK LENTICULAR BRACKET
|
|
||||||
{0x3011, 0x3011}, // RIGHT BLACK LENTICULAR BRACKET
|
|
||||||
{0x3012, 0x3013}, // POSTAL MARK..GETA MARK
|
|
||||||
{0x3014, 0x3014}, // LEFT TORTOISE SHELL BRACKET
|
|
||||||
{0x3015, 0x3015}, // RIGHT TORTOISE SHELL BRACKET
|
|
||||||
{0x3016, 0x3016}, // LEFT WHITE LENTICULAR BRACKET
|
|
||||||
{0x3017, 0x3017}, // RIGHT WHITE LENTICULAR BRACKET
|
|
||||||
{0x3018, 0x3018}, // LEFT WHITE TORTOISE SHELL BRACKET
|
|
||||||
{0x3019, 0x3019}, // RIGHT WHITE TORTOISE SHELL BRACKET
|
|
||||||
{0x301A, 0x301A}, // LEFT WHITE SQUARE BRACKET
|
|
||||||
{0x301B, 0x301B}, // RIGHT WHITE SQUARE BRACKET
|
|
||||||
{0x301C, 0x301C}, // WAVE DASH
|
|
||||||
{0x301D, 0x301D}, // REVERSED DOUBLE PRIME QUOTATION MARK
|
|
||||||
{0x301E, 0x301F}, // DOUBLE PRIME QUOTATION MARK..LOW DOUBLE PRIME
|
|
||||||
{0x3020, 0x3020}, // POSTAL MARK FACE
|
|
||||||
{0x3021, 0x3029}, // HANGZHOU NUMERAL ONE..HANGZHOU NUMERAL NINE
|
|
||||||
{0x302A, 0x302D}, // IDEOGRAPHIC LEVEL TONE MARK..ENTERING TONE MARK
|
|
||||||
{0x302E, 0x302F}, // HANGUL SINGLE DOT TONE MARK..DOUBLE DOT TONE MARK
|
|
||||||
{0x3030, 0x3030}, // WAVY DASH
|
|
||||||
{0x3031, 0x3035}, // VERTICAL KANA REPEAT MARK..KANA REPEAT MARK LOWER
|
|
||||||
{0x3036, 0x3037}, // CIRCLED POSTAL MARK..IDEOGRAPHIC TELEGRAPH LF SYMBOL
|
|
||||||
{0x3038, 0x303A}, // HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY
|
|
||||||
{0x303B, 0x303B}, // VERTICAL IDEOGRAPHIC ITERATION MARK
|
|
||||||
{0x303C, 0x303C}, // MASU MARK
|
|
||||||
{0x303D, 0x303D}, // PART ALTERNATION MARK
|
|
||||||
{0x303E, 0x303E}, // IDEOGRAPHIC VARIATION INDICATOR
|
|
||||||
{0x3041, 0x3096}, // HIRAGANA LETTER SMALL A..HIRAGANA LETTER SMALL KE
|
|
||||||
{0x3099, 0x309A}, // COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK...
|
|
||||||
{0x309B, 0x309C}, // KATAKANA-HIRAGANA VOICED SOUND MARK...
|
|
||||||
{0x309D, 0x309E}, // HIRAGANA ITERATION MARK..VOICED ITERATION MARK
|
|
||||||
{0x309F, 0x309F}, // HIRAGANA DIGRAPH YORI
|
|
||||||
{0x30A0, 0x30A0}, // KATAKANA-HIRAGANA DOUBLE HYPHEN
|
|
||||||
{0x30A1, 0x30FA}, // KATAKANA LETTER SMALL A..KATAKANA LETTER VO
|
|
||||||
{0x30FB, 0x30FB}, // KATAKANA MIDDLE DOT
|
|
||||||
{0x30FC, 0x30FE}, // KATAKANA-HIRAGANA PROLONGED SOUND MARK..ITERATION
|
|
||||||
{0x30FF, 0x30FF}, // KATAKANA DIGRAPH KOTO
|
|
||||||
{0x3105, 0x312F}, // BOPOMOFO LETTER B..BOPOMOFO LETTER NN
|
|
||||||
{0x3131, 0x318E}, // HANGUL LETTER KIYEOK..HANGUL LETTER ARAEAE
|
|
||||||
{0x3190, 0x3191}, // IDEOGRAPHIC ANNOTATION LINKING MARK..REVERSE
|
|
||||||
{0x3192, 0x3195}, // IDEOGRAPHIC ANNOTATION ONE MARK..FOUR
|
|
||||||
{0x3196, 0x319F}, // IDEOGRAPHIC ANNOTATION TOP MARK..MAN
|
|
||||||
{0x31A0, 0x31BF}, // BOPOMOFO LETTER BU..BOPOMOFO LETTER AH
|
|
||||||
{0x31C0, 0x31E3}, // CJK STROKE T..CJK STROKE Q
|
|
||||||
{0x31F0, 0x31FF}, // KATAKANA LETTER SMALL KU..KATAKANA LETTER SMALL RO
|
|
||||||
{0x3200, 0x321E}, // PARENTHESIZED HANGUL KIYEOK..CHARACTER O HU
|
|
||||||
{0x3220, 0x3229}, // PARENTHESIZED IDEOGRAPH ONE..TEN
|
|
||||||
{0x322A, 0x3247}, // PARENTHESIZED IDEOGRAPH MOON..CIRCLED IDEOGRAPH KOTO
|
|
||||||
{0x3250, 0x3250}, // PARTNERSHIP SIGN
|
|
||||||
{0x3251, 0x325F}, // CIRCLED NUMBER TWENTY ONE..CIRCLED 35
|
|
||||||
{0x3260, 0x327F}, // CIRCLED HANGUL KIYEOK..KOREAN STANDARD SYMBOL
|
|
||||||
{0x3280, 0x3289}, // CIRCLED IDEOGRAPH ONE..CIRCLED IDEOGRAPH TEN
|
|
||||||
{0x328A, 0x32B0}, // CIRCLED IDEOGRAPH MOON..CIRCLED IDEOGRAPH NIGHT
|
|
||||||
{0x32B1, 0x32BF}, // CIRCLED NUMBER THIRTY SIX..CIRCLED NUMBER FIFTY
|
|
||||||
{0x32C0, 0x32FF}, // TELEGRAPH SYMBOL FOR JANUARY..SQUARE ERA NAME REIWA
|
|
||||||
{0x3300, 0x33FF}, // SQUARE APAATO..SQUARE GAL
|
|
||||||
{0x3400, 0x4DBF}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x4E00, 0x9FFF}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0xA000, 0xA014}, // YI SYLLABLE IT..YI SYLLABLE E
|
|
||||||
{0xA015, 0xA015}, // YI SYLLABLE WU
|
|
||||||
{0xA016, 0xA48C}, // YI SYLLABLE BIT..YI SYLLABLE YYR
|
|
||||||
{0xA490, 0xA4C6}, // YI RADICAL QOT..YI RADICAL KE
|
|
||||||
{0xA960, 0xA97C}, // HANGUL CHOSEONG TIKEUT-MIEUM..SSANGYEORINHIEUH
|
|
||||||
{0xAC00, 0xD7A3}, // HANGUL SYLLABLE GA..HANGUL SYLLABLE HIH
|
|
||||||
{0xF900, 0xFA6D}, // CJK COMPATIBILITY IDEOGRAPH
|
|
||||||
{0xFA6E, 0xFA6F}, // RESERVED
|
|
||||||
{0xFA70, 0xFAD9}, // CJK COMPATIBILITY IDEOGRAPH
|
|
||||||
{0xFADA, 0xFAFF}, // RESERVED
|
|
||||||
{0xFE10, 0xFE16}, // PRESENTATION FORM FOR VERTICAL COMMA..QUESTION
|
|
||||||
{0xFE17, 0xFE17}, // VERTICAL LEFT WHITE LENTICULAR BRACKET
|
|
||||||
{0xFE18, 0xFE18}, // VERTICAL RIGHT WHITE LENTICULAR BRAKCET
|
|
||||||
{0xFE19, 0xFE19}, // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS
|
|
||||||
{0xFE30, 0xFE30}, // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER
|
|
||||||
{0xFE31, 0xFE32}, // VERTICAL EM DASH..VERTICAL EN DASH
|
|
||||||
{0xFE33, 0xFE34}, // VERTICAL LOW LINE..VERTICAL WAVY LOW LINE
|
|
||||||
{0xFE35, 0xFE35}, // PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS
|
|
||||||
{0xFE36, 0xFE36}, // PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS
|
|
||||||
{0xFE37, 0xFE37}, // PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET
|
|
||||||
{0xFE38, 0xFE38}, // PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET
|
|
||||||
{0xFE39, 0xFE39}, // VERTICAL LEFT TORTOISE SHELL BRACKET
|
|
||||||
{0xFE3A, 0xFE3A}, // VERTICAL RIGHT TORTOISE SHELL BRACKET
|
|
||||||
{0xFE3B, 0xFE3B}, // VERTICAL LEFT BLACK LENTICULAR BRACKET
|
|
||||||
{0xFE3C, 0xFE3C}, // VERTICAL RIGHT BLACK LENTICULAR BRACKET
|
|
||||||
{0xFE3D, 0xFE3D}, // VERTICAL LEFT DOUBLE ANGLE BRACKET
|
|
||||||
{0xFE3E, 0xFE3E}, // VERTICAL RIGHT DOUBLE ANGLE BRACKET
|
|
||||||
{0xFE3F, 0xFE3F}, // VERTICAL LEFT ANGLE BRACKET
|
|
||||||
{0xFE40, 0xFE40}, // VERTICAL RIGHT ANGLE BRACKET
|
|
||||||
{0xFE41, 0xFE41}, // VERTICAL LEFT CORNER BRACKET
|
|
||||||
{0xFE42, 0xFE42}, // VERTICAL RIGHT CORNER BRACKET
|
|
||||||
{0xFE43, 0xFE43}, // VERTICAL LEFT WHITE CORNER BRACKET
|
|
||||||
{0xFE44, 0xFE44}, // VERTICAL RIGHT WHITE CORNER BRACKET
|
|
||||||
{0xFE45, 0xFE46}, // SESAME DOT..WHITE SESAME DOT
|
|
||||||
{0xFE47, 0xFE47}, // VERTICAL LEFT SQUARE BRACKET
|
|
||||||
{0xFE48, 0xFE48}, // VERTICAL RIGHT SQUARE BRACKET
|
|
||||||
{0xFE49, 0xFE4C}, // DASHED OVERLINE..DOUBLE WAVY OVERLINE
|
|
||||||
{0xFE4D, 0xFE4F}, // DASHED LOW LINE..WAVY LOW LINE
|
|
||||||
{0xFE50, 0xFE52}, // SMALL COMMA..SMALL FULL STOP
|
|
||||||
{0xFE54, 0xFE57}, // SMALL SEMICOLON..SMALL EXCLAMATION MARK
|
|
||||||
{0xFE58, 0xFE58}, // SMALL EM DASH
|
|
||||||
{0xFE59, 0xFE59}, // SMALL LEFT PARENTHESIS
|
|
||||||
{0xFE5A, 0xFE5A}, // SMALL RIGHT PARENTHESIS
|
|
||||||
{0xFE5B, 0xFE5B}, // SMALL LEFT CURLY BRACKET
|
|
||||||
{0xFE5C, 0xFE5C}, // SMALL RIGHT CURLY BRACKET
|
|
||||||
{0xFE5D, 0xFE5D}, // SMALL LEFT TORTOISE SHELL BRACKET
|
|
||||||
{0xFE5E, 0xFE5E}, // SMALL RIGHT TORTOISE SHELL BRACKET
|
|
||||||
{0xFE5F, 0xFE61}, // SMALL NUMBER SIGN..SMALL ASTERISK
|
|
||||||
{0xFE62, 0xFE62}, // SMALL PLUS SIGN
|
|
||||||
{0xFE63, 0xFE63}, // SMALL HYPHEN-MINUS
|
|
||||||
{0xFE64, 0xFE66}, // SMALL LESS-THAN SIGN..SMALL EQUALS SIGN
|
|
||||||
{0xFE68, 0xFE68}, // SMALL REVERSE SOLIDUS
|
|
||||||
{0xFE69, 0xFE69}, // SMALL DOLLAR SIGN
|
|
||||||
{0xFE6A, 0xFE6B}, // SMALL PERCENT SIGN..SMALL COMMERCIAL AT
|
|
||||||
{0xFF01, 0xFF03}, // EXCLAMATION MARK..NUMBER SIGN
|
|
||||||
{0xFF04, 0xFF04}, // DOLLAR SIGN
|
|
||||||
{0xFF05, 0xFF07}, // PERCENT SIGN..APOSTROPHE
|
|
||||||
{0xFF08, 0xFF08}, // LEFT PARENTHESIS
|
|
||||||
{0xFF09, 0xFF09}, // RIGHT PARENTHESIS
|
|
||||||
{0xFF0A, 0xFF0A}, // ASTERISK
|
|
||||||
{0xFF0B, 0xFF0B}, // PLUS SIGN
|
|
||||||
{0xFF0C, 0xFF0C}, // COMMA
|
|
||||||
{0xFF0D, 0xFF0D}, // HYPHEN-MINUS
|
|
||||||
{0xFF0E, 0xFF0F}, // FULL STOP..SOLIDUS
|
|
||||||
{0xFF10, 0xFF19}, // DIGIT ZERO..DIGIT NINE
|
|
||||||
{0xFF1A, 0xFF1B}, // COLON..SEMICOLON
|
|
||||||
{0xFF1C, 0xFF1E}, // LESS-THAN..GREATER-THAN
|
|
||||||
{0xFF1F, 0xFF20}, // QUESTION MARK..COMMERCIAL AT
|
|
||||||
{0xFF21, 0xFF3A}, // LATIN CAPITAL LETTER A..Z
|
|
||||||
{0xFF3B, 0xFF3B}, // LEFT SQUARE BRACKET
|
|
||||||
{0xFF3C, 0xFF3C}, // REVERSE SOLIDUS
|
|
||||||
{0xFF3D, 0xFF3D}, // RIGHT SQUARE BRACKET
|
|
||||||
{0xFF3E, 0xFF3E}, // CIRCUMFLEX ACCENT
|
|
||||||
{0xFF3F, 0xFF3F}, // LOW LINE
|
|
||||||
{0xFF40, 0xFF40}, // GRAVE ACCENT
|
|
||||||
{0xFF41, 0xFF5A}, // LATIN SMALL LETTER A..Z
|
|
||||||
{0xFF5B, 0xFF5B}, // LEFT CURLY BRACKET
|
|
||||||
{0xFF5C, 0xFF5C}, // VERTICAL LINE
|
|
||||||
{0xFF5D, 0xFF5D}, // RIGHT CURLY BRACKET
|
|
||||||
{0xFF5E, 0xFF5E}, // TILDE
|
|
||||||
{0xFF5F, 0xFF5F}, // LEFT WHITE PARENTHESIS
|
|
||||||
{0xFF60, 0xFF60}, // RIGHT WHITE PARENTHESIS
|
|
||||||
{0xFFE0, 0xFFE1}, // CENT SIGN..POUND SIGN
|
|
||||||
{0xFFE2, 0xFFE2}, // NOT SIGN
|
|
||||||
{0xFFE3, 0xFFE3}, // MACRON
|
|
||||||
{0xFFE4, 0xFFE4}, // BROKEN BAR
|
|
||||||
{0xFFE5, 0xFFE6}, // YEN SIGN..WON SIGN
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int kAstralWides[][2] = {
|
|
||||||
{0x16FE0, 0x16FE1}, // TANGUT ITERATION MARK..NUSHU ITERATION MARK
|
|
||||||
{0x16FE2, 0x16FE2}, // OLD CHINESE HOOK MARK
|
|
||||||
{0x16FE3, 0x16FE3}, // OLD CHINESE ITERATION MARK
|
|
||||||
{0x16FE4, 0x16FE4}, // KHITAN SMALL SCRIPT FILLER
|
|
||||||
{0x16FF0, 0x16FF1}, // VIETNAMESE ALTERNATE READING MARK CA..NHAY
|
|
||||||
{0x17000, 0x187F7}, // TANGUT IDEOGRAPH
|
|
||||||
{0x18800, 0x18AFF}, // TANGUT COMPONENT
|
|
||||||
{0x18B00, 0x18CD5}, // KHITAN SMALL SCRIPT CHARACTER
|
|
||||||
{0x18D00, 0x18D08}, // TANGUT IDEOGRAPH
|
|
||||||
{0x1AFF0, 0x1AFF3}, // KATAKANA LETTER MINNAN TONE-2..5
|
|
||||||
{0x1AFF5, 0x1AFFB}, // KATAKANA LETTER MINNAN TONE-7..5
|
|
||||||
{0x1AFFD, 0x1AFFE}, // KATAKANA LETTER MINNAN NASALIZED TONE-7..8
|
|
||||||
{0x1B000, 0x1B0FF}, // KATAKANA LETTER ARCHAIC E..HENTAIGANA LETTER RE-2
|
|
||||||
{0x1B100, 0x1B122}, // HENTAIGANA LETTER RE-3..KATAKANA LETTER ARCHAIC WU
|
|
||||||
{0x1B150, 0x1B152}, // HIRAGANA LETTER SMALL WI..HIRAGANA LETTER SMALL WO
|
|
||||||
{0x1B164, 0x1B167}, // KATAKANA LETTER SMALL WI..KATAKANA LETTER SMALL N
|
|
||||||
{0x1B170, 0x1B2FB}, // NUSHU CHARACTER-1B170..NUSHU CHARACTER-1B2FB
|
|
||||||
{0x1F004, 0x1F004}, // MAHJONG TILE RED DRAGON
|
|
||||||
{0x1F0CF, 0x1F0CF}, // PLAYING CARD BLACK JOKER
|
|
||||||
{0x1F18E, 0x1F18E}, // NEGATIVE SQUARED AB
|
|
||||||
{0x1F191, 0x1F19A}, // SQUARED CL..SQUARED VS
|
|
||||||
{0x1F200, 0x1F202}, // SQUARE HIRAGANA HOKA..SQUARED KATAKANA SA
|
|
||||||
{0x1F210, 0x1F23B}, // SQUARED CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x1F240, 0x1F248}, // TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x1F250, 0x1F251}, // CIRCLED IDEOGRAPH ADVANTAGE..ACCEPT
|
|
||||||
{0x1F260, 0x1F265}, // ROUNDED SYMBOL FOR FU..ROUNDED SYMBOL FOR CAI
|
|
||||||
{0x1F300, 0x1F320}, // CYCLONE..SHOOTING STAR
|
|
||||||
{0x1F32D, 0x1F335}, // HOT DOG..CACTUS
|
|
||||||
{0x1F337, 0x1F37C}, // TULIP..BABY BOTTLE
|
|
||||||
{0x1F37E, 0x1F393}, // BOTTLE WITH POPPING CORK..GRADUATION CAP
|
|
||||||
{0x1F3A0, 0x1F3CA}, // CAROUSEL HORSE..SWIMMER
|
|
||||||
{0x1F3CF, 0x1F3D3}, // CRICKET BAT AND BALL..TABLE TENNIS PADDLE AND BALL
|
|
||||||
{0x1F3E0, 0x1F3F0}, // HOUSE BUILDING..EUROPEAN CASTLE
|
|
||||||
{0x1F3F4, 0x1F3F4}, // WAVING BLACK FLAG
|
|
||||||
{0x1F3F8, 0x1F3FA}, // BADMINTON RACQUET AND SHUTTLECOCK..AMPHORA
|
|
||||||
{0x1F3FB, 0x1F3FF}, // EMOJI MODIFIER FITZPATRICK TYPE-1-2..6
|
|
||||||
{0x1F400, 0x1F43E}, // RAT..PAW PRINTS
|
|
||||||
{0x1F440, 0x1F440}, // EYES
|
|
||||||
{0x1F442, 0x1F4FC}, // EAR..VIDEOCASSETTE
|
|
||||||
{0x1F4FF, 0x1F53D}, // PRAYER BEADS..DOWN-POINTING SMALL RED TRIANGLE
|
|
||||||
{0x1F54B, 0x1F54E}, // KAABA..MENORAH WITH NINE BRANCHES
|
|
||||||
{0x1F550, 0x1F567}, // CLOCK FACE ONE OCLOCK..CLOCK FACE TWELVE-THIRTY
|
|
||||||
{0x1F57A, 0x1F57A}, // MAN DANCING
|
|
||||||
{0x1F595, 0x1F596}, // REVERSED HAND WITH MIDDLE FINGER EXTENDED..FINGERS
|
|
||||||
{0x1F5A4, 0x1F5A4}, // BLACK HEART
|
|
||||||
{0x1F5FB, 0x1F5FF}, // MOUNT FUJI..MOYAI
|
|
||||||
{0x1F600, 0x1F64F}, // GRINNING FACE..PERSON WITH FOLDED HANDS
|
|
||||||
{0x1F680, 0x1F6C5}, // ROCKET..LEFT LUGGAGE
|
|
||||||
{0x1F6CC, 0x1F6CC}, // SLEEPING ACCOMMODATION
|
|
||||||
{0x1F6D0, 0x1F6D2}, // PLACE OF WORSHIP..SHOPPING TROLLEY
|
|
||||||
{0x1F6D5, 0x1F6D7}, // HINDU TEMPLE..ELEVATOR
|
|
||||||
{0x1F6DD, 0x1F6DF}, // PLAYGROUND SLIDE..RING BUOY
|
|
||||||
{0x1F6EB, 0x1F6EC}, // AIRPLANE DEPARTURE..AIRPLANE ARRIVING
|
|
||||||
{0x1F6F4, 0x1F6FC}, // SCOOTER..ROLLER SKATE
|
|
||||||
{0x1F7E0, 0x1F7EB}, // LARGE ORANGE CIRCLE..LARGE BROWN SQUARE
|
|
||||||
{0x1F7F0, 0x1F7F0}, // HEAVY EQUALS SIGN
|
|
||||||
{0x1F90C, 0x1F93A}, // PINCHED FINGERS..FENCER
|
|
||||||
{0x1F93C, 0x1F945}, // WRESTLERS..GOAL NET
|
|
||||||
{0x1F947, 0x1F9FF}, // FIRST PLACE MEDAL..NAZAR AMULET
|
|
||||||
{0x1FA70, 0x1FA74}, // BALLET SHOES..THONG SANDAL
|
|
||||||
{0x1FA78, 0x1FA7C}, // DROP OF BLOOD..CRUTCH
|
|
||||||
{0x1FA80, 0x1FA86}, // YO-YO..NESTING DOLLS
|
|
||||||
{0x1FA90, 0x1FAAC}, // RINGED PLANET..HAMSA
|
|
||||||
{0x1FAB0, 0x1FABA}, // FLY..NEST WITH EGGS
|
|
||||||
{0x1FAC0, 0x1FAC5}, // ANATOMICAL HEART..PERSON WITH CROWN
|
|
||||||
{0x1FAD0, 0x1FAD9}, // BLUEBERRIES..JAR
|
|
||||||
{0x1FAE0, 0x1FAE7}, // MELTING FACE..BUBBLES
|
|
||||||
{0x1FAF0, 0x1FAF6}, // HAND WITH INDEX FINGER THUMB CROSSED..HEART HANDS
|
|
||||||
{0x20000, 0x2A6DF}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x2A6E0, 0x2A6FF}, // RESERVED
|
|
||||||
{0x2A700, 0x2B738}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x2B739, 0x2B73F}, // RESERVED
|
|
||||||
{0x2B740, 0x2B81D}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x2B81E, 0x2B81F}, // RESERVED
|
|
||||||
{0x2B820, 0x2CEA1}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x2CEA2, 0x2CEAF}, // RESERVED
|
|
||||||
{0x2CEB0, 0x2EBE0}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x2EBE1, 0x2F7FF}, // RESERVED
|
|
||||||
{0x2F800, 0x2FA1D}, // CJK COMPATIBILITY IDEOGRAPH
|
|
||||||
{0x2FA1E, 0x2FA1F}, // RESERVED
|
|
||||||
{0x2FA20, 0x2FFFD}, // RESERVED
|
|
||||||
{0x30000, 0x3134A}, // CJK UNIFIED IDEOGRAPH
|
|
||||||
{0x3134B, 0x3FFFD}, // RESERVED
|
|
||||||
};
|
|
||||||
|
|
||||||
pureconst bool IsWide(int c) {
|
|
||||||
int m, l, r, n;
|
|
||||||
if (c < 0x1100) {
|
|
||||||
return false;
|
|
||||||
} else if (c < 0x10000) {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kWides) / sizeof(kWides[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kWides[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return l < n && kWides[l][0] <= c && c <= kWides[l][1];
|
|
||||||
} else {
|
|
||||||
l = 0;
|
|
||||||
r = n = sizeof(kAstralWides) / sizeof(kAstralWides[0]);
|
|
||||||
while (l < r) {
|
|
||||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
|
||||||
if (kAstralWides[m][1] < c) {
|
|
||||||
l = m + 1;
|
|
||||||
} else {
|
|
||||||
r = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return l < n && kAstralWides[l][0] <= c && c <= kAstralWides[l][1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pureconst int GetMonospaceCharacterWidth(int c) {
|
|
||||||
return !IsControl(c) + IsWide(c);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue