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