Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/waterbox/libc/includes/locale.h
2 views
1
/* Localization <locale.h>
2
3
This file is part of the Public Domain C Library (PDCLib).
4
Permission is granted to use, modify, and / or redistribute at will.
5
*/
6
7
#ifndef _PDCLIB_LOCALE_H
8
#define _PDCLIB_LOCALE_H _PDCLIB_LOCALE_H
9
#include "_PDCLIB_int.h"
10
11
#ifdef __cplusplus
12
extern "C" {
13
#endif
14
15
#ifndef _PDCLIB_NULL_DEFINED
16
#define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
17
#define NULL _PDCLIB_NULL
18
#endif
19
20
/* The structure returned by localeconv().
21
22
The values for *_sep_by_space:
23
0 - no space
24
1 - if symbol and sign are adjacent, a space seperates them from the value;
25
otherwise a space seperates the symbol from the value
26
2 - if symbol and sign are adjacent, a space seperates them; otherwise a
27
space seperates the sign from the value
28
29
The values for *_sign_posn:
30
0 - Parentheses surround value and symbol
31
1 - sign precedes value and symbol
32
2 - sign succeeds value and symbol
33
3 - sign immediately precedes symbol
34
4 - sign immediately succeeds symbol
35
*/
36
struct lconv
37
{
38
char * decimal_point; /* decimal point character */
39
char * thousands_sep; /* character for seperating groups of digits */
40
char * grouping; /* string indicating the size of digit groups */
41
char * mon_decimal_point; /* decimal point for monetary quantities */
42
char * mon_thousands_sep; /* thousands_sep for monetary quantities */
43
char * mon_grouping; /* grouping for monetary quantities */
44
char * positive_sign; /* string indicating nonnegative mty. qty. */
45
char * negative_sign; /* string indicating negative mty. qty. */
46
char * currency_symbol; /* local currency symbol (e.g. '$') */
47
char * int_curr_symbol; /* international currency symbol (e.g. "USD" */
48
char frac_digits; /* fractional digits in local monetary qty. */
49
char p_cs_precedes; /* if currency_symbol precedes positive qty. */
50
char n_cs_precedes; /* if currency_symbol precedes negative qty. */
51
char p_sep_by_space; /* if it is seperated by space from pos. qty. */
52
char n_sep_by_space; /* if it is seperated by space from neg. qty. */
53
char p_sign_posn; /* positioning of positive_sign for mon. qty. */
54
char n_sign_posn; /* positioning of negative_sign for mon. qty. */
55
char int_frac_digits; /* Same as above, for international format */
56
char int_p_cs_precedes; /* Same as above, for international format */
57
char int_n_cs_precedes; /* Same as above, for international format */
58
char int_p_sep_by_space; /* Same as above, for international format */
59
char int_n_sep_by_space; /* Same as above, for international format */
60
char int_p_sign_posn; /* Same as above, for international format */
61
char int_n_sign_posn; /* Same as above, for international format */
62
};
63
64
/* First arguments to setlocale().
65
TODO: Beware, values might change before v0.6 is released.
66
*/
67
/* Entire locale */
68
#define LC_ALL -1
69
/* Collation (strcoll(), strxfrm()) */
70
#define LC_COLLATE 0
71
/* Character types (<ctype.h>) */
72
#define LC_CTYPE 1
73
/* Monetary formatting (as returned by localeconv) */
74
#define LC_MONETARY 2
75
/* Decimal-point character (for printf() / scanf() functions), string
76
conversions, nonmonetary formatting as returned by localeconv */
77
#define LC_NUMERIC 3
78
/* Time formats (strftime(), wcsftime()) */
79
#define LC_TIME 4
80
81
/* not supported! */
82
#define LC_MESSAGES 5
83
84
/* The category parameter can be any of the LC_* macros to specify if the call
85
to setlocale() shall affect the entire locale or only a portion thereof.
86
The category locale specifies which locale should be switched to, with "C"
87
being the minimal default locale, and "" being the locale-specific native
88
environment. A NULL pointer makes setlocale() return the *current* setting.
89
Otherwise, returns a pointer to a string associated with the specified
90
category for the new locale.
91
*/
92
char * setlocale( int category, const char * locale ) _PDCLIB_nothrow;
93
94
/* Returns a struct lconv initialized to the values appropriate for the current
95
locale setting.
96
*/
97
struct lconv * localeconv( void ) _PDCLIB_nothrow;
98
99
#if _PDCLIB_POSIX_MIN(2008)
100
#define LC_COLLATE_MASK (1 << LC_COLLATE)
101
#define LC_CTYPE_MASK (1 << LC_CTYPE)
102
#define LC_MONETARY_MASK (1 << LC_MONETARY)
103
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
104
#define LC_TIME_MASK (1 << LC_TIME)
105
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
106
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MONETARY_MASK | \
107
LC_NUMERIC_MASK | LC_TIME_MASK | LC_MESSAGES_MASK)
108
109
110
/* POSIX locale type */
111
typedef _PDCLIB_locale_t locale_t;
112
113
/* Global locale */
114
extern struct _PDCLIB_locale _PDCLIB_global_locale;
115
#define LC_GLOBAL_LOCALE (&_PDCLIB_global_locale)
116
117
#ifdef _PDCLIB_LOCALE_METHOD
118
119
locale_t newlocale(int category_mask, const char *locale, locale_t base);
120
121
/* Set the thread locale to newlocale
122
*
123
* If newlocale is (locale_t)0, then doesn't change the locale and just returns
124
* the existing locale.
125
*
126
* If newlocale is LC_GLOBAL_LOCALE, resets the thread's locale to use the
127
* global locale.
128
*
129
* Returns the previous thread locale. If the thread had no previous locale,
130
* returns the global locale.
131
*/
132
locale_t uselocale( locale_t newlocale );
133
134
/* Returns a copy of loc */
135
locale_t duplocale( locale_t loc );
136
137
/* Frees the passed locale object */
138
void freelocale( locale_t loc );
139
#endif
140
141
#endif
142
143
#ifdef __cplusplus
144
}
145
#endif
146
147
#endif
148
149