home *** CD-ROM | disk | FTP | other *** search
- /*
- * ctype.h -- ANSI
- *
- * Functions for handling characters.
- *
- * Copyright (c) 1990, 1991, 1992, MetaWare Incorporated
- */
-
- #ifndef _CTYPE_H
- #define _CTYPE_H
- #pragma push_align_members(64);
-
- #ifdef __CPLUSPLUS__
- extern "C" {
- #endif
-
- #define _UPPER 1
- #define _LOWER 2
- #define _NUMBER 4
- #define _DIGIT 4
- #define _SPACE 8
- #define _PUNCT 16
- #define _CONTROL 32
- #define _CNTRL 32
- #if _AIX || _ATT || _XNX || _ATT4 || _SOL
- #define _BLANK 64
- #define _HEX 128
- #else
- #define _HEX 64
- #define _BLANK 128
- #endif
-
- #if _IBMESA
- /* Structure info derived from localedef.h. */
- extern struct {
- char a,b; short c,d,e; void *f;
- struct {
- short a,b,c,d,e,f; char g; int h; void *i; int j;
- unsigned short *lc_ctype; /* At offset 28. */
- } *lc_chrtbl;
- } *_locp;
- #define _CTYPE(c) ((_locp->lc_chrtbl->lc_ctype+1)[c])
- #elif _AIX || _XNX || _ATT || _ATT4 || _SOL
- #if __ATTSTDC /* AT&T ANSI-std vs. non-ANSI std. ctype. */
- #define _CTYPE(c) ((__ctype+1)[(c)])
- extern const unsigned char __ctype[];
- #else
- #define _CTYPE(c) ((_ctype+1)[(c)])
- extern const unsigned char _ctype[];
- #endif /* __ATTSTDC */
- #else
- #define _CTYPE(c) ((_ctype_+1)[(c)])
- extern const unsigned char _ctype_[];
- #endif /* _AIX || _XNX || _ATT */
-
- extern int isupper(int __c);
- extern int islower(int __c);
- extern int isalpha(int __c);
- extern int isdigit(int __c);
- extern int isxdigit(int __c);
- extern int isspace(int __c);
- extern int ispunct(int __c);
- extern int isalnum(int __c);
- extern int isgraph(int __c);
- extern int isprint(int __c);
- extern int iscntrl(int __c);
- extern int toupper(int __c);
- extern int tolower(int __c);
- extern int _isascii(int __c);
- extern int _isodigit(int __c);
- extern int _toupper(int __c);
- extern int _tolower(int __c);
-
- #define isupper(c) (_CTYPE(c) & _UPPER)
- #define islower(c) (_CTYPE(c) & _LOWER)
- #define isalpha(c) (_CTYPE(c) & (_UPPER | _LOWER))
- #define isdigit(c) (_CTYPE(c) & _NUMBER)
- #define isxdigit(c) (_CTYPE(c) & (_NUMBER | _HEX))
- #define isspace(c) (_CTYPE(c) & _SPACE)
- #define ispunct(c) (_CTYPE(c) & _PUNCT)
- #define isalnum(c) (_CTYPE(c) & (_UPPER|_LOWER|_NUMBER))
- #define isgraph(c) (_CTYPE(c) & (_UPPER | _LOWER | _NUMBER | _PUNCT))
- #define isprint(c) (_CTYPE(c) & (_UPPER |_LOWER |_NUMBER |_PUNCT |_BLANK))
- #define iscntrl(c) (_CTYPE(c) & _CNTRL)
-
- #if __HIGHC__
- #define _toupper(c) ((c) - 'a' + 'A')
- #define _tolower(c) ((c) - 'A' + 'a')
- #define isascii(c) ((unsigned)(c) <= 0177)
- #define toascii(c) ((unsigned)(c) & 0177)
- #endif
-
- #ifdef _K_AND_R
- #define _isascii(c) ((unsigned)(c) <= 0177)
- #define isascii(c) ((unsigned)(c) <= 0177)
- #define toascii(c) ((unsigned)(c) & 0177)
- #endif
-
- #if _MSDOS
- #define _isodigit(c) ((unsigned int)(((c)&0xFF) - '0') <= 7)
- #if __HIGHC__
- #define toupper(c) (islower(c) ? _toupper(c) : (c))
- #define tolower(c) (isupper(c) ? _tolower(c) : (c))
- #endif
- #endif
-
- #ifdef __CPLUSPLUS__
- }
- #endif
- #pragma pop_align_members();
- #endif /* _CTYPE_H */
-