1 #ifndef LIBRARIES_CODESETS_H
2 #define LIBRARIES_CODESETS_H
4 /***************************************************************************
6 codesets.library - Amiga shared library for handling different codesets
7 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
8 Copyright (C) 2005-2008 by codesets.library Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library 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. See the GNU
18 Lesser General Public License for more details.
20 codesets.library project: http://sourceforge.net/projects/codesetslib/
24 ***************************************************************************/
26 #ifndef EXEC_SEMAPHORES_H
27 #include <exec/semaphores.h>
30 #ifndef UTILITY_TAGITEM_H
31 #include <utility/tagitem.h>
34 #ifndef UTILITY_HOOKS_H
35 #include <utility/hooks.h>
42 #elif defined(__VBCC__)
46 /***********************************************************************/
48 ** Actual library name and version.
51 #define CODESETSNAME "codesets.library"
54 /***********************************************************************/
59 typedef unsigned long UTF32
; /* at least 32 bits */
60 typedef unsigned short UTF16
; /* at least 16 bits */
61 typedef unsigned char UTF8
; /* typically 8 bits */
63 /***********************************************************************/
70 unsigned char code
; /* the code in this representation */
71 UTF8 utf8
[8]; /* the utf8 string, first byte is alway the length of the string */
72 unsigned int ucs4
; /* the full 32 bit unicode */
75 /***********************************************************************/
85 char *characterization
;
87 struct single_convert table
[256];
88 struct single_convert table_sorted
[256];
91 /***********************************************************************/
101 /***********************************************************************/
105 CSR_ConversionOK
=0, /* conversion successful */
106 CSR_SourceExhausted
, /* partial character in source, but hit end */
107 CSR_TargetExhausted
, /* insuff. room in target for conversion */
108 CSR_SourceIllegal
/* source sequence is illegal/malformed */
113 CSF_StrictConversion
=0,
114 CSF_LenientConversion
117 /***********************************************************************/
120 ** Enumerations for CSA_CodesetFamily
124 CSV_CodesetFamily_Latin
=0, /* Latin Family */
125 CSV_CodesetFamily_Cyrillic
/* Cyrillic Family */
128 /***********************************************************************/
133 #define CODESETSLIB_TAG(n) ((ULONG)0xfec901f4+(n))
135 #define CSA_Base CODESETSLIB_TAG(0)
137 #define CSA_SourceLen CODESETSLIB_TAG(1)
138 #define CSA_Source CODESETSLIB_TAG(2)
139 #define CSA_Dest CODESETSLIB_TAG(3)
140 #define CSA_DestLen CODESETSLIB_TAG(4)
141 #define CSA_DestHook CODESETSLIB_TAG(5)
142 #define CSA_DestLenPtr CODESETSLIB_TAG(6)
143 #define CSA_SourceCodeset CODESETSLIB_TAG(7)
144 #define CSA_Pool CODESETSLIB_TAG(8)
145 #define CSA_PoolSem CODESETSLIB_TAG(9)
146 #define CSA_AllocIfNeeded CODESETSLIB_TAG(10)
147 #define CSA_Save CODESETSLIB_TAG(11)
148 #define CSA_FallbackToDefault CODESETSLIB_TAG(12)
149 #define CSA_DestCodeset CODESETSLIB_TAG(13)
150 #define CSA_CodesetDir CODESETSLIB_TAG(14)
151 #define CSA_CodesetFile CODESETSLIB_TAG(15)
152 #define CSA_CodesetList CODESETSLIB_TAG(16)
153 #define CSA_FreeCodesets CODESETSLIB_TAG(17)
154 #define CSA_CodesetFamily CODESETSLIB_TAG(18)
155 #define CSA_ErrPtr CODESETSLIB_TAG(19)
157 #define CSA_B64SourceString CODESETSLIB_TAG(20)
158 #define CSA_B64SourceLen CODESETSLIB_TAG(21)
159 #define CSA_B64SourceFile CODESETSLIB_TAG(22)
160 #define CSA_B64DestPtr CODESETSLIB_TAG(23)
161 #define CSA_B64DestFile CODESETSLIB_TAG(24)
162 #define CSA_B64MaxLineLen CODESETSLIB_TAG(25)
163 #define CSA_B64Unix CODESETSLIB_TAG(26)
164 #define CSA_B64FLG_NtCheckErr CODESETSLIB_TAG(27)
166 #define CSA_MapForeignChars CODESETSLIB_TAG(28)
167 #define CSA_MapForeignCharsHook CODESETSLIB_TAG(29)
169 /***********************************************************************/
171 ** Returns code from CodesetsEncodeB64A() CodesetsDecodeB64A()
176 CSR_B64_ERROR_OK
= 0,
179 CSR_B64_ERROR_INCOMPLETE
,
180 CSR_B64_ERROR_ILLEGAL
,
183 /***********************************************************************/
197 /***********************************************************************/
200 ** the message passed to a CSA_MapForeignCharsHook hook
201 ** the hook function must return the length of the replacement string
202 ** == 0 signals 'no replacement found'
203 ** > 0 will use the supplied string directly
204 ** < 0 signals an UTF8 replacement of negated length
208 char **dst
; /* place the replace string here */
209 unsigned char *src
; /* the source UTF8 string */
210 int srclen
; /* length of the UTF8 sequence */
213 /***********************************************************************/
219 #elif defined(__VBCC__)
220 #pragma default-align
223 #endif /* LIBRARIES_CODESETS_H */