ft2_unicode.h (1518B)
1 #pragma once 2 3 #include <stdbool.h> 4 5 #ifdef _WIN32 6 #include <wchar.h> 7 #endif 8 9 // unicode stuff for different platforms 10 11 #ifdef _WIN32 12 13 // Windows 14 typedef wchar_t UNICHAR; 15 #define UNICHAR_STRCPY(a, b) wcscpy(a, b) 16 #define UNICHAR_STRNCPY(a, b, c) wcsncpy(a, b, c) 17 #define UNICHAR_STRCMP(a, b) wcscmp(a, b) 18 #define UNICHAR_STRNCMP(a, b, c) wcsncmp(a, b, c) 19 #define UNICHAR_STRCAT(a, b) wcscat(a, b) 20 #define UNICHAR_STRDUP(a) _wcsdup(a) 21 #define UNICHAR_FOPEN(a, b) _wfopen(a, L ## b) 22 #define UNICHAR_CHDIR(a) _wchdir(a) 23 #define UNICHAR_GETCWD(a, b) _wgetcwd(a, b) 24 #define UNICHAR_RENAME(a, b) _wrename(a, b) 25 #define UNICHAR_REMOVE(a) _wremove(a) 26 #define UNICHAR_STRLEN(a) wcslen(a) 27 #else 28 29 // other OSes 30 typedef char UNICHAR; 31 #define UNICHAR_STRCPY(a, b) strcpy(a, b) 32 #define UNICHAR_STRNCPY(a, b, c) strncpy(a, b, c) 33 #define UNICHAR_STRCMP(a, b) strcmp(a, b) 34 #define UNICHAR_STRNCMP(a, b, c) strncmp(a, b, c) 35 #define UNICHAR_STRCAT(a, b) strcat(a, b) 36 #define UNICHAR_STRDUP(a) strdup(a) 37 #define UNICHAR_FOPEN(a, b) fopen(a, b) 38 #define UNICHAR_CHDIR(a) chdir(a) 39 #define UNICHAR_GETCWD(a, b) getcwd(a, b) 40 #define UNICHAR_RENAME(a, b) rename(a, b) 41 #define UNICHAR_REMOVE(a) remove(a) 42 #define UNICHAR_STRLEN(a) strlen(a) 43 #endif 44 45 char *cp850ToUtf8(char *src); 46 char *utf8ToCp850(char *src, bool removeIllegalChars); 47 #ifdef _WIN32 48 UNICHAR *cp850ToUnichar(char *src); 49 char *unicharToCp850(UNICHAR *src, bool removeIllegalChars); 50 #else 51 #define cp850ToUnichar(a) cp850ToUtf8(a) 52 #define unicharToCp850(a, b) utf8ToCp850(a, b) 53 #endif