2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore/*
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * This file and its contents are supplied under the terms of the
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * Common Development and Distribution License ("CDDL"), version 1.0.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * You may only use this file in accordance with the terms of version
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * 1.0 of the CDDL.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore *
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * A full copy of the text of the CDDL should have accompanied this
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * source. A copy of the CDDL is also available via the Internet at
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * http://www.illumos.org/license/CDDL.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore */
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore/*
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore */
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifndef _XLOCALE_H
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#define _XLOCALE_H
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore/*
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * This file supplies declarations for extended locale routines, as
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * originally delivered by MacOS X. Many of these things are now
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * officially part of XPG7. (Note that while the interfaces are the
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * same as MacOS X, there is no shared implementation.)
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore *
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * Those declarations that are part of XPG7 are provided for the in the
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * XPG7-specified location. This file lists just the declarations that
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * were not part of the standard. These will be useful in their own right,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * and will aid porting programs that don't strictly follow the standard.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore *
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * Note that it is an error to include this file in a program with strict
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * symbol visibilty rules (under strict ANSI or POSIX_C_SOURCE rules.)
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * If this is done, the symbols defined here will indeed be exposed to your
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * program, but those symbols that are part of the related standards might
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * not be.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore */
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include <sys/feature_tests.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include <wchar.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include <locale.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include <stdio.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifdef __cplusplus
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern "C" {
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifndef _LOCALE_T
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#define _LOCALE_T
732efd5515b5788339f3da4db04de7cea0f79c86Dan McDonaldtypedef struct _locale *locale_t;
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int mbsinit_l(const mbstate_t *, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t mbsrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t mbsnrtowcs_l(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern char *strptime_l(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore struct tm *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int wcwidth_l(wchar_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int wcswidth_l(const wchar_t *, size_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int iswspecial_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int iswnumber_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int iswhexnumber_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int iswideogram_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int iswphonogram_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern wint_t btowc_l(int, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int wctob_l(wint_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t mbrtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t mbstowcs_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore size_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int mblen_l(const char *, size_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t mbrlen_l(const char *_RESTRICT_KYWD, size_t,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int mbtowc_l(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t wcsrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
538aa54d819fa7751ca82bcc30d4ed8c57ec2ef2Garrett D'Amore size_t, mbstate_t *_RESTRICT_KYWD, locale_t);
538aa54d819fa7751ca82bcc30d4ed8c57ec2ef2Garrett D'Amoreextern size_t wcsnrtombs_l(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
538aa54d819fa7751ca82bcc30d4ed8c57ec2ef2Garrett D'Amore size_t, size_t, mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t wcrtomb_l(char *_RESTRICT_KYWD, wchar_t,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore mbstate_t *_RESTRICT_KYWD, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern size_t wcstombs_l(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore size_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern int wctomb_l(char *, wchar_t, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern unsigned char __mb_cur_max_l(locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifndef MB_CUR_MAX_L
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#define MB_CUR_MAX_L(l) (__mb_cur_max_l(l))
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#if defined(_XPG4) && !defined(_FILEDEFED) || __cplusplus >= 199711L
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#define _FILEDEFED
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoretypedef __FILE FILE;
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern wint_t fgetwc_l(FILE *, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreextern wint_t getwc_l(FILE *, locale_t);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifndef getwchar_l
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#define getwchar_l(l) fgetwc_l(stdin, (l))
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#ifdef __cplusplus
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore}
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#endif /* _XLOCALE_H */