diff --git a/ffi-tools/ffi-tools.h b/ffi-tools/ffi-tools.h index 9842d4f..bf1b21c 100644 --- a/ffi-tools/ffi-tools.h +++ b/ffi-tools/ffi-tools.h @@ -1,6 +1,9 @@ #include #include "scheme48.h" +/* kludges */ +#define FIXED_S48_RECORD_TYPE(x) (s48_stob_ref((x), S48_STOBTYPE_RECORD, 0)) + /* variables */ static s48_value scheme_list_length_function = S48_FALSE; static s48_value scheme_boolean_p_function = S48_FALSE; @@ -34,13 +37,10 @@ void ffit_init_hook(void); S48_GC_PROTECT_GLOBAL(C_RECTYPE); \ C_RECTYPE = s48_get_imported_binding("SCM_NAME"); -#if 0 -#define FFIT_CHECK_RECORD_TYPE(SCM_VAL, SCM_RECTYPE) \ - if (!(S48_RECORD_P(SCM_VAL) && (S48_RECORD_TYPE(SCM_VAL) == SCM_RECTYPE))) \ +#define FFIT_CHECK_RECORD_TYPE(SCM_VAL, SCM_RECTYPE) \ + if (!(S48_RECORD_P(SCM_VAL) && \ + (FIXED_S48_RECORD_TYPE(SCM_VAL) == SCM_RECTYPE))) \ s48_raise_argument_type_error(SCM_VAL) -#endif - -#define FFIT_CHECK_RECORD_TYPE(SCM_VAL, SCM_RECTYPE) ; #define FFIT_STRUCT_GET(FUNNAME, SCM_RECTYPE, C_RECTYPE, C_FIELD, FIELD_SCM_ENTER_FUN) \ s48_value FUNNAME(s48_value scm_rec) { \