30#define wsbody(ws) ((WSBODY *) ((ws)->wsbody))
#define __swi_variadic_begin(number)
#define __swi_end(number, func, call)
#define __swi_variadic_end(number, func,...)
#define __swi_begin(number)
void *(* malloc_func_t)(size_t size)
malloc()
void(* mfree_func_t)(void *ptr)
free()
uint16_t len
The first item is string length.
uint16_t maxlen
Maximum length of the string.
mfree_func_t ws_mfree
Pointer to the free()
uint16_t data[]
Other items are string characters.
int isbody_allocated
1: When a string is allocated by AllocWS or CreateWS, 0: When as string is allocated by CreateLocalWS
uint16_t * wsbody
wsbody[0] - len, wsbody[1] - first char
malloc_func_t ws_malloc
Pointer to the malloc()
int utf8_2ws(WSHDR *destination, const char *source, uint32_t size)
Convert UTF-8 C-string to WSHDR.
int wstrncmp(const WSHDR *ws1, const WSHDR *ws2, size_t n)
Compare two WSHDR strings, up to a specific length.
void wstrcatprintf(WSHDR *s, const char *format,...)
Append formatted output to the end of WSHDR.
short wstrchr(WSHDR *str, uint32_t start, uint32_t character)
Locate first occurrence of character in WSHDR.
WSHDR * CreateLocalWS(WSHDR *header, uint16_t *body, int size)
Initialize new empty WSHDR with static allocation.
void wstrreplace(WSHDR *dest, const WSHDR *src, uint32_t pos)
Replace substring in dest with src starting from position pos.
uint16_t wstrlen(const WSHDR *str)
Get WSHDR length.
void CutWSTR(WSHDR *str, int length)
Truncate string.
int str_2ws(WSHDR *destination, const char *source, uint32_t size)
Convert CP1252 (Latin) C-string to WSHDR.
int wstrcmp(const WSHDR *str1, const WSHDR *str2)
Compare two WSHDR strings.
void wstrcpybypos(WSHDR *destination, WSHDR *source, int from, int num)
Copy characters from WSHDR.
void wstrtolower(WSHDR *ws)
Convert WSHDR string to lowercase in-place.
void FreeWS(WSHDR *str)
Free WSHDR.
void wstrcapitalize(WSHDR *ws)
Convert WSHDR string to capitalized form in-place (first character uppercase, rest lowercase)
uint16_t wstriwstr(const WSHDR *ws, const WSHDR *search, uint32_t start_pos)
Find the first occurrence of a substring in a WSHDR string, ignoring case, starting from given positi...
int wsprintf(WSHDR *s, const char *format,...)
Write formatted output to WSHDR.
WSHDR * wstrcat(WSHDR *destination, WSHDR *source)
Concatenate two WSHDR.
int wstrnicmp(const WSHDR *ws1, const WSHDR *ws2, size_t n)
Compare two WSHDR strings without case sensitivity, up to a specific length.
void ws_2str(const WSHDR *source, char *destination, uint32_t size)
Convert WSHDR to the UTF-8 C-string with special mark.
int GetUnicodeSymbolByDynIcon(int dyn_icon)
Get character by dynamic icon id.
WSHDR * wstrncpy(WSHDR *destination, WSHDR *source, int num)
Copy characters from WSHDR.
void wsAppendChar(WSHDR *destination, int character)
Append a character to the end of WSHDR.
uint16_t wsCharAt(const WSHDR *str, short pos)
Get charater at the given position (safe).
WSHDR * AllocWS(int size)
Create new empty WSHDR.
void wsRemoveChars(WSHDR *destination, int position, int length)
Remove characters from the WSHDR.
int ws_2utf8(const WSHDR *source, char *destination, int *new_length, uint32_t size)
Convert WSHDR to the UTF-8 C-string.
WSHDR * wstrcpy(WSHDR *destination, WSHDR *source)
Copy WSHDR.
int wsInsertChar(WSHDR *destination, int character, int position)
Insert a character at the given position of the WSHDR.
void wstrtoupper(WSHDR *ws)
Convert WSHDR string to uppercase in-place.
int wstricmp(const WSHDR *ws1, const WSHDR *ws2)
Compare two WSHDR strings without case sensitivity.
short wstrrchr(WSHDR *str, uint32_t rstart, uint32_t character)
Locate last occurrence of character in WSHDR.
WSHDR * CreateWS(malloc_func_t malloc_func, mfree_func_t mfree_func, int size)
Create new empty WSHDR with custom allocator.
WSHDR * wstrncat(WSHDR *destination, WSHDR *source, int num)
Concatenate two WSHDR.
uint16_t * wstrcopy(uint16_t *destination, const uint16_t *source)
Copy WSHDR body.