Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

  1. /* towctrans/wctrans functions for Microsoft */
  2. #include <string.h>
  3. #ifndef _YVALS
  4. #include <yvals.h>
  5. #endif
  6. #pragma warning(disable:4244)
  7. #ifndef _WCTYPE_T_DEFINED
  8. typedef wchar_t wint_t;
  9. typedef wchar_t wctype_t;
  10. #endif
  11. typedef wchar_t wctrans_t;
  12. _CRTIMP wchar_t __cdecl towupper(wchar_t);
  13. _CRTIMP wchar_t __cdecl towlower(wchar_t);
  14. _STD_BEGIN
  15. static const struct wctab {
  16. const char *s;
  17. wctype_t val;
  18. } tab[] = {
  19. {"tolower", 0},
  20. {"toupper", 1},
  21. {(const char *)0, 0}};
  22. _CRTIMP2 wint_t (__cdecl towctrans)(wint_t c, wctrans_t val)
  23. { /* translate wide character */
  24. return (val == 1 ? towupper(c) : towlower(c));
  25. }
  26. _CRTIMP2 wctrans_t (__cdecl wctrans)(const char *name)
  27. { /* find translation for wide character */
  28. int n;
  29. for (n = 0; tab[n].s != 0; ++n)
  30. if (strcmp(tab[n].s, name) == 0)
  31. return (tab[n].val);
  32. return (0);
  33. }
  34. _STD_END
  35. /*
  36. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  37. * Consult your license regarding permissions and restrictions.
  38. V3.10:0009 */