/* Base Object Definition
*****************************************************************************/
-Obj* mkobject(uint32_t type, size_t datasz) {
+Obj* obj_new(uint32_t type, size_t datasz) {
Obj* obj = (Obj*)malloc(sizeof(struct Obj) + datasz);
obj->type = type;
obj->size = datasz;
return obj;
}
+void obj_set(Obj* obj, uintptr_t sel, Obj* val) {
+ Slot* slot = (Slot*)malloc(sizeof(Slot));
+ slot->sel = sel;
+ slot->val = val;
+ hamt_insert(&(obj->slots), slot);
+}
+
+Obj* obj_get(Obj* obj, uintptr_t sel) {
+ Slot slot = { sel, NULL };
+ Slot* entry = hamt_lookup(&(obj->slots), &slot);
+ return (entry != NULL) ? entry->val : NULL;
+}
+
/* Main API
*****************************************************************************/
GirCtx* gir_init(void)