Skip to content

Commit

Permalink
add wchar32 and related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Dec 19, 2024
1 parent 2a92efb commit c075874
Show file tree
Hide file tree
Showing 8 changed files with 929 additions and 258 deletions.
3 changes: 3 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 最新动态

2024/12/19
* 增加 wchar32 以及相关函数。

2024/12/13
* 增加EVT\_NATIVE\_WINDOW\_FOCUS\_GAINED(感谢兆坤提供补丁)
* 用widget\_set\_self\_layout替换widget\_set\_self\_layout\_params(感谢兆坤提供补丁)
Expand Down
10 changes: 5 additions & 5 deletions src/tkc/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ int32_t tk_wstricmp(const wchar_t* a, const wchar_t* b) {
return 1;
}

return wcs_case_cmp(a, b);
return wcscasecmp(a, b);
}

char* tk_str_copy(char* dst, const char* src) {
Expand Down Expand Up @@ -1016,13 +1016,13 @@ ret_t tk_wstr_select_word(const wchar_t* str, uint32_t len, uint32_t index, int3
--i;

if (i >= 0) {
if (wcs_chr(no_start_symbols, str[i]) != NULL) {
if (wcschr(no_start_symbols, str[i]) != NULL) {
break;
} else if (str[i] == '\r' || str[i] == '\n') {
break;
} else if (tk_isspace(str[i])) {
break;
} else if (!tk_isspace(str[i + 1]) && wcs_chr(no_start_symbols, str[i + 1]) == NULL &&
} else if (!tk_isspace(str[i + 1]) && wcschr(no_start_symbols, str[i + 1]) == NULL &&
((tk_isalpha(str[i]) && !tk_isalpha(str[i + 1])) ||
(!tk_isalpha(str[i]) && tk_isalpha(str[i + 1])))) {
break;
Expand All @@ -1044,10 +1044,10 @@ ret_t tk_wstr_select_word(const wchar_t* str, uint32_t len, uint32_t index, int3
++i;

if (i >= 0 && i <= len) {
if (wcs_chr(no_start_symbols, str[i - 1]) != NULL) {
if (wcschr(no_start_symbols, str[i - 1]) != NULL) {
*right = i - 1;
break;
} else if (wcs_chr(no_start_symbols, str[i]) != NULL) {
} else if (wcschr(no_start_symbols, str[i]) != NULL) {
*right = i;
break;
} else if (str[i - 1] == '\r' || str[i] == '\n') {
Expand Down
13 changes: 0 additions & 13 deletions src/tkc/wasm_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,6 @@ int iswalnum(wchar_t ch);
int iswspace(wchar_t ch);
int islower(int c);

#ifdef WITH_WCSXXX

size_t wcslen(const wchar_t* s);
int wcscmp(const wchar_t* s1, const wchar_t* s2);
int wcscasecmp(const wchar_t* s1, const wchar_t* s2);
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
wchar_t* wcsdup(const wchar_t* s);
wchar_t* wcschr(const wchar_t* s, wchar_t c);
wchar_t* wcscpy(wchar_t* s1, const wchar_t* s2);
wchar_t* wcsncpy(wchar_t* s1, const wchar_t* s2, size_t n);
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
#endif /*WITH_WCSXXX*/

#if defined(__GNUC__) && !defined(__cplusplus)
typedef _Bool bool_t;
#else
Expand Down
Loading

0 comments on commit c075874

Please sign in to comment.