add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / codesetslib / developer / include / libraries / codesets.h
blobf86733727b275e11a16f6b71fc57542f1894598b
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-2007 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/
22 $Id$
24 ***************************************************************************/
26 #ifndef EXEC_SEMAPHORES_H
27 #include <exec/semaphores.h>
28 #endif
30 #ifndef UTILITY_TAGITEM_H
31 #include <utility/tagitem.h>
32 #endif
34 #ifndef UTILITY_HOOKS_H
35 #include <utility/hooks.h>
36 #endif
38 #ifdef __GNUC__
39 #ifdef __PPC__
40 #pragma pack(2)
41 #endif
42 #elif defined(__VBCC__)
43 #pragma amiga-align
44 #endif
46 /***********************************************************************/
48 ** Actual library name and version.
51 #define CODESETSNAME "codesets.library"
52 #define CODESETSVER 6
54 /***********************************************************************/
56 * Types
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 /***********************************************************************/
65 * single_convert
68 struct single_convert
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 /***********************************************************************/
77 * codeset
80 struct codeset
82 struct MinNode node;
83 char *name;
84 char *alt_name;
85 char *characterization;
86 int read_only;
87 struct single_convert table[256];
88 struct single_convert table_sorted[256];
91 /***********************************************************************/
93 * codesetList
96 struct codesetList
98 struct MinList list;
101 /***********************************************************************/
103 enum
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 */
111 enum
113 CSF_StrictConversion=0,
114 CSF_LenientConversion
117 /***********************************************************************/
120 ** Enumerations for CSA_CodesetFamily
122 enum
124 CSV_CodesetFamily_Latin=0, /* Latin Family */
125 CSV_CodesetFamily_Cyrillic /* Cyrillic Family */
128 /***********************************************************************/
130 ** Tags
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 /***********************************************************************/
168 ** Returns code from CodesetsEncodeB64A() CodesetsDecodeB64A()
171 enum
173 CSR_B64_ERROR_OK = 0,
174 CSR_B64_ERROR_MEM,
175 CSR_B64_ERROR_DOS,
176 CSR_B64_ERROR_INCOMPLETE,
177 CSR_B64_ERROR_ILLEGAL,
180 /***********************************************************************/
182 struct convertMsg
184 ULONG state;
185 ULONG len;
188 enum
190 CSV_Translating,
191 CSV_End,
194 /***********************************************************************/
196 #ifdef __GNUC__
197 #ifdef __PPC__
198 #pragma pack()
199 #endif
200 #elif defined(__VBCC__)
201 #pragma default-align
202 #endif
204 #endif /* LIBRARIES_CODESETS_H */