File indexing completed on 2025-06-30 08:56:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _UNICASE_H
0019 #define _UNICASE_H
0020
0021 #include "unitypes.h"
0022
0023
0024 #include <unistring/stdbool.h>
0025
0026
0027 #include <stddef.h>
0028
0029
0030 #include "uninorm.h"
0031
0032 #if 1
0033 # include <unistring/woe32dll.h>
0034 #else
0035 # define LIBUNISTRING_DLL_VARIABLE
0036 #endif
0037
0038 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 extern ucs4_t
0052 uc_toupper (ucs4_t uc)
0053 _UC_ATTRIBUTE_CONST;
0054
0055
0056 extern ucs4_t
0057 uc_tolower (ucs4_t uc)
0058 _UC_ATTRIBUTE_CONST;
0059
0060
0061 extern ucs4_t
0062 uc_totitle (ucs4_t uc)
0063 _UC_ATTRIBUTE_CONST;
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 extern const char *
0076 uc_locale_language (void)
0077 _UC_ATTRIBUTE_PURE;
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 extern uint8_t *
0104 u8_toupper (const uint8_t *s, size_t n, const char *iso639_language,
0105 uninorm_t nf,
0106 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0107 extern uint16_t *
0108 u16_toupper (const uint16_t *s, size_t n, const char *iso639_language,
0109 uninorm_t nf,
0110 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0111 extern uint32_t *
0112 u32_toupper (const uint32_t *s, size_t n, const char *iso639_language,
0113 uninorm_t nf,
0114 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0115
0116
0117
0118
0119 extern uint8_t *
0120 u8_tolower (const uint8_t *s, size_t n, const char *iso639_language,
0121 uninorm_t nf,
0122 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0123 extern uint16_t *
0124 u16_tolower (const uint16_t *s, size_t n, const char *iso639_language,
0125 uninorm_t nf,
0126 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0127 extern uint32_t *
0128 u32_tolower (const uint32_t *s, size_t n, const char *iso639_language,
0129 uninorm_t nf,
0130 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0131
0132
0133
0134
0135 extern uint8_t *
0136 u8_totitle (const uint8_t *s, size_t n, const char *iso639_language,
0137 uninorm_t nf,
0138 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0139 extern uint16_t *
0140 u16_totitle (const uint16_t *s, size_t n, const char *iso639_language,
0141 uninorm_t nf,
0142 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0143 extern uint32_t *
0144 u32_totitle (const uint32_t *s, size_t n, const char *iso639_language,
0145 uninorm_t nf,
0146 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0147
0148
0149 typedef struct casing_prefix_context
0150 {
0151
0152 uint32_t last_char_except_ignorable;
0153 uint32_t last_char_normal_or_above;
0154 }
0155 casing_prefix_context_t;
0156
0157 extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empty_prefix_context;
0158
0159 extern casing_prefix_context_t
0160 u8_casing_prefix_context (const uint8_t *s, size_t n);
0161 extern casing_prefix_context_t
0162 u16_casing_prefix_context (const uint16_t *s, size_t n);
0163 extern casing_prefix_context_t
0164 u32_casing_prefix_context (const uint32_t *s, size_t n);
0165
0166
0167 extern casing_prefix_context_t
0168 u8_casing_prefixes_context (const uint8_t *s, size_t n,
0169 casing_prefix_context_t a_context);
0170 extern casing_prefix_context_t
0171 u16_casing_prefixes_context (const uint16_t *s, size_t n,
0172 casing_prefix_context_t a_context);
0173 extern casing_prefix_context_t
0174 u32_casing_prefixes_context (const uint32_t *s, size_t n,
0175 casing_prefix_context_t a_context);
0176
0177
0178 typedef struct casing_suffix_context
0179 {
0180
0181 uint32_t first_char_except_ignorable;
0182 uint32_t bits;
0183 }
0184 casing_suffix_context_t;
0185
0186 extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empty_suffix_context;
0187
0188 extern casing_suffix_context_t
0189 u8_casing_suffix_context (const uint8_t *s, size_t n);
0190 extern casing_suffix_context_t
0191 u16_casing_suffix_context (const uint16_t *s, size_t n);
0192 extern casing_suffix_context_t
0193 u32_casing_suffix_context (const uint32_t *s, size_t n);
0194
0195
0196 extern casing_suffix_context_t
0197 u8_casing_suffixes_context (const uint8_t *s, size_t n,
0198 casing_suffix_context_t a_context);
0199 extern casing_suffix_context_t
0200 u16_casing_suffixes_context (const uint16_t *s, size_t n,
0201 casing_suffix_context_t a_context);
0202 extern casing_suffix_context_t
0203 u32_casing_suffixes_context (const uint32_t *s, size_t n,
0204 casing_suffix_context_t a_context);
0205
0206
0207
0208 extern uint8_t *
0209 u8_ct_toupper (const uint8_t *s, size_t n,
0210 casing_prefix_context_t prefix_context,
0211 casing_suffix_context_t suffix_context,
0212 const char *iso639_language,
0213 uninorm_t nf,
0214 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0215 extern uint16_t *
0216 u16_ct_toupper (const uint16_t *s, size_t n,
0217 casing_prefix_context_t prefix_context,
0218 casing_suffix_context_t suffix_context,
0219 const char *iso639_language,
0220 uninorm_t nf,
0221 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0222 extern uint32_t *
0223 u32_ct_toupper (const uint32_t *s, size_t n,
0224 casing_prefix_context_t prefix_context,
0225 casing_suffix_context_t suffix_context,
0226 const char *iso639_language,
0227 uninorm_t nf,
0228 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0229
0230
0231
0232 extern uint8_t *
0233 u8_ct_tolower (const uint8_t *s, size_t n,
0234 casing_prefix_context_t prefix_context,
0235 casing_suffix_context_t suffix_context,
0236 const char *iso639_language,
0237 uninorm_t nf,
0238 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0239 extern uint16_t *
0240 u16_ct_tolower (const uint16_t *s, size_t n,
0241 casing_prefix_context_t prefix_context,
0242 casing_suffix_context_t suffix_context,
0243 const char *iso639_language,
0244 uninorm_t nf,
0245 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0246 extern uint32_t *
0247 u32_ct_tolower (const uint32_t *s, size_t n,
0248 casing_prefix_context_t prefix_context,
0249 casing_suffix_context_t suffix_context,
0250 const char *iso639_language,
0251 uninorm_t nf,
0252 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0253
0254
0255
0256 extern uint8_t *
0257 u8_ct_totitle (const uint8_t *s, size_t n,
0258 casing_prefix_context_t prefix_context,
0259 casing_suffix_context_t suffix_context,
0260 const char *iso639_language,
0261 uninorm_t nf,
0262 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0263 extern uint16_t *
0264 u16_ct_totitle (const uint16_t *s, size_t n,
0265 casing_prefix_context_t prefix_context,
0266 casing_suffix_context_t suffix_context,
0267 const char *iso639_language,
0268 uninorm_t nf,
0269 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0270 extern uint32_t *
0271 u32_ct_totitle (const uint32_t *s, size_t n,
0272 casing_prefix_context_t prefix_context,
0273 casing_suffix_context_t suffix_context,
0274 const char *iso639_language,
0275 uninorm_t nf,
0276 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0277
0278
0279
0280
0281
0282
0283 extern uint8_t *
0284 u8_casefold (const uint8_t *s, size_t n, const char *iso639_language,
0285 uninorm_t nf,
0286 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0287 extern uint16_t *
0288 u16_casefold (const uint16_t *s, size_t n, const char *iso639_language,
0289 uninorm_t nf,
0290 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0291 extern uint32_t *
0292 u32_casefold (const uint32_t *s, size_t n, const char *iso639_language,
0293 uninorm_t nf,
0294 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0295
0296 extern uint8_t *
0297 u8_ct_casefold (const uint8_t *s, size_t n,
0298 casing_prefix_context_t prefix_context,
0299 casing_suffix_context_t suffix_context,
0300 const char *iso639_language,
0301 uninorm_t nf,
0302 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0303 extern uint16_t *
0304 u16_ct_casefold (const uint16_t *s, size_t n,
0305 casing_prefix_context_t prefix_context,
0306 casing_suffix_context_t suffix_context,
0307 const char *iso639_language,
0308 uninorm_t nf,
0309 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0310 extern uint32_t *
0311 u32_ct_casefold (const uint32_t *s, size_t n,
0312 casing_prefix_context_t prefix_context,
0313 casing_suffix_context_t suffix_context,
0314 const char *iso639_language,
0315 uninorm_t nf,
0316 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
0317
0318
0319
0320
0321
0322
0323 extern int
0324 u8_casecmp (const uint8_t *s1, size_t n1,
0325 const uint8_t *s2, size_t n2,
0326 const char *iso639_language, uninorm_t nf, int *resultp);
0327 extern int
0328 u16_casecmp (const uint16_t *s1, size_t n1,
0329 const uint16_t *s2, size_t n2,
0330 const char *iso639_language, uninorm_t nf, int *resultp);
0331 extern int
0332 u32_casecmp (const uint32_t *s1, size_t n1,
0333 const uint32_t *s2, size_t n2,
0334 const char *iso639_language, uninorm_t nf, int *resultp);
0335 extern int
0336 ulc_casecmp (const char *s1, size_t n1,
0337 const char *s2, size_t n2,
0338 const char *iso639_language, uninorm_t nf, int *resultp);
0339
0340
0341
0342
0343
0344 extern char *
0345 u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language,
0346 uninorm_t nf,
0347 char *_UC_RESTRICT resultbuf, size_t *lengthp);
0348 extern char *
0349 u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language,
0350 uninorm_t nf,
0351 char *_UC_RESTRICT resultbuf, size_t *lengthp);
0352 extern char *
0353 u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language,
0354 uninorm_t nf,
0355 char *_UC_RESTRICT resultbuf, size_t *lengthp);
0356 extern char *
0357 ulc_casexfrm (const char *s, size_t n, const char *iso639_language,
0358 uninorm_t nf,
0359 char *_UC_RESTRICT resultbuf, size_t *lengthp);
0360
0361
0362
0363
0364
0365
0366
0367
0368 extern int
0369 u8_casecoll (const uint8_t *s1, size_t n1,
0370 const uint8_t *s2, size_t n2,
0371 const char *iso639_language, uninorm_t nf, int *resultp);
0372 extern int
0373 u16_casecoll (const uint16_t *s1, size_t n1,
0374 const uint16_t *s2, size_t n2,
0375 const char *iso639_language, uninorm_t nf, int *resultp);
0376 extern int
0377 u32_casecoll (const uint32_t *s1, size_t n1,
0378 const uint32_t *s2, size_t n2,
0379 const char *iso639_language, uninorm_t nf, int *resultp);
0380 extern int
0381 ulc_casecoll (const char *s1, size_t n1,
0382 const char *s2, size_t n2,
0383 const char *iso639_language, uninorm_t nf, int *resultp);
0384
0385
0386
0387
0388 extern int
0389 u8_is_uppercase (const uint8_t *s, size_t n,
0390 const char *iso639_language,
0391 bool *resultp);
0392 extern int
0393 u16_is_uppercase (const uint16_t *s, size_t n,
0394 const char *iso639_language,
0395 bool *resultp);
0396 extern int
0397 u32_is_uppercase (const uint32_t *s, size_t n,
0398 const char *iso639_language,
0399 bool *resultp);
0400
0401
0402
0403 extern int
0404 u8_is_lowercase (const uint8_t *s, size_t n,
0405 const char *iso639_language,
0406 bool *resultp);
0407 extern int
0408 u16_is_lowercase (const uint16_t *s, size_t n,
0409 const char *iso639_language,
0410 bool *resultp);
0411 extern int
0412 u32_is_lowercase (const uint32_t *s, size_t n,
0413 const char *iso639_language,
0414 bool *resultp);
0415
0416
0417
0418 extern int
0419 u8_is_titlecase (const uint8_t *s, size_t n,
0420 const char *iso639_language,
0421 bool *resultp);
0422 extern int
0423 u16_is_titlecase (const uint16_t *s, size_t n,
0424 const char *iso639_language,
0425 bool *resultp);
0426 extern int
0427 u32_is_titlecase (const uint32_t *s, size_t n,
0428 const char *iso639_language,
0429 bool *resultp);
0430
0431
0432
0433 extern int
0434 u8_is_casefolded (const uint8_t *s, size_t n,
0435 const char *iso639_language,
0436 bool *resultp);
0437 extern int
0438 u16_is_casefolded (const uint16_t *s, size_t n,
0439 const char *iso639_language,
0440 bool *resultp);
0441 extern int
0442 u32_is_casefolded (const uint32_t *s, size_t n,
0443 const char *iso639_language,
0444 bool *resultp);
0445
0446
0447
0448
0449
0450
0451
0452 extern int
0453 u8_is_cased (const uint8_t *s, size_t n,
0454 const char *iso639_language,
0455 bool *resultp);
0456 extern int
0457 u16_is_cased (const uint16_t *s, size_t n,
0458 const char *iso639_language,
0459 bool *resultp);
0460 extern int
0461 u32_is_cased (const uint32_t *s, size_t n,
0462 const char *iso639_language,
0463 bool *resultp);
0464
0465
0466
0467
0468 #ifdef __cplusplus
0469 }
0470 #endif
0471
0472 #endif