home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / patches / cset50 / include / ctype.h
Encoding:
C/C++ Source or Header  |  1993-03-08  |  3.9 KB  |  100 lines

  1. #pragma checkout( suspend )
  2.    #ifndef __CHKHDR__
  3.       #pragma checkout( suspend )
  4.    #endif
  5. #pragma checkout( resume )
  6.  
  7. #ifndef __ctype_h
  8.    #define __ctype_h
  9.  
  10.    /********************************************************************/
  11.    /*  <ctype.h> header file                                           */
  12.    /*                                                                  */
  13.    /*  Licensed Materials - Property of IBM                            */
  14.    /*                                                                  */
  15.    /*  IBM C Set/2  Version 1.0                                        */
  16.    /*  Copyright (C) International Business Machines Corp., 1991,1992  */
  17.    /*  All rights reserved                                             */
  18.    /*                                                                  */
  19.    /*  US Government Users Restricted Rights -                         */
  20.    /*  Use, duplication, or disclosure restricted                      */
  21.    /*  by GSA ADP Schedule Contract with IBM Corp.                     */
  22.    /*                                                                  */
  23.    /********************************************************************/
  24.  
  25.    int _Optlink isalnum( int );
  26.    int _Optlink isalpha( int );
  27.    int _Optlink iscntrl( int );
  28.    int _Optlink isdigit( int );
  29.    int _Optlink isgraph( int );
  30.    int _Optlink islower( int );
  31.    int _Optlink isprint( int );
  32.    int _Optlink ispunct( int );
  33.    int _Optlink isspace( int );
  34.    int _Optlink isupper( int );
  35.    int _Optlink isxdigit( int );
  36.    int _Optlink tolower( int );
  37.    int _Optlink toupper( int );
  38.  
  39.    /* masks for using external character table */
  40.    #define __A 0x0100U   /* alphabetic  (isalpha)  */
  41.    #define __U 0x0080U   /* uppercase   (isupper)  */
  42.    #define __L 0x0040U   /* lowercase   (islower)  */
  43.    #define __C 0x0020U   /* control     (iscntrl)  */
  44.    #define __P 0x0010U   /* punctuation (ispunct)  */
  45.    #define __W 0x0008U   /* whitespace  (isspace)  */
  46.    #define __S 0x0004U   /* space                  */
  47.    #define __D 0x0002U   /* decimal     (isdigit)  */
  48.    #define __X 0x0001U   /* hexadecimal (isxdigit) */
  49.  
  50.    /* indexes of toupper/tolower tables in _ctype table */
  51.    #define _TOUPPER_INDEX   257
  52.    #define _TOLOWER_INDEX   514
  53.  
  54.    extern const unsigned short *_ctype;
  55.  
  56.    /* macro definitions */
  57.    #pragma checkout( suspend )
  58.    #define isalnum( c )  ( _ctype[(c)] & (__A | __D) )
  59.    #define isalpha( c )  ( _ctype[(c)] & __A )
  60.    #define iscntrl( c )  ( _ctype[(c)] & __C )
  61.    #define isdigit( c )  ( _ctype[(c)] & __D )
  62.    #define isgraph( c )  ( _ctype[(c)] & (__P | __A | __D) )
  63.    #define islower( c )  ( _ctype[(c)] & __L )
  64.    #define isprint( c )  ( _ctype[(c)] & (__P | __A | __D | __S) )
  65.    #define ispunct( c )  ( _ctype[(c)] & __P )
  66.    #define isspace( c )  ( _ctype[(c)] & __W )
  67.    #define isupper( c )  ( _ctype[(c)] & __U )
  68.    #define isxdigit( c ) ( _ctype[(c)] & __X )
  69.    #define tolower( c )  (signed short)( _ctype[(c) + _TOLOWER_INDEX] )
  70.    #define toupper( c )  (signed short)( _ctype[(c) + _TOUPPER_INDEX] )
  71.    #pragma checkout( resume )
  72.  
  73.    #if (defined(__MIG__) || (defined(__EXTENDED__) && defined(__MIG_LIB__)))
  74.  
  75.       int _Optlink _tolower( int );
  76.       int _Optlink _toupper( int );
  77.       int _Optlink isascii( int );
  78.       int _Optlink iscsymf( int );
  79.       int _Optlink iscsym( int );
  80.       int _Optlink toascii( int );
  81.  
  82.       #pragma checkout( suspend )
  83.       #define _tolower( c )  ( (c) + 'a' - 'A' )
  84.       #define _toupper( c )  ( (c) + 'A' - 'a' )
  85.       #define isascii( c )   ( (unsigned)(c) < 0x80 )
  86.       #define iscsymf( c )   ( isalpha( c ) || (c) == '_' )
  87.       #define iscsym( c )    ( isalnum( c ) || (c) == '_' )
  88.       #define toascii( c )   ( (c) & 0x7f )
  89.       #pragma checkout( resume )
  90.  
  91.    #endif
  92.  
  93. #endif
  94.  
  95. #pragma checkout( suspend )
  96.    #ifndef __CHKHDR__
  97.       #pragma checkout( resume )
  98.    #endif
  99. #pragma checkout( resume )
  100.