summaryrefslogtreecommitdiff
path: root/vendor/nunicode/include/libnu/config.h
blob: 6948815b6c1c3b4687dd0689a6af57217e8c6ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#ifndef NU_BUILD_CONFIG_H
#define NU_BUILD_CONFIG_H

// Hardcoded defines for vendored copy
#define NU_WITH_UTF8
#define NU_WITH_TOUPPER
#define NU_WITH_TOLOWER
#define NU_WITH_UNACCENT
#define NU_WITH_Z_COLLATION

/** @file config.h
 *
 * This file list available build options and provide some shortcuts,
 * like NU_WITH_UTF16 will enable NU_WITH_UTF16LE + NU_WITH_UTF16BE.
 *
 * At build time you might set either particular option or shortcut. Either
 * way you don't have to and shouldn't modify this file, just set build flags
 * at the environment.
 *
 * This file will also enable several dependencies for you: case-mapping
 * depends on NU_WITH_UDB, NU_UTF8_READER and so.
 */

/* Definitions not covered in this file which should be defined
 * externally.
 *
 * NU_BUILD_STATIC: will change functions visibility to "hidden" (GCC).
 * @see defines.h
 *
 * NU_DISABLE_CONTRACTIONS: disables forward-reading during collation,
 * only weights of a single codepoints will be compared (enabled in release build)
 */

/* Enable everything, see below for details on a specific option */
#ifdef NU_WITH_EVERYTHING
# define NU_WITH_UTF8
# define NU_WITH_CESU8
# define NU_WITH_UTF16
# define NU_WITH_UTF16HE
# define NU_WITH_UTF32
# define NU_WITH_UTF32HE
# define NU_WITH_STRINGS
# define NU_WITH_EXTRA
# define NU_WITH_REVERSE_READ
# define NU_WITH_VALIDATION
# define NU_WITH_COLLATION
# define NU_WITH_CASEMAP
# define NU_WITH_UNACCENT
#endif /* NU_WITH_EVERYTHING */

/* Enable UTF-8 decoding and encoding */
#ifdef NU_WITH_UTF8
# define NU_WITH_UTF8_READER /* UTF-8 decoding functions */
# define NU_WITH_UTF8_WRITER /* UTF-8 encoding functions */
#endif /* NU_WITH_UTF8 */

/* Enable CESU-8 decoding and encoding */
#ifdef NU_WITH_CESU8
# define NU_WITH_CESU8_READER
# define NU_WITH_CESU8_WRITER
#endif /* NU_WITH_CESU8 */

/* Enable UTF-16LE decoding and encoding */
#ifdef NU_WITH_UTF16LE
# define NU_WITH_UTF16LE_READER
# define NU_WITH_UTF16LE_WRITER
#endif /* NU_WITH_UTF16LE */

/* Enable UTF-16BE decoding and encoding */
#ifdef NU_WITH_UTF16BE
# define NU_WITH_UTF16BE_READER
# define NU_WITH_UTF16BE_WRITER
#endif /* NU_WITH_UTF16BE */

/* Enable UTF-16HE decoding and encoding */
#ifdef NU_WITH_UTF16HE
# define NU_WITH_UTF16HE_READER
# define NU_WITH_UTF16HE_WRITER
#endif /* NU_WITH_UTF16HE */

/* Enable all UTF-16 options */
#ifdef NU_WITH_UTF16
# define NU_WITH_UTF16_READER
# define NU_WITH_UTF16_WRITER
#endif /* NU_WITH_UTF16 */

/* Enable UTF-16LE and BE decoders of UTF-16 decoder is requested */
#ifdef NU_WITH_UTF16_READER
# define NU_WITH_UTF16LE_READER
# define NU_WITH_UTF16BE_READER
#endif /* NU_WITH_UTF16_READER */

/* Enable UTF-16LE and BE encoders of UTF-16 encoder is requested */
#ifdef NU_WITH_UTF16_WRITER
# define NU_WITH_UTF16LE_WRITER
# define NU_WITH_UTF16BE_WRITER
#endif /* NU_WITH_UTF16_WRITER */

/* Enable UTF-32LE decoding and encoding */
#ifdef NU_WITH_UTF32LE
# define NU_WITH_UTF32LE_READER
# define NU_WITH_UTF32LE_WRITER
#endif /* NU_WITH_UTF32LE */

/* Enable UTF-32BE decoding and encoding */
#ifdef NU_WITH_UTF32BE
# define NU_WITH_UTF32BE_READER
# define NU_WITH_UTF32BE_WRITER
#endif /* NU_WITH_UTF32BE */

/* Enable UTF-32HE decoding and encoding */
#ifdef NU_WITH_UTF32HE
# define NU_WITH_UTF32HE_READER
# define NU_WITH_UTF32HE_WRITER
#endif /* NU_WITH_UTF32HE */

/* Enable all UTF-32 options */
#ifdef NU_WITH_UTF32
# define NU_WITH_UTF32_READER
# define NU_WITH_UTF32_WRITER
#endif /* NU_WITH_UTF32 */

/* Enable UTF-32LE and BE decoders of UTF-32 decoder is requested */
#ifdef NU_WITH_UTF32_READER
# define NU_WITH_UTF32LE_READER
# define NU_WITH_UTF32BE_READER
#endif /* NU_WITH_UTF32_READER */

/* Enable UTF-32LE and BE encoders of UTF-32 encoder is requested */
#ifdef NU_WITH_UTF32_WRITER
# define NU_WITH_UTF32LE_WRITER
# define NU_WITH_UTF32BE_WRITER
#endif /* NU_WITH_UTF32_WRITER */

/* Shortcut for all string functions */
#ifdef NU_WITH_STRINGS
# define NU_WITH_Z_STRINGS /* 0-terminated string functions */
# define NU_WITH_N_STRINGS /* unterminated string functions */
#endif /* NU_WITH_STRINGS */

/* Shortcut for extra string functions */
#ifdef NU_WITH_EXTRA
# define NU_WITH_Z_EXTRA /* extra functions for 0-terminated strings */
# define NU_WITH_N_EXTRA /* extra functions for unterminated strings */
#endif /* NU_WITH_STRINGS */

/* Enable collation functions */
#ifdef NU_WITH_COLLATION
# define NU_WITH_Z_COLLATION /* collation functions for 0-terminated strings */
# define NU_WITH_N_COLLATION /* collation functions for unterminated strings */
#endif /* NU_WITH_COLLATION */

/* Requirements for collation functions on 0-terminated strings */
#ifdef NU_WITH_Z_COLLATION
# define NU_WITH_Z_STRINGS
# define NU_WITH_TOUPPER /* nu_toupper() */
#endif

/* Requirements for collation functions
 * on unterminated strings */
#ifdef NU_WITH_N_COLLATION
# define NU_WITH_N_STRINGS
# define NU_WITH_TOUPPER
#endif

/* Requirements for casemap functions */
#ifdef NU_WITH_CASEMAP
# define NU_WITH_TOLOWER /* nu_tolower() */
# define NU_WITH_TOUPPER
# define NU_WITH_TOFOLD
#endif /* NU_WITH_CASEMAP */

/* More requirements for collation functions all collation functions depends
 * on NU_WITH_DUCET */
#if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION)
# ifndef NU_WITH_DUCET
#  define NU_WITH_DUCET
# endif
#endif

/* All collation and casemapping functions depends on NU_WITH_UDB */
#if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION) \
|| (defined NU_WITH_TOLOWER) || (defined NU_WITH_TOUPPER) || (defined NU_WITH_TOFOLD) \
|| (defined NU_WITH_UNACCENT)
# ifndef NU_WITH_UDB
#  define NU_WITH_UDB /* nu_udb_* functions, pretty much internal stuff */
# endif /* NU_WITH_UDB */
#endif

/* DUCET implementation depends on NU_WITH_UDB */
#ifdef NU_WITH_DUCET
#  define NU_WITH_UDB
#endif /* NU_WITH_DUCET */

/* NU_WITH_UDB depends on NU_WITH_UTF8_READER because internal encoding
 * of UDB is UTF-8 */
#ifdef NU_WITH_UDB
#  define NU_WITH_UTF8_READER
#endif /* NU_WITH_UDB */

#endif /* NU_BUILD_CONFIG_H */