17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 1996, by Sun Microsystems, Inc. 247c478bd9Sstevel@tonic-gate * All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* 287c478bd9Sstevel@tonic-gate * ISO/IEC 9899: 1990/Add.3: 1993 (E): Wide character header file 297c478bd9Sstevel@tonic-gate * 307c478bd9Sstevel@tonic-gate * Copyright 1992, 1993 by Mortice Kern Systems Inc. All rights reserved. 317c478bd9Sstevel@tonic-gate * 327c478bd9Sstevel@tonic-gate * $Header: /rd/h/rcs/m_wchar.h 1.51 1995/09/20 19:17:54 ant Exp $ 33*1da57d55SToomas Soome * 347c478bd9Sstevel@tonic-gate */ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifndef __M_M_WCHAR_H__ 377c478bd9Sstevel@tonic-gate #define __M_M_WCHAR_H__ 1 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate /* 407c478bd9Sstevel@tonic-gate * m_wchar.h: 417c478bd9Sstevel@tonic-gate * configuration file for multi-byte vs. single byte enablement 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #include <wchar.h> 457c478bd9Sstevel@tonic-gate #include <wctype.h> 467c478bd9Sstevel@tonic-gate #include <limits.h> /* Fetch MB_LEN_MAX */ 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifdef M_I18N_LOCKING_SHIFT 497c478bd9Sstevel@tonic-gate extern char *m_strsanitize (char *); 507c478bd9Sstevel@tonic-gate #else 517c478bd9Sstevel@tonic-gate #define m_strsanitize(str) (str) 527c478bd9Sstevel@tonic-gate #endif /* M_I18N_LOCKING_SHIFT */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #ifdef M_I18N_MB 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate # ifndef MB_LEN_MAX 577c478bd9Sstevel@tonic-gate # error M_I18N_MB defined; but the local system does not support multibyte 587c478bd9Sstevel@tonic-gate # endif /* MB_LEN_MAX */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define MB_BEGIN if (MB_CUR_MAX > 1) { 617c478bd9Sstevel@tonic-gate #define MB_ELSE } else { 627c478bd9Sstevel@tonic-gate #define MB_END } 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #define M_MB_L(s) L##s 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #ifndef _WUCHAR_T 677c478bd9Sstevel@tonic-gate #define _WUCHAR_T 68*1da57d55SToomas Soome /* a typedef to allow single byte distinction between char and uchar 697c478bd9Sstevel@tonic-gate * in MKS environment 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate typedef wchar_t wuchar_t; 727c478bd9Sstevel@tonic-gate #endif /*_WUCHAR_T*/ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate extern wint_t m_escapewc(wchar_t **); 757c478bd9Sstevel@tonic-gate extern int m_fputmbs(FILE* fp, char *mbs, int wid, int prec, int ljust); 767c478bd9Sstevel@tonic-gate extern int m_fgetws (wchar_t *, size_t, FILE *); 777c478bd9Sstevel@tonic-gate extern FILE *m_fwopen (wchar_t *, char *); 787c478bd9Sstevel@tonic-gate extern wchar_t *m_wcsdup (const wchar_t *); 797c478bd9Sstevel@tonic-gate extern wchar_t *m_mbstowcsdup (const char *s); 807c478bd9Sstevel@tonic-gate extern char *m_wcstombsdup (const wchar_t *w); 817c478bd9Sstevel@tonic-gate extern char *m_mbschr (const char *, int); 827c478bd9Sstevel@tonic-gate extern char *m_mbsrchr (const char *, int); 837c478bd9Sstevel@tonic-gate extern char *m_mbspbrk (const char *, const char *); 847c478bd9Sstevel@tonic-gate extern wchar_t *m_wcsset (wchar_t *, wchar_t, size_t); 857c478bd9Sstevel@tonic-gate extern int iswabsname (wchar_t *); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define m_smalls(s) (s) 887c478bd9Sstevel@tonic-gate #define wctomb_init() wctomb(NULL,0) 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #else /* !M_I18N_MB */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* include <stdlib.h> here, 937c478bd9Sstevel@tonic-gate * We must include the multibyte function prototypes (in <stdlib.h>) before 947c478bd9Sstevel@tonic-gate * redefining the prototype function names below. 957c478bd9Sstevel@tonic-gate * 967c478bd9Sstevel@tonic-gate * AND including <stdlib.h> DOES NOT cause a problem with wchar_t. 977c478bd9Sstevel@tonic-gate * 987c478bd9Sstevel@tonic-gate * ANSI says that the typedef of wchar_t should be defined in stdlib.h. 997c478bd9Sstevel@tonic-gate * Thus, the prototypes in stdlib.h are declared using stdlib's definition 1007c478bd9Sstevel@tonic-gate * of wchar_t. 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #include <stdlib.h> /* DO NOT MOVE THIS include - THIS must be first */ 1047c478bd9Sstevel@tonic-gate #undef m_escapewc 1057c478bd9Sstevel@tonic-gate #undef m_fgetws 1067c478bd9Sstevel@tonic-gate #undef m_fwopen 1077c478bd9Sstevel@tonic-gate #undef m_wcsdup 1087c478bd9Sstevel@tonic-gate #undef m_mbstowcsdup 1097c478bd9Sstevel@tonic-gate #undef m_wcstombsdup 1107c478bd9Sstevel@tonic-gate #undef m_mbschr 1117c478bd9Sstevel@tonic-gate #undef m_mbsrchr 1127c478bd9Sstevel@tonic-gate #undef m_mbspbrk 1137c478bd9Sstevel@tonic-gate #undef m_wcsset 1147c478bd9Sstevel@tonic-gate #undef iswabsname 1157c478bd9Sstevel@tonic-gate #undef m_fputmbs 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define m_escapewc m_escapec 1187c478bd9Sstevel@tonic-gate #define m_fgetws m_fgets 1197c478bd9Sstevel@tonic-gate #define m_fwopen fopen 1207c478bd9Sstevel@tonic-gate #define m_wcsdup strdup 1217c478bd9Sstevel@tonic-gate #define m_mbstowcsdup strdup 1227c478bd9Sstevel@tonic-gate #define m_wcstombsdup strdup 1237c478bd9Sstevel@tonic-gate #define m_mbschr strchr 1247c478bd9Sstevel@tonic-gate #define m_mbsrchr strrchr 1257c478bd9Sstevel@tonic-gate #define m_mbspbrk strpbrk 1267c478bd9Sstevel@tonic-gate #define m_wcsset memset 1277c478bd9Sstevel@tonic-gate #define iswabsname(s) isabsname(s) 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate #define m_fputmbs(fp, str, wid, prec, ljust) \ 1307c478bd9Sstevel@tonic-gate fprintf((fp), (ljust) ? "%-*.*s" : "%*.*s", wid, prec, str) 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate #define MB_BEGIN if (0) { 1347c478bd9Sstevel@tonic-gate #define MB_ELSE } else { 1357c478bd9Sstevel@tonic-gate #define MB_END } 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #define M_MB_L(s) s 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate /* 1407c478bd9Sstevel@tonic-gate * Types and Macros 1417c478bd9Sstevel@tonic-gate */ 1427c478bd9Sstevel@tonic-gate #undef WEOF 1437c478bd9Sstevel@tonic-gate #undef wint_t 1447c478bd9Sstevel@tonic-gate #undef wuchar_t 1457c478bd9Sstevel@tonic-gate #undef wchar_t 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #define WEOF EOF 1487c478bd9Sstevel@tonic-gate #define wchar_t char /* ensures we never use the wchar_t typedef */ 1497c478bd9Sstevel@tonic-gate #define wint_t int /* type as large as either wchar_t or WEOF */ 1507c478bd9Sstevel@tonic-gate #define wuchar_t unsigned char /* Force override of typedef */ 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate /* 1537c478bd9Sstevel@tonic-gate * Must define _WCHAR_T, _WINT_T and _WUCHAR_T to avoid typedefs collisions 1547c478bd9Sstevel@tonic-gate * in other system headers. 1557c478bd9Sstevel@tonic-gate * Most systems do something like this: 1567c478bd9Sstevel@tonic-gate * #ifndef _WCHAR_T 1577c478bd9Sstevel@tonic-gate * #define _WCHAR_T 1587c478bd9Sstevel@tonic-gate * typedef unsigned short wchar_t 1597c478bd9Sstevel@tonic-gate * #endif 1607c478bd9Sstevel@tonic-gate * in their system headers to avoid multiple declarations of wchar_t 1617c478bd9Sstevel@tonic-gate */ 1627c478bd9Sstevel@tonic-gate #undef _WCHAR_T 1637c478bd9Sstevel@tonic-gate #undef _WINT_T 1647c478bd9Sstevel@tonic-gate #undef _WUCHAR_T 1657c478bd9Sstevel@tonic-gate #define _WCHAR_T 1667c478bd9Sstevel@tonic-gate #define _WINT_T 1677c478bd9Sstevel@tonic-gate #define _WUCHAR_T 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /* 1707c478bd9Sstevel@tonic-gate * Input/Output 1717c478bd9Sstevel@tonic-gate */ 1727c478bd9Sstevel@tonic-gate #undef fgetwc 1737c478bd9Sstevel@tonic-gate #undef getwc 1747c478bd9Sstevel@tonic-gate #undef getwchar 1757c478bd9Sstevel@tonic-gate #undef fputwc 1767c478bd9Sstevel@tonic-gate #undef putwc 1777c478bd9Sstevel@tonic-gate #undef putwchar 1787c478bd9Sstevel@tonic-gate #undef fputws 1797c478bd9Sstevel@tonic-gate #undef puts 1807c478bd9Sstevel@tonic-gate #undef fgetwx 1817c478bd9Sstevel@tonic-gate #undef getws 1827c478bd9Sstevel@tonic-gate #undef ungetwc 1837c478bd9Sstevel@tonic-gate #undef fwprintf 1847c478bd9Sstevel@tonic-gate #undef fwscanf 1857c478bd9Sstevel@tonic-gate #undef wprintf 1867c478bd9Sstevel@tonic-gate #undef wscanf 1877c478bd9Sstevel@tonic-gate #undef swscanf 1887c478bd9Sstevel@tonic-gate #undef vfwprintf 1897c478bd9Sstevel@tonic-gate #undef vwprintf 1907c478bd9Sstevel@tonic-gate #undef vswprintf 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate #define fgetwc fgetc 1937c478bd9Sstevel@tonic-gate #define getwc getc 1947c478bd9Sstevel@tonic-gate #define getwchar getchar 1957c478bd9Sstevel@tonic-gate #define fputwc fputc 1967c478bd9Sstevel@tonic-gate #define putwc putc 1977c478bd9Sstevel@tonic-gate #define putwchar putchar 1987c478bd9Sstevel@tonic-gate #define fputws fputs 1997c478bd9Sstevel@tonic-gate #define fgetws fgets 2007c478bd9Sstevel@tonic-gate #define getws gets 2017c478bd9Sstevel@tonic-gate #define ungetwc ungetc 2027c478bd9Sstevel@tonic-gate #define fwprintf fprintf 2037c478bd9Sstevel@tonic-gate #define fwscanf fscanf 2047c478bd9Sstevel@tonic-gate #define wprintf printf 2057c478bd9Sstevel@tonic-gate #define wscanf scanf 2067c478bd9Sstevel@tonic-gate #define swscanf sscanf 2077c478bd9Sstevel@tonic-gate #define vfwprintf vfprintf 2087c478bd9Sstevel@tonic-gate #define vwprintf vprintf 2097c478bd9Sstevel@tonic-gate /* NOTE: 2107c478bd9Sstevel@tonic-gate * In single byte mode, both swprintf() and vswprintf() are converted to 2117c478bd9Sstevel@tonic-gate * similar, but NOT IDENTICAL, functions that have slightly different 2127c478bd9Sstevel@tonic-gate * semantics. 2137c478bd9Sstevel@tonic-gate * The 2nd argument to both these routines (e.g the size_t arg) 2147c478bd9Sstevel@tonic-gate * is not used in the singlebyte environment since sprintf() and vsprintf() 2157c478bd9Sstevel@tonic-gate * do not support this argument. 2167c478bd9Sstevel@tonic-gate * One has to be careful when using this routine to not depend on 217*1da57d55SToomas Soome * the enforcement/safety of this 2nd argument. 218*1da57d55SToomas Soome * 2197c478bd9Sstevel@tonic-gate * swprintf() is converted to m_swprintf(), which is a C function 2207c478bd9Sstevel@tonic-gate * (because it can use a variable number of args), 221*1da57d55SToomas Soome * which is implemented as a call to vsprint() 2227c478bd9Sstevel@tonic-gate * vswprintf() is converted to vsprintf() 223*1da57d55SToomas Soome * 2247c478bd9Sstevel@tonic-gate */ 2257c478bd9Sstevel@tonic-gate #define swprintf m_swprintf 2267c478bd9Sstevel@tonic-gate #define vswprintf(w,n,f,v) vsprintf((char*)w,(const char*)f, v) 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate #ifndef m_smalls 2297c478bd9Sstevel@tonic-gate extern wchar_t *m_smalls (const wchar_t *); 2307c478bd9Sstevel@tonic-gate #endif /*m_smalls*/ 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate /* 2337c478bd9Sstevel@tonic-gate * General Utilities 2347c478bd9Sstevel@tonic-gate */ 2357c478bd9Sstevel@tonic-gate #undef wcstod 2367c478bd9Sstevel@tonic-gate #undef wcstol 2377c478bd9Sstevel@tonic-gate #undef wcstoul 2387c478bd9Sstevel@tonic-gate #undef wctomb_init 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate #define wcstod strtod 2417c478bd9Sstevel@tonic-gate #define wcstol strtol 2427c478bd9Sstevel@tonic-gate #define wcstoul strtoul 2437c478bd9Sstevel@tonic-gate #define wctomb_init() (0) /* No state dependency for nonmultibyte. */ 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* 2467c478bd9Sstevel@tonic-gate * Wide string handling 2477c478bd9Sstevel@tonic-gate */ 2487c478bd9Sstevel@tonic-gate #undef wcscpy 2497c478bd9Sstevel@tonic-gate #undef wcsncpy 2507c478bd9Sstevel@tonic-gate #undef wcscat 2517c478bd9Sstevel@tonic-gate #undef wcsncat 2527c478bd9Sstevel@tonic-gate #undef wcscoll 2537c478bd9Sstevel@tonic-gate #undef wcscmp 2547c478bd9Sstevel@tonic-gate #undef wcsncmp 2557c478bd9Sstevel@tonic-gate #undef wcsxfrm 2567c478bd9Sstevel@tonic-gate #undef wcschr 2577c478bd9Sstevel@tonic-gate #undef wcscspn 2587c478bd9Sstevel@tonic-gate #undef wcspbrk 2597c478bd9Sstevel@tonic-gate #undef wcsrchr 2607c478bd9Sstevel@tonic-gate #undef wcsspn 2617c478bd9Sstevel@tonic-gate #undef wcsstr 2627c478bd9Sstevel@tonic-gate #undef wcstok 2637c478bd9Sstevel@tonic-gate #undef wcslen 2647c478bd9Sstevel@tonic-gate #undef wcswidth 2657c478bd9Sstevel@tonic-gate #undef wcwidth 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate #define wcscpy strcpy 2687c478bd9Sstevel@tonic-gate #define wcsncpy strncpy 2697c478bd9Sstevel@tonic-gate #define wcscat strcat 2707c478bd9Sstevel@tonic-gate #define wcsncat strncat 2717c478bd9Sstevel@tonic-gate #define wcscoll strcoll 2727c478bd9Sstevel@tonic-gate #define wcscmp strcmp 2737c478bd9Sstevel@tonic-gate #define wcsncmp strncmp 2747c478bd9Sstevel@tonic-gate #define wcsxfrm strxfrm 2757c478bd9Sstevel@tonic-gate #define wcschr strchr 2767c478bd9Sstevel@tonic-gate #define wcscspn strcspn 2777c478bd9Sstevel@tonic-gate #define wcspbrk strpbrk 2787c478bd9Sstevel@tonic-gate #define wcsrchr strrchr 2797c478bd9Sstevel@tonic-gate #define wcsspn strspn 2807c478bd9Sstevel@tonic-gate #define wcsstr strstr 2817c478bd9Sstevel@tonic-gate #define wcstok(x, y, z) strtok(x, y) 2827c478bd9Sstevel@tonic-gate #define wcslen strlen 2837c478bd9Sstevel@tonic-gate #define wcswidth(s1, n) strlen(s1) /* Need a strnlen? */ 2847c478bd9Sstevel@tonic-gate #define wcwidth(c) 1 2857c478bd9Sstevel@tonic-gate 2867c478bd9Sstevel@tonic-gate /* 2877c478bd9Sstevel@tonic-gate * Date and time 2887c478bd9Sstevel@tonic-gate */ 2897c478bd9Sstevel@tonic-gate #undef wcsftime 2907c478bd9Sstevel@tonic-gate #define wcsftime strftime 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate /* 2937c478bd9Sstevel@tonic-gate * Extended Multibyte functions 2947c478bd9Sstevel@tonic-gate */ 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate #undef wctob 2977c478bd9Sstevel@tonic-gate #undef sisinit 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate #define wctob(c) ((int) (wint_t) (c)) 3007c478bd9Sstevel@tonic-gate #define sisinit(p) (1) /* Always in initial state */ 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate /* 3037c478bd9Sstevel@tonic-gate * Define prototypes for singlebyte equivalents of multibyte functions. 3047c478bd9Sstevel@tonic-gate * We have to use macros to map them to other function names, so that 3057c478bd9Sstevel@tonic-gate * they do not conflict with the prototypes from <stdlib.h> that may have 3067c478bd9Sstevel@tonic-gate * used a different definition of wchar_t. The restartable functions are 3077c478bd9Sstevel@tonic-gate * mapped to their non-restartable counterparts, since there is no state 3087c478bd9Sstevel@tonic-gate * information to be preserved. 3097c478bd9Sstevel@tonic-gate */ 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gate #undef mblen 3127c478bd9Sstevel@tonic-gate #undef mbrlen 3137c478bd9Sstevel@tonic-gate #undef mbtowc 3147c478bd9Sstevel@tonic-gate #undef mbrtowc 3157c478bd9Sstevel@tonic-gate #undef wctomb 3167c478bd9Sstevel@tonic-gate #undef wcrtomb 3177c478bd9Sstevel@tonic-gate #undef mbstowcs 3187c478bd9Sstevel@tonic-gate #undef mbsrtowcs 3197c478bd9Sstevel@tonic-gate #undef wcstombs 3207c478bd9Sstevel@tonic-gate #undef wcsrtombs 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate #define mblen(s, n) m_sb_mblen(s, n) 3237c478bd9Sstevel@tonic-gate #define mbrlen(s, n, ps) m_sb_mblen(s, n) 3247c478bd9Sstevel@tonic-gate #define mbtowc(pwc, s, n) m_sb_mbtowc(pwc, s, n) 3257c478bd9Sstevel@tonic-gate #define mbrtowc(pwc, s, n, ps) m_sb_mbtowc(pwc, s, n) 3267c478bd9Sstevel@tonic-gate #define wctomb(s, wc) m_sb_wctomb(s, wc) 3277c478bd9Sstevel@tonic-gate #define wcrtomb(s, wc, ps) m_sb_wctomb(s, wc) 3287c478bd9Sstevel@tonic-gate #define mbstowcs(pwcs, s, n) m_sb_mbstowcs(pwcs, s, n) 3297c478bd9Sstevel@tonic-gate #define mbsrtowcs(pwcs, s, n, ps) m_sb_mbstowcs(pwcs, s, n) 3307c478bd9Sstevel@tonic-gate #define wcstombs(s, pwcs, n) m_sb_wcstombs(s, pwcs, n) 3317c478bd9Sstevel@tonic-gate #define wcsrtombs(s, pwcs, n, ps) m_sb_wcstombs(s, pwcs, n) 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate extern int m_sb_mblen(const char *s, size_t n); 3347c478bd9Sstevel@tonic-gate extern int m_sb_mbtowc(wchar_t *pwc, const char *s, size_t n); 3357c478bd9Sstevel@tonic-gate extern int m_sb_wctomb(char *s, wchar_t wc); 3367c478bd9Sstevel@tonic-gate extern size_t m_sb_mbstowcs(wchar_t *pwcs, const char *s, size_t n); 3377c478bd9Sstevel@tonic-gate extern size_t m_sb_wcstombs(char *s, const wchar_t *pwcs, size_t n); 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate /* 3407c478bd9Sstevel@tonic-gate * convert definitions from <wctype.h> 3417c478bd9Sstevel@tonic-gate */ 3427c478bd9Sstevel@tonic-gate #undef iswalnum 3437c478bd9Sstevel@tonic-gate #undef iswalpha 3447c478bd9Sstevel@tonic-gate #undef iswcntrl 3457c478bd9Sstevel@tonic-gate #undef iswdigit 3467c478bd9Sstevel@tonic-gate #undef iswgraph 3477c478bd9Sstevel@tonic-gate #undef iswlower 3487c478bd9Sstevel@tonic-gate #undef iswprint 3497c478bd9Sstevel@tonic-gate #undef iswpunct 3507c478bd9Sstevel@tonic-gate #undef iswspace 3517c478bd9Sstevel@tonic-gate #undef iswupper 3527c478bd9Sstevel@tonic-gate #undef iswxdigit 3537c478bd9Sstevel@tonic-gate #undef iswblank 3547c478bd9Sstevel@tonic-gate #undef towlower 3557c478bd9Sstevel@tonic-gate #undef towupper 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate #define iswalnum(c) isalnum(c) 3587c478bd9Sstevel@tonic-gate #define iswalpha(c) isalpha(c) 3597c478bd9Sstevel@tonic-gate #define iswcntrl(c) iscntrl(c) 3607c478bd9Sstevel@tonic-gate #define iswdigit(c) isdigit(c) 3617c478bd9Sstevel@tonic-gate #define iswgraph(c) isgraph(c) 3627c478bd9Sstevel@tonic-gate #define iswlower(c) islower(c) 3637c478bd9Sstevel@tonic-gate #define iswprint(c) isprint(c) 3647c478bd9Sstevel@tonic-gate #define iswpunct(c) ispunct(c) 3657c478bd9Sstevel@tonic-gate #define iswspace(c) isspace(c) 3667c478bd9Sstevel@tonic-gate #define iswupper(c) isupper(c) 3677c478bd9Sstevel@tonic-gate #define iswxdigit(c) isxdigit(c) 3687c478bd9Sstevel@tonic-gate #define iswblank(c) isblank(c) 3697c478bd9Sstevel@tonic-gate #define towlower(c) tolower(c) 3707c478bd9Sstevel@tonic-gate #define towupper(c) toupper(c) 3717c478bd9Sstevel@tonic-gate 3727c478bd9Sstevel@tonic-gate /* 373*1da57d55SToomas Soome * Note: MKS libc/gen/iswctype.c contains the system independent version 3747c478bd9Sstevel@tonic-gate * of wctype() and iswctype(). 3757c478bd9Sstevel@tonic-gate * 3767c478bd9Sstevel@tonic-gate * In single byte mode, we can't use the names wctype() and iswctype(). 3777c478bd9Sstevel@tonic-gate * These may have been defined in the system's headers (e.g <wctype.h>) 3787c478bd9Sstevel@tonic-gate * using the system definition of wint_t and wctype_t. 3797c478bd9Sstevel@tonic-gate * BUT we have just changed the meaning of wint_t above, to an 'int' 3807c478bd9Sstevel@tonic-gate * which may not be the same size as wint_t. 3817c478bd9Sstevel@tonic-gate * Thus, we rename them so that we don't get any prototype conflicts 3827c478bd9Sstevel@tonic-gate */ 3837c478bd9Sstevel@tonic-gate #undef wctype 3847c478bd9Sstevel@tonic-gate #undef iswctype 3857c478bd9Sstevel@tonic-gate #define wctype _m_wctype 3867c478bd9Sstevel@tonic-gate #define iswctype _m_iswctype 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate extern wctype_t wctype(const char *property); 3897c478bd9Sstevel@tonic-gate extern int iswctype(wint_t wc, wctype_t desc); 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate /* 3937c478bd9Sstevel@tonic-gate * .2 Functions 3947c478bd9Sstevel@tonic-gate */ 3957c478bd9Sstevel@tonic-gate #include <fnmatch.h> 3967c478bd9Sstevel@tonic-gate #undef fnwwmatch 3977c478bd9Sstevel@tonic-gate #undef fnwnmatch 3987c478bd9Sstevel@tonic-gate #define fnwwmatch fnmatch 3997c478bd9Sstevel@tonic-gate #define fnwnmatch fnmatch 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate #include <regex.h> 4027c478bd9Sstevel@tonic-gate #undef regwcomp 4037c478bd9Sstevel@tonic-gate #undef regwexec 4047c478bd9Sstevel@tonic-gate #undef regwdosub 4057c478bd9Sstevel@tonic-gate #undef regwdosuba 4067c478bd9Sstevel@tonic-gate #undef regwmatch_t 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate #define regwcomp regcomp 4097c478bd9Sstevel@tonic-gate #define regwexec regexec 4107c478bd9Sstevel@tonic-gate #define regwdosub regdosub 4117c478bd9Sstevel@tonic-gate #define regwdosuba regdosuba 4127c478bd9Sstevel@tonic-gate #define regwmatch_t regmatch_t 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate #endif /* M_I18N_MB */ 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate /* 4177c478bd9Sstevel@tonic-gate * prototypes that are common to both SingleByte and MultiByte 4187c478bd9Sstevel@tonic-gate */ 4197c478bd9Sstevel@tonic-gate extern int m_mbswidth (const char *, size_t); 4207c478bd9Sstevel@tonic-gate extern int m_mbsrwidth (const char *, size_t, mbstate_t *); 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gate 423*1da57d55SToomas Soome #endif /*__M_M_WCHAR_H__*/ 424