| 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 | #ifndef NULL
|
|---|
| 39 | #define NULL ((void *) 0)
|
|---|
| 40 | #endif
|
|---|
| 41 |
|
|---|
| 42 | #ifndef __locale_t_defined
|
|---|
| 43 | #define __locale_t_defined
|
|---|
| 44 | typedef struct __posix_locale *posix_locale_t;
|
|---|
| 45 | #ifndef LIBPOSIX_INTERNAL
|
|---|
| 46 | #define locale_t posix_locale_t
|
|---|
| 47 | #endif
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 | #undef LC_ALL
|
|---|
| 51 | #undef LC_COLLATE
|
|---|
| 52 | #undef LC_CTYPE
|
|---|
| 53 | #undef LC_MESSAGES
|
|---|
| 54 | #undef LC_MONETARY
|
|---|
| 55 | #undef LC_NUMERIC
|
|---|
| 56 | #undef LC_TIME
|
|---|
| 57 | #define LC_ALL 0
|
|---|
| 58 | #define LC_COLLATE 1
|
|---|
| 59 | #define LC_CTYPE 2
|
|---|
| 60 | #define LC_MESSAGES 3
|
|---|
| 61 | #define LC_MONETARY 4
|
|---|
| 62 | #define LC_NUMERIC 5
|
|---|
| 63 | #define LC_TIME 6
|
|---|
| 64 |
|
|---|
| 65 | #undef LC_COLLATE_MASK
|
|---|
| 66 | #undef LC_CTYPE_MASK
|
|---|
| 67 | #undef LC_MESSAGES_MASK
|
|---|
| 68 | #undef LC_MONETARY_MASK
|
|---|
| 69 | #undef LC_NUMERIC_MASK
|
|---|
| 70 | #undef LC_TIME_MASK
|
|---|
| 71 | #undef LC_ALL_MASK
|
|---|
| 72 | #define LC_COLLATE_MASK (1 << 0)
|
|---|
| 73 | #define LC_CTYPE_MASK (1 << 1)
|
|---|
| 74 | #define LC_MESSAGES_MASK (1 << 2)
|
|---|
| 75 | #define LC_MONETARY_MASK (1 << 3)
|
|---|
| 76 | #define LC_NUMERIC_MASK (1 << 4)
|
|---|
| 77 | #define LC_TIME_MASK (1 << 5)
|
|---|
| 78 | #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
|
|---|
| 79 | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
|
|---|
| 80 |
|
|---|
| 81 | #undef LC_GLOBAL_LOCALE
|
|---|
| 82 | #define LC_GLOBAL_LOCALE NULL
|
|---|
| 83 |
|
|---|
| 84 | struct posix_lconv {
|
|---|
| 85 | char *currency_symbol;
|
|---|
| 86 | char *decimal_point;
|
|---|
| 87 | char frac_digits;
|
|---|
| 88 | char *grouping;
|
|---|
| 89 | char *int_curr_symbol;
|
|---|
| 90 | char int_frac_digits;
|
|---|
| 91 | char int_n_cs_precedes;
|
|---|
| 92 | char int_n_sep_by_space;
|
|---|
| 93 | char int_n_sign_posn;
|
|---|
| 94 | char int_p_cs_precedes;
|
|---|
| 95 | char int_p_sep_by_space;
|
|---|
| 96 | char int_p_sign_posn;
|
|---|
| 97 | char *mon_decimal_point;
|
|---|
| 98 | char *mon_grouping;
|
|---|
| 99 | char *mon_thousands_sep;
|
|---|
| 100 | char *negative_sign;
|
|---|
| 101 | char n_cs_precedes;
|
|---|
| 102 | char n_sep_by_space;
|
|---|
| 103 | char n_sign_posn;
|
|---|
| 104 | char *positive_sign;
|
|---|
| 105 | char p_cs_precedes;
|
|---|
| 106 | char p_sep_by_space;
|
|---|
| 107 | char p_sign_posn;
|
|---|
| 108 | char *thousands_sep;
|
|---|
| 109 | };
|
|---|
| 110 |
|
|---|
| 111 | extern char *posix_setlocale(int category, const char *locale);
|
|---|
| 112 | extern struct posix_lconv *posix_localeconv(void);
|
|---|
| 113 |
|
|---|
| 114 | /* POSIX Extensions */
|
|---|
| 115 | extern posix_locale_t posix_duplocale(posix_locale_t locobj);
|
|---|
| 116 | extern void posix_freelocale(posix_locale_t locobj);
|
|---|
| 117 | extern posix_locale_t posix_newlocale(int category_mask, const char *locale,
|
|---|
| 118 | posix_locale_t base);
|
|---|
| 119 | extern posix_locale_t posix_uselocale(posix_locale_t newloc);
|
|---|
| 120 |
|
|---|
| 121 | #ifndef LIBPOSIX_INTERNAL
|
|---|
| 122 | #define lconv posix_lconv
|
|---|
| 123 |
|
|---|
| 124 | #define setlocale posix_setlocale
|
|---|
| 125 | #define localeconv posix_localeconv
|
|---|
| 126 |
|
|---|
| 127 | #define newlocale posix_newlocale
|
|---|
| 128 | #define uselocale posix_uselocale
|
|---|
| 129 | #define duplocale posix_duplocale
|
|---|
| 130 | #define freelocale posix_freelocale
|
|---|
| 131 | #endif
|
|---|
| 132 |
|
|---|
| 133 | #endif /* POSIX_LOCALE_H_ */
|
|---|
| 134 |
|
|---|
| 135 | /** @}
|
|---|
| 136 | */
|
|---|