]> git.ipfire.org Git - thirdparty/glibc.git/blame - locale/programs/localedef.h
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[thirdparty/glibc.git] / locale / programs / localedef.h
CommitLineData
4b10dd6c 1/* General definitions for localedef(1).
a334319f 2 Copyright (C) 1998, 1999, 2000, 2001, 2002 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
a334319f
UD
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
4b10dd6c 10
a334319f 11 The GNU C Library is distributed in the hope that it will be useful,
4b10dd6c 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
a334319f
UD
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
4b10dd6c 15
a334319f
UD
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
4b10dd6c
UD
20
21#ifndef _LOCALEDEF_H
22#define _LOCALEDEF_H 1
23
24/* Get the basic locale definitions. */
a7b65cdc 25#include <errno.h>
4b10dd6c 26#include <locale.h>
a7b65cdc 27#include <stdbool.h>
4b10dd6c
UD
28#include <stddef.h>
29
30#include "repertoire.h"
a7b65cdc 31#include "../locarchive.h"
4b10dd6c
UD
32
33
34/* We need a bitmask for the locales. */
35enum
36{
37 CTYPE_LOCALE = 1 << LC_CTYPE,
38 NUMERIC_LOCALE = 1 << LC_NUMERIC,
39 TIME_LOCALE = 1 << LC_TIME,
40 COLLATE_LOCALE = 1 << LC_COLLATE,
41 MONETARY_LOCALE = 1 << LC_MONETARY,
42 MESSAGES_LOCALE = 1 << LC_MESSAGES,
43 PAPER_LOCALE = 1 << LC_PAPER,
44 NAME_LOCALE = 1 << LC_NAME,
45 ADDRESS_LOCALE = 1 << LC_ADDRESS,
46 TELEPHONE_LOCALE = 1 << LC_TELEPHONE,
47 MEASUREMENT_LOCALE = 1 << LC_MEASUREMENT,
48 IDENTIFICATION_LOCALE = 1 << LC_IDENTIFICATION,
49 ALL_LOCALES = (1 << LC_CTYPE
50 | 1 << LC_NUMERIC
51 | 1 << LC_TIME
52 | 1 << LC_COLLATE
53 | 1 << LC_MONETARY
54 | 1 << LC_MESSAGES
55 | 1 << LC_PAPER
56 | 1 << LC_NAME
57 | 1 << LC_ADDRESS
58 | 1 << LC_TELEPHONE
59 | 1 << LC_MEASUREMENT
60 | 1 << LC_IDENTIFICATION)
61};
62
63
64/* Opaque types for the different locales. */
65struct locale_ctype_t;
66struct locale_collate_t;
67struct locale_monetary_t;
68struct locale_numeric_t;
69struct locale_time_t;
70struct locale_messages_t;
71struct locale_paper_t;
72struct locale_name_t;
73struct locale_address_t;
74struct locale_telephone_t;
75struct locale_measurement_t;
76struct locale_identification_t;
77
78
79/* Definitions for the locale. */
80struct localedef_t
81{
82 struct localedef_t *next;
83
84 const char *name;
85
86 int needed;
87 int avail;
88
89 union
90 {
91 void *generic;
92 struct locale_ctype_t *ctype;
93 struct locale_collate_t *collate;
94 struct locale_monetary_t *monetary;
95 struct locale_numeric_t *numeric;
96 struct locale_time_t *time;
97 struct locale_messages_t *messages;
98 struct locale_paper_t *paper;
99 struct locale_name_t *name;
100 struct locale_address_t *address;
101 struct locale_telephone_t *telephone;
102 struct locale_measurement_t *measurement;
103 struct locale_identification_t *identification;
b9eb05d6 104 } categories[__LC_LAST];
4b10dd6c 105
b9eb05d6
UD
106 size_t len[__LC_LAST];
107
108 const char *copy_name[__LC_LAST];
4b10dd6c
UD
109
110 const char *repertoire_name;
111};
112
113
114/* Global variables of the localedef program. */
115extern int verbose;
116extern int be_quiet;
ef446144 117extern int oldstyle_tables;
4b10dd6c 118extern const char *repertoire_global;
a7b65cdc
UD
119extern int max_locarchive_open_retry;
120extern bool no_archive;
cb09a2cd 121extern const char *alias_file;
4b10dd6c
UD
122
123
124/* Prototypes for a few program-wide used functions. */
125extern void *xmalloc (size_t __n);
126extern void *xcalloc (size_t __n, size_t __size);
127extern void *xrealloc (void *__p, size_t __n);
128extern char *xstrdup (const char *__str);
129
130
f2b98f97
UD
131/* Wrapper to switch LC_CTYPE back to the locale specified in the
132 environment for output. */
133#define WITH_CUR_LOCALE(stmt) \
134 do { \
135 int saved_errno = errno; \
136 const char *cur_locale_ = setlocale (LC_CTYPE, NULL); \
137 setlocale (LC_CTYPE, ""); \
138 errno = saved_errno; \
139 stmt; \
140 setlocale (LC_CTYPE, cur_locale_); \
141 } while (0)
142
143
4b10dd6c
UD
144/* Mark given locale as to be read. */
145extern struct localedef_t *add_to_readlist (int locale, const char *name,
b9eb05d6 146 const char *repertoire_name,
07dab0c3
UD
147 int generate,
148 struct localedef_t *copy_locale);
4b10dd6c
UD
149
150/* Find the information for the locale NAME. */
151extern struct localedef_t *find_locale (int locale, const char *name,
152 const char *repertoire_name,
47e8b443 153 const struct charmap_t *charmap);
4b10dd6c 154
70e51ab9
UD
155/* Load (if necessary) the information for the locale NAME. */
156extern struct localedef_t *load_locale (int locale, const char *name,
157 const char *repertoire_name,
47e8b443 158 const struct charmap_t *charmap,
07dab0c3 159 struct localedef_t *copy_locale);
70e51ab9 160
a7b65cdc
UD
161
162/* Open the locale archive. */
b2bffca2 163extern void open_archive (struct locarhandle *ah, bool readonly);
a7b65cdc
UD
164
165/* Close the locale archive. */
166extern void close_archive (struct locarhandle *ah);
167
168/* Add given locale data to the archive. */
169extern int add_locale_to_archive (struct locarhandle *ah, const char *name,
170 locale_data_t data, bool replace);
171
172/* Add content of named directories to locale archive. */
173extern int add_locales_to_archive (size_t nlist, char *list[], bool replace);
174
175/* Removed named locales from archive. */
176extern int delete_locales_from_archive (size_t nlist, char *list[]);
177
178/* List content of locale archive. */
b2bffca2 179extern void show_archive_content (int verbose);
a7b65cdc 180
4b10dd6c 181#endif /* localedef.h */