ReactOS 0.4.16-dev-1172-g2041f3c
wctrans.cpp
Go to the documentation of this file.
1//
2// wctrans.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Implementations of the towctrans and wctrans functions.
7//
8#include <corecrt.h>
9#include <ctype.h>
10#include <string.h>
11#include <wctype.h>
12
13#pragma warning(disable:4244)
14
15
16
17typedef wchar_t wctrans_t;
18
19static struct wctab
20{
21 char const* s;
23}
24const tab[] =
25{
26 { "tolower", 2 },
27 { "toupper", 1 },
28 { nullptr, 0 }
29};
30
31
32
33extern "C" wint_t __cdecl towctrans(wint_t const c, wctrans_t const value)
34{
35 return value == 1 ? towupper(c) : towlower(c);
36}
37
38extern "C" wctrans_t __cdecl wctrans(char const* const name)
39{
40 for (unsigned n = 0; tab[n].s != 0; ++n)
41 {
42 if (strcmp(tab[n].s, name) == 0)
43 return tab[n].value;
44 }
45
46 return 0;
47}
48
49/*
50 * Copyright (c) 1992-2007 by P.J. Plauger. ALL RIGHTS RESERVED.
51 * Consult your license regarding permissions and restrictions.
52 V5.03:0009 */
int wint_t
Definition: _apple.h:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define __cdecl
Definition: accygwin.h:79
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
wchar_t wctrans_t
Definition: wctype.h:147
Definition: name.c:39
wctype_t value
Definition: wctrans.cpp:22
char const * s
Definition: wctrans.cpp:21
#define towlower(c)
Definition: wctype.h:97
#define towupper(c)
Definition: wctype.h:99
unsigned short wctype_t
Definition: corecrt.h:617
Definition: pdh_main.c:96
wchar_t wctrans_t
Definition: wctrans.cpp:17
wint_t __cdecl towctrans(wint_t const c, wctrans_t const value)
Definition: wctrans.cpp:33
wctrans_t __cdecl wctrans(char const *const name)
Definition: wctrans.cpp:38
static struct wctab tab[]