1 //metadoc Object copyright Steve Dekorte 2002
2 //metadoc Object license BSD revised
4 #ifndef OBJECT_STRUCT_DEFINED
5 #define OBJECT_STRUCT_DEFINED 1
11 #include "Collector.h"
18 typedef struct CollectorMarker IoObject
;
19 //typedef struct IoObjectData IoObjectData;
21 #ifndef CollectorObjectReference_DEFINED
22 #define CollectorObjectReference_DEFINED 1
23 typedef struct IoObjectData CollectorObjectReference;
29 unsigned int markerCount
;
40 } data
; // 8 bytes (9+8 = 17)
42 // 4*4 = 16 bytes (17+16 = 33)
48 #ifdef IOOBJECT_PERSISTENCE
49 PID_TYPE persistentId
;
52 unsigned int hasDoneLookup
: 1; // used to avoid slot lookup loops
53 unsigned int isActivatable
: 1; // if true, upon activation, call activate slot
54 unsigned int isDirty
: 1; // set to true when the object changes it's storable state
58 unsigned int ownsSlots
: 1; // if true, io_free slots hash table when io_freeing object
59 unsigned int isSymbol
: 1; // true if the object is a unqiue sequence - a symbol
60 unsigned int isLocals
: 1; // true if the Object is a locals object
61 unsigned int isReferenced
: 1; // 1 bit ref counter
62 unsigned int sentWillFree
: 1; // 1 is sent willFree mes
63 //unsigned int isPObject : 1; // check before type tests?
66 #define IoObject_deref(self) ((IoObjectData *)(((CollectorMarker *)(self))->object))
67 #define IoObject_markerCount(self) IoObject_deref(self)->markerCount
68 #define IoObject_markerCount_(self, v) IoObject_deref(self)->markerCount = (v);
69 #define IoObject_incrementMarkerCount(self) IoObject_deref(self)->markerCount ++;
70 #define IoObject_decrementMarkerCount(self) IoObject_deref(self)->markerCount --;
72 #define IoObject_tag_(self, t) IoObject_deref(self)->tag = t;
73 #define IoObject_tag(self) (IoObject_deref(self)->tag)
75 #define IoObject_state(self) ((IoState *)(IoObject_tag(self)->state))
76 #define IOSTATE ((IoState *)(IoObject_tag(self)->state))
77 //#define IOSTATE IoObject_state(state)
81 #define IoObject_dataPointer(self) IoObject_deref(self)->data.pointers.ptr
82 #define IoObject_setDataPointer_(self, v) IoObject_deref(self)->data.pointers.ptr = (void *)(v);
84 #define IoObject_dataPointer2(self) IoObject_deref(self)->data.pointers.ptr2
85 #define IoObject_setDataPointer2_(self, v) IoObject_deref(self)->data.pointers.ptr2 = (void *)(v);
87 #define IoObject_dataDouble(self) IoObject_deref(self)->data.d
88 #define IoObject_setDataDouble_(self, v) IoObject_deref(self)->data.d = (double)(v);
90 #define IoObject_dataUint32(self) IoObject_deref(self)->data.ui32
91 #define IoObject_setDataUint32_(self, v) IoObject_deref(self)->data.ui32 = (uint32_t)(v);
93 #define IoObject_isActivatable_(self, b) IoObject_deref(self)->isActivatable = b;
94 #define IoObject_isActivatable(self) (IoObject_deref(self)->isActivatable)
96 #define IoObject_ownsSlots_(self, b) IoObject_deref(self)->ownsSlots = b;
97 #define IoObject_ownsSlots(self) (IoObject_deref(self)->ownsSlots)
99 #define IoObject_slots_(self, v) IoObject_deref(self)->slots = v;
100 #define IoObject_slots(self) (IoObject_deref(self)->slots)
102 #define IoObject_protos_(self, v) IoObject_deref(self)->protos = v;
103 #define IoObject_protos(self) (IoObject_deref(self)->protos)
105 #define IoObject_firstProto(self) IoObject_protos(self)[0]
106 #define IoObject_protoAt_(self, i) IoObject_protos(self)[i]
107 #define IoObject_protoAtPut_(self, i, v) IoObject_protos(self)[i] = v;
109 #define IoObject_listeners_(self, v) IoObject_deref(self)->listeners = v;
110 #define IoObject_listeners(self) (IoObject_deref(self)->listeners)
112 #define IoObject_hasDoneLookup_(self, v) IoObject_deref(self)->hasDoneLookup = v;
113 #define IoObject_hasDoneLookup(self) (IoObject_deref(self)->hasDoneLookup)
115 #define IoObject_isSymbol_(self, v) IoObject_deref(self)->isSymbol = v;
116 #define IoObject_isSymbol(self) (IoObject_deref(self)->isSymbol)
118 #ifdef IOOBJECT_PERSISTENCE
119 #define IoObject_isDirty_(self, v) IoObject_deref(self)->isDirty = v;
120 #define IoObject_isDirty(self) (IoObject_deref(self)->isDirty)
122 #define IoObject_isDirty_(self, v)
123 #define IoObject_isDirty(self) 0
126 #define IoObject_sentWillFree_(self, v) IoObject_deref(self)->sentWillFree = v;
127 #define IoObject_sentWillFree(self) (IoObject_deref(self)->sentWillFree)
129 #define IoObject_isLocals_(self, v) IoObject_deref(self)->isLocals = v;
130 #define IoObject_isLocals(self) (IoObject_deref(self)->isLocals)
132 #ifdef IOOBJECT_PERSISTENCE
133 #define IoObject_persistentId_(self, v) IoObject_deref(self)->persistentId = v;
134 #define IoObject_persistentId(self) (IoObject_deref(self)->persistentId)
136 #define IoObject_persistentId_(self, v)
137 #define IoObject_persistentId(self) 0
140 #ifdef IO_BLOCK_LOCALS_RECYCLING
141 #define IoObject_isReferenced_(self, v) IoObject_deref(self)->isReferenced = v;
142 #define IoObject_isReferenced(self) (IoObject_deref(self)->isReferenced)
144 #define IoObject_isReferenced_(self, v)
145 #define IoObject_isReferenced(self) 0
148 typedef IoObject
*(IoMethodFunc
)(IoObject
*, IoObject
*, IoObject
*);