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-2014 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 /***********************************************************************/
61 typedef ULONG UTF32
; /* at least 32 bits */
66 typedef UWORD UTF16
; /* at least 16 bits */
71 typedef UBYTE UTF8
; /* typically 8 bits */
74 /***********************************************************************/
81 unsigned char code
; /* the code in this representation */
82 UTF8 utf8
[8]; /* the utf8 string, first byte is alway the length of the string */
83 unsigned int ucs4
; /* the full 32 bit unicode */
86 /***********************************************************************/
96 char *characterization
;
98 struct single_convert table
[256];
99 struct single_convert table_sorted
[256];
102 /***********************************************************************/
112 /***********************************************************************/
116 CSR_ConversionOK
=0, /* conversion successful */
117 CSR_SourceExhausted
, /* partial character in source, but hit end */
118 CSR_TargetExhausted
, /* insuff. room in target for conversion */
119 CSR_SourceIllegal
/* source sequence is illegal/malformed */
124 CSF_StrictConversion
=0,
125 CSF_LenientConversion
128 /***********************************************************************/
131 ** Enumerations for CSA_CodesetFamily
135 CSV_CodesetFamily_Latin
=0, /* Latin Family */
136 CSV_CodesetFamily_Cyrillic
/* Cyrillic Family */
139 /***********************************************************************/
144 #define CODESETSLIB_TAG(n) ((ULONG)0xfec901f4+(n))
146 #define CSA_Base CODESETSLIB_TAG(0)
148 #define CSA_SourceLen CODESETSLIB_TAG(1)
149 #define CSA_Source CODESETSLIB_TAG(2)
150 #define CSA_Dest CODESETSLIB_TAG(3)
151 #define CSA_DestLen CODESETSLIB_TAG(4)
152 #define CSA_DestHook CODESETSLIB_TAG(5)
153 #define CSA_DestLenPtr CODESETSLIB_TAG(6)
154 #define CSA_SourceCodeset CODESETSLIB_TAG(7)
155 #define CSA_Pool CODESETSLIB_TAG(8)
156 #define CSA_PoolSem CODESETSLIB_TAG(9)
157 #define CSA_AllocIfNeeded CODESETSLIB_TAG(10)
158 #define CSA_Save CODESETSLIB_TAG(11)
159 #define CSA_FallbackToDefault CODESETSLIB_TAG(12)
160 #define CSA_DestCodeset CODESETSLIB_TAG(13)
161 #define CSA_CodesetDir CODESETSLIB_TAG(14)
162 #define CSA_CodesetFile CODESETSLIB_TAG(15)
163 #define CSA_CodesetList CODESETSLIB_TAG(16)
164 #define CSA_FreeCodesets CODESETSLIB_TAG(17)
165 #define CSA_CodesetFamily CODESETSLIB_TAG(18)
166 #define CSA_ErrPtr CODESETSLIB_TAG(19)
168 #define CSA_B64SourceString CODESETSLIB_TAG(20)
169 #define CSA_B64SourceLen CODESETSLIB_TAG(21)
170 #define CSA_B64SourceFile CODESETSLIB_TAG(22)
171 #define CSA_B64DestPtr CODESETSLIB_TAG(23)
172 #define CSA_B64DestFile CODESETSLIB_TAG(24)
173 #define CSA_B64MaxLineLen CODESETSLIB_TAG(25)
174 #define CSA_B64Unix CODESETSLIB_TAG(26)
175 #define CSA_B64FLG_NtCheckErr CODESETSLIB_TAG(27)
177 #define CSA_MapForeignChars CODESETSLIB_TAG(28)
178 #define CSA_MapForeignCharsHook CODESETSLIB_TAG(29)
180 #define CSA_AllowMultibyteCodesets CODESETSLIB_TAG(30)
182 /***********************************************************************/
184 ** Returns code from CodesetsEncodeB64A() CodesetsDecodeB64A()
189 CSR_B64_ERROR_OK
= 0,
192 CSR_B64_ERROR_INCOMPLETE
,
193 CSR_B64_ERROR_ILLEGAL
,
196 /***********************************************************************/
210 /***********************************************************************/
213 ** the message passed to a CSA_MapForeignCharsHook hook
214 ** the hook function must return the length of the replacement string
215 ** == 0 signals 'no replacement found'
216 ** > 0 will use the supplied string directly
217 ** < 0 signals an UTF8 replacement of negated length
221 char **dst
; /* place the replace string here */
222 unsigned char *src
; /* the source UTF8 string */
223 int srclen
; /* length of the UTF8 sequence */
226 /***********************************************************************/
232 #elif defined(__VBCC__)
233 #pragma default-align
236 #endif /* LIBRARIES_CODESETS_H */