Resurrected native codesetslib from r27301
[cake.git] / workbench / libs / codesetslib / include / inline / codesets.h
blobc30f6856b59aa423e9c952326c0599d1b0aea2cd
1 #ifndef _INLINE_CODESETS_H
2 #define _INLINE_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 CLIB_CODESETS_PROTOS_H
27 #define CLIB_CODESETS_PROTOS_H
28 #endif
30 #ifndef __INLINE_MACROS_H
31 #include <inline/macros.h>
32 #endif
34 #ifndef LIBRARIES_CODESETS_H
35 #include <libraries/codesets.h>
36 #endif
38 #ifndef CODESETS_BASE_NAME
39 #define CODESETS_BASE_NAME CodesetsBase
40 #endif
42 #define CodesetsConvertUTF32toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
43 LP5(0x24, ULONG, CodesetsConvertUTF32toUTF16, const , sourceStart, a0, const , sourceEnd, a1, UTF16 **, targetStart, a2, UTF16 *, targetEnd, a3, ULONG, flags, d0, \
44 , CODESETS_BASE_NAME)
46 #define CodesetsConvertUTF16toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
47 LP5(0x2a, ULONG, CodesetsConvertUTF16toUTF32, const , sourceStart, a0, const , sourceEnd, a1, UTF32 **, targetStart, a2, UTF32 *, targetEnd, a3, ULONG, flags, d0, \
48 , CODESETS_BASE_NAME)
50 #define CodesetsConvertUTF16toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
51 LP5(0x30, ULONG, CodesetsConvertUTF16toUTF8, const , sourceStart, a0, const , sourceEnd, a1, UTF8 **, targetStart, a2, UTF8 *, targetEnd, a3, ULONG, flags, d0, \
52 , CODESETS_BASE_NAME)
54 #define CodesetsIsLegalUTF8(source, length) \
55 LP2(0x36, BOOL, CodesetsIsLegalUTF8, const , source, a0, ULONG, length, d0, \
56 , CODESETS_BASE_NAME)
58 #define CodesetsIsLegalUTF8Sequence(source, sourceEnd) \
59 LP2(0x3c, BOOL, CodesetsIsLegalUTF8Sequence, const , source, a0, const , sourceEnd, a1, \
60 , CODESETS_BASE_NAME)
62 #define CodesetsConvertUTF8toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
63 LP5(0x42, ULONG, CodesetsConvertUTF8toUTF16, const , sourceStart, a0, const , sourceEnd, a1, UTF16 **, targetStart, a2, UTF16 *, targetEnd, a3, ULONG, flags, d0, \
64 , CODESETS_BASE_NAME)
66 #define CodesetsConvertUTF32toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
67 LP5(0x48, ULONG, CodesetsConvertUTF32toUTF8, const , sourceStart, a0, const , sourceEnd, a1, UTF8 **, targetStart, a2, UTF8 *, targetEnd, a3, ULONG, flags, d0, \
68 , CODESETS_BASE_NAME)
70 #define CodesetsConvertUTF8toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags) \
71 LP5(0x4e, ULONG, CodesetsConvertUTF8toUTF32, const , sourceStart, a0, const , sourceEnd, a1, UTF32 **, targetStart, a2, UTF32 *, targetEnd, a3, ULONG, flags, d0, \
72 , CODESETS_BASE_NAME)
74 #define CodesetsSetDefaultA(name, attrs) \
75 LP2(0x54, struct codeset *, CodesetsSetDefaultA, STRPTR, name, a0, struct TagItem *, attrs, a1, \
76 , CODESETS_BASE_NAME)
78 #ifndef NO_INLINE_STDARG
79 #define CodesetsSetDefault(name, tags...) \
80 ({ULONG _tags[] = {tags}; CodesetsSetDefaultA((name), (struct TagItem *) _tags);})
81 #endif
83 #define CodesetsFreeA(obj, attrs) \
84 LP2NR(0x5a, CodesetsFreeA, APTR, obj, a0, struct TagItem *, attrs, a1, \
85 , CODESETS_BASE_NAME)
87 #ifndef NO_INLINE_STDARG
88 #define CodesetsFree(obj, tags...) \
89 ({ULONG _tags[] = {tags}; CodesetsFreeA((obj), (struct TagItem *) _tags);})
90 #endif
92 #define CodesetsSupportedA(attrs) \
93 LP1(0x60, STRPTR *, CodesetsSupportedA, struct TagItem *, attrs, a0, \
94 , CODESETS_BASE_NAME)
96 #ifndef NO_INLINE_STDARG
97 #define CodesetsSupported(tags...) \
98 ({ULONG _tags[] = {tags}; CodesetsSupportedA((struct TagItem *) _tags);})
99 #endif
101 #define CodesetsFindA(name, attrs) \
102 LP2(0x66, struct codeset *, CodesetsFindA, STRPTR, name, a0, struct TagItem *, attrs, a1, \
103 , CODESETS_BASE_NAME)
105 #ifndef NO_INLINE_STDARG
106 #define CodesetsFind(name, tags...) \
107 ({ULONG _tags[] = {tags}; CodesetsFindA((name), (struct TagItem *) _tags);})
108 #endif
110 #define CodesetsFindBestA(attrs) \
111 LP1(0x6c, struct codeset *, CodesetsFindBestA, struct TagItem *, attrs, a0, \
112 , CODESETS_BASE_NAME)
114 #ifndef NO_INLINE_STDARG
115 #define CodesetsFindBest(tags...) \
116 ({ULONG _tags[] = {tags}; CodesetsFindBestA((struct TagItem *) _tags);})
117 #endif
119 #define CodesetsUTF8Len(str) \
120 LP1(0x72, ULONG, CodesetsUTF8Len, const , str, a0, \
121 , CODESETS_BASE_NAME)
123 #define CodesetsUTF8ToStrA(attrs) \
124 LP1(0x78, STRPTR, CodesetsUTF8ToStrA, struct TagItem *, attrs, a0, \
125 , CODESETS_BASE_NAME)
127 #ifndef NO_INLINE_STDARG
128 #define CodesetsUTF8ToStr(tags...) \
129 ({ULONG _tags[] = {tags}; CodesetsUTF8ToStrA((struct TagItem *) _tags);})
130 #endif
132 #define CodesetsUTF8CreateA(attrs) \
133 LP1(0x7e, UTF8 *, CodesetsUTF8CreateA, struct TagItem *, attrs, a0, \
134 , CODESETS_BASE_NAME)
136 #ifndef NO_INLINE_STDARG
137 #define CodesetsUTF8Create(tags...) \
138 ({ULONG _tags[] = {tags}; CodesetsUTF8CreateA((struct TagItem *) _tags);})
139 #endif
141 #define CodesetsEncodeB64A(attrs) \
142 LP1(0x84, ULONG, CodesetsEncodeB64A, struct TagItem *, attrs, a0, \
143 , CODESETS_BASE_NAME)
145 #ifndef NO_INLINE_STDARG
146 #define CodesetsEncodeB64(tags...) \
147 ({ULONG _tags[] = {tags}; CodesetsEncodeB64A((struct TagItem *) _tags);})
148 #endif
150 #define CodesetsDecodeB64A(attrs) \
151 LP1(0x8a, ULONG, CodesetsDecodeB64A, struct TagItem *, attrs, a0, \
152 , CODESETS_BASE_NAME)
154 #ifndef NO_INLINE_STDARG
155 #define CodesetsDecodeB64(tags...) \
156 ({ULONG _tags[] = {tags}; CodesetsDecodeB64A((struct TagItem *) _tags);})
157 #endif
159 #define CodesetsStrLenA(str, attrs) \
160 LP2(0x90, ULONG, CodesetsStrLenA, STRPTR, str, a0, struct TagItem *, attrs, a1, \
161 , CODESETS_BASE_NAME)
163 #ifndef NO_INLINE_STDARG
164 #define CodesetsStrLen(str, tags...) \
165 ({ULONG _tags[] = {tags}; CodesetsStrLenA((str), (struct TagItem *) _tags);})
166 #endif
168 #define CodesetsIsValidUTF8(str) \
169 LP1(0x96, BOOL, CodesetsIsValidUTF8, STRPTR, str, a0, \
170 , CODESETS_BASE_NAME)
172 #define CodesetsFreeVecPooledA(pool, mem, attrs) \
173 LP3NR(0x9c, CodesetsFreeVecPooledA, APTR, pool, a0, APTR, mem, a1, struct TagItem *, attrs, a2, \
174 , CODESETS_BASE_NAME)
176 #ifndef NO_INLINE_STDARG
177 #define CodesetsFreeVecPooled(pool, mem, tags...) \
178 ({ULONG _tags[] = {tags}; CodesetsFreeVecPooledA((pool), (mem), (struct TagItem *) _tags);})
179 #endif
181 #define CodesetsConvertStrA(str) \
182 LP1(0xa2, STRPTR, CodesetsConvertStrA, struct TagItem *, str, a0, \
183 , CODESETS_BASE_NAME)
185 #ifndef NO_INLINE_STDARG
186 #define CodesetsConvertStr(tags...) \
187 ({ULONG _tags[] = {tags}; CodesetsConvertStrA((struct TagItem *) _tags);})
188 #endif
190 #define CodesetsListCreateA(attrs) \
191 LP1(0xa8, struct codesetList *, CodesetsListCreateA, struct TagItem *, attrs, a0, \
192 , CODESETS_BASE_NAME)
194 #ifndef NO_INLINE_STDARG
195 #define CodesetsListCreate(tags...) \
196 ({ULONG _tags[] = {tags}; CodesetsListCreateA((struct TagItem *) _tags);})
197 #endif
199 #define CodesetsListDeleteA(attrs) \
200 LP1(0xae, BOOL, CodesetsListDeleteA, struct TagItem *, attrs, a0, \
201 , CODESETS_BASE_NAME)
203 #ifndef NO_INLINE_STDARG
204 #define CodesetsListDelete(tags...) \
205 ({ULONG _tags[] = {tags}; CodesetsListDeleteA((struct TagItem *) _tags);})
206 #endif
208 #define CodesetsListAddA(list, attrs) \
209 LP2(0xb4, BOOL, CodesetsListAddA, struct codesetList *, list, a0, struct TagItem *, attrs, a1, \
210 , CODESETS_BASE_NAME)
212 #ifndef NO_INLINE_STDARG
213 #define CodesetsListAdd(list, tags...) \
214 ({ULONG _tags[] = {tags}; CodesetsListAddA((list), (struct TagItem *) _tags);})
215 #endif
217 #define CodesetsListRemoveA(attrs) \
218 LP1(0xba, BOOL, CodesetsListRemoveA, struct TagItem *, attrs, a0, \
219 , CODESETS_BASE_NAME)
221 #ifndef NO_INLINE_STDARG
222 #define CodesetsListRemove(tags...) \
223 ({ULONG _tags[] = {tags}; CodesetsListRemoveA((struct TagItem *) _tags);})
224 #endif
226 #endif /* _INLINE_CODESETS_H */