home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / tchar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  30.5 KB  |  966 lines

  1. /*
  2.  *      C/C++ Run Time Library - Version 10.0
  3.  *
  4.  *      Copyright (c) 1995, 2000 by Inprise Corporation
  5.  *      All Rights Reserved.
  6.  *
  7.  */
  8.  
  9. /* $Revision:   9.21  $ */
  10.  
  11. #if !defined(__TCHAR_H)
  12. #define __TCHAR_H
  13. #define _INC_TCHAR  /* MSC Guard name */
  14.  
  15. #ifndef ___STDDEF_H
  16. #include <_stddef.h>
  17. #endif
  18.  
  19. /*
  20.     This file is parsed with a tool that will spit out a table of
  21.     function mappings for the online help.  The format is as follows:
  22.  
  23.     Inside a single-line slash-star comment, there will be a command:
  24.  
  25.     @+(col_name[,col]) ..descrip..   Define (start) current column block(s)
  26.     @-                               Stop the current block(s)
  27.     @:..descrip..                    Change description for the current block(s)
  28.     @!:portable_name                 Adds in a brute force entry with no equiv.
  29.     @!(portable_name,cur_col_name)   Adds in a brute force entry
  30.  
  31.     The lines following these commands will then be processed:
  32.       #define portable_name cur_col_name
  33.       typedef cur_col_name portable_name
  34.  
  35.     #defines that are macros (have parens) or are more than two words are
  36.     ignored.
  37. */
  38.  
  39. #if defined(__USING_CNAME__)
  40. #  undef __USING_CNAME__
  41. #  include <string.h>
  42. #  define __USING_CNAME__
  43. #else
  44. #  include <string.h>
  45. #endif
  46.  
  47. #ifdef  __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if defined(_MBCS) && !defined(__MBSTRING_H)
  52. #include <mbstring.h>
  53. #endif
  54.  
  55. #if !defined(_UNICODE)
  56.  
  57. #ifdef __cplusplus
  58. namespace std {
  59. #endif
  60.  
  61. /* @+(SBCS) Types */
  62.  
  63. #if !defined(_MBCS)
  64.  
  65. #ifndef __TCHAR_DEFINED
  66. typedef char            _TCHAR;
  67. typedef signed char     _TSCHAR;
  68. typedef unsigned char   _TUCHAR;
  69. typedef char            _TXCHAR;
  70. typedef int             _TINT;
  71. #define __TCHAR_DEFINED
  72. #endif
  73. #endif /* _MBCS */
  74.  
  75. #ifdef __cplusplus
  76. } // std
  77. #endif
  78.  
  79. /* @: misc. functions */
  80.  
  81. #define _tfdopen        _fdopen
  82. #define _fputtchar      _fputchar
  83. #define _fgettchar      _fgetchar
  84. #define _tmktemp        _mktemp
  85. #define _tunlink        _unlink
  86. #define _ttempnam       _tempnam
  87. #define _trmdir         _rmdir
  88. #define _tmkdir         _mkdir
  89. #define _tutime         _utime
  90. #define _ltot           _ltoa
  91. #define _tsopen         _sopen
  92.  
  93. /* @: program specific functions */
  94.  
  95. #define _tmain          main
  96. #define _tWinMain       WinMain
  97. #define _tenviron       _environ
  98. #define _targv          _argv
  99.  
  100. /* @: path/environment specific functions */
  101.  
  102. #define _tfullpath      _fullpath
  103. #define _tmakepath      _makepath
  104. #define _tsplitpath     _splitpath
  105. #define _tsearchpath    searchpath
  106. #define _tsearchenv     _searchenv
  107. #define _tsearchstr     _searchstr
  108. #define _tgetenv        getenv
  109. #define _tputenv        putenv
  110. #define _tfnsplit       fnsplit
  111. #define _tfnmerge       fnmerge
  112.  
  113. /* @: directory functions */
  114.  
  115. #define _topendir       opendir
  116. #define _treaddir       readdir
  117. #define _trewinddir     rewinddir
  118. #define _tclosedir      closedir
  119. #define _tDIR           DIR
  120. #define _tdirent        dirent
  121.  
  122. /* @: stdio functions */
  123.  
  124. #define _tpopen         _popen
  125. #define _tfsopen        _fsopen
  126. #define _tfopen         fopen
  127. #define _tfreopen       freopen
  128. #define _tperror        perror
  129. #define _ttmpnam        tmpnam
  130.  
  131. /* @: time functions */
  132.  
  133. #define _tstrdate       _strdate
  134. #define _tstrtime       _strtime
  135. #define _tasctime       asctime
  136. #define _tctime         ctime
  137. #define _tcsftime       strftime
  138. #define _ttzset         _tzset
  139. #define _ttzname        _tzname
  140.  
  141. /* @: I/O functions */
  142.  
  143. #define _taccess        access
  144. #define _tchmod         chmod
  145. #define _trtl_open      _rtl_open
  146. #define _trtl_creat     _rtl_creat
  147. #define _trtl_chmod     _rtl_chmod
  148. #define _tcreat         creat
  149. #define __tcreat        _creat
  150. #define _tfindfirst     findfirst
  151. #define _tfindnext      findnext
  152. #define _tfindclose     findclose
  153. #define __tfindfirsti64 _findfirsti64
  154. #define __tfindnexti64  _findnexti64
  155. #define __tfinddatai64_t _finddatai64_t
  156. #define __tfinddata_t   _finddata_t
  157.  
  158. #define __tfindfirst    _findfirst
  159. #define __tfindnext     _findnext
  160. #define _topen          open
  161. #define __topen         _open
  162. #define _tremove        remove
  163. #define _trename        rename
  164.  
  165. #define _tffblk         ffblk
  166.  
  167. /* @: string conversion functions */
  168.  
  169. #define _ttof           atof
  170. #define _ttoi           atoi
  171. #define _ttol           atol
  172. #define _ttoi64         _atoi64
  173. #define _ttold          _atold
  174. #define _tcstod         strtod
  175. #define _tcstol         strtol
  176. #define _tcstold        _strtold
  177. #define _tcstoul        strtoul
  178. #define _itot           itoa
  179. #define _ultot          ultoa
  180. #define _i64tot         _i64toa
  181. #define _ui64tot        _ui64toa
  182.  
  183. /* @: generic string functions  */
  184.  
  185. #define _tcscat         strcat
  186. #define _tcscpy         strcpy
  187. #define _tcspcpy        _stpcpy
  188. #define _tcslen         strlen
  189. #define _tcsdup         strdup
  190.  
  191. /* @: directory functions */
  192.  
  193. #define _tchdir         chdir
  194. #define _tgetcurdir     getcurdir
  195. #define _tgetcwd        getcwd
  196. #define _tgetdcwd       _getdcwd
  197.  
  198. /* @: process execution functions */
  199.  
  200. #define _texecl     execl
  201. #define _texecle    execle
  202. #define _texeclp    execlp
  203. #define _texeclpe   execlpe
  204. #define _texecv     execv
  205. #define _texecve    execve
  206. #define _texecvp    execvp
  207. #define _texecvpe   execvpe
  208.  
  209. #define _tspawnl    spawnl
  210. #define _tspawnle   spawnle
  211. #define _tspawnlp   spawnlp
  212. #define _tspawnlpe  spawnlpe
  213. #define _tspawnv    spawnv
  214. #define _tspawnve   spawnve
  215. #define _tspawnvp   spawnvp
  216. #define _tspawnvpe  spawnvpe
  217.  
  218. #define _tsystem    system
  219.  
  220. /* @: unformated I/O */
  221.  
  222. #define _fgettc         fgetc
  223. #define _fgetts         fgets
  224. #define _fputtc         fputc
  225. #define _fputts         fputs
  226. #define _gettc          getc
  227. #define _gettchar       getchar
  228. #define _getts          gets
  229. #define _puttc          putc
  230. #define _puttchar       putchar
  231. #define _putts          puts
  232. #define _ungettc        ungetc
  233.  
  234. /* @: formated I/O functions */
  235.  
  236. #define _ftprintf       fprintf
  237. #define _tprintf        printf
  238. #define _stprintf       sprintf
  239. #define _vtprintf       vprintf
  240. #define _vftprintf      vfprintf
  241. #define _vstprintf      vsprintf
  242. #define _sntprintf      snprintf
  243. #define _vsntprintf     vsnprintf
  244. #define __sntprintf     _snprintf       // MSC compat.
  245. #define __vsntprintf    _vsnprintf      // MSC compat.
  246.  
  247.  
  248. #define _tscanf         scanf
  249. #define _stscanf        sscanf
  250. #define _ftscanf        fscanf
  251. #define _vstscanf       vsscanf
  252. #define _vtscanf        vscanf
  253. #define _vftscanf       vfscanf
  254.  
  255. /* @: stat functions */
  256.  
  257. #define _tstat          _stat
  258. #define _tstati64       _stati64
  259.  
  260. /* @: setlocale functions */
  261.  
  262. #define _tsetlocale setlocale
  263.  
  264. /* @: memory functions */
  265.  
  266. #define _tmemcpy        memcpy
  267. #define _tmemchr        memchr
  268. #define _tmemset        memset
  269.  
  270. /* @: generic text macros */
  271. /* @!:__T */
  272. /* @!:_TEXT */
  273. /* @!:_T */
  274.  
  275. #define __T(__x)          __x
  276. #define _TEXT(__x)        __T(__x)
  277. #define _T(__x)           __T(__x)
  278. #define _TEOF           EOF
  279.  
  280. #if defined(_MBCS)
  281.  
  282. /* ----------------- MBCS functions -------------------------- */
  283.  
  284. #ifdef __cplusplus
  285. namespace std {
  286. #endif
  287.  
  288. /* @+(MBCS) Types */
  289.  
  290. #ifndef __TCHAR_DEFINED
  291. typedef char            _TCHAR;
  292. typedef signed char     _TSCHAR;
  293. typedef unsigned char   _TUCHAR;
  294. typedef unsigned char   _TXCHAR;
  295. /* typedef unsigned int    _TINT; */ /* HACK: for now */
  296. typedef int    _TINT;
  297. #define __TCHAR_DEFINED
  298. #endif
  299.  
  300. #ifdef __cplusplus
  301. } // std
  302. #endif
  303.  
  304. #ifdef _MBC_USE_MACROS
  305. /* @: string functions */
  306.  
  307. #define _tcschr         _mbschr
  308. #define _tcscspn        _mbscspn
  309. #define _tcsncat        _mbsnbcat
  310. #define _tcsncpy        _mbsnbcpy
  311. #define _tcspbrk        _mbspbrk
  312. #define _tcsrchr        _mbsrchr
  313. #define _tcsspn         _mbsspn
  314. #define _tcsstr         _mbsstr
  315. #define _tcstok         _mbstok
  316.  
  317. #define _tcsset         _mbsset
  318. #define _tcsnset        _mbsnbset
  319. #define _tcsrev         _mbsrev
  320. #define _tcscmp         _mbscmp
  321. #define _tcsicmp        _mbsicmp
  322. #define _tcsncmp        _mbsnbcmp
  323. #define _tcsnicmp       _mbsnbicmp
  324. #define _tcsnccmp       _mbsncmp
  325. #define _tcsncicmp      _mbsnicmp
  326.  
  327. /* todo : correct the mapping of these functions and add the new functions */
  328. #define _tcscoll        _mbscoll
  329. #define _tcsncoll       _mbsnbcoll
  330. #define _tcsnccoll      _mbsncoll
  331. #define _tcsicoll       _mbsicoll
  332. #define _tcsnicoll      _mbsnbicoll
  333. #define _tcsncicoll     _mbsnicoll
  334.  
  335. /* @: logical-character functions */
  336.  
  337. #define _tcsclen        _mbslen
  338. #define _tcsnccat       _mbsncat
  339. #define _tcsnccpy       _mbsncpy
  340. #define _tcsncset       _mbsnset
  341.  
  342. /* @: misc. functions */
  343.  
  344. #define _tcsdec         _mbsdec
  345. #define _tcsinc         _mbsinc
  346. #define _tcsnbcnt       _mbsnbcnt
  347. #define _tcsnccnt       _mbsnccnt
  348. #define _tcsnextc       _mbsnextc
  349. #define _tcsninc        _mbsninc
  350. #define _tcsspnp        _mbsspnp
  351.  
  352. #define _tcslwr         _mbslwr
  353. #define _tcsupr         _mbsupr
  354.  
  355. #define _tclen          _mbclen
  356. #define _tccpy          _mbccpy
  357.  
  358. /* @!(_tccmp,_mbsncmp) */
  359. /* @- */
  360. #define _tccmp(__a,__b) _mbsncmp(__a,__b,1)
  361.  
  362. #else /* _MBC_USE_MACROS */
  363.  
  364. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  365.  
  366. /* String functions */
  367.  
  368. char * _RTLENTRY  _EXPFUNC _tcschr(const char *, unsigned int);
  369. _SIZE_T _RTLENTRY  _EXPFUNC _tcscspn(const char *, const char *);
  370. char * _RTLENTRY  _EXPFUNC _tcsncat(char *, const char *, _SIZE_T);
  371. char * _RTLENTRY  _EXPFUNC _tcsncpy(char *, const char *, _SIZE_T);
  372. char * _RTLENTRY  _EXPFUNC _tcspbrk(const char *, const char *);
  373. char * _RTLENTRY  _EXPFUNC _tcsrchr(const char *, int);
  374. _SIZE_T _RTLENTRY  _EXPFUNC _tcsspn(const char *, const char *);
  375. char * _RTLENTRY  _EXPFUNC _tcsstr(const char *, const char *);
  376. char * _RTLENTRY  _EXPFUNC _tcstok(char *, const char *);
  377.  
  378. char * _RTLENTRY  _EXPFUNC _tcsnset(char *, unsigned int, _SIZE_T);
  379. char * _RTLENTRY  _EXPFUNC _tcsrev(char *);
  380. char * _RTLENTRY  _EXPFUNC _tcsset(char *, unsigned int);
  381.  
  382. int _RTLENTRY  _EXPFUNC _tcscmp(const char *, const char *);
  383. int _RTLENTRY  _EXPFUNC _tcsicmp(const char *, const char *);
  384. int _RTLENTRY  _EXPFUNC _tcsnccmp(const char *, const char *, _SIZE_T);
  385. int _RTLENTRY  _EXPFUNC _tcsncmp(const char *, const char *, _SIZE_T);
  386. int _RTLENTRY  _EXPFUNC _tcsncicmp(const char *, const char *, _SIZE_T);
  387. int _RTLENTRY  _EXPFUNC _tcsnicmp(const char *, const char *, _SIZE_T);
  388.  
  389. int _RTLENTRY  _EXPFUNC _tcscoll(const char *, const char *);
  390. int _RTLENTRY  _EXPFUNC _tcsicoll(const char *, const char *);
  391. int _RTLENTRY  _EXPFUNC _tcsnccoll(const char *, const char *, _SIZE_T);
  392. int _RTLENTRY  _EXPFUNC _tcsncoll(const char *, const char *, _SIZE_T);
  393. int _RTLENTRY  _EXPFUNC _tcsncicoll(const char *, const char *, _SIZE_T);
  394. int _RTLENTRY  _EXPFUNC _tcsnicoll(const char *, const char *, _SIZE_T);
  395.  
  396.  
  397. /* "logical-character" functions */
  398.  
  399. _SIZE_T _RTLENTRY  _EXPFUNC _tcsclen(const char *);
  400. char * _RTLENTRY  _EXPFUNC _tcsnccat(char *, const char *, _SIZE_T);
  401. char * _RTLENTRY  _EXPFUNC _tcsnccpy(char *, const char *, _SIZE_T);
  402. char * _RTLENTRY  _EXPFUNC _tcsncset(char *, unsigned int, _SIZE_T);
  403.  
  404.  
  405. /* MBCS-specific functions */
  406.  
  407. char * _RTLENTRY  _EXPFUNC _tcsdec(const char *, const char *);
  408. char * _RTLENTRY  _EXPFUNC _tcsinc(const char *);
  409. _SIZE_T _RTLENTRY  _EXPFUNC _tcsnbcnt(const char *, _SIZE_T);
  410. _SIZE_T _RTLENTRY  _EXPFUNC _tcsnccnt(const char *, _SIZE_T);
  411. unsigned int _RTLENTRY  _EXPFUNC _tcsnextc (const char *);
  412. char * _RTLENTRY  _EXPFUNC _tcsninc(const char *, _SIZE_T);
  413. char * _RTLENTRY  _EXPFUNC _tcsspnp(const char *, const char *);
  414.  
  415. char * _RTLENTRY  _EXPFUNC _tcslwr(char *);
  416. char * _RTLENTRY  _EXPFUNC _tcsupr(char *);
  417.  
  418. _SIZE_T _RTLENTRY  _EXPFUNC _tclen(const char *);
  419. void   _RTLENTRY  _EXPFUNC _tccpy(char *, const char *);
  420. int    _RTLENTRY  _EXPFUNC _tccmp(const char *, const char *);
  421.  
  422. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  423.  
  424. inline char * _tcschr(const char * __s1,unsigned int __c) {return (char *)_mbschr((const unsigned char *)__s1,__c);}
  425. inline _SIZE_T _tcscspn(const char * __s1,const char * __s2) {return _mbscspn((const unsigned char *)__s1,(const unsigned char *)__s2);}
  426. inline char * _tcsncat(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsnbcat((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  427. inline char * _tcsncpy(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsnbcpy((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  428. inline char * _tcspbrk(const char * __s1,const char * __s2) {return (char *)_mbspbrk((const unsigned char *)__s1,(const unsigned char *)__s2);}
  429. inline char * _tcsrchr(const char * __s1,unsigned int __c) {return (char *)_mbsrchr((const unsigned char *)__s1,__c);}
  430. inline _SIZE_T _tcsspn(const char * __s1,const char * __s2) {return _mbsspn((const unsigned char *)__s1,(const unsigned char *)__s2);}
  431. inline char * _tcsstr(const char * __s1,const char * __s2) {return (char *)_mbsstr((const unsigned char *)__s1,(const unsigned char *)__s2);}
  432. inline char * _tcstok(char * __s1,const char * __s2) {return (char *)_mbstok((unsigned char *)__s1,(const unsigned char *)__s2);}
  433.  
  434. inline char * _tcsnset(char * __s1,unsigned int __c,_SIZE_T __n) {return (char *)_mbsnbset((unsigned char *)__s1,__c,__n);}
  435. inline char * _tcsrev(char * __s1) {return (char *)_mbsrev((unsigned char *)__s1);}
  436. inline char * _tcsset(char * __s1,unsigned int __c) {return (char *)_mbsset((unsigned char *)__s1,__c);}
  437.  
  438. inline int _tcscmp(const char * __s1,const char * __s2) {return _mbscmp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  439. inline int _tcsicmp(const char * __s1,const char * __s2) {return _mbsicmp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  440. inline int _tcsnccmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsncmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  441. inline int _tcsncmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbcmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  442. inline int _tcsncicmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnicmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  443. inline int _tcsnicmp(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbicmp((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  444.  
  445. inline int _tcscoll(const char * __s1,const char * __s2) {return _mbscoll((const unsigned char *)__s1,(const unsigned char *)__s2);}
  446. inline int _tcsicoll(const char * __s1,const char * __s2) {return _mbsicoll((const unsigned char *)__s1,(const unsigned char *)__s2);}
  447. inline int _tcsnccoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsncoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  448. inline int _tcsncoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbcoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  449. inline int _tcsncicoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnicoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  450. inline int _tcsnicoll(const char * __s1,const char * __s2,_SIZE_T __n) {return _mbsnbicoll((const unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  451.  
  452.  
  453. /* logical-character functions */
  454.  
  455. inline _SIZE_T _tcsclen(const char * __s1) {return _mbslen((const unsigned char *)__s1);}
  456. inline char * _tcsnccat(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsncat((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  457. inline char * _tcsnccpy(char * __s1,const char * __s2,_SIZE_T __n) {return (char *)_mbsncpy((unsigned char *)__s1,(const unsigned char *)__s2,__n);}
  458. inline char * _tcsncset(char * __s1,unsigned int __c,_SIZE_T __n) {return (char *)_mbsnset((unsigned char *)__s1,__c,__n);}
  459.  
  460.  
  461. /* MBCS-specific functions */
  462.  
  463. inline char * _tcsdec(const char * __s1,const char * __s2) {return (char *)_mbsdec((const unsigned char *)__s1,(const unsigned char *)__s2);}
  464. inline char * _tcsinc(const char * __s1) {return (char *)_mbsinc((const unsigned char *)__s1);}
  465. inline _SIZE_T _tcsnbcnt(const char * __s1,_SIZE_T __n) {return _mbsnbcnt((const unsigned char *)__s1,__n);}
  466. inline _SIZE_T _tcsnccnt(const char * __s1,_SIZE_T __n) {return _mbsnccnt((const unsigned char *)__s1,__n);}
  467.  
  468. inline unsigned int _tcsnextc(const char * __s1)
  469. {
  470.    const unsigned char *__p = (const unsigned char *) __s1;
  471.    return (_ismbblead(*__p)) ? (((unsigned int)*__p << 8) | __p[0]) : *__p;
  472. }
  473.  
  474. inline char * _tcsninc(const char * __s1,_SIZE_T __n) {return (char *)_mbsninc((const unsigned char *)__s1,__n);}
  475. inline char * _tcsspnp(const char * __s1,const char * __s2) {return (char *)_mbsspnp((const unsigned char *)__s1,(const unsigned char *)__s2);}
  476. inline char * _tcslwr(char * __s1) {return (char *)_mbslwr((unsigned char *)__s1);}
  477. inline char * _tcsupr(char * __s1) {return (char *)_mbsupr((unsigned char *)__s1);}
  478.  
  479. inline _SIZE_T _tclen(const char * __s1) {return _mbclen((const unsigned char *)__s1);}
  480. inline void   _tccpy(char * __s1,const char * __s2) {_mbccpy((unsigned char *)__s1,(const unsigned char *)__s2); return;}
  481. inline int    _tccmp(const char *__s1, const char *__s2){ return  _mbsncmp((const unsigned char *)__s1,(const unsigned char *)__s2,1);}
  482.  
  483. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  484.  
  485. #endif  /* _MBC_USE_MACROS */
  486.  
  487. /* @+(MBCS) comparison functions */
  488.  
  489. #define _tcscmpi        _tcsicmp
  490. #define _tcsncmpi       _tcsnicmp
  491.  
  492. /* @: ctype functions */
  493.  
  494. #define _istalnum       _ismbcalnum
  495. #define _istalpha       _ismbcalpha
  496. #define _istdigit       _ismbcdigit
  497. #define _istgraph       _ismbcgraph
  498. #define _istlower       _ismbclower
  499. #define _istprint       _ismbcprint
  500. #define _istpunct       _ismbcpunct
  501. #define _istspace       _ismbcspace
  502. #define _istupper       _ismbcupper
  503. #define _istlegal       _ismbclegal
  504.  
  505. #define _totlower       _mbctolower
  506. #define _totupper       _mbctoupper
  507.  
  508. #define _istlead        _ismbblead
  509. #define _istleadbyte    _ismbblead
  510.  
  511. /* @- */
  512. #else  /* _MBCS */
  513.  
  514. /* ------------------- SBCS functions ----------------------- */
  515.  
  516.  
  517. /* @+(SBCS) string functions */
  518.  
  519. #define _tcschr         strchr
  520. #define _tcscspn        strcspn
  521. #define _tcsncpy        strncpy
  522. #define _tcsncat        strncat
  523. #define _tcspbrk        strpbrk
  524. #define _tcsrchr        strrchr
  525. #define _tcsspn         strspn
  526. #define _tcsstr         strstr
  527. #define _tcstok         strtok
  528.  
  529. #define _tcsnset        strnset
  530. #define _tcsrev         strrev
  531. #define _tcsset         strset
  532.  
  533. #define _tcscmp         strcmp
  534. #define _tcsicmp        stricmp
  535. #define _tcsnccmp       strncmp
  536. #define _tcsncmp        strncmp
  537. #define _tcsncicmp      strnicmp
  538. #define _tcsnicmp       strnicmp
  539. #define _tcscmpi        strcmpi
  540. #define _tcsncmpi       strncmpi
  541.  
  542. #define _tcscoll        strcoll
  543. #define _tcsicoll       _stricoll
  544. #define _tcsnccoll      _strncoll
  545. #define _tcsncoll       _strncoll
  546. #define _tcsncicoll     _strnicoll
  547. #define _tcsnicoll      _strnicoll
  548. #define _tcsxfrm        strxfrm
  549.  
  550. #define _ltcscoll       _lstrcoll
  551. #define _ltcsicoll      _lstricoll
  552. #define _ltcsnccoll     _lstrncoll
  553. #define _ltcsncoll      _lstrncoll
  554. #define _ltcsncicoll    _lstrnicoll
  555. #define _ltcsnicoll     _lstrnicoll
  556. #define _ltcsxfrm       _lstrxfrm
  557.  
  558. /* A few MBCS-like functions */
  559.  
  560. #define _tcsdec         _strdec
  561. #define _tcsinc         _strinc
  562. #define _tcsnbcnt       _strncnt
  563. #define _tcsnccnt       _strncnt
  564. #define _tcsnextc       _strnextc
  565. #define _tcsninc        _strninc
  566. #define _tcsspnp        _strspnp
  567.  
  568. #define _tcslwr         strlwr
  569. #define _tcsupr         strupr
  570.  
  571. /* @!:_istlegal */
  572. /* @!:_istlead */
  573. /* @!:_istleadbyte */
  574.  
  575. #define _istlegal(__a)    (1)
  576. #define _istlead(__a)     (0)
  577. #define _istleadbyte(__a) (0)
  578.  
  579.  
  580. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  581.  
  582. /* @!:_tclen */
  583. /* @!:_tccpy */
  584. /* @!:_tccmp */
  585.  
  586. #define _tclen(__a)         (1)
  587. #define _tccpy(__a,__b)     ((*(__a))=(*(__b)))
  588. #define _tccmp(__a,__b)     ((*(__a))-(*(__b)))
  589.  
  590. #else  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  591.  
  592. inline _SIZE_T _RTLENTRY _tclen(const char *__s ){return (1); }
  593. inline void   _RTLENTRY _tccpy(char *__s1, const char *__s2) {*(__s1) = *(__s2); }
  594. inline int    _RTLENTRY _tccmp(const char *__s1, const char *__s2){ return (int) ( ((unsigned char*)__s1)-((unsigned char*)__s2)); }
  595.  
  596. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  597.  
  598. /* @: logical-character functions */
  599.  
  600. #define _tcsclen        strlen
  601. #define _tcsnccat       strncat
  602. #define _tcsnccpy       strncpy
  603. #define _tcsncset       strnset
  604.  
  605. /* @: ctype functions */
  606.  
  607. #define _istalnum       isalnum
  608. #define _istalpha       isalpha
  609. #define _istdigit       isdigit
  610. #define _istgraph       isgraph
  611. #define _istlower       islower
  612. #define _istprint       isprint
  613. #define _istpunct       ispunct
  614. #define _istspace       isspace
  615. #define _istupper       isupper
  616. #define _istascii       isascii
  617. #define _istcntrl       iscntrl
  618. #define _istxdigit      isxdigit
  619.  
  620. #define _totlower       tolower
  621. #define _totupper       toupper
  622.  
  623. #if (!defined (__cplusplus) || defined( _NO_INLINING ))
  624.  
  625. #define _strinc(__a)       ((__a)+1)
  626. #define _strdec(__a, __b)    ((__b)-1)
  627. #define _strnextc(__a)     ((unsigned int) ((__a) ? (__a)[0] : 0))
  628. #define _strninc(__a, __b)   ((__a)+(__b))
  629. #define _strncnt(__a, __b)   ((strlen(__a)>__b) ? __b : strlen(__a))
  630. #define _strspnp(__a, __b)   ((*((__a)+strspn(__a,__b))) ? ((__a)+strspn(__a,__b)) : NULL)
  631.  
  632. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  633.  
  634. inline char * _RTLENTRY strinc(const char * __s) { return (char *)(__s+1); }
  635. inline char * _RTLENTRY strdec(const char * __s1, const char * __s2) { return (char *)(__s1,(__s2-1)); }
  636.  
  637. inline char * _RTLENTRY _strinc(const char * __s) { return (char *)(__s+1); }
  638. inline char * _RTLENTRY _strdec(const char * __s1, const char * __s2) { return (char *)(__s1,(__s2-1)); }
  639. inline unsigned int _RTLENTRY _strnextc(const char *__s) { return (unsigned int) (__s ? __s[0] : 0); }
  640. inline char * _RTLENTRY _strninc(const char * __s, _SIZE_T __n) { return (char *)(__s+__n); }
  641. inline _SIZE_T _RTLENTRY _strncnt( const char * __s, _SIZE_T __n) { _SIZE_T __len; __len = strlen(__s); return (__len>__n) ? __n : __len; }
  642. inline char * _RTLENTRY _strspnp( const char * __s1, const char * __s2) { return (*(__s1 += strspn(__s1,__s2))!='\0') ? (char*)__s1 : NULL; }
  643.  
  644. #endif /* (!defined (__cplusplus) || defined( _NO_INLINING )) */
  645.  
  646. #endif /* _MBCS */
  647.  
  648. /* @- */
  649.  
  650. #else  /* _UNICODE */
  651.  
  652. #ifdef __cplusplus
  653. namespace std {
  654. #endif
  655.  
  656. /* @+(UNICODE) types */
  657.  
  658. #ifndef __TCHAR_DEFINED
  659. typedef wchar_t         _TCHAR;
  660. typedef wchar_t         _TSCHAR;
  661. typedef wchar_t         _TUCHAR;
  662. typedef wchar_t         _TXCHAR;
  663. typedef _WINT_T          _TINT;
  664. #define __TCHAR_DEFINED
  665. #endif
  666.  
  667. #ifdef __cplusplus
  668. } // std
  669. #endif
  670.  
  671. /* @: generic text macros */
  672. /* @!:__T */
  673. /* @!:_TEXT */
  674. /* @!:_T */
  675.  
  676. #define _TEOF             WEOF
  677. #define __T(__x)          L ## __x
  678. #define _TEXT(__x)        __T(__x)
  679. #define _T(__x)           __T(__x)
  680.  
  681. /* @: string functions */
  682.  
  683. #define _tcschr         wcschr
  684. #define _tcscspn        wcscspn
  685. #define _tcsncpy        wcsncpy
  686. #define _tcsncat        wcsncat
  687. #define _tcspbrk        wcspbrk
  688. #define _tcsrchr        wcsrchr
  689. #define _tcsspn         wcsspn
  690. #define _tcsstr         wcsstr
  691. #define _tcstok         wcstok
  692. #define _tcsnset        _wcsnset
  693. #define _tcsrev         _wcsrev
  694. #define _tcsset         _wcsset
  695. #define _tcscmp         wcscmp
  696. #define _tcsicmp        _wcsicmp
  697. #define _tcsnccmp       wcsncmp
  698. #define _tcsncmp        wcsncmp
  699. #define _tcsnicmp       _wcsnicmp
  700. #define _tcsncicmp      _wcsnicmp
  701. #define _tcscmpi        wcscmpi
  702. #define _tcsncmpi       wcsncmpi
  703. #define _tcscat         wcscat
  704. #define _tcscpy         wcscpy
  705. #define _tcspcpy        _wcspcpy
  706. #define _tcslen         wcslen
  707. #define _tcsdup         _wcsdup
  708. #define _tcslwr         _wcslwr
  709. #define _tcsupr         _wcsupr
  710. #define _totlower       towlower
  711. #define _totupper       towupper
  712.  
  713.  
  714. #define _tcsdec         _wcsdec
  715. #define _tcsinc         _wcsinc
  716. #define _tcsnbcnt       _wcsncnt
  717. #define _tcsnccnt       _wcsncnt
  718. #define _tcsnextc       _wcsnextc
  719. #define _tcsninc        _wcsninc
  720. #define _tcsspnp        _wcsspnp
  721.  
  722. #define _tcscoll        wcscoll
  723. #define _tcsicoll       _wcsicoll
  724. #define _tcsnccoll      _wcsncoll
  725. #define _tcsncoll       _wcsncoll
  726. #define _tcsncicoll     _wcsnicoll
  727. #define _tcsnicoll      _wcsnicoll
  728. #define _tcsxfrm        wcsxfrm
  729.  
  730. #define _ltcscoll       _lwcscoll
  731. #define _ltcsicoll      _lwcsicoll
  732. #define _ltcsnccoll     _lwcsncoll
  733. #define _ltcsncoll      _lwcsncoll
  734. #define _ltcsncicoll    _lwcsnicoll
  735. #define _ltcsnicoll     _lwcsnicoll
  736. #define _ltcsxfrm       _lwcsxfrm
  737.  
  738. /* @: time functions */
  739.  
  740. #define _tasctime       _wasctime
  741. #define _tutime         _wutime
  742. #define _tctime         _wctime
  743. #define _tstrdate       _wstrdate
  744. #define _tstrtime       _wstrtime
  745. #define _tcsftime       wcsftime
  746. #define _ttzset         _wtzset
  747. #define _ttzname        _wtzname
  748.  
  749. /* @: ctype functions */
  750.  
  751. #define _istalnum       iswalnum
  752. #define _istalpha       iswalpha
  753. #define _istdigit       iswdigit
  754. #define _istgraph       iswgraph
  755. #define _istlower       iswlower
  756. #define _istprint       iswprint
  757. #define _istpunct       iswpunct
  758. #define _istspace       iswspace
  759. #define _istupper       iswupper
  760. #define _istascii       iswascii
  761. #define _istcntrl       iswcntrl
  762. #define _istxdigit      iswxdigit
  763.  
  764. /* @!:_istlegal */
  765. /* @!:_istlead */
  766. /* @!:_istleadbyte */
  767.  
  768. #define _istlegal(__a)    (1)
  769. #define _istlead(__a)     (0)
  770. #define _istleadbyte(__a) (0)
  771.  
  772. /* @: process execution functions */
  773.  
  774. #define _texecl     _wexecl
  775. #define _texecle    _wexecle
  776. #define _texeclp    _wexeclp
  777. #define _texeclpe   _wexeclpe
  778. #define _texecv     _wexecv
  779. #define _texecve    _wexecve
  780. #define _texecvp    _wexecvp
  781. #define _texecvpe   _wexecvpe
  782.  
  783. #define _tspawnl    _wspawnl
  784. #define _tspawnle   _wspawnle
  785. #define _tspawnlp   _wspawnlp
  786. #define _tspawnlpe  _wspawnlpe
  787. #define _tspawnv    _wspawnv
  788. #define _tspawnve   _wspawnve
  789. #define _tspawnvp   _wspawnvp
  790. #define _tspawnvp   _wspawnvp
  791. #define _tspawnvpe  _wspawnvpe
  792.  
  793. #define _tsystem        _wsystem
  794.  
  795. /* @: path/environment specific functions  */
  796.  
  797. #define _tfullpath      _wfullpath
  798. #define _tsplitpath     _wsplitpath
  799. #define _tfnsplit       _wfnsplit
  800. #define _tfnmerge       _wfnmerge
  801. #define _tmakepath      _wmakepath
  802. #define _tsearchpath    wsearchpath
  803. #define _tsearchenv     _wsearchenv
  804. #define _tsearchstr     _wsearchstr
  805. #define _tgetenv        _wgetenv
  806. #define _tputenv        _wputenv
  807.  
  808. /* @: I/O functions   */
  809.  
  810. #define _taccess        _waccess
  811. #define _tchmod         _wchmod
  812. #define _trtl_open      _wrtl_open
  813. #define _trtl_creat     _wrtl_creat
  814. #define _trtl_chmod     _wrtl_chmod
  815. #define _tcreat         _wcreat
  816. #define __tcreat        __wcreat
  817. #define _tfindfirst     _wfindfirst
  818. #define _tfindnext      _wfindnext
  819. #define _tfindclose     _wfindclose
  820. #define __tfindfirsti64 _wfindfirsti64
  821. #define __tfindnexti64  _wfindnexti64
  822. #define __tfinddatai64_t _wfinddatai64_t
  823. #define __tfinddata_t   _wfinddata_t
  824. #define __tfindfirst    __wfindfirst
  825. #define __tfindnext     __wfindnext
  826.  
  827. #define _tmktemp        _wmktemp
  828. #define _topen          _wopen
  829. #define __topen         __wopen
  830. #define _tremove        _wremove
  831. #define _trename        _wrename
  832. #define _tsopen         _wsopen
  833. #define _tunlink        _wunlink
  834.  
  835. #define _tffblk         _wffblk
  836.  
  837. /* @: directory functions */
  838.  
  839. #define _topendir       wopendir
  840. #define _treaddir       wreaddir
  841. #define _trewinddir     wrewinddir
  842. #define _tclosedir      wclosedir
  843. #define _tDIR           wDIR
  844. #define _tdirent        wdirent
  845.  
  846. /* @: stdio functions   */
  847.  
  848. #define _tpopen         _wpopen
  849. #define _tfopen         _wfopen
  850. #define _tfsopen        _wfsopen
  851. #define _tfreopen       _wfreopen
  852. #define _tfdopen        _wfdopen
  853. #define _tperror        _wperror
  854. #define _ttmpnam        _wtmpnam
  855. #define _ttempnam       _wtempnam
  856.  
  857. /* @: program specific functions */
  858.  
  859. #define _tmain          wmain
  860. #define _tWinMain       wWinMain
  861. #define _tenviron       _wenviron
  862. #define _targv          _wargv
  863.  
  864. /* @: directory functions */
  865.  
  866. #define _tchdir     _wchdir
  867. #define _tgetcurdir _wgetcurdir
  868. #define _tgetcwd    _wgetcwd
  869. #define _tgetdcwd   _wgetdcwd
  870. #define _tmkdir     _wmkdir
  871. #define _trmdir     _wrmdir
  872.  
  873. /* @: string conversion functions */
  874.  
  875. #define _ttof           _wtof
  876. #define _ttoi           _wtoi
  877. #define _ttol           _wtol
  878. #define _ttoi64         _wtoi64
  879. #define _ttold          _wtold
  880. #define _tcstod         wcstod
  881. #define _tcstol         wcstol
  882. #define _tcstold        _wcstold
  883. #define _tcstoul        wcstoul
  884. #define _itot           _itow
  885. #define _ltot           _ltow
  886. #define _ultot          _ultow
  887. #define _i64tot         _i64tow
  888. #define _ui64tot        _ui64tow
  889.  
  890. /* @: stat functions */
  891.  
  892. #define _tstat          _wstat
  893. #define _tstati64       _wstati64
  894.  
  895. /* @: setlocale functions */
  896.  
  897. #define _tsetlocale _wsetlocale
  898.  
  899. /* @: memory functions */
  900.  
  901. #define _tmemcpy        _wmemcpy
  902. #define _tmemchr        _wmemchr
  903. #define _tmemset        _wmemset
  904.  
  905. /* @: unformated I/O */
  906.  
  907. #define _fgettc         fgetwc
  908. #define _gettc          getwc
  909. #define _fputtc         fputwc
  910. #define _puttc          putwc
  911. #define _fgettchar      _fgetwchar
  912. #define _fgetts         fgetws
  913. #define _fputtchar      _fputwchar
  914. #define _puttchar       putwchar
  915. #define _getts          _getws
  916. #define _fputts         fputws
  917. #define _gettchar       getwchar
  918. #define _putts          _putws
  919. #define _ungettc        ungetwc
  920.  
  921. /* @: formated I/O */
  922.  
  923. #define _tprintf        wprintf
  924. #define _vstprintf      vswprintf
  925. #define _stprintf       swprintf
  926. #define _ftprintf       fwprintf
  927. #define _vftprintf      vfwprintf
  928. #define _vtprintf       vwprintf
  929. #define _sntprintf      snwprintf
  930. #define _vsntprintf     vsnwprintf
  931. #define __sntprintf     _snwprintf     // MSC compat.
  932. #define __vsntprintf    _vsnwprintf    // MSC compat.
  933.  
  934.  
  935. #define _tscanf         wscanf
  936. #define _stscanf        swscanf
  937. #define _vstscanf       vswscanf
  938. #define _vtscanf        vwscanf
  939. #define _vftscanf       vfwscanf
  940. #define _ftscanf        fwscanf
  941.  
  942.  
  943. #define _wcsinc(__a)         ((__a)+1)
  944. #define _wcsdec(__a, __b)    ((__b)-1)
  945. #define _wcsnextc(__a)       ((wchar_t) ((__a) ? (__a)[0] : 0))
  946. #define _wcsninc(__a, __b)   ((__a)+(__b))
  947. #define _wcsncnt(__a, __b)   ((wcslen(__a)>__b) ? __b : wcslen(__a))
  948. #define _wcsspnp(__a, __b)   ((*((__a)+wcsspn(__a,__b))) ? ((__a)+wcsspn(__a,__b)) : NULL)
  949.  
  950. /* @- */
  951.  
  952. #endif /* _UNICODE */
  953.  
  954. #define __targv _targv  /* MS Compatibility */
  955.  
  956. #ifdef __cplusplus
  957. }
  958.     using std::_TCHAR;
  959.     using std::_TSCHAR;
  960.     using std::_TUCHAR;
  961.     using std::_TXCHAR;
  962.     using std::_TINT;
  963. #endif
  964.  
  965. #endif  /* __TCHAR_H */
  966.