]>
Commit | Line | Data |
---|---|---|
4b10dd6c | 1 | /* General definitions for localedef(1). |
bfff8b1b | 2 | Copyright (C) 1998-2017 Free Software Foundation, Inc. |
4b10dd6c UD |
3 | This file is part of the GNU C Library. |
4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. | |
5 | ||
43bc8ac6 | 6 | This program is free software; you can redistribute it and/or modify |
2e2efe65 RM |
7 | it under the terms of the GNU General Public License as published |
8 | by the Free Software Foundation; version 2 of the License, or | |
9 | (at your option) any later version. | |
4b10dd6c | 10 | |
43bc8ac6 | 11 | This program is distributed in the hope that it will be useful, |
4b10dd6c | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
43bc8ac6 UD |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | |
4b10dd6c | 15 | |
43bc8ac6 | 16 | You should have received a copy of the GNU General Public License |
59ba27a6 | 17 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
4b10dd6c UD |
18 | |
19 | #ifndef _LOCALEDEF_H | |
20 | #define _LOCALEDEF_H 1 | |
21 | ||
22 | /* Get the basic locale definitions. */ | |
a7b65cdc | 23 | #include <errno.h> |
4b10dd6c | 24 | #include <locale.h> |
a7b65cdc | 25 | #include <stdbool.h> |
4b10dd6c | 26 | #include <stddef.h> |
f16491eb CD |
27 | #include <stdarg.h> |
28 | #include <stdio.h> | |
29 | #include <stdlib.h> | |
4b10dd6c | 30 | |
f16491eb | 31 | #include "record-status.h" |
4b10dd6c | 32 | #include "repertoire.h" |
a7b65cdc | 33 | #include "../locarchive.h" |
4b10dd6c UD |
34 | |
35 | ||
36 | /* We need a bitmask for the locales. */ | |
37 | enum | |
38 | { | |
39 | CTYPE_LOCALE = 1 << LC_CTYPE, | |
40 | NUMERIC_LOCALE = 1 << LC_NUMERIC, | |
41 | TIME_LOCALE = 1 << LC_TIME, | |
42 | COLLATE_LOCALE = 1 << LC_COLLATE, | |
43 | MONETARY_LOCALE = 1 << LC_MONETARY, | |
44 | MESSAGES_LOCALE = 1 << LC_MESSAGES, | |
45 | PAPER_LOCALE = 1 << LC_PAPER, | |
46 | NAME_LOCALE = 1 << LC_NAME, | |
47 | ADDRESS_LOCALE = 1 << LC_ADDRESS, | |
48 | TELEPHONE_LOCALE = 1 << LC_TELEPHONE, | |
49 | MEASUREMENT_LOCALE = 1 << LC_MEASUREMENT, | |
50 | IDENTIFICATION_LOCALE = 1 << LC_IDENTIFICATION, | |
51 | ALL_LOCALES = (1 << LC_CTYPE | |
52 | | 1 << LC_NUMERIC | |
53 | | 1 << LC_TIME | |
54 | | 1 << LC_COLLATE | |
55 | | 1 << LC_MONETARY | |
56 | | 1 << LC_MESSAGES | |
57 | | 1 << LC_PAPER | |
58 | | 1 << LC_NAME | |
59 | | 1 << LC_ADDRESS | |
60 | | 1 << LC_TELEPHONE | |
61 | | 1 << LC_MEASUREMENT | |
62 | | 1 << LC_IDENTIFICATION) | |
63 | }; | |
64 | ||
65 | ||
66 | /* Opaque types for the different locales. */ | |
67 | struct locale_ctype_t; | |
68 | struct locale_collate_t; | |
69 | struct locale_monetary_t; | |
70 | struct locale_numeric_t; | |
71 | struct locale_time_t; | |
72 | struct locale_messages_t; | |
73 | struct locale_paper_t; | |
74 | struct locale_name_t; | |
75 | struct locale_address_t; | |
76 | struct locale_telephone_t; | |
77 | struct locale_measurement_t; | |
78 | struct locale_identification_t; | |
79 | ||
80 | ||
81 | /* Definitions for the locale. */ | |
82 | struct localedef_t | |
83 | { | |
84 | struct localedef_t *next; | |
85 | ||
86 | const char *name; | |
87 | ||
88 | int needed; | |
89 | int avail; | |
90 | ||
91 | union | |
92 | { | |
93 | void *generic; | |
94 | struct locale_ctype_t *ctype; | |
95 | struct locale_collate_t *collate; | |
96 | struct locale_monetary_t *monetary; | |
97 | struct locale_numeric_t *numeric; | |
98 | struct locale_time_t *time; | |
99 | struct locale_messages_t *messages; | |
100 | struct locale_paper_t *paper; | |
101 | struct locale_name_t *name; | |
102 | struct locale_address_t *address; | |
103 | struct locale_telephone_t *telephone; | |
104 | struct locale_measurement_t *measurement; | |
105 | struct locale_identification_t *identification; | |
b9eb05d6 | 106 | } categories[__LC_LAST]; |
4b10dd6c | 107 | |
b9eb05d6 UD |
108 | size_t len[__LC_LAST]; |
109 | ||
110 | const char *copy_name[__LC_LAST]; | |
4b10dd6c UD |
111 | |
112 | const char *repertoire_name; | |
113 | }; | |
114 | ||
115 | ||
116 | /* Global variables of the localedef program. */ | |
4b10dd6c | 117 | extern const char *repertoire_global; |
a7b65cdc UD |
118 | extern int max_locarchive_open_retry; |
119 | extern bool no_archive; | |
cb09a2cd | 120 | extern const char *alias_file; |
4b10dd6c UD |
121 | |
122 | ||
123 | /* Prototypes for a few program-wide used functions. */ | |
6ff444c4 | 124 | #include <programs/xmalloc.h> |
4b10dd6c UD |
125 | |
126 | ||
127 | /* Mark given locale as to be read. */ | |
128 | extern struct localedef_t *add_to_readlist (int locale, const char *name, | |
b9eb05d6 | 129 | const char *repertoire_name, |
07dab0c3 UD |
130 | int generate, |
131 | struct localedef_t *copy_locale); | |
4b10dd6c UD |
132 | |
133 | /* Find the information for the locale NAME. */ | |
134 | extern struct localedef_t *find_locale (int locale, const char *name, | |
135 | const char *repertoire_name, | |
47e8b443 | 136 | const struct charmap_t *charmap); |
4b10dd6c | 137 | |
70e51ab9 UD |
138 | /* Load (if necessary) the information for the locale NAME. */ |
139 | extern struct localedef_t *load_locale (int locale, const char *name, | |
140 | const char *repertoire_name, | |
47e8b443 | 141 | const struct charmap_t *charmap, |
07dab0c3 | 142 | struct localedef_t *copy_locale); |
70e51ab9 | 143 | |
a7b65cdc UD |
144 | |
145 | /* Open the locale archive. */ | |
b2bffca2 | 146 | extern void open_archive (struct locarhandle *ah, bool readonly); |
a7b65cdc UD |
147 | |
148 | /* Close the locale archive. */ | |
149 | extern void close_archive (struct locarhandle *ah); | |
150 | ||
151 | /* Add given locale data to the archive. */ | |
152 | extern int add_locale_to_archive (struct locarhandle *ah, const char *name, | |
153 | locale_data_t data, bool replace); | |
154 | ||
155 | /* Add content of named directories to locale archive. */ | |
156 | extern int add_locales_to_archive (size_t nlist, char *list[], bool replace); | |
157 | ||
158 | /* Removed named locales from archive. */ | |
159 | extern int delete_locales_from_archive (size_t nlist, char *list[]); | |
160 | ||
484c12fb CD |
161 | /* List content of locale archive. If FNAME is non-null use that as |
162 | the locale archive to list, otherwise the default. */ | |
163 | extern void show_archive_content (const char *fname, | |
164 | int verbose) __attribute__ ((noreturn)); | |
a7b65cdc | 165 | |
4b10dd6c | 166 | #endif /* localedef.h */ |