Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / compiler / include / intuition / classes.h
blobf633db093f1d653ffa7c066095c125cdc0608a27
1 #ifndef INTUITION_CLASSES_H
2 #define INTUITION_CLASSES_H
4 /*
5 Copyright 1995-2008, The AROS Development Team. All rights reserved.
6 $Id$
8 BOOPSI structures.
9 */
11 #ifndef EXEC_LIBRARIES_H
12 # include <exec/libraries.h>
13 #endif
14 #ifndef INTUITION_CLASSUSR_H
15 # include <intuition/classusr.h>
16 #endif
17 #ifndef UTILITY_HOOKS_H
18 # include <utility/hooks.h>
19 #endif
20 #include <aros/asmcall.h>
22 /* The following structure is READ-ONLY */
23 typedef struct IClass
25 struct Hook cl_Dispatcher;
26 ULONG cl_Reserved;
27 struct IClass *cl_Super; /* Super-Class */
28 ClassID cl_ID;
29 UWORD cl_InstOffset;
30 UWORD cl_InstSize;
31 IPTR cl_UserData; /* application specific */
32 ULONG cl_SubclassCount; /* # of direct suclasses */
33 ULONG cl_ObjectCount; /* # of objects, made from this class
34 must be 0, if the class is to be
35 deleted */
36 ULONG cl_Flags; /* see below */
37 ULONG cl_ObjectSize; /* cl_InstOffset + cl_InstSize + sizeof(struct _Object) */
38 APTR cl_MemoryPool;
39 } Class;
41 /* cl_Flags */
42 #define CLF_INLIST (1L<<0)
44 /* This structure is situated before the pointer. It may grow in future,
45 but o_Class will always stay at the end, so that you can subtract
46 the size of a pointer from the object-pointer to get a pointer to the
47 pointer to the class of the object. */
48 struct _Object
50 struct MinNode o_Node; /* PRIVATE */
51 struct IClass * o_Class;
54 #define _OBJ(obj) ((struct _Object *)(obj))
55 #define BASEOBJECT(obj) ((Object *)(_OBJ(obj) + 1))
56 #define _OBJECT(obj) (_OBJ(obj) - 1)
58 #define OCLASS(obj) ((_OBJECT(obj))->o_Class)
60 #define INST_DATA(class, obj) ((APTR)(((UBYTE *)(obj)) + (class)->cl_InstOffset))
62 #define SIZEOF_INSTANCE(class) ((class)->cl_InstOffset + (class)->cl_InstSize \
63 + sizeof(struct _Object))
65 struct ClassLibrary
67 struct Library cl_Lib;
68 UWORD cl_Pad;
69 Class *cl_Class;
72 /*
73 With the following define a typical dispatcher will looks like this:
74 BOOPSI_DISPATCHER(IPTR,IconWindow_Dispatcher,cl,obj,msg)
76 #define BOOPSI_DISPATCHER(rettype,name,cl,obj,msg) \
77 AROS_UFH3(rettype, name,\
78 AROS_UFHA(Class *, cl, A0),\
79 AROS_UFHA(Object *, obj, A2),\
80 AROS_UFHA(Msg , msg, A1)) {AROS_USERFUNC_INIT
81 #define BOOPSI_DISPATCHER_END AROS_USERFUNC_EXIT}
82 #define BOOPSI_DISPATCHER_PROTO(rettype,name,cl,obj,msg) \
83 AROS_UFP3(rettype, name,\
84 AROS_UFPA(Class *, cl, A0),\
85 AROS_UFPA(Object *, obj, A2),\
86 AROS_UFPA(Msg , msg, A1))
88 #endif /* INTUITION_CLASSES_H */