12d08521bSGarrett D'Amore /* 22d08521bSGarrett D'Amore * This file and its contents are supplied under the terms of the 32d08521bSGarrett D'Amore * Common Development and Distribution License ("CDDL"), version 1.0. 42d08521bSGarrett D'Amore * You may only use this file in accordance with the terms of version 52d08521bSGarrett D'Amore * 1.0 of the CDDL. 62d08521bSGarrett D'Amore * 72d08521bSGarrett D'Amore * A full copy of the text of the CDDL should have accompanied this 82d08521bSGarrett D'Amore * source. A copy of the CDDL is also available via the Internet at 92d08521bSGarrett D'Amore * http://www.illumos.org/license/CDDL. 102d08521bSGarrett D'Amore */ 112d08521bSGarrett D'Amore 122d08521bSGarrett D'Amore /* 132d08521bSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 142d08521bSGarrett D'Amore */ 152d08521bSGarrett D'Amore 162d08521bSGarrett D'Amore #ifndef _XLOCALE_H 172d08521bSGarrett D'Amore #define _XLOCALE_H 182d08521bSGarrett D'Amore 192d08521bSGarrett D'Amore /* 202d08521bSGarrett D'Amore * This file supplies declarations for extended locale routines, as 212d08521bSGarrett D'Amore * originally delivered by MacOS X. Many of these things are now 222d08521bSGarrett D'Amore * officially part of XPG7. (Note that while the interfaces are the 232d08521bSGarrett D'Amore * same as MacOS X, there is no shared implementation.) 242d08521bSGarrett D'Amore * 252d08521bSGarrett D'Amore * Those declarations that are part of XPG7 are provided for the in the 262d08521bSGarrett D'Amore * XPG7-specified location. This file lists just the declarations that 272d08521bSGarrett D'Amore * were not part of the standard. These will be useful in their own right, 282d08521bSGarrett D'Amore * and will aid porting programs that don't strictly follow the standard. 292d08521bSGarrett D'Amore * 302d08521bSGarrett D'Amore * Note that it is an error to include this file in a program with strict 312d08521bSGarrett D'Amore * symbol visibilty rules (under strict ANSI or POSIX_C_SOURCE rules.) 322d08521bSGarrett D'Amore * If this is done, the symbols defined here will indeed be exposed to your 332d08521bSGarrett D'Amore * program, but those symbols that are part of the related standards might 342d08521bSGarrett D'Amore * not be. 352d08521bSGarrett D'Amore */ 362d08521bSGarrett D'Amore 372d08521bSGarrett D'Amore #include <sys/feature_tests.h> 382d08521bSGarrett D'Amore #include <wchar.h> 392d08521bSGarrett D'Amore #include <locale.h> 402d08521bSGarrett D'Amore #include <stdio.h> 412d08521bSGarrett D'Amore 422d08521bSGarrett D'Amore #ifdef __cplusplus 432d08521bSGarrett D'Amore extern "C" { 442d08521bSGarrett D'Amore #endif 452d08521bSGarrett D'Amore 462d08521bSGarrett D'Amore #ifndef _LOCALE_T 472d08521bSGarrett D'Amore #define _LOCALE_T 48*732efd55SDan McDonald typedef struct _locale *locale_t; 492d08521bSGarrett D'Amore #endif 502d08521bSGarrett D'Amore 512d08521bSGarrett D'Amore extern int mbsinit_l(const mbstate_t *, locale_t); 522d08521bSGarrett D'Amore 532d08521bSGarrett D'Amore extern size_t mbsrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, 542d08521bSGarrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 552d08521bSGarrett D'Amore 562d08521bSGarrett D'Amore extern size_t mbsnrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD, 572d08521bSGarrett D'Amore size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 582d08521bSGarrett D'Amore 592d08521bSGarrett D'Amore extern char *strptime_l(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 602d08521bSGarrett D'Amore struct tm *_RESTRICT_KYWD, locale_t); 612d08521bSGarrett D'Amore 622d08521bSGarrett D'Amore extern int wcwidth_l(wchar_t, locale_t); 632d08521bSGarrett D'Amore 642d08521bSGarrett D'Amore extern int wcswidth_l(const wchar_t *, size_t, locale_t); 652d08521bSGarrett D'Amore 662d08521bSGarrett D'Amore extern int iswspecial_l(wint_t, locale_t); 672d08521bSGarrett D'Amore extern int iswnumber_l(wint_t, locale_t); 682d08521bSGarrett D'Amore extern int iswhexnumber_l(wint_t, locale_t); 692d08521bSGarrett D'Amore extern int iswideogram_l(wint_t, locale_t); 702d08521bSGarrett D'Amore extern int iswphonogram_l(wint_t, locale_t); 712d08521bSGarrett D'Amore 722d08521bSGarrett D'Amore extern wint_t btowc_l(int, locale_t); 732d08521bSGarrett D'Amore extern int wctob_l(wint_t, locale_t); 742d08521bSGarrett D'Amore extern size_t mbrtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 752d08521bSGarrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 762d08521bSGarrett D'Amore extern size_t mbstowcs_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, 772d08521bSGarrett D'Amore size_t, locale_t); 782d08521bSGarrett D'Amore extern int mblen_l(const char *, size_t, locale_t); 792d08521bSGarrett D'Amore extern size_t mbrlen_l(const char *_RESTRICT_KYWD, size_t, 802d08521bSGarrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t); 812d08521bSGarrett D'Amore extern int mbtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, 822d08521bSGarrett D'Amore locale_t); 832d08521bSGarrett D'Amore extern size_t wcsrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, 84538aa54dSGarrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 85538aa54dSGarrett D'Amore extern size_t wcsnrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD, 86538aa54dSGarrett D'Amore size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t); 872d08521bSGarrett D'Amore extern size_t wcrtomb_l(char *_RESTRICT_KYWD, wchar_t, 882d08521bSGarrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t); 892d08521bSGarrett D'Amore extern size_t wcstombs_l(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, 902d08521bSGarrett D'Amore size_t, locale_t); 912d08521bSGarrett D'Amore extern int wctomb_l(char *, wchar_t, locale_t); 922d08521bSGarrett D'Amore 932d08521bSGarrett D'Amore extern unsigned char __mb_cur_max_l(locale_t); 942d08521bSGarrett D'Amore #ifndef MB_CUR_MAX_L 952d08521bSGarrett D'Amore #define MB_CUR_MAX_L(l) (__mb_cur_max_l(l)) 962d08521bSGarrett D'Amore #endif 972d08521bSGarrett D'Amore 982d08521bSGarrett D'Amore 992d08521bSGarrett D'Amore #if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L 1002d08521bSGarrett D'Amore #define _FILEDEFED 1012d08521bSGarrett D'Amore typedef __FILE FILE; 1022d08521bSGarrett D'Amore #endif 1032d08521bSGarrett D'Amore 1042d08521bSGarrett D'Amore extern wint_t fgetwc_l(FILE *, locale_t); 1052d08521bSGarrett D'Amore extern wint_t getwc_l(FILE *, locale_t); 1062d08521bSGarrett D'Amore 1072d08521bSGarrett D'Amore #ifndef getwchar_l 1082d08521bSGarrett D'Amore #define getwchar_l(l) fgetwc_l(stdin, (l)) 1092d08521bSGarrett D'Amore #endif 1102d08521bSGarrett D'Amore 1112d08521bSGarrett D'Amore #ifdef __cplusplus 1122d08521bSGarrett D'Amore } 1132d08521bSGarrett D'Amore #endif 1142d08521bSGarrett D'Amore 1152d08521bSGarrett D'Amore #endif /* _XLOCALE_H */ 116