summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-19 12:54:49 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-19 12:54:49 +0100
commit619b17ce5eb96b3cfd5f2d94174270a31e46871c (patch)
treeec5100fc26035969d1a90947b9e20fb14ff1f35d /Objective-C
parent982965f8e14194dd1660eb1faff9a3bd8be2a00b (diff)
Reimplement slot reading.
darcs-hash:bdef9c8f4c3fb2121456295da23fbe679265a15b
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.h6
-rw-r--r--Objective-C/libobjcl.m18
2 files changed, 24 insertions, 0 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h
index e7194a5..c2e2fac 100644
--- a/Objective-C/libobjcl.h
+++ b/Objective-C/libobjcl.h
@@ -153,6 +153,12 @@ objcl_set_slot_value (id obj, const char *ivar_name, void *value);
void
objcl_get_slot_value (id obj, const char *ivar_name, void *value_out);
+void *
+objcl_get_slot (Class class, const char *ivar_name);
+
+long /* actually ptrdiff_t */
+objcl_get_slot_offset (void *slot);
+
/* The following function returns a freshly consed array that the caller
must deallocate. */
IVAR_T *
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 87e4c28..f244e50 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -532,6 +532,24 @@ objcl_get_slot_value (id obj, const char *ivar_name, void *value_out)
}
+void *
+objcl_get_slot (Class class, const char *ivar_name)
+{
+ return class_getInstanceVariable (class, ivar_name);
+}
+
+
+long
+objcl_get_slot_offset (void *slot)
+{
+#ifdef __NEXT_RUNTIME__
+ return (ivar_getOffset ((Ivar) slot));
+#else
+ return ((Ivar_t) slot)->ivar_offset;
+#endif
+}
+
+
IVAR_T *
objcl_class_direct_slots (Class class, unsigned int *count, unsigned int *element_size)
{