2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Initialize a BOOPSI class
8 #include <exec/lists.h>
9 #include <exec/memory.h>
10 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <intuition/classes.h>
17 #include <proto/boopsi.h>
19 AROS_LH5(struct IClass
*, MakeClass
,
22 AROS_LHA(UBYTE
*, classID
, A0
),
23 AROS_LHA(UBYTE
*, superClassID
, A1
),
24 AROS_LHA(struct IClass
*, superClassPtr
, A2
),
25 AROS_LHA(ULONG
, instanceSize
, D0
),
26 AROS_LHA(ULONG
, flags
, D1
),
29 struct Library
*, BOOPSIBase
, 10, BOOPSI
)
32 Only for class implementators.
34 This function creates a new public BOOPSI class. The SuperClass
35 should be another BOOPSI class; all BOOPSI classes are subclasses
38 SuperClasses can by private or public. You can specify a name/ID
39 for the class if you want it to become a public class. For public
40 classes, you must call AddClass() afterwards to make it public
43 The return value contains a pointer to the IClass structure of your
44 class. You must specify your dispatcher in cl_Dispatcher. You can
45 also store shared data in cl_UserData.
47 To get rid of the class, you must call FreeClass().
50 classID - NULL for private classes otherwise the name/ID of the
52 superClassID - Name/ID of a public SuperClass. NULL is you don't
53 want to use a public SuperClass or if you have the pointer
55 superClassPtr - Pointer to the SuperClass. If this is non-NULL,
56 then superClassID is ignored.
57 instanceSize - The amount of memory which your objects need (in
58 addition to the memory which is needed by the SuperClass(es))
59 flags - For future extensions. To maintain comaptibility, use 0
63 Pointer to the new class or NULL if
64 - There wasn't enough memory
65 - The superclass couldn't be found
66 - There already is a class with the same name/ID.
69 No copy is made of classID. So make sure the lifetime of the contents
70 of classID is at least the same as the lifetime of the class itself.
81 29-10-95 digulla automatically created from
82 intuition_lib.fd and clib/intuition_protos.h
84 *****************************************************************************/
89 /* trust the user ;-) */
90 if (!superClassID
&& !superClassPtr
)
93 /* Does this class already exist ? */
94 if (FindClass (classID
))
97 /* Has the user specified a classPtr ? */
100 /* Search for the class ... */
101 superClassPtr
= FindClass (superClassID
);
104 return (NULL
); /* nothing found */
107 /* Get some memory */
108 if ((iclass
= (Class
*) AllocMem (sizeof (Class
), MEMF_PUBLIC
|MEMF_CLEAR
)))
111 iclass
->cl_Super
= superClassPtr
;
112 iclass
->cl_ID
= classID
;
113 iclass
->cl_InstOffset
= superClassPtr
->cl_InstOffset
+
114 superClassPtr
->cl_InstSize
;
115 iclass
->cl_InstSize
= instanceSize
;
116 iclass
->cl_Flags
= flags
;
118 /* SuperClass is used one more time now */
119 superClassPtr
->cl_SubclassCount
++;