2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <aros/asmcall.h>
8 #include <aros/atomic.h>
9 #include <exec/lists.h>
10 #include <exec/memory.h>
11 #include <proto/exec.h>
12 #include <proto/alib.h>
13 #include <intuition/classes.h>
14 #include <utility/hooks.h>
15 #include <utility/utility.h>
16 #include "intuition_intern.h"
18 #define ENABLE_MEM_POOL 1
21 # define alloc(a, b) AllocPooled(a, b)
22 # define free(a, b, c) FreePooled(a, b, c)
24 # define alloc(a, b) AllocMem(b, MEMF_PUBLIC|MEMF_CLEAR)
25 # define free(a, b, c) FreeMem(b, c)
29 /*****i************************************************************************
32 AROS_UFH3(IPTR
, rootDispatcher
,
35 AROS_UFHA(Class
*, cl
, A0
),
36 AROS_UFHA(Object
*, o
, A2
),
37 AROS_UFHA(Msg
, msg
, A1
))
42 Processes all messages sent to the RootClass. Unknown messages are
46 cl - Pointer to the RootClass
47 o - This object was the destination for the message in the first
49 msg - This is the message.
52 The meaning of the result depends on the type of the message.
55 This is a good place to debug BOOPSI objects since every message
56 should eventually show up here.
64 ******************************************************************************/
71 switch (msg
->MethodID
)
77 Get memory for the instance data. The class knows how much is
78 needed. NOTE: The object argument is actually the class!
83 iclass
->cl_MemoryPool
, iclass
->cl_ObjectSize
88 _OBJ(o
)->o_Class
= iclass
;
90 AROS_ATOMIC_INC(iclass
->cl_ObjectCount
);
92 retval
= (IPTR
) BASEOBJECT(o
);
98 Free memory. Caller is responsible that everything else
105 iclass
->cl_MemoryPool
, _OBJECT(o
), iclass
->cl_ObjectSize
108 AROS_ATOMIC_DEC(iclass
->cl_ObjectCount
);
112 /* Add <o> to list. */
113 AddTail (((struct opAddTail
*)msg
)->opat_List
, (struct Node
*) _OBJECT(o
));
118 /* Remove object from list. */
119 Remove ((struct Node
*) _OBJECT(o
));
140 } /* rootDispatcher */