home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / TCHAR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-20  |  26.1 KB  |  819 lines

  1. /* $Copyright: 1995$ */
  2. /* $Revision:   8.33  $ */
  3.  
  4. #if !defined(__TCHAR_H)
  5. #define __TCHAR_H
  6.  
  7. #if !defined(__STDDEF_H)
  8. #include <stddef.h>
  9. #endif
  10.  
  11. #if !defined(___DEFS_H)
  12. #include <_defs.h>
  13. #endif
  14.  
  15. #if !defined(__STRING_H)
  16. #include <string.h>
  17. #endif
  18.  
  19. #ifdef  __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. #if defined(_MBCS)
  24. #include <mbstring.h>
  25. #endif
  26.  
  27. #if !defined(_UNICODE)
  28.  
  29. /* Common functions between SBCS & MBCS */
  30.  
  31. #ifndef __TCHAR_DEFINED
  32. typedef char            _TCHAR;
  33. typedef signed char     _TSCHAR;
  34. typedef unsigned char   _TUCHAR;
  35. typedef char            _TXCHAR;
  36. typedef int             _TINT;
  37. #define __TCHAR_DEFINED
  38. #endif
  39.  
  40. /* program specific mappings*/
  41.  
  42. #define _tmain          main
  43. #define _tWinMain       WinMain
  44. #define _tenviron       _environ
  45. #define _targv          _argv
  46.  
  47. /*  Path / Environment  specific mappings  */
  48.  
  49. #define _tfullpath      _fullpath
  50. #define _tmakepath      _makepath
  51. #define _tsplitpath     _splitpath
  52. #define _tsearchpath    searchpath
  53. #define _tsearchenv     _searchenv
  54. #define _tsearchstr     _searchstr
  55. #define _tgetenv        getenv
  56. #define _tputenv        putenv
  57.  
  58. /* stdio functions   */
  59.  
  60. #define _tpopen         _popen
  61. #define _tfdopen        fdopen
  62. #define _tfsopen        _fsopen
  63. #define _tfopen         fopen
  64. #define _tfreopen       freopen
  65. #define _tperror        perror
  66. #define _ttempnam       tempnam
  67. #define _ttmpnam        tmpnam
  68.  
  69. /* Time functions     */
  70.  
  71. #define _tstrdate       _strdate
  72. #define _tstrtime       _strtime
  73. #define _tasctime       asctime
  74. #define _tctime         ctime
  75. #define _tutime         utime
  76. #define _tcsftime       strftime
  77. #define _ttzset         tzset
  78. #define _ttzname        _tzname
  79.  
  80. /*  I/O functions   */
  81.  
  82. #define _taccess        access
  83. #define _tchmod         chmod
  84. #define _trtl_open      _rtl_open
  85. #define _trtl_creat     _rtl_creat
  86. #define _trtl_chmod     _rtl_chmod
  87. #define _tcreat         creat
  88. #define _tfindfirst     findfirst
  89. #define _tfindnext      findnext
  90. #define _tmktemp        mktemp
  91. #define _topen          open
  92.  
  93. #define _tremove        remove
  94. #define _trename        rename
  95. #define _tsopen         sopen
  96. #define _tunlink        unlink
  97.  
  98. #define _tffblk         ffblk
  99.  
  100. /* string conversion functions */
  101.  
  102. #define _ttof           atof
  103. #define _ttoi           atoi
  104. #define _ttol           atol
  105. #define _ttoi64         _atoi64
  106. #define _ttold          _atold
  107. #define _tcstod         strtod
  108. #define _tcstol         strtol
  109. #define _tcstold        _strtold
  110. #define _tcstoul        strtoul
  111. #define _itot           itoa
  112. #define _ltot           ltoa
  113. #define _ultot          ultoa
  114. #define _i64tot         _i64toa
  115. #define _ui64tot        _ui64toa
  116.  
  117. /* string functions  */
  118.  
  119. #define _tcscat         strcat
  120. #define _tcscpy         strcpy
  121. #define _tcspcpy        _stpcpy
  122. #define _tcslen         strlen
  123. #define _tcsdup         strdup
  124.  
  125. /* directory functions */
  126.  
  127. #define _tchdir         chdir
  128. #define _tgetcurdir     getcurdir
  129. #define _tgetcwd        getcwd
  130. #define _tgetdcwd       _getdcwd
  131. #define _tmkdir         mkdir
  132. #define _trmdir         rmdir
  133.  
  134. /* Execute functions */
  135.  
  136. #define _texecl     execl
  137. #define _texecle    execle
  138. #define _texeclp    execlp
  139. #define _texeclpe   execlpe
  140. #define _texecv     execv
  141. #define _texecve    execve
  142. #define _texecvp    execvp
  143. #define _texecvpe   execvpe
  144.  
  145. #define _tspawnl    spawnl
  146. #define _tspawnle   spawnle
  147. #define _tspawnlp   spawnlp
  148. #define _tspawnlpe  spawnlpe
  149. #define _tspawnv    spawnv
  150. #define _tspawnve   spawnve
  151. #define _tspawnvp   spawnvp
  152. #define _tspawnvpe  spawnvpe
  153.  
  154. #define _tsystem        system
  155.  
  156. /* Unformated I/O */
  157.  
  158. #define _fgettc         fgetc
  159. #define _fgettchar      fgetchar
  160. #define _fgetts         fgets
  161. #define _fputtc         fputc
  162. #define _fputtchar      fputchar
  163. #define _fputts         fputs
  164. #define _gettc          getc
  165. #define _gettchar       getchar
  166. #define _getts          gets
  167. #define _puttc          putc
  168. #define _puttchar       putchar
  169. #define _putts          puts
  170. #define _ungettc        ungetc
  171.  
  172. /* Formated I/O */
  173.  
  174. #define _ftprintf       fprintf
  175. #define _tprintf        printf
  176. #define _stprintf       sprintf
  177. #define _vtprintf       vprintf
  178. #define _vftprintf      vfprintf
  179. #define _vstprintf      vsprintf
  180.  
  181. #define _tscanf         scanf
  182. #define _stscanf        sscanf
  183. #define _ftscanf        fscanf
  184. #define _stscanf        sscanf
  185. #define _vstscanf       vsscanf
  186. #define _vtscanf        vscanf
  187. #define _vftscanf       vfscanf
  188.  
  189. /* Stat functions */
  190.  
  191. #define _tstat          stat
  192.  
  193. /* Setlocale functions */
  194.  
  195. #define _tsetlocale setlocale
  196.  
  197. /* memory functions */
  198.  
  199. #define _tmemcpy        memcpy
  200. #define _tmemchr        memchr
  201. #define _tmemset        memset
  202.  
  203. /* Generic Text macros */
  204.  
  205. #define __T(x)          x
  206. #define _TEXT(x)        __T(x)
  207. #define _T(x)           __T(x)
  208. #define _TEOF           EOF
  209.  
  210. #if defined(_MBCS)
  211.  
  212. /* ----------------- MBCS functions -------------------------- */
  213.  
  214. #ifndef __TCHAR_DEFINED
  215. typedef char            _TCHAR;
  216. typedef signed char     _TSCHAR;
  217. typedef unsigned char   _TUCHAR;
  218. typedef unsigned char   _TXCHAR;
  219. typedef unsigned int    _TINT;
  220. #define __TCHAR_DEFINED
  221. #endif
  222.  
  223. #ifdef _MBC_USE_MACROS
  224. /* string functions */
  225.  
  226. #define _tcschr         _mbschr
  227. #define _tcscspn        _mbscspn
  228. #define _tcsncat        _mbsnbcat
  229. #define _tcsncpy        _mbsnbcpy
  230. #define _tcspbrk        _mbspbrk
  231. #define _tcsrchr        _mbsrchr
  232. #define _tcsspn         _mbsspn
  233. #define _tcsstr         _mbsstr
  234. #define _tcstok         _mbstok
  235.  
  236. #define _tcsset         _mbsset
  237. #define _tcsnset        _mbsnbset
  238. #define _tcsrev         _mbsrev
  239. #define _tcscmp         _mbscmp
  240. #define _tcsicmp        _mbsicmp
  241. #define _tcsncmp        _mbsnbcmp
  242. #define _tcsnicmp       _mbsnbicmp
  243. #define _tcsnccmp       _mbsncmp
  244. #define _tcsncicmp      _mbsnicmp
  245.  
  246. /* todo : correct the mapping of these functions and add the new functions */
  247. #define _tcscoll        _mbscoll
  248. #define _tcsncoll       _mbsnbcoll
  249. #define _tcsnccoll      _mbsncoll
  250. #define _tcsicoll       _mbsicoll
  251. #define _tcsnicoll      _mbsnbicoll
  252. #define _tcsncicoll     _mbsnicoll
  253.  
  254. /* logical-character mappings */
  255.  
  256. #define _tcsclen        _mbslen
  257. #define _tcsnccat       _mbsncat
  258. #define _tcsnccpy       _mbsncpy
  259. #define _tcsncset       _mbsnset
  260.  
  261. /* MBCS specific mappings */
  262.  
  263. #define _tcsdec         _mbsdec
  264. #define _tcsinc         _mbsinc
  265. #define _tcsnbcnt       _mbsnbcnt
  266. #define _tcsnccnt       _mbsnccnt
  267. #define _tcsnextc       _mbsnextc
  268. #define _tcsninc        _mbsninc
  269. #define _tcsspnp        _mbsspnp
  270.  
  271. #define _tcslwr         _mbslwr
  272. #define _tcsupr         _mbsupr
  273.  
  274. #define _tclen          _mbclen
  275. #define _tccpy          _mbccpy
  276. #define _tccmp(a,b)     _mbsncmp(a,b,1)
  277.  
  278. #else /* _MBC_USE_MACROS */
  279.  
  280. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  281.  
  282. /* String functions */
  283.  
  284. char * _RTLENTRY  _EXPFUNC _tcschr(const char *, unsigned int);
  285. size_t _RTLENTRY  _EXPFUNC _tcscspn(const char *, const char *);
  286. char * _RTLENTRY  _EXPFUNC _tcsncat(char *, const char *, size_t);
  287. char * _RTLENTRY  _EXPFUNC _tcsncpy(char *, const char *, size_t);
  288. char * _RTLENTRY  _EXPFUNC _tcspbrk(const char *, const char *);
  289. char * _RTLENTRY  _EXPFUNC _tcsrchr(const char *, int);
  290. size_t _RTLENTRY  _EXPFUNC _tcsspn(const char *, const char *);
  291. char * _RTLENTRY  _EXPFUNC _tcsstr(const char *, const char *);
  292. char * _RTLENTRY  _EXPFUNC _tcstok(char *, const char *);
  293.  
  294. char * _RTLENTRY  _EXPFUNC _tcsnset(char *, unsigned int, size_t);
  295. char * _RTLENTRY  _EXPFUNC _tcsrev(char *);
  296. char * _RTLENTRY  _EXPFUNC _tcsset(char *, unsigned int);
  297.  
  298. int _RTLENTRY  _EXPFUNC _tcscmp(const char *, const char *);
  299. int _RTLENTRY  _EXPFUNC _tcsicmp(const char *, const char *);
  300. int _RTLENTRY  _EXPFUNC _tcsnccmp(const char *, const char *, size_t);
  301. int _RTLENTRY  _EXPFUNC _tcsncmp(const char *, const char *, size_t);
  302. int _RTLENTRY  _EXPFUNC _tcsncicmp(const char *, const char *, size_t);
  303. int _RTLENTRY  _EXPFUNC _tcsnicmp(const char *, const char *, size_t);
  304.  
  305. int _RTLENTRY  _EXPFUNC _tcscoll(const char *, const char *);
  306. int _RTLENTRY  _EXPFUNC _tcsicoll(const char *, const char *);
  307. int _RTLENTRY  _EXPFUNC _tcsnccoll(const char *, const char *, size_t);
  308. int _RTLENTRY  _EXPFUNC _tcsncoll(const char *, const char *, size_t);
  309. int _RTLENTRY  _EXPFUNC _tcsncicoll(const char *, const char *, size_t);
  310. int _RTLENTRY  _EXPFUNC _tcsnicoll(const char *, const char *, size_t);
  311.  
  312.  
  313. /* "logical-character" mappings */
  314.  
  315. size_t _RTLENTRY  _EXPFUNC _tcsclen(const char *);
  316. char * _RTLENTRY  _EXPFUNC _tcsnccat(char *, const char *, size_t);
  317. char * _RTLENTRY  _EXPFUNC _tcsnccpy(char *, const char *, size_t);
  318. char * _RTLENTRY  _EXPFUNC _tcsncset(char *, unsigned int, size_t);
  319.  
  320.  
  321. /* MBCS-specific mappings */
  322.  
  323. char * _RTLENTRY  _EXPFUNC _tcsdec(const char *, const char *);
  324. char * _RTLENTRY  _EXPFUNC _tcsinc(const char *);
  325. size_t _RTLENTRY  _EXPFUNC _tcsnbcnt(const char *, size_t);
  326. size_t _RTLENTRY  _EXPFUNC _tcsnccnt(const char *, size_t);
  327. unsigned int _RTLENTRY  _EXPFUNC _tcsnextc (const char *);
  328. char * _RTLENTRY  _EXPFUNC _tcsninc(const char *, size_t);
  329. char * _RTLENTRY  _EXPFUNC _tcsspnp(const char *, const char *);
  330.  
  331. char * _RTLENTRY  _EXPFUNC _tcslwr(char *);
  332. char * _RTLENTRY  _EXPFUNC _tcsupr(char *);
  333.  
  334. size_t _RTLENTRY  _EXPFUNC _tclen(const char *);
  335. void   _RTLENTRY  _EXPFUNC _tccpy(char *, const char *);
  336. int    _RTLENTRY  _EXPFUNC _tccmp(const char *s1, const char *s2);
  337.  
  338. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  339.  
  340. inline char * _tcschr(const char * s1,unsigned int c) {return (char *)_mbschr((const unsigned char *)s1,c);}
  341. inline size_t _tcscspn(const char * s1,const char * s2) {return _mbscspn((const unsigned char *)s1,(const unsigned char *)s2);}
  342. inline char * _tcsncat(char * s1,const char * s2,size_t n) {return (char *)_mbsnbcat((unsigned char *)s1,(const unsigned char *)s2,n);}
  343. inline char * _tcsncpy(char * s1,const char * s2,size_t n) {return (char *)_mbsnbcpy((unsigned char *)s1,(const unsigned char *)s2,n);}
  344. inline char * _tcspbrk(const char * s1,const char * s2) {return (char *)_mbspbrk((const unsigned char *)s1,(const unsigned char *)s2);}
  345. inline char * _tcsrchr(const char * s1,unsigned int c) {return (char *)_mbsrchr((const unsigned char *)s1,c);}
  346. inline size_t _tcsspn(const char * s1,const char * s2) {return _mbsspn((const unsigned char *)s1,(const unsigned char *)s2);}
  347. inline char * _tcsstr(const char * s1,const char * s2) {return (char *)_mbsstr((const unsigned char *)s1,(const unsigned char *)s2);}
  348. inline char * _tcstok(char * s1,const char * s2) {return (char *)_mbstok((unsigned char *)s1,(const unsigned char *)s2);}
  349.  
  350. inline char * _tcsnset(char * s1,unsigned int c,size_t n) {return (char *)_mbsnbset((unsigned char *)s1,c,n);}
  351. inline char * _tcsrev(char * s1) {return (char *)_mbsrev((unsigned char *)s1);}
  352. inline char * _tcsset(char * s1,unsigned int c) {return (char *)_mbsset((unsigned char *)s1,c);}
  353.  
  354. inline int _tcscmp(const char * s1,const char * s2) {return _mbscmp((const unsigned char *)s1,(const unsigned char *)s2);}
  355. inline int _tcsicmp(const char * s1,const char * s2) {return _mbsicmp((const unsigned char *)s1,(const unsigned char *)s2);}
  356. inline int _tcsnccmp(const char * s1,const char * s2,size_t n) {return _mbsncmp((const unsigned char *)s1,(const unsigned char *)s2,n);}
  357. inline int _tcsncmp(const char * s1,const char * s2,size_t n) {return _mbsnbcmp((const unsigned char *)s1,(const unsigned char *)s2,n);}
  358. inline int _tcsncicmp(const char * s1,const char * s2,size_t n) {return _mbsnicmp((const unsigned char *)s1,(const unsigned char *)s2,n);}
  359. inline int _tcsnicmp(const char * s1,const char * s2,size_t n) {return _mbsnbicmp((const unsigned char *)s1,(const unsigned char *)s2,n);}
  360.  
  361. inline int _tcscoll(const char * s1,const char * s2) {return _mbscoll((const unsigned char *)s1,(const unsigned char *)s2);}
  362. inline int _tcsicoll(const char * s1,const char * s2) {return _mbsicoll((const unsigned char *)s1,(const unsigned char *)s2);}
  363. inline int _tcsnccoll(const char * s1,const char * s2,size_t n) {return _mbsncoll((const unsigned char *)s1,(const unsigned char *)s2,n);}
  364. inline int _tcsncoll(const char * s1,const char * s2,size_t n) {return _mbsnbcoll((const unsigned char *)s1,(const unsigned char *)s2,n);}
  365. inline int _tcsncicoll(const char * s1,const char * s2,size_t n) {return _mbsnicoll((const unsigned char *)s1,(const unsigned char *)s2,n);}
  366. inline int _tcsnicoll(const char * s1,const char * s2,size_t n) {return _mbsnbicoll((const unsigned char *)s1,(const unsigned char *)s2,n);}
  367.  
  368.  
  369. /* logical-character mappings */
  370.  
  371. inline size_t _tcsclen(const char * s1) {return _mbslen((const unsigned char *)s1);}
  372. inline char * _tcsnccat(char * s1,const char * s2,size_t n) {return (char *)_mbsncat((unsigned char *)s1,(const unsigned char *)s2,n);}
  373. inline char * _tcsnccpy(char * s1,const char * s2,size_t n) {return (char *)_mbsncpy((unsigned char *)s1,(const unsigned char *)s2,n);}
  374. inline char * _tcsncset(char * s1,unsigned int c,size_t n) {return (char *)_mbsnset((unsigned char *)s1,c,n);}
  375.  
  376.  
  377. /* MBCS-specific mappings */
  378.  
  379. inline char * _tcsdec(const char * s1,const char * s2) {return (char *)_mbsdec((const unsigned char *)s1,(const unsigned char *)s2);}
  380. inline char * _tcsinc(const char * s1) {return (char *)_mbsinc((const unsigned char *)s1);}
  381. inline size_t _tcsnbcnt(const char * s1,size_t n) {return _mbsnbcnt((const unsigned char *)s1,n);}
  382. inline size_t _tcsnccnt(const char * s1,size_t n) {return _mbsnccnt((const unsigned char *)s1,n);}
  383.  
  384. inline unsigned int _tcsnextc(const char * s1) {unsigned int n=0; if (_ismbblead((unsigned int)*(unsigned char *)s1)) n=((unsigned int)*s1++)<<8; n+=(unsigned int)*s1; return(n);}
  385.  
  386. inline char * _tcsninc(const char * s1,size_t n) {return (char *)_mbsninc((const unsigned char *)s1,n);}
  387. inline char * _tcsspnp(const char * s1,const char * s2) {return (char *)_mbsspnp((const unsigned char *)s1,(const unsigned char *)s2);}
  388. inline char * _tcslwr(char * s1) {return (char *)_mbslwr((unsigned char *)s1);}
  389. inline char * _tcsupr(char * s1) {return (char *)_mbsupr((unsigned char *)s1);}
  390.  
  391. inline size_t _tclen(const char * s1) {return _mbclen((const unsigned char *)s1);}
  392. inline void   _tccpy(char * s1,const char * s2) {_mbccpy((unsigned char *)s1,(const unsigned char *)s2); return;}
  393. inline int    _tccmp(const char *s1, const char *s2){ return  _mbsncmp((const unsigned char *)s1,(const unsigned char *)s2,1);}
  394.  
  395. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  396.  
  397. #endif  /* _MBC_USE_MACROS */
  398.  
  399. /* ctype functions */
  400. #define _istalnum       _ismbcalnum
  401. #define _istalpha       _ismbcalpha
  402. #define _istdigit       _ismbcdigit
  403. #define _istgraph       _ismbcgraph
  404. #define _istlower       _ismbclower
  405. #define _istprint       _ismbcprint
  406. #define _istpunct       _ismbcpunct
  407. #define _istspace       _ismbcspace
  408. #define _istupper       _ismbcupper
  409. #define _istlegal       _ismbclegal
  410.  
  411. #define _totlower       _mbctolower
  412. #define _totupper       _mbctoupper
  413.  
  414. #define _istlead        _ismbblead
  415. #define _istleadbyte    _ismbblead
  416.  
  417. #else  /* _MBCS */
  418.  
  419. /* ------------------- SBCS functions ----------------------- */
  420.  
  421.  
  422. /*  Path / Environment  specific mappings  */
  423.  
  424. #define _tfnsplit       fnsplit
  425.  
  426. /*  I/O functions   */
  427.  
  428. #define _trtl_open      _rtl_open
  429. #define _trtl_creat     _rtl_creat
  430. #define _trtl_chmod     _rtl_chmod
  431.  
  432. /* string functions */
  433.  
  434. #define _tcschr         strchr
  435. #define _tcscspn        strcspn
  436. #define _tcsncpy        strncpy
  437. #define _tcsncat        strncat
  438. #define _tcspbrk        strpbrk
  439. #define _tcsrchr        strrchr
  440. #define _tcsspn         strspn
  441. #define _tcsstr         strstr
  442. #define _tcstok         strtok
  443.  
  444. #define _tcsnset        strnset
  445. #define _tcsrev         strrev
  446. #define _tcsset         strset
  447.  
  448. #define _tcscmp         strcmp
  449. #define _tcsicmp        stricmp
  450. #define _tcsnccmp       strncmp
  451. #define _tcsncmp        strncmp
  452. #define _tcsncicmp      strnicmp
  453. #define _tcsnicmp       strnicmp
  454.  
  455. #define _tcscoll        strcoll
  456. #define _tcsicoll       _stricoll
  457. #define _tcsnccoll      _strncoll
  458. #define _tcsncoll       _strncoll
  459. #define _tcsncicoll     _strnicoll
  460. #define _tcsnicoll      _strnicoll
  461. #define _tcsxfrm        strxfrm
  462.  
  463. #define _ltcscoll       lstrcoll
  464. #define _ltcsicoll      _lstricoll
  465. #define _ltcsnccoll     _lstrncoll
  466. #define _ltcsncoll      _lstrncoll
  467. #define _ltcsncicoll    _lstrnicoll
  468. #define _ltcsnicoll     _lstrnicoll
  469. #define _ltcsxfrm       lstrxfrm
  470.  
  471. /* MBCS specific functions */
  472.  
  473. #define _tcsdec         _strdec
  474. #define _tcsinc         _strinc
  475. #define _tcsnbcnt       _strncnt
  476. #define _tcsnccnt       _strncnt
  477. #define _tcsnextc       _strnextc
  478. #define _tcsninc        _strninc
  479. #define _tcsspnp        _strspnp
  480.  
  481. #define _tcslwr         strlwr
  482. #define _tcsupr         strupr
  483.  
  484. #define _istlegal(a)    (1)
  485. #define _istlead(a)     (0)
  486. #define _istleadbyte(a) (0)
  487.  
  488.  
  489. #if (!defined ( __cplusplus) || defined( _NO_INLINING ))
  490.  
  491. #define _tclen(a)       (1)
  492. #define _tccpy(a,b)     ((*(a))=(*(b)))
  493. #define _tccmp(a,b)     ((*(a))-(*(b)))
  494.  
  495. #else  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  496.  
  497. inline size_t _RTLENTRY _tclen(const char *s ){return (1); }
  498. inline void   _RTLENTRY _tccpy(char *s1, const char *s2) {*(s1) = *(s2); }
  499. inline int    _RTLENTRY _tccmp(const char *s1, const char *s2){ return (int) ( ((unsigned char*)s1)-((unsigned char*)s2)); }
  500.  
  501. #endif  /* (!defined ( __cplusplus) || defined( _NO_INLINING )) */
  502.  
  503. /* logical-character mappings */
  504.  
  505. #define _tcsclen        strlen
  506. #define _tcsnccat       strncat
  507. #define _tcsnccpy       strncpy
  508. #define _tcsncset       strnset
  509.  
  510. /* ctype functions */
  511.  
  512. #define _istalnum       isalnum
  513. #define _istalpha       isalpha
  514. #define _istdigit       isdigit
  515. #define _istgraph       isgraph
  516. #define _istlower       islower
  517. #define _istprint       isprint
  518. #define _istpunct       ispunct
  519. #define _istspace       isspace
  520. #define _istupper       isupper
  521. #define _istascii       isascii
  522. #define _istcntrl       iscntrl
  523. #define _istxdigit      isxdigit
  524.  
  525. #define _totlower       tolower
  526. #define _totupper       toupper
  527.  
  528. #if (!defined (__cplusplus) || defined( _NO_INLINING ))
  529.  
  530. #define _strinc(a)       ((a)+1)
  531. #define _strdec(a, b)    ((b)-1)
  532.  
  533. #define _strinc(a)       ((a)+1)
  534. #define _strdec(a, b)    ((b)-1)
  535. #define _strnextc(a)     ((unsigned int) *(a))
  536. #define _strninc(a, b)   ((a)+(b))
  537. #define _strncnt(a, b)   ((strlen(a)>b) ? b : strlen(a))
  538. #define _strspnp(a, b)   ((*((a)+strspn(a,b))) ? ((a)+strspn(a,b)) : NULL)
  539.  
  540. #else  /* (!defined( __cplusplus) || defined( _NO_INLINING )) */
  541.  
  542. inline char * _RTLENTRY strinc(const char * s) { return (char *)(s+1); }
  543. inline char * _RTLENTRY strdec(const char * s1, const char * s2) { return (char *)(s1,(s2-1)); }
  544.  
  545. inline char * _RTLENTRY _strinc(const char * s) { return (char *)(s+1); }
  546. inline char * _RTLENTRY _strdec(const char * s1, const char * s2) { return (char *)(s1,(s2-1)); }
  547. inline unsigned int _RTLENTRY _strnextc(const char *s) { return (unsigned int)*s; }
  548. inline char * _RTLENTRY _strninc(const char * s, size_t n) { return (char *)(s+n); }
  549. inline size_t _RTLENTRY _strncnt( const char * s, size_t n) { size_t len; len = strlen(s); return (len>n) ? n : len; }
  550. inline char * _RTLENTRY _strspnp( const char * s1, const char * s2) { return (*(s1 += strspn(s1,s2))!='\0') ? (char*)s1 : NULL; }
  551.  
  552. #endif /* (!defined (__cplusplus) || defined( _NO_INLINING )) */
  553.  
  554. #endif /* _MBCS */
  555.  
  556. #else  /* _UNICODE */
  557.  
  558. #if !defined(_WINT_T)
  559. typedef unsigned short wint_t;
  560. #define _WINT_T
  561. #endif
  562.  
  563. #ifndef _WCTYPE_T_DEFINED
  564. typedef wchar_t wctype_t;
  565. #define _WCTYPE_T_DEFINED
  566. #endif
  567.  
  568. #ifndef __TCHAR_DEFINED
  569. typedef wchar_t         _TCHAR;
  570. typedef wchar_t         _TSCHAR;
  571. typedef wchar_t         _TUCHAR;
  572. typedef wchar_t         _TXCHAR;
  573. typedef wint_t          _TINT;
  574. #define __TCHAR_DEFINED
  575. #endif
  576.  
  577. #define _TEOF           WEOF
  578. #define __T(x)          L ## x
  579. #define _TEXT(x)        __T(x)
  580. #define _T(x)           __T(x)
  581.  
  582. /* string functions */
  583.  
  584. #define _tcschr         wcschr
  585. #define _tcscspn        wcscspn
  586. #define _tcsncpy        wcsncpy
  587. #define _tcsncat        wcsncat
  588. #define _tcspbrk        wcspbrk
  589. #define _tcsrchr        wcsrchr
  590. #define _tcsspn         wcsspn
  591. #define _tcsstr         wcsstr
  592. #define _tcstok         wcstok
  593. #define _tcsnset        _wcsnset
  594. #define _tcsrev         _wcsrev
  595. #define _tcsset         _wcsset
  596. #define _tcscmp         wcscmp
  597. #define _tcsicmp        wcsicmp
  598. #define _tcsncmp        wcsncmp
  599. #define _tcsnicmp       wcsnicmp
  600. #define _tcscat         wcscat
  601. #define _tcscpy         wcscpy
  602. #define _tcspcpy        _wcspcpy
  603. #define _tcslen         wcslen
  604. #define _tcsdup         _wcsdup
  605. #define _tcslwr         _wcslwr
  606. #define _tcsupr         _wcsupr
  607.  
  608. #define _tcsdec         _wcsdec
  609. #define _tcsinc         _wcsinc
  610. #define _tcsnbcnt       _wcsncnt
  611. #define _tcsnccnt       _wcsncnt
  612. #define _tcsnextc       _wcsnextc
  613. #define _tcsninc        _wcsninc
  614. #define _tcsspnp        _wcsspnp
  615.  
  616. #define _tcscoll        wcscoll
  617. #define _tcsicoll       _wcsicoll
  618. #define _tcsnccoll      _wcsncoll
  619. #define _tcsncoll       _wcsncoll
  620. #define _tcsncicoll     _wcsnicoll
  621. #define _tcsnicoll      _wcsnicoll
  622. #define _tcsxfrm        wcsxfrm
  623.  
  624. #define _ltcscoll       lwcscoll
  625. #define _ltcsicoll      _lwcsicoll
  626. #define _ltcsnccoll     _lwcsncoll
  627. #define _ltcsncoll      _lwcsncoll
  628. #define _ltcsncicoll    _lwcsnicoll
  629. #define _ltcsnicoll     _lwcsnicoll
  630. #define _ltcsxfrm       lwcsxfrm
  631.  
  632. /* time functions */
  633.  
  634. #define _tasctime       _wasctime
  635. #define _tutime         _wutime
  636. #define _tctime         _wctime
  637. #define _tstrdate       _wstrdate
  638. #define _tstrtime       _wstrtime
  639. #define _tcsftime       wcsftime
  640. #define _ttzset         _wtzset
  641. #define _ttzname        _wtzname
  642.  
  643. /* ctype functions */
  644.  
  645. #define _istalnum       _iswalnum
  646. #define _istalpha       _iswalpha
  647. #define _istdigit       _iswdigit
  648. #define _istgraph       _iswgraph
  649. #define _istlower       _iswlower
  650. #define _istprint       _iswprint
  651. #define _istpunct       _iswpunct
  652. #define _istspace       _iswspace
  653. #define _istupper       _iswupper
  654. #define _istascii       _iswascii
  655. #define _istcntrl       _iswcntrl
  656. #define _istxdigit      _iswxdigit
  657.  
  658. #define _totlower       towlower
  659. #define _totupper       towupper
  660.  
  661. /* Execute functions */
  662.  
  663. #define _texecl     _wexecl
  664. #define _texecle    _wexecle
  665. #define _texeclp    _wexeclp
  666. #define _texeclpe   _wexeclpe
  667. #define _texecv     _wexecv
  668. #define _texecve    _wexecve
  669. #define _texecvp    _wexecvp
  670. #define _texecvpe   _wexecvpe
  671.  
  672. #define _tspawnl    _wspawnl
  673. #define _tspawnle   _wspawnle
  674. #define _tspawnlp   _wspawnlp
  675. #define _tspawnlpe  _wspawnlpe
  676. #define _tspawnv    _wspawnv
  677. #define _tspawnve   _wspawnve
  678. #define _tspawnvp   _wspawnvp
  679. #define _tspawnvp   _wspawnvp
  680. #define _tspawnvpe  _wspawnvpe
  681.  
  682. #define _tsystem        _wsystem
  683.  
  684. /*  Path / Environment  specific mappings  */
  685.  
  686. #define _tfullpath      _wfullpath
  687. #define _tsplitpath     _wsplitpath
  688. #define _tfnsplit       _wfnsplit
  689. #define _tmakepath      _wmakepath
  690. #define _tsearchpath    wsearchpath
  691. #define _tsearchenv     _wsearchenv
  692. #define _tsearchstr     _wsearchstr
  693. #define _tgetenv        _wgetenv
  694. #define _tputenv        _wputenv
  695.  
  696. /*  I/O functions   */
  697.  
  698. #define _taccess        _waccess
  699. #define _tcreat         _wcreat
  700. #define _tchmod         _wchmod
  701. #define _trtl_open      _wrtl_open
  702. #define _trtl_creat     _wrtl_creat
  703. #define _trtl_chmod     _wrtl_chmod
  704. #define _topen          _wopen
  705. #define _tunlink        _wunlink
  706. #define _trename        _wrename
  707. #define _tremove        _wremove
  708. #define _tfindfirst     _wfindfirst
  709. #define _tfindnext      _wfindnext
  710. #define _tmktemp        _wmktemp
  711.  
  712. #define _tffblk         _wffblk
  713.  
  714. /* stdio functions   */
  715.  
  716. #define _tpopen         _wpopen
  717. #define _tfopen         _wfopen
  718. #define _tfsopen        _wfsopen
  719. #define _tfreopen       _wfreopen
  720. #define _tfdopen        _wfdopen
  721. #define _tperror        _wperror
  722. #define _ttmpnam        _wtmpnam
  723. #define _ttempnam       _wtempnam
  724.  
  725. /* program specific mappings*/
  726.  
  727. #define _tmain          wmain
  728. #define _tWinMain       wWinMain
  729. #define _tenviron       _wenviron
  730. #define _targv          _wargv
  731.  
  732. /* Directory functions */
  733.  
  734. #define _tchdir     _wchdir
  735. #define _tgetcurdir _wgetcurdir
  736. #define _tgetcwd    _wgetcwd
  737. #define _tgetdcwd   _wgetdcwd
  738. #define _tmkdir     _wmkdir
  739. #define _trmdir     _wrmdir
  740.  
  741. /* string conversion functions */
  742.  
  743. #define _ttof           _wtof
  744. #define _ttoi           _wtoi
  745. #define _ttol           _wtol
  746. #define _ttoi64         _wtoi64
  747. #define _ttold          _wtold
  748. #define _tcstod         wcstod
  749. #define _tcstol         wcstol
  750. #define _tcstold        _wcstold
  751. #define _tcstoul        wcstoul
  752. #define _itot           _itow
  753. #define _ltot           _ltow
  754. #define _ultot          _ultow
  755. #define _i64tot         _i64tow
  756. #define _ui64tot        _ui64tow
  757.  
  758. /* Stat functions */
  759.  
  760. #define _tstat          _wstat
  761.  
  762. /* Setlocale functions */
  763.  
  764. #define _tsetlocale _wsetlocale
  765.  
  766. /* memory functions */
  767.  
  768. #define _tmemcpy        _wmemcpy
  769. #define _tmemchr        _wmemchr
  770. #define _tmemset        _wmemset
  771.  
  772. /* Unformated I/O */
  773.  
  774. #define _fgettc         fgetwc
  775. #define _gettc          getwc
  776. #define _fputtc         fputwc
  777. #define _puttc          putwc
  778. #define _fgettchar      _fgetwchar
  779. #define _fgetts         fgetws
  780. #define _fputtchar      _fputwchar
  781. #define _puttchar       putwchar
  782. #define _getts          _getws
  783. #define _fputts         fputws
  784. #define _gettchar       getwchar
  785. #define _putts          _putws
  786. #define _ungettc        ungetwc
  787.  
  788. /* Formated I/O */
  789. #define _tprintf        wprintf
  790. #define _vstprintf      vswprintf
  791. #define _stprintf       swprintf
  792. #define _ftprintf       fwprintf
  793. #define _vftprintf      vfwprintf
  794. #define _vtprintf       vwprintf
  795.  
  796.  
  797. #define _tscanf         wscanf
  798. #define _stscanf        swscanf
  799. #define _vstscanf       vswscanf
  800. #define _vtscanf        vwscanf
  801. #define _vftscanf       vfwscanf
  802. #define _ftscanf        fwscanf
  803.  
  804.  
  805. #define _wcsinc(a)       ((a)+1)
  806. #define _wcsdec(a, b)    ((b)-1)
  807. #define _wcsnextc(a)     ((wchar_t int) *(a))
  808. #define _wcsninc(a, b)   ((a)+(b))
  809. #define _wcsncnt(a, b)   ((wcslen(a)>b) ? b : wcslen(a))
  810. #define _wcsspnp(a, b)   ((*((a)+wcsspn(a,b))) ? ((a)+wcsspn(a,b)) : NULL)
  811.  
  812. #endif /* _UNCODE */
  813.  
  814. #ifdef __cplusplus
  815. }
  816. #endif
  817.  
  818. #endif  /* __TCHAR_H */
  819.