XawI18n.c revision 994689c1
1/* Copyright 1991 NCR Corporation - Dayton, Ohio, USA */
2
3/*
4 * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
5 *                      and Nippon Telegraph and Telephone Corporation
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the names of OMRON, NTT Software, and NTT
12 * not be used in advertising or publicity pertaining to distribution of the
13 * software without specific, written prior permission. OMRON, NTT Software,
14 * and NTT make no representations about the suitability of this
15 * software for any purpose.  It is provided "as is" without express or
16 * implied warranty.
17 *
18 * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD
19 * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20 * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT BE
21 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
24 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 *
26 *	Author: Li Yuhong	OMRON Corporation
27 */
28
29/*
30
31Copyright 1991, 1994, 1998  The Open Group
32
33Permission to use, copy, modify, distribute, and sell this software and its
34documentation for any purpose is hereby granted without fee, provided that
35the above copyright notice appear in all copies and that both that
36copyright notice and this permission notice appear in supporting
37documentation.
38
39The above copyright notice and this permission notice shall be included in
40all copies or substantial portions of the Software.
41
42THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
45OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
46AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
47CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
49Except as contained in this notice, the name of The Open Group shall not be
50used in advertising or otherwise to promote the sale, use or other dealings
51in this Software without prior written authorization from The Open Group.
52
53*/
54
55#ifdef HAVE_CONFIG_H
56#include <config.h>
57#endif
58#include <X11/IntrinsicP.h>
59#include "XawI18n.h"
60
61wchar_t
62#if NeedWidePrototypes
63_Xaw_atowc(int c)
64#else
65_Xaw_atowc(unsigned char c)
66#endif
67{
68    wchar_t  wc;
69    char str[2];
70
71    str[0] = c;
72    str[1] = '\0';
73
74    mbtowc(&wc, str, 1);
75
76    return (wc);
77}
78
79#ifdef NCR
80int
81_Xaw_iswspace(wchar_t w)
82{
83    int ret = 0;
84    wchar_t s = _Xaw_atowc(' ');
85
86    if (s == w)
87	ret = 1;
88
89  return (ret);
90}
91#endif
92
93int
94_Xaw_iswalnum(wchar_t ch)
95{
96#ifdef HAVE_ISWALNUM
97    return iswalnum(ch);
98#else
99    unsigned char mb[MB_LEN_MAX];
100
101    wctomb((char*)mb, ch);
102
103    return (isalnum(*mb));
104#endif
105}
106