summaryrefslogtreecommitdiff
path: root/libguile/goops.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-01-11 21:31:51 +0100
committerAndy Wingo <wingo@pobox.com>2015-01-23 16:16:02 +0100
commit2025a02793282b5548372939e43c72d13933853d (patch)
treec513c7e079fcc881184f75743fe76d0083dc6dd9 /libguile/goops.h
parentf37bece4e4e71d430b0742d83327e63b72b97644 (diff)
downloadguile-2025a02793282b5548372939e43c72d13933853d.tar.gz
goops.c no longer knows about <class> slot allocation
* libguile/goops.c (scm_class_of): Access "redefined" slot by name in the case where we need to change the class of an instance. (scm_sys_goops_early_init): Move up capture of class-precedence-list so SCM_SUBCLASSP can use it. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_redefined) (scm_si_direct_supers, scm_si_direct_slots, scm_si_direct_subclasses) (scm_si_direct_methods, scm_si_cpl scm_si_slots) (scm_si_getters_n_setters, SCM_N_CLASS_SLOTS, SCM_OBJ_CLASS_REDEF): Remove. Now C code has no special knowledge about the layout of GOOPS classes. (SCM_SUBCLASSP): Use scm_class_precedence_list to get CPL. (SCM_INST, SCM_ACCESSORS_OF): Remove unused macros that were undocumented and nonsensical.
Diffstat (limited to 'libguile/goops.h')
-rw-r--r--libguile/goops.h32
1 files changed, 2 insertions, 30 deletions
diff --git a/libguile/goops.h b/libguile/goops.h
index f7233cb4d..fafd7fa37 100644
--- a/libguile/goops.h
+++ b/libguile/goops.h
@@ -54,36 +54,7 @@
#define SCM_CLASSF_GOOPS SCM_VTABLE_FLAG_GOOPS_CLASS
#define SCM_CLASSF_GOOPS_OR_VALID (SCM_CLASSF_GOOPS | SCM_CLASSF_GOOPS_VALID)
-/*
- * scm_class_class
- */
-
-/* see also, SCM_VTABLE_BASE_LAYOUT, and build_class_class_slots */
-#define SCM_CLASS_CLASS_LAYOUT \
- "pw" /* redefined */ \
- "pw" /* direct supers */ \
- "pw" /* direct slots */ \
- "pw" /* direct subclasses */ \
- "pw" /* direct methods */ \
- "pw" /* cpl */ \
- "pw" /* slots */ \
- "pw" /* getters-n-setters */
-
-#define scm_si_redefined (scm_vtable_offset_user + 0)
-#define scm_si_direct_supers (scm_vtable_offset_user + 1) /* (class ...) */
-#define scm_si_direct_slots (scm_vtable_offset_user + 2) /* ((name . options) ...) */
-#define scm_si_direct_subclasses (scm_vtable_offset_user + 3) /* (class ...) */
-#define scm_si_direct_methods (scm_vtable_offset_user + 4) /* (methods ...) */
-#define scm_si_cpl (scm_vtable_offset_user + 5) /* (class ...) */
-#define scm_si_slots (scm_vtable_offset_user + 6) /* ((name . options) ...) */
-#define scm_si_getters_n_setters (scm_vtable_offset_user + 7)
-#define SCM_N_CLASS_SLOTS (scm_vtable_offset_user + 8)
-
-#define SCM_OBJ_CLASS_REDEF(x) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (x) [scm_si_redefined]))
-#define SCM_INST(x) SCM_STRUCT_DATA (x)
-
#define SCM_CLASS_OF(x) SCM_STRUCT_VTABLE (x)
-#define SCM_ACCESSORS_OF(x) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (x)[scm_si_getters_n_setters]))
#define SCM_CLASSP(x) \
(SCM_STRUCTP (x) && SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_METACLASS)
@@ -96,7 +67,8 @@
#define SCM_SLOT(x, i) (SCM_STRUCT_SLOT_REF (x, i))
#define SCM_SET_SLOT(x, i, v) (SCM_STRUCT_SLOT_SET (x, i, v))
-#define SCM_SUBCLASSP(c1, c2) (scm_is_true (scm_c_memq (c2, SCM_SLOT (c1, scm_si_cpl))))
+#define SCM_SUBCLASSP(c1, c2) \
+ (scm_is_true (scm_c_memq (c2, scm_class_precedence_list (c1))))
#define SCM_IS_A_P(x, c) \
(SCM_INSTANCEP (x) && SCM_SUBCLASSP (SCM_CLASS_OF (x), c))