Minor fixes to comments.
[AROS.git] / rom / oop / oop_init.c
blob37797f995c4a8f10a708a317f75cc3dc28d35dd7
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: OOP Library
6 Lang: english
7 */
9 #define NUM_IDS 31
11 #include <utility/utility.h>
12 #include <proto/oop.h>
13 #include <oop/oop.h>
14 #include <aros/symbolsets.h>
16 #include "intern.h"
17 #include LC_LIBDEFS_FILE
19 #include "hash.h"
20 //#undef SDEBUG
21 #undef DEBUG
22 //#define SDEBUG 0
23 #define DEBUG 0
24 #include <aros/debug.h>
27 BOOL InitUtilityClasses(struct IntOOPBase *OOPBase);
30 #if 0
31 static void FreeAllClasses(struct Library *BOOPIBase)
33 OOP_Class *cl;
35 while((cl = (OOP_Class *)RemHead((struct List *)&GetOBase(OOPBase)->bb_ClassList)))
37 if(cl != &rootclass)
38 OOP_FreeClass(cl);
41 #endif
44 static int OOPInit(LIBBASETYPEPTR LIBBASE)
46 D(bug("Enter OOPInit\n"));
48 LIBBASE->ob_UtilityBase = OpenLibrary("utility.library",36);
49 if (!LIBBASE->ob_UtilityBase)
50 return FALSE;
52 NEWLIST(&LIBBASE->ob_ClassList);
53 InitSemaphore(&LIBBASE->ob_ClassListLock);
55 NEWLIST(&LIBBASE->ob_ServerList);
56 InitSemaphore(&LIBBASE->ob_ServerListLock);
58 InitSemaphore(&LIBBASE->ob_IIDTableLock);
60 SDInit();
62 LIBBASE->ob_IIDTable = NewHash(NUM_IDS, HT_STRING, LIBBASE);
63 if (LIBBASE->ob_IIDTable)
65 struct IDDescr intern_ids[] =
67 /* We must make sure that Root gets ID 0 and Meta gets ID 1 */
68 { IID_Root, &__IRoot },
69 { IID_Meta, &__IMeta },
71 #if 0
72 { IID_Method, &__IMethod },
73 { IID_Server, &__IServer },
74 { IID_Proxy, &__IProxy },
75 { IID_Interface, &__IInterface },
76 #endif
77 { NULL, NULL }
80 /* Get some IDs that are used internally */
81 if (GetIDs(intern_ids, LIBBASE))
83 if (init_rootclass(LIBBASE))
85 if (init_basemeta(LIBBASE))
87 if (init_ifmetaclass(LIBBASE))
89 LIBBASE->ob_HIDDMetaClass
90 = init_hiddmetaclass(LIBBASE);
91 if (LIBBASE->ob_HIDDMetaClass)
93 if (InitUtilityClasses(LIBBASE))
95 D(bug("OOPInit all OK\n"));
96 return (TRUE);
105 D(bug("OOPInit failed\n"));
107 return (FALSE);
110 static int OOPExpunge(LIBBASETYPEPTR LIBBASE)
112 CloseLibrary(LIBBASE->ob_UtilityBase);
113 return TRUE;
116 ADD2INITLIB(OOPInit, 0);
117 ADD2EXPUNGELIB(OOPExpunge, 0);
119 /**************************
120 ** InitUtilityClasses() **
121 **************************/
122 BOOL InitUtilityClasses(struct IntOOPBase *OOPBase)
124 #if 0
125 D(bug("Initializing methodclass\n"));
126 if ((GetOBase(OOPBase)->ob_MethodClass = init_methodclass(GetOBase(OOPBase) )))
128 D(bug("Initializing serverclass\n"));
129 OOPBase->ob_ServerClass = init_serverclass((struct Library *)OOPBase);
130 if (OOPBase->ob_ServerClass)
132 D(bug("Initializing proxyclass\n"));
133 OOPBase->ob_ProxyClass = init_proxyclass((struct Library *)OOPBase);
134 if (OOPBase->ob_ProxyClass)
136 D(bug("Initializing interfaceclass\n"));
137 OOPBase->ob_InterfaceClass = init_interfaceclass((struct Library *)OOPBase);
138 if (OOPBase->ob_InterfaceClass)
140 #endif
141 D(bug("Everything initialized\n"));
142 return TRUE;
143 #if 0
148 #endif
150 return FALSE;