--- psiconv/trunk/lib/psiconv/unicode.h 2004/01/04 15:47:16 181 +++ psiconv/trunk/lib/psiconv/unicode.h 2004/02/25 16:12:10 229 @@ -1,6 +1,6 @@ /* unicode.h - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 2003 Frodo Looijaard + Copyright (c) 2003-2004 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -38,30 +39,37 @@ /* Translate a single character to a unicode character, using the translation tables in config */ -extern psiconv_ucs2 psiconv_unicode_from_char(const psiconv_config config, - psiconv_u8 input); +extern psiconv_ucs2 psiconv_unicode_read_char(const psiconv_config config, + psiconv_buffer buf, + int lev,psiconv_u32 off, + int *length, + int *status); + +extern int psiconv_unicode_write_char(const psiconv_config config, + psiconv_buffer buf, + int lev, + psiconv_ucs2 value); -/* Translate a single unicode character to a normal character, using the - translation tables in config */ -extern psiconv_u8 psiconv_unicode_to_char(psiconv_config config, - psiconv_ucs2 input); - -/* Translate a normal string to unicode. - Output is allocated by this function on success, and must be freed by - hand. */ -extern int psiconv_unicode_from_chars(const psiconv_config config, - const psiconv_u8 *input, - psiconv_ucs2 **output); -/* Translate a unicode string to a normal one. - Output is allocated by this function on success, and must be freed by - hand. */ -extern int psiconv_unicode_to_chars(const psiconv_config config, - const psiconv_ucs2 *input, - psiconv_u8 **output); /* Compute the length of a unicode string */ extern int psiconv_unicode_strlen(const psiconv_ucs2 *input); +/* Duplicate a unicode string */ +extern psiconv_ucs2 *psiconv_unicode_strdup(const psiconv_ucs2 *input); + +/* Compare two unicode strings. Ordering as in Unicode codepoints! */ +extern int psiconv_unicode_strcmp(const psiconv_ucs2 *str1, const psiconv_ucs2 *str2); + +/* Return a newly allocated empty string */ +extern psiconv_ucs2 *psiconv_unicode_empty_string(void); + +/* Convert a psiconv_list of psiconv_ucs2 characters to a string */ +extern psiconv_ucs2 *psiconv_unicode_from_list(psiconv_list input); + +/* Convert a psiconv_list of psiconv_ucs2 characters to a string */ +extern psiconv_ucs2 *psiconv_unicode_strstr(const psiconv_ucs2 *haystack, + const psiconv_ucs2 *needle); + #ifdef __cplusplus }