home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $PROJECT: midi.datatype
- **
- ** $VER: libinit.c 40.0 (11.09.97)
- **
- ** Copyright 1997 by Martin Gierich.
- **
- ** Library initializers and functions to be called by StartUp.c
- **
- ** Based on Datatype in 100% C created by Andreas R. Kleinert.
- ** Adapted by Martin Gierich.
- ** All Rights Reserved !
- **
- ** $HISTORY:
- ** 11.09.97 : 40.00 : Initial BETA release
- **
- ** $TABSIZE: 8
- */
-
-
- #define __USE_SYSBASE
-
- #include <exec/types.h>
- #include <exec/libraries.h>
- #include <exec/resident.h>
- #include <exec/initializers.h>
-
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/datatypes.h>
-
- #include "register.h"
-
- Class *initClass ( struct ClassBase *cb );
-
-
- extern struct ClassBase *ClassBase;
-
- struct ExecBase *SysBase = NULL;
- struct DosLibrary *DOSBase = NULL;
- struct IntuitionBase *IntuitionBase = NULL;
- struct GfxBase *GfxBase = NULL;
- struct Library *UtilityBase = NULL;
- struct Library *IFFParseBase = NULL;
- struct Library *GadToolsBase = NULL;
- struct Library *DataTypesBase = NULL;
-
-
- #define VERSION 40
- #define REVISION 0
-
- char __aligned ExLibName [] = "midi.datatype";
- char __aligned ExLibID [] = "midi.datatype 40.0 (11.9.97)";
- char __aligned Copyright [] = "Copyright 1997 Martin Gierich";
-
- extern ULONG InitTab[];
-
- extern APTR EndResident; /* below */
-
- struct Resident __aligned ROMTag =
- {
- RTC_MATCHWORD,
- &ROMTag,
- &EndResident,
- RTF_AUTOINIT,
- VERSION,
- NT_LIBRARY,
- 0,
- &ExLibName[0],
- &ExLibID[0],
- &InitTab[0]
- };
-
- APTR EndResident;
-
- struct MyDataInit /* do not change */
- {
- 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
- };
-
- /* Libraries not shareable between Processes or libraries messing
- with RamLib (deadlock and crash) may not be opened here - open/close
- these later locally and or maybe close them fromout L_CloseLibs()
- when expunging !
- */
-
- ULONG __saveds __stdargs L_OpenLibs(void)
- {
- SysBase = (*((struct ExecBase **) 4));
-
- if( !(DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 39)) ) return(FALSE);
- if( !(IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 39)) ) return(FALSE);
- if( !(GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 39)) ) return(FALSE);
- if( !(UtilityBase = OpenLibrary("utility.library", 39)) ) return(FALSE);
- if( !(IFFParseBase = OpenLibrary("iffparse.library", 37)) ) return(FALSE);
- if( !(GadToolsBase = OpenLibrary("gadtools.library", 39)) ) return(FALSE);
- if( !(DataTypesBase = OpenLibrary("datatypes.library", 39)) ) return(FALSE);
- if(ClassBase->cb_Class = initClass(ClassBase)) return(TRUE);
-
- return(FALSE);
- }
-
- void __saveds __stdargs L_CloseLibs(void)
- {
- if(ClassBase->cb_Class) FreeClass(ClassBase->cb_Class);
-
- if(DataTypesBase) CloseLibrary(DataTypesBase);
- if(GadToolsBase) CloseLibrary(GadToolsBase);
- if(IFFParseBase) CloseLibrary(IFFParseBase);
- if(UtilityBase) CloseLibrary(UtilityBase);
- if(GfxBase) CloseLibrary((struct Library *)GfxBase);
- if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
- if(DOSBase) CloseLibrary((struct Library *)DOSBase);
- }
-
-
- Class * __saveds __asm ObtainMidiEngine ( register __a6 struct ClassBase *cb)
- {
- return (cb->cb_Class);
- }
-