Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [r294] Maximize Restore History

* misc: updated to the most recent SDI header files. This makes it possible to remove the stub functions for AmigaOS4.

thboeckel 2014-04-02

added /trunk/include/SDI_misc.h
removed /trunk/include/codesets_68k.c
changed /trunk/ChangeLog
changed /trunk/include/SDI_compiler.h
changed /trunk/include/SDI_hook.h
changed /trunk/include/SDI_lib.h
changed /trunk/include/SDI_stdarg.h
changed /trunk/include/inline/codesets.h
changed /trunk/src/Makefile
changed /trunk/src/Makefile.dep
changed /trunk/src/base.h
changed /trunk/src/base64.c
changed /trunk/src/codesets.c
changed /trunk/src/convertUTF.c
changed /trunk/src/lib_protos.h
changed /trunk/src/libinit.c
changed /trunk/src/stubs-morphos.c
copied /trunk/include/codesets_68k.c -> /trunk/src/codesets_68k.c
copied /trunk/src/stubs-amigaos4.c -> /trunk/include/SDI_interrupt.h
/trunk/include/SDI_misc.h Diff Switch to side-by-side view
Loading...
/trunk/include/codesets_68k.c
File was removed.
/trunk/ChangeLog Diff Switch to side-by-side view
Loading...
/trunk/include/SDI_compiler.h Diff Switch to side-by-side view
Loading...
/trunk/include/SDI_hook.h Diff Switch to side-by-side view
Loading...
/trunk/include/SDI_lib.h Diff Switch to side-by-side view
Loading...
/trunk/include/SDI_stdarg.h Diff Switch to side-by-side view
Loading...
/trunk/include/inline/codesets.h Diff Switch to side-by-side view
Loading...
/trunk/src/Makefile Diff Switch to side-by-side view
Loading...
/trunk/src/Makefile.dep Diff Switch to side-by-side view
Loading...
/trunk/src/base.h Diff Switch to side-by-side view
Loading...
/trunk/src/base64.c Diff Switch to side-by-side view
Loading...
/trunk/src/codesets.c Diff Switch to side-by-side view
Loading...
/trunk/src/convertUTF.c Diff Switch to side-by-side view
Loading...
/trunk/src/lib_protos.h Diff Switch to side-by-side view
Loading...
/trunk/src/libinit.c Diff Switch to side-by-side view
Loading...
/trunk/src/stubs-morphos.c Diff Switch to side-by-side view
Loading...
/trunk/src/stubs-amigaos4.c to /trunk/include/SDI_interrupt.h
--- a/trunk/src/stubs-amigaos4.c
+++ b/trunk/include/SDI_interrupt.h
@@ -1,371 +1,156 @@
-/***************************************************************************
+#ifndef SDI_INTERRUPT_H
+#define SDI_INTERRUPT_H
 
- codesets.library - Amiga shared library for handling different codesets
- Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
- Copyright (C) 2005-2014 codesets.library Open Source Team
+/* Includeheader
 
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+        Name:           SDI_interrupt.h
+        Versionstring:  $VER: SDI_interrupt.h 1.1 (25.04.2006)
+        Author:         Guido Mersmann
+        Distribution:   PD
+        Project page:   http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
+        Description:    defines to hide compiler specific interrupt and
+                        handler stuff
+        Id:             $Id: SDI_interrupt.h 294 2014-04-02 05:13:43Z thboeckel $
+        URL:            $URL: https://svn.code.sf.net/p/adtools/code/trunk/sdi/SDI_interrupt.h $
 
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- Lesser General Public License for more details.
+ 1.0   17.05.05 : inspired by the SDI_#?.h files made by Jens Langner
+                  and Dirk St�cker I created files to handle interrupt
+                  and handler functions in an API compatible way.
+ 1.1   25.04.06 : fixed MakeInterrupt() and MakeHandler() macro. (geit)
 
- codesets.library project: http://sourceforge.net/projects/codesetslib/
+*/
 
- $Id: stubs-amigaos4.c 291 2014-01-26 09:35:01Z damato $
+/*
+** This is PD (Public Domain). This means you can do with it whatever you want
+** without any restrictions. I only ask you to tell me improvements, so I may
+** fix the main line of this files as well.
+**
+** To keep confusion level low: When changing this file, please note it in
+** above history list and indicate that the change was not made by myself
+** (e.g. add your name or nick name).
+**
+** Find the latest version of this file at:
+** http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
+**
+** Guido Mersmann <geit@gmx.de>
+**
+*/
 
-***************************************************************************/
+#include "SDI_compiler.h"
 
-#include "lib.h"
-#include "SDI_stdarg.h"
+/*
+** The INTERRUPTPROTO macro is for creating interrupts functions and the
+** HANDLERPROTO macro is for handler type setup like used by the
+** input.device.
+**
+** The usage is simular to the DISPATCHERPROTO macro provided by SDI_hook.h.
+**
+** It gets the function name as argument. To supply this function for use by
+** an interrupt structure or handler argument, use the ENTRY macro, which also
+** gets the function name as argument. There is also a MakeInterrupt and a
+** MakeHandler macro for easy structure setup.
+**
+** Example:
+**
+** We create a handler function for the input.device.
+**
+** HANDLERPROTO( handlerfunc, ULONG, struct InputEvent *inputevent, APTR userdata)
+** {
+** ... Modify/parse input stream here
+** ...
+** return( (ULONG) inputevent );
+** }
+** MakeHandler( handlerstruct, handlerfunc, "TestHandler", &our_user_data);
+**
+** As you can see usage is as simple as using SDI hooks. To create interrupt
+** use INTERRUPTPROTO and MakeInterrupt. Internally both macros are identically.
+**
+** There are also functions to create more specific interrupt and handler
+** structures. By default type is NT_INTERRUPT and priority is 0.
+**
+** MakeHandlerType     - additional argument for type
+** MakeHandlerPri      - additional argument for pri
+** MakeHandlerTypePri  - additional arguments for type and pri
+**
+**
+** Notes: Since the interrupt structure is used for handlers and also foreign
+**        handlers are using this structure I keeped the arguments definition
+**        on the user side.
+**
+*/
 
-LIBSTUB(CodesetsEncodeB64A, ULONG, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsEncodeB64A(attrs);
-}
+#ifdef __MORPHOS__
 
-LIBSTUBVA(CodesetsEncodeB64, ULONG, ...)
-{
-  ULONG res;
-  VA_LIST args;
+#ifndef SDI_TRAP_LIB /* avoid defining this twice */
 
-  VA_START(args, self);
-  res = CodesetsEncodeB64A(VA_ARG(args, struct TagItem *));
-  VA_END(args);
+  #include <proto/alib.h>
+  #include <emul/emulregs.h>
 
-  return res;
-}
+  #define SDI_TRAP_LIB 0xFF00 /* SDI prefix to reduce conflicts */
 
-LIBSTUB(CodesetsDecodeB64A, ULONG, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsDecodeB64A(attrs);
-}
+  struct SDI_EmulLibEntry
+  {
+    UWORD Trap;
+    UWORD pad;
+    APTR  Func;
+  };
+#endif
 
-LIBSTUBVA(CodesetsDecodeB64, ULONG, ...)
-{
-  ULONG res;
-  VA_LIST args;
+  #define INTERRUPTPROTO(name, ret, obj, data)                               \
+    SAVEDS ASM ret name( obj, data);                                         \
+    static ret Trampoline_##name(void) {return name(( obj) REG_A0,           \
+    (data) REG_A1);}                                                         \
+    static const struct SDI_EmulLibEntry Gate_##name = {SDI_TRAP_LIB, 0,     \
+    (APTR) Trampoline_##name};                                               \
+    SAVEDS ASM ret name( obj, data)
 
-  VA_START(args, self);
-  res = CodesetsDecodeB64A(VA_ARG(args, struct TagItem *));
-  VA_END(args);
+  #define HANDLERPROTO(name, ret, obj, data)                                 \
+    SAVEDS ASM ret name( obj, data);                                         \
+    static ret Trampoline_##name(void) {return name(( obj) REG_A0,           \
+    (data) REG_A1);}                                                         \
+    static const struct SDI_EmulLibEntry Gate_##name = {SDI_TRAP_LIB, 0,     \
+    (APTR) Trampoline_##name};                                               \
+    SAVEDS ASM ret name( obj, data)
 
-  return res;
-}
+  #define ENTRY(func) (APTR)&Gate_##func
 
-LIBSTUB(CodesetsSupportedA, STRPTR*, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsSupportedA(attrs);
-}
+#else
 
-LIBSTUBVA(CodesetsSupported, STRPTR*, ...)
-{
-  STRPTR* res;
-  VA_LIST args;
+  #define INTERRUPTPROTO(name, ret, obj, data)                               \
+    SAVEDS ASM ret name(REG(a0, obj), REG(a1, data))
+  #define HANDLERPROTO(name, ret, obj, data)                                 \
+    SAVEDS ASM ret name(REG(a0, obj), REG(a1, data))
 
-  VA_START(args, self);
-  res = CodesetsSupportedA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
+  #define ENTRY(func) (APTR)func
 
-  return res;
-}
+#endif /* __MORPHOS__ */
 
-LIBSTUB(CodesetsFreeA, void, REG(a0, APTR obj), REG(a1, struct TagItem *attrs))
-{
-  return CodesetsFreeA(obj, attrs);
-}
+/* some structure creating macros for easy and more specific usage */
 
-LIBSTUBVA(CodesetsFree, void, REG(a0, APTR obj), ...)
-{
-  VA_LIST args;
+#define MakeInterrupt( name, func, title, isdata ) \
+  static struct Interrupt name = {{ NULL, NULL, NT_INTERRUPT, 0, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-  VA_START(args, obj);
-  CodesetsFreeA(obj, VA_ARG(args, struct TagItem *));
-  VA_END(args);
-}
+#define MakeInterruptPri( name, func, title, isdata, pri ) \
+  static struct Interrupt name = {{ NULL, NULL, NT_INTERRUPT, pri, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-LIBSTUB(CodesetsSetDefaultA, struct codeset *, REG(a0, STRPTR name), REG(a1, struct TagItem *attrs))
-{
-  return CodesetsSetDefaultA(name, attrs);
-}
+#define MakeInterruptType( name, func, title, isdata, type ) \
+  static struct Interrupt name = {{ NULL, NULL, type, 0, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-LIBSTUBVA(CodesetsSetDefault, struct codeset *, REG(a0, STRPTR name), ...)
-{
-  struct codeset *cs;
-  VA_LIST args;
+#define MakeInterruptTypePri( name, func, title, isdata, type, pri ) \
+  static struct Interrupt name = {{ NULL, NULL, type, pri, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-  VA_START(args, name);
-  cs = CodesetsSetDefaultA(name, VA_ARG(args, struct TagItem *));
-  VA_END(args);
+#define MakeHandler( name, func, title, isdata ) \
+  static struct Interrupt name = {{ NULL, NULL, NT_INTERRUPT, 0, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-  return cs;
-}
+#define MakeHandlerPri( name, func, title, isdata, pri ) \
+  static struct Interrupt name = {{ NULL, NULL, NT_INTERRUPT, pri, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-LIBSTUB(CodesetsFindA, struct codeset *, REG(a0, STRPTR name), REG(a1, struct TagItem *attrs))
-{
-  return CodesetsFindA(name, attrs);
-}
+#define MakeHandlerType( name, func, title, isdata, type ) \
+  static struct Interrupt name = {{ NULL, NULL, type, 0, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
-LIBSTUBVA(CodesetsFind, struct codeset *, REG(a0, STRPTR name), ...)
-{
-  struct codeset *cs;
-  VA_LIST args;
-
-  VA_START(args, name);
-  cs = CodesetsFindA(name, VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return cs;
-}
-
-LIBSTUB(CodesetsFindBestA, struct codeset *, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsFindBestA(attrs);
-}
-
-LIBSTUBVA(CodesetsFindBest, struct codeset *, ...)
-{
-  struct codeset *cs;
-  VA_LIST args;
-
-  VA_START(args, self);
-  cs = CodesetsFindBestA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return cs;
-}
-
-LIBSTUB(CodesetsUTF8Len, ULONG, REG(a0, UTF8 *str))
-{
-  return CodesetsUTF8Len(str);
-}
-
-LIBSTUB(CodesetsStrLenA, ULONG, REG(a0, STRPTR str),
-                                REG(a1, struct TagItem *attrs))
-{
-  return CodesetsStrLenA(str, attrs);
-}
-
-LIBSTUBVA(CodesetsStrLen, ULONG, REG(a0, STRPTR str), ...)
-{
-  ULONG res;
-  VA_LIST args;
-
-  VA_START(args, str);
-  res = CodesetsStrLenA(str, VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return res;
-}
-
-LIBSTUB(CodesetsUTF8ToStrA, STRPTR, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsUTF8ToStrA(attrs);
-}
-
-LIBSTUBVA(CodesetsUTF8ToStr, STRPTR, ...)
-{
-  STRPTR res;
-  VA_LIST args;
-
-  VA_START(args, self);
-  res = CodesetsUTF8ToStrA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return res;
-}
-
-LIBSTUB(CodesetsUTF8CreateA, UTF8*, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsUTF8CreateA(attrs);
-}
-
-LIBSTUBVA(CodesetsUTF8Create, UTF8*, ...)
-{
-  UTF8 *res;
-  VA_LIST args;
-
-  VA_START(args, self);
-  res = CodesetsUTF8CreateA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return res;
-}
-
-LIBSTUB(CodesetsIsValidUTF8, BOOL, REG(a0, STRPTR s))
-{
-  return CodesetsIsValidUTF8(s);
-}
-
-LIBSTUB(CodesetsConvertStrA, STRPTR, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsConvertStrA(attrs);
-}
-
-LIBSTUBVA(CodesetsConvertStr, STRPTR, ...)
-{
-  STRPTR res;
-  VA_LIST args;
-
-  VA_START(args, self);
-  res = CodesetsConvertStrA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return res;
-}
-
-LIBSTUB(CodesetsFreeVecPooledA, void, REG(a0, APTR pool),
-                                      REG(a1, APTR mem),
-                                      REG(a2, struct TagItem *attrs))
-{
-  return CodesetsFreeVecPooledA(pool, mem, attrs);
-}
-
-LIBSTUBVA(CodesetsFreeVecPooled, void, REG(a0, APTR pool),
-                                       REG(a1, APTR mem), ...)
-{
-  VA_LIST args;
-
-  VA_START(args, mem);
-  CodesetsFreeVecPooledA(pool, mem, VA_ARG(args, struct TagItem *));
-  VA_END(args);
-}
-
-LIBSTUB(CodesetsListCreateA, struct codesetList *, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsListCreateA(attrs);
-}
-
-LIBSTUBVA(CodesetsListCreate, struct codesetList *, ...)
-{
-  struct codesetList *res;
-  VA_LIST args;
-
-  VA_START(args, self);
-  res = CodesetsListCreateA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return res;
-}
-
-LIBSTUB(CodesetsListDeleteA, BOOL, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsListDeleteA(attrs);
-}
-
-LIBSTUBVA(CodesetsListDelete, BOOL, ...)
-{
-  BOOL result;
-  VA_LIST args;
-
-  VA_START(args, self);
-  result = CodesetsListDeleteA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return result;
-}
-
-LIBSTUB(CodesetsListAddA, BOOL, REG(a0, struct codesetList *csList), REG(a1, struct TagItem *attrs))
-{
-  return CodesetsListAddA(csList, attrs);
-}
-
-LIBSTUBVA(CodesetsListAdd, BOOL, struct codesetList *csList, ...)
-{
-  BOOL result;
-  VA_LIST args;
-
-  VA_START(args, csList);
-  result = CodesetsListAddA(csList, VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return result;
-}
-
-LIBSTUB(CodesetsListRemoveA, BOOL, REG(a0, struct TagItem *attrs))
-{
-  return CodesetsListRemoveA(attrs);
-}
-
-LIBSTUBVA(CodesetsListRemove, BOOL, ...)
-{
-  BOOL result;
-  VA_LIST args;
-
-  VA_START(args, self);
-  result = CodesetsListRemoveA(VA_ARG(args, struct TagItem *));
-  VA_END(args);
-
-  return result;
-}
-
-LIBSTUB(CodesetsConvertUTF32toUTF16, ULONG, REG(a0, const UTF32 ** sourceStart),
-                                            REG(a1, const UTF32 * sourceEnd),
-                                            REG(a2, UTF16 ** targetStart),
-                                            REG(a3, UTF16 * targetEnd),
-                                            REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF32toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}
+#define MakeHandlerTypePri( name, func, title, isdata, type, pri ) \
+  static struct Interrupt name = {{ NULL, NULL, type, pri, (STRPTR) title}, (APTR) isdata, (void (*)()) ENTRY(func) }
 
 
-LIBSTUB(CodesetsConvertUTF16toUTF32, ULONG, REG(a0, const UTF16 ** sourceStart),
-                                            REG(a1, const UTF16 * sourceEnd),
-                                            REG(a2, UTF32 ** targetStart),
-                                            REG(a3, UTF32 * targetEnd),
-                                            REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF16toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}
+#endif /* SDI_INTERRUPT_H */
 
-LIBSTUB(CodesetsConvertUTF16toUTF8, ULONG, REG(a0, const UTF16 ** sourceStart),
-                                           REG(a1, const UTF16 * sourceEnd),
-                                           REG(a2, UTF8 ** targetStart),
-                                           REG(a3, UTF8 * targetEnd),
-                                           REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF16toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}
-
-LIBSTUB(CodesetsIsLegalUTF8, BOOL, REG(a0, const UTF8 * source),
-                                   REG(d0, ULONG length))
-{
-  return CodesetsIsLegalUTF8(source, length);
-}
-
-LIBSTUB(CodesetsIsLegalUTF8Sequence, BOOL, REG(a0, const UTF8 * source),
-                                            REG(a1, const UTF8 * sourceEnd))
-{
-  return CodesetsIsLegalUTF8Sequence(source, sourceEnd);
-}
-
-LIBSTUB(CodesetsConvertUTF8toUTF16, ULONG, REG(a0, const UTF8 ** sourceStart),
-                                           REG(a1, const UTF8 * sourceEnd),
-                                           REG(a2, UTF16 ** targetStart),
-                                           REG(a3, UTF16 * targetEnd),
-                                           REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF8toUTF16(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}
-
-LIBSTUB(CodesetsConvertUTF32toUTF8, ULONG, REG(a0, const UTF32 ** sourceStart),
-                                           REG(a1, const UTF32 * sourceEnd),
-                                           REG(a2, UTF8 ** targetStart),
-                                           REG(a3, UTF8 * targetEnd),
-                                           REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF32toUTF8(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}
-
-LIBSTUB(CodesetsConvertUTF8toUTF32, ULONG, REG(a0, const UTF8 ** sourceStart),
-                                           REG(a1, const UTF8 * sourceEnd),
-                                           REG(a2, UTF32 ** targetStart),
-                                           REG(a3, UTF32 * targetEnd),
-                                           REG(d0, ULONG flags))
-{
-  return CodesetsConvertUTF8toUTF32(sourceStart, sourceEnd, targetStart, targetEnd, flags);
-}