1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1996, by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* 30*0Sstevel@tonic-gate * ISO/IEC 9899: 1990/Add.3: 1993 (E): Wide character header file 31*0Sstevel@tonic-gate * 32*0Sstevel@tonic-gate * Copyright 1992, 1993 by Mortice Kern Systems Inc. All rights reserved. 33*0Sstevel@tonic-gate * 34*0Sstevel@tonic-gate * $Header: /rd/h/rcs/m_wchar.h 1.51 1995/09/20 19:17:54 ant Exp $ 35*0Sstevel@tonic-gate * 36*0Sstevel@tonic-gate */ 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #ifndef __M_M_WCHAR_H__ 39*0Sstevel@tonic-gate #define __M_M_WCHAR_H__ 1 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate /* 42*0Sstevel@tonic-gate * m_wchar.h: 43*0Sstevel@tonic-gate * configuration file for multi-byte vs. single byte enablement 44*0Sstevel@tonic-gate */ 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate #include <wchar.h> 47*0Sstevel@tonic-gate #include <wctype.h> 48*0Sstevel@tonic-gate #include <limits.h> /* Fetch MB_LEN_MAX */ 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #ifdef M_I18N_LOCKING_SHIFT 51*0Sstevel@tonic-gate extern char *m_strsanitize (char *); 52*0Sstevel@tonic-gate #else 53*0Sstevel@tonic-gate #define m_strsanitize(str) (str) 54*0Sstevel@tonic-gate #endif /* M_I18N_LOCKING_SHIFT */ 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate #ifdef M_I18N_MB 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate # ifndef MB_LEN_MAX 59*0Sstevel@tonic-gate # error M_I18N_MB defined; but the local system does not support multibyte 60*0Sstevel@tonic-gate # endif /* MB_LEN_MAX */ 61*0Sstevel@tonic-gate 62*0Sstevel@tonic-gate #define MB_BEGIN if (MB_CUR_MAX > 1) { 63*0Sstevel@tonic-gate #define MB_ELSE } else { 64*0Sstevel@tonic-gate #define MB_END } 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate #define M_MB_L(s) L##s 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate #ifndef _WUCHAR_T 69*0Sstevel@tonic-gate #define _WUCHAR_T 70*0Sstevel@tonic-gate /* a typedef to allow single byte distinction between char and uchar 71*0Sstevel@tonic-gate * in MKS environment 72*0Sstevel@tonic-gate */ 73*0Sstevel@tonic-gate typedef wchar_t wuchar_t; 74*0Sstevel@tonic-gate #endif /*_WUCHAR_T*/ 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate extern wint_t m_escapewc(wchar_t **); 77*0Sstevel@tonic-gate extern int m_fputmbs(FILE* fp, char *mbs, int wid, int prec, int ljust); 78*0Sstevel@tonic-gate extern int m_fgetws (wchar_t *, size_t, FILE *); 79*0Sstevel@tonic-gate extern FILE *m_fwopen (wchar_t *, char *); 80*0Sstevel@tonic-gate extern wchar_t *m_wcsdup (const wchar_t *); 81*0Sstevel@tonic-gate extern wchar_t *m_mbstowcsdup (const char *s); 82*0Sstevel@tonic-gate extern char *m_wcstombsdup (const wchar_t *w); 83*0Sstevel@tonic-gate extern char *m_mbschr (const char *, int); 84*0Sstevel@tonic-gate extern char *m_mbsrchr (const char *, int); 85*0Sstevel@tonic-gate extern char *m_mbspbrk (const char *, const char *); 86*0Sstevel@tonic-gate extern wchar_t *m_wcsset (wchar_t *, wchar_t, size_t); 87*0Sstevel@tonic-gate extern int iswabsname (wchar_t *); 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate #define m_smalls(s) (s) 90*0Sstevel@tonic-gate #define wctomb_init() wctomb(NULL,0) 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #else /* !M_I18N_MB */ 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate /* include <stdlib.h> here, 95*0Sstevel@tonic-gate * We must include the multibyte function prototypes (in <stdlib.h>) before 96*0Sstevel@tonic-gate * redefining the prototype function names below. 97*0Sstevel@tonic-gate * 98*0Sstevel@tonic-gate * AND including <stdlib.h> DOES NOT cause a problem with wchar_t. 99*0Sstevel@tonic-gate * 100*0Sstevel@tonic-gate * ANSI says that the typedef of wchar_t should be defined in stdlib.h. 101*0Sstevel@tonic-gate * Thus, the prototypes in stdlib.h are declared using stdlib's definition 102*0Sstevel@tonic-gate * of wchar_t. 103*0Sstevel@tonic-gate */ 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate #include <stdlib.h> /* DO NOT MOVE THIS include - THIS must be first */ 106*0Sstevel@tonic-gate #undef m_escapewc 107*0Sstevel@tonic-gate #undef m_fgetws 108*0Sstevel@tonic-gate #undef m_fwopen 109*0Sstevel@tonic-gate #undef m_wcsdup 110*0Sstevel@tonic-gate #undef m_mbstowcsdup 111*0Sstevel@tonic-gate #undef m_wcstombsdup 112*0Sstevel@tonic-gate #undef m_mbschr 113*0Sstevel@tonic-gate #undef m_mbsrchr 114*0Sstevel@tonic-gate #undef m_mbspbrk 115*0Sstevel@tonic-gate #undef m_wcsset 116*0Sstevel@tonic-gate #undef iswabsname 117*0Sstevel@tonic-gate #undef m_fputmbs 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate #define m_escapewc m_escapec 120*0Sstevel@tonic-gate #define m_fgetws m_fgets 121*0Sstevel@tonic-gate #define m_fwopen fopen 122*0Sstevel@tonic-gate #define m_wcsdup strdup 123*0Sstevel@tonic-gate #define m_mbstowcsdup strdup 124*0Sstevel@tonic-gate #define m_wcstombsdup strdup 125*0Sstevel@tonic-gate #define m_mbschr strchr 126*0Sstevel@tonic-gate #define m_mbsrchr strrchr 127*0Sstevel@tonic-gate #define m_mbspbrk strpbrk 128*0Sstevel@tonic-gate #define m_wcsset memset 129*0Sstevel@tonic-gate #define iswabsname(s) isabsname(s) 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate #define m_fputmbs(fp, str, wid, prec, ljust) \ 132*0Sstevel@tonic-gate fprintf((fp), (ljust) ? "%-*.*s" : "%*.*s", wid, prec, str) 133*0Sstevel@tonic-gate 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate #define MB_BEGIN if (0) { 136*0Sstevel@tonic-gate #define MB_ELSE } else { 137*0Sstevel@tonic-gate #define MB_END } 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate #define M_MB_L(s) s 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate /* 142*0Sstevel@tonic-gate * Types and Macros 143*0Sstevel@tonic-gate */ 144*0Sstevel@tonic-gate #undef WEOF 145*0Sstevel@tonic-gate #undef wint_t 146*0Sstevel@tonic-gate #undef wuchar_t 147*0Sstevel@tonic-gate #undef wchar_t 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate #define WEOF EOF 150*0Sstevel@tonic-gate #define wchar_t char /* ensures we never use the wchar_t typedef */ 151*0Sstevel@tonic-gate #define wint_t int /* type as large as either wchar_t or WEOF */ 152*0Sstevel@tonic-gate #define wuchar_t unsigned char /* Force override of typedef */ 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate /* 155*0Sstevel@tonic-gate * Must define _WCHAR_T, _WINT_T and _WUCHAR_T to avoid typedefs collisions 156*0Sstevel@tonic-gate * in other system headers. 157*0Sstevel@tonic-gate * Most systems do something like this: 158*0Sstevel@tonic-gate * #ifndef _WCHAR_T 159*0Sstevel@tonic-gate * #define _WCHAR_T 160*0Sstevel@tonic-gate * typedef unsigned short wchar_t 161*0Sstevel@tonic-gate * #endif 162*0Sstevel@tonic-gate * in their system headers to avoid multiple declarations of wchar_t 163*0Sstevel@tonic-gate */ 164*0Sstevel@tonic-gate #undef _WCHAR_T 165*0Sstevel@tonic-gate #undef _WINT_T 166*0Sstevel@tonic-gate #undef _WUCHAR_T 167*0Sstevel@tonic-gate #define _WCHAR_T 168*0Sstevel@tonic-gate #define _WINT_T 169*0Sstevel@tonic-gate #define _WUCHAR_T 170*0Sstevel@tonic-gate 171*0Sstevel@tonic-gate /* 172*0Sstevel@tonic-gate * Input/Output 173*0Sstevel@tonic-gate */ 174*0Sstevel@tonic-gate #undef fgetwc 175*0Sstevel@tonic-gate #undef getwc 176*0Sstevel@tonic-gate #undef getwchar 177*0Sstevel@tonic-gate #undef fputwc 178*0Sstevel@tonic-gate #undef putwc 179*0Sstevel@tonic-gate #undef putwchar 180*0Sstevel@tonic-gate #undef fputws 181*0Sstevel@tonic-gate #undef puts 182*0Sstevel@tonic-gate #undef fgetwx 183*0Sstevel@tonic-gate #undef getws 184*0Sstevel@tonic-gate #undef ungetwc 185*0Sstevel@tonic-gate #undef fwprintf 186*0Sstevel@tonic-gate #undef fwscanf 187*0Sstevel@tonic-gate #undef wprintf 188*0Sstevel@tonic-gate #undef wscanf 189*0Sstevel@tonic-gate #undef swscanf 190*0Sstevel@tonic-gate #undef vfwprintf 191*0Sstevel@tonic-gate #undef vwprintf 192*0Sstevel@tonic-gate #undef vswprintf 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate #define fgetwc fgetc 195*0Sstevel@tonic-gate #define getwc getc 196*0Sstevel@tonic-gate #define getwchar getchar 197*0Sstevel@tonic-gate #define fputwc fputc 198*0Sstevel@tonic-gate #define putwc putc 199*0Sstevel@tonic-gate #define putwchar putchar 200*0Sstevel@tonic-gate #define fputws fputs 201*0Sstevel@tonic-gate #define fgetws fgets 202*0Sstevel@tonic-gate #define getws gets 203*0Sstevel@tonic-gate #define ungetwc ungetc 204*0Sstevel@tonic-gate #define fwprintf fprintf 205*0Sstevel@tonic-gate #define fwscanf fscanf 206*0Sstevel@tonic-gate #define wprintf printf 207*0Sstevel@tonic-gate #define wscanf scanf 208*0Sstevel@tonic-gate #define swscanf sscanf 209*0Sstevel@tonic-gate #define vfwprintf vfprintf 210*0Sstevel@tonic-gate #define vwprintf vprintf 211*0Sstevel@tonic-gate /* NOTE: 212*0Sstevel@tonic-gate * In single byte mode, both swprintf() and vswprintf() are converted to 213*0Sstevel@tonic-gate * similar, but NOT IDENTICAL, functions that have slightly different 214*0Sstevel@tonic-gate * semantics. 215*0Sstevel@tonic-gate * The 2nd argument to both these routines (e.g the size_t arg) 216*0Sstevel@tonic-gate * is not used in the singlebyte environment since sprintf() and vsprintf() 217*0Sstevel@tonic-gate * do not support this argument. 218*0Sstevel@tonic-gate * One has to be careful when using this routine to not depend on 219*0Sstevel@tonic-gate * the enforcement/safety of this 2nd argument. 220*0Sstevel@tonic-gate * 221*0Sstevel@tonic-gate * swprintf() is converted to m_swprintf(), which is a C function 222*0Sstevel@tonic-gate * (because it can use a variable number of args), 223*0Sstevel@tonic-gate * which is implemented as a call to vsprint() 224*0Sstevel@tonic-gate * vswprintf() is converted to vsprintf() 225*0Sstevel@tonic-gate * 226*0Sstevel@tonic-gate */ 227*0Sstevel@tonic-gate #define swprintf m_swprintf 228*0Sstevel@tonic-gate #define vswprintf(w,n,f,v) vsprintf((char*)w,(const char*)f, v) 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate #ifndef m_smalls 231*0Sstevel@tonic-gate extern wchar_t *m_smalls (const wchar_t *); 232*0Sstevel@tonic-gate #endif /*m_smalls*/ 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate /* 235*0Sstevel@tonic-gate * General Utilities 236*0Sstevel@tonic-gate */ 237*0Sstevel@tonic-gate #undef wcstod 238*0Sstevel@tonic-gate #undef wcstol 239*0Sstevel@tonic-gate #undef wcstoul 240*0Sstevel@tonic-gate #undef wctomb_init 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate #define wcstod strtod 243*0Sstevel@tonic-gate #define wcstol strtol 244*0Sstevel@tonic-gate #define wcstoul strtoul 245*0Sstevel@tonic-gate #define wctomb_init() (0) /* No state dependency for nonmultibyte. */ 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate /* 248*0Sstevel@tonic-gate * Wide string handling 249*0Sstevel@tonic-gate */ 250*0Sstevel@tonic-gate #undef wcscpy 251*0Sstevel@tonic-gate #undef wcsncpy 252*0Sstevel@tonic-gate #undef wcscat 253*0Sstevel@tonic-gate #undef wcsncat 254*0Sstevel@tonic-gate #undef wcscoll 255*0Sstevel@tonic-gate #undef wcscmp 256*0Sstevel@tonic-gate #undef wcsncmp 257*0Sstevel@tonic-gate #undef wcsxfrm 258*0Sstevel@tonic-gate #undef wcschr 259*0Sstevel@tonic-gate #undef wcscspn 260*0Sstevel@tonic-gate #undef wcspbrk 261*0Sstevel@tonic-gate #undef wcsrchr 262*0Sstevel@tonic-gate #undef wcsspn 263*0Sstevel@tonic-gate #undef wcsstr 264*0Sstevel@tonic-gate #undef wcstok 265*0Sstevel@tonic-gate #undef wcslen 266*0Sstevel@tonic-gate #undef wcswidth 267*0Sstevel@tonic-gate #undef wcwidth 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gate #define wcscpy strcpy 270*0Sstevel@tonic-gate #define wcsncpy strncpy 271*0Sstevel@tonic-gate #define wcscat strcat 272*0Sstevel@tonic-gate #define wcsncat strncat 273*0Sstevel@tonic-gate #define wcscoll strcoll 274*0Sstevel@tonic-gate #define wcscmp strcmp 275*0Sstevel@tonic-gate #define wcsncmp strncmp 276*0Sstevel@tonic-gate #define wcsxfrm strxfrm 277*0Sstevel@tonic-gate #define wcschr strchr 278*0Sstevel@tonic-gate #define wcscspn strcspn 279*0Sstevel@tonic-gate #define wcspbrk strpbrk 280*0Sstevel@tonic-gate #define wcsrchr strrchr 281*0Sstevel@tonic-gate #define wcsspn strspn 282*0Sstevel@tonic-gate #define wcsstr strstr 283*0Sstevel@tonic-gate #define wcstok(x, y, z) strtok(x, y) 284*0Sstevel@tonic-gate #define wcslen strlen 285*0Sstevel@tonic-gate #define wcswidth(s1, n) strlen(s1) /* Need a strnlen? */ 286*0Sstevel@tonic-gate #define wcwidth(c) 1 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gate /* 289*0Sstevel@tonic-gate * Date and time 290*0Sstevel@tonic-gate */ 291*0Sstevel@tonic-gate #undef wcsftime 292*0Sstevel@tonic-gate #define wcsftime strftime 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate /* 295*0Sstevel@tonic-gate * Extended Multibyte functions 296*0Sstevel@tonic-gate */ 297*0Sstevel@tonic-gate 298*0Sstevel@tonic-gate #undef wctob 299*0Sstevel@tonic-gate #undef sisinit 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate #define wctob(c) ((int) (wint_t) (c)) 302*0Sstevel@tonic-gate #define sisinit(p) (1) /* Always in initial state */ 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /* 305*0Sstevel@tonic-gate * Define prototypes for singlebyte equivalents of multibyte functions. 306*0Sstevel@tonic-gate * We have to use macros to map them to other function names, so that 307*0Sstevel@tonic-gate * they do not conflict with the prototypes from <stdlib.h> that may have 308*0Sstevel@tonic-gate * used a different definition of wchar_t. The restartable functions are 309*0Sstevel@tonic-gate * mapped to their non-restartable counterparts, since there is no state 310*0Sstevel@tonic-gate * information to be preserved. 311*0Sstevel@tonic-gate */ 312*0Sstevel@tonic-gate 313*0Sstevel@tonic-gate #undef mblen 314*0Sstevel@tonic-gate #undef mbrlen 315*0Sstevel@tonic-gate #undef mbtowc 316*0Sstevel@tonic-gate #undef mbrtowc 317*0Sstevel@tonic-gate #undef wctomb 318*0Sstevel@tonic-gate #undef wcrtomb 319*0Sstevel@tonic-gate #undef mbstowcs 320*0Sstevel@tonic-gate #undef mbsrtowcs 321*0Sstevel@tonic-gate #undef wcstombs 322*0Sstevel@tonic-gate #undef wcsrtombs 323*0Sstevel@tonic-gate 324*0Sstevel@tonic-gate #define mblen(s, n) m_sb_mblen(s, n) 325*0Sstevel@tonic-gate #define mbrlen(s, n, ps) m_sb_mblen(s, n) 326*0Sstevel@tonic-gate #define mbtowc(pwc, s, n) m_sb_mbtowc(pwc, s, n) 327*0Sstevel@tonic-gate #define mbrtowc(pwc, s, n, ps) m_sb_mbtowc(pwc, s, n) 328*0Sstevel@tonic-gate #define wctomb(s, wc) m_sb_wctomb(s, wc) 329*0Sstevel@tonic-gate #define wcrtomb(s, wc, ps) m_sb_wctomb(s, wc) 330*0Sstevel@tonic-gate #define mbstowcs(pwcs, s, n) m_sb_mbstowcs(pwcs, s, n) 331*0Sstevel@tonic-gate #define mbsrtowcs(pwcs, s, n, ps) m_sb_mbstowcs(pwcs, s, n) 332*0Sstevel@tonic-gate #define wcstombs(s, pwcs, n) m_sb_wcstombs(s, pwcs, n) 333*0Sstevel@tonic-gate #define wcsrtombs(s, pwcs, n, ps) m_sb_wcstombs(s, pwcs, n) 334*0Sstevel@tonic-gate 335*0Sstevel@tonic-gate extern int m_sb_mblen(const char *s, size_t n); 336*0Sstevel@tonic-gate extern int m_sb_mbtowc(wchar_t *pwc, const char *s, size_t n); 337*0Sstevel@tonic-gate extern int m_sb_wctomb(char *s, wchar_t wc); 338*0Sstevel@tonic-gate extern size_t m_sb_mbstowcs(wchar_t *pwcs, const char *s, size_t n); 339*0Sstevel@tonic-gate extern size_t m_sb_wcstombs(char *s, const wchar_t *pwcs, size_t n); 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate /* 342*0Sstevel@tonic-gate * convert definitions from <wctype.h> 343*0Sstevel@tonic-gate */ 344*0Sstevel@tonic-gate #undef iswalnum 345*0Sstevel@tonic-gate #undef iswalpha 346*0Sstevel@tonic-gate #undef iswcntrl 347*0Sstevel@tonic-gate #undef iswdigit 348*0Sstevel@tonic-gate #undef iswgraph 349*0Sstevel@tonic-gate #undef iswlower 350*0Sstevel@tonic-gate #undef iswprint 351*0Sstevel@tonic-gate #undef iswpunct 352*0Sstevel@tonic-gate #undef iswspace 353*0Sstevel@tonic-gate #undef iswupper 354*0Sstevel@tonic-gate #undef iswxdigit 355*0Sstevel@tonic-gate #undef iswblank 356*0Sstevel@tonic-gate #undef towlower 357*0Sstevel@tonic-gate #undef towupper 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate #define iswalnum(c) isalnum(c) 360*0Sstevel@tonic-gate #define iswalpha(c) isalpha(c) 361*0Sstevel@tonic-gate #define iswcntrl(c) iscntrl(c) 362*0Sstevel@tonic-gate #define iswdigit(c) isdigit(c) 363*0Sstevel@tonic-gate #define iswgraph(c) isgraph(c) 364*0Sstevel@tonic-gate #define iswlower(c) islower(c) 365*0Sstevel@tonic-gate #define iswprint(c) isprint(c) 366*0Sstevel@tonic-gate #define iswpunct(c) ispunct(c) 367*0Sstevel@tonic-gate #define iswspace(c) isspace(c) 368*0Sstevel@tonic-gate #define iswupper(c) isupper(c) 369*0Sstevel@tonic-gate #define iswxdigit(c) isxdigit(c) 370*0Sstevel@tonic-gate #define iswblank(c) isblank(c) 371*0Sstevel@tonic-gate #define towlower(c) tolower(c) 372*0Sstevel@tonic-gate #define towupper(c) toupper(c) 373*0Sstevel@tonic-gate 374*0Sstevel@tonic-gate /* 375*0Sstevel@tonic-gate * Note: MKS libc/gen/iswctype.c contains the system independent version 376*0Sstevel@tonic-gate * of wctype() and iswctype(). 377*0Sstevel@tonic-gate * 378*0Sstevel@tonic-gate * In single byte mode, we can't use the names wctype() and iswctype(). 379*0Sstevel@tonic-gate * These may have been defined in the system's headers (e.g <wctype.h>) 380*0Sstevel@tonic-gate * using the system definition of wint_t and wctype_t. 381*0Sstevel@tonic-gate * BUT we have just changed the meaning of wint_t above, to an 'int' 382*0Sstevel@tonic-gate * which may not be the same size as wint_t. 383*0Sstevel@tonic-gate * Thus, we rename them so that we don't get any prototype conflicts 384*0Sstevel@tonic-gate */ 385*0Sstevel@tonic-gate #undef wctype 386*0Sstevel@tonic-gate #undef iswctype 387*0Sstevel@tonic-gate #define wctype _m_wctype 388*0Sstevel@tonic-gate #define iswctype _m_iswctype 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate extern wctype_t wctype(const char *property); 391*0Sstevel@tonic-gate extern int iswctype(wint_t wc, wctype_t desc); 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gate 394*0Sstevel@tonic-gate /* 395*0Sstevel@tonic-gate * .2 Functions 396*0Sstevel@tonic-gate */ 397*0Sstevel@tonic-gate #include <fnmatch.h> 398*0Sstevel@tonic-gate #undef fnwwmatch 399*0Sstevel@tonic-gate #undef fnwnmatch 400*0Sstevel@tonic-gate #define fnwwmatch fnmatch 401*0Sstevel@tonic-gate #define fnwnmatch fnmatch 402*0Sstevel@tonic-gate 403*0Sstevel@tonic-gate #include <regex.h> 404*0Sstevel@tonic-gate #undef regwcomp 405*0Sstevel@tonic-gate #undef regwexec 406*0Sstevel@tonic-gate #undef regwdosub 407*0Sstevel@tonic-gate #undef regwdosuba 408*0Sstevel@tonic-gate #undef regwmatch_t 409*0Sstevel@tonic-gate 410*0Sstevel@tonic-gate #define regwcomp regcomp 411*0Sstevel@tonic-gate #define regwexec regexec 412*0Sstevel@tonic-gate #define regwdosub regdosub 413*0Sstevel@tonic-gate #define regwdosuba regdosuba 414*0Sstevel@tonic-gate #define regwmatch_t regmatch_t 415*0Sstevel@tonic-gate 416*0Sstevel@tonic-gate #endif /* M_I18N_MB */ 417*0Sstevel@tonic-gate 418*0Sstevel@tonic-gate /* 419*0Sstevel@tonic-gate * prototypes that are common to both SingleByte and MultiByte 420*0Sstevel@tonic-gate */ 421*0Sstevel@tonic-gate extern int m_mbswidth (const char *, size_t); 422*0Sstevel@tonic-gate extern int m_mbsrwidth (const char *, size_t, mbstate_t *); 423*0Sstevel@tonic-gate 424*0Sstevel@tonic-gate 425*0Sstevel@tonic-gate #endif /*__M_M_WCHAR_H__*/ 426