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-2009 by 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 ***************************************************************************/
29 ULONG
freeBase(struct LibraryHeader
* lib
);
30 ULONG
initBase(struct LibraryHeader
* lib
);
33 #if defined(__amigaos4__) || defined(__MORPHOS__)
34 #define HAVE_ALLOCVECPOOLED 1
35 #define HAVE_FREEVECPOOLED 1
38 #if defined(HAVE_ALLOCVECPOOLED)
39 #define allocVecPooled(pool,size) AllocVecPooled(pool,size)
41 APTR
allocVecPooled(APTR pool
, ULONG size
);
43 #if defined(HAVE_FREEVECPOOLED)
44 #define freeVecPooled(pool,mem) FreeVecPooled(pool,mem)
46 void freeVecPooled(APTR pool
, APTR mem
);
48 APTR
reallocVecPooled(APTR pool
, APTR mem
, ULONG oldSize
, ULONG newSize
);
49 APTR
allocArbitrateVecPooled(ULONG size
);
50 void freeArbitrateVecPooled(APTR mem
);
51 APTR
reallocArbitrateVecPooled(APTR mem
, ULONG oldSize
, ULONG newSize
);
52 ULONG
utf16_strlen(UTF16
*ptr
);
53 ULONG
utf32_strlen(UTF32
*ptr
);
56 LIBPROTO(CodesetsEncodeB64A
, ULONG
, REG(a0
, struct TagItem
*attrs
));
57 LIBPROTOVA(CodesetsEncodeB64
,ULONG
, ...);
58 LIBPROTO(CodesetsDecodeB64A
, ULONG
, REG(a0
, struct TagItem
*attrs
));
59 LIBPROTOVA(CodesetsDecodeB64
,ULONG
, ...);
62 LIBPROTO(CodesetsConvertUTF32toUTF16
, ULONG
, REG(a0
, const UTF32
**sourceStart
), REG(a1
, const UTF32
*sourceEnd
), REG(a2
, UTF16
**targetStart
), REG(a3
, UTF16
*targetEnd
), REG(d0
, ULONG flags
));
63 LIBPROTO(CodesetsConvertUTF16toUTF32
, ULONG
, REG(a0
, const UTF16
**sourceStart
), REG(a1
, const UTF16
*sourceEnd
), REG(a2
, UTF32
**targetStart
), REG(a3
, UTF32
*targetEnd
), REG(d0
, ULONG flags
));
64 LIBPROTO(CodesetsConvertUTF16toUTF8
, ULONG
, REG(a0
, const UTF16
**sourceStart
), REG(a1
, const UTF16
*sourceEnd
) , REG(a2
, UTF8
**targetStart
), REG(a3
, UTF8
*targetEnd
), REG(d0
, ULONG flags
));
65 LIBPROTO(CodesetsIsLegalUTF8
, BOOL
, REG(a0
, const UTF8
*source
), REG(d0
, ULONG length
));
66 LIBPROTO(CodesetsIsLegalUTF8Sequence
, BOOL
, REG(a0
, const UTF8
*source
), REG(a1
, const UTF8
*sourceEnd
));
67 LIBPROTO(CodesetsConvertUTF8toUTF16
, ULONG
, REG(a0
, const UTF8
**sourceStart
), REG(a1
, const UTF8
*sourceEnd
), REG(a2
, UTF16
**targetStart
), REG(a3
, UTF16
*targetEnd
), REG(d0
, ULONG flags
));
68 LIBPROTO(CodesetsConvertUTF32toUTF8
, ULONG
, REG(a0
, const UTF32
**sourceStart
), REG(a1
, const UTF32
*sourceEnd
), REG(a2
, UTF8
**targetStart
), REG(a3
, UTF8
*targetEnd
), REG(d0
, ULONG flags
));
69 LIBPROTO(CodesetsConvertUTF8toUTF32
, ULONG
, REG(a0
, const UTF8
**sourceStart
), REG(a1
, const UTF8
*sourceEnd
), REG(a2
, UTF32
**targetStart
), REG(a3
, UTF32
*targetEnd
), REG(d0
, ULONG flags
));
72 BOOL
codesetsInit(struct codesetList
*csList
);
73 void codesetsCleanup(struct codesetList
*csList
);
74 struct codeset
*codesetsFind(struct codesetList
*csList
, const char *name
);
76 LIBPROTO(CodesetsSupportedA
, STRPTR
*, REG(a0
, struct TagItem
*attrs
));
77 LIBPROTOVA(CodesetsSupported
, STRPTR
*, ...);
78 LIBPROTO(CodesetsFreeA
, void, REG(a0
, APTR obj
), REG(a1
, struct TagItem
*attrs
));
79 LIBPROTOVA(CodesetsFree
, void, REG(a0
, APTR obj
), ...);
80 LIBPROTO(CodesetsSetDefaultA
, struct codeset
*, REG(a0
, STRPTR name
), REG(a1
, struct TagItem
*attrs
));
81 LIBPROTOVA(CodesetsSetDefault
,struct codeset
*, REG(a0
, STRPTR name
), ...);
82 LIBPROTO(CodesetsFindA
, struct codeset
*, REG(a0
, STRPTR name
), REG(a1
, struct TagItem
*attrs
));
83 LIBPROTOVA(CodesetsFind
, struct codeset
*, REG(a0
, STRPTR name
), ...);
84 LIBPROTO(CodesetsFindBestA
, struct codeset
*, REG(a0
, struct TagItem
*attrs
));
85 LIBPROTOVA(CodesetsFindBest
, struct codeset
*, ...);
86 LIBPROTO(CodesetsStrLenA
, ULONG
, REG(a0
, STRPTR str
), REG(a1
, struct TagItem
*attrs
));
87 LIBPROTOVA(CodesetsStrLen
, ULONG
, REG(a0
, STRPTR str
), ...);
88 LIBPROTO(CodesetsConvertStrA
, STRPTR
, REG(a0
, struct TagItem
*attrs
));
89 LIBPROTOVA(CodesetsConvertStr
,STRPTR
, ...);
90 LIBPROTO(CodesetsUTF8ToStrA
, STRPTR
, REG(a0
, struct TagItem
*attrs
));
91 LIBPROTOVA(CodesetsUTF8ToStr
, STRPTR
, ...);
92 LIBPROTO(CodesetsUTF8CreateA
, UTF8
*, REG(a0
, struct TagItem
*attrs
));
93 LIBPROTOVA(CodesetsUTF8Create
,UTF8
*, ...);
94 LIBPROTO(CodesetsFreeVecPooledA
, void, REG(a0
, APTR pool
), REG(a1
, APTR mem
), REG(a2
, struct TagItem
*attrs
));
95 LIBPROTOVA(CodesetsFreeVecPooled
,void, REG(a0
, APTR pool
), REG(a1
, APTR mem
), ...);
96 LIBPROTO(CodesetsIsValidUTF8
,BOOL
, REG(a0
, STRPTR s
));
97 LIBPROTO(CodesetsUTF8Len
, ULONG
, REG(a0
, UTF8
*str
));
98 LIBPROTO(CodesetsListCreateA
, struct codesetList
*, REG(a0
, struct TagItem
*attrs
));
99 LIBPROTOVA(CodesetsListCreate
, struct codesetList
*, ...);
100 LIBPROTO(CodesetsListDeleteA
, BOOL
, REG(a0
, struct TagItem
*attrs
));
101 LIBPROTOVA(CodesetsListDelete
, BOOL
, ...);
102 LIBPROTO(CodesetsListAddA
, BOOL
, REG(a0
, struct codesetList
*csList
), REG(a1
, struct TagItem
*attrs
));
103 LIBPROTOVA(CodesetsListAdd
, BOOL
, REG(a0
, struct codesetList
*csList
), ...);
104 LIBPROTO(CodesetsListRemoveA
, BOOL
, REG(a0
, struct TagItem
*attrs
));
105 LIBPROTOVA(CodesetsListRemove
, BOOL
, ...);
107 #endif /* _LIB_PROTOS_H */