home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: LibInit.c 37.11 (24.6.97)
- **
- ** Library initializers and functions to be called by StartUp.c
- **
- ** (C) Copyright 1996-97 Andreas R. Kleinert
- ** All Rights Reserved.
- */
-
- #define __USE_SYSBASE
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <exec/libraries.h>
- #include <exec/execbase.h>
- #include <exec/resident.h>
- #include <exec/initializers.h>
- #include <proto/exec.h>
-
- #include "/include/libraries/imagebase.h"
-
- ULONG __saveds __stdargs StartLib(void);
- void __saveds __stdargs EndLib(void);
-
- extern struct ImageBase *ImageBase;
- struct ExecBase *SysBase = NULL;
- struct Library *UtilityBase = NULL;
- struct GfxBase *GfxBase = NULL;
-
- #define VERSION 40
- #define REVISION 0
-
- char __aligned ExLibName [] = "image.library";
-
- #ifdef _M68060
- #define __CPU "68060"
- #else
- #ifdef _M68040
- #define __CPU "68040"
- #else
- #ifdef _M68030
- #define __CPU "68030"
- #else
- #ifdef _M68020
- #define __CPU "68020"
- #else
- #ifdef _M68010
- #define __CPU "68010"
- #else
- #define __CPU "68000"
- #endif
- #endif
- #endif
- #endif
- #endif
-
- char __aligned ExLibID [] = "image.library 40.00 - "__CPU" ("__AMIGADATE__" "__TIME__")";
-
-
- char __aligned Copyright [] = "© 1993-99 Paweî Marciniak";
-
- extern ULONG InitTab[];
-
- extern APTR EndResident;
-
- struct Resident __aligned ROMTag =
- {
- RTC_MATCHWORD,
- &ROMTag,
- &EndResident,
- RTF_AUTOINIT,
- VERSION,
- NT_LIBRARY,
- 0,
- &ExLibName[0],
- &ExLibID[0],
- &InitTab[0]
- };
-
- APTR EndResident;
-
- struct MyDataInit
- {
- UWORD ln_Type_Init;
- UWORD ln_Type_Offset;
- UWORD ln_Type_Content;
- UBYTE ln_Name_Init;
- UBYTE ln_Name_Offset;
- ULONG ln_Name_Content;
- UWORD lib_Flags_Init;
- UWORD lib_Flags_Offset;
- UWORD lib_Flags_Content;
- UWORD lib_Version_Init;
- UWORD lib_Version_Offset;
- UWORD lib_Version_Content;
- UWORD lib_Revision_Init;
- UWORD lib_Revision_Offset;
- UWORD lib_Revision_Content;
- UBYTE lib_IdString_Init;
- UBYTE lib_IdString_Offset;
- ULONG lib_IdString_Content;
- ULONG ENDMARK;
- } DataTab =
- {
- INITBYTE(OFFSET(Node, ln_Type), NT_LIBRARY),
- 0x80, (UBYTE) OFFSET(Node, ln_Name), (ULONG) &ExLibName[0],
- INITBYTE(OFFSET(Library, lib_Flags), LIBF_SUMUSED|LIBF_CHANGED),
- INITWORD(OFFSET(Library, lib_Version), VERSION),
- INITWORD(OFFSET(Library, lib_Revision), REVISION),
- 0x80, (UBYTE) OFFSET(Library, lib_IdString), (ULONG) &ExLibID[0],
- (ULONG) 0
- };
-
- ULONG __saveds __stdargs StartLib(void)
- {
- SysBase = (*((struct ExecBase **) 4));
-
- UtilityBase = OpenLibrary("utility.library", 37);
- if(!UtilityBase) return(FALSE);
-
- GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 39);
- if(!GfxBase) return(FALSE);
-
-
- ImageBase->ib_SysBase = SysBase;
-
- ImageBase->ib_UtilityBase = UtilityBase;
- ImageBase->ib_GfxBase = GfxBase;
-
- return(TRUE);
- }
-
- void __saveds __stdargs EndLib(void)
- {
- if(GfxBase) CloseLibrary((struct Library *) GfxBase);
- if(UtilityBase) CloseLibrary((struct Library *) UtilityBase);
- }
-