/* strtype.h header */ #ifndef _STRTYPE #define _STRTYPE #include #include #pragma options align=mac68k #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) #pragma import on #endif #ifndef _STDIO #define EOF (-1) #endif /* _Ctype code bits */ #define _XA 0x00 /* extra alphabetic (unused) */ #define _XS 0x00 /* extra space (unused) */ #define _BB 0x80 /* BEL, BS, etc. */ #define _CN 0x40 /* CR, FF, HT, NL, VT */ #define _DI 0x20 /* '0'-'9' */ #define _LO 0x10 /* 'a'-'z' */ #define _PU 0x08 /* punctuation */ #define _SP 0x04 /* space */ #define _UP 0x02 /* 'A'-'Z' */ #define _XD 0x01 /* '0'-'9', 'A'-'F', 'a'-'f' */ /* declarations */ extern const char *_Ctype, *_Tolower, *_Toupper; int _SC; inline void stringchar(string _STR, int _SUB) { char *_CTemp; _STR.substr(_SUB,1).copy(_CTemp, 1, 0); _CTemp[1] = 0; // set a null terminator _SC = *_CTemp; } inline int isalnum(int _C) { if (_C == -1) return (_Ctype[_SC] & (_DI|_LO|_UP|_XA)); else return (_Ctype[_C] & (_DI|_LO|_UP|_XA)); } inline int isalpha(int _C) { if (_C == -1) return (_Ctype[_SC] & (_LO|_UP|_XA)); else return (_Ctype[_C] & (_LO|_UP|_XA)); } inline int iscntrl(int _C) { if (_C == -1) return (_Ctype[_SC] & (_BB|_CN)); else return (_Ctype[_C] & (_BB|_CN)); } inline int isdigit(int _C) { if (_C == -1) return (_Ctype[_SC] & _DI); else return (_Ctype[_C] & _DI); } inline int isgraph(int _C) { if (_C == -1) return (_Ctype[_SC] & (_DI|_LO|_PU|_UP|_XA)); else return (_Ctype[_C] & (_DI|_LO|_PU|_UP|_XA)); } inline int islower(int _C) { if (_C == -1) return (_Ctype[_SC] & _LO); else return (_Ctype[_C] & _LO); } inline int isprint(int _C) { if (_C == -1) return (_Ctype[_SC] & (_DI|_LO|_PU|_SP|_UP|_XA)); else return (_Ctype[_C] & (_DI|_LO|_PU|_SP|_UP|_XA)); } inline int ispunct(int _C) { if (_C == -1) return (_Ctype[_SC] & _PU); else return (_Ctype[_C] & _PU); } inline int isspace(int _C) { if (_C == -1) return (_Ctype[_SC] & (_CN|_SP|_XS)); else return (_Ctype[_C] & (_CN|_SP|_XS)); } inline int isupper(int _C) { if (_C == -1) return (_Ctype[_SC] & _UP); else return (_Ctype[_C] & _UP); } inline int isxdigit(int _C) { if (_C == -1) return (_Ctype[_SC] & _XD); else return (_Ctype[_C] & _XD); } inline int tolower(int _C) { if (_C == -1) return (_Tolower[_SC]); else return (_Tolower[_C]); } inline int toupper(int _C) { if (_C == -1) return (_Toupper[_SC]); else return (_Toupper[_C]); } #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) #pragma import reset #endif #pragma options align=reset #endif /* _CTYPE */ // Original ctype.h code (c) 1994 P.J. Plauger // String support added 1999, Rupert Scammell. //Change log: //94Jun04 - PlumHall Baseline //94Oct07 - Inserted MetroWerks changes //99May22RS - String support added