New slot setter/reader for the C interface

This commit is contained in:
jgarcia 2007-11-24 18:31:09 +00:00
parent 7fd98105fb
commit 47ce3f53e5
2 changed files with 18 additions and 0 deletions

View file

@ -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);
}

View file

@ -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 */