1 /* General definitions for localedef(1).
2 Copyright (C) 1998-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
6 This program is free software; you can redistribute it and/or modify
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.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>. */
20 #define _LOCALEDEF_H 1
22 /* Get the basic locale definitions. */
31 #include "record-status.h"
32 #include "repertoire.h"
33 #include "../locarchive.h"
36 /* We need a bitmask for the locales. */
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
62 | 1 << LC_IDENTIFICATION
)
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
;
72 struct locale_messages_t
;
73 struct locale_paper_t
;
75 struct locale_address_t
;
76 struct locale_telephone_t
;
77 struct locale_measurement_t
;
78 struct locale_identification_t
;
81 /* Definitions for the locale. */
84 struct localedef_t
*next
;
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
;
106 } categories
[__LC_LAST
];
108 size_t len
[__LC_LAST
];
110 const char *copy_name
[__LC_LAST
];
112 const char *repertoire_name
;
116 /* Global variables of the localedef program. */
117 extern const char *repertoire_global
;
118 extern int max_locarchive_open_retry
;
119 extern bool no_archive
;
120 extern const char *alias_file
;
123 /* Prototypes for a few program-wide used functions. */
124 #include <programs/xmalloc.h>
127 /* Mark given locale as to be read. */
128 extern struct localedef_t
*add_to_readlist (int locale
, const char *name
,
129 const char *repertoire_name
,
131 struct localedef_t
*copy_locale
);
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
,
136 const struct charmap_t
*charmap
);
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
,
141 const struct charmap_t
*charmap
,
142 struct localedef_t
*copy_locale
);
145 /* Open the locale archive. */
146 extern void open_archive (struct locarhandle
*ah
, bool readonly
);
148 /* Close the locale archive. */
149 extern void close_archive (struct locarhandle
*ah
);
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
);
155 /* Add content of named directories to locale archive. */
156 extern int add_locales_to_archive (size_t nlist
, char *list
[], bool replace
);
158 /* Removed named locales from archive. */
159 extern int delete_locales_from_archive (size_t nlist
, char *list
[]);
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
));
166 #endif /* localedef.h */