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 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1986 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate /* This module is created for NLS on Jun.04.86 */ 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #ifndef _WIDEC_H 34*7c478bd9Sstevel@tonic-gate #define _WIDEC_H 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 41*7c478bd9Sstevel@tonic-gate #include <stdio.h> /* For definition of FILE */ 42*7c478bd9Sstevel@tonic-gate #endif 43*7c478bd9Sstevel@tonic-gate #include <euc.h> 44*7c478bd9Sstevel@tonic-gate #include <wchar.h> 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 47*7c478bd9Sstevel@tonic-gate extern "C" { 48*7c478bd9Sstevel@tonic-gate #endif 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 51*7c478bd9Sstevel@tonic-gate /* Character based input and output functions */ 52*7c478bd9Sstevel@tonic-gate extern wchar_t *getws(wchar_t *); 53*7c478bd9Sstevel@tonic-gate extern int putws(const wchar_t *); 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate #if !defined(__lint) 56*7c478bd9Sstevel@tonic-gate #define getwc(p) fgetwc(p) 57*7c478bd9Sstevel@tonic-gate #define putwc(x, p) fputwc((x), (p)) 58*7c478bd9Sstevel@tonic-gate #define getwchar() getwc(stdin) 59*7c478bd9Sstevel@tonic-gate #define putwchar(x) putwc((x), stdout) 60*7c478bd9Sstevel@tonic-gate #endif 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate /* wchar_t string operation functions */ 63*7c478bd9Sstevel@tonic-gate extern wchar_t *strtows(wchar_t *, char *); 64*7c478bd9Sstevel@tonic-gate extern wchar_t *wscpy(wchar_t *, const wchar_t *); 65*7c478bd9Sstevel@tonic-gate extern wchar_t *wsncpy(wchar_t *, const wchar_t *, size_t); 66*7c478bd9Sstevel@tonic-gate extern wchar_t *wscat(wchar_t *, const wchar_t *); 67*7c478bd9Sstevel@tonic-gate extern wchar_t *wsncat(wchar_t *, const wchar_t *, size_t); 68*7c478bd9Sstevel@tonic-gate extern wchar_t *wschr(const wchar_t *, wchar_t); 69*7c478bd9Sstevel@tonic-gate extern wchar_t *wsrchr(const wchar_t *, wchar_t); 70*7c478bd9Sstevel@tonic-gate extern wchar_t *wspbrk(const wchar_t *, const wchar_t *); 71*7c478bd9Sstevel@tonic-gate extern wchar_t *wstok(wchar_t *, const wchar_t *); 72*7c478bd9Sstevel@tonic-gate extern char *wstostr(char *, wchar_t *); 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate extern int wscmp(const wchar_t *, const wchar_t *); 75*7c478bd9Sstevel@tonic-gate extern int wsncmp(const wchar_t *, const wchar_t *, size_t); 76*7c478bd9Sstevel@tonic-gate extern size_t wslen(const wchar_t *); 77*7c478bd9Sstevel@tonic-gate extern size_t wsspn(const wchar_t *, const wchar_t *); 78*7c478bd9Sstevel@tonic-gate extern size_t wscspn(const wchar_t *, const wchar_t *); 79*7c478bd9Sstevel@tonic-gate extern int wscoll(const wchar_t *, const wchar_t *); 80*7c478bd9Sstevel@tonic-gate extern size_t wsxfrm(wchar_t *, const wchar_t *, size_t); 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX) 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate extern wchar_t *wsdup(const wchar_t *); 85*7c478bd9Sstevel@tonic-gate extern int wscol(const wchar_t *); 86*7c478bd9Sstevel@tonic-gate extern double wstod(const wchar_t *, wchar_t **); 87*7c478bd9Sstevel@tonic-gate extern long wstol(const wchar_t *, wchar_t **, int); 88*7c478bd9Sstevel@tonic-gate extern int wscasecmp(const wchar_t *, const wchar_t *); 89*7c478bd9Sstevel@tonic-gate extern int wsncasecmp(const wchar_t *, const wchar_t *, size_t); 90*7c478bd9Sstevel@tonic-gate extern int wsprintf(wchar_t *, const char *, ...); 91*7c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE) 92*7c478bd9Sstevel@tonic-gate extern long long wstoll(const wchar_t *, wchar_t **, int); 93*7c478bd9Sstevel@tonic-gate #endif /* defined(_LONGLONG_TYPE) */ 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX) */ 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate #else /* !defined(__STDC__) */ 98*7c478bd9Sstevel@tonic-gate /* Character based input and output functions */ 99*7c478bd9Sstevel@tonic-gate extern wchar_t *getws(); 100*7c478bd9Sstevel@tonic-gate extern int putws(); 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate #ifndef getwc 103*7c478bd9Sstevel@tonic-gate #define getwc(p) fgetwc(p) 104*7c478bd9Sstevel@tonic-gate #endif 105*7c478bd9Sstevel@tonic-gate #ifndef putwc 106*7c478bd9Sstevel@tonic-gate #define putwc(x, p) fputwc((x), (p)) 107*7c478bd9Sstevel@tonic-gate #endif 108*7c478bd9Sstevel@tonic-gate #ifndef getwchar 109*7c478bd9Sstevel@tonic-gate #define getwchar() getwc(stdin) 110*7c478bd9Sstevel@tonic-gate #endif 111*7c478bd9Sstevel@tonic-gate #ifndef putwchar 112*7c478bd9Sstevel@tonic-gate #define putwchar(x) putwc((x), stdout) 113*7c478bd9Sstevel@tonic-gate #endif 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate /* wchar_t string operation functions */ 116*7c478bd9Sstevel@tonic-gate extern wchar_t *strtows(); 117*7c478bd9Sstevel@tonic-gate extern wchar_t *wscpy(); 118*7c478bd9Sstevel@tonic-gate extern wchar_t *wsncpy(); 119*7c478bd9Sstevel@tonic-gate extern wchar_t *wscat(); 120*7c478bd9Sstevel@tonic-gate extern wchar_t *wsncat(); 121*7c478bd9Sstevel@tonic-gate extern wchar_t *wschr(); 122*7c478bd9Sstevel@tonic-gate extern wchar_t *wsrchr(); 123*7c478bd9Sstevel@tonic-gate extern wchar_t *wspbrk(); 124*7c478bd9Sstevel@tonic-gate extern wchar_t *wstok(); 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate extern int wscmp(); 127*7c478bd9Sstevel@tonic-gate extern int wsncmp(); 128*7c478bd9Sstevel@tonic-gate extern int wslen(); 129*7c478bd9Sstevel@tonic-gate extern int wsspn(); 130*7c478bd9Sstevel@tonic-gate extern int wscspn(); 131*7c478bd9Sstevel@tonic-gate extern int wscoll(); 132*7c478bd9Sstevel@tonic-gate extern int wsxfrm(); 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate extern char *wstostr(); 135*7c478bd9Sstevel@tonic-gate extern wchar_t *wsdup(); 136*7c478bd9Sstevel@tonic-gate extern int wscol(); 137*7c478bd9Sstevel@tonic-gate extern double wstod(); 138*7c478bd9Sstevel@tonic-gate extern long wstol(); 139*7c478bd9Sstevel@tonic-gate extern int wscasecmp(); 140*7c478bd9Sstevel@tonic-gate extern int wsncasecmp(); 141*7c478bd9Sstevel@tonic-gate extern int wsprintf(); 142*7c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE) 143*7c478bd9Sstevel@tonic-gate extern long long wstoll(); 144*7c478bd9Sstevel@tonic-gate #endif /* defined(_LONGLONG_TYPE) */ 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate #endif /* !defined(__STDC__) */ 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate /* Returns the code set number for the process code c. */ 149*7c478bd9Sstevel@tonic-gate #define WCHAR_SHIFT 7 150*7c478bd9Sstevel@tonic-gate #define WCHAR_S_MASK 0x7f 151*7c478bd9Sstevel@tonic-gate #define wcsetno(c) \ 152*7c478bd9Sstevel@tonic-gate (((c)&0x20000000)?(((c)&0x10000000)?1:3):(((c)&0x10000000)?2:0)) 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* Aliases... */ 155*7c478bd9Sstevel@tonic-gate #define windex wschr 156*7c478bd9Sstevel@tonic-gate #define wrindex wsrchr 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate #define watol(s) wstol((s), (wchar_t **)0, 10) 159*7c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE) && !defined(__lint) 160*7c478bd9Sstevel@tonic-gate #define watoll(s) wstoll((s), (wchar_t **)0, 10) 161*7c478bd9Sstevel@tonic-gate #endif /* defined(_LONGLONG_TYPE) && !defined(__lint) */ 162*7c478bd9Sstevel@tonic-gate #define watoi(s) ((int)wstol((s), (wchar_t **)0, 10)) 163*7c478bd9Sstevel@tonic-gate #define watof(s) wstod((s), (wchar_t **)0) 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate /* 166*7c478bd9Sstevel@tonic-gate * other macros. 167*7c478bd9Sstevel@tonic-gate */ 168*7c478bd9Sstevel@tonic-gate #define WCHAR_CSMASK 0x30000000 169*7c478bd9Sstevel@tonic-gate #define EUCMASK 0x30000000 170*7c478bd9Sstevel@tonic-gate #define WCHAR_CS0 0x00000000 171*7c478bd9Sstevel@tonic-gate #define WCHAR_CS1 0x30000000 172*7c478bd9Sstevel@tonic-gate #define WCHAR_CS2 0x10000000 173*7c478bd9Sstevel@tonic-gate #define WCHAR_CS3 0x20000000 174*7c478bd9Sstevel@tonic-gate #define WCHAR_BYTE_OF(wc, i) (((wc&~0x30000000)>>(7*(3-i)))&0x7f) 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate #endif 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #endif /* _WIDEC_H */ 181