diff --git a/library/skeleton_library/GNUmakefile.os4 b/library/skeleton_library/GNUmakefile.os4 index 88cb94c..0f5dbba 100755 --- a/library/skeleton_library/GNUmakefile.os4 +++ b/library/skeleton_library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.1 2005-07-04 10:25:33 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.2 2005-07-04 11:06:20 obarthel Exp $ # # :ts=4 # @@ -43,12 +43,12 @@ DEBUG = -ggdb ############################################################################### -CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(CPU) $(OPTIONS) -I. -I/V/include +CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(CPU) $(OPTIONS) -I/V/include -I. -Iinclude ############################################################################### OBJS = \ - lib_base.o lib_user.o usergroup_68k.o + lib_base.o lib_user.o skeleton_68k.o ############################################################################### @@ -56,7 +56,9 @@ LIBS = -lc -lamiga ############################################################################### -all: skeleton.library +all: skeleton_68k.c skeleton.library + +############################################################################### skeleton.library: $(OBJS) $(CC) -o $@.debug $(OBJS) $(CFLAGS) -Wl,--cref,-M,-Map=$@.map \ @@ -65,5 +67,12 @@ skeleton.library: $(OBJS) ############################################################################### +# This will rebuild the library header files and stub code when necessary +skeleton_68k.c : skeleton_lib.sfd skeleton.xml + idltool --proto --interface --inline skeleton.xml + fdtrans --c68k skeleton_lib.sfd + +############################################################################### + clean: -rm -f *.o *.debug *.map skeleton.library diff --git a/library/skeleton_library/include/inline4/skeleton.h b/library/skeleton_library/include/inline4/skeleton.h new file mode 100644 index 0000000..59de76a --- /dev/null +++ b/library/skeleton_library/include/inline4/skeleton.h @@ -0,0 +1,26 @@ +#ifndef INLINE4_SKELETON_H +#define INLINE4_SKELETON_H + +/* +** This file was auto generated by idltool 51.6. +** +** It provides compatibility to OS3 style library +** calls by substituting functions. +** +** Do not edit manually. +*/ + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + + +/* Inline macros for Interface "main" */ + +#endif /* INLINE4_SKELETON_H */ diff --git a/library/skeleton_library/include/interfaces/skeleton.h b/library/skeleton_library/include/interfaces/skeleton.h new file mode 100644 index 0000000..aef5ec9 --- /dev/null +++ b/library/skeleton_library/include/interfaces/skeleton.h @@ -0,0 +1,30 @@ +#ifndef SKELETON_INTERFACE_DEF_H +#define SKELETON_INTERFACE_DEF_H + +/* +** This file was machine generated by idltool 51.6. +** Do not edit +*/ + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + + +struct SkeletonIFace +{ + struct InterfaceData Data; + + ULONG APICALL (*Obtain)(struct SkeletonIFace *Self); + ULONG APICALL (*Release)(struct SkeletonIFace *Self); + void APICALL (*Expunge)(struct SkeletonIFace *Self); + struct Interface * APICALL (*Clone)(struct SkeletonIFace *Self); +}; + +#endif /* SKELETON_INTERFACE_DEF_H */ diff --git a/library/skeleton_library/include/proto/skeleton.h b/library/skeleton_library/include/proto/skeleton.h new file mode 100755 index 0000000..d9f9922 --- /dev/null +++ b/library/skeleton_library/include/proto/skeleton.h @@ -0,0 +1,83 @@ +#ifndef PROTO_SKELETON_H +#define PROTO_SKELETON_H + +/* +** $Id: skeleton.h,v 1.1 2005-07-04 11:06:23 obarthel Exp $ +** +** Prototype/inline/pragma header file combo +** Copyright (c) 2002-2005 by Olaf Barthel +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** - Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** +** - Neither the name of Olaf Barthel nor the names of contributors +** may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef EXEC_TYPES_H +#include +#endif + +/****************************************************************************/ + +#ifndef __NOLIBBASE__ + #ifndef __USE_BASETYPE__ + extern struct Library * SkeletonBase; + #else + extern struct Library * SkeletonBase; + #endif /* __USE_BASETYPE__ */ +#endif /* __NOLIBBASE__ */ + +/****************************************************************************/ + +#ifdef __amigaos4__ + #include + #ifdef __USE_INLINE__ + #include + #endif /* __USE_INLINE__ */ + #ifndef CLIB_SKELETON_PROTOS_H + #define CLIB_SKELETON_PROTOS_H 1 + #endif /* CLIB_SKELETON_PROTOS_H */ + #ifndef __NOGLOBALIFACE__ + extern struct SkeletonIFace *ISkeleton; + #endif /* __NOGLOBALIFACE__ */ +#else /* __amigaos4__ */ + #ifndef CLIB_SKELETON_PROTOS_H + #include + #endif /* CLIB_SKELETON_PROTOS_H */ + #if defined(__GNUC__) + #ifndef __PPC__ + #include + #else + #include + #endif /* __PPC__ */ + #elif defined(__VBCC__) + #ifndef __PPC__ + #include + #endif /* __PPC__ */ + #else + #include + #endif /* __GNUC__ */ +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#endif /* PROTO_SKELETON_H */ diff --git a/library/skeleton_library/lib_base.c b/library/skeleton_library/lib_base.c index 6f2d229..b624269 100755 --- a/library/skeleton_library/lib_base.c +++ b/library/skeleton_library/lib_base.c @@ -1,5 +1,5 @@ /* - * $Id: lib_base.c,v 1.2 2005-07-04 10:25:33 obarthel Exp $ + * $Id: lib_base.c,v 1.3 2005-07-04 11:06:21 obarthel Exp $ * * :ts=4 * @@ -41,9 +41,17 @@ /****************************************************************************/ #define __NOLIBBASE__ +#define __NOGLOBALIFACE__ #define __USE_INLINE__ + +/****************************************************************************/ + #include +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + /****************************************************************************/ #include "lib_base.h" @@ -166,7 +174,7 @@ lib_init( goto out; /* Now try the user-supplied library initialization function. */ - if(UserLibInit(SysBase,sb->sb_UserData) == FALSE) + if(UserLibInit(SysBase,sb,sb->sb_UserData) == FALSE) goto out; result = sb; @@ -456,11 +464,11 @@ STATIC CONST UBYTE version_string[] = "$VER: " VSTRING; /****************************************************************************/ -CONST struct Resident LibTag[] = +CONST struct Resident LibTag = { RTC_MATCHWORD, - (struct Resident *)&LibTag[0], - (struct Resident *)&LibTag[1], + (struct Resident *)&LibTag, + (struct Resident *)&LibTag+1, RTF_AUTOINIT|RTF_NATIVE, VERSION, NT_LIBRARY, @@ -529,11 +537,11 @@ STATIC CONST struct LibraryInitTable lib_init_table = /* The library loader looks for this marker in the memory the library code and data will occupy. It is responsible setting up the Library base data structure. */ -struct Resident LibTag[] = +struct Resident LibTag = { RTC_MATCHWORD, /* Marker value. */ - (struct Resident *)&LibTag[0], /* This points back to itself. */ - (struct Resident *)&LibTag[1], /* This points behind this marker. */ + (struct Resident *)&LibTag, /* This points back to itself. */ + (struct Resident *)&LibTag+1, /* This points behind this marker. */ RTF_AUTOINIT, /* The Library should be set up according to the given table. */ VERSION, /* The version of this Library. */ NT_LIBRARY, /* This defines this module as a Library. */ diff --git a/library/skeleton_library/lib_user.c b/library/skeleton_library/lib_user.c index 0485c36..5dc66dd 100755 --- a/library/skeleton_library/lib_user.c +++ b/library/skeleton_library/lib_user.c @@ -1,5 +1,5 @@ /* - * $Id: lib_user.c,v 1.2 2005-07-04 10:25:33 obarthel Exp $ + * $Id: lib_user.c,v 1.3 2005-07-04 11:06:21 obarthel Exp $ * * :ts=4 * @@ -46,7 +46,10 @@ By the time this function is invoked the library base has already been initialized. It has to return TRUE for success and FALSE otherwise. */ BOOL -UserLibInit(struct Library * SysBase,struct UserData * ud) +UserLibInit( + struct Library * SysBase, + struct SkeletonBase * sb, + struct UserData * ud) { BOOL result; @@ -65,6 +68,12 @@ UserLibInit(struct Library * SysBase,struct UserData * ud) } #endif /* __amigaos4__ */ + /* The library base pointer may come in handy if library + functions are to call other library functions. These + calls should go through the normal library calling + mechanism rather than invoke these functions directly. */ + ud->ud_SkeletonBase = sb; + result = TRUE; return(result); diff --git a/library/skeleton_library/lib_user.h b/library/skeleton_library/lib_user.h index 2285234..1359621 100755 --- a/library/skeleton_library/lib_user.h +++ b/library/skeleton_library/lib_user.h @@ -1,5 +1,5 @@ /* - * $Id: lib_user.h,v 1.2 2005-07-04 10:25:33 obarthel Exp $ + * $Id: lib_user.h,v 1.3 2005-07-04 11:06:21 obarthel Exp $ * * :ts=4 * @@ -46,20 +46,26 @@ /****************************************************************************/ +struct SkeletonBase; + +/****************************************************************************/ + struct UserData { - struct Library * ud_SysBase; + struct Library * ud_SysBase; #if defined(__amigaos4__) - struct ExecIFace * ud_IExec; + struct ExecIFace * ud_IExec; #endif /* __amigaos4__ */ - ULONG ud_UseCount; + struct SkeletonBase * ud_SkeletonBase; + + ULONG ud_UseCount; }; /****************************************************************************/ -BOOL UserLibInit(struct Library *SysBase,struct UserData *ud); +BOOL UserLibInit(struct Library *SysBase,struct SkeletonBase *sb,struct UserData *ud); BOOL UserLibOpen(struct UserData *ud); VOID UserLibClose(struct UserData *ud); VOID UserLibExpunge(struct UserData *ud); diff --git a/library/skeleton_library/skeleton.xml b/library/skeleton_library/skeleton.xml index d3835a1..363a259 100644 --- a/library/skeleton_library/skeleton.xml +++ b/library/skeleton_library/skeleton.xml @@ -1,5 +1,6 @@ + exec/types.h diff --git a/library/skeleton_library/skeleton_68k.c b/library/skeleton_library/skeleton_68k.c new file mode 100644 index 0000000..4661312 --- /dev/null +++ b/library/skeleton_library/skeleton_68k.c @@ -0,0 +1,65 @@ +/* +** This file was automatically generated by fdtrans 51.16. +** Do not edit it by hand. Instead, edit the sfd file +** that was used to generate this file +*/ + +#ifdef __USE_INLINE__ +#undef __USE_INLINE__ +#endif +#ifndef __NOGLOBALIFACE__ +#define __NOGLOBALIFACE__ +#endif + +#include +#include +#include +#include +#include +#include + + +static inline int8 convert_int8 (uint32 x) { return x; } +static inline int16 convert_int16(uint32 x) { return x; } + + +STATIC struct Library * stub_OpenPPC(ULONG *regarray) +{ + struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; + struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); + struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; + + return Self->Open(0); +} +STATIC CONST struct EmuTrap stub_Open = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_OpenPPC }; + +STATIC APTR stub_ClosePPC(ULONG *regarray) +{ + struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; + struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); + struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; + + return Self->Close(); +} +STATIC CONST struct EmuTrap stub_Close = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_ClosePPC }; + +STATIC APTR stub_ExpungePPC(ULONG *regarray __attribute__((unused))) +{ + return NULL; +} +STATIC CONST struct EmuTrap stub_Expunge = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_ExpungePPC }; + +STATIC ULONG stub_ReservedPPC(ULONG *regarray __attribute__((unused))) +{ + return 0UL; +} +STATIC CONST struct EmuTrap stub_Reserved = { TRAPINST, TRAPTYPE, stub_ReservedPPC }; + +CONST CONST_APTR VecTable68K[] = +{ + &stub_Open, + &stub_Close, + &stub_Expunge, + &stub_Reserved, + (CONST_APTR)-1 +};