1 /**********************************************************************
2 text.datatype - (c) 2000 by Sebastian Bauer
4 This module is the library initializion module for the
6 It must be compiled with sc's libcode option
7 ***********************************************************************/
9 #include <proto/exec.h>
10 #include <proto/intuition.h>
11 #include "compilerspecific.h"
12 #if defined(__AROS__) && !defined(__MORPHOS__)
13 #include LC_LIBDEFS_FILE
18 #warning "All this global stuff sucks and should be removed"
19 struct ExecBase
*SysBase
;
20 struct IntuitionBase
*IntuitionBase
;
21 struct GfxBase
*GfxBase
;
24 struct Library
*UtilityBase
;
26 struct UtilityBase
*UtilityBase
;
29 struct Library
*UtilityBase
;
31 struct DosLibrary
*DOSBase
;
32 struct Library
*LayersBase
;
33 struct Library
*DiskfontBase
;
34 struct Library
*DataTypesBase
;
35 struct Library
*IFFParseBase
;
37 /* inside textclass.c */
38 struct IClass
*DT_MakeClass(LIBBASETYPEPTR
);
50 /**************************************************************************************************/
53 int __UserLibInit(LIBBASETYPEPTR LIBBASE
)
55 ASM SAVEDS
int __UserLibInit( register __a6 LIBBASETYPEPTR LIBBASE
)
59 SysBase
= LIBBASE
->sysbase
;
61 if((LayersBase
= OpenLibrary("layers.library", 39)))
63 if((GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 39)))
65 if((IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 39)))
67 if((DOSBase
= (struct DosLibrary
*)OpenLibrary("dos.library", 39)))
69 if((DiskfontBase
= OpenLibrary("diskfont.library", 37)))
73 if((UtilityBase
= (struct Library
*)OpenLibrary("utility.library", 37)))
75 if((UtilityBase
= (struct UtilityBase
*)OpenLibrary("utility.library", 37)))
78 if((UtilityBase
= (struct Library
*)OpenLibrary("utility.library", 37)))
81 if((DataTypesBase
= OpenLibrary("datatypes.library", 37)))
83 if((IFFParseBase
= OpenLibrary("iffparse.library", 37)))
85 if((LIBBASE
->class = DT_MakeClass(LIBBASE
)))
87 AddClass(LIBBASE
->class);
103 /**************************************************************************************************/
106 void __UserLibCleanup(LIBBASETYPEPTR LIBBASE
)
108 ASM SAVEDS
void __UserLibCleanup( register __a6 LIBBASETYPEPTR LIBBASE
)
113 RemoveClass(LIBBASE
->class);
114 FreeClass(LIBBASE
->class);
115 LIBBASE
->class = NULL
;
118 if(IFFParseBase
) CloseLibrary(IFFParseBase
);
119 if(DataTypesBase
) CloseLibrary(DataTypesBase
);
120 if(UtilityBase
) CloseLibrary((struct Library
*)UtilityBase
);
121 if(DiskfontBase
) CloseLibrary(DiskfontBase
);
122 if(DOSBase
) CloseLibrary((struct Library
*)DOSBase
);
123 if(IntuitionBase
) CloseLibrary((struct Library
*)IntuitionBase
);
124 if(GfxBase
) CloseLibrary((struct Library
*)GfxBase
);
125 if(LayersBase
) CloseLibrary(LayersBase
);
128 /**************************************************************************************************/
130 SAVEDS STDARGS
struct IClass
*ObtainEngine(LIBBASETYPEPTR LIBBASE
)
132 return (LIBBASE
->class);
135 /**************************************************************************************************/