beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / utils / unistring.h
blobf0a5914a6c540e1ae4729751527e323966fc4642
1 /* unistring.h
3 Copyright 2013 Taco Hoekwater <taco@luatex.org>
5 This file is part of LuaTeX.
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
21 #ifndef UNISTRING_H
22 # define UNISTRING_H
24 extern unsigned char *uni2str(unsigned);
25 extern unsigned str2uni(const unsigned char *);
26 extern int buffer_to_unichar(int k);
28 extern char *uni2string(char *utf8_text, unsigned ch);
29 extern unsigned u_length(register unsigned int *str);
30 extern void utf2uni_strcpy(unsigned int *ubuf, const char *utf8buf);
32 #define is_utf8_follow(A) (A >= 0x80 && A < 0xC0)
34 #define utf8_size(a) (a>0xFFFF ? 4 : (a>0x7FF ? 3 : (a>0x7F? 2 : 1)))
36 extern char *utf16be_str(long code);
38 #endif