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

  1. /* towctrans/wctrans functions 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.     {"tolower", 0},
  14.     {"toupper", 1},
  15.     {(const char *)0, 0}};
  16.  
  17. _CRTIMP2 wint_t (towctrans)(wint_t c, wctrans_t val)
  18.     {    /* translate wide character */
  19.     return (val == 1 ? towupper(c) : towlower(c));
  20.     }
  21.  
  22. _CRTIMP2 wctrans_t (wctrans)(const char *name)
  23.     {    /* find translation for wide character */
  24.     int n;
  25.  
  26.     for (n = 0; tab[n].s != 0; ++n)
  27.         if (strcmp(tab[n].s, name) == 0)
  28.             return (tab[n].val);
  29.     return (0);
  30.     }
  31. _STD_END
  32.  
  33. /*
  34.  * Copyright (c) 1995 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  35.  * Consult your license regarding permissions and restrictions.
  36.  */
  37.  
  38. /*
  39. 951207 pjp: added new file
  40.  */
  41.