2013-05-17 18:11:55 +04:00
|
|
|
/* $NetBSD: locale.h,v 1.24 2013/05/17 14:11:55 joerg Exp $ */
|
1994-10-26 03:55:40 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1998-02-03 00:07:13 +03:00
|
|
|
* Copyright (c) 1991, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 13:44:09 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1998-02-03 00:07:13 +03:00
|
|
|
* @(#)locale.h 8.1 (Berkeley) 6/2/93
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LOCALE_H_
|
|
|
|
#define _LOCALE_H_
|
|
|
|
|
2013-04-28 01:24:27 +04:00
|
|
|
#include <sys/featuretest.h>
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
struct lconv {
|
|
|
|
char *decimal_point;
|
|
|
|
char *thousands_sep;
|
|
|
|
char *grouping;
|
|
|
|
char *int_curr_symbol;
|
|
|
|
char *currency_symbol;
|
|
|
|
char *mon_decimal_point;
|
|
|
|
char *mon_thousands_sep;
|
|
|
|
char *mon_grouping;
|
|
|
|
char *positive_sign;
|
|
|
|
char *negative_sign;
|
|
|
|
char int_frac_digits;
|
|
|
|
char frac_digits;
|
|
|
|
char p_cs_precedes;
|
|
|
|
char p_sep_by_space;
|
|
|
|
char n_cs_precedes;
|
|
|
|
char n_sep_by_space;
|
|
|
|
char p_sign_posn;
|
|
|
|
char n_sign_posn;
|
2001-01-02 13:53:24 +03:00
|
|
|
char int_p_cs_precedes;
|
|
|
|
char int_n_cs_precedes;
|
|
|
|
char int_p_sep_by_space;
|
|
|
|
char int_n_sep_by_space;
|
|
|
|
char int_p_sign_posn;
|
|
|
|
char int_n_sign_posn;
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
2000-01-10 19:58:36 +03:00
|
|
|
#include <sys/null.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
#define LC_ALL 0
|
|
|
|
#define LC_COLLATE 1
|
|
|
|
#define LC_CTYPE 2
|
|
|
|
#define LC_MONETARY 3
|
|
|
|
#define LC_NUMERIC 4
|
|
|
|
#define LC_TIME 5
|
1993-09-03 00:46:33 +04:00
|
|
|
#define LC_MESSAGES 6
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1993-09-03 00:46:33 +04:00
|
|
|
#define _LC_LAST 7 /* marks end */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
2013-04-18 00:40:13 +04:00
|
|
|
#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
|
|
|
|
defined(__SETLOCALE_SOURCE__)
|
|
|
|
# ifndef __LOCALE_T_DECLARED
|
|
|
|
typedef struct _locale *locale_t;
|
|
|
|
# define __LOCALE_T_DECLARED
|
|
|
|
# endif
|
|
|
|
#endif
|
Fixes PR lib/39662, shortcomings in LC_{MONETARY,NUMERIC,TIME,MESSAGES} db format.
ok'ed by core and releng.
(thanks for agc@, snj@ and i'm sorry for long time patience).
[libc]
- localeio.[ch] and lc*.[ch] in src/lib/libc/locale was replaced by
new locale-db implementation using citrus_db backend,
see src/lib/libc/citrus/citrus_lc_*.[ch].
- add citrus_bcs_strtou?l.c. don't use strtou?l locale implementation
internally, because they're locale-aware function.
- add some stubs for multi-locale issue, see {current,global}_locale.c.
- remove some obsolete file, setrunelocale.c, ___runetype_mb.c.
- remove __savectype() from ctypeio.[ch].
[tools]
- mklocale(1): add new option ``-t'' that generates new style
LC_{MONETARY,NUMERIC,TIME,MESSAGES} locale-db format.
- chrtbl(1): added ctypeio.[ch] for __savectype().
[locale-db]
- added en_US.US-ASCII locale.
- removed some shareable locale definition file:
en_US.US-ASCII -> en_US.ISO8859-1, en_US.UTF-8
zh_CN.eucCN -> zh_CN.GB18030
and more...see src/share/locale/*/Makefile.
- remove obsoleted locale sr_YU, added new locale sr_ME, sr_RS.
- change locale name ja_JP.ISO2022-JP* -> ja_JP.ISO-2022-JP*
for X11's locale.alias file alignments.
- fix regression test, wrong wcs?width(3), NAN/INF usage.
i tested release-build following arch:
i386, amd64, hpc{mips,arm,sh}, sparc64, vax.
citrus_lc_*.[ch] also can read old-plain-text style locale-db.
so that backward compatibility is keeped, but lc*.[ch] can't read
new citrus_db'ed locale-db and localeio.c never check sanity,
so forward compatibility is broken ;-<
old mklocale(1) doesn't know -t option, so you have to rebuild toolchain.
2009-01-02 03:20:18 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
__BEGIN_DECLS
|
2010-06-07 17:52:28 +04:00
|
|
|
struct lconv *localeconv(void);
|
|
|
|
char *setlocale(int, const char *) __RENAME(__setlocale50);
|
2013-04-18 00:40:13 +04:00
|
|
|
|
|
|
|
#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
|
|
|
|
# ifndef __LOCALE_T_DECLARED
|
|
|
|
typedef struct _locale *locale_t;
|
|
|
|
# define __LOCALE_T_DECLARED
|
|
|
|
# endif
|
2013-04-30 04:45:04 +04:00
|
|
|
#define LC_ALL_MASK ((int)~0)
|
|
|
|
#define LC_COLLATE_MASK ((int)(1 << LC_COLLATE))
|
|
|
|
#define LC_CTYPE_MASK ((int)(1 << LC_CTYPE))
|
|
|
|
#define LC_MONETARY_MASK ((int)(1 << LC_MONETARY))
|
|
|
|
#define LC_NUMERIC_MASK ((int)(1 << LC_NUMERIC))
|
|
|
|
#define LC_TIME_MASK ((int)(1 << LC_TIME))
|
|
|
|
#define LC_MESSAGES_MASK ((int)(1 << LC_MESSAGES))
|
|
|
|
locale_t duplocale(locale_t);
|
|
|
|
void freelocale(locale_t);
|
2013-04-18 00:40:13 +04:00
|
|
|
struct lconv *localeconv_l(locale_t);
|
2013-04-30 04:45:04 +04:00
|
|
|
locale_t newlocale(int, const char *, locale_t);
|
2013-05-17 16:55:56 +04:00
|
|
|
|
|
|
|
#ifndef _LIBC
|
|
|
|
extern struct _locale _lc_global_locale;
|
|
|
|
#else
|
|
|
|
extern __dso_protected struct _locale _lc_global_locale;
|
|
|
|
#endif
|
|
|
|
#define LC_GLOBAL_LOCALE (&_lc_global_locale)
|
2013-05-17 17:00:40 +04:00
|
|
|
#endif /* _POSIX_SOURCE >= 200809 || _NETBSD_SOURCE */
|
|
|
|
|
|
|
|
#if defined(_NETBSD_SOURCE)
|
|
|
|
# ifndef _LIBC
|
|
|
|
extern const struct _locale _lc_C_locale;
|
|
|
|
# else
|
|
|
|
extern __dso_protected const struct _locale _lc_C_locale;
|
|
|
|
# endif
|
2013-05-17 16:55:56 +04:00
|
|
|
#define LC_C_LOCALE ((locale_t)__UNCONST(&_lc_C_locale))
|
2013-04-18 00:40:13 +04:00
|
|
|
#endif
|
1993-03-21 12:45:37 +03:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _LOCALE_H_ */
|