diff --git a/libguile/print.c b/libguile/print.c index 8aed00228..93c545062 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -320,9 +320,7 @@ taloop: if (SCM_CDR (SCM_CAR (exp) - 1L) == 0) { - scm_gen_write (scm_regular_string, "#', port); + scm_print_struct (exp, port, pstate); break; } diff --git a/libguile/struct.c b/libguile/struct.c index 525df2638..6f2261ec5 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -43,6 +43,7 @@ #include #include "_scm.h" #include "chars.h" +#include "genio.h" #include "struct.h" @@ -434,7 +435,7 @@ scm_struct_ref (handle, pos) p = SCM_INUM (pos); fields_desc = (unsigned char *)SCM_CHARS (layout); - n_fields = data[- scm_struct_n_extra_words] - scm_struct_n_extra_words; + n_fields = data[scm_struct_i_n_words] - scm_struct_n_extra_words; SCM_ASSERT (p < n_fields, pos, SCM_OUTOFRANGE, s_struct_ref); @@ -516,7 +517,7 @@ scm_struct_set_x (handle, pos, val) p = SCM_INUM (pos); fields_desc = (unsigned char *)SCM_CHARS (layout); - n_fields = data[- scm_struct_n_extra_words] - scm_struct_n_extra_words; + n_fields = data[scm_struct_i_n_words] - scm_struct_n_extra_words; SCM_ASSERT (p < n_fields, pos, SCM_OUTOFRANGE, s_struct_set_x); @@ -595,6 +596,41 @@ scm_struct_vtable_tag (handle) +void +scm_print_struct (exp, port, pstate) + SCM exp; + SCM port; + scm_print_state *pstate; +{ +#if 0 /* XXX - too verbose */ + SCM * data; + SCM layout; + int p; + int n_fields; + unsigned char * fields_desc; + unsigned char field_type; + + layout = SCM_STRUCT_LAYOUT (exp); + data = SCM_STRUCT_DATA (exp); + + fields_desc = (unsigned char *)SCM_CHARS (layout); + n_fields = data[scm_struct_i_n_words] - scm_struct_n_extra_words; + + scm_gen_write (scm_regular_string, "#', port); +#else + scm_gen_write (scm_regular_string, "#', port); +#endif +} void scm_init_struct () diff --git a/libguile/struct.h b/libguile/struct.h index 545a41c9f..e0d0f66d9 100644 --- a/libguile/struct.h +++ b/libguile/struct.h @@ -45,6 +45,7 @@ #include "libguile/__scm.h" +#include "libguile/print.h" @@ -81,6 +82,7 @@ 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_print_struct SCM_P ((SCM exp, SCM port, scm_print_state *)); extern void scm_init_struct SCM_P ((void)); #endif /* STRUCTH */