xlocale.h revision 227753
1/*- 2 * Copyright (c) 2011 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by David Chisnall under sponsorship from 6 * the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright notice, 12 * this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $FreeBSD: head/include/xlocale.h 227753 2011-11-20 14:45:42Z theraven $ 30 */ 31 32#ifndef _XLOCALE_H_ 33#define _XLOCALE_H_ 34 35#include <locale.h> 36 37__BEGIN_DECLS 38 39/* 40 * Extended locale versions of the locale-aware functions from string.h. 41 * 42 * Include <string.h> before <xlocale.h> to expose these. 43 */ 44#ifdef _STRING_H_ 45int strcoll_l(const char *, const char *, locale_t); 46size_t strxfrm_l(char *, const char *, size_t, locale_t); 47int strcasecmp_l(const char *, const char *, locale_t); 48char *strcasestr_l(const char *, const char *, locale_t); 49int strncasecmp_l(const char *, const char *, size_t, locale_t); 50#endif 51/* 52 * Extended locale versions of the locale-aware functions from inttypes.h. 53 * 54 * Include <inttypes.h> before <xlocale.h> to expose these. 55 */ 56#ifdef _INTTYPES_H_ 57intmax_t 58strtoimax_l(const char * __restrict, char ** __restrict, int, locale_t); 59uintmax_t 60strtoumax_l(const char * __restrict, char ** __restrict, int, locale_t); 61intmax_t 62wcstoimax_l(const wchar_t * __restrict, wchar_t ** __restrict, int , locale_t); 63uintmax_t 64wcstoumax_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); 65#endif 66/* 67 * Extended locale versions of the locale-aware functions from monetary.h. 68 * 69 * Include <monetary.h> before <xlocale.h> to expose these. 70 */ 71#ifdef _MONETARY_H_ 72ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) 73# if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 74 __attribute__((__format__ (__strfmon__, 4, 5))) 75# endif 76 ; 77#endif 78 79/* 80 * Extended locale versions of the locale-aware functions from stdlib.h. 81 * 82 * Include <stdlib.h> before <xlocale.h> to expose these. 83 */ 84#ifdef _STDLIB_H_ 85double atof_l(const char *, locale_t); 86int atoi_l(const char *, locale_t); 87long atol_l(const char *, locale_t); 88long long atoll_l(const char *, locale_t); 89int mblen_l(const char *, size_t, locale_t); 90size_t 91mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t); 92int 93mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t); 94double strtod_l(const char *, char **, locale_t); 95float strtof_l(const char *, char **, locale_t); 96long strtol_l(const char *, char **, int, locale_t); 97long double strtold_l(const char *, char **, locale_t); 98long long strtoll_l(const char *, char **, int, locale_t); 99unsigned long strtoul_l(const char *, char **, int, locale_t); 100unsigned long long strtoull_l(const char *, char **, int, locale_t); 101size_t 102wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t, locale_t); 103int wctomb_l(char *, wchar_t, locale_t); 104 105int ___mb_cur_max_l(locale_t); 106#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) 107 108#endif 109/* 110 * Extended locale versions of the locale-aware functions from time.h. 111 * 112 * Include <time.h> before <xlocale.h> to expose these. 113 */ 114#ifdef _TIME_H_ 115size_t 116strftime_l(char * __restrict, size_t, const char * __restrict, const 117 struct tm * __restrict, locale_t) 118# if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 119 __attribute__((__format__ (__strftime__, 3, 0))) 120# endif 121 ; 122char * 123strptime_l(const char * __restrict, const char * __restrict, 124 struct tm * __restrict, locale_t); 125#endif 126#ifdef _LANGINFO_H_ 127char *nl_langinfo_l(nl_item, locale_t); 128#endif 129#ifdef _CTYPE_H_ 130#include <_xlocale_ctype.h> 131#endif 132#ifdef _WCTYPE_H_ 133#define XLOCALE_WCTYPES 1 134#include <_xlocale_ctype.h> 135#endif 136 137#ifdef _STDIO_H_ 138int fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...) 139 __printflike(3, 4); 140int fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...) 141 __scanflike(3, 4); 142int printf_l(locale_t, const char * __restrict, ...) __printflike(2, 3); 143int scanf_l(locale_t, const char * __restrict, ...) __scanflike(2, 3); 144int sprintf_l(char * __restrict, locale_t, const char * __restrict, ...) 145 __printflike(3, 4); 146int sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...) 147 __scanflike(3, 4); 148int vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list) 149 __printflike(3, 0); 150int vprintf_l(locale_t, const char * __restrict, __va_list) __printflike(2, 0); 151int vsprintf_l(char * __restrict, locale_t, const char * __restrict, __va_list) 152 __printflike(3, 0); 153 154int snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, 155 ...) __printflike(4, 5); 156int vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list) 157 __scanflike(3, 0); 158int vscanf_l(locale_t, const char * __restrict, __va_list) __scanflike(2, 0); 159int vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, 160 va_list) __printflike(4, 0); 161int vsscanf_l(const char * __restrict, locale_t, const char * __restrict, 162 va_list) __scanflike(3, 0); 163int dprintf_l(int, locale_t, const char * __restrict, ...) __printflike(3, 4); 164int vdprintf_l(int, locale_t, const char * __restrict, __va_list) 165 __printflike(3, 0); 166int asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4); 167int vasprintf_l(char **, locale_t, const char *, __va_list) __printflike(3, 0); 168#endif 169#ifdef _WCHAR_H_ 170wint_t btowc_l(int, locale_t); 171wint_t fgetwc_l(FILE *, locale_t); 172wchar_t * 173fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t); 174wint_t fputwc_l(wchar_t, FILE *, locale_t); 175int 176fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t); 177int 178fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, 179 ...); 180int 181fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); 182wint_t getwc_l(FILE *, locale_t); 183wint_t getwchar_l(locale_t); 184size_t 185mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t); 186size_t 187mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t, 188 mbstate_t * __restrict, locale_t); 189int mbsinit_l(const mbstate_t *, locale_t); 190size_t 191mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, 192 mbstate_t * __restrict, locale_t); 193wint_t putwc_l(wchar_t, FILE *, locale_t); 194wint_t putwchar_l(wchar_t, locale_t); 195int 196swprintf_l(wchar_t * __restrict, size_t n, locale_t, 197 const wchar_t * __restrict, ...); 198int 199swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict, 200 ...); 201wint_t ungetwc_l(wint_t, FILE *, locale_t); 202int 203vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, 204 __va_list); 205int 206vswprintf_l(wchar_t * __restrict, size_t n, locale_t, 207 const wchar_t * __restrict, __va_list); 208int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list); 209size_t 210wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t); 211int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); 212size_t 213wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict, 214 const struct tm * __restrict, locale_t); 215size_t 216wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, 217 mbstate_t * __restrict, locale_t); 218double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); 219long 220wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); 221unsigned long 222wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); 223int wcswidth_l(const wchar_t *, size_t, locale_t); 224size_t 225wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t); 226int wctob_l(wint_t, locale_t); 227int wcwidth_l(wchar_t, locale_t); 228int wprintf_l(locale_t, const wchar_t * __restrict, ...); 229int wscanf_l(locale_t, const wchar_t * __restrict, ...); 230 231int 232vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, 233 __va_list); 234int vswscanf_l(const wchar_t * __restrict, locale_t, 235const wchar_t *__restrict, __va_list); 236int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list); 237float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); 238long double 239wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); 240long long 241wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); 242unsigned long long 243wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); 244size_t 245mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t, 246 mbstate_t * __restrict, locale_t); 247int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); 248int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); 249size_t 250wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t, 251 mbstate_t * __restrict, locale_t); 252 253#endif 254 255struct lconv *localeconv_l(locale_t); 256__END_DECLS 257 258#endif 259