Print this page
2964 need POSIX 2008 locale object support
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libc/port/locale/collate.h
+++ new/usr/src/lib/libc/port/locale/collate.h
1 1 /*
2 2 * Copyright 2010 Nexenta Systmes, Inc. All rights reserved.
3 3 * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
4 4 * at Electronni Visti IA, Kiev, Ukraine.
5 5 * All rights reserved.
6 6 *
7 7 * Redistribution and use in source and binary forms, with or without
8 8 * modification, are permitted provided that the following conditions
9 9 * are met:
10 10 * 1. Redistributions of source code must retain the above copyright
11 11 * notice, this list of conditions and the following disclaimer.
12 12 * 2. Redistributions in binary form must reproduce the above copyright
13 13 * notice, this list of conditions and the following disclaimer in the
14 14 * documentation and/or other materials provided with the distribution.
15 15 *
16 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
17 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
20 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
25 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 26 * SUCH DAMAGE.
27 27 */
28 28
29 29 #ifndef _COLLATE_H_
30 30 #define _COLLATE_H_
31 31
32 32 #include <sys/types.h>
33 33 #include <limits.h>
34 34
35 +#include "xlocale_private.h"
36 +
35 37 #define COLLATE_STR_LEN 24 /* should be 64-bit multiple */
36 38 #define COLLATE_VERSION "IllumosCollate2\n"
37 39
38 40 #define COLLATE_MAX_PRIORITY (0x7fffffff) /* max signed value */
39 41 #define COLLATE_SUBST_PRIORITY (0x40000000) /* bit indicates subst table */
40 42
41 43 #define DIRECTIVE_UNDEF 0x00
42 44 #define DIRECTIVE_FORWARD 0x01
43 45 #define DIRECTIVE_BACKWARD 0x02
44 46 #define DIRECTIVE_POSITION 0x04
45 47 #define DIRECTIVE_UNDEFINED 0x08 /* special last weight for UNDEFINED */
46 48
47 49 #define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
48 50
49 51 /*
50 52 * The collate file format is as follows:
51 53 *
52 54 * char version[COLLATE_STR_LEN]; // must be COLLATE_VERSION
53 55 * collate_info_t info; // see below, includes padding
54 56 * collate_char_pri_t char_data[256]; // 8 bit char values
55 57 * collate_subst_t subst[*]; // 0 or more substitutions
56 58 * collate_chain_pri_t chains[*]; // 0 or more chains
57 59 * collate_large_pri_t large[*]; // extended char priorities
58 60 *
59 61 * Note that all structures must be 32-bit aligned, as each structure
60 62 * contains 32-bit member fields. The entire file is mmap'd, so its
61 63 * critical that alignment be observed. It is not generally safe to
62 64 * use any 64-bit values in the structures.
63 65 */
64 66
65 67 typedef struct collate_info {
66 68 uint8_t directive_count;
67 69 uint8_t directive[COLL_WEIGHTS_MAX];
68 70 int32_t pri_count[COLL_WEIGHTS_MAX];
69 71 int32_t flags;
70 72 int32_t chain_count;
71 73 int32_t large_count;
72 74 int32_t subst_count[COLL_WEIGHTS_MAX];
73 75 int32_t undef_pri[COLL_WEIGHTS_MAX];
74 76 } collate_info_t;
75 77
76 78 typedef struct collate_char {
77 79 int32_t pri[COLL_WEIGHTS_MAX];
78 80 } collate_char_t;
79 81
80 82 typedef struct collate_chain {
81 83 wchar_t str[COLLATE_STR_LEN];
82 84 int32_t pri[COLL_WEIGHTS_MAX];
83 85 } collate_chain_t;
84 86
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
85 87 typedef struct collate_large {
86 88 int32_t val;
87 89 collate_char_t pri;
88 90 } collate_large_t;
89 91
90 92 typedef struct collate_subst {
91 93 int32_t key;
92 94 int32_t pri[COLLATE_STR_LEN];
93 95 } collate_subst_t;
94 96
97 +struct xlocale_collate {
98 + struct xlocale_component header;
99 + int __collate_load_error;
100 + int __collate_substitute_nontrivial;
101 +
102 + /* XXX */
103 +};
104 +
95 105 int _collate_load_tables(const char *);
96 106 void _collate_lookup(const wchar_t *, int *, int *, int, int **);
97 107 size_t _collate_wxfrm(const wchar_t *, wchar_t *, size_t);
98 108 size_t _collate_sxfrm(const wchar_t *, char *, size_t);
99 109 int _collate_range_cmp(wchar_t, wchar_t);
100 110
101 111 extern int _collate_load_error;
102 112 extern int _collate_substitute_nontrivial;
103 113 extern collate_info_t *_collate_info;
104 114
105 115 #endif /* !_COLLATE_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX