From b2ddb3d0b42a43428c24d185b16e51082befd15e Mon Sep 17 00:00:00 2001 From: mazze Date: Sun, 18 Nov 2007 01:17:00 +0000 Subject: [PATCH] mmakefile und *.conf written. LHxx macros to functions added. git-svn-id: https://svn.aros.org:8080/svn/aros/trunk/AROS@27242 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/codesetslib/src/base64.c | 28 ++++ workbench/libs/codesetslib/src/codesets.c | 234 ++++++++++++++++++++++++++- workbench/libs/codesetslib/src/codesets.conf | 61 +++++++ workbench/libs/codesetslib/src/convertUTF.c | 138 ++++++++++++++++ workbench/libs/codesetslib/src/init.c | 5 +- workbench/libs/codesetslib/src/mmakefile.src | 32 ++++ 6 files changed, 496 insertions(+), 2 deletions(-) create mode 100644 workbench/libs/codesetslib/src/codesets.conf create mode 100644 workbench/libs/codesetslib/src/mmakefile.src diff --git a/workbench/libs/codesetslib/src/base64.c b/workbench/libs/codesetslib/src/base64.c index 67f6c73cb..bc9c6e030 100755 --- a/workbench/libs/codesetslib/src/base64.c +++ b/workbench/libs/codesetslib/src/base64.c @@ -284,9 +284,18 @@ insig(struct b64 *b64) /****************************************************************************/ +#ifdef __AROS__ +AROS_LH1(ULONG, CodesetsEncodeB64A, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 21, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsEncodeB64A(REG(a0, struct TagItem *attrs)) { +#endif struct b64 b64; struct TagItem *tag; STRPTR source; @@ -475,8 +484,12 @@ CodesetsEncodeB64A(REG(a0, struct TagItem *attrs)) RETURN((ULONG)b64.error); return (ULONG)b64.error; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsEncodeB64A, ULONG, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -485,6 +498,7 @@ LIBSTUB(CodesetsEncodeB64A, ULONG, REG(a0, struct TagItem *attrs)) return CodesetsEncodeB64A(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsEncodeB64, ULONG, ...) @@ -502,9 +516,18 @@ LIBSTUBVA(CodesetsEncodeB64, ULONG, ...) /****************************************************************************/ +#ifdef __AROS__ +AROS_LH1(ULONG, CodesetsDecodeB64A, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 22, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsDecodeB64A(REG(a0, struct TagItem *attrs)) { +#endif struct b64 b64; struct TagItem *tag; STRPTR source; @@ -690,8 +713,12 @@ end: RETURN((ULONG)b64.error); return (ULONG)b64.error; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsDecodeB64A, ULONG, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -700,6 +727,7 @@ LIBSTUB(CodesetsDecodeB64A, ULONG, REG(a0, struct TagItem *attrs)) return CodesetsDecodeB64A(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsDecodeB64, ULONG, ...) diff --git a/workbench/libs/codesetslib/src/codesets.c b/workbench/libs/codesetslib/src/codesets.c index 34bd74c11..2f6cb59a7 100755 --- a/workbench/libs/codesetslib/src/codesets.c +++ b/workbench/libs/codesetslib/src/codesets.c @@ -4283,9 +4283,18 @@ codesetsFindBest(struct TagItem *attrs, ULONG csFamily, STRPTR text, int text_le /**************************************************************************/ /// CodesetsSupportedA() +#ifdef __AROS__ +AROS_LH1(STRPTR *, CodesetsSupportedA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 15, Codesets +) +{ + AROS_LIBFUNC_INIT +#else STRPTR *LIBFUNC CodesetsSupportedA(REG(a0, UNUSED struct TagItem * attrs)) { +#endif STRPTR *array = NULL; struct TagItem *tstate = attrs; struct TagItem *tag; @@ -4342,8 +4351,12 @@ CodesetsSupportedA(REG(a0, UNUSED struct TagItem * attrs)) RETURN(array); return array; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsSupportedA, STRPTR*, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4352,6 +4365,7 @@ LIBSTUB(CodesetsSupportedA, STRPTR*, REG(a0, struct TagItem *attrs)) return CodesetsSupportedA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsSupported, STRPTR*, ...) @@ -4369,18 +4383,32 @@ LIBSTUBVA(CodesetsSupported, STRPTR*, ...) /// /// CodesetsFreeA() +#ifdef __AROS__ +AROS_LH2(void, CodesetsFreeA, + AROS_LHA(APTR, obj, A0), + AROS_LHA(struct TagItem *, attrs, A1), + struct CodesetsBase *, library, 14, Codesets +) +{ + AROS_LIBFUNC_INIT +#else void LIBFUNC CodesetsFreeA(REG(a0, APTR obj), REG(a1, UNUSED struct TagItem *attrs)) { +#endif ENTER(); if(obj) freeArbitrateVecPooled(obj); LEAVE(); +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsFreeA, void, REG(a0, APTR obj), REG(a1, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4389,6 +4417,7 @@ LIBSTUB(CodesetsFreeA, void, REG(a0, APTR obj), REG(a1, struct TagItem *attrs)) return CodesetsFreeA(obj, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsFree, void, REG(a0, APTR obj), ...) @@ -4403,10 +4432,20 @@ LIBSTUBVA(CodesetsFree, void, REG(a0, APTR obj), ...) /// /// CodesetsSetDefaultA() +#ifdef __AROS__ +AROS_LH2(struct codeset *, CodesetsSetDefaultA, + AROS_LHA(STRPTR, name, A0), + AROS_LHA(struct TagItem *, attrs, A1), + struct CodesetsBase *, library, 13, Codesets +) +{ + AROS_LIBFUNC_INIT +#else struct codeset *LIBFUNC CodesetsSetDefaultA(REG(a0, STRPTR name), REG(a1, struct TagItem *attrs)) { +#endif struct codeset *codeset; ENTER(); @@ -4426,8 +4465,12 @@ CodesetsSetDefaultA(REG(a0, STRPTR name), RETURN(codeset); return codeset; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsSetDefaultA, struct codeset *, REG(a0, STRPTR name), REG(a1, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4436,6 +4479,7 @@ LIBSTUB(CodesetsSetDefaultA, struct codeset *, REG(a0, STRPTR name), REG(a1, str return CodesetsSetDefaultA(name, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsSetDefault, struct codeset *, REG(a0, STRPTR name), ...) @@ -4453,9 +4497,19 @@ LIBSTUBVA(CodesetsSetDefault, struct codeset *, REG(a0, STRPTR name), ...) /// /// CodesetsFindA() +#ifdef __AROS__ +AROS_LH2(struct codeset *, CodesetsFindA, + AROS_LHA(STRPTR, name, A0), + AROS_LHA(struct TagItem *, attrs, A1), + struct CodesetsBase *, library, 16, Codesets +) +{ + AROS_LIBFUNC_INIT +#else struct codeset *LIBFUNC CodesetsFindA(REG(a0, STRPTR name), REG(a1, struct TagItem *attrs)) { +#endif struct codeset *codeset = NULL; ENTER(); @@ -4498,8 +4552,12 @@ CodesetsFindA(REG(a0, STRPTR name), REG(a1, struct TagItem *attrs)) RETURN(codeset); return codeset; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsFindA, struct codeset *, REG(a0, STRPTR name), REG(a1, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4508,6 +4566,7 @@ LIBSTUB(CodesetsFindA, struct codeset *, REG(a0, STRPTR name), REG(a1, struct Ta return CodesetsFindA(name, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsFind, struct codeset *, REG(a0, STRPTR name), ...) @@ -4524,9 +4583,18 @@ LIBSTUBVA(CodesetsFind, struct codeset *, REG(a0, STRPTR name), ...) #endif /// /// CodesetsFindBestA() +#ifdef __AROS__ +AROS_LH1(struct codeset *, CodesetsFindBestA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 17, Codesets +) +{ + AROS_LIBFUNC_INIT +#else struct codeset *LIBFUNC CodesetsFindBestA(REG(a0, struct TagItem *attrs)) { +#endif struct codeset *codeset = NULL; ENTER(); @@ -4560,8 +4628,12 @@ CodesetsFindBestA(REG(a0, struct TagItem *attrs)) RETURN(codeset); return codeset; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsFindBestA, struct codeset *, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4570,6 +4642,7 @@ LIBSTUB(CodesetsFindBestA, struct codeset *, REG(a0, struct TagItem *attrs)) return CodesetsFindBestA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsFindBest, struct codeset *, ...) @@ -4588,9 +4661,18 @@ LIBSTUBVA(CodesetsFindBest, struct codeset *, ...) /// CodesetsUTF8Len() // Returns the number of characters a utf8 string has. This is not // identically with the size of memory is required to hold the string. +#ifdef __AROS__ +AROS_LH1(ULONG, CodesetsUTF8Len, + AROS_LHA(const UTF8 *, str, A0), + struct CodesetsBase *, library, 18, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsUTF8Len(REG(a0, UTF8 *str)) { +#endif int len; unsigned char c; @@ -4609,8 +4691,12 @@ CodesetsUTF8Len(REG(a0, UTF8 *str)) RETURN((ULONG)len); return (ULONG)len; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsUTF8Len, ULONG, REG(a0, UTF8* str)) { #ifdef __MORPHOS__ @@ -4619,12 +4705,24 @@ LIBSTUB(CodesetsUTF8Len, ULONG, REG(a0, UTF8* str)) return CodesetsUTF8Len(str); #endif } +#endif + /// /// CodesetsStrLenA() +#ifdef __AROS__ +AROS_LH2(ULONG, CodesetsStrLenA, + AROS_LHA(STRPTR, str, A0), + AROS_LHA(struct TagItem *, attrs, A1), + struct CodesetsBase *, library, 23, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsStrLenA(REG(a0, STRPTR str), REG(a1, struct TagItem *attrs)) { +#endif struct codeset *codeset; int len, res; STRPTR src; @@ -4648,8 +4746,12 @@ CodesetsStrLenA(REG(a0, STRPTR str), RETURN((ULONG)res); return (ULONG)res; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsStrLenA, ULONG, REG(a0, STRPTR str), REG(a1, struct TagItem *attrs)) { @@ -4659,6 +4761,7 @@ LIBSTUB(CodesetsStrLenA, ULONG, REG(a0, STRPTR str), return CodesetsStrLenA(str, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsStrLen, ULONG, REG(a0, STRPTR str), ...) @@ -4679,9 +4782,18 @@ LIBSTUBVA(CodesetsStrLen, ULONG, REG(a0, STRPTR str), ...) // written to dest excluding the NULL byte (which is always ensured by this // function; it means a NULL str will produce "" as dest; anyway you should // check NULL str to not waste your time!). +#ifdef __AROS__ +AROS_LH1(STRPTR, CodesetsUTF8ToStrA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 19, Codesets +) +{ + AROS_LIBFUNC_INIT +#else STRPTR LIBFUNC CodesetsUTF8ToStrA(REG(a0, struct TagItem *attrs)) { +#endif UTF8 *src; ULONG srcLen; ULONG *destLenPtr; @@ -4856,8 +4968,12 @@ CodesetsUTF8ToStrA(REG(a0, struct TagItem *attrs)) RETURN(dest); return dest; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsUTF8ToStrA, STRPTR, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -4866,6 +4982,7 @@ LIBSTUB(CodesetsUTF8ToStrA, STRPTR, REG(a0, struct TagItem *attrs)) return CodesetsUTF8ToStrA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsUTF8ToStr, STRPTR, ...) @@ -4886,9 +5003,18 @@ LIBSTUBVA(CodesetsUTF8ToStr, STRPTR, ...) // Converts a string and a charset to an UTF8. Returns the UTF8. // If a destination hook is supplied always return 0. // If from is NULL, it returns NULL and doesn't call the hook. +#ifdef __AROS__ +AROS_LH1(UTF8 *, CodesetsUTF8CreateA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 20, Codesets +) +{ + AROS_LIBFUNC_INIT +#else UTF8 *LIBFUNC CodesetsUTF8CreateA(REG(a0, struct TagItem *attrs)) { +#endif UTF8 *from; UTF8 *dest; ULONG fromLen, *destLenPtr; @@ -5026,8 +5152,12 @@ CodesetsUTF8CreateA(REG(a0, struct TagItem *attrs)) RETURN(dest); return dest; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsUTF8CreateA, UTF8*, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5036,6 +5166,7 @@ LIBSTUB(CodesetsUTF8CreateA, UTF8*, REG(a0, struct TagItem *attrs)) return CodesetsUTF8CreateA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsUTF8Create, UTF8*, ...) @@ -5057,10 +5188,18 @@ LIBSTUBVA(CodesetsUTF8Create, UTF8*, ...) ((c) >= 160 && ((c) & ~0x3ff) != 0xd800 && \ (c) != 0xfeff && (c) != 0xfffe && (c) != 0xffff) - +#ifdef __AROS__ +AROS_LH1(BOOL, CodesetsIsValidUTF8, + AROS_LHA(STRPTR, s, A0), + struct CodesetsBase *, library, 24, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsIsValidUTF8(REG(a0, STRPTR s)) { +#endif STRPTR t = s; int n; @@ -5077,8 +5216,12 @@ CodesetsIsValidUTF8(REG(a0, STRPTR s)) RETURN(TRUE); return TRUE; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsIsValidUTF8, BOOL, REG(a0, STRPTR s)) { #ifdef __MORPHOS__ @@ -5087,13 +5230,24 @@ LIBSTUB(CodesetsIsValidUTF8, BOOL, REG(a0, STRPTR s)) return CodesetsIsValidUTF8(s); #endif } +#endif + /// /// CodesetsConvertStrA() // Converts a given string from one source Codeset to a given destination // codeset and returns the convert string +#ifdef __AROS__ +AROS_LH1(STRPTR, CodesetsConvertStrA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 26, Codesets +) +{ + AROS_LIBFUNC_INIT +#else STRPTR LIBFUNC CodesetsConvertStrA(REG(a0, struct TagItem *attrs)) { +#endif STRPTR srcStr; STRPTR dstStr = NULL; ULONG srcLen; @@ -5210,8 +5364,12 @@ CodesetsConvertStrA(REG(a0, struct TagItem *attrs)) RETURN(dstStr); return dstStr; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertStrA, STRPTR, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5220,6 +5378,7 @@ LIBSTUB(CodesetsConvertStrA, STRPTR, REG(a0, struct TagItem *attrs)) return CodesetsConvertStrA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsConvertStr, STRPTR, ...) @@ -5237,11 +5396,22 @@ LIBSTUBVA(CodesetsConvertStr, STRPTR, ...) /// /// CodesetsFreeVecPooledA() +#ifdef __AROS__ +AROS_LH3(void, CodesetsFreeVecPooledA, + AROS_LHA(APTR, pool, A0), + AROS_LHA(APTR, mem, A1), + AROS_LHA(struct TagItem *, attrs, A2), + struct CodesetsBase *, library, 25, Codesets +) +{ + AROS_LIBFUNC_INIT +#else void LIBFUNC CodesetsFreeVecPooledA(REG(a0, APTR pool), REG(a1, APTR mem), REG(a2, struct TagItem *attrs)) { +#endif ENTER(); if(pool && mem) @@ -5258,8 +5428,12 @@ CodesetsFreeVecPooledA(REG(a0, APTR pool), } LEAVE(); +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsFreeVecPooledA, void, REG(a0, APTR pool), REG(a1, APTR mem), REG(a2, struct TagItem *attrs)) @@ -5270,6 +5444,7 @@ LIBSTUB(CodesetsFreeVecPooledA, void, REG(a0, APTR pool), return CodesetsFreeVecPooledA(pool, mem, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsFreeVecPooled, void, REG(a0, APTR pool), @@ -5284,9 +5459,18 @@ LIBSTUBVA(CodesetsFreeVecPooled, void, REG(a0, APTR pool), #endif /// /// CodesetsListCreateA() +#ifdef __AROS__ +AROS_LH1(struct codesetList *, CodesetsListCreateA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 27, Codesets +) +{ + AROS_LIBFUNC_INIT +#else struct codesetList *LIBFUNC CodesetsListCreateA(REG(a0, struct TagItem *attrs)) { +#endif struct codesetList *csList = NULL; ENTER(); @@ -5347,8 +5531,12 @@ CodesetsListCreateA(REG(a0, struct TagItem *attrs)) RETURN(csList); return csList; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsListCreateA, struct codesetList *, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5357,6 +5545,7 @@ LIBSTUB(CodesetsListCreateA, struct codesetList *, REG(a0, struct TagItem *attrs return CodesetsListCreateA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsListCreate, struct codesetList *, ...) @@ -5374,9 +5563,18 @@ LIBSTUBVA(CodesetsListCreate, struct codesetList *, ...) /// /// CodesetsListDeleteA() +#ifdef __AROS__ +AROS_LH1(BOOL, CodesetsListDeleteA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 28, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsListDeleteA(REG(a0, struct TagItem *attrs)) { +#endif BOOL result = FALSE; ENTER(); @@ -5421,8 +5619,12 @@ CodesetsListDeleteA(REG(a0, struct TagItem *attrs)) RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsListDeleteA, BOOL, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5431,6 +5633,7 @@ LIBSTUB(CodesetsListDeleteA, BOOL, REG(a0, struct TagItem *attrs)) return CodesetsListDeleteA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsListDelete, BOOL, ...) @@ -5448,10 +5651,20 @@ LIBSTUBVA(CodesetsListDelete, BOOL, ...) /// /// CodesetsListAddA() +#ifdef __AROS__ +AROS_LH2(BOOL, CodesetsListAddA, + AROS_LHA(struct codesetList *, csList, A0), + AROS_LHA(struct TagItem *, attrs, A1), + struct CodesetsBase *, library, 29, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsListAddA(REG(a0, struct codesetList *csList), REG(a1, struct TagItem *attrs)) { +#endif BOOL result = FALSE; ENTER(); @@ -5498,8 +5711,12 @@ CodesetsListAddA(REG(a0, struct codesetList *csList), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsListAddA, BOOL, REG(a0, struct codesetList *csList), REG(a1, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5508,6 +5725,7 @@ LIBSTUB(CodesetsListAddA, BOOL, REG(a0, struct codesetList *csList), REG(a1, str return CodesetsListAddA(csList, attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsListAdd, BOOL, struct codesetList *csList, ...) @@ -5525,9 +5743,18 @@ LIBSTUBVA(CodesetsListAdd, BOOL, struct codesetList *csList, ...) /// /// CodesetsListRemoveA() +#ifdef __AROS__ +AROS_LH1(BOOL, CodesetsListRemoveA, + AROS_LHA(struct TagItem *, attrs, A0), + struct CodesetsBase *, library, 30, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsListRemoveA(REG(a0, struct TagItem *attrs)) { +#endif BOOL result = FALSE; ENTER(); @@ -5590,8 +5817,12 @@ CodesetsListRemoveA(REG(a0, struct TagItem *attrs)) RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsListRemoveA, BOOL, REG(a0, struct TagItem *attrs)) { #ifdef __MORPHOS__ @@ -5600,6 +5831,7 @@ LIBSTUB(CodesetsListRemoveA, BOOL, REG(a0, struct TagItem *attrs)) return CodesetsListRemoveA(attrs); #endif } +#endif #ifdef __amigaos4__ LIBSTUBVA(CodesetsListRemove, BOOL, ...) diff --git a/workbench/libs/codesetslib/src/codesets.conf b/workbench/libs/codesetslib/src/codesets.conf new file mode 100644 index 000000000..6028e886e --- /dev/null +++ b/workbench/libs/codesetslib/src/codesets.conf @@ -0,0 +1,61 @@ +##begin config +version 6.4 +date 29.07.2007 +libbasetype struct CodesetsBase * +##end config + +##begin cdef +#include + +struct codeset * CodesetsSetDefault(STRPTR name, Tag attrs, ...); +void CodesetsFree(APTR obj, Tag attrs, ...); +STRPTR * CodesetsSupported(Tag attrs, ...); +struct codeset * CodesetsFind(STRPTR name, Tag attrs, ...); +struct codeset * CodesetsFindBest(Tag attrs, ...); +STRPTR CodesetsUTF8ToStr(Tag attrs, ...); +UTF8 * CodesetsUTF8Create(Tag attrs, ...); +ULONG CodesetsEncodeB64(Tag attrs, ...); +ULONG CodesetsDecodeB64(Tag attrs, ...); +ULONG CodesetsStrLen(STRPTR str, Tag attrs, ...); +void CodesetsFreeVecPooled(APTR pool, APTR mem, Tag attrs, ...); +STRPTR CodesetsConvertStr(Tag attrs, ...); +struct codesetList * CodesetsListCreate(Tag attrs, ...); +BOOL CodesetsListDelete(Tag tag1, ...); +BOOL CodesetsListAdd(struct codesetList *codesetsList, Tag attrs, ...); +BOOL CodesetsListRemove(Tag tag1, ...); +##end cdef + +##begin cdefprivate +#include +#include +#include "base.h" +##end cdefprivate + +##begin functionlist +ULONG CodesetsConvertUTF32toUTF16(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +ULONG CodesetsConvertUTF16toUTF32(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +ULONG CodesetsConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +BOOL CodesetsIsLegalUTF8(const UTF8 *source, ULONG length) (A0,D0) +BOOL CodesetsIsLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) (A0,D1) +ULONG CodesetsConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +ULONG CodesetsConvertUTF32toUTF8(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +ULONG CodesetsConvertUTF8toUTF32(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ULONG flags) (A0,A1,A2,A3,D0) +struct codeset * CodesetsSetDefaultA(STRPTR name, struct TagItem * attrs) (A0,A1) +void CodesetsFreeA(APTR obj, struct TagItem * attrs) (A0,A1) +STRPTR * CodesetsSupportedA(struct TagItem * attrs) (A0) +struct codeset * CodesetsFindA(STRPTR name, struct TagItem * attrs) (A0,A1) +struct codeset * CodesetsFindBestA(struct TagItem * attrs) (A0) +ULONG CodesetsUTF8Len(const UTF8 *str) (A0) +STRPTR CodesetsUTF8ToStrA(struct TagItem * attrs) (A0) +UTF8 * CodesetsUTF8CreateA(struct TagItem * attrs) (A0) +ULONG CodesetsEncodeB64A(struct TagItem * attrs) (A0) +ULONG CodesetsDecodeB64A(struct TagItem * attrs) (A0) +ULONG CodesetsStrLenA(STRPTR str, struct TagItem * attrs) (A0,A1) +BOOL CodesetsIsValidUTF8(STRPTR str) (A0) +void CodesetsFreeVecPooledA(APTR pool, APTR mem, struct TagItem *attrs) (A0,A1,A2) +STRPTR CodesetsConvertStrA(struct TagItem * attrs) (A0) +struct codesetList * CodesetsListCreateA(struct TagItem *attrs) (A0) +BOOL CodesetsListDeleteA(struct TagItem *attrs) (A0) +BOOL CodesetsListAddA(struct codesetList *codesetsList, struct TagItem *attrs) (A0,A1) +BOOL CodesetsListRemoveA(struct TagItem *attrs) (A0) +##end functionlist diff --git a/workbench/libs/codesetslib/src/convertUTF.c b/workbench/libs/codesetslib/src/convertUTF.c index 4900e8d69..3978d775d 100755 --- a/workbench/libs/codesetslib/src/convertUTF.c +++ b/workbench/libs/codesetslib/src/convertUTF.c @@ -59,6 +59,18 @@ static const UTF32 halfMask = 0x3FFUL; /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF32toUTF16, + AROS_LHA(const UTF32 **, sourceStart, A0), + AROS_LHA(const UTF32 *, sourceEnd, A1), + AROS_LHA(UTF16 **, targetStart, A2), + AROS_LHA(UTF16 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 5, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF32toUTF16(REG(a0, const UTF32 ** sourceStart), REG(a1, const UTF32 * sourceEnd), @@ -66,6 +78,7 @@ CodesetsConvertUTF32toUTF16(REG(a0, const UTF32 ** sourceStart), REG(a3, UTF16 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF32 *source = *sourceStart; UTF16 *target = *targetStart; @@ -136,8 +149,12 @@ CodesetsConvertUTF32toUTF16(REG(a0, const UTF32 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF32toUTF16, ULONG, REG(a0, const UTF32 ** sourceStart), REG(a1, const UTF32 * sourceEnd), REG(a2, UTF16 ** targetStart), @@ -150,9 +167,22 @@ LIBSTUB(CodesetsConvertUTF32toUTF16, ULONG, REG(a0, const UTF32 ** sourceStart), return CodesetsConvertUTF32toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF16toUTF32, + AROS_LHA(const UTF16 **, sourceStart, A0), + AROS_LHA(const UTF16 *, sourceEnd, A1), + AROS_LHA(UTF32 **, targetStart, A2), + AROS_LHA(UTF32 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 6, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF16toUTF32(REG(a0, const UTF16 ** sourceStart), REG(a1, const UTF16 * sourceEnd), @@ -160,6 +190,7 @@ CodesetsConvertUTF16toUTF32(REG(a0, const UTF16 ** sourceStart), REG(a3, UTF32 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF16 *source = *sourceStart; UTF32 *target = *targetStart; @@ -240,8 +271,12 @@ CodesetsConvertUTF16toUTF32(REG(a0, const UTF16 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF16toUTF32, ULONG, REG(a0, const UTF16 ** sourceStart), REG(a1, const UTF16 * sourceEnd), REG(a2, UTF32 ** targetStart), @@ -254,6 +289,7 @@ LIBSTUB(CodesetsConvertUTF16toUTF32, ULONG, REG(a0, const UTF16 ** sourceStart), return CodesetsConvertUTF16toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /***********************************************************************/ @@ -306,6 +342,18 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF16toUTF8, + AROS_LHA(const UTF16 **, sourceStart, A0), + AROS_LHA(const UTF16 *, sourceEnd, A1), + AROS_LHA(UTF8 **, targetStart, A2), + AROS_LHA(UTF8 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 7, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF16toUTF8(REG(a0, const UTF16 ** sourceStart), REG(a1, const UTF16 * sourceEnd), @@ -313,6 +361,7 @@ CodesetsConvertUTF16toUTF8(REG(a0, const UTF16 ** sourceStart), REG(a3, UTF8 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF16 *source = *sourceStart; UTF8 *target = *targetStart; @@ -432,8 +481,12 @@ CodesetsConvertUTF16toUTF8(REG(a0, const UTF16 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF16toUTF8, ULONG, REG(a0, const UTF16 ** sourceStart), REG(a1, const UTF16 * sourceEnd), REG(a2, UTF8 ** targetStart), @@ -446,6 +499,7 @@ LIBSTUB(CodesetsConvertUTF16toUTF8, ULONG, REG(a0, const UTF16 ** sourceStart), return CodesetsConvertUTF16toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /***********************************************************************/ @@ -460,10 +514,20 @@ LIBSTUB(CodesetsConvertUTF16toUTF8, ULONG, REG(a0, const UTF16 ** sourceStart), * definition of UTF-8 goes up to 4-byte sequences. */ +#ifdef __AROS__ +AROS_LH2(BOOL, CodesetsIsLegalUTF8, + AROS_LHA(const UTF8 *, source, A0), + AROS_LHA(ULONG, length, D0), + struct CodesetsBase *, library, 8, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsIsLegalUTF8(REG(a0, const UTF8 * source), REG(d0, ULONG length)) { +#endif UTF8 a; const UTF8 *srcptr = source + length; @@ -556,8 +620,12 @@ CodesetsIsLegalUTF8(REG(a0, const UTF8 * source), RETURN(TRUE); return TRUE; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsIsLegalUTF8, BOOL, REG(a0, const UTF8 * source), REG(d0, ULONG length)) { @@ -567,6 +635,7 @@ LIBSTUB(CodesetsIsLegalUTF8, BOOL, REG(a0, const UTF8 * source), return CodesetsIsLegalUTF8(source, length); #endif } +#endif /***********************************************************************/ @@ -575,10 +644,20 @@ LIBSTUB(CodesetsIsLegalUTF8, BOOL, REG(a0, const UTF8 * source), * This is not used here; it's just exported. */ +#ifdef __AROS__ +AROS_LH2(BOOL, CodesetsIsLegalUTF8Sequence, + AROS_LHA(const UTF8 *, source, A0), + AROS_LHA(const UTF8 *, sourceEnd, D1), + struct CodesetsBase *, library, 9, Codesets +) +{ + AROS_LIBFUNC_INIT +#else BOOL LIBFUNC CodesetsIsLegalUTF8Sequence(REG(a0, const UTF8 * source), REG(a1, const UTF8 * sourceEnd)) { +#endif int length = trailingBytesForUTF8[*source] + 1; BOOL res = FALSE; @@ -594,8 +673,12 @@ CodesetsIsLegalUTF8Sequence(REG(a0, const UTF8 * source), RETURN(res); return res; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsIsLegalUTF8Sequence, BOOL, REG(a0, const UTF8 * source), REG(a1, const UTF8 * sourceEnd)) { @@ -605,9 +688,22 @@ LIBSTUB(CodesetsIsLegalUTF8Sequence, BOOL, REG(a0, const UTF8 * source), return CodesetsIsLegalUTF8Sequence(source, sourceEnd); #endif } +#endif /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF8toUTF16, + AROS_LHA(const UTF8 **, sourceStart, A0), + AROS_LHA(const UTF8 *, sourceEnd, A1), + AROS_LHA(UTF16 **, targetStart, A2), + AROS_LHA(UTF16 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 10, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF8toUTF16(REG(a0, const UTF8 ** sourceStart), REG(a1, const UTF8 * sourceEnd), @@ -615,6 +711,7 @@ CodesetsConvertUTF8toUTF16(REG(a0, const UTF8 ** sourceStart), REG(a3, UTF16 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF8 *source = *sourceStart; UTF16 *target = *targetStart; @@ -737,8 +834,12 @@ CodesetsConvertUTF8toUTF16(REG(a0, const UTF8 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF8toUTF16, ULONG, REG(a0, const UTF8 ** sourceStart), REG(a1, const UTF8 * sourceEnd), REG(a2, UTF16 ** targetStart), @@ -751,9 +852,22 @@ LIBSTUB(CodesetsConvertUTF8toUTF16, ULONG, REG(a0, const UTF8 ** sourceStart), return CodesetsConvertUTF8toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF32toUTF8, + AROS_LHA(const UTF32 **, sourceStart, A0), + AROS_LHA(const UTF32 *, sourceEnd, A1), + AROS_LHA(UTF8 **, targetStart, A2), + AROS_LHA(UTF8 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 11, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF32toUTF8(REG(a0, const UTF32 ** sourceStart), REG(a1, const UTF32 * sourceEnd), @@ -761,6 +875,7 @@ CodesetsConvertUTF32toUTF8(REG(a0, const UTF32 ** sourceStart), REG(a3, UTF8 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF32 *source = *sourceStart; UTF8 *target = *targetStart; @@ -851,8 +966,12 @@ CodesetsConvertUTF32toUTF8(REG(a0, const UTF32 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF32toUTF8, ULONG, REG(a0, const UTF32 ** sourceStart), REG(a1, const UTF32 * sourceEnd), REG(a2, UTF8 ** targetStart), @@ -865,9 +984,22 @@ LIBSTUB(CodesetsConvertUTF32toUTF8, ULONG, REG(a0, const UTF32 ** sourceStart), return CodesetsConvertUTF32toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /***********************************************************************/ +#ifdef __AROS__ +AROS_LH5(ULONG, CodesetsConvertUTF8toUTF32, + AROS_LHA(const UTF8 **, sourceStart, A0), + AROS_LHA(const UTF8 *, sourceEnd, A1), + AROS_LHA(UTF32 **, targetStart, A2), + AROS_LHA(UTF32 *, targetEnd, A3), + AROS_LHA(ULONG, flags, D0), + struct CodesetsBase *, library, 12, Codesets +) +{ + AROS_LIBFUNC_INIT +#else ULONG LIBFUNC CodesetsConvertUTF8toUTF32(REG(a0, const UTF8 ** sourceStart), REG(a1, const UTF8 * sourceEnd), @@ -875,6 +1007,7 @@ CodesetsConvertUTF8toUTF32(REG(a0, const UTF8 ** sourceStart), REG(a3, UTF32 * targetEnd), REG(d0, ULONG flags)) { +#endif ULONG result = CSR_ConversionOK; const UTF8 *source = *sourceStart; UTF32 *target = *targetStart; @@ -976,8 +1109,12 @@ CodesetsConvertUTF8toUTF32(REG(a0, const UTF8 ** sourceStart), RETURN(result); return result; +#ifdef __AROS__ + AROS_LIBFUNC_EXIT +#endif } +#ifndef __AROS__ LIBSTUB(CodesetsConvertUTF8toUTF32, ULONG, REG(a0, const UTF8 ** sourceStart), REG(a1, const UTF8 * sourceEnd), REG(a2, UTF32 ** targetStart), @@ -990,6 +1127,7 @@ LIBSTUB(CodesetsConvertUTF8toUTF32, ULONG, REG(a0, const UTF8 ** sourceStart), return CodesetsConvertUTF8toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags); #endif } +#endif /*********************************************************************** diff --git a/workbench/libs/codesetslib/src/init.c b/workbench/libs/codesetslib/src/init.c index 6306d1176..b2b1cf415 100755 --- a/workbench/libs/codesetslib/src/init.c +++ b/workbench/libs/codesetslib/src/init.c @@ -48,6 +48,9 @@ extern struct Library *__UtilityBase; extern struct UtilityIFace* __IUtility; #endif +#elif defined(__AROS__) +struct DosLibrary *DOSBase = NULL; +struct UtilityBase *UtilityBase = NULL; #else struct DosLibrary *DOSBase = NULL; struct Library *UtilityBase = NULL; @@ -291,7 +294,7 @@ initBase(struct LibraryHeader *lib) { // we have to please the internal utilitybase // pointers of libnix and clib2 - #if !defined(__NEWLIB__) + #if !defined(__NEWLIB__) && !defined(__AROS__) __UtilityBase = (APTR)UtilityBase; #if defined(__amigaos4__) __IUtility = IUtility; diff --git a/workbench/libs/codesetslib/src/mmakefile.src b/workbench/libs/codesetslib/src/mmakefile.src new file mode 100644 index 000000000..2ea8f4bad --- /dev/null +++ b/workbench/libs/codesetslib/src/mmakefile.src @@ -0,0 +1,32 @@ +# $Id$ +include $(TOP)/config/make.cfg + +FILES := \ + init \ + utils \ + base64 \ + convertUTF \ + codesets \ + debug + +# init \ + +USER_INCLUDES := -I../include + + +#MM- workbench-libs-codesets-lib : linklibs + +#MM workbench-libs-codesets-lib-includes : \ +#MM kernel-exec-includes \ +#MM kernel-dos-includes \ +#MM kernel-utility-includes \ +#MM includes-copy + +%build_module mmake=workbench-libs-codesets-lib \ + modname=codesets modtype=library \ + files=$(FILES) \ + uselibs="amiga rom" + +%copy_includes includes=../include/libraries/codesets.h dir=../include path= + +%common -- 2.11.4.GIT