Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
Use scm_memory_error instead of SCM_NALLOC.
+** Removed function: scm_struct_init
+
** Deprecated function: scm_call_catching_errors
Use scm_catch or scm_lazy_catch from throw.[ch] instead.
+2000-07-26 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * struct.[ch] (scm_struct_init): Made static. Fixed not to rely
+ on the struct cell to be fully initialized.
+
+ * struct.c (scm_make_struct, scm_make_vtable_vtable): Fix the
+ initialization order of the struct such that the type cell is
+ initialized last.
+
2000-07-25 Marius Vollmer <mvo@zagadka.ping.de>
* alist.c (scm_assq_remove_x, scm_assv_remove_x,
-void
-scm_struct_init (SCM handle, int tail_elts, SCM inits)
+static void
+scm_struct_init (SCM handle, SCM layout, scm_bits_t * mem, int tail_elts, SCM inits)
{
- SCM layout = SCM_STRUCT_LAYOUT (handle);
unsigned char * fields_desc = (unsigned char *) SCM_CHARS (layout) - 2;
unsigned char prot = 0;
int n_fields = SCM_LENGTH (layout) / 2;
- scm_bits_t * mem = SCM_STRUCT_DATA (handle);
int tailp = 0;
while (n_fields)
scm_struct_n_extra_words,
"make-struct");
SCM_SET_CELL_WORD_1 (handle, data);
+ scm_struct_init (handle, layout, data, tail_elts, init);
SCM_SET_CELL_WORD_0 (handle, (scm_bits_t) SCM_STRUCT_DATA (vtable) + scm_tc3_cons_gloc);
- scm_struct_init (handle, tail_elts, init);
SCM_ALLOW_INTS;
return handle;
}
scm_struct_n_extra_words,
"make-vtable-vtable");
SCM_SET_CELL_WORD_1 (handle, data);
+ data [scm_vtable_index_layout] = SCM_UNPACK (layout);
+ scm_struct_init (handle, layout, data, tail_elts, scm_cons (layout, init));
SCM_SET_CELL_WORD_0 (handle, (scm_bits_t) data + scm_tc3_cons_gloc);
- SCM_SET_STRUCT_LAYOUT (handle, layout);
- scm_struct_init (handle, tail_elts, scm_cons (layout, init));
SCM_ALLOW_INTS;
return handle;
}
extern scm_sizet scm_struct_free_light (scm_bits_t * vtable, scm_bits_t * data);
extern scm_sizet scm_struct_free_standard (scm_bits_t * vtable, scm_bits_t * data);
extern scm_sizet scm_struct_free_entity (scm_bits_t * vtable, scm_bits_t * data);
-extern void scm_struct_init (SCM handle, int tail_elts, SCM inits);
extern SCM scm_make_struct_layout (SCM fields);
extern SCM scm_struct_p (SCM x);
extern SCM scm_struct_vtable_p (SCM x);