netbsd/pr.txt: update
[mmondor.git] / mmsoftware / mmlib / utf8.h
1 /* $Id: utf8.h,v 1.1 2010/03/27 06:09:24 mmondor Exp $ */
2
3 /*
4 * Copyright (c) 2010, Matthew Mondor.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef MM_UTF8_H
29 #define MM_UTF8_H
30
31
32 #include <stdint.h>
33
34
35 enum utf8_status {
36 UTF8_UNKNOWN = 0,
37 UTF8_BYTES_ARRAY_EMPTY,
38 UTF8_CHARS_ARRAY_FULL,
39 UTF8_INVALID_START_BYTE,
40 UTF8_INVALID_CONT_BYTE,
41 UTF8_OVERLONG_SEQUENCE,
42 UTF8_CHAR_OUT_OF_RANGE,
43 UTF8_CHARS_ARRAY_EMPTY,
44 UTF8_BYTES_ARRAY_FULL
45 };
46
47
48 extern int utf8_decode(int32_t **, int32_t *,
49 const uint8_t **, const uint8_t *);
50 extern int utf8_encode(uint8_t **, uint8_t *,
51 const int32_t **, const int32_t *);
52
53 #endif