grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / hidds / hidd / initcode.c
blob97e96b3e240a91e799ae4523e6bd928e137b6866
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <aros/symbolsets.h>
8 #include <proto/exec.h>
9 #include <proto/oop.h>
11 #include "hiddclass_intern.h"
13 #include LC_LIBDEFS_FILE
15 static int init_hiddclass(LIBBASETYPEPTR lh)
17 struct Library *OOPBase = GM_OOPBASE_FIELD(lh);
18 struct class_static_data *csd;
20 EnterFunc(bug("HIDD::Init()\n"));
22 csd = &lh->hd_csd;
23 csd->cs_UtilityBase = OpenLibrary("utility.library", 36);
24 if (!csd->cs_UtilityBase)
25 return FALSE;
27 csd->MemPool = CreatePool(MEMF_CLEAR | MEMF_PUBLIC, 8192, 4096);
28 if (!csd->MemPool)
29 return FALSE;
31 csd->hiddAttrBase = OOP_ObtainAttrBase(IID_Hidd);
32 if (!csd->hiddAttrBase)
33 return FALSE;
34 csd->hwAttrBase = OOP_ObtainAttrBase(IID_HW);
35 if (!csd->hwAttrBase)
36 return FALSE;
38 csd->hwMethodBase = OOP_GetMethodID(IID_HW, 0);
40 if (!OOP_NewObject(csd->rootclass, NULL, NULL))
41 return FALSE;
43 ReturnInt("HIDD::Init", ULONG, TRUE);
46 static int free_hiddclass(LIBBASETYPEPTR lh)
48 struct Library *OOPBase = GM_OOPBASE_FIELD(lh);
49 struct class_static_data *csd = &lh->hd_csd;
51 EnterFunc(bug("HIDD::Free()\n"));
53 /* We do not dispose csd->hwroot because we will never be expunged */
55 if (csd->hwAttrBase)
56 OOP_ReleaseAttrBase(IID_HW);
57 if (csd->hiddAttrBase)
58 OOP_ReleaseAttrBase(IID_Hidd);
60 DeletePool(csd->MemPool);
61 CloseLibrary(csd->cs_UtilityBase);
63 ReturnInt("HIDD::Free", ULONG, TRUE);
66 ADD2INITLIB(init_hiddclass, 0)
67 ADD2EXPUNGELIB(free_hiddclass, 0)