]> git.ipfire.org Git - thirdparty/glibc.git/blob - locale/programs/localedef.h
Replace = with += in CFLAGS-xxx.c/CPPFLAGS-xxx.c
[thirdparty/glibc.git] / locale / programs / localedef.h
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.
5
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.
10
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.
15
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/>. */
18
19 #ifndef _LOCALEDEF_H
20 #define _LOCALEDEF_H 1
21
22 /* Get the basic locale definitions. */
23 #include <errno.h>
24 #include <locale.h>
25 #include <stdbool.h>
26 #include <stddef.h>
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #include "record-status.h"
32 #include "repertoire.h"
33 #include "../locarchive.h"
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;
106 } categories[__LC_LAST];
107
108 size_t len[__LC_LAST];
109
110 const char *copy_name[__LC_LAST];
111
112 const char *repertoire_name;
113 };
114
115
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;
121
122
123 /* Prototypes for a few program-wide used functions. */
124 #include <programs/xmalloc.h>
125
126
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,
130 int generate,
131 struct localedef_t *copy_locale);
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,
136 const struct charmap_t *charmap);
137
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);
143
144
145 /* Open the locale archive. */
146 extern void open_archive (struct locarhandle *ah, bool readonly);
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
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));
165
166 #endif /* localedef.h */