7 #define UTF8_BYTEMASK 0xBF
8 #define UTF8_BYTEMARK 0x80
10 #define UTF16_MAX_BMP (UTF_32)0x0000FFFF
11 #define UTF16_SUR_HIGH_START (UTF_32)0xD800
12 #define UTF16_SUR_HIGH_END (UTF_32)0xDBFF
13 #define UTF16_SUR_LOW_START (UTF_32)0xDC00
14 #define UTF16_SUR_LOW_END (UTF_32)0xDFFF
15 #define UTF16_HALFSHIFT 10
16 #define UTF16_HALFBASE (UTF_32)0x0010000UL
17 #define UTF16_HALFMASK (UTF_32)0x3FFUL
21 # define FB_WCHAR char
24 # define wcslen(s) strlen(s)
25 # define iswlower(c) islower(c)
26 # define iswupper(c) isupper(c)
27 # define towlower(c) tolower(c)
28 # define towupper(c) toupper(c)
29 # define wmemcmp(a,b,c) memcmp(a,b,c)
30 # define wmemchr(a,b,c) memchr(a,b,c)
31 # define mbstowcs __dos_mbstowcs
32 # define wcstombs __dos_wcstombs
33 # define wcsstr(str, strSearch) strstr(str, strSearch)
34 # define wcsncmp(str1, str2, count) strncmp(str1, str2, count)
35 # define wcstod strtod
36 # define wcstol strtol
37 # define wcstoll strtoll
38 # define wcstoul strtoul
39 # define wcstoull strtoull
40 # define wcschr strchr
41 # define wcscspn strcspn
42 # define FB_WSTR_WCHARTOCHAR fb_wstr_WcharToChar
43 static __inline__
size_t __dos_mbstowcs(
FB_WCHAR *wcstr,
const char *mbstr,
size_t count)
45 return memcpy(wcstr,mbstr,count), count;
47 static __inline__
size_t __dos_wcstombs(
char *mbstr,
const FB_WCHAR *wcstr,
size_t count)
49 return memcpy(mbstr,wcstr,count), count;
53 memcpy(dst,src,chars);
60 result = vsprintf( buffer, format, ap );
64 #elif defined HOST_MINGW || defined HOST_CYGWIN
67 # define FB_WCHAR wchar_t
68 # define _LC(c) L ## c
69 # if defined HOST_MINGW
71 # define swprintf _snwprintf
72 # define FB_WSTR_FROM_INT( buffer, num ) _itow( num, buffer, 10 )
73 # define FB_WSTR_FROM_UINT( buffer, num ) _ultow( (unsigned int) num, buffer, 10 )
74 # define FB_WSTR_FROM_UINT_OCT( buffer, num ) _itow( num, buffer, 8 )
75 # define FB_WSTR_FROM_INT64( buffer, num ) _i64tow( num, buffer, 10 )
76 # define FB_WSTR_FROM_UINT64( buffer, num ) _ui64tow( num, buffer, 10 )
77 # define FB_WSTR_FROM_UINT64_OCT( buffer, num ) _ui64tow( num, buffer, 8 )
79 # define FB_WEOF ((FB_WCHAR)-1)
81 # define FB_WSTR_WCHARTOCHAR fb_wstr_WcharToChar
95 # define __USE_ISOC99 1
96 # define __USE_ISOC95 1
99 # define FB_WCHAR wchar_t
100 # define _LC(c) L ## c
101 # define FB_WEOF WEOF
104 #ifndef FB_WSTR_FROM_INT
105 #define FB_WSTR_FROM_INT( buffer, num ) \
106 swprintf( buffer, sizeof( int ) * 3 + 1, _LC("%d"), (int) (num) )
109 #ifndef FB_WSTR_FROM_UINT
110 #define FB_WSTR_FROM_UINT( buffer, num ) \
111 swprintf( buffer, sizeof( unsigned int ) * 3 + 1, _LC("%u"), (unsigned) (num) )
114 #ifndef FB_WSTR_FROM_UINT_OCT
115 #define FB_WSTR_FROM_UINT_OCT( buffer, num ) \
116 swprintf( buffer, sizeof( int ) * 4 + 1, _LC("%o"), (unsigned) (num) )
119 #ifndef FB_WSTR_FROM_INT64
120 #define FB_WSTR_FROM_INT64( buffer, num ) \
121 swprintf( buffer, sizeof( long long ) * 3 + 1, _LC("%lld"), (long long) (num) )
124 #ifndef FB_WSTR_FROM_UINT64
125 #define FB_WSTR_FROM_UINT64( buffer, num ) \
126 swprintf( buffer, sizeof( unsigned long long ) * 3 + 1, _LC("%llu"), (unsigned long long) (num) )
129 #ifndef FB_WSTR_FROM_UINT64_OCT
130 #define FB_WSTR_FROM_UINT64_OCT( buffer, num ) \
131 swprintf( buffer, sizeof( long long ) * 4 + 1, _LC("%llo"), (unsigned long long) (num) )
134 #ifndef FB_WSTR_FROM_FLOAT
135 #define FB_WSTR_FROM_FLOAT( buffer, num ) \
136 swprintf( buffer, 7+8 + 1, _LC("%.7g"), (double) (num) )
139 #ifndef FB_WSTR_FROM_DOUBLE
140 #define FB_WSTR_FROM_DOUBLE( buffer, num ) \
141 swprintf( buffer, 16+8 + 1, _LC("%.16g"), (double) (num) )
144 #ifndef FB_WSTR_WCHARTOCHAR
145 #define FB_WSTR_WCHARTOCHAR fb_wstr_WcharToChar
161 return ((intptr_t)end - (intptr_t)ini) /
sizeof(
FB_WCHAR );
191 chars = mbstowcs( dst, src, dst_chars + 1 );
199 else if( chars == (dst_chars + 1) )
200 dst[dst_chars] =
_LC(
'\0');
211 bytes = wcstombs( dst, src, chars + 1 );
218 else if( bytes == chars + 1 )
219 dst[src_chars] =
'\0';
231 return iswlower( c );
236 return iswupper( c );
241 return towlower( c );
246 return towupper( c );
252 if( (src !=
NULL) && (chars > 0) )
268 for( i = 0; i < chars; i++ )
295 if( (s ==
NULL) || (chars <= 0) )
313 return wcsstr( s, patt );
318 return wcscspn( s, sset );
323 return wcsncmp( str1, str2, chars );