diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cstr.h | 13 | ||||
| -rw-r--r-- | include/stc/utf8.h | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 3231c09d..aae52ea0 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -172,9 +172,16 @@ STC_INLINE size_t cstr_capacity(cstr s) // utf8 methods defined in/depending on src/utf8code.c: -extern cstr cstr_casefold_sv(csview sv); -extern cstr cstr_tolower_sv(csview sv); -extern cstr cstr_toupper_sv(csview sv); +extern cstr cstr_tocase(csview sv, int k); + +STC_INLINE cstr cstr_casefold_sv(csview sv) + { return cstr_tocase(sv, 0); } + +STC_INLINE cstr cstr_tolower_sv(csview sv) + { return cstr_tocase(sv, 1); } + +STC_INLINE cstr cstr_toupper_sv(csview sv) + { return cstr_tocase(sv, 2); } STC_INLINE cstr cstr_tolower(const char* str) { return cstr_tolower_sv(c_sv(str, strlen(str))); } diff --git a/include/stc/utf8.h b/include/stc/utf8.h index 2dd51927..c20b80cb 100644 --- a/include/stc/utf8.h +++ b/include/stc/utf8.h @@ -5,8 +5,7 @@ #include <ctype.h> // utf8 methods defined in src/utf8code.c: -extern bool utf8_islower(uint32_t c); -extern bool utf8_isupper(uint32_t c); + extern bool utf8_isspace(uint32_t c); extern bool utf8_isdigit(uint32_t c); extern bool utf8_isxdigit(uint32_t c); @@ -20,6 +19,9 @@ extern int utf8_icmp_sv(csview s1, csview s2); extern unsigned utf8_encode(char *out, uint32_t c); extern uint32_t utf8_peek(const char *s, int u8pos); +STC_INLINE bool utf8_isupper(uint32_t c) { return utf8_tolower(c) != c; } +STC_INLINE bool utf8_islower(uint32_t c) { return utf8_toupper(c) != c; } + /* following functions uses src/utf8code.c */ /* decode next utf8 codepoint. https://bjoern.hoehrmann.de/utf-8/decoder/dfa */ |
