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