home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / wctype.c < prev    next >
C/C++ Source or Header  |  1998-06-16  |  922b  |  45 lines

  1. /* wctype function for Microsoft */
  2. #include <string.h>
  3. #include <wctype.h>
  4. #ifndef _LIMITS
  5. #include <yvals.h>
  6. #endif
  7. _STD_BEGIN
  8.  
  9. static const struct wctab {
  10.     const char *s;
  11.     wctype_t val;
  12.     } tab[] = {
  13.     {"alnum", _ALPHA|_DIGIT},
  14.     {"alpha", _ALPHA},
  15.     {"cntrl", _CONTROL},
  16.     {"digit", _DIGIT},
  17.     {"graph", _PUNCT|_ALPHA|_DIGIT},
  18.     {"lower", _LOWER},
  19.     {"print", _BLANK|_PUNCT|_ALPHA|_DIGIT},
  20.     {"punct", _PUNCT},
  21.     {"space", _SPACE},
  22.     {"upper", _UPPER},
  23.     {"xdigit", _HEX},
  24.     {(const char *)0, 0}};
  25.  
  26. _CRTIMP2 wctype_t (wctype)(const char *name)
  27.     {    /* find classification for wide character */
  28.     int n;
  29.  
  30.     for (n = 0; tab[n].s != 0; ++n)
  31.         if (strcmp(tab[n].s, name) == 0)
  32.             return (tab[n].val);
  33.     return (0);
  34.     }
  35. _STD_END
  36.  
  37. /*
  38.  * Copyright (c) 1995 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  39.  * Consult your license regarding permissions and restrictions.
  40.  */
  41.  
  42. /*
  43. 951207 pjp: added new file
  44.  */
  45.