XawI18n.c revision 5ec34c4c
17a84e134Smrg/* Copyright 1991 NCR Corporation - Dayton, Ohio, USA */ 27a84e134Smrg 37a84e134Smrg/* 47a84e134Smrg * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, 57a84e134Smrg * and Nippon Telegraph and Telephone Corporation 67a84e134Smrg * 77a84e134Smrg * Permission to use, copy, modify, distribute, and sell this software and its 87a84e134Smrg * documentation for any purpose is hereby granted without fee, provided that 97a84e134Smrg * the above copyright notice appear in all copies and that both that 107a84e134Smrg * copyright notice and this permission notice appear in supporting 117a84e134Smrg * documentation, and that the names of OMRON, NTT Software, and NTT 127a84e134Smrg * not be used in advertising or publicity pertaining to distribution of the 137a84e134Smrg * software without specific, written prior permission. OMRON, NTT Software, 147a84e134Smrg * and NTT make no representations about the suitability of this 157a84e134Smrg * software for any purpose. It is provided "as is" without express or 167a84e134Smrg * implied warranty. 177a84e134Smrg * 187a84e134Smrg * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD 197a84e134Smrg * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 207a84e134Smrg * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT BE 21421c997bSmrg * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 227a84e134Smrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 237a84e134Smrg * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 247a84e134Smrg * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 257a84e134Smrg * 267a84e134Smrg * Author: Li Yuhong OMRON Corporation 277a84e134Smrg */ 287a84e134Smrg 297a84e134Smrg/* 307a84e134Smrg 317a84e134SmrgCopyright 1991, 1994, 1998 The Open Group 327a84e134Smrg 337a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its 347a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that 357a84e134Smrgthe above copyright notice appear in all copies and that both that 367a84e134Smrgcopyright notice and this permission notice appear in supporting 377a84e134Smrgdocumentation. 387a84e134Smrg 397a84e134SmrgThe above copyright notice and this permission notice shall be included in 407a84e134Smrgall copies or substantial portions of the Software. 417a84e134Smrg 427a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 437a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 447a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 457a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 467a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 477a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 487a84e134Smrg 497a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be 507a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings 517a84e134Smrgin this Software without prior written authorization from The Open Group. 527a84e134Smrg 537a84e134Smrg*/ 547a84e134Smrg 557a84e134Smrg#ifdef HAVE_CONFIG_H 567a84e134Smrg#include <config.h> 577a84e134Smrg#endif 587a84e134Smrg#include <X11/IntrinsicP.h> 597a84e134Smrg#include "XawI18n.h" 607a84e134Smrg 617a84e134Smrgwchar_t 627a84e134Smrg#if NeedWidePrototypes 637a84e134Smrg_Xaw_atowc(int c) 647a84e134Smrg#else 657a84e134Smrg_Xaw_atowc(unsigned char c) 667a84e134Smrg#endif 677a84e134Smrg{ 687a84e134Smrg wchar_t wc; 697a84e134Smrg char str[2]; 707a84e134Smrg 715ec34c4cSmrg str[0] = (char)c; 727a84e134Smrg str[1] = '\0'; 737a84e134Smrg 747a84e134Smrg mbtowc(&wc, str, 1); 757a84e134Smrg 767a84e134Smrg return (wc); 777a84e134Smrg} 787a84e134Smrg 797a84e134Smrg#ifdef NCR 807a84e134Smrgint 817a84e134Smrg_Xaw_iswspace(wchar_t w) 827a84e134Smrg{ 837a84e134Smrg int ret = 0; 847a84e134Smrg wchar_t s = _Xaw_atowc(' '); 857a84e134Smrg 867a84e134Smrg if (s == w) 877a84e134Smrg ret = 1; 887a84e134Smrg 897a84e134Smrg return (ret); 907a84e134Smrg} 917a84e134Smrg#endif 927a84e134Smrg 937a84e134Smrgint 947a84e134Smrg_Xaw_iswalnum(wchar_t ch) 957a84e134Smrg{ 967a84e134Smrg#ifdef HAVE_ISWALNUM 975ec34c4cSmrg return iswalnum((wint_t)ch); 987a84e134Smrg#else 997a84e134Smrg unsigned char mb[MB_LEN_MAX]; 1007a84e134Smrg 1017a84e134Smrg wctomb((char*)mb, ch); 1027a84e134Smrg 1037a84e134Smrg return (isalnum(*mb)); 104421c997bSmrg#endif 1057a84e134Smrg} 106