SCM scm_make_foreign_object_n (SCM type, size_t n, void *vals[]) #define FUNC_NAME "make-foreign-object" { SCM obj; SCM layout; size_t i; const char *layout_chars; SCM_VALIDATE_VTABLE (SCM_ARG1, type); layout = SCM_VTABLE_LAYOUT (type); if (scm_i_symbol_length (layout) / 2 < n) scm_out_of_range (FUNC_NAME, scm_from_size_t (n)); layout_chars = scm_i_symbol_chars (layout); for (i = 0; i < n; i++) if (layout_chars[i * 2] != 'u') scm_wrong_type_arg_msg (FUNC_NAME, 0, layout, "'u' field"); obj = scm_c_make_structv (type, 0, 0, NULL); for (i = 0; i < n; i++) SCM_STRUCT_DATA_SET (obj, i, (scm_t_bits) vals[i]); return obj; }
SCM scm_make_foreign_object_n (SCM type, size_t n, void *vals[]) #define FUNC_NAME "make-foreign-object" { SCM obj; size_t i; SCM_VALIDATE_VTABLE (SCM_ARG1, type); if (SCM_VTABLE_SIZE (type) / 2 < n) scm_out_of_range (FUNC_NAME, scm_from_size_t (n)); for (i = 0; i < n; i++) if (!SCM_VTABLE_FIELD_IS_UNBOXED (type, i)) scm_wrong_type_arg_msg (FUNC_NAME, 0, type, "foreign object type"); obj = scm_c_make_structv (type, 0, 0, NULL); for (i = 0; i < n; i++) SCM_STRUCT_DATA_SET (obj, i, (scm_t_bits) vals[i]); return obj; }