Update.
[platform/upstream/glibc.git] / locale / lc-collate.c
1 /* Define current locale data for LC_COLLATE category.
2    Copyright (C) 1995, 1996, 1997, 1998, 1999 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 not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
19
20 #include "localeinfo.h"
21 #include <endian.h>
22
23
24 extern const u_int32_t _nl_C_LC_COLLATE_symbol_hash[];
25 extern const char _nl_C_LC_COLLATE_symbol_strings[];
26 extern const u_int32_t _nl_C_LC_COLLATE_symbol_classes[];
27
28
29 _NL_CURRENT_DEFINE (LC_COLLATE);
30
31 const u_int32_t *__collate_tablewc;
32 const u_int32_t *__collate_extrawc;
33
34 const u_int32_t *__collate_element_hash;
35 const char *__collate_element_strings;
36 const uint32_t *__collate_element_values;
37
38 const u_int32_t *__collate_symbol_hash = _nl_C_LC_COLLATE_symbol_hash;
39 const char *__collate_symbol_strings = _nl_C_LC_COLLATE_symbol_strings;
40 const u_int32_t *__collate_symbol_classeswc = _nl_C_LC_COLLATE_symbol_classes;
41
42
43 /* We are called after loading LC_CTYPE data to load it into
44    the variables used by the collation functions and regex.  */
45 void
46 _nl_postload_collate (void)
47 {
48 #define paste(a,b) paste1(a,b)
49 #define paste1(a,b) a##b
50
51 #define current(x)                                                            \
52   ((const unsigned int *) _NL_CURRENT (LC_COLLATE, paste(_NL_COLLATE_,x)))
53
54   __collate_tablewc = current (TABLEWC);
55   __collate_extrawc = current (EXTRAWC);
56
57   __collate_element_hash = current (ELEM_HASH);
58   __collate_element_strings = (const char *) current (ELEM_STR_POOL);
59   __collate_element_values = (const uint32_t *) current (ELEM_VAL);
60
61   __collate_symbol_hash = current (SYMB_HASH);
62   __collate_symbol_strings = (const char *) current (SYMB_STR_POOL);
63   __collate_symbol_classeswc = current (SYMB_CLASSWC);
64 }