source: main/trunk/greenstone2/build-src/packages/isis-gdl/tchar.h@ 26670

Last change on this file since 26670 was 6127, checked in by mdewsnip, 20 years ago

IsisGdl package for reading CDS/ISIS databases. Provided by Jean-Claude Dauphin at UNESCO, and modified slightly to compile and run under Linux.

  • Property svn:keywords set to Author Date Id Revision
File size: 28.3 KB
Line 
1/**********************************************************************
2 *
3 * tchar.h
4 * Copyright (C) 2003 UNESCO
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26/***
27*tchar.h - definitions for generic international text functions
28*
29* Copyright (c) 1991-1997, Microsoft Corporation. All rights reserved.
30*
31*Purpose:
32* Definitions for generic international functions, mostly defines
33* which map string/formatted-io/ctype functions to char, wchar_t, or
34* MBCS versions. To be used for compatibility between single-byte,
35* multi-byte and Unicode text models.
36*
37* [Public]
38*
39****/
40
41#if _MSC_VER > 1000 /*IFSTRIP=IGN*/
42#pragma once
43#endif
44
45#ifndef _INC_TCHAR
46#define _INC_TCHAR
47
48#ifdef _MSC_VER
49#pragma warning(disable:4514) /* disable unwanted C++ /W4 warning */
50/* #pragma warning(default:4514) */ /* use this to reenable, if necessary */
51#endif /* _MSC_VER */
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57
58/* Define __cdecl for non-Microsoft compilers */
59
60#if ( !defined(_MSC_VER) && !defined(__cdecl) )
61#define __cdecl
62#endif
63
64
65/* Define _CRTIMP */
66
67#ifndef _CRTIMP
68#ifdef CRTDLL
69#define _CRTIMP __declspec(dllexport)
70#else /* ndef CRTDLL */
71#ifdef _DLL
72#define _CRTIMP __declspec(dllimport)
73#else /* ndef _DLL */
74#define _CRTIMP
75#endif /* _DLL */
76#endif /* CRTDLL */
77#endif /* _CRTIMP */
78
79
80#define _ftcscat _tcscat
81#define _ftcschr _tcschr
82#define _ftcscpy _tcscpy
83#define _ftcscspn _tcscspn
84#define _ftcslen _tcslen
85#define _ftcsncat _tcsncat
86#define _ftcsncpy _tcsncpy
87#define _ftcspbrk _tcspbrk
88#define _ftcsrchr _tcsrchr
89#define _ftcsspn _tcsspn
90#define _ftcsstr _tcsstr
91#define _ftcstok _tcstok
92
93#define _ftcsdup _tcsdup
94#define _ftcsnset _tcsnset
95#define _ftcsrev _tcsrev
96#define _ftcsset _tcsset
97
98#define _ftcscmp _tcscmp
99#define _ftcsicmp _tcsicmp
100#define _ftcsnccmp _tcsnccmp
101#define _ftcsncmp _tcsncmp
102#define _ftcsncicmp _tcsncicmp
103#define _ftcsnicmp _tcsnicmp
104
105#define _ftcscoll _tcscoll
106#define _ftcsicoll _tcsicoll
107#define _ftcsnccoll _tcsnccoll
108#define _ftcsncoll _tcsncoll
109#define _ftcsncicoll _tcsncicoll
110#define _ftcsnicoll _tcsnicoll
111
112/* Redundant "logical-character" mappings */
113
114#define _ftcsclen _tcsclen
115#define _ftcsnccat _tcsnccat
116#define _ftcsnccpy _tcsnccpy
117#define _ftcsncset _tcsncset
118
119#define _ftcsdec _tcsdec
120#define _ftcsinc _tcsinc
121#define _ftcsnbcnt _tcsnbcnt
122#define _ftcsnccnt _tcsnccnt
123#define _ftcsnextc _tcsnextc
124#define _ftcsninc _tcsninc
125#define _ftcsspnp _tcsspnp
126
127#define _ftcslwr _tcslwr
128#define _ftcsupr _tcsupr
129
130#define _ftclen _tclen
131#define _ftccpy _tccpy
132#define _ftccmp _tccmp
133
134
135#ifdef _UNICODE
136
137#ifdef __cplusplus
138} /* ... extern "C" */
139#endif
140
141/* ++++++++++++++++++++ UNICODE ++++++++++++++++++++ */
142
143#include <wchar.h>
144
145#ifdef __cplusplus
146extern "C" {
147#endif
148
149#ifndef _WCTYPE_T_DEFINED
150typedef wchar_t wint_t;
151typedef wchar_t wctype_t;
152#define _WCTYPE_T_DEFINED
153#endif
154
155#ifndef __TCHAR_DEFINED
156typedef wchar_t _TCHAR;
157typedef wchar_t _TSCHAR;
158typedef wchar_t _TUCHAR;
159typedef wchar_t _TXCHAR;
160typedef wint_t _TINT;
161#define __TCHAR_DEFINED
162#endif
163
164#ifndef _TCHAR_DEFINED
165#if !__STDC__
166typedef wchar_t TCHAR;
167#endif
168#define _TCHAR_DEFINED
169#endif
170
171#define _TEOF WEOF
172
173#define __T(x) L ## x
174
175
176/* Program */
177
178#define _tmain wmain
179#define _tWinMain wWinMain
180#define _tenviron _wenviron
181#define __targv __wargv
182
183/* Formatted i/o */
184
185#define _tprintf wprintf
186#define _ftprintf fwprintf
187#define _stprintf swprintf
188#define _sntprintf _snwprintf
189#define _vtprintf vwprintf
190#define _vftprintf vfwprintf
191#define _vstprintf vswprintf
192#define _vsntprintf _vsnwprintf
193#define _tscanf wscanf
194#define _ftscanf fwscanf
195#define _stscanf swscanf
196
197
198/* Unformatted i/o */
199
200#define _fgettc fgetwc
201#define _fgettchar _fgetwchar
202#define _fgetts fgetws
203#define _fputtc fputwc
204#define _fputtchar _fputwchar
205#define _fputts fputws
206#define _gettc getwc
207#define _gettchar getwchar
208#define _getts _getws
209#define _puttc putwc
210#define _puttchar putwchar
211#define _putts _putws
212#define _ungettc ungetwc
213
214
215/* String conversion functions */
216
217#define _tcstod wcstod
218#define _tcstol wcstol
219#define _tcstoul wcstoul
220
221#define _itot _itow
222#define _ltot _ltow
223#define _ultot _ultow
224#define _ttoi _wtoi
225#define _ttol _wtol
226
227#define _ttoi64 _wtoi64
228#define _i64tot _i64tow
229#define _ui64tot _ui64tow
230
231/* String functions */
232
233#define _tcscat wcscat
234#define _tcschr wcschr
235#define _tcscpy wcscpy
236#define _tcscspn wcscspn
237#define _tcslen wcslen
238#define _tcsncat wcsncat
239#define _tcsncpy wcsncpy
240#define _tcspbrk wcspbrk
241#define _tcsrchr wcsrchr
242#define _tcsspn wcsspn
243#define _tcsstr wcsstr
244#define _tcstok wcstok
245
246#define _tcsdup _wcsdup
247#define _tcsnset _wcsnset
248#define _tcsrev _wcsrev
249#define _tcsset _wcsset
250
251#define _tcscmp wcscmp
252#define _tcsicmp _wcsicmp
253#define _tcsnccmp wcsncmp
254#define _tcsncmp wcsncmp
255#define _tcsncicmp _wcsnicmp
256#define _tcsnicmp _wcsnicmp
257
258#define _tcscoll wcscoll
259#define _tcsicoll _wcsicoll
260#define _tcsnccoll _wcsncoll
261#define _tcsncoll _wcsncoll
262#define _tcsncicoll _wcsnicoll
263#define _tcsnicoll _wcsnicoll
264
265
266/* Execute functions */
267
268#define _texecl _wexecl
269#define _texecle _wexecle
270#define _texeclp _wexeclp
271#define _texeclpe _wexeclpe
272#define _texecv _wexecv
273#define _texecve _wexecve
274#define _texecvp _wexecvp
275#define _texecvpe _wexecvpe
276
277#define _tspawnl _wspawnl
278#define _tspawnle _wspawnle
279#define _tspawnlp _wspawnlp
280#define _tspawnlpe _wspawnlpe
281#define _tspawnv _wspawnv
282#define _tspawnve _wspawnve
283#define _tspawnvp _wspawnvp
284#define _tspawnvp _wspawnvp
285#define _tspawnvpe _wspawnvpe
286
287#define _tsystem _wsystem
288
289
290/* Time functions */
291
292#define _tasctime _wasctime
293#define _tctime _wctime
294#define _tstrdate _wstrdate
295#define _tstrtime _wstrtime
296#define _tutime _wutime
297#define _tcsftime wcsftime
298
299
300/* Directory functions */
301
302#define _tchdir _wchdir
303#define _tgetcwd _wgetcwd
304#define _tgetdcwd _wgetdcwd
305#define _tmkdir _wmkdir
306#define _trmdir _wrmdir
307
308
309/* Environment/Path functions */
310
311#define _tfullpath _wfullpath
312#define _tgetenv _wgetenv
313#define _tmakepath _wmakepath
314#define _tputenv _wputenv
315#define _tsearchenv _wsearchenv
316#define _tsplitpath _wsplitpath
317
318
319/* Stdio functions */
320
321#define _tfdopen _wfdopen
322#define _tfsopen _wfsopen
323#define _tfopen _wfopen
324#define _tfreopen _wfreopen
325#define _tperror _wperror
326#define _tpopen _wpopen
327#define _ttempnam _wtempnam
328#define _ttmpnam _wtmpnam
329
330
331/* Io functions */
332
333#define _taccess _waccess
334#define _tchmod _wchmod
335#define _tcreat _wcreat
336#define _tfindfirst _wfindfirst
337#define _tfindfirsti64 _wfindfirsti64
338#define _tfindnext _wfindnext
339#define _tfindnexti64 _wfindnexti64
340#define _tmktemp _wmktemp
341#define _topen _wopen
342#define _tremove _wremove
343#define _trename _wrename
344#define _tsopen _wsopen
345#define _tunlink _wunlink
346
347#define _tfinddata_t _wfinddata_t
348#define _tfinddatai64_t _wfinddatai64_t
349
350
351/* Stat functions */
352
353#define _tstat _wstat
354#define _tstati64 _wstati64
355
356
357/* Setlocale functions */
358
359#define _tsetlocale _wsetlocale
360
361
362/* Redundant "logical-character" mappings */
363
364#define _tcsclen wcslen
365#define _tcsnccat wcsncat
366#define _tcsnccpy wcsncpy
367#define _tcsncset _wcsnset
368
369#define _tcsdec _wcsdec
370#define _tcsinc _wcsinc
371#define _tcsnbcnt _wcsncnt
372#define _tcsnccnt _wcsncnt
373#define _tcsnextc _wcsnextc
374#define _tcsninc _wcsninc
375#define _tcsspnp _wcsspnp
376
377#define _tcslwr _wcslwr
378#define _tcsupr _wcsupr
379#define _tcsxfrm wcsxfrm
380
381
382#if (__STDC__ || defined(_NO_INLINING)) && !defined(_M_M68K)
383#define _tclen(_pc) (1)
384#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2)))
385#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2)))
386#else /* __STDC__ */
387__inline size_t __cdecl _tclen(const wchar_t *_cpc) { return (_cpc,1); }
388__inline void __cdecl _tccpy(wchar_t *_pc1, const wchar_t *_cpc2) { *_pc1 = (wchar_t)*_cpc2; }
389__inline int __cdecl _tccmp(const wchar_t *_cpc1, const wchar_t *_cpc2) { return (int) ((*_cpc1)-(*_cpc2)); }
390#endif /* __STDC__ */
391
392
393/* ctype functions */
394
395#define _istalnum iswalnum
396#define _istalpha iswalpha
397#define _istascii iswascii
398#define _istcntrl iswcntrl
399#define _istdigit iswdigit
400#define _istgraph iswgraph
401#define _istlower iswlower
402#define _istprint iswprint
403#define _istpunct iswpunct
404#define _istspace iswspace
405#define _istupper iswupper
406#define _istxdigit iswxdigit
407
408#define _totupper towupper
409#define _totlower towlower
410
411#define _istlegal(_c) (1)
412#define _istlead(_c) (0)
413#define _istleadbyte(_c) (0)
414
415
416#if (__STDC__ || defined(_NO_INLINING)) && !defined(_M_M68K)
417#define _wcsdec(_cpc1, _cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1)
418#define _wcsinc(_pc) ((_pc)+1)
419#define _wcsnextc(_cpc) ((unsigned int) *(_cpc))
420#define _wcsninc(_pc, _sz) (((_pc)+(_sz)))
421#define _wcsncnt(_cpc, _sz) ((wcslen(_cpc)>_sz) ? _sz : wcslen(_cpc))
422#define _wcsspnp(_cpc1, _cpc2) ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)
423#else /* __STDC__ */
424__inline wchar_t * __cdecl _wcsdec(const wchar_t * _cpc1, const wchar_t * _cpc2) { return (wchar_t *)((_cpc1)>=(_cpc2) ? NULL : ((_cpc2)-1)); }
425__inline wchar_t * __cdecl _wcsinc(const wchar_t * _pc) { return (wchar_t *)(_pc+1); }
426__inline unsigned int __cdecl _wcsnextc(const wchar_t * _cpc) { return (unsigned int)*_cpc; }
427__inline wchar_t * __cdecl _wcsninc(const wchar_t * _pc, size_t _sz) { return (wchar_t *)(_pc+_sz); }
428__inline size_t __cdecl _wcsncnt( const wchar_t * _cpc, size_t _sz) { size_t len; len = wcslen(_cpc); return (len>_sz) ? _sz : len; }
429__inline wchar_t * __cdecl _wcsspnp( const wchar_t * _cpc1, const wchar_t * _cpc2) { return (*(_cpc1 += wcsspn(_cpc1,_cpc2))!='\0') ? (wchar_t*)_cpc1 : NULL; }
430#endif /* __STDC__ */
431
432
433#else /* ndef _UNICODE */
434
435/* ++++++++++++++++++++ SBCS and MBCS ++++++++++++++++++++ */
436
437#ifdef __cplusplus
438} /* ... extern "C" */
439#endif
440
441#include <string.h>
442
443#ifdef __cplusplus
444extern "C" {
445#endif
446
447
448#define _TEOF EOF
449
450#define __T(x) x
451
452
453/* Program */
454
455#define _tmain main
456#define _tWinMain WinMain
457#ifdef _POSIX_
458#define _tenviron environ
459#else
460#define _tenviron _environ
461#endif
462#define __targv __argv
463
464
465/* Formatted i/o */
466
467#define _tprintf printf
468#define _ftprintf fprintf
469#define _stprintf sprintf
470#define _sntprintf _snprintf
471#define _vtprintf vprintf
472#define _vftprintf vfprintf
473#define _vstprintf vsprintf
474#define _vsntprintf _vsnprintf
475#define _tscanf scanf
476#define _ftscanf fscanf
477#define _stscanf sscanf
478
479
480/* Unformatted i/o */
481
482#define _fgettc fgetc
483#define _fgettchar _fgetchar
484#define _fgetts fgets
485#define _fputtc fputc
486#define _fputtchar _fputchar
487#define _fputts fputs
488#define _gettc getc
489#define _gettchar getchar
490#define _getts gets
491#define _puttc putc
492#define _puttchar putchar
493#define _putts puts
494#define _ungettc ungetc
495
496
497/* String conversion functions */
498
499#define _tcstod strtod
500#define _tcstol strtol
501#define _tcstoul strtoul
502
503#define _itot _itoa
504#define _ltot _ltoa
505#define _ultot _ultoa
506#define _ttoi atoi
507#define _ttol atol
508
509#define _ttoi64 _atoi64
510#define _i64tot _i64toa
511#define _ui64tot _ui64toa
512
513/* String functions */
514
515/* Note that _mbscat, _mbscpy and _mbsdup are functionally equivalent to
516 strcat, strcpy and strdup, respectively. */
517
518#define _tcscat strcat
519#define _tcscpy strcpy
520#define _tcsdup _strdup
521
522#define _tcslen strlen
523#define _tcsxfrm strxfrm
524
525
526/* Execute functions */
527
528#define _texecl _execl
529#define _texecle _execle
530#define _texeclp _execlp
531#define _texeclpe _execlpe
532#define _texecv _execv
533#define _texecve _execve
534#define _texecvp _execvp
535#define _texecvpe _execvpe
536
537#define _tspawnl _spawnl
538#define _tspawnle _spawnle
539#define _tspawnlp _spawnlp
540#define _tspawnlpe _spawnlpe
541#define _tspawnv _spawnv
542#define _tspawnve _spawnve
543#define _tspawnvp _spawnvp
544#define _tspawnvpe _spawnvpe
545
546#define _tsystem system
547
548
549/* Time functions */
550
551#define _tasctime asctime
552#define _tctime ctime
553#define _tstrdate _strdate
554#define _tstrtime _strtime
555#define _tutime _utime
556#define _tcsftime strftime
557
558
559/* Directory functions */
560
561#define _tchdir _chdir
562#define _tgetcwd _getcwd
563#define _tgetdcwd _getdcwd
564#define _tmkdir _mkdir
565#define _trmdir _rmdir
566
567
568/* Environment/Path functions */
569
570#define _tfullpath _fullpath
571#define _tgetenv getenv
572#define _tmakepath _makepath
573#define _tputenv _putenv
574#define _tsearchenv _searchenv
575#define _tsplitpath _splitpath
576
577
578/* Stdio functions */
579
580#ifdef _POSIX_
581#define _tfdopen fdopen
582#else
583#define _tfdopen _fdopen
584#endif
585#define _tfsopen _fsopen
586#define _tfopen fopen
587#define _tfreopen freopen
588#define _tperror perror
589#define _tpopen _popen
590#define _ttempnam _tempnam
591#define _ttmpnam tmpnam
592
593
594/* Io functions */
595
596#define _tchmod _chmod
597#define _tcreat _creat
598#define _tfindfirst _findfirst
599#define _tfindfirsti64 _findfirsti64
600#define _tfindnext _findnext
601#define _tfindnexti64 _findnexti64
602#define _tmktemp _mktemp
603
604#ifdef _POSIX_
605#define _topen open
606#define _taccess access
607#else
608#define _topen _open
609#define _taccess _access
610#endif
611
612#define _tremove remove
613#define _trename rename
614#define _tsopen _sopen
615#define _tunlink _unlink
616
617#define _tfinddata_t _finddata_t
618#define _tfinddatai64_t _finddatai64_t
619
620
621/* ctype functions */
622
623#define _istascii isascii
624#define _istcntrl iscntrl
625#define _istxdigit isxdigit
626
627
628/* Stat functions */
629
630#define _tstat _stat
631#define _tstati64 _stati64
632
633
634/* Setlocale functions */
635
636#define _tsetlocale setlocale
637
638
639#ifdef _MBCS
640
641/* ++++++++++++++++++++ MBCS ++++++++++++++++++++ */
642
643#ifdef __cplusplus
644} /* ... extern "C" */
645#endif
646
647#include <mbstring.h>
648
649#ifdef __cplusplus
650extern "C" {
651#endif
652
653
654#ifndef __TCHAR_DEFINED
655typedef char _TCHAR;
656typedef signed char _TSCHAR;
657typedef unsigned char _TUCHAR;
658typedef unsigned char _TXCHAR;
659typedef unsigned int _TINT;
660#define __TCHAR_DEFINED
661#endif
662
663#ifndef _TCHAR_DEFINED
664#if !__STDC__
665typedef char TCHAR;
666#endif
667#define _TCHAR_DEFINED
668#endif
669
670
671#ifdef _MB_MAP_DIRECT
672
673/* use mb functions directly - types must match */
674
675/* String functions */
676
677#define _tcschr _mbschr
678#define _tcscspn _mbscspn
679#define _tcsncat _mbsnbcat
680#define _tcsncpy _mbsnbcpy
681#define _tcspbrk _mbspbrk
682#define _tcsrchr _mbsrchr
683#define _tcsspn _mbsspn
684#define _tcsstr _mbsstr
685#define _tcstok _mbstok
686
687#define _tcsnset _mbsnbset
688#define _tcsrev _mbsrev
689#define _tcsset _mbsset
690
691#define _tcscmp _mbscmp
692#define _tcsicmp _mbsicmp
693#define _tcsnccmp _mbsncmp
694#define _tcsncmp _mbsnbcmp
695#define _tcsncicmp _mbsnicmp
696#define _tcsnicmp _mbsnbicmp
697
698#define _tcscoll _mbscoll
699#define _tcsicoll _mbsicoll
700#define _tcsnccoll _mbsncoll
701#define _tcsncoll _mbsnbcoll
702#define _tcsncicoll _mbsnicoll
703#define _tcsnicoll _mbsnbicoll
704
705
706/* "logical-character" mappings */
707
708#define _tcsclen _mbslen
709#define _tcsnccat _mbsncat
710#define _tcsnccpy _mbsncpy
711#define _tcsncset _mbsnset
712
713
714/* MBCS-specific mappings */
715
716#define _tcsdec _mbsdec
717#define _tcsinc _mbsinc
718#define _tcsnbcnt _mbsnbcnt
719#define _tcsnccnt _mbsnccnt
720#define _tcsnextc _mbsnextc
721#define _tcsninc _mbsninc
722#define _tcsspnp _mbsspnp
723
724#define _tcslwr _mbslwr
725#define _tcsupr _mbsupr
726
727#define _tclen _mbclen
728#define _tccpy _mbccpy
729
730#define _tccmp(_cpuc1,_cpuc2) _tcsnccmp(_cpuc1,_cpuc2,1)
731
732
733#else /* _MB_MAP_DIRECT */
734
735#if (__STDC__ || defined(_NO_INLINING)) && !defined(_M_M68K)
736
737/* use type-safe linked-in function thunks */
738
739/* String functions */
740
741_CRTIMP char * __cdecl _tcschr(const char *, unsigned int);
742_CRTIMP size_t __cdecl _tcscspn(const char *, const char *);
743_CRTIMP char * __cdecl _tcsncat(char *, const char *, size_t);
744_CRTIMP char * __cdecl _tcsncpy(char *, const char *, size_t);
745_CRTIMP char * __cdecl _tcspbrk(const char *, const char *);
746_CRTIMP char * __cdecl _tcsrchr(const char *, int);
747_CRTIMP size_t __cdecl _tcsspn(const char *, const char *);
748_CRTIMP char * __cdecl _tcsstr(const char *, const char *);
749_CRTIMP char * __cdecl _tcstok(char *, const char *);
750
751_CRTIMP char * __cdecl _tcsnset(char *, unsigned int, size_t);
752_CRTIMP char * __cdecl _tcsrev(char *);
753_CRTIMP char * __cdecl _tcsset(char *, unsigned int);
754
755_CRTIMP int __cdecl _tcscmp(const char *, const char *);
756_CRTIMP int __cdecl _tcsicmp(const char *, const char *);
757_CRTIMP int __cdecl _tcsnccmp(const char *, const char *, size_t);
758_CRTIMP int __cdecl _tcsncmp(const char *, const char *, size_t);
759_CRTIMP int __cdecl _tcsncicmp(const char *, const char *, size_t);
760_CRTIMP int __cdecl _tcsnicmp(const char *, const char *, size_t);
761
762_CRTIMP int __cdecl _tcscoll(const char *, const char *);
763_CRTIMP int __cdecl _tcsicoll(const char *, const char *);
764_CRTIMP int __cdecl _tcsnccoll(const char *, const char *, size_t);
765_CRTIMP int __cdecl _tcsncoll(const char *, const char *, size_t);
766_CRTIMP int __cdecl _tcsncicoll(const char *, const char *, size_t);
767_CRTIMP int __cdecl _tcsnicoll(const char *, const char *, size_t);
768
769
770/* "logical-character" mappings */
771
772_CRTIMP size_t __cdecl _tcsclen(const char *);
773_CRTIMP char * __cdecl _tcsnccat(char *, const char *, size_t);
774_CRTIMP char * __cdecl _tcsnccpy(char *, const char *, size_t);
775_CRTIMP char * __cdecl _tcsncset(char *, unsigned int, size_t);
776
777
778/* MBCS-specific mappings */
779
780_CRTIMP char * __cdecl _tcsdec(const char *, const char *);
781_CRTIMP char * __cdecl _tcsinc(const char *);
782_CRTIMP size_t __cdecl _tcsnbcnt(const char *, size_t);
783_CRTIMP size_t __cdecl _tcsnccnt(const char *, size_t);
784_CRTIMP unsigned int __cdecl _tcsnextc (const char *);
785_CRTIMP char * __cdecl _tcsninc(const char *, size_t);
786_CRTIMP char * __cdecl _tcsspnp(const char *, const char *);
787
788_CRTIMP char * __cdecl _tcslwr(char *);
789_CRTIMP char * __cdecl _tcsupr(char *);
790
791_CRTIMP size_t __cdecl _tclen(const char *);
792_CRTIMP void __cdecl _tccpy(char *, const char *);
793
794
795#else /* __STDC__ */
796
797/* the default: use type-safe inline function thunks */
798
799#define _PUC unsigned char *
800#define _CPUC const unsigned char *
801#define _PC char *
802#define _CPC const char *
803#define _UI unsigned int
804
805
806/* String functions */
807
808__inline _PC _tcschr(_CPC _s1,_UI _c) {return (_PC)_mbschr((_CPUC)_s1,_c);}
809__inline size_t _tcscspn(_CPC _s1,_CPC _s2) {return _mbscspn((_CPUC)_s1,(_CPUC)_s2);}
810__inline _PC _tcsncat(_PC _s1,_CPC _s2,size_t _n) {return (_PC)_mbsnbcat((_PUC)_s1,(_CPUC)_s2,_n);}
811__inline _PC _tcsncpy(_PC _s1,_CPC _s2,size_t _n) {return (_PC)_mbsnbcpy((_PUC)_s1,(_CPUC)_s2,_n);}
812__inline _PC _tcspbrk(_CPC _s1,_CPC _s2) {return (_PC)_mbspbrk((_CPUC)_s1,(_CPUC)_s2);}
813__inline _PC _tcsrchr(_CPC _s1,_UI _c) {return (_PC)_mbsrchr((_CPUC)_s1,_c);}
814__inline size_t _tcsspn(_CPC _s1,_CPC _s2) {return _mbsspn((_CPUC)_s1,(_CPUC)_s2);}
815__inline _PC _tcsstr(_CPC _s1,_CPC _s2) {return (_PC)_mbsstr((_CPUC)_s1,(_CPUC)_s2);}
816__inline _PC _tcstok(_PC _s1,_CPC _s2) {return (_PC)_mbstok((_PUC)_s1,(_CPUC)_s2);}
817
818__inline _PC _tcsnset(_PC _s1,_UI _c,size_t _n) {return (_PC)_mbsnbset((_PUC)_s1,_c,_n);}
819__inline _PC _tcsrev(_PC _s1) {return (_PC)_mbsrev((_PUC)_s1);}
820__inline _PC _tcsset(_PC _s1,_UI _c) {return (_PC)_mbsset((_PUC)_s1,_c);}
821
822__inline int _tcscmp(_CPC _s1,_CPC _s2) {return _mbscmp((_CPUC)_s1,(_CPUC)_s2);}
823__inline int _tcsicmp(_CPC _s1,_CPC _s2) {return _mbsicmp((_CPUC)_s1,(_CPUC)_s2);}
824__inline int _tcsnccmp(_CPC _s1,_CPC _s2,size_t _n) {return _mbsncmp((_CPUC)_s1,(_CPUC)_s2,_n);}
825__inline int _tcsncmp(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnbcmp((_CPUC)_s1,(_CPUC)_s2,_n);}
826__inline int _tcsncicmp(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnicmp((_CPUC)_s1,(_CPUC)_s2,_n);}
827__inline int _tcsnicmp(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnbicmp((_CPUC)_s1,(_CPUC)_s2,_n);}
828
829__inline int _tcscoll(_CPC _s1,_CPC _s2) {return _mbscoll((_CPUC)_s1,(_CPUC)_s2);}
830__inline int _tcsicoll(_CPC _s1,_CPC _s2) {return _mbsicoll((_CPUC)_s1,(_CPUC)_s2);}
831__inline int _tcsnccoll(_CPC _s1,_CPC _s2,size_t _n) {return _mbsncoll((_CPUC)_s1,(_CPUC)_s2,_n);}
832__inline int _tcsncoll(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnbcoll((_CPUC)_s1,(_CPUC)_s2,_n);}
833__inline int _tcsncicoll(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnicoll((_CPUC)_s1,(_CPUC)_s2,_n);}
834__inline int _tcsnicoll(_CPC _s1,_CPC _s2,size_t _n) {return _mbsnbicoll((_CPUC)_s1,(_CPUC)_s2,_n);}
835
836
837/* "logical-character" mappings */
838
839__inline size_t _tcsclen(_CPC _s1) {return _mbslen((_CPUC)_s1);}
840__inline _PC _tcsnccat(_PC _s1,_CPC _s2,size_t _n) {return (_PC)_mbsncat((_PUC)_s1,(_CPUC)_s2,_n);}
841__inline _PC _tcsnccpy(_PC _s1,_CPC _s2,size_t _n) {return (_PC)_mbsncpy((_PUC)_s1,(_CPUC)_s2,_n);}
842__inline _PC _tcsncset(_PC _s1,_UI _c,size_t _n) {return (_PC)_mbsnset((_PUC)_s1,_c,_n);}
843
844
845/* MBCS-specific mappings */
846
847__inline _PC _tcsdec(_CPC _s1,_CPC _s2) {return (_PC)_mbsdec((_CPUC)_s1,(_CPUC)_s2);}
848__inline _PC _tcsinc(_CPC _s1) {return (_PC)_mbsinc((_CPUC)_s1);}
849__inline size_t _tcsnbcnt(_CPC _s1,size_t _n) {return _mbsnbcnt((_CPUC)_s1,_n);}
850__inline size_t _tcsnccnt(_CPC _s1,size_t _n) {return _mbsnccnt((_CPUC)_s1,_n);}
851__inline _PC _tcsninc(_CPC _s1,size_t _n) {return (_PC)_mbsninc((_CPUC)_s1,_n);}
852__inline _PC _tcsspnp(_CPC _s1,_CPC _s2) {return (_PC)_mbsspnp((_CPUC)_s1,(_CPUC)_s2);}
853__inline _PC _tcslwr(_PC _s1) {return (_PC)_mbslwr((_PUC)_s1);}
854__inline _PC _tcsupr(_PC _s1) {return (_PC)_mbsupr((_PUC)_s1);}
855
856__inline size_t _tclen(_CPC _s1) {return _mbclen((_CPUC)_s1);}
857__inline void _tccpy(_PC _s1,_CPC _s2) {_mbccpy((_PUC)_s1,(_CPUC)_s2); return;}
858
859
860/* inline helper */
861__inline _UI _tcsnextc(_CPC _s1) {_UI _n=0; if (_ismbblead((_UI)*(_PUC)_s1)) _n=((_UI)*_s1++)<<8; _n+=(_UI)*_s1; return(_n);}
862
863
864#endif /* __STDC__ */
865
866#endif /* _MB_MAP_DIRECT */
867
868
869/* MBCS-specific mappings */
870
871#define _tccmp(_cp1,_cp2) _tcsnccmp(_cp1,_cp2,1)
872
873
874/* ctype functions */
875
876#define _istalnum _ismbcalnum
877#define _istalpha _ismbcalpha
878#define _istdigit _ismbcdigit
879#define _istgraph _ismbcgraph
880#define _istlegal _ismbclegal
881#define _istlower _ismbclower
882#define _istprint _ismbcprint
883#define _istpunct _ismbcpunct
884#define _istspace _ismbcspace
885#define _istupper _ismbcupper
886
887#define _totupper _mbctoupper
888#define _totlower _mbctolower
889
890#define _istlead _ismbblead
891#define _istleadbyte isleadbyte
892
893#else /* !_MBCS */
894
895/* ++++++++++++++++++++ SBCS ++++++++++++++++++++ */
896
897
898#ifndef __TCHAR_DEFINED
899typedef char _TCHAR;
900typedef signed char _TSCHAR;
901typedef unsigned char _TUCHAR;
902typedef char _TXCHAR;
903typedef int _TINT;
904#define __TCHAR_DEFINED
905#endif
906
907#ifndef _TCHAR_DEFINED
908#if !__STDC__
909typedef char TCHAR;
910#endif
911#define _TCHAR_DEFINED
912#endif
913
914
915/* String functions */
916
917#define _tcschr strchr
918#define _tcscspn strcspn
919#define _tcsncat strncat
920#define _tcsncpy strncpy
921#define _tcspbrk strpbrk
922#define _tcsrchr strrchr
923#define _tcsspn strspn
924#define _tcsstr strstr
925#define _tcstok strtok
926
927#define _tcsnset _strnset
928#define _tcsrev _strrev
929#define _tcsset _strset
930
931#define _tcscmp strcmp
932#define _tcsicmp _stricmp
933#define _tcsnccmp strncmp
934#define _tcsncmp strncmp
935#define _tcsncicmp _strnicmp
936#define _tcsnicmp _strnicmp
937
938#define _tcscoll strcoll
939#define _tcsicoll _stricoll
940#define _tcsnccoll _strncoll
941#define _tcsncoll _strncoll
942#define _tcsncicoll _strnicoll
943#define _tcsnicoll _strnicoll
944
945
946/* "logical-character" mappings */
947
948#define _tcsclen strlen
949#define _tcsnccat strncat
950#define _tcsnccpy strncpy
951#define _tcsncset _strnset
952
953
954/* MBCS-specific functions */
955
956#define _tcsdec _strdec
957#define _tcsinc _strinc
958#define _tcsnbcnt _strncnt
959#define _tcsnccnt _strncnt
960#define _tcsnextc _strnextc
961#define _tcsninc _strninc
962#define _tcsspnp _strspnp
963
964#define _tcslwr _strlwr
965#define _tcsupr _strupr
966#define _tcsxfrm strxfrm
967
968#define _istlead(_c) (0)
969#define _istleadbyte(_c) (0)
970
971#if (__STDC__ || defined(_NO_INLINING)) && !defined(_M_M68K)
972#define _tclen(_pc) (1)
973#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2))
974#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2)))
975#else /* __STDC__ */
976__inline size_t __cdecl _tclen(const char *_cpc) { return (_cpc,1); }
977__inline void __cdecl _tccpy(char *_pc1, const char *_cpc2) { *_pc1 = *_cpc2; }
978__inline int __cdecl _tccmp(const char *_cpc1, const char *_cpc2) { return (int) (((unsigned char)*_cpc1)-((unsigned char)*_cpc2)); }
979#endif /* __STDC__ */
980
981
982/* ctype-functions */
983
984#define _istalnum isalnum
985#define _istalpha isalpha
986#define _istdigit isdigit
987#define _istgraph isgraph
988#define _istlower islower
989#define _istprint isprint
990#define _istpunct ispunct
991#define _istspace isspace
992#define _istupper isupper
993
994#define _totupper toupper
995#define _totlower tolower
996
997#define _istlegal(_c) (1)
998
999
1000/* the following is optional if functional versions are available */
1001
1002/* define NULL pointer value */
1003
1004#ifndef NULL
1005#ifdef __cplusplus
1006#define NULL 0
1007#else
1008#define NULL ((void *)0)
1009#endif
1010#endif
1011
1012
1013#if (__STDC__ || defined(_NO_INLINING)) && !defined(_M_M68K)
1014#define _strdec(_cpc1, _cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1)
1015#define _strinc(_pc) ((_pc)+1)
1016#define _strnextc(_cpc) ((unsigned int) *(_cpc))
1017#define _strninc(_pc, _sz) (((_pc)+(_sz)))
1018#define _strncnt(_cpc, _sz) ((strlen(_cpc)>_sz) ? _sz : strlen(_cpc))
1019#define _strspnp(_cpc1, _cpc2) ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)
1020#else /* __STDC__ */
1021__inline char * __cdecl _strdec(const char * _cpc1, const char * _cpc2) { return (char *)((_cpc1)>=(_cpc2) ? NULL : (_cpc2-1)); }
1022__inline char * __cdecl _strinc(const char * _pc) { return (char *)(_pc+1); }
1023__inline unsigned int __cdecl _strnextc(const char * _cpc) { return (unsigned int)*_cpc; }
1024__inline char * __cdecl _strninc(const char * _pc, size_t _sz) { return (char *)(_pc+_sz); }
1025__inline size_t __cdecl _strncnt( const char * _cpc, size_t _sz) { size_t len; len = strlen(_cpc); return (len>_sz) ? _sz : len; }
1026__inline char * __cdecl _strspnp( const char * _cpc1, const char * _cpc2) { return (*(_cpc1 += strspn(_cpc1,_cpc2))!='\0') ? (char*)_cpc1 : NULL; }
1027#endif /* __STDC__ */
1028
1029
1030#endif /* _MBCS */
1031
1032#endif /* _UNICODE */
1033
1034
1035/* Generic text macros to be used with string literals and character constants.
1036 Will also allow symbolic constants that resolve to same. */
1037
1038#define _T(x) __T(x)
1039#define _TEXT(x) __T(x)
1040
1041
1042#ifdef __cplusplus
1043} /* ... extern "C" */
1044#endif
1045
1046#endif /* _INC_TCHAR */
Note: See TracBrowser for help on using the repository browser.