#ifndef __CTYPE_LOADED #define __CTYPE_LOADED #ifndef __CTYPE_PROCESSED #define __CTYPE_PROCESSED /**************************************************************************** ** ** - Character Type Classification Macros/Routines ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** ** Copyright 2005 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** If the user has used /pointer_size=short or /pointer_size=long, we will ** begin in a 32-bit pointer size context. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif #ifdef __NAMESPACE_STD namespace std { #endif /* ** 4.3.1 Character Testing Functions */ #ifdef __NAMESPACE_STD # pragma __extern_prefix __save # pragma __extern_prefix "CXXL$" #endif int isalnum (int); int isalpha (int); int iscntrl (int); int isdigit (int); int isgraph (int); int islower (int); int isprint (int); int ispunct (int); int isspace (int); int isupper (int); int isxdigit (int); #ifdef __NAMESPACE_STD # pragma __extern_prefix __restore #endif /* ** 4.3.2 Character Case Mapping Functions */ int tolower (int); int toupper (int); #ifdef __NAMESPACE_STD } /* namespace std */ #endif /****************************************************************************** ** ** OpenVMS V6.2 and later ** ******************************************************************************/ #if __CRTL_VER >= 60200000 # define __ctypet (decc$$ga___ctypet) # define __ctypea (decc$$gl___ctypea) # define __isclocale (decc$$gl___isclocale) # pragma __extern_model __save # pragma __extern_model __strict_refdef /* ** Classmask array __ctypet is declared as a pointer in order ** to prevent BADSUBSCRIPT message which otherwise would be ** issued by the compiler when one of the is* functions is called ** with EOF and, accordingly, __ISFUNCTION macro below expands ** into __ctypet[-1] */ extern const unsigned int * __ctypet ; extern int __ctypea ; extern int __isclocale ; # pragma __extern_model __restore # define __UPPER 0x1 # define __LOWER 0x2 # define __DIGIT 0x4 # define __SPACE 0x8 # define __PUNCT 0x10 # define __CNTRL 0x20 # define __XDIGIT 0x40 # define __PRINT 0x80 # define __ALPHABET 0x100 # define __ALNUM 0x104 # define __GRAPH 0x200 # define __BLANK 0X400 # define __ISALPHABET (isalpha) # define __ISCNTRL (iscntrl) # define __ISUPPER (isupper) # define __ISLOWER (islower) # define __ISDIGIT (isdigit) # define __ISSPACE (isspace) # define __ISPUNCT (ispunct) # define __ISXDIGIT (isxdigit) # define __ISPRINT (isprint) # define __ISGRAPH (isgraph) # define __ISALNUM (isalnum) /* ** Throughout this header file, for a C++ compilation with __NAMESPACE_STD ** enabled, functions from ANSI C standard that are defined as macros in this ** header file, are defined as inline functions instead of macros. ** ** This is to comply with clause 17.4.1.2 Headers [lib.headers] of the C++ ** standard which says, in particular: -6- Names that are defined as functions in C shall be defined as functions in the C++ Standard Library.*) *) This disallows the practice, allowed in C, of providing a "masking macro" in addition to the function prototype. The only way to achieve equivalent "inline" behavior in C++ is to provide a definition as an extern inline function. */ #ifndef __NAMESPACE_STD /* ** Macro definitions */ # define __ISFUNCTION(c,p) (__ctypea?__ctypet[(int)(c)]&__##p:__IS##p(c)) # define iscntrl(c) __ISFUNCTION(c, CNTRL) # define isalnum(c) __ISFUNCTION(c, ALNUM) # define isalpha(c) __ISFUNCTION(c, ALPHABET) # define isdigit(c) __ISFUNCTION(c, DIGIT) # define isgraph(c) __ISFUNCTION(c, GRAPH) # define islower(c) __ISFUNCTION(c, LOWER) # define isprint(c) __ISFUNCTION(c, PRINT) # define ispunct(c) __ISFUNCTION(c, PUNCT) # define isspace(c) __ISFUNCTION(c, SPACE) # define isxdigit(c) __ISFUNCTION(c, XDIGIT) # define isupper(c) __ISFUNCTION(c, UPPER) #else /* ** Inline functions */ namespace std { #define __INLINE_ISFUNCTION(c,p) { \ /* no need to check __ctypea on VMS V6.2 and above */ \ return (c == __EOF ? 0 : __ctypet[(unsigned) c & 0xff] & __##p); \ } inline int iscntrl(int c) __INLINE_ISFUNCTION(c, CNTRL) inline int isalnum(int c) __INLINE_ISFUNCTION(c, ALNUM) inline int isalpha(int c) __INLINE_ISFUNCTION(c, ALPHABET) inline int isdigit(int c) __INLINE_ISFUNCTION(c, DIGIT) inline int isgraph(int c) __INLINE_ISFUNCTION(c, GRAPH) inline int islower(int c) __INLINE_ISFUNCTION(c, LOWER) inline int isprint(int c) __INLINE_ISFUNCTION(c, PRINT) inline int ispunct(int c) __INLINE_ISFUNCTION(c, PUNCT) inline int isspace(int c) __INLINE_ISFUNCTION(c, SPACE) inline int isxdigit(int c) __INLINE_ISFUNCTION(c, XDIGIT) inline int isupper(int c) __INLINE_ISFUNCTION(c, UPPER) } /* namespace std */ #endif /* __NAMESPACE_STD */ # define __IS_LOWER(c) (((c) >= 'a' && (c) <= 'z')?1:0) # define __IS_UPPER(c) (((c) >= 'A' && (c) <= 'Z')?1:0) /* ** X/Open extensions */ # if defined(_XOPEN_SOURCE) || !defined(_ANSI_C_SOURCE) # if defined(_FAST_TOUPPER) /* Note - these evaluate macro parameters multiple times */ # define _toupper(c) (__isclocale? (__IS_LOWER(c) ? (c) & 0xDF: (c)): (toupper)(c)) # define _tolower(c) (__isclocale? (__IS_UPPER(c) ? (c) | 0x20: (c)): (tolower)(c)) # else # define _toupper(c) (toupper)(c) # define _tolower(c) (tolower)(c) # endif int isascii (int); int toascii (int); # define isascii(c) ((unsigned)(c) <= 0x7F) # define toascii(c) ((c) & 0x7F) # endif #endif /****************************************************************************** ** ** Prior to OpenVMS V6.2 ** ******************************************************************************/ #if __CRTL_VER < 60200000 # define __ctype (*decc$ga___ctype) # pragma __extern_model __save # pragma __extern_model __strict_refdef extern const char __ctype []; # pragma __extern_model __restore # define _U 0x1 # define _L 0x2 # define _D 0x4 # define _S 0x8 # define _P 0x10 # define _C 0x20 # define _X 0x40 # define _B 0x80 # ifdef __DECC # pragma __message __save # pragma __message __disable (__CHECK) # endif static int __iscntrl (int __c) { /* Check explicitly for EOF */ return __c < 0 ? 0 : __ctype [__c & 0xFF] & _C; } # define iscntrl __iscntrl # ifdef __DECC # pragma __message __restore # endif # define isalnum(c) (__ctype [(c) & 0xFF] & (_U | _L | _D)) # define isalpha(c) (__ctype [(c) & 0xFF] & (_U | _L)) # define isdigit(c) (__ctype [(c) & 0xFF] & _D) # define isgraph(c) (__ctype [(c) & 0xFF] & (_P | _U | _L | _D)) # define islower(c) (__ctype [(c) & 0xFF] & _L) # define isprint(c) (__ctype [(c) & 0xFF] & (_P | _U | _L | _D | _B)) # define ispunct(c) (__ctype [(c) & 0xFF] & _P) # define isspace(c) (__ctype [(c) & 0xFF] & _S) # define isupper(c) (__ctype [(c) & 0xFF] & _U) # define isxdigit(c) (__ctype [(c) & 0xFF] & _X) /* ** X/Open extensions */ # if defined(_XOPEN_SOURCE) || !defined(_ANSI_C_SOURCE) # define _ctype_ __ctype int isascii (int); # define isascii(c) ((unsigned)(c) <= 0x7F) # define toascii(c) ((c) & 0x7F) # define _toupper(c) (((c) >= 'a' && (c) <= 'z') ? (c) & 0xDF : (c)) # define _tolower(c) (((c) >= 'A' && (c) <= 'Z') ? (c) | 0x20 : (c)) # endif #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __CTYPE_PROCESSED */ #if defined(__NAMESPACE_STD) && !defined(__NAMESPACE_STD_ONLY) # ifndef __USING_CTYPE_NAMES # define __USING_CTYPE_NAMES 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; # endif #endif #endif /* __CTYPE_LOADED */