|
|
1.1 root 1: /***
2: *wchar.h - declarations for wide character functions
3: *
4: * Copyright (c) 1992, Microsoft Corporation. All rights reserved.
5: *
6: *Purpose:
7: * This file contains the types, macros and function declarations for
8: * all wide character-related functions. They may also be declared in
9: * individual header files on a functional basis.
10: * [ISO]
11: *
12: * Note: keep in sync with ctype.h, stdio.h, stdlib.h, string.h, time.h.
13: *
14: ****/
15:
16: #ifndef _INC_WCHAR
17: #define _INC_WCHAR
18:
19: #ifdef __cplusplus
20: extern "C" {
21: #endif
22:
23:
24: #ifndef MIPS
25: #if (_MSC_VER <= 600)
26: #define __cdecl _cdecl
27: #endif
28: #endif
29:
30: #ifndef _SIZE_T_DEFINED
31: typedef unsigned int size_t;
32: #define _SIZE_T_DEFINED
33: #endif
34:
35:
36: #ifndef _WCHAR_T_DEFINED
37: typedef unsigned short wchar_t;
38: #define _WCHAR_T_DEFINED
39: #endif
40:
41: #ifndef _WCTYPE_T_DEFINED
42: typedef wchar_t wint_t;
43: typedef wchar_t wctype_t;
44: #define _WCTYPE_T_DEFINED
45: #endif
46:
47: #ifndef _VA_LIST_DEFINED
48: typedef char * va_list;
49: #define _VA_LIST_DEFINED
50: #endif
51:
52: #ifndef WEOF
53: #define WEOF (wint_t)(0xFFFF)
54: #endif
55:
56: #ifndef _FILE_DEFINED
57: struct _iobuf {
58: char *_ptr;
59: int _cnt;
60: char *_base;
61: int _flag;
62: int _file;
63: int _charbuf;
64: int _bufsiz;
65: char *_tmpfname;
66: };
67: typedef struct _iobuf FILE;
68: #define _FILE_DEFINED
69: #endif
70:
71: /* UNDONE: define struct tm */
72:
73: /* define NULL pointer value */
74:
75: #ifndef NULL
76: #ifdef __cplusplus
77: #define NULL 0
78: #else
79: #define NULL ((void *)0)
80: #endif
81: #endif
82:
83: /* function prototypes */
84:
85: #ifndef _WCTYPE_DEFINED
86:
87: /*
88: * This declaration allows the user access to the ctype look-up
89: * array _ctype defined in ctype.obj by simply including ctype.h
90: */
91:
92: #ifndef _NEWCTYPETABLE
93:
94: #ifdef _DLL
95: extern unsigned char * _ctype;
96: #else
97: extern unsigned char _ctype[];
98: #endif
99:
100: extern unsigned char *_pctype;
101: extern unsigned char *_pwctype;
102:
103: #else
104:
105: #ifdef _DLL
106: extern unsigned short * _ctype;
107: #else
108: extern unsigned short _ctype[];
109: #endif
110:
111: extern unsigned short *_pctype;
112: extern wctype_t *_pwctype;
113:
114: #endif
115:
116:
117: /* set bit masks for the possible character types */
118:
119: #define _UPPER 0x1 /* upper case letter */
120: #define _LOWER 0x2 /* lower case letter */
121: #define _DIGIT 0x4 /* digit[0-9] */
122: #define _SPACE 0x8 /* tab, carriage return, newline, */
123: /* vertical tab or form feed */
124: #define _PUNCT 0x10 /* punctuation character */
125: #define _CONTROL 0x20 /* control character */
126: #define _BLANK 0x40 /* space char */
127: #define _HEX 0x80 /* hexadecimal digit */
128:
129:
130:
131: /* character classification function prototypes */
132:
133: int iswalpha(wint_t);
134: int iswupper(wint_t);
135: int iswlower(wint_t);
136: int iswdigit(wint_t);
137: int iswxdigit(wint_t);
138: int iswspace(wint_t);
139: int iswpunct(wint_t);
140: int iswalnum(wint_t);
141: int iswprint(wint_t);
142: int iswgraph(wint_t);
143: int iswcntrl(wint_t);
144: int iswascii(wint_t);
145:
146: wchar_t towupper(wchar_t);
147: wchar_t towlower(wchar_t);
148:
149: /* UNDONE: add wctype_t set_wctype(const char* property); */
150: int is_wctype(wint_t, wctype_t);
151:
152: #define isleadbyte(_c) (0)
153: /* #define is_wctype(_c,_t) ((_c) < 256 ? _pwctype[_c] & _t : 0 ) */
154:
155: #define _WCTYPE_DEFINED
156: #endif
157:
158: #define iswalpha(_c) ((_c) < 256 ? _pwctype[_c] &_ALPHA:is_wctype(_c,_ALPHA))
159: #define iswupper(_c) ((_c) < 256 ? _pwctype[_c] &_UPPER:is_wctype(_c,_UPPER))
160: #define iswlower(_c) ((_c) < 256 ? _pwctype[_c] &_LOWER:is_wctype(_c,_LOWER))
161: #define iswdigit(_c) ((_c) < 256 ? _pwctype[_c] &_DIGIT:is_wctype(_c,_DIGIT))
162: #define iswxdigit(_c) ((_c) < 256 ? _pwctype[_c] &_HEX:is_wctype(_c,_HEX))
163: #define iswspace(_c) ((_c) < 256 ? _pwctype[_c] &_SPACE:is_wctype(_c,_SPACE))
164: #define iswpunct(_c) ((_c) < 256 ? _pwctype[_c] &_PUNCT:is_wctype(_c,_PUNCT))
165: #define iswalnum(_c) ((_c) < 256 ? _pwctype[_c] &(_ALPHA|_DIGIT):is_wctype(_c,_ALPHA|_DIGIT))
166: #define iswprint(_c) ((_c) < 256 ? _pwctype[_c] &(_BLANK|_PUNCT|_ALPHA|_DIGIT):is_wctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
167: #define iswgraph(_c) ((_c) < 256 ? _pwctype[_c] &(_PUNCT|_ALPHA|_DIGIT):is_wctype(_c,_PUNCT|_ALPHA|_DIGIT))
168: #define iswcntrl(_c) ((_c) < 256 ? _pwctype[_c] &_CONTROL:is_wctype(_c,_CONTROL))
169: #define iswascii(_c) ( (unsigned)(_c) < 0x80 )
170:
171:
172:
173: #ifndef _WSTDIO_DEFINED
174: int fwprintf(FILE *, const wchar_t *, ...);
175: int wprintf(const wchar_t *, ...);
176: int _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
177: int swprintf(wchar_t *, const wchar_t *, ...);
178: int vfwprintf(FILE *, const wchar_t *, va_list);
179: int vwprintf(const wchar_t *, va_list);
180: int _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
181: int vswprintf(wchar_t *, const wchar_t *, va_list);
182: /* UNDONE: add wscanf, swscanf, fwscanf */
183: #define _WSTDIO_DEFINED
184: #endif
185:
186:
187: #ifndef _WSTDLIB_DEFINED
188: /* UNDONE: add wcstod, etc. */
189: /* #define _WSTDLIB_DEFINED */
190: #endif
191:
192:
193: #ifndef _WSTRING_DEFINED
194: wchar_t * wcscat(wchar_t *, const wchar_t *);
195: wchar_t * wcschr(const wchar_t *, wchar_t);
196: int wcscmp(const wchar_t *, const wchar_t *);
197: wchar_t * wcscpy(wchar_t *, const wchar_t *);
198: size_t wcscspn(const wchar_t *, const wchar_t *);
199: size_t wcslen(const wchar_t *);
200: wchar_t * wcsncat(wchar_t *, const wchar_t *, size_t);
201: int wcsncmp(const wchar_t *, const wchar_t *, size_t);
202: wchar_t * wcsncpy(wchar_t *, const wchar_t *, size_t);
203: wchar_t * wcspbrk(const wchar_t *, const wchar_t *);
204: wchar_t * wcsrchr(const wchar_t *, wchar_t);
205: size_t wcsspn(const wchar_t *, const wchar_t *);
206: wchar_t * wcsstr(const wchar_t *, const wchar_t *);
207:
208: wchar_t * _wcsdup(const wchar_t *);
209: int _wcsicmp(const wchar_t *, const wchar_t *);
210: int _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
211: wchar_t * _wcsnset(wchar_t *, wchar_t, size_t);
212: wchar_t * _wcsrev(wchar_t *);
213: wchar_t * _wcsset(wchar_t *, wchar_t);
214:
215: wchar_t * _wcslwr(wchar_t *);
216: wchar_t * _wcsupr(wchar_t *);
217: size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
218: int wcscoll(const wchar_t *, const wchar_t *);
219: int _wcsicoll(const wchar_t *, const wchar_t *);
220:
221: /* old names */
222: #define wcswcs wcsstr
223:
224: #if !__STDC__
225: /* Non-ANSI names for compatibility */
226: #define wcsdup _wcsdup
227: #define wcsicmp _wcsicmp
228: #define wcsnicmp _wcsnicmp
229: #define wcsnset _wcsnset
230: #define wcsrev _wcsrev
231: #define wcsset _wcsset
232: #define wcslwr _wcslwr
233: #define wcsupr _wcsupr
234: #define wcsicoll _wcsicoll
235: #endif
236:
237: #define _WSTRING_DEFINED
238: #endif
239:
240:
241: #ifndef _WTIME_DEFINED
242: /* UNDONE: add wcsftime, etc. */
243: /* #define _WTIME_DEFINED */
244: #endif
245:
246:
247: #ifdef __cplusplus
248: }
249: #endif
250:
251: #endif /* _INC_WCHAR */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.