From 47ce3f53e5fd07fdb7a2a418348e46c7062a6a4b Mon Sep 17 00:00:00 2001 From: jgarcia Date: Sat, 24 Nov 2007 18:31:09 +0000 Subject: [PATCH] New slot setter/reader for the C interface --- src/c/instance.d | 15 +++++++++++++++ src/h/external.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/c/instance.d b/src/c/instance.d index dfe2a467b..c6a46bcb2 100644 --- a/src/c/instance.d +++ b/src/c/instance.d @@ -291,3 +291,18 @@ cl_class_of(cl_object x) t = cl_find_class(1, Ct); @(return t) } + +cl_object +ecl_slot_value(cl_object x, const char *slot) +{ + cl_object slot_name = c_string_to_object(slot); + return funcall(3, @'slot-value', x, slot_name); +} + +cl_object +ecl_slot_value_set(cl_object x, const char *slot, cl_object value) +{ + cl_object slot_name = c_string_to_object(slot); + cl_object slot_setter = c_string_to_object("(SETF SLOT-VALUE)"); + return funcall(4, ecl_fdefinition(slot_setter), value, x, slot_name); +} diff --git a/src/h/external.h b/src/h/external.h index bda4a2dbc..afc4adba1 100644 --- a/src/h/external.h +++ b/src/h/external.h @@ -682,6 +682,9 @@ extern cl_object ecl_allocate_instance(cl_object clas, cl_index size); extern cl_object ecl_instance_ref(cl_object x, cl_fixnum i); extern cl_object ecl_instance_set(cl_object x, cl_fixnum i, cl_object v); extern cl_object si_copy_instance(cl_object x); + +extern cl_object ecl_slot_value(cl_object x, const char *slot); +extern cl_object ecl_slot_value_set(cl_object x, const char *slot, cl_object y); #endif /* CLOS */