Added AROS port of all shell applications:
[cake.git] / rom / boopsi / boopsi_init.c
blobc40e7147991c11b108e7ee3998ddf5c81c1394cf
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: BOOPSI Library
6 Lang: english
7 */
9 #include <utility/utility.h>
10 #include <proto/boopsi.h>
11 #include "intern.h"
12 #include "libdefs.h"
14 /**********************************************************************************************/
16 #ifdef SysBase
17 # undef SysBase
18 #endif
20 /* Customize libheader.c */
21 #define LC_SYSBASE_FIELD(lib) (((struct IntBOOPSIBase *)(lib))->bb_SysBase)
22 #define LC_SEGLIST_FIELD(lib) (((struct IntBOOPSIBase *)(lib))->bb_SegList)
23 #define LC_RESIDENTNAME BOOPSI_resident
24 #define LC_RESIDENTFLAGS RTF_AUTOINIT|RTF_COLDSTART
25 #define LC_RESIDENTPRI 95
26 #define LC_LIBBASESIZE sizeof(struct IntBOOPSIBase)
27 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
28 #define LC_LIB_FIELD(lib) (((struct IntBOOPSIBase *)(lib))->bb_LibNode)
29 #define LC_NO_OPENLIB
30 #define LC_NO_CLOSELIB
31 #define LC_NO_EXPUNGELIB
32 #define LC_STATIC_INITLIB
34 #include <libcore/libheader.c>
36 /**********************************************************************************************/
38 #define SysBase (GetBBase(BOOPSIBase)->bb_SysBase)
40 /**********************************************************************************************/
42 static void FreeAllClasses(struct Library *BOOPSIBase)
44 Class *cl;
46 while((cl = (Class *)RemHead((struct List *)&GetBBase(BOOPSIBase)->bb_ClassList)))
48 /* We can't free this class, so lets not bother */
49 if(cl != &rootclass)
50 FreeClass(cl);
54 /**********************************************************************************************/
56 static ULONG SAVEDS STDARGS LC_BUILDNAME(L_InitLib) (LIBBASETYPEPTR LIBBASE)
58 Class *cl;
60 UtilityBase = OpenLibrary (UTILITYNAME, 0);
62 if (!UtilityBase)
63 return FALSE;
65 /* All we have to do is to set up the pre-existing classes. */
66 NEWLIST(&GetBBase(LIBBASE)->bb_ClassList);
67 InitSemaphore(&GetBBase(LIBBASE)->bb_ClassListLock);
69 rootclass.cl_UserData = (IPTR)LIBBASE;
70 AddClass(&rootclass);
72 if((cl = InitICClass(LIBBASE)) == 0)
74 CloseLibrary (UtilityBase);
75 return FALSE;
78 if((cl = InitModelClass(LIBBASE)) == 0)
80 FreeAllClasses(LIBBASE);
81 CloseLibrary (UtilityBase);
82 return FALSE;
85 return TRUE;
88 /**********************************************************************************************/