[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 29/61: Incorporate %inherit-magic! into %init-layout!
From: |
Andy Wingo |
Subject: |
[Guile-commits] 29/61: Incorporate %inherit-magic! into %init-layout! |
Date: |
Thu, 22 Jan 2015 18:53:08 +0000 |
wingo pushed a commit to branch wip-goops-refactor
in repository guile.
commit 8e5796c5fa36ede607b4e9fc34b9b621218657a2
Author: Andy Wingo <address@hidden>
Date: Sun Jan 11 22:01:47 2015 +0100
Incorporate %inherit-magic! into %init-layout!
* libguile/goops.c (scm_make_standard_class, scm_sys_init_layout_x):
Move definitions up. Incorporate scm_sys_inherit_magic_x into
scm_sys_init_layout_x.
* libguile/goops.h: Remove scm_sys_init_layout_x declaration.
---
libguile/goops.c | 63 +++++++++++++++++++++++---------------------------
libguile/goops.h | 1 -
module/oop/goops.scm | 10 ++-----
3 files changed, 32 insertions(+), 42 deletions(-)
diff --git a/libguile/goops.c b/libguile/goops.c
index aabd6ad..547b4d2 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -164,6 +164,35 @@ static SCM scm_sys_goops_early_init (void);
static SCM scm_sys_goops_loaded (void);
+
+
+SCM
+scm_make_standard_class (SCM meta, SCM name, SCM dsupers, SCM dslots)
+{
+ return scm_call_4 (scm_variable_ref (var_make_standard_class),
+ meta, name, dsupers, dslots);
+}
+
+SCM_DEFINE (scm_sys_init_layout_x, "%init-layout!", 2, 0, 0,
+ (SCM class, SCM layout),
+ "")
+#define FUNC_NAME s_scm_sys_init_layout_x
+{
+ SCM_VALIDATE_INSTANCE (1, class);
+ SCM_ASSERT (!scm_is_symbol (SCM_VTABLE_LAYOUT (class)), class, 1, FUNC_NAME);
+ SCM_VALIDATE_STRING (2, layout);
+
+ SCM_SET_VTABLE_LAYOUT (class, scm_make_struct_layout (layout));
+ scm_i_struct_inherit_vtable_magic (SCM_CLASS_OF (class), class);
+ SCM_SET_CLASS_FLAGS (class, SCM_CLASSF_GOOPS_OR_VALID);
+
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+
+
+
/* This function is used for efficient type dispatch. */
SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
(SCM x),
@@ -287,42 +316,8 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_sys_init_layout_x, "%init-layout!", 2, 0, 0,
- (SCM class, SCM layout),
- "")
-#define FUNC_NAME s_scm_sys_init_layout_x
-{
- SCM_VALIDATE_INSTANCE (1, class);
- SCM_ASSERT (!scm_is_symbol (SCM_VTABLE_LAYOUT (class)), class, 1, FUNC_NAME);
- SCM_VALIDATE_STRING (2, layout);
-
- SCM_SET_VTABLE_LAYOUT (class, scm_make_struct_layout (layout));
- return SCM_UNSPECIFIED;
-}
-#undef FUNC_NAME
-
-SCM_DEFINE (scm_sys_inherit_magic_x, "%inherit-magic!", 2, 0, 0,
- (SCM class, SCM dsupers),
- "")
-#define FUNC_NAME s_scm_sys_inherit_magic_x
-{
- SCM_VALIDATE_INSTANCE (1, class);
- scm_i_struct_inherit_vtable_magic (SCM_CLASS_OF (class), class);
- SCM_SET_CLASS_FLAGS (class, SCM_CLASSF_GOOPS_OR_VALID);
-
- return SCM_UNSPECIFIED;
-}
-#undef FUNC_NAME
-
/******************************************************************************/
-SCM
-scm_make_standard_class (SCM meta, SCM name, SCM dsupers, SCM dslots)
-{
- return scm_call_4 (scm_variable_ref (var_make_standard_class),
- meta, name, dsupers, dslots);
-}
-
/******************************************************************************/
SCM_DEFINE (scm_sys_make_root_class, "%make-root-class", 1, 0, 0,
diff --git a/libguile/goops.h b/libguile/goops.h
index fafd7fa..ca9c41b 100644
--- a/libguile/goops.h
+++ b/libguile/goops.h
@@ -102,7 +102,6 @@ SCM_API SCM scm_slot_ref (SCM obj, SCM slot_name);
SCM_API SCM scm_slot_set_x (SCM obj, SCM slot_name, SCM value);
SCM_INTERNAL void scm_i_inherit_applicable (SCM c);
-SCM_API SCM scm_sys_inherit_magic_x (SCM c, SCM dsupers);
SCM_API SCM scm_instance_p (SCM obj);
SCM_API int scm_is_generic (SCM x);
SCM_API int scm_is_method (SCM x);
diff --git a/module/oop/goops.scm b/module/oop/goops.scm
index 10d6395..67e7bf8 100644
--- a/module/oop/goops.scm
+++ b/module/oop/goops.scm
@@ -447,7 +447,6 @@
(cons z subclasses))))
dsupers)
(%prep-layout! z)
- (%inherit-magic! z dsupers)
z)))
(define <class>
@@ -2471,12 +2470,9 @@ var{initargs}."
(cons class dsubs))))
supers)
- ;; Support for the underlying structs:
-
- ;; Set the layout slot
- (%prep-layout! class)
- ;; Inherit class flags (invisible on scheme level) from supers
- (%inherit-magic! class supers)))
+ ;; Compute struct layout of instances, set the `layout' slot, and
+ ;; update class flags.
+ (%prep-layout! class)))
(define (initialize-object-procedure object initargs)
(let ((proc (get-keyword #:procedure initargs #f)))
- [Guile-commits] 23/61: Deprecate scm_get_keyword, (continued)
- [Guile-commits] 23/61: Deprecate scm_get_keyword, Andy Wingo, 2015/01/22
- [Guile-commits] 18/61: Remove TEST_CHANGE_CLASS, Andy Wingo, 2015/01/22
- [Guile-commits] 17/61: Remove pure-generic?, Andy Wingo, 2015/01/22
- [Guile-commits] 25/61: Re-use the vtable "size" field for GOOPS nfields, Andy Wingo, 2015/01/22
- [Guile-commits] 19/61: No more concept of "pure generics", Andy Wingo, 2015/01/22
- [Guile-commits] 15/61: Move slot-ref et al to Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 21/61: Minor goops.c tidying, Andy Wingo, 2015/01/22
- [Guile-commits] 01/61: Deprecate C exports of GOOPS classes., Andy Wingo, 2015/01/22
- [Guile-commits] 22/61: Rewrite %initialize-object in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 31/61: GOOPS cleanup to use SRFI-1 better, Andy Wingo, 2015/01/22
- [Guile-commits] 29/61: Incorporate %inherit-magic! into %init-layout!,
Andy Wingo <=
- [Guile-commits] 32/61: append-map rather than mapappend, Andy Wingo, 2015/01/22
- [Guile-commits] 24/61: Move <class> initialization to Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 30/61: Cosmetic goops refactors., Andy Wingo, 2015/01/22
- [Guile-commits] 35/61: Add compute-cpl tests, Andy Wingo, 2015/01/22
- [Guile-commits] 26/61: Reimplement %allocate-instance in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 28/61: goops.c no longer knows about <class> slot allocation, Andy Wingo, 2015/01/22
- [Guile-commits] 34/61: Fold (oop goops util) into (oop goops), Andy Wingo, 2015/01/22
- [Guile-commits] 33/61: GOOPS utils module cleanups, Andy Wingo, 2015/01/22
- [Guile-commits] 27/61: Reimplement inherit-applicable! in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 12/61: goops: use computed class slot offsets; untabify and fix whitepace, Andy Wingo, 2015/01/22