- bool ok = true;
- SCM type_p = SCM_EOL;
- SCM errport = scm_current_error_port ();
-
- if (gh_symbol_p(sym))
- type_p = scm_object_property (sym, type_symbol);
-
- if (type_p != SCM_EOL && !gh_procedure_p (type_p))
- {
- scm_puts (_("Couldn't find property type-check for `").ch_C(),errport);
- scm_puts (String ("'").ch_C(), errport);
- scm_display (sym, errport);
-
- scm_puts (_(". Perhaps you made a typing error?\n").ch_C(),errport);
- }
- else
- {
- if (val != SCM_EOL
- && gh_procedure_p (type_p)
- && gh_call1 (type_p, val) == SCM_BOOL_F)
- {
- ok = false;
- scm_puts (_("Failed typecheck for `").ch_C (),errport);
- scm_display (sym,errport);
- scm_puts ( _("', value `").ch_C (), errport);
- scm_write (val, errport);
- scm_puts (_("' must be of type ").ch_C (), errport);
- SCM typefunc = scm_eval2 (ly_symbol2scm ("type-name"), SCM_EOL);
- scm_display (gh_call1 (typefunc, type_p), errport);
- scm_puts ("\n", errport);
- }
- }
- return ok;