mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
* Fixed struct initialization.
This commit is contained in:
parent
8e2488ffae
commit
f762051048
4 changed files with 16 additions and 8 deletions
2
NEWS
2
NEWS
|
@ -79,6 +79,8 @@ SCM_ORD_SIG, SCM_NUM_SIGS
|
|||
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.
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
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,
|
||||
|
|
|
@ -148,14 +148,12 @@ SCM_DEFINE (scm_make_struct_layout, "make-struct-layout", 1, 0, 0,
|
|||
|
||||
|
||||
|
||||
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)
|
||||
|
@ -399,8 +397,8 @@ SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1,
|
|||
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;
|
||||
}
|
||||
|
@ -489,9 +487,9 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,6 @@ extern scm_sizet scm_struct_free_0 (scm_bits_t * vtable, scm_bits_t * data);
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue