.
[glibc/history.git] / locale / localeinfo.h
blob4199bf7a1b2673b1b5d541f3ac5a5167e80290ff
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.
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.
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.
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. */
20 #ifndef _LOCALEINFO_H
21 #define _LOCALEINFO_H 1
23 #include <stddef.h>
24 #include <langinfo.h>
25 #include <sys/types.h>
27 /* Magic number at the beginning of a locale data file for CATEGORY. */
28 #define LIMAGIC(category) (0x051472CA ^ (category))
30 /* Structure describing locale data in core for a category. */
31 struct locale_data
33 const char *filedata; /* Region mapping the file data. */
34 off_t filesize; /* Size of the file (and the region). */
36 unsigned int nstrings; /* Number of strings below. */
37 const char *strings[0]; /* Items, usually pointers into `filedata'. */
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
47 extern const char *const _nl_category_names[LC_ALL];
48 extern const struct locale_data * *const _nl_current[LC_ALL];
50 /* Extract the current CATEGORY locale's string for ITEM. */
51 #define _NL_CURRENT(category, item) \
52 (_nl_current_##category->strings[_NL_ITEM_INDEX (item)])
54 /* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
55 #define _NL_CURRENT_DEFINE(category) \
56 extern const struct locale_data _nl_C_##category; \
57 const struct locale_data *_nl_current_##category = &_nl_C_##category
59 /* Load the locale data for CATEGORY from the file specified by *NAME.
60 If *NAME is "", use environment variables as specified by POSIX,
61 and fill in *NAME with the actual name used. */
62 extern struct locale_data *_nl_load_locale (int category, char **name);
64 /* Free the locale data read in by a `_nl_load_locale' call. */
65 extern void _nl_free_locale (struct locale_data *);
68 #endif /* localeinfo.h */