1/*
2 * The authors of this software are Rob Pike and Ken Thompson.
3 * Copyright (c) 2002 by Lucent Technologies.
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose without fee is hereby granted, provided that this entire notice
6 * is included in all copies of any software which is or includes a copy
7 * or modification of this software and in all copies of the supporting
8 * documentation for such software.
9 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
10 * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
11 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
12 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
13 *
14 * This file and rune.cc have been converted to compile as C++ code
15 * in name space re2.
16 */
17
18#ifndef UTIL_UTF_H_
19#define UTIL_UTF_H_
20
21#include <stdint.h>
22
23namespace duckdb_re2 {
24
25typedef signed int Rune; /* Code-point values in Unicode 4.0 are 21 bits wide.*/
26
27enum
28{
29 UTFmax = 4, /* maximum bytes per rune */
30 Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
31 Runeself = 0x80, /* rune and UTF sequences are the same (<) */
32 Runeerror = 0xFFFD, /* decoding error in UTF */
33 Runemax = 0x10FFFF, /* maximum rune value */
34};
35
36int runetochar(char* s, const Rune* r);
37int chartorune(Rune* r, const char* s);
38int fullrune(const char* s, int n);
39int utflen(const char* s);
40char* utfrune(const char*, Rune);
41
42} // namespace duckdb_re2
43
44#endif // UTIL_UTF_H_
45