diff options
Diffstat (limited to 'libguile/struct.h')
-rw-r--r-- | libguile/struct.h | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/libguile/struct.h b/libguile/struct.h index b444e282b..e076a8aee 100644 --- a/libguile/struct.h +++ b/libguile/struct.h @@ -44,11 +44,15 @@ */ -#include "__scm.h" +#include "libguile/__scm.h" +/* Number of words with negative index */ +#define scm_struct_n_extra_words 3 + /* These are how the initial words of a vtable are allocated. */ +#define scm_struct_i_ptr -3 /* start of block (see alloc_struct) */ #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.. */ #define scm_struct_i_layout 0 /* A symbol describing the physical arrangement of this type. */ @@ -62,40 +66,21 @@ #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 */ -#ifdef __STDC__ -extern SCM scm_make_struct_layout (SCM fields); -extern SCM scm_struct_p (SCM x); -extern SCM scm_struct_vtable_p (SCM x); -extern SCM scm_make_struct (SCM vtable, SCM tail_array_size, SCM init); -extern SCM scm_make_vtable_vtable (SCM extra_fields, SCM tail_array_size, SCM init); -extern SCM scm_struct_ref (SCM handle, SCM pos); -extern SCM scm_struct_set_x (SCM handle, SCM pos, SCM val); -extern SCM scm_struct_vtable (SCM handle); -extern SCM scm_struct_vtable_tag (SCM handle); -extern void scm_init_struct (void); - -#else /* STDC */ -extern SCM scm_make_struct_layout (); -extern SCM scm_struct_p (); -extern SCM scm_struct_vtable_p (); -extern SCM scm_make_struct (); -extern SCM scm_make_vtable_vtable (); -extern SCM scm_struct_ref (); -extern SCM scm_struct_set_x (); -extern SCM scm_struct_vtable (); -extern SCM scm_struct_vtable_tag (); -extern void scm_init_struct (); - -#endif /* STDC */ - - - - - - +extern SCM scm_make_struct_layout SCM_P ((SCM fields)); +extern SCM scm_struct_p SCM_P ((SCM x)); +extern SCM scm_struct_vtable_p SCM_P ((SCM x)); +extern SCM scm_make_struct SCM_P ((SCM vtable, SCM tail_array_size, SCM init)); +extern SCM scm_make_vtable_vtable SCM_P ((SCM extra_fields, SCM tail_array_size, SCM init)); +extern SCM scm_struct_ref SCM_P ((SCM handle, SCM pos)); +extern SCM scm_struct_set_x SCM_P ((SCM handle, SCM pos, SCM val)); +extern SCM scm_struct_vtable SCM_P ((SCM handle)); +extern SCM scm_struct_vtable_tag SCM_P ((SCM handle)); +extern void scm_init_struct SCM_P ((void)); #endif /* STRUCTH */ |