ctype.mh
来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 154 行
MH
154 行
/***************************************************************************
* FILE: ctype.h/cctype (Character Handling)
*
:include crwat.sp
*
* Description: This header is part of the C/C++ standard library. It
* declares several character classification functions.
***************************************************************************/
:segment CNAME
#ifndef _CCTYPE_INCLUDED
#define _CCTYPE_INCLUDED
#ifndef __cplusplus
#error the header cctype requires C++
#endif
:elsesegment
#ifndef _CTYPE_H_INCLUDED
#define _CTYPE_H_INCLUDED
:endsegment
:include readonly.sp
::
:: The following somewhat long segment only appears in ctype.h.
:segment !CNAME
#ifdef __cplusplus
#include <cctype>
// C99 functions in ctype.h
using std::isalnum;
using std::isalpha;
using std::iscntrl;
using std::isdigit;
using std::isgraph;
using std::islower;
using std::isprint;
using std::ispunct;
using std::isspace;
using std::isupper;
using std::isxdigit;
using std::tolower;
using std::toupper;
:: Now the extensions section.
:include ext.sp
// C99 functions in ctype.h that are currently considered extensions.
using std::isblank;
#endif
#else /* __cplusplus not defined */
:: End of segment that is only in ctype.h
:endsegment
:segment CNAME
:include cpluspro.sp
:endsegment
#ifndef _COMDEF_H_INCLUDED
#include <_comdef.h>
#endif
#define _LOWER 0x80
#define _UPPER 0x40
#define _DIGIT 0x20
#define _XDIGT 0x10
#define _PRINT 0x08
#define _PUNCT 0x04
#define _SPACE 0x02
#define _CNTRL 0x01
:segment CNAME
namespace std {
:endsegment
_WCRTLINK extern int isalnum(int);
_WCRTLINK extern int isalpha(int);
_WCRTLINK extern int iscntrl(int);
_WCRTLINK extern int isdigit(int);
_WCRTLINK extern int isgraph(int);
_WCRTLINK extern int islower(int);
_WCRTLINK extern int isprint(int);
_WCRTLINK extern int ispunct(int);
_WCRTLINK extern int isspace(int);
_WCRTLINK extern int isupper(int);
_WCRTLINK extern int isxdigit(int);
_WCRTLINK extern int tolower(int);
_WCRTLINK extern int toupper(int);
:include ext.sp
/* These names are in ctype.h according to C99. */
_WCRTLINK extern int isblank(int);
#endif
:segment CNAME
}
:endsegment
:segment !SNAP & !SNAPDRV
/* These names are not in ctype.h according to C99. */
_WCRTLINK extern int _tolower(int);
_WCRTLINK extern int _toupper(int);
_WCRTLINK extern int __iscsymf(int);
_WCRTLINK extern int __iscsym(int);
:endsegment
:include ext.sp
_WCRTLINK extern int isleadbyte(int);
_WCRTLINK extern int isascii(int);
_WCRTLINK extern int __isascii(int);
#if !defined(__FUNCTION_DATA_ACCESS)
#define isascii(__c) ((unsigned)(__c) <= 0x7f)
#define __isascii(__c) ((unsigned)(__c) <= 0x7f)
#endif
#endif
#if (defined(__SW_BR) || defined(_RTDLL))
#define _IsTable _IsTable_br
#endif
_WCRTDATA extern const char _WCDATA _IsTable[257];
#if !defined(__FUNCTION_DATA_ACCESS)
:: Eliminate macros from cctype. These can be put back later as in-lines.
:segment !CNAME
#define isalnum(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & (_LOWER|_UPPER|_DIGIT))
#define isalpha(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & (_LOWER|_UPPER))
#define iscntrl(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _CNTRL)
#define isdigit(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _DIGIT)
#define isgraph(__c) (((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & (_PRINT|_SPACE))==_PRINT)
#define islower(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _LOWER)
#define isprint(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _PRINT)
#define ispunct(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _PUNCT)
#define isspace(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _SPACE)
#define isupper(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _UPPER)
#define isxdigit(__c) ((unsigned char)(_IsTable[((unsigned char)(__c))+1]) & _XDIGT)
:include ext.sp
#define isblank(__c) (((__c)==' ')||((__c)=='\t'))
#endif
:endsegment
:segment !SNAP & !SNAPDRV
#define __iscsymf(__c) (isalpha(__c)||((__c)=='_'))
#define __iscsym(__c) (isalnum(__c)||((__c)=='_'))
:endsegment
#endif
:segment CNAME
:include cplusepi.sp
:endsegment
:: This #endif closes the #ifdef __cplusplus in ctype.h
:segment !CNAME
#endif
:endsegment
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?