2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
11 #include <utility/utility.h>
12 #include <proto/oop.h>
14 #include <aros/symbolsets.h>
17 #include LC_LIBDEFS_FILE
24 #include <aros/debug.h>
27 BOOL
InitUtilityClasses(struct IntOOPBase
*OOPBase
);
31 static void FreeAllClasses(struct Library *BOOPIBase)
35 while((cl = (OOP_Class *)RemHead((struct List *)&GetOBase(OOPBase)->bb_ClassList)))
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
)
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
);
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
},
72 { IID_Method
, &__IMethod
},
73 { IID_Server
, &__IServer
},
74 { IID_Proxy
, &__IProxy
},
75 { IID_Interface
, &__IInterface
},
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"));
105 D(bug("OOPInit failed\n"));
110 static int OOPExpunge(LIBBASETYPEPTR LIBBASE
)
112 CloseLibrary(LIBBASE
->ob_UtilityBase
);
116 ADD2INITLIB(OOPInit
, 0);
117 ADD2EXPUNGELIB(OOPExpunge
, 0);
119 /**************************
120 ** InitUtilityClasses() **
121 **************************/
122 BOOL
InitUtilityClasses(struct IntOOPBase
*OOPBase
)
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
)
141 D(bug("Everything initialized\n"));