[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 08/87: Preparation for more GOOPS refactorings
From: |
Andy Wingo |
Subject: |
[Guile-commits] 08/87: Preparation for more GOOPS refactorings |
Date: |
Thu, 22 Jan 2015 17:29:42 +0000 |
wingo pushed a commit to branch wip-goops-refactor
in repository guile.
commit 8701c2cd82797608f76cdd57b400c84dd3f34db0
Author: Andy Wingo <address@hidden>
Date: Wed Dec 24 11:29:45 2014 -0500
Preparation for more GOOPS refactorings
* libguile/goops.c (scm_sys_goops_early_init)
(scm_init_goops_builtins): Factor out some initialization to a
separate helper. This will be the base for moving more things from C
to Scheme in the future.
* module/oop/goops.scm: Call %goops-early-init.
---
libguile/goops.c | 42 ++++++++++++++++++++++++++----------------
module/oop/goops.scm | 3 +++
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/libguile/goops.c b/libguile/goops.c
index 0b3f30a..e12b580 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -172,6 +172,7 @@ static SCM scm_make_unbound (void);
static SCM scm_unbound_p (SCM obj);
static SCM scm_assert_bound (SCM value, SCM obj);
static SCM scm_at_assert_bound_ref (SCM obj, SCM index);
+static SCM scm_sys_goops_early_init (void);
static SCM scm_sys_goops_loaded (void);
static SCM scm_make_extended_class_from_symbol (SCM type_name_sym,
int applicablep);
@@ -2417,6 +2418,28 @@ SCM_DEFINE (scm_pure_generic_p, "pure-generic?", 1, 0, 0,
* Initialization
*/
+SCM_DEFINE (scm_sys_goops_early_init, "%goops-early-init", 0, 0, 0,
+ (),
+ "")
+#define FUNC_NAME s_scm_sys_goops_early_init
+{
+ create_basic_classes ();
+ create_standard_classes ();
+ create_smob_classes ();
+ create_struct_classes ();
+ create_port_classes ();
+
+ {
+ SCM name = scm_from_latin1_symbol ("no-applicable-method");
+ scm_no_applicable_method =
+ scm_make (scm_list_3 (scm_class_generic, k_name, name));
+ scm_module_define (scm_module_goops, name, scm_no_applicable_method);
+ }
+
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
SCM_DEFINE (scm_sys_goops_loaded, "%goops-loaded", 0, 0, 0,
(),
"Announce that GOOPS is loaded and perform initialization\n"
@@ -2446,26 +2469,13 @@ scm_init_goops_builtins (void *unused)
goops_rstate = scm_c_make_rstate ("GOOPS", 5);
-#include "libguile/goops.x"
-
- var_compute_cpl =
- scm_module_variable (scm_module_goops, sym_compute_cpl);
-
hell = scm_calloc (hell_size * sizeof (*hell));
hell_mutex = scm_make_mutex ();
- create_basic_classes ();
- create_standard_classes ();
- create_smob_classes ();
- create_struct_classes ();
- create_port_classes ();
+#include "libguile/goops.x"
- {
- SCM name = scm_from_latin1_symbol ("no-applicable-method");
- scm_no_applicable_method =
- scm_make (scm_list_3 (scm_class_generic, k_name, name));
- scm_module_define (scm_module_goops, name, scm_no_applicable_method);
- }
+ var_compute_cpl =
+ scm_module_variable (scm_module_goops, sym_compute_cpl);
}
void
diff --git a/module/oop/goops.scm b/module/oop/goops.scm
index dfe4d6c..efa9f03 100644
--- a/module/oop/goops.scm
+++ b/module/oop/goops.scm
@@ -207,6 +207,9 @@
(use-modules ((language tree-il primitives) :select
(add-interesting-primitive!)))
(add-interesting-primitive! 'class-of))
+(eval-when (compile load eval)
+ (%goops-early-init))
+
;; Then load the rest of GOOPS
(use-modules (oop goops util)
(oop goops dispatch)
- [Guile-commits] branch wip-goops-refactor updated (c89d0c5 -> def60ff), Andy Wingo, 2015/01/22
- [Guile-commits] 01/87: %compute-applicable-methods in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 05/87: More useless goops.c code removal, Andy Wingo, 2015/01/22
- [Guile-commits] 07/87: %init-goops-builtins is an extension, not a global, Andy Wingo, 2015/01/22
- [Guile-commits] 03/87: Rewrite %method-more-specific? to be in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 10/87: Remove declarations without definitions, Andy Wingo, 2015/01/22
- [Guile-commits] 08/87: Preparation for more GOOPS refactorings,
Andy Wingo <=
- [Guile-commits] 09/87: Remove unused %fast-slot-ref / %fast-slot-set! from GOOPS, Andy Wingo, 2015/01/22
- [Guile-commits] 02/87: Deprecate C interfaces scm_compute_applicable_methods, scm_find_method, Andy Wingo, 2015/01/22
- [Guile-commits] 12/87: Deprecate scm_basic_make_class, Andy Wingo, 2015/01/22
- [Guile-commits] 04/87: Remove unused macros in goops.c, Andy Wingo, 2015/01/22
- [Guile-commits] 06/87: compute-cpl implementation only in Scheme, Andy Wingo, 2015/01/22
- [Guile-commits] 13/87: `class' is a hygienic macro, Andy Wingo, 2015/01/22
- [Guile-commits] 14/87: define-generic, define-extended-generic are hygienic syntax, Andy Wingo, 2015/01/22
- [Guile-commits] 15/87: Remove unused *goops-module* definition., Andy Wingo, 2015/01/22
- [Guile-commits] 17/87: Remove unused scm_t_method and SCM_METHOD, Andy Wingo, 2015/01/22
- [Guile-commits] 20/87: Remove useless scm_s_slot_set_x export, Andy Wingo, 2015/01/22