aboutsummaryrefslogtreecommitdiff
path: root/locale/localeinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'locale/localeinfo.h')
-rw-r--r--locale/localeinfo.h231
1 files changed, 45 insertions, 186 deletions
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 5ba5fefa05..bb4738eb5a 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* localeinfo.h -- declarations for internal libc locale interfaces
+Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,196 +14,54 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-/* Locale-specific information. */
+#ifndef _LOCALEINFO_H
+#define _LOCALEINFO_H 1
-#ifndef _LOCALEINFO_H
+#include <stddef.h>
+#include <langinfo.h>
+#include <sys/types.h>
-#define _LOCALEINFO_H 1
+/* Magic number at the beginning of a locale data file for CATEGORY. */
+#define LIMAGIC(category) (0x051472CA ^ (category))
-#define __need_size_t
-#define __need_wchar_t
-#include <stddef.h>
-#include <limits.h>
-
-
-/* Change these if the `wchar_t' type is changed. */
-#define WCHAR_MAX ((wchar_t) UCHAR_MAX)
-
-
-/* Used by multibyte char functions. */
-typedef struct
-{
- char *string; /* Bytes. */
- size_t len; /* # of bytes. */
- long int shift; /* # of mb_char's to shift. */
-} mb_char;
-
-struct ctype_mbchar_info
-{
- size_t mb_max; /* Max MB char length. */
- mb_char *mb_chars; /* MB chars. */
-};
-
-struct ctype_ctype_info
-{
- unsigned short int *ctype_b; /* Characteristics. */
- short int *ctype_tolower; /* Case mappings. */
- short int *ctype_toupper; /* Case mappings. */
-};
-
-struct ctype_info
-{
- struct ctype_ctype_info *ctype;
- struct ctype_mbchar_info *mbchar;
-};
-
-extern __const struct ctype_info *_ctype_info;
-
-/* These are necessary because they are used in a header file. */
-extern __const unsigned short int *__ctype_b;
-extern __const short int *__ctype_tolower;
-extern __const short int *__ctype_toupper;
-
-
-/* Used by strcoll and strxfrm. */
-typedef struct
-{
- unsigned char *values;
- size_t nvalues;
-} literal_value;
-
-typedef struct
-{
- union
+/* Structure describing locale data in core for a category. */
+struct locale_data
{
- literal_value literal;
- /* %%% This may become a regex_t in the future. */
- char *regexp;
- } replace, with;
- unsigned int regexp:1;
-} subst;
-
-struct collate_info
-{
- size_t nsubsts;
- subst *substs;
-
- unsigned char *values;
- unsigned char *offsets;
-};
-
-extern __const struct collate_info *_collate_info;
-
-
-/* Used by strtod, atof. */
-struct numeric_info
-{
- char *decimal_point;
- char *thousands_sep;
- char *grouping;
-};
-
-extern __const struct numeric_info *_numeric_info;
-
-
-/* Used in the return value of localeconv. */
-struct monetary_info
-{
- char *int_curr_symbol;
- char *currency_symbol;
- char *mon_decimal_point;
- char *mon_thousands_sep;
- char *mon_grouping;
- char *positive_sign;
- char *negative_sign;
- char int_frac_digits;
- char frac_digits;
- char p_cs_precedes;
- char p_sep_by_space;
- char n_cs_precedes;
- char n_sep_by_space;
- char p_sign_posn;
- char n_sign_posn;
-};
-
-extern __const struct monetary_info *_monetary_info;
-
-
-/* Used by strftime, asctime. */
-struct time_info
-{
- char *abbrev_wkday[7]; /* Short weekday names. */
- char *full_wkday[7]; /* Full weekday names. */
- char *abbrev_month[12]; /* Short month names. */
- char *full_month[12]; /* Full month names. */
- char *ampm[2]; /* "AM" and "PM" strings. */
-
- char *date_time; /* Appropriate date and time format. */
- char *date; /* Appropriate date format. */
- char *time; /* Appropriate time format. */
-
- char *ut0; /* Name for GMT. */
- char *tz; /* Default TZ value. */
-};
-
-extern __const struct time_info *_time_info;
-
-struct response_info
-{
- /* Regexp for affirmative answers. */
- char *yesexpr;
-
- /* Regexp for negative answers. */
- char *noexpr;
-};
-
-extern __const struct response_info *_response_info;
-
-/* Locale structure. */
-typedef struct
-{
- char *name;
- int categories;
-
- unsigned int allocated:1;
-
- int subcategories;
- size_t num_sublocales;
- struct sub_locale *sublocales;
-
- __ptr_t *info;
-} locale;
-
-typedef struct sub_locale
-{
- unsigned int pointer:1;
-
- int categories;
- char *name;
-
- locale *locale;
-} sublocale;
-
-
-/* This is the magic number that localeinfo object files begin with.
- In case you're wondering why I chose the value 0x051472CA, it's
- because I was born on 05-14-72 in Oakland, CA. */
-#define LIMAGIC 0x051472CA
-/* This is the magic number that precedes each category-specific section
- of a localeinfo object file. It's the arbitrary magic number above,
- but modified by the category so that it's different from the per-file
- magic number and unique for each category. */
-#define CATEGORY_MAGIC(x) (LIMAGIC ^ (x))
-
-extern __const char *__lidir, *__lidefault;
-
-extern locale *__find_locale __P ((int categories, __const char *name));
-extern locale *__new_locale __P ((locale *));
-extern locale *__localefile __P ((__const char *file));
-extern void __free_locale __P ((locale *));
+ const char *filedata; /* Region mapping the file data. */
+ off_t filesize; /* Size of the file (and the region). */
+
+ unsigned int nstrings; /* Number of strings below. */
+ const char *strings[0]; /* Items, usually pointers into `filedata'. */
+ };
+
+
+/* For each category declare the variable for the current locale data. */
+#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
+extern const struct locale_data *_nl_current_##category;
+#include "categories.def"
+#undef DEFINE_CATEGORY
+
+extern const char *const _nl_category_names[LC_ALL];
+
+/* Extract the current CATEGORY locale's string for ITEM. */
+#define _NL_CURRENT(category, item) \
+ (_nl_current_##category->strings[_NL_ITEM_INDEX (item)])
+
+/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
+#define _NL_CURRENT_DEFINE(category) \
+ extern const struct locale_data _nl_C_##category; \
+ const struct locale_data *nl_current_##category = &_nl_C_##category
+
+/* Load the locale data for CATEGORY from the file specified by *NAME.
+ If *NAME is "", use environment variables as specified by POSIX,
+ and fill in *NAME with the actual name used. */
+extern struct locale_data *_nl_load_locale (int category, char **name);
+
+/* Free the locale data read in by a `_nl_load_locale' call. */
+extern void _nl_free_locale (struct locale_data *);
-#endif /* localeinfo.h */
+#endif /* localeinfo.h */