summaryrefslogtreecommitdiff
path: root/libguile/goops.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-01-11 00:17:22 +0100
committerAndy Wingo <wingo@pobox.com>2015-01-23 16:16:01 +0100
commit4a28ef1086a1fa6c890f7306ca81161cdd817119 (patch)
tree3a9139ccd68c34bb57dc4ca1a6d148466d1b13d9 /libguile/goops.c
parentf6088819c8b010fc20811131f8fce0dd67a6bf74 (diff)
downloadguile-4a28ef1086a1fa6c890f7306ca81161cdd817119.tar.gz
Rewrite %initialize-object in Scheme
* libguile/goops.h: * libguile/goops.c (scm_sys_initialize_object): Remove C interface. This function was only really useful as part of a GOOPS initialize method but was not exported from the goops module. * module/oop/goops.scm (get-keyword, %initialize-object): Implement in Scheme.
Diffstat (limited to 'libguile/goops.c')
-rw-r--r--libguile/goops.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/libguile/goops.c b/libguile/goops.c
index d722e0dde..ce07686a2 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -332,74 +332,6 @@ SCM_DEFINE (scm_get_keyword, "get-keyword", 3, 0, 0,
SCM_KEYWORD (k_init_keyword, "init-keyword");
-SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0,
- (SCM obj, SCM initargs),
- "Initialize the object @var{obj} with the given arguments\n"
- "@var{initargs}.")
-#define FUNC_NAME s_scm_sys_initialize_object
-{
- SCM tmp, get_n_set, slots;
- SCM class = SCM_CLASS_OF (obj);
- long n_initargs;
-
- SCM_VALIDATE_INSTANCE (1, obj);
- n_initargs = scm_ilength (initargs);
- SCM_ASSERT ((n_initargs & 1) == 0, initargs, SCM_ARG2, FUNC_NAME);
-
- get_n_set = SCM_SLOT (class, scm_si_getters_n_setters);
- slots = SCM_SLOT (class, scm_si_slots);
-
- /* See for each slot how it must be initialized */
- for (;
- !scm_is_null (slots);
- get_n_set = SCM_CDR (get_n_set), slots = SCM_CDR (slots))
- {
- SCM slot_name = SCM_CAR (slots);
- SCM slot_value = SCM_GOOPS_UNBOUND;
-
- if (!scm_is_null (SCM_CDR (slot_name)))
- {
- /* This slot admits (perhaps) to be initialized at creation time */
- long n = scm_ilength (SCM_CDR (slot_name));
- if (n & 1) /* odd or -1 */
- SCM_MISC_ERROR ("class contains bogus slot definition: ~S",
- scm_list_1 (slot_name));
- tmp = scm_i_get_keyword (k_init_keyword,
- SCM_CDR (slot_name),
- n,
- SCM_PACK (0),
- FUNC_NAME);
- slot_name = SCM_CAR (slot_name);
- if (SCM_UNPACK (tmp))
- {
- /* an initarg was provided for this slot */
- if (!scm_is_keyword (tmp))
- SCM_MISC_ERROR ("initarg must be a keyword. It was ~S",
- scm_list_1 (tmp));
- slot_value = scm_i_get_keyword (tmp,
- initargs,
- n_initargs,
- SCM_GOOPS_UNBOUND,
- FUNC_NAME);
- }
- }
-
- if (!SCM_GOOPS_UNBOUNDP (slot_value))
- /* set slot to provided value */
- scm_slot_set_x (obj, slot_name, slot_value);
- else
- {
- /* set slot to its :init-form if it exists */
- tmp = SCM_CADAR (get_n_set);
- if (scm_is_true (tmp))
- scm_slot_set_x (obj, slot_name, scm_call_0 (tmp));
- }
- }
-
- return obj;
-}
-#undef FUNC_NAME
-
SCM_DEFINE (scm_sys_init_layout_x, "%init-layout!", 2, 0, 0,
(SCM class, SCM layout),
"")