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