aboutsummaryrefslogtreecommitdiff
path: root/arch/all/core/include/locale.h
blob: 4ca8c62ece23fbb7ea0b0bd0d5b0cbf2f77f4976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* ****************************************************************************
 * locale.h -- Locales.
 *
 * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 *
 * This file is part of the 'all/core' module in libcarrot, an experimental
 * modular libc project.
 *
 * This file is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This file is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Lesser Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this file. If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************* */
#include <cdefs.h>
#include <stddef.h>

/* Locale types provided by libcarrot. */

#define LC_ALL       0
#define LC_COLLATE   1
#define LC_CTYPE     2
#define LC_MONETARY  3
#define LC_NUMERIC   4
#define LC_TIME      5

/* Set the locale. */

extern char *setlocale _OF((int __category, const char *__locale)) __THROW;

/* `struct lconv` is the structure containing members related to the
 * formatting of numeric values. */

struct lconv {
	char *decimal_point;     /* decimal-point character used to format
	                          * nonmonetary quantities. */
	char *thousands_sep;     /* character used to separate groups of digits
	                          * before the decimal-point character in
	                          * formatted nonmonetary quantities. */
	char *grouping;          /* string whose elements indicate the size of
	                          * each group of digits in formatted nonmonetary
	                          * quantities. */

	char *mon_decimal_point; /* decimal-point used to format monetary
	                          * quantities. */
	char *mon_thousands_sep; /* separator for groups of digits before the
	                          * decimal-point in formatted monetary
	                          * quantities. */
	char *mon_grouping;      /* string whose elements indicate the size of
	                          * each group of digits in formatted monetary
	                          * quantities. */

	char *positive_sign;     /* string used to indicate a nonnegative-valued
	                          * formatted monetary quantity. */
	char *negative_sign;     /* string used to indicate a negative-valued
	                          * formatted monetary quantity. */

	char *currency_symbol;   /* local currency symbol applicable to the current
	                          * locale. */
	char frac_digits;        /* number of fractional digits (those after the
	                          * decimal-point) to be displayed in a locally
	                          * formatted monetary quantity. */

	char p_cs_precedes;      /* 1 or 0 if the `currency_symbol` respectively
	                          * precedes or succeeds the value for a
	                          * nonnegative locally formatted monetary
	                          * quantity. */
	char n_cs_precedes;      /* 1 or 0 if the `currency_symbol` respectively
	                          * precedes or succeeds the value for a
	                          * negative locally formatted
	                          * monetary quantity. */

	char p_sep_by_space;     /* value indicating the separation of the
	                          * `currency_symbol`, the sign string, and the
	                          * value for a nonnegative locally formatted
	                          * monetary quantity. */
	char n_sep_by_space;     /* value indicating the separation of the
	                          * `currency_symbol`, the sign string, and the
	                          * value for a negative locally formatted
	                          * monetary quantity. */

	char p_sign_posn;        /* value indicating the positioning of the
	                          * `positive_sign` for a nonnegative locally
	                          * formatted monetary quantity. */
	char n_sign_posn;        /* value indicating the positioning of the
	                          * `negative_sign` for a negative locally
	                          * formatted monetary quantity. */

	char *int_curr_symbol;   /* international currency symbol applicable to the
	                          * current locale. */
	char int_frac_digits;    /* number of fractional digits to be displayed in
	                          * an internationally formatted monetary
	                          * quantity. */

	char int_p_cs_precedes;  /* 1 or 0 if the `int_curr_symbol` respectively
	                          * precedes or succeeds the value for a
	                          * nonnegative internationally formatted
	                          * monetary quantity. */
	char int_n_cs_precedes;  /* 1 or 0 if the `int_curr_symbol` respectively
	                          * precedes or succeeds the value for a negative
	                          * internationally formatted
	                          * monetary quantity. */

	char int_p_sep_by_space; /* value indicating the separation of the
	                          * `int_curr_symbol`, the sign string, and the
	                          * value for a nonnegative internationally
	                          * formatted monetary quantity. */
	char int_n_sep_by_space; /* value indicating the separation of the
	                          * `int_curr_symbol`, the sign string, and the
	                          * value for a negative internationally
	                          * formatted monetary quantity. */

	char int_p_sign_posn;    /* value indicating the positioning of the
	                          * `positive_sign` for a nonnegative
	                          * internationally formatted monetary quantity. */
	char int_n_sign_posn;    /* value indicating the positioning of the
	                          * `negative_sign` for a negative internationally
	                          * formatted monetary quantity. */
};

/* Get the locale numerical conversion thing. */

extern struct lconv *localeconv _OF((void)) __THROW;