1 /** 2 * @file 3 */ 4 5 /* 6 All original material Copyright (C) 2002-2013 UFO: Alien Invasion. 7 8 Copyright (C) 1997-2001 Id Software, Inc. 9 10 This program is free software; you can redistribute it and/or 11 modify it under the terms of the GNU General Public License 12 as published by the Free Software Foundation; either version 2 13 of the License, or (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 19 See the GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 */ 25 26 #pragma once 27 28 #include <stddef.h> 29 30 /** Is this the second or later byte of a multibyte UTF-8 character? */ 31 /* The definition of UTF-8 guarantees that the second and later 32 * bytes of a multibyte character have high bits 10, and that 33 * singlebyte characters and the start of multibyte characters 34 * never do. */ 35 #define UTF8_CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80) 36 37 int UTF8_delete_char_at(char* s, int pos); 38 int UTF8_insert_char_at(char* s, int n, int pos, int codepoint); 39 int UTF8_char_len(unsigned char c); 40 int UTF8_next(const char** str); 41 int UTF8_encoded_len(int codepoint); 42 size_t UTF8_strlen(const char* str); 43 int UTF8_char_offset_to_byte_offset (char* str, int pos); 44 char* UTF8_strncpyz(char* dest, const char* src, size_t limit); 45