]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/collate.h.patch
Libc-583.tar.gz
[apple/libc.git] / locale / FreeBSD / collate.h.patch
1 --- collate.h.orig 2003-05-20 15:21:44.000000000 -0700
2 +++ collate.h 2005-10-20 00:05:25.000000000 -0700
3 @@ -31,36 +31,88 @@
4 #define _COLLATE_H_
5
6 #include <sys/cdefs.h>
7 +#ifndef __LIBC__
8 #include <sys/types.h>
9 +#endif /* !__LIBC__ */
10 #include <limits.h>
11
12 #define STR_LEN 10
13 #define TABLE_SIZE 100
14 #define COLLATE_VERSION "1.0\n"
15 #define COLLATE_VERSION1_1 "1.1\n"
16 +#define COLLATE_VERSION1_1A "1.1A\n"
17 +/* see discussion in string/FreeBSD/strxfrm for this value */
18 +#define COLLATE_MAX_PRIORITY ((1 << 24) - 1)
19 +
20 +#define DIRECTIVE_UNDEF 0x00
21 +#define DIRECTIVE_FORWARD 0x01
22 +#define DIRECTIVE_BACKWARD 0x02
23 +#define DIRECTIVE_POSITION 0x04
24 +
25 +#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
26 +
27 +#define COLLATE_SUBST_DUP 0x0001
28 +
29 +#define IGNORE_EQUIV_CLASS 1
30 +
31 +struct __collate_st_info {
32 + __uint8_t directive[COLL_WEIGHTS_MAX];
33 + __uint8_t flags;
34 +#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
35 + __uint8_t directive_count:4;
36 + __uint8_t chain_max_len:4;
37 +#else
38 + __uint8_t chain_max_len:4;
39 + __uint8_t directive_count:4;
40 +#endif
41 + __int32_t undef_pri[COLL_WEIGHTS_MAX];
42 + __int32_t subst_count[COLL_WEIGHTS_MAX];
43 + __int32_t chain_count;
44 + __int32_t large_pri_count;
45 +};
46
47 struct __collate_st_char_pri {
48 - int prim, sec;
49 + __int32_t pri[COLL_WEIGHTS_MAX];
50 };
51 struct __collate_st_chain_pri {
52 - u_char str[STR_LEN];
53 - int prim, sec;
54 + __darwin_wchar_t str[STR_LEN];
55 + __int32_t pri[COLL_WEIGHTS_MAX];
56 +};
57 +struct __collate_st_large_char_pri {
58 + __int32_t val;
59 + struct __collate_st_char_pri pri;
60 +};
61 +struct __collate_st_subst {
62 + __int32_t val;
63 + __darwin_wchar_t str[STR_LEN];
64 };
65
66 +#ifndef __LIBC__
67 extern int __collate_load_error;
68 extern int __collate_substitute_nontrivial;
69 -#define __collate_substitute_table (*__collate_substitute_table_ptr)
70 -extern u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
71 #define __collate_char_pri_table (*__collate_char_pri_table_ptr)
72 extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
73 extern struct __collate_st_chain_pri *__collate_chain_pri_table;
74 +extern __int32_t *__collate_chain_equiv_table;
75 +extern struct __collate_st_info __collate_info;
76 +#endif /* !__LIBC__ */
77
78 __BEGIN_DECLS
79 -u_char *__collate_strdup(u_char *);
80 -u_char *__collate_substitute(const u_char *);
81 -int __collate_load_tables(const char *);
82 -void __collate_lookup(const u_char *, int *, int *, int *);
83 -int __collate_range_cmp(int, int);
84 +#ifdef __LIBC__
85 +__darwin_wchar_t *__collate_mbstowcs(const char *, locale_t);
86 +__darwin_wchar_t *__collate_wcsdup(const __darwin_wchar_t *);
87 +__darwin_wchar_t *__collate_substitute(const __darwin_wchar_t *, int, locale_t);
88 +int __collate_load_tables(const char *, locale_t);
89 +void __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t);
90 +void __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t);
91 +void __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t);
92 +int __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t);
93 +size_t __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t);
94 +int __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t);
95 +size_t __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t);
96 +#else /* !__LIBC__ */
97 +void __collate_lookup(const unsigned char *, int *, int *, int *);
98 +#endif /* __LIBC__ */
99 #ifdef COLLATE_DEBUG
100 void __collate_print_tables(void);
101 #endif