projects/linux·blob master · refs

63 lines · 2.0 KiB

1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Unicode related declarations
4 */
5
6#ifndef _LINUX_HFSPLUS_UNICODE_H
7#define _LINUX_HFSPLUS_UNICODE_H
8
9/*
10 * struct hfsplus_ccc_range - one run of consecutive BMP code points that
11 * share the same Unicode canonical combining class
12 * @first: the first UTF-16 code point in the run
13 * @last: the last code point in the run (inclusive)
14 * @combining_class: canonical combining class (ccc) shared by @first..@last
15 */
16struct hfsplus_ccc_range {
17 u16 first;
18 u16 last;
19 u8 combining_class;
20};
21
22/*
23 * struct hfsplus_legacy_decomp - corrected canonical decomposition
24 * @uc: the code point (a UTF-16 code unit) to look up
25 * @len: number of valid code units in @repl
26 * @repl: corrected decomposition sequence (base letter + combining marks)
27 */
28struct hfsplus_legacy_decomp {
29 u16 uc;
30 u8 len;
31#define HFSPLUS_LEGACY_DECOMP_MAX_LEN (3)
32 u16 repl[HFSPLUS_LEGACY_DECOMP_MAX_LEN];
33};
34
35/*
36 * struct hfsplus_legacy_seq_fixup - corrected replacement for a short
37 * sequence of already-decomposed code units
38 * @match_len: number of valid code units in @match
39 * @match: decomposed sequence to look for in the buffer
40 * @repl_len: number of valid code units in @repl
41 * @repl: corrected sequence to substitute in place of @match
42 */
43struct hfsplus_legacy_seq_fixup {
44 u8 match_len;
45#define HFSPLUS_LEGACY_SEQ_MAX_MATCH (3)
46 u16 match[HFSPLUS_LEGACY_SEQ_MAX_MATCH];
47 u8 repl_len;
48#define HFSPLUS_LEGACY_SEQ_MAX_REPL (2)
49 u16 repl[HFSPLUS_LEGACY_SEQ_MAX_REPL];
50};
51
52extern u16 hfsplus_case_fold_table[];
53extern u16 hfsplus_decompose_table[];
54extern u16 hfsplus_compose_table[];
55extern struct hfsplus_ccc_range hfsplus_ccc_table[];
56extern struct hfsplus_legacy_decomp hfsplus_legacy_decomp_table[];
57extern struct hfsplus_legacy_seq_fixup hfsplus_legacy_seq_fixups[];
58
59u8 hfsplus_combining_class(u16 c);
60const u16 *hfsplus_legacy_decompose(u16 uc, int *size);
61void hfsplus_fixup_legacy_sequences(u16 *buf, int *len);
62
63#endif /* _LINUX_HFSPLUS_UNICODE_H */