Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / .unmaintained / m68k-pp-native / Drivers / graphics / graphics_init.c
blob84d658060eed13df9aba86f6e09eaefb73f02c94
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics hidd initialization code.
6 Lang: English.
7 */
8 //#include <stddef.h>
9 #include <exec/types.h>
10 #include <exec/lists.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
13 #include <oop/oop.h>
14 #include <utility/utility.h>
16 #include "graphics_intern.h"
19 #undef SysBase
21 /* Customize libheader.c */
22 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR )(lib))->hdg_SysBase)
23 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR )(lib))->hdg_SegList)
24 #define LC_RESIDENTNAME hiddgraphics_resident
25 #define LC_RESIDENTFLAGS RTF_AUTOINIT | RTF_COLDSTART
26 #define LC_RESIDENTPRI 9
27 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
28 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
29 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_LibNode)
31 #define LC_NO_OPENLIB
32 #define LC_NO_CLOSELIB
34 /* to avoid removing the gfxhiddclass from memory add #define NOEXPUNGE */
36 #include <libcore/libheader.c>
38 #undef SDEBUG
39 #undef DEBUG
40 #define DEBUG 0
41 #include <aros/debug.h>
43 #define SysBase (LC_SYSBASE_FIELD(lh))
45 //struct ExecBase * SysBase;
47 ULONG SAVEDS STDARGS LC_BUILDNAME(L_InitLib) (LC_LIBHEADERTYPEPTR lh)
49 struct class_static_data *xsd; /* GfxHidd static data */
51 // SysBase = sysBase;
52 EnterFunc(bug("GfxHIDD_Init()\n"));
55 We map the memory into the shared memory space, because it is
56 to be accessed by many processes, eg searching for a HIDD etc.
58 Well, maybe once we've got MP this might help...:-)
60 xsd = AllocVec(sizeof(struct class_static_data), MEMF_CLEAR|MEMF_PUBLIC);
61 lh->hdg_csd = xsd;
62 if(xsd)
64 xsd->sysbase = SysBase;
66 D(bug(" Got csd\n"));
68 xsd->oopbase = OpenLibrary(AROSOOP_NAME, 0);
69 if (xsd->oopbase)
71 D(bug(" Got OOPBase\n"));
72 xsd->utilitybase = OpenLibrary("utility.library", 37);
73 if (xsd->utilitybase)
75 D(bug(" Got UtilityBase\n"));
76 xsd->gfxhiddclass = init_gfxhiddclass(xsd);
78 // D(bug(" GfxHiddClass: %p\n", csd->gfxhiddclass))
80 if(xsd->gfxhiddclass)
82 // D(bug(" Got GfxHIDDClass\n"))
83 ReturnInt("GfxHIDD_Init", ULONG, TRUE);
86 CloseLibrary(xsd->utilitybase);
88 CloseLibrary(xsd->oopbase);
91 FreeVec(xsd);
92 lh->hdg_csd = NULL;
96 ReturnInt("GfxHIDD_Init", ULONG, FALSE);
101 void SAVEDS STDARGS LC_BUILDNAME(L_ExpungeLib) (LC_LIBHEADERTYPEPTR lh)
103 //EnterFunc(bug("GfxHIDD_Expunge()\n"))
105 if(lh->hdg_csd)
107 free_gfxhiddclass(lh->hdg_csd);
109 CloseLibrary(lh->hdg_csd->utilitybase);
110 CloseLibrary(lh->hdg_csd->oopbase);
112 FreeVec(lh->hdg_csd);
115 ReturnVoid("GfxHIDD_Expunge");