home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 712 / cpp102 / src / ztype.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-13  |  669 b   |  29 lines

  1. #include <limits.h>
  2. #include <ctype.h>
  3. #include "global.h"
  4. #include "ztype.h"
  5.  
  6. unsigned char Z_type[UCHAR_MAX + 1];
  7.  
  8. /* Z_type_init() -- initialize lookup table for extended ctype macros */
  9. void Z_type_init()
  10. {
  11.   unsigned c;
  12.  
  13.   for (c = 0; c <= UCHAR_MAX; c++) {
  14.     Z_type[c] = '\0';
  15.     if (isalpha(c) || c == '_')
  16.       Z_type[c] |= Z_ct1;
  17.     if (isalnum(c) || c == '_')
  18.       Z_type[c] |= Z_ct2;
  19.     if (c == 'f' || c == 'F')
  20.       Z_type[c] |= Z_fsx;
  21.     if (c == 'U' || c == 'u')
  22.       Z_type[c] |= Z_isx;
  23.     if (c == 'L' || c == 'l')
  24.       Z_type[c] |= (Z_fsx | Z_isx);
  25.     if (c >= '0' && c <= '7')
  26.       Z_type[c] |= Z_oct;
  27.   }
  28. }
  29.