1 /***************************************************************************
3 codesets.library - Amiga shared library for handling different codesets
4 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 Copyright (C) 2005-2014 codesets.library Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 codesets.library project: http://sourceforge.net/projects/codesetslib/
21 ***************************************************************************/
23 #include <libraries/codesets.h>
27 #endif /* __cplusplus */
29 #include <aros/libcall.h>
34 AROS_LH5(ULONG
, CodesetsConvertUTF32toUTF16
,
35 AROS_LHA(const UTF32
**, ___sourceStart
, A0
),
36 AROS_LHA(const UTF32
*, ___sourceEnd
, A1
),
37 AROS_LHA(UTF16
**, ___targetStart
, A2
),
38 AROS_LHA(UTF16
*, ___targetEnd
, A3
),
39 AROS_LHA(ULONG
, ___flags
, D0
),
40 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
44 return CALL_LFUNC(CodesetsConvertUTF32toUTF16
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
48 AROS_LH5(ULONG
, CodesetsConvertUTF16toUTF32
,
49 AROS_LHA(const UTF16
**, ___sourceStart
, A0
),
50 AROS_LHA(const UTF16
*, ___sourceEnd
, A1
),
51 AROS_LHA(UTF32
**, ___targetStart
, A2
),
52 AROS_LHA(UTF32
*, ___targetEnd
, A3
),
53 AROS_LHA(ULONG
, ___flags
, D0
),
54 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
58 return CALL_LFUNC(CodesetsConvertUTF16toUTF32
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
62 AROS_LH5(ULONG
, CodesetsConvertUTF16toUTF8
,
63 AROS_LHA(const UTF16
**, ___sourceStart
, A0
),
64 AROS_LHA(const UTF16
*, ___sourceEnd
, A1
),
65 AROS_LHA(UTF8
**, ___targetStart
, A2
),
66 AROS_LHA(UTF8
*, ___targetEnd
, A3
),
67 AROS_LHA(ULONG
, ___flags
, D0
),
68 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
72 return CALL_LFUNC(CodesetsConvertUTF16toUTF8
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
76 AROS_LH2(BOOL
, CodesetsIsLegalUTF8
,
77 AROS_LHA(const UTF8
*, ___source
, A0
),
78 AROS_LHA(ULONG
, ___length
, D0
),
79 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
83 return CALL_LFUNC(CodesetsIsLegalUTF8
,___source
, ___length
);
87 AROS_LH2(BOOL
, CodesetsIsLegalUTF8Sequence
,
88 AROS_LHA(const UTF8
*, ___source
, A0
),
89 AROS_LHA(const UTF8
*, ___sourceEnd
, A1
),
90 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
94 return CALL_LFUNC(CodesetsIsLegalUTF8Sequence
,___source
, ___sourceEnd
);
98 AROS_LH5(ULONG
, CodesetsConvertUTF8toUTF16
,
99 AROS_LHA(const UTF8
**, ___sourceStart
, A0
),
100 AROS_LHA(const UTF8
*, ___sourceEnd
, A1
),
101 AROS_LHA(UTF16
**, ___targetStart
, A2
),
102 AROS_LHA(UTF16
*, ___targetEnd
, A3
),
103 AROS_LHA(ULONG
, ___flags
, D0
),
104 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
108 return CALL_LFUNC(CodesetsConvertUTF8toUTF16
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
112 AROS_LH5(ULONG
, CodesetsConvertUTF32toUTF8
,
113 AROS_LHA(const UTF32
**, ___sourceStart
, A0
),
114 AROS_LHA(const UTF32
*, ___sourceEnd
, A1
),
115 AROS_LHA(UTF8
**, ___targetStart
, A2
),
116 AROS_LHA(UTF8
*, ___targetEnd
, A3
),
117 AROS_LHA(ULONG
, ___flags
, D0
),
118 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
122 return CALL_LFUNC(CodesetsConvertUTF32toUTF8
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
126 AROS_LH5(ULONG
, CodesetsConvertUTF8toUTF32
,
127 AROS_LHA(const UTF8
**, ___sourceStart
, A0
),
128 AROS_LHA(const UTF8
*, ___sourceEnd
, A1
),
129 AROS_LHA(UTF32
**, ___targetStart
, A2
),
130 AROS_LHA(UTF32
*, ___targetEnd
, A3
),
131 AROS_LHA(ULONG
, ___flags
, D0
),
132 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
136 return CALL_LFUNC(CodesetsConvertUTF8toUTF32
,___sourceStart
, ___sourceEnd
, ___targetStart
, ___targetEnd
, ___flags
);
140 AROS_LH2(struct codeset
*, CodesetsSetDefaultA
,
141 AROS_LHA(STRPTR
, ___name
, A0
),
142 AROS_LHA(struct TagItem
*, ___attrs
, A1
),
143 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
147 return CALL_LFUNC(CodesetsSetDefaultA
,___name
, ___attrs
);
151 AROS_LH2(void, CodesetsFreeA
,
152 AROS_LHA(APTR
, ___obj
, A0
),
153 AROS_LHA(struct TagItem
*, ___attrs
, A1
),
154 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
158 return CALL_LFUNC(CodesetsFreeA
,___obj
, ___attrs
);
162 AROS_LH1(STRPTR
*, CodesetsSupportedA
,
163 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
164 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
168 return CALL_LFUNC(CodesetsSupportedA
,___attrs
);
172 AROS_LH2(struct codeset
*, CodesetsFindA
,
173 AROS_LHA(STRPTR
, ___name
, A0
),
174 AROS_LHA(struct TagItem
*, ___attrs
, A1
),
175 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
179 return CALL_LFUNC(CodesetsFindA
,___name
, ___attrs
);
183 AROS_LH1(struct codeset
*, CodesetsFindBestA
,
184 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
185 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
189 return CALL_LFUNC(CodesetsFindBestA
,___attrs
);
193 AROS_LH1(ULONG
, CodesetsUTF8Len
,
194 AROS_LHA(const UTF8
*, ___str
, A0
),
195 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
199 return CALL_LFUNC(CodesetsUTF8Len
,___str
);
203 AROS_LH1(STRPTR
, CodesetsUTF8ToStrA
,
204 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
205 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
209 return CALL_LFUNC(CodesetsUTF8ToStrA
,___attrs
);
213 AROS_LH1(UTF8
*, CodesetsUTF8CreateA
,
214 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
215 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
219 return CALL_LFUNC(CodesetsUTF8CreateA
,___attrs
);
223 AROS_LH1(ULONG
, CodesetsEncodeB64A
,
224 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
225 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
229 return CALL_LFUNC(CodesetsEncodeB64A
,___attrs
);
233 AROS_LH1(ULONG
, CodesetsDecodeB64A
,
234 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
235 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
239 return CALL_LFUNC(CodesetsDecodeB64A
,___attrs
);
243 AROS_LH2(ULONG
, CodesetsStrLenA
,
244 AROS_LHA(STRPTR
, ___str
, A0
),
245 AROS_LHA(struct TagItem
*, ___attrs
, A1
),
246 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
250 return CALL_LFUNC(CodesetsStrLenA
,___str
, ___attrs
);
254 AROS_LH1(BOOL
, CodesetsIsValidUTF8
,
255 AROS_LHA(STRPTR
, ___str
, A0
),
256 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
260 return CALL_LFUNC(CodesetsIsValidUTF8
,___str
);
264 AROS_LH3(void, CodesetsFreeVecPooledA
,
265 AROS_LHA(APTR
, ___pool
, A0
),
266 AROS_LHA(APTR
, ___mem
, A1
),
267 AROS_LHA(struct TagItem
*, ___attrs
, A2
),
268 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
272 return CALL_LFUNC(CodesetsFreeVecPooledA
,___pool
, ___mem
, ___attrs
);
276 AROS_LH1(STRPTR
, CodesetsConvertStrA
,
277 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
278 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
282 return CALL_LFUNC(CodesetsConvertStrA
,___attrs
);
286 AROS_LH1(struct codesetList
*, CodesetsListCreateA
,
287 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
288 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
292 return CALL_LFUNC(CodesetsListCreateA
,___attrs
);
296 AROS_LH1(BOOL
, CodesetsListDeleteA
,
297 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
298 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
302 return CALL_LFUNC(CodesetsListDeleteA
,___attrs
);
306 AROS_LH2(BOOL
, CodesetsListAddA
,
307 AROS_LHA(struct codesetList
*, ___codesetsList
, A0
),
308 AROS_LHA(struct TagItem
*, ___attrs
, A1
),
309 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
313 return CALL_LFUNC(CodesetsListAddA
,___codesetsList
, ___attrs
);
317 AROS_LH1(BOOL
, CodesetsListRemoveA
,
318 AROS_LHA(struct TagItem
*, ___attrs
, A0
),
319 struct LibraryHeader
*, __BASE_OR_IFACE_VAR
, 0, LIBSTUB
323 return CALL_LFUNC(CodesetsListRemoveA
,___attrs
);
330 #endif /* __cplusplus */