some fixes to accented characters
[tangerine.git] / rom / intuition / rootclass.c
blobb91e1e28bb78323c0c0f6c5f6fe93c24a9076387
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
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 IntuitionBase (GetPrivIBase(cl->cl_UserData))
20 #define ENABLE_MEM_POOL 1
22 #if ENABLE_MEM_POOL
23 # define alloc(a, b) AllocPooled(a, b)
24 # define free(a, b, c) FreePooled(a, b, c)
25 #else
26 # define alloc(a, b) AllocMem(b, MEMF_PUBLIC|MEMF_CLEAR)
27 # define free(a, b, c) FreeMem(b, c)
28 #endif
31 /*****i************************************************************************
33 NAME */
34 AROS_UFH3(IPTR, rootDispatcher,
36 /* SYNOPSIS */
37 AROS_UFHA(Class *, cl, A0),
38 AROS_UFHA(Object *, o, A2),
39 AROS_UFHA(Msg, msg, A1))
41 /* FUNCTION
42 internal !
44 Processes all messages sent to the RootClass. Unknown messages are
45 silently ignored.
47 INPUTS
48 cl - Pointer to the RootClass
49 o - This object was the destination for the message in the first
50 place
51 msg - This is the message.
53 RESULT
54 Processes the message. The meaning of the result depends on the
55 type of the message.
57 NOTES
58 This is a good place to debug BOOPSI objects since every message
59 should eventually show up here.
61 EXAMPLE
63 BUGS
65 SEE ALSO
67 ******************************************************************************/
69 AROS_USERFUNC_INIT
71 IPTR retval = 0;
72 Class *iclass;
74 switch (msg->MethodID)
76 case OM_NEW:
77 iclass = (Class *) o;
79 /*
80 Get memory for the instance data. The class knows how much is
81 needed. NOTE: The object argument is actually the class!
84 o = (Object *) alloc
86 iclass->cl_MemoryPool, iclass->cl_ObjectSize
89 if (o)
91 _OBJ(o)->o_Class = iclass;
93 AROS_ATOMIC_INC(iclass->cl_ObjectCount);
95 retval = (IPTR) BASEOBJECT(o);
97 break;
99 case OM_DISPOSE:
101 Free memory. Caller is responsible that everything else
102 is already cleared!
104 iclass = OCLASS(o);
106 free
108 iclass->cl_MemoryPool, _OBJECT(o), iclass->cl_ObjectSize
111 AROS_ATOMIC_DEC(iclass->cl_ObjectCount);
112 break;
114 case OM_ADDTAIL:
115 /* Add <o> to list. */
116 AddTail (((struct opAddTail *)msg)->opat_List, (struct Node *) _OBJECT(o));
117 retval = TRUE;
118 break;
120 case OM_REMOVE:
121 /* Remove object from list. */
122 Remove ((struct Node *) _OBJECT(o));
123 retval = TRUE;
124 break;
126 case OM_SET:
127 case OM_GET:
128 case OM_UPDATE:
129 case OM_NOTIFY:
130 case OM_ADDMEMBER:
131 case OM_REMMEMBER:
133 default:
134 /* Ignore */
135 break;
137 } /* switch */
139 return (retval);
141 AROS_USERFUNC_EXIT
143 } /* rootDispatcher */