revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / datatypes / picture / libfunc.c
blobc3468695c75c67b3e8d8367ec6c0e34b551f8972
1 /**********************************************************************
2 text.datatype - (c) 2000 by Sebastian Bauer
4 This module is the library initializion module for the
5 datatype.
6 It must be compiled with sc's libcode option
7 ***********************************************************************/
9 /*
10 * picture.datatype - a rippoff
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
16 #include "compilerspecific.h"
17 #include "debug.h"
20 struct IClass *dt_class;
22 struct ExecBase *SysBase;
23 struct IntuitionBase *IntuitionBase;
24 struct GfxBase *GfxBase;
25 #ifdef __AROS__
26 struct UtilityBase *UtilityBase;
27 #else
28 struct Library *UtilityBase;
29 #endif
30 struct DosLibrary *DOSBase;
31 struct Library *LayersBase;
32 struct Library *DiskfontBase;
33 struct Library *DataTypesBase;
34 struct Library *IFFParseBase;
35 struct Library *CyberGfxBase;
37 /* inside pictureclass.c */
38 struct IClass *DT_MakeClass(struct Library *picturebase);
40 #ifdef __AROS__
41 #undef register
42 #define register
44 #undef __a6
45 #define __a6
46 #endif
48 /**************************************************************************************************/
50 ASM SAVEDS int __UserLibInit( register __a6 struct Library *libbase )
52 #ifndef __AROS__
53 SysBase = *(struct ExecBase**)4;
54 #endif
56 D(bug("picture.datatype/__UserLibInit\n"));
58 if((LayersBase = OpenLibrary("layers.library", 39)))
60 if((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 39)))
62 if((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 39)))
64 if((DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 39)))
66 if((DiskfontBase = OpenLibrary("diskfont.library", 37)))
68 #ifdef __AROS__
69 if((UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37)))
70 #else
71 if((UtilityBase = (struct Library *)OpenLibrary("utility.library", 37)))
72 #endif
74 if((DataTypesBase = OpenLibrary("datatypes.library", 37)))
76 if((IFFParseBase = OpenLibrary("iffparse.library", 37)))
78 if((CyberGfxBase = OpenLibrary("cybergraphics.library", 37)))
80 if((dt_class = DT_MakeClass(libbase)))
82 AddClass(dt_class);
84 D(bug("picture.datatype/__UserLibInit: Returning success\n"));
86 return 0;
98 D(bug("picture.datatype/__UserLibInit: Returning failure\n"));
100 return -1;
103 /**************************************************************************************************/
105 ASM SAVEDS void __UserLibCleanup( register __a6 struct Library *libbase )
107 D(bug("picture.datatype/__UserLibCleanup\n"));
109 D(bug("picture.datatype/__UserLibCleanup: Freeing class\n"));
111 if(dt_class)
113 RemoveClass(dt_class);
114 FreeClass(dt_class);
115 dt_class = NULL;
118 D(bug("picture.datatype/__UserLibCleanup: Closing Libraries\n"));
120 if(CyberGfxBase) CloseLibrary(CyberGfxBase);
121 if(IFFParseBase) CloseLibrary(IFFParseBase);
122 if(DataTypesBase) CloseLibrary(DataTypesBase);
123 if(UtilityBase) CloseLibrary((struct Library *)UtilityBase);
124 if(DiskfontBase) CloseLibrary(DiskfontBase);
125 if(DOSBase) CloseLibrary((struct Library *)DOSBase);
126 if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
127 if(GfxBase) CloseLibrary((struct Library *)GfxBase);
128 if(LayersBase) CloseLibrary(LayersBase);
130 D(bug("picture.datatype/__UserLibCleanup: Done\n"));
133 /**************************************************************************************************/
135 SAVEDS STDARGS struct IClass *ObtainEngine(void)
137 D(bug("picture.datatype/ObtainEngine: returning %x\n", dt_class));
139 return dt_class;
142 /**************************************************************************************************/