File: unicode.h

package info (click to toggle)
apfsprogs 0%2Bgit20230206%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,036 kB
  • sloc: ansic: 14,691; makefile: 123
file content (24 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright (C) 2019 Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
 */

#ifndef _UNICODE_H
#define _UNICODE_H

#include <apfs/types.h>

/*
 * This structure helps normalize_next() to retrieve one normalized
 * (and case-folded) UTF-32 character at a time from a UTF-8 string.
 */
struct unicursor {
	const char *utf8curr;	/* Start of UTF-8 to decompose and reorder */
	int length;		/* Length of normalization until next starter */
	int last_pos;           /* Offset in substring of last char returned */
	u8 last_ccc;		/* CCC of the last character returned */
};

extern void init_unicursor(struct unicursor *cursor, const char *utf8str);
extern unicode_t normalize_next(struct unicursor *cursor, bool case_fold);

#endif	/* _UNICODE_H */