home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  7.3 KB  |  209 lines

  1. #if (defined(__IBMC__) || defined(__IBMCPP__))
  2. #pragma info( none )
  3. #ifndef __CHKHDR__
  4.    #pragma info( none )
  5. #endif
  6. #pragma info( restore )
  7. #endif
  8.  
  9. #ifndef __ctype_h
  10.    #define __ctype_h
  11.  
  12.    #ifdef __cplusplus
  13.       extern "C" {
  14.    #endif
  15.  
  16.    #ifndef  _LNK_CONV
  17.      #ifdef _M_I386
  18.        #define  _LNK_CONV   _Optlink
  19.      #else
  20.        #define  _LNK_CONV
  21.      #endif
  22.    #endif
  23.  
  24.    #ifndef _IMPORT
  25.       #ifdef __IMPORTLIB__
  26.          #define _IMPORT _Import
  27.       #else
  28.          #define _IMPORT
  29.       #endif
  30.    #endif
  31.  
  32.    /********************************************************************/
  33.    /*  <ctype.h> header file                                           */
  34.    /*                                                                  */
  35.    /*  VisualAge for C++ for Windows, Version 3.5                      */
  36.    /*    Licensed Material - Property of IBM                           */
  37.    /*                                                                  */
  38.    /*  5801-ARR and Other Materials                                    */
  39.    /*                                                                  */
  40.    /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  41.    /*                                                                  */
  42.    /********************************************************************/
  43.  
  44.    /* masks for using external character table */
  45.    #ifndef __ISXDIGIT
  46.       #define __ISXDIGIT       0x0001U
  47.    #endif
  48.    #ifndef __ISDIGIT
  49.       #define __ISDIGIT        0x0002U
  50.    #endif
  51.    #ifndef __ISSPACE
  52.       #define __ISSPACE        0x0008U
  53.    #endif
  54.    #ifndef __ISPUNCT
  55.       #define __ISPUNCT        0x0010U
  56.    #endif
  57.    #ifndef __ISCNTRL
  58.       #define __ISCNTRL        0x0020U
  59.    #endif
  60.    #ifndef __ISLOWER
  61.       #define __ISLOWER        0x0040U
  62.    #endif
  63.    #ifndef __ISUPPER
  64.       #define __ISUPPER        0x0080U
  65.    #endif
  66.    #ifndef __ISALPHA
  67.       #define __ISALPHA        0x0100U
  68.    #endif
  69.    #ifndef __ISGRAPH
  70.       #define __ISGRAPH        0x0200U
  71.    #endif
  72.    #ifndef __ISPRINT
  73.       #define __ISPRINT        0x0400U
  74.    #endif
  75.    #ifndef __ISALNUM
  76.       #define __ISALNUM        0x0800U
  77.    #endif
  78.    #ifndef __ISBLANK
  79.       #define __ISBLANK        0x1000U
  80.    #endif
  81.  
  82.    /* indexes of toupper/tolower tables in _ctype table */
  83.    #define _TOUPPER_INDEX   257
  84.    #define _TOLOWER_INDEX   514
  85.  
  86.    #ifdef _WIN32S
  87.       extern const unsigned short** _IMPORT _LNK_CONV __ctype( void );
  88.       #define _ctype (*__ctype())
  89.    #else
  90.       extern const unsigned short* _IMPORT _ctype;
  91.    #endif
  92.  
  93.    #ifdef __cplusplus
  94.       inline int _LNK_CONV isalnum ( int c )
  95.                           { return _ctype[(c)] & __ISALNUM; }
  96.       inline int _LNK_CONV isalpha ( int c )
  97.                           { return _ctype[(c)] & __ISALPHA; }
  98.       inline int _LNK_CONV iscntrl ( int c )
  99.                           { return _ctype[(c)] & __ISCNTRL; }
  100.       inline int _LNK_CONV isdigit ( int c )
  101.                           { return _ctype[(c)] & __ISDIGIT; }
  102.       inline int _LNK_CONV isgraph ( int c )
  103.                           { return _ctype[(c)] & __ISGRAPH; }
  104.       inline int _LNK_CONV islower ( int c )
  105.                           { return _ctype[(c)] & __ISLOWER; }
  106.       inline int _LNK_CONV isprint ( int c )
  107.                           { return _ctype[(c)] & __ISPRINT; }
  108.       inline int _LNK_CONV ispunct ( int c )
  109.                           { return _ctype[(c)] & __ISPUNCT; }
  110.       inline int _LNK_CONV isspace ( int c )
  111.                           { return _ctype[(c)] & __ISSPACE; }
  112.       inline int _LNK_CONV isupper ( int c )
  113.                           { return _ctype[(c)] & __ISUPPER; }
  114.       inline int _LNK_CONV isxdigit( int c )
  115.                           { return _ctype[(c)] & __ISXDIGIT; }
  116.       inline int _LNK_CONV tolower ( int c )
  117.                           { return (signed short)_ctype[(c) + _TOLOWER_INDEX]; }
  118.       inline int _LNK_CONV toupper ( int c )
  119.                           { return (signed short)_ctype[(c) + _TOUPPER_INDEX]; }
  120.    #else
  121.       #if (defined(__IBMC__) || defined(__IBMCPP__))
  122.       #pragma info( none )
  123.       #endif
  124.       extern int _IMPORT _LNK_CONV isalnum( int );
  125.       extern int _IMPORT _LNK_CONV isalpha( int );
  126.       extern int _IMPORT _LNK_CONV iscntrl( int );
  127.       extern int _IMPORT _LNK_CONV isdigit( int );
  128.       extern int _IMPORT _LNK_CONV isgraph( int );
  129.       extern int _IMPORT _LNK_CONV islower( int );
  130.       extern int _IMPORT _LNK_CONV isprint( int );
  131.       extern int _IMPORT _LNK_CONV ispunct( int );
  132.       extern int _IMPORT _LNK_CONV isspace( int );
  133.       extern int _IMPORT _LNK_CONV isupper( int );
  134.       extern int _IMPORT _LNK_CONV isxdigit( int );
  135.       extern int _IMPORT _LNK_CONV tolower( int );
  136.       extern int _IMPORT _LNK_CONV toupper( int );
  137.  
  138.       #define isalnum( c )  ( _ctype[(c)] & __ISALNUM )
  139.       #define isalpha( c )  ( _ctype[(c)] & __ISALPHA )
  140.       #define iscntrl( c )  ( _ctype[(c)] & __ISCNTRL )
  141.       #define isdigit( c )  ( _ctype[(c)] & __ISDIGIT )
  142.       #define isgraph( c )  ( _ctype[(c)] & __ISGRAPH )
  143.       #define islower( c )  ( _ctype[(c)] & __ISLOWER )
  144.       #define isprint( c )  ( _ctype[(c)] & __ISPRINT )
  145.       #define ispunct( c )  ( _ctype[(c)] & __ISPUNCT )
  146.       #define isspace( c )  ( _ctype[(c)] & __ISSPACE )
  147.       #define isupper( c )  ( _ctype[(c)] & __ISUPPER )
  148.       #define isxdigit( c ) ( _ctype[(c)] & __ISXDIGIT )
  149.       #define tolower( c )  (signed short)( _ctype[(c) + _TOLOWER_INDEX] )
  150.       #define toupper( c )  (signed short)( _ctype[(c) + _TOUPPER_INDEX] )
  151.       #if (defined(__IBMC__) || defined(__IBMCPP__))
  152.       #pragma info( restore )
  153.       #endif
  154.    #endif
  155.  
  156.    #if defined(__EXTENDED__)
  157.  
  158.       int _LNK_CONV _tolower( int );
  159.       int _LNK_CONV _toupper( int );
  160.       int _LNK_CONV _isascii( int );
  161.       int _LNK_CONV _iscsymf( int );
  162.       int _LNK_CONV _iscsym( int );
  163.       int _LNK_CONV _toascii( int );
  164.  
  165.       #if (defined(__IBMC__) || defined(__IBMCPP__))
  166.       #pragma info( none )
  167.       #endif
  168.       #define _tolower( c ) ( (c) + 'a' - 'A' )
  169.       #define _toupper( c ) ( (c) + 'A' - 'a' )
  170.       #define _isascii( c ) ( (unsigned)(c) < 0x80 )
  171.       #define _iscsymf( c ) ( isalpha( c ) || (c) == '_' )
  172.       #define _iscsym( c )  ( isalnum( c ) || (c) == '_' )
  173.       #define _toascii( c ) ( (c) & 0x7f )
  174.  
  175.       #ifdef __cplusplus
  176.          inline int isascii( int c ) { return _isascii( c ); }
  177.          inline int iscsymf( int c ) { return _iscsymf( c ); }
  178.          inline int iscsym ( int c ) { return _iscsym ( c ); }
  179.          inline int toascii( int c ) { return _toascii( c ); }
  180.          inline int isblank( int c ) { return _ctype[(c)] & __ISBLANK; }
  181.       #else
  182.          extern int _IMPORT _LNK_CONV isblank( int );
  183.          #define  isascii( c )        _isascii( c )
  184.          #define  iscsymf( c )        _iscsymf( c )
  185.          #define  iscsym( c )         _iscsym( c )
  186.          #define  toascii( c )        _toascii( c )
  187.          #define  isblank( c )  ( _ctype[(c)] & __ISBLANK )
  188.       #endif
  189.       #if (defined(__IBMC__) || defined(__IBMCPP__))
  190.       #pragma info( restore )
  191.       #endif
  192.  
  193.    #endif
  194.  
  195.    #ifdef __cplusplus
  196.       }
  197.    #endif
  198.  
  199. #endif
  200.  
  201. #if (defined(__IBMC__) || defined(__IBMCPP__))
  202. #pragma info( none )
  203. #ifndef __CHKHDR__
  204.    #pragma info( restore )
  205. #endif
  206. #pragma info( restore )
  207. #endif
  208.  
  209.