ekg2  GIT master
strings.h
Idź do dokumentacji tego pliku.
1 /* $Id: strings.h 4412 2008-08-17 12:28:15Z peres $ */
2 
3 #ifndef __EKG_STRINGS_H
4 #define __EKG_STRINGS_H
5 
6 /*
7  * (C) Copyright 2003-2006 Maciej Pietrzak <maciej@hell.org.pl>
8  * Jakub Zawadzki <darkjames@darkjames.ath.cx>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License Version 2 as
12  * published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23 
24 #include "ekg2-config.h"
25 
26 
27 #if USE_UNICODE
28 
29 #include <wchar.h> /* wchar_t stuff */
30 
31 extern int config_use_unicode; /* not everyone want to include stuff.h */
32 
33 #define CHAR_T wchar_t
34 #define TEXT(x) (wchar_t *) L##x
35 #define CHAR(x) (wchar_t) L##x
36 #define STRING_FORMAT "%ls"
37 #define CHAR_FORMAT "%lc"
38 
39 extern size_t xwcslen(const CHAR_T *str);
40 extern size_t xmbslen(const char *str);
41 extern CHAR_T *xwcscpy(CHAR_T *dst, CHAR_T *src);
42 extern CHAR_T *xwcsdup(CHAR_T *str);
43 extern CHAR_T *xwcscat(CHAR_T *dst, const CHAR_T *src);
44 extern int xwcscmp(const CHAR_T *s1, const CHAR_T *s2);
45 extern CHAR_T *xwcschr(const CHAR_T *s, CHAR_T c);
46 extern char *wcs_to_normal(const CHAR_T *str);
47 extern CHAR_T *normal_to_wcs(const char *str);
48 extern CHAR_T **wcs_array_make(const CHAR_T *string, const CHAR_T *sep, int max, int trim, int quotes);
49 extern CHAR_T *wcs_array_join(CHAR_T **array, const CHAR_T *sep);
50 extern size_t xwcslcpy(CHAR_T *dst, const CHAR_T *src, size_t size);
51 
52 #define free_utf(x) xfree(x)
53 
54 #else /* USE_UNICODE */
55 
56 #include "xmalloc.h"
57 
58 #define CHAR_T unsigned char
59 #define TEXT(x) x
60 #define CHAR(x) x
61 #define STRING_FORMAT "%s"
62 #define CHAR_FORMAT "%c"
63 
64 #define xwcslen(str) xstrlen((char *) str)
65 #define xmbslen(str) xstrlen(str)
66 #define xwcscpy(dst, str) xstrcpy((char *) dst, (char *) str)
67 #define xwcsdup(str) (CHAR_T *) xstrdup((char *) str)
68 #define xwcscat(dst, src) xstrcat((char *) dst, (char *) src)
69 #define xwcscmp(s1, s2) xstrcmp((char *) s1, (char *) s2)
70 #define xwcschr(s, c) xstrchr((char *) s, c)
71 #define wcs_to_normal(x) (char *) x
72 #define wcs_array_make(str, sep, max, trim, quotes) (CHAR_T **) array_make((char *) str, sep, max, trim, quotes)
73 #define wcs_array_join(arr, sep) (CHAR_T *) array_join((char **) arr, sep)
74 #define xwcslcpy(dst, src, size) strlcpy((char *) dst, (char *) src, size)
75 #define free_utf(x)
76 
77 #endif /* USE_UNICODE */
78 
79 
80 #endif /* __EKG_STRINGS_H */
#define wcs_array_join(arr, sep)
Definition: strings.h:73
#define wcs_to_normal(x)
Definition: strings.h:71
wchar_t * normal_to_wcs(const char *str)
Definition: nc-strings.c:80
#define xwcscpy(dst, str)
Definition: strings.h:66
#define CHAR_T
Definition: strings.h:58
#define xwcsdup(str)
Definition: strings.h:67
#define xmbslen(str)
Definition: strings.h:65
#define xwcscat(dst, src)
Definition: strings.h:68
#define xwcschr(s, c)
Definition: strings.h:70
#define xwcslen(str)
Definition: strings.h:64
#define xwcslcpy(dst, src, size)
Definition: strings.h:74
int config_use_unicode
#define wcs_array_make(str, sep, max, trim, quotes)
Definition: strings.h:72
#define s
#define xwcscmp(s1, s2)
Definition: strings.h:69