Import the current wip animation datatype and subclasses. further development will...
[AROS.git] / workbench / classes / datatypes / text / libfunc.c
blobb53ed828f539dadd00e1ed7a1f1d6bf38b2403bd
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 #include <proto/exec.h>
10 #include <proto/intuition.h>
11 #include "compilerspecific.h"
12 #if defined(__AROS__) && !defined(__MORPHOS__)
13 #include LC_LIBDEFS_FILE
14 #else
15 #include "libdefs.h"
16 #endif
18 #warning "All this global stuff sucks and should be removed"
19 struct ExecBase *SysBase;
20 struct IntuitionBase *IntuitionBase;
21 struct GfxBase *GfxBase;
22 #ifdef __AROS__
23 #ifdef __MORPHOS__
24 struct Library *UtilityBase;
25 #else
26 struct UtilityBase *UtilityBase;
27 #endif
28 #else
29 struct Library *UtilityBase;
30 #endif
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);
40 #ifdef __AROS__
41 #undef register
42 #define register
44 #undef __a6
45 #define __a6
46 #endif
48 #undef SysBase
50 /**************************************************************************************************/
52 #ifdef __MORPHOS__
53 int __UserLibInit(LIBBASETYPEPTR LIBBASE )
54 #else
55 ASM SAVEDS int __UserLibInit( register __a6 LIBBASETYPEPTR LIBBASE )
56 #endif
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)))
71 #ifdef __AROS__
72 #ifdef __MORPHOS__
73 if((UtilityBase = (struct Library *)OpenLibrary("utility.library", 37)))
74 #else
75 if((UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37)))
76 #endif
77 #else
78 if((UtilityBase = (struct Library *)OpenLibrary("utility.library", 37)))
79 #endif
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);
89 return 0;
100 return -1;
103 /**************************************************************************************************/
105 #ifdef __MORPHOS__
106 void __UserLibCleanup(LIBBASETYPEPTR LIBBASE )
107 #else
108 ASM SAVEDS void __UserLibCleanup( register __a6 LIBBASETYPEPTR LIBBASE )
109 #endif
111 if(LIBBASE->class)
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 /**************************************************************************************************/