[BACK]Return to ctype.h CVS log [TXT][DIR] Up to [local] / src / include

Diff for /src/include/ctype.h between version 1.4 and 1.5

version 1.4, 2002/02/16 21:27:17 version 1.5, 2002/12/11 23:01:40
Line 54 
Line 54 
 #define _X      0x40  #define _X      0x40
 #define _B      0x80  #define _B      0x80
   
   #define EOF     (-1)
   
 extern const char       *_ctype_;  extern const char       *_ctype_;
 extern const short      *_tolower_tab_;  extern const short      *_tolower_tab_;
 extern const short      *_toupper_tab_;  extern const short      *_toupper_tab_;
   
   #ifdef _ANSI_LIBRARY
 __BEGIN_DECLS  __BEGIN_DECLS
 extern int      isalnum(int);  int     isalnum(int);
 extern int      isalpha(int);  int     isalpha(int);
 extern int      iscntrl(int);  int     iscntrl(int);
 extern int      isdigit(int);  int     isdigit(int);
 extern int      isgraph(int);  int     isgraph(int);
 extern int      islower(int);  int     islower(int);
 extern int      isprint(int);  int     isprint(int);
 extern int      ispunct(int);  int     ispunct(int);
 extern int      isspace(int);  int     isspace(int);
 extern int      isupper(int);  int     isupper(int);
 extern int      isxdigit(int);  int     isxdigit(int);
 extern int      tolower(int);  int     tolower(int);
 extern int      toupper(int);  int     toupper(int);
   
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
 extern int      isblank(int);  int     isblank(int);
 extern int      isascii(int);  int     isascii(int);
 extern int      toascii(int);  int     toascii(int);
 extern int      _tolower(int);  int     _tolower(int);
 extern int      _toupper(int);  int     _toupper(int);
 #endif  #endif
 __END_DECLS  __END_DECLS
   
 #define isdigit(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _N)  #else /* !_ANSI_LIBRARY */
 #define islower(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _L)  
 #define isspace(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _S)  
 #define ispunct(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _P)  
 #define isupper(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _U)  
 #define isalpha(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L))  
 #define isxdigit(c)     ((_ctype_ + 1)[(unsigned char)(c)] & (_N|_X))  
 #define isalnum(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L|_N))  
 #define isprint(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N|_B))  
 #define isgraph(c)      ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N))  
 #define iscntrl(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _C)  
 #define tolower(c)      ((_tolower_tab_ + 1)[(unsigned char)(c)])  
 #define toupper(c)      ((_toupper_tab_ + 1)[(unsigned char)(c)])  
   
   static __inline int isalnum(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N));
   }
   
   static __inline int isalpha(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & (_U|_L));
   }
   
   static __inline int iscntrl(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _C);
   }
   
   static __inline int isdigit(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _N);
   }
   
   static __inline int isgraph(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N));
   }
   
   static __inline int islower(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _L);
   }
   
   static __inline int isprint(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B));
   }
   
   static __inline int ispunct(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _P);
   }
   
   static __inline int isspace(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _S);
   }
   
   static __inline int isupper(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & _U);
   }
   
   static __inline int isxdigit(int c)
   {
           if (c == EOF)
                   return (0);
           return ((_ctype_ + 1)[(unsigned char)c] & (_N|_X));
   }
   
   static __inline int tolower(int c)
   {
           if (c != (unsigned char) c)
                   return (c);
           return ((_tolower_tab_ + 1)[c]);
   }
   
   static __inline int toupper(int c)
   {
           if (c != (unsigned char) c)
                   return (c);
           return ((_toupper_tab_ + 1)[c]);
   }
   
 #if !defined(_ANSI_SOURCE) && !defined (_POSIX_SOURCE)  #if !defined(_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
 #if notyet  static __inline int isblank(int c)
 #define isblank(c)      ((_ctype_ + 1)[(unsigned char)(c)] & _B)  {
           return (c == ' ' || c == '\t');
   }
   
   static __inline int isascii(int c)
   {
           if (c == EOF)
                   return (0);
           return ((unsigned)(c) <= 0177);
   }
   
   static __inline int toascii(int c)
   {
           return (c & 0177);
   }
   
   static __inline int _tolower(int c)
   {
           return (c - 'A' + 'a');
   }
   
   static __inline int _toupper(int c)
   {
           return (c - 'a' + 'A');
   }
 #endif  #endif
 #define isascii(c)      ((unsigned char)(c) <= 0177)  
 #define toascii(c)      ((c) & 0177)  #endif /* !_ANSI_LIBRARY */
 #define _tolower(c)     ((c) - 'A' + 'a')  
 #define _toupper(c)     ((c) - 'a' + 'A')  
 #endif  
   
 #endif /* !_CTYPE_H_ */  #endif /* !_CTYPE_H_ */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5