00001 00005 /* 00006 All original material Copyright (C) 2002-2010 UFO: Alien Invasion. 00007 00008 Copyright (C) 1997-2001 Id Software, Inc. 00009 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 00019 See the GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with this program; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef UTF8_H_ 00027 #define UTF8_H_ 00028 00029 #include <stddef.h> 00030 00032 /* The definition of UTF-8 guarantees that the second and later 00033 * bytes of a multibyte character have high bits 10, and that 00034 * singlebyte characters and the start of multibyte characters 00035 * never do. */ 00036 #define UTF8_CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80) 00037 00038 int UTF8_delete_char(char *s, int pos); 00039 int UTF8_insert_char(char *s, int n, int pos, int codepoint); 00040 int UTF8_char_len(unsigned char c); 00041 int UTF8_encoded_len(int codepoint); 00042 size_t UTF8_strlen(const char *str); 00043 char *UTF8_strncpyz(char *dest, const char *src, size_t limit); 00044 00045 #endif 00046