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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 351 - (show annotations)
Wed Oct 22 19:53:40 2014 UTC (9 years, 5 months ago) by frodo
File MIME type: text/plain
File size: 2979 byte(s)
(Frodo) Update copyright year in all source files

1 /*
2 unicode.h - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 2003-2014 Frodo Looijaard <frodo@frodo.looijaard.name>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef PSICONV_UNICODE_H
21 #define PSICONV_UNICODE_H
22
23 #include <psiconv/general.h>
24 #include <psiconv/configuration.h>
25 #include <psiconv/buffer.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 /* A simple unicode implementation, using UCS-2 (16-bit encoding).
32 Unicode strings are arrays of psiconv_u16 characters, zero-terminated.
33 Note that there is a lot in Unicode we do not support; for example,
34 we assume a single Unicode codepoint corresponds with a single character.
35 For EPOC, that should be enough */
36
37 extern int psiconv_unicode_select_characterset(const psiconv_config config,
38 int charset);
39
40 /* Translate a single character to a unicode character, using the
41 translation tables in config */
42 extern psiconv_ucs2 psiconv_unicode_read_char(const psiconv_config config,
43 psiconv_buffer buf,
44 int lev,psiconv_u32 off,
45 int *length,
46 int *status);
47
48 extern int psiconv_unicode_write_char(const psiconv_config config,
49 psiconv_buffer buf,
50 int lev,
51 psiconv_ucs2 value);
52
53
54 /* Compute the length of a unicode string */
55 extern int psiconv_unicode_strlen(const psiconv_ucs2 *input);
56
57 /* Duplicate a unicode string */
58 extern psiconv_ucs2 *psiconv_unicode_strdup(const psiconv_ucs2 *input);
59
60 /* Compare two unicode strings. Ordering as in Unicode codepoints! */
61 extern int psiconv_unicode_strcmp(const psiconv_ucs2 *str1, const psiconv_ucs2 *str2);
62
63 /* Return a newly allocated empty string */
64 extern psiconv_ucs2 *psiconv_unicode_empty_string(void);
65
66 /* Convert a psiconv_list of psiconv_ucs2 characters to a string */
67 extern psiconv_ucs2 *psiconv_unicode_from_list(psiconv_list input);
68
69 /* Look for needle in haystack, return pointer to found location */
70 extern psiconv_ucs2 *psiconv_unicode_strstr(const psiconv_ucs2 *haystack,
71 const psiconv_ucs2 *needle);
72
73
74 #ifdef __cplusplus
75 }
76 #endif /* __cplusplus */
77
78 #endif /* PSICONV_ERROR_H */

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