tchar.mh
来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 1,026 行 · 第 1/2 页
MH
1,026 行
/*
* tchar.h Generic International Text Function Macros
*
:include crwat.sp
*/
#ifndef _TCHAR_H_INCLUDED
#define _TCHAR_H_INCLUDED
:include readonly.sp
:include null.sp
#ifndef _COMDEF_H_INCLUDED
#include <_comdef.h>
#endif
#ifndef _STRING_H_INCLUDED
#include <string.h>
#endif
#ifndef _TIME_H_INCLUDED
#include <time.h>
#endif
#if defined(_UNICODE) || defined(__UNICODE__)
// **************************** UNICODE **************************************
#ifndef _WCHAR_H_INCLUDED
#include <wchar.h>
#endif
:include cpluspro.sp
#ifndef __TCHAR_DEFINED
typedef wchar_t _TCHAR;
typedef wchar_t _TSCHAR;
typedef wchar_t _TUCHAR;
typedef wchar_t _TXCHAR;
typedef wchar_t _TINT;
#define __TCHAR_DEFINED
#endif
#ifndef _TCHAR_DEFINED
:include ext.sp
typedef wchar_t TCHAR;
#endif
#define _TCHAR_DEFINED
#endif
#define _TEOF WEOF
#define __T(x) L ## x
/* Program */
#define _tmain wmain
#define _tWinMain wWinMain
#define _tenviron _wenviron
#define __targc __wargc
#define __targv __wargv
/* Formatted i/o */
#define _tprintf wprintf
#define _ftprintf fwprintf
#define _vtprintf vwprintf
#define _vftprintf vfwprintf
#define _tscanf wscanf
#define _ftscanf fwscanf
#define _stscanf swscanf
#if defined(__cplusplus) && defined(__INLINE_FUNCTIONS__)
inline int _vstprintf( wchar_t *__p1, const wchar_t *__p2, __va_list __p3 ) {
return( vswprintf( __p1, 32767, __p2, __p3 ) );
}
#else
#define _vstprintf(__p1,__p2,__p3) vswprintf((__p1),32767,(__p2),(__p3))
#endif
_WCRTLINK extern int _stprintf(wchar_t *, const wchar_t *, ...);
/* Unformatted i/o */
#define _fgettc fgetwc
#define _fgettchar _fgetwchar
#define _fgetts fgetws
#define _fputtc fputwc
#define _fputtchar _fputwchar
#define _fputts fputws
#define _gettc getwc
#define _gettchar getwchar
#define _getts _getws
#define _puttc putwc
#define _puttchar putwchar
#define _putts _putws
#define _ungettc ungetwc
/* String conversion functions */
#define _tcstod wcstod
#define _tcstol wcstol
#define _tcstoul wcstoul
#define _itot _itow
#define _ltot _ltow
#define _ultot _ultow
#define _ttoi _wtoi
#define _ttol _wtol
/* String functions */
#define _tcscat wcscat
#define _tcschr wcschr
#define _tcscpy wcscpy
#define _tcscspn wcscspn
#define _tcslen wcslen
#define _tcsncat wcsncat
#define _tcsncpy wcsncpy
#define _tcspbrk wcspbrk
#define _tcsrchr wcsrchr
#define _tcsspn wcsspn
#define _tcsstr wcsstr
#if defined(__cplusplus) && defined(__INLINE_FUNCTIONS__)
inline wchar_t *_tcstok( wchar_t *__p1, const wchar_t *__p2 ) {
return( wcstok( __p1, __p2, NULL ) );
}
#else
#define _tcstok(__p1,__p2) wcstok((__p1),(__p2),NULL)
#endif
#define _tcsdup _wcsdup
#define _tcsnset _wcsnset
#define _tcsrev _wcsrev
#define _tcsset _wcsset
#define _tcscmp wcscmp
#define _tcsicmp _wcsicmp
#define _tcsnccmp wcsncmp
#define _tcsncmp wcsncmp
#define _tcsncicmp _wcsnicmp
#define _tcsnicmp _wcsnicmp
#define _tcscoll wcscoll
#define _tcsicoll _wcsicoll
#define _tcsnccoll _wcsncoll
#define _tcsncoll _wcsncoll
#define _tcsncicoll _wcsnicoll
#define _tcsnicoll _wcsnicoll
/* Execute functions */
#define _texecl _wexecl
#define _texecle _wexecle
#define _texeclp _wexeclp
#define _texeclpe _wexeclpe
#define _texecv _wexecv
#define _texecve _wexecve
#define _texecvp _wexecvp
#define _texecvpe _wexecvpe
#define _tspawnl _wspawnl
#define _tspawnle _wspawnle
#define _tspawnlp _wspawnlp
#define _tspawnlpe _wspawnlpe
#define _tspawnv _wspawnv
#define _tspawnve _wspawnve
#define _tspawnvp _wspawnvp
#define _tspawnvpe _wspawnvpe
#define _tsystem _wsystem
/* Time functions */
#define _tasctime _wasctime
#define _tctime _wctime
#define _tstrdate _wstrdate
#define _tstrtime _wstrtime
#define _tutime _wutime
#define _tcsftime wcsftime
/* Directory functions */
#define _tchdir _wchdir
#define _tclosedir _wclosedir
#define _tgetcwd _wgetcwd
#define _tgetdcwd _wgetdcwd
#define _tmkdir _wmkdir
#define _topendir _wopendir
#define _treaddir _wreaddir
#define _trewinddir _wrewinddir
#define _trmdir _wrmdir
/* Directory struct */
#define _tdirent _wdirent
/* Environment/Path functions */
#define _tfullpath _wfullpath
#define _tgetenv _wgetenv
#define _tmakepath _wmakepath
#define _tputenv _wputenv
#define _tsearchenv _wsearchenv
#define _tsplitpath _wsplitpath
/* Stdio functions */
#define _tfdopen _wfdopen
#define _tfsopen _wfsopen
#define _tfopen _wfopen
#define _tfreopen _wfreopen
#define _tperror _wperror
#define _ttmpnam _wtmpnam
/* Io functions */
#define _taccess _waccess
#define _tchmod _wchmod
#define _tcreat _wcreat
#define _tfindfirst _wfindfirst
#define _tfindfirsti64 _wfindfirsti64
#define _tfindnext _wfindnext
#define _tfindnexti64 _wfindnexti64
#define _topen _wopen
#define _tremove _wremove
#define _trename _wrename
#define _tsopen _wsopen
#define _tunlink _wunlink
#define _tfinddata_t _wfinddata_t
#define _tfinddatai64_t _wfinddatai64_t
/* Stat functions */
#define _tstat _wstat
#define _tstati64 _wstati64
#define _tfstat _wfstat
#define _tfstati64 _wfstati64
/* Setlocale functions */
#define _tsetlocale _wsetlocale
/* Redundant "logical-character" mappings */
#define _tcsclen wcslen
#define _tcsnccat wcsncat
#define _tcsnccpy wcsncpy
#define _tcsncset _wcsnset
#define _tcsdec _wcsdec
#define _tcsinc _wcsinc
#define _tcsnbcnt _wcsncnt
#define _tcsnccnt _wcsncnt
#define _tcsnextc _wcsnextc
#define _tcsninc _wcsninc
#define _tcsspnp _wcsspnp
#define _tcslwr _wcslwr
#define _tcsupr _wcsupr
#define _tcsxfrm wcsxfrm
#if defined(__cplusplus) && defined(__INLINE_FUNCTIONS__)
inline size_t _tclen( const wchar_t * ) {
return( 1 );
}
inline void _tccpy( wchar_t *__p1, const wchar_t *__p2 ) {
*__p1 = (wchar_t)*__p2;
}
inline int _tccmp( const wchar_t *__p1, const wchar_t *__p2 ) {
return( (int) ((*__p1)-(*__p2)) );
}
#else
#define _tclen(__p) (1)
#define _tccpy(__p1,__p2) ((*(__p1) = *(__p2)))
#define _tccmp(__p1,__p2) ((*(__p1))-(*(__p2)))
#endif
/* ctype functions */
#define _istalnum iswalnum
#define _istalpha iswalpha
#define _istascii iswascii
#define _istcntrl iswcntrl
#define _istdigit iswdigit
#define _istgraph iswgraph
#define _istlower iswlower
#define _istprint iswprint
#define _istpunct iswpunct
#define _istspace iswspace
#define _istupper iswupper
#define _istxdigit iswxdigit
#define _totupper towupper
#define _totlower towlower
#define _istlegal(_c) (1)
#define _istlead(_c) (0)
#define _istleadbyte(_c) (0)
#if defined(__cplusplus) && defined(__INLINE_FUNCTIONS__)
inline wchar_t *_wcsdec( const wchar_t *, const wchar_t *__p ) {
return( (wchar_t *)(__p-1) );
}
inline wchar_t *_wcsinc( const wchar_t *__p ) {
return( (wchar_t *)(__p+1) );
}
inline unsigned int _wcsnextc( const wchar_t *__p ) {
return( (unsigned int)*__p );
}
inline wchar_t *_wcsninc( const wchar_t *__p, size_t __l ) {
return( (wchar_t *)(__p+__l) );
}
inline size_t _wcsncnt( const wchar_t *__p, size_t __l ) {
size_t __i;
__i = wcslen(__p);
return( (__i>__l) ? __l : __i );
}
inline wchar_t *_wcsspnp( const wchar_t *__p1, const wchar_t *__p2 ) {
return( (*(__p1 += wcsspn(__p1,__p2))!='\0') ? (wchar_t*)__p1 : NULL );
}
#else
#define _wcsdec(__p1, __p2) ((__p2)-1)
#define _wcsinc(__p) ((__p)+1)
#define _wcsnextc(__p) ((unsigned int) *(__p))
#define _wcsninc(__p, __l) (((__p)+(__l)))
#define _wcsncnt(__p, __l) ((wcslen(__p)>__l) ? __l : wcslen(__p))
#define _wcsspnp(__p1, __p2) ((*((__p1)+wcsspn(__p1,__p2))) ? \
((__p1)+wcsspn(__p1,__p2)) : NULL)
#endif
#ifdef __cplusplus
namespace std {
#endif
_WMRTLINK extern double wcstod( const wchar_t *__nptr, wchar_t **__endptr );
_WCRTLINK extern long int wcstol( const wchar_t *, wchar_t **, int );
_WCRTLINK extern unsigned long int wcstoul( const wchar_t *, wchar_t **, int );
#ifdef __cplusplus
}
using std::wcstod;
using std::wcstol;
using std::wcstoul;
#endif
_WCRTLINK extern int _wcsicmp( const wchar_t *, const wchar_t * );
_WCRTLINK extern int _wcsnicmp( const wchar_t *, const wchar_t *, size_t );
_WCRTLINK extern wchar_t *_wcsdup( const wchar_t * );
_WCRTLINK extern wchar_t *_wcslwr( wchar_t * );
_WCRTLINK extern wchar_t *_wcsupr( wchar_t * );
_WCRTLINK extern wchar_t *_wcsset( wchar_t *, wchar_t );
_WCRTLINK extern wchar_t *_wcsnset( wchar_t *, int, size_t );
_WCRTLINK extern wchar_t *_wcsrev( wchar_t * );
:include cplusepi.sp
#else
// **************************** SBCS and MBCS ********************************
:include cpluspro.sp
#define _TEOF EOF
#define __T(x) x
/* Program */
#define _tmain main
#define _tWinMain WinMain
#define _tenviron environ
#define __targc __argc
#define __targv __argv
/* Formatted i/o */
#define _tprintf printf
#define _ftprintf fprintf
#define _stprintf sprintf
#define _vtprintf vprintf
#define _vftprintf vfprintf
#define _vstprintf vsprintf
#define _tscanf scanf
#define _ftscanf fscanf
#define _stscanf sscanf
/* Unformatted i/o */
#define _fgettc fgetc
#define _fgettchar _fgetchar
#define _fgetts fgets
#define _fputtc fputc
#define _fputtchar _fputchar
#define _fputts fputs
#define _gettc getc
#define _gettchar getchar
#define _getts gets
#define _puttc putc
#define _puttchar putchar
#define _putts puts
#define _ungettc ungetc
/* String conversion functions */
#define _tcstod strtod
#define _tcstol strtol
#define _tcstoul strtoul
#define _itot itoa
#define _ltot ltoa
#define _ultot ultoa
#define _ttoi atoi
#define _ttol atol
/* String functions */
#define _tcscat strcat
#define _tcscpy strcpy
#define _tcslen strlen
#define _tcsxfrm strxfrm
#define _tcsdup strdup
/* Execute functions */
#define _texecl execl
#define _texecle execle
#define _texeclp execlp
#define _texeclpe execlpe
#define _texecv execv
#define _texecve execve
#define _texecvp execvp
#define _texecvpe execvpe
#define _tspawnl spawnl
#define _tspawnle spawnle
#define _tspawnlp spawnlp
#define _tspawnlpe spawnlpe
#define _tspawnv spawnv
#define _tspawnve spawnve
#define _tspawnvp spawnvp
#define _tspawnvpe spawnvpe
#define _tsystem system
/* Time functions */
#define _tasctime asctime
#define _tctime ctime
#define _tstrdate _strdate
#define _tstrtime strtime
#define _tutime utime
#define _tcsftime strftime
/* Directory functions */
#define _tchdir chdir
#define _tclosedir closedir
#define _tgetcwd getcwd
#define _tgetdcwd getdcwd
#define _tmkdir mkdir
#define _topendir opendir
#define _treaddir readdir
#define _trewinddir rewinddir
#define _trmdir rmdir
/* Directory struct */
#define _tdirent dirent
/* Environment/Path functions */
#define _tfullpath _fullpath
#define _tgetenv getenv
#define _tmakepath _makepath
#define _tputenv putenv
#define _tsearchenv searchenv
#define _tsplitpath _splitpath
/* Stdio functions */
#define _tfdopen fdopen
#define _tfsopen _fsopen
#define _tfopen fopen
#define _tfreopen freopen
#define _tperror perror
#define _ttmpnam tmpnam
/* Io functions */
#define _taccess access
#define _tchmod chmod
#define _tcreat creat
#define _tfindfirst _findfirst
#define _tfindfirsti64 _findfirsti64
#define _tfindnext _findnext
#define _tfindnexti64 _findnexti64
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?