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