Idź do dokumentacji tego pliku.00001
00002
00003 #ifndef __EKG_STRINGS_H
00004 #define __EKG_STRINGS_H
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "ekg2-config.h"
00025
00026
00027 #if USE_UNICODE
00028
00029 #include <wchar.h>
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 extern int config_use_unicode;
00036
00037 #define CHAR_T wchar_t
00038 #define TEXT(x) (wchar_t *) L##x
00039 #define CHAR(x) (wchar_t) L##x
00040 #define STRING_FORMAT "%ls"
00041 #define CHAR_FORMAT "%lc"
00042
00043 extern size_t xwcslen(const CHAR_T *str);
00044 extern size_t xmbslen(const char *str);
00045 extern CHAR_T *xwcscpy(CHAR_T *dst, CHAR_T *src);
00046 extern CHAR_T *xwcsdup(CHAR_T *str);
00047 extern CHAR_T *xwcscat(CHAR_T *dst, const CHAR_T *src);
00048 extern int xwcscmp(const CHAR_T *s1, const CHAR_T *s2);
00049 extern CHAR_T *xwcschr(const CHAR_T *s, CHAR_T c);
00050 extern char *wcs_to_normal(const CHAR_T *str);
00051 extern CHAR_T *normal_to_wcs(const char *str);
00052 extern CHAR_T **wcs_array_make(const CHAR_T *string, const CHAR_T *sep, int max, int trim, int quotes);
00053 extern CHAR_T *wcs_array_join(CHAR_T **array, const CHAR_T *sep);
00054 extern size_t xwcslcpy(CHAR_T *dst, const CHAR_T *src, size_t size);
00055
00056 #define free_utf(x) xfree(x)
00057
00058 #else
00059
00060 #include <ekg/xmalloc.h>
00061
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065
00066 #define CHAR_T unsigned char
00067 #define TEXT(x) x
00068 #define CHAR(x) x
00069 #define STRING_FORMAT "%s"
00070 #define CHAR_FORMAT "%c"
00071
00072 #define xwcslen(str) xstrlen((char *) str)
00073 #define xmbslen(str) xstrlen(str)
00074 #define xwcscpy(dst, str) xstrcpy((char *) dst, (char *) str)
00075 #define xwcsdup(str) (CHAR_T *) xstrdup((char *) str)
00076 #define xwcscat(dst, src) xstrcat((char *) dst, (char *) src)
00077 #define xwcscmp(s1, s2) xstrcmp((char *) s1, (char *) s2)
00078 #define xwcschr(s, c) xstrchr((char *) s, c)
00079 #define wcs_to_normal(x) (char *) x
00080 #define wcs_array_make(str, sep, max, trim, quotes) (CHAR_T **) array_make((char *) str, sep, max, trim, quotes)
00081 #define wcs_array_join(arr, sep) (CHAR_T *) array_join((char **) arr, sep)
00082 #define xwcslcpy(dst, src, size) strlcpy((char *) dst, (char *) src, size)
00083 #define free_utf(x)
00084
00085 #endif
00086
00087 #ifdef __cplusplus
00088 }
00089 #endif
00090
00091 #endif