Blob


1 /*
2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 #ifndef UTF8_H
18 #define UTF8_H
20 #include <stddef.h>
21 #include <stdint.h>
23 /* utf8.c */
24 uint32_t utf8_decode(uint32_t*restrict, uint32_t*restrict, uint8_t);
25 size_t utf8_encode(uint32_t, char*);
26 char *utf8_nth(char*, size_t);
27 size_t utf8_cplen(char*);
28 size_t utf8_chwidth(uint32_t);
29 size_t utf8_snwidth(const char*, size_t);
30 size_t utf8_swidth(const char*);
31 size_t utf8_swidth_between(const char*, const char*);
32 char *utf8_next_cp(const char*);
33 char *utf8_prev_cp(const char*, const char*);
34 int emojied_line(const char *, const char **);
36 /* emoji-matcher.c */
37 int is_emoji(uint32_t);
39 #endif