]> git.ipfire.org Git - thirdparty/glibc.git/blob - locale/localeinfo.h
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[thirdparty/glibc.git] / locale / localeinfo.h
1 /* localeinfo.h -- declarations for internal libc locale interfaces
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
19
20 #ifndef _LOCALEINFO_H
21 #define _LOCALEINFO_H 1
22
23 #include <stddef.h>
24 #include <langinfo.h>
25 #include <sys/types.h>
26
27 /* Magic number at the beginning of a locale data file for CATEGORY. */
28 #define LIMAGIC(category) (0x051472CA ^ (category))
29
30 /* Structure describing locale data in core for a category. */
31 struct locale_data
32 {
33 const char *filedata; /* Region mapping the file data. */
34 off_t filesize; /* Size of the file (and the region). */
35
36 unsigned int nstrings; /* Number of strings below. */
37 const char *strings[0]; /* Items, usually pointers into `filedata'. */
38 };
39
40
41 /* For each category declare the variable for the current locale data. */
42 #define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
43 extern const struct locale_data *_nl_current_##category;
44 #include "categories.def"
45 #undef DEFINE_CATEGORY
46
47 extern const char *const _nl_category_names[LC_ALL];
48
49 /* Extract the current CATEGORY locale's string for ITEM. */
50 #define _NL_CURRENT(category, item) \
51 (_nl_current_##category->strings[_NL_ITEM_INDEX (item)])
52
53 /* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
54 #define _NL_CURRENT_DEFINE(category) \
55 extern const struct locale_data _nl_C_##category; \
56 const struct locale_data *nl_current_##category = &_nl_C_##category
57
58 /* Load the locale data for CATEGORY from the file specified by *NAME.
59 If *NAME is "", use environment variables as specified by POSIX,
60 and fill in *NAME with the actual name used. */
61 extern struct locale_data *_nl_load_locale (int category, char **name);
62
63 /* Free the locale data read in by a `_nl_load_locale' call. */
64 extern void _nl_free_locale (struct locale_data *);
65
66
67 #endif /* localeinfo.h */