| 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 |
|
| 31 |
Copyright 1991, 1994, 1998 The Open Group |
| 32 |
|
| 33 |
Permission to use, copy, modify, distribute, and sell this software and its |
| 34 |
documentation for any purpose is hereby granted without fee, provided that |
| 35 |
the above copyright notice appear in all copies and that both that |
| 36 |
copyright notice and this permission notice appear in supporting |
| 37 |
documentation. |
| 38 |
|
| 39 |
The above copyright notice and this permission notice shall be included in |
| 40 |
all copies or substantial portions of the Software. |
| 41 |
|
| 42 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 43 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 44 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 45 |
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 46 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 47 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 48 |
|
| 49 |
Except as contained in this notice, the name of The Open Group shall not be |
| 50 |
used in advertising or otherwise to promote the sale, use or other dealings |
| 51 |
in 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 |
|
| 61 |
wchar_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] = (char)c; |
| 72 |
str[1] = '\0'; |
| 73 |
|
| 74 |
mbtowc(&wc, str, 1); |
| 75 |
|
| 76 |
return (wc); |
| 77 |
} |
| 78 |
|
| 79 |
int |
| 80 |
_Xaw_iswalnum(wchar_t ch) |
| 81 |
{ |
| 82 |
#ifdef HAVE_ISWALNUM |
| 83 |
return iswalnum((wint_t)ch); |
| 84 |
#else |
| 85 |
unsigned char mb[MB_LEN_MAX]; |
| 86 |
|
| 87 |
wctomb((char*)mb, ch); |
| 88 |
|
| 89 |
return (isalnum(*mb)); |
| 90 |
#endif |
| 91 |
} |