/[public]/psiconv/trunk/lib/psiconv/unicode.h
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/unicode.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 181 Revision 228
1/* 1/*
2 unicode.h - Part of psiconv, a PSION 5 file formats converter 2 unicode.h - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 2003 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 2003-2004 Frodo Looijaard <frodol@dds.nl>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
20#ifndef PSICONV_UNICODE_H 20#ifndef PSICONV_UNICODE_H
21#define PSICONV_UNICODE_H 21#define PSICONV_UNICODE_H
22 22
23#include <psiconv/general.h> 23#include <psiconv/general.h>
24#include <psiconv/configuration.h> 24#include <psiconv/configuration.h>
25#include <psiconv/buffer.h>
25 26
26#ifdef __cplusplus 27#ifdef __cplusplus
27extern "C" { 28extern "C" {
28#endif /* __cplusplus */ 29#endif /* __cplusplus */
29 30
36extern int psiconv_unicode_select_characterset(const psiconv_config config, 37extern int psiconv_unicode_select_characterset(const psiconv_config config,
37 int charset); 38 int charset);
38 39
39/* Translate a single character to a unicode character, using the 40/* Translate a single character to a unicode character, using the
40 translation tables in config */ 41 translation tables in config */
41extern psiconv_ucs2 psiconv_unicode_from_char(const psiconv_config config, 42extern psiconv_ucs2 psiconv_unicode_read_char(const psiconv_config config,
42 psiconv_u8 input); 43 psiconv_buffer buf,
44 int lev,psiconv_u32 off,
45 int *length,
46 int *status);
43 47
44/* Translate a single unicode character to a normal character, using the
45 translation tables in config */
46extern psiconv_u8 psiconv_unicode_to_char(psiconv_config config, 48extern int psiconv_unicode_write_char(const psiconv_config config,
47 psiconv_ucs2 input); 49 psiconv_buffer buf,
50 int lev,
51 psiconv_ucs2 value);
48 52
49/* Translate a normal string to unicode.
50 Output is allocated by this function on success, and must be freed by
51 hand. */
52extern int psiconv_unicode_from_chars(const psiconv_config config,
53 const psiconv_u8 *input,
54 psiconv_ucs2 **output);
55/* Translate a unicode string to a normal one.
56 Output is allocated by this function on success, and must be freed by
57 hand. */
58extern int psiconv_unicode_to_chars(const psiconv_config config,
59 const psiconv_ucs2 *input,
60 psiconv_u8 **output);
61 53
62/* Compute the length of a unicode string */ 54/* Compute the length of a unicode string */
63extern int psiconv_unicode_strlen(const psiconv_ucs2 *input); 55extern int psiconv_unicode_strlen(const psiconv_ucs2 *input);
56
57/* Duplicate a unicode string */
58extern psiconv_ucs2 *psiconv_unicode_strdup(const psiconv_ucs2 *input);
59
60/* Compare two unicode strings. Ordering as in Unicode codepoints! */
61extern int psiconv_unicode_strcmp(const psiconv_ucs2 *str1, const psiconv_ucs2 *str2);
62
63/* Return a newly allocated empty string */
64extern psiconv_ucs2 *psiconv_unicode_empty_string(void);
65
66/* Convert a psiconv_list of psiconv_ucs2 characters to a string */
67extern psiconv_ucs2 *psiconv_unicode_from_list(psiconv_list input);
64 68
65 69
66#ifdef __cplusplus 70#ifdef __cplusplus
67} 71}
68#endif /* __cplusplus */ 72#endif /* __cplusplus */

Legend:
Removed from v.181  
changed lines
  Added in v.228

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26