1*2d08521bSGarrett D'Amore /* 2*2d08521bSGarrett D'Amore * This file and its contents are supplied under the terms of the 3*2d08521bSGarrett D'Amore * Common Development and Distribution License ("CDDL"), version 1.0. 4*2d08521bSGarrett D'Amore * You may only use this file in accordance with the terms of version 5*2d08521bSGarrett D'Amore * 1.0 of the CDDL. 6*2d08521bSGarrett D'Amore * 7*2d08521bSGarrett D'Amore * A full copy of the text of the CDDL should have accompanied this 8*2d08521bSGarrett D'Amore * source. A copy of the CDDL is also available via the Internet at 9*2d08521bSGarrett D'Amore * http://www.illumos.org/license/CDDL. 10*2d08521bSGarrett D'Amore */ 11*2d08521bSGarrett D'Amore 12*2d08521bSGarrett D'Amore /* 13*2d08521bSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 14*2d08521bSGarrett D'Amore */ 15*2d08521bSGarrett D'Amore 16*2d08521bSGarrett D'Amore #ifndef _XLOCALE_H 17*2d08521bSGarrett D'Amore #define _XLOCALE_H 18*2d08521bSGarrett D'Amore 19*2d08521bSGarrett D'Amore /* 20*2d08521bSGarrett D'Amore * This file supplies declarations for extended locale routines, as 21*2d08521bSGarrett D'Amore * originally delivered by MacOS X. Many of these things are now 22*2d08521bSGarrett D'Amore * officially part of XPG7. (Note that while the interfaces are the 23*2d08521bSGarrett D'Amore * same as MacOS X, there is no shared implementation.) 24*2d08521bSGarrett D'Amore * 25*2d08521bSGarrett D'Amore * Those declarations that are part of XPG7 are provided for the in the 26*2d08521bSGarrett D'Amore * XPG7-specified location. This file lists just the declarations that 27*2d08521bSGarrett D'Amore * were not part of the standard. These will be useful in their own right, 28*2d08521bSGarrett D'Amore * and will aid porting programs that don't strictly follow the standard. 29*2d08521bSGarrett D'Amore * 30*2d08521bSGarrett D'Amore * Note that it is an error to include this file in a program with strict 31*2d08521bSGarrett D'Amore * symbol visibilty rules (under strict ANSI or POSIX_C_SOURCE rules.) 32*2d08521bSGarrett D'Amore * If this is done, the symbols defined here will indeed be exposed to your 33*2d08521bSGarrett D'Amore * program, but those symbols that are part of the related standards might 34*2d08521bSGarrett D'Amore * not be. 35*2d08521bSGarrett D'Amore */ 36*2d08521bSGarrett D'Amore 37*2d08521bSGarrett D'Amore #include <sys/feature_tests.h> 38*2d08521bSGarrett D'Amore #include <wchar.h> 39*2d08521bSGarrett D'Amore #include <locale.h> 40*2d08521bSGarrett D'Amore #include <stdio.h> 41*2d08521bSGarrett D'Amore 42*2d08521bSGarrett D'Amore #ifdef __cplusplus 43*2d08521bSGarrett D'Amore extern "C" { 44*2d08521bSGarrett D'Amore #endif 45*2d08521bSGarrett D'Amore 46*2d08521bSGarrett D'Amore #ifndef _LOCALE_T 47*2d08521bSGarrett D'Amore #define _LOCALE_T 48*2d08521bSGarrett D'Amore typedef struct locale *locale_t; 49*2d08521bSGarrett D'Amore #endif 50*2d08521bSGarrett D'Amore 51*2d08521bSGarrett D'Amore extern int mbsinit_l(const mbstate_t *, locale_t); 52*2d08521bSGarrett D'Amore 53*2d08521bSGarrett D'Amore extern size_t mbsrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, 54*2d08521bSGarrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 55*2d08521bSGarrett D'Amore 56*2d08521bSGarrett D'Amore extern size_t mbsnrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, 57*2d08521bSGarrett D'Amore size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 58*2d08521bSGarrett D'Amore 59*2d08521bSGarrett D'Amore extern char *strptime_l(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 60*2d08521bSGarrett D'Amore struct tm *_RESTRICT_KYWD, locale_t); 61*2d08521bSGarrett D'Amore 62*2d08521bSGarrett D'Amore extern int wcwidth_l(wchar_t, locale_t); 63*2d08521bSGarrett D'Amore 64*2d08521bSGarrett D'Amore extern int wcswidth_l(const wchar_t *, size_t, locale_t); 65*2d08521bSGarrett D'Amore 66*2d08521bSGarrett D'Amore extern int iswspecial_l(wint_t, locale_t); 67*2d08521bSGarrett D'Amore extern int iswnumber_l(wint_t, locale_t); 68*2d08521bSGarrett D'Amore extern int iswhexnumber_l(wint_t, locale_t); 69*2d08521bSGarrett D'Amore extern int iswideogram_l(wint_t, locale_t); 70*2d08521bSGarrett D'Amore extern int iswphonogram_l(wint_t, locale_t); 71*2d08521bSGarrett D'Amore 72*2d08521bSGarrett D'Amore extern wint_t btowc_l(int, locale_t); 73*2d08521bSGarrett D'Amore extern int wctob_l(wint_t, locale_t); 74*2d08521bSGarrett D'Amore extern size_t mbrtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 75*2d08521bSGarrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 76*2d08521bSGarrett D'Amore extern size_t mbstowcs_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 77*2d08521bSGarrett D'Amore size_t, locale_t); 78*2d08521bSGarrett D'Amore extern int mblen_l(const char *, size_t, locale_t); 79*2d08521bSGarrett D'Amore extern size_t mbrlen_l(const char *_RESTRICT_KYWD, size_t, 80*2d08521bSGarrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t); 81*2d08521bSGarrett D'Amore extern int mbtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, 82*2d08521bSGarrett D'Amore locale_t); 83*2d08521bSGarrett D'Amore extern size_t wcsrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, 84*2d08521bSGarrett D'Amore size_t len, mbstate_t *_RESTRICT_KYWD, locale_t); 85*2d08521bSGarrett D'Amore extern size_t wcrtomb_l(char *_RESTRICT_KYWD, wchar_t, 86*2d08521bSGarrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t); 87*2d08521bSGarrett D'Amore extern size_t wcstombs_l(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, 88*2d08521bSGarrett D'Amore size_t, locale_t); 89*2d08521bSGarrett D'Amore extern int wctomb_l(char *, wchar_t, locale_t); 90*2d08521bSGarrett D'Amore 91*2d08521bSGarrett D'Amore extern unsigned char __mb_cur_max_l(locale_t); 92*2d08521bSGarrett D'Amore #ifndef MB_CUR_MAX_L 93*2d08521bSGarrett D'Amore #define MB_CUR_MAX_L(l) (__mb_cur_max_l(l)) 94*2d08521bSGarrett D'Amore #endif 95*2d08521bSGarrett D'Amore 96*2d08521bSGarrett D'Amore 97*2d08521bSGarrett D'Amore #if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L 98*2d08521bSGarrett D'Amore #define _FILEDEFED 99*2d08521bSGarrett D'Amore typedef __FILE FILE; 100*2d08521bSGarrett D'Amore #endif 101*2d08521bSGarrett D'Amore 102*2d08521bSGarrett D'Amore extern wint_t fgetwc_l(FILE *, locale_t); 103*2d08521bSGarrett D'Amore extern wint_t getwc_l(FILE *, locale_t); 104*2d08521bSGarrett D'Amore 105*2d08521bSGarrett D'Amore #ifndef getwchar_l 106*2d08521bSGarrett D'Amore #define getwchar_l(l) fgetwc_l(stdin, (l)) 107*2d08521bSGarrett D'Amore #endif 108*2d08521bSGarrett D'Amore 109*2d08521bSGarrett D'Amore #ifdef __cplusplus 110*2d08521bSGarrett D'Amore } 111*2d08521bSGarrett D'Amore #endif 112*2d08521bSGarrett D'Amore 113*2d08521bSGarrett D'Amore #endif /* _XLOCALE_H */ 114