source: mainline/uspace/lib/posix/locale.h@ 1e591c8

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 1e591c8 was 4cf8ca6, checked in by Petr Koupy <petr.koupy@…>, 14 years ago

Various minor commenting (no change in functionality).

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2011 Jiri Zarevucky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libposix
30 * @{
31 */
32/** @file Locale-specific definitions.
33 */
34
35#ifndef POSIX_LOCALE_H_
36#define POSIX_LOCALE_H_
37
38// TODO: documentation
39
40#ifndef NULL
41 #define NULL ((void *) 0)
42#endif
43
44#ifndef __locale_t_defined
45 #define __locale_t_defined
46 typedef struct __posix_locale *posix_locale_t;
47 #ifndef LIBPOSIX_INTERNAL
48 #define locale_t posix_locale_t
49 #endif
50#endif
51
52#undef LC_ALL
53#undef LC_COLLATE
54#undef LC_CTYPE
55#undef LC_MESSAGES
56#undef LC_MONETARY
57#undef LC_NUMERIC
58#undef LC_TIME
59#define LC_ALL 0
60#define LC_COLLATE 1
61#define LC_CTYPE 2
62#define LC_MESSAGES 3
63#define LC_MONETARY 4
64#define LC_NUMERIC 5
65#define LC_TIME 6
66
67#undef LC_COLLATE_MASK
68#undef LC_CTYPE_MASK
69#undef LC_MESSAGES_MASK
70#undef LC_MONETARY_MASK
71#undef LC_NUMERIC_MASK
72#undef LC_TIME_MASK
73#undef LC_ALL_MASK
74#define LC_COLLATE_MASK (1 << 0)
75#define LC_CTYPE_MASK (1 << 1)
76#define LC_MESSAGES_MASK (1 << 2)
77#define LC_MONETARY_MASK (1 << 3)
78#define LC_NUMERIC_MASK (1 << 4)
79#define LC_TIME_MASK (1 << 5)
80#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
81 LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
82
83#undef LC_GLOBAL_LOCALE
84#define LC_GLOBAL_LOCALE NULL
85
86struct posix_lconv {
87 char *currency_symbol;
88 char *decimal_point;
89 char frac_digits;
90 char *grouping;
91 char *int_curr_symbol;
92 char int_frac_digits;
93 char int_n_cs_precedes;
94 char int_n_sep_by_space;
95 char int_n_sign_posn;
96 char int_p_cs_precedes;
97 char int_p_sep_by_space;
98 char int_p_sign_posn;
99 char *mon_decimal_point;
100 char *mon_grouping;
101 char *mon_thousands_sep;
102 char *negative_sign;
103 char n_cs_precedes;
104 char n_sep_by_space;
105 char n_sign_posn;
106 char *positive_sign;
107 char p_cs_precedes;
108 char p_sep_by_space;
109 char p_sign_posn;
110 char *thousands_sep;
111};
112
113extern char *posix_setlocale(int category, const char *locale);
114extern struct posix_lconv *posix_localeconv(void);
115
116/* POSIX Extensions */
117extern posix_locale_t posix_duplocale(posix_locale_t locobj);
118extern void posix_freelocale(posix_locale_t locobj);
119extern posix_locale_t posix_newlocale(int category_mask, const char *locale,
120 posix_locale_t base);
121extern posix_locale_t posix_uselocale(posix_locale_t newloc);
122
123#ifndef LIBPOSIX_INTERNAL
124 #define lconv posix_lconv
125
126 #define setlocale posix_setlocale
127 #define localeconv posix_localeconv
128
129 #define newlocale posix_newlocale
130 #define uselocale posix_uselocale
131 #define duplocale posix_duplocale
132 #define freelocale posix_freelocale
133#endif
134
135#endif /* POSIX_LOCALE_H_ */
136
137/** @}
138 */
Note: See TracBrowser for help on using the repository browser.