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