1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

* struct.c (scm_make_struct_layout, init_struct, scm_struct_ref,

scm_struct_set_x), struct.h, gc.c (scm_gc_mark): Completed Tom
Lord's implementation of structs, allowing for tail arrays as
described in the manual. Also fixed some bugs. (Both the interface
and the implementation should be improved.)
This commit is contained in:
Mikael Djurfeldt 1996-09-22 22:38:56 +00:00
parent 90b826c925
commit 2c36c351d0
2 changed files with 99 additions and 46 deletions

View file

@ -48,6 +48,9 @@
/* Number of words with negative index */
#define scm_struct_n_extra_words 2
/* These are how the initial words of a vtable are allocated. */
#define scm_struct_i_n_words -2 /* How many words allocated to this struct? */
#define scm_struct_i_tag -1 /* A unique tag for this type.. */
@ -62,6 +65,8 @@
#define SCM_STRUCT_VTABLE_DATA(X) ((SCM *)(SCM_CAR(X) - 1))
#define SCM_STRUCT_LAYOUT(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_struct_i_layout])
#define SCM_STRUCT_VTABLE(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_struct_i_vtable])
/* Efficiency is important in the following macro, since it's used in GC */
#define SCM_LAYOUT_TAILP(X) (((X) & 32) == 0) /* R, W or O */