23643b29c82c4446b928cc33b82a2ee892f876d3
[platform/upstream/linaro-glibc.git] / locale / lc-collate.c
1 /* Define current locale data for LC_COLLATE category.
2 Copyright (C) 1995, 1996 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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.  */
19
20 #include "localeinfo.h"
21 #include <endian.h>
22
23 _NL_CURRENT_DEFINE (LC_COLLATE);
24
25 const u_int32_t *__collate_table;
26 const u_int32_t *__collate_extra;
27
28
29 void
30 _nl_postload_collate (void)
31 {
32 #if BYTE_ORDER == BIG_ENDIAN
33 #define bo(x) x##_EB
34 #elif BYTE_ORDER == LITTLE_ENDIAN
35 #define bo(x) x##_EL
36 #else
37 #error bizarre byte order
38 #endif
39 #define paste(a,b) paste1(a,b)
40 #define paste1(a,b) a##b
41
42 #define current(x)                                                            \
43   ((const unsigned int *) _NL_CURRENT (LC_COLLATE, paste(_NL_COLLATE_,x)))
44
45   __collate_table = current (bo (TABLE));
46   __collate_extra = current (bo (EXTRA));
47 }