90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
|
CFWObject *obj1 = ptr1, *obj2 = ptr2;
if (obj1->cls->equal != NULL) {
return obj1->cls->equal(obj1, obj2);
} else
return (obj1 == obj2);
}
uint32_t
cfw_hash(void *ptr)
{
CFWObject *obj = ptr;
if (obj->cls->hash != NULL)
return obj->cls->hash(obj);
return (uint32_t)(uintptr_t)ptr;
}
void*
cfw_copy(void *ptr)
{
CFWObject *obj = ptr;
if (obj->cls->copy != NULL)
return obj->cls->copy(obj);
else
return NULL;
return NULL;
}
static CFWClass class = {
.name = "CFWObject",
.size = sizeof(CFWObject),
};
CFWClass *cfw_object = &class;
|