- if (val != SCM_EOL
- && ly_is_procedure (type)
- && scm_call_1 (type, val) == SCM_BOOL_F)
- {
- ok = false;
- SCM typefunc = ly_lily_module_constant ("type-name");
- SCM type_name = scm_call_1 (typefunc, type);
-
- warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'",
- ly_symbol2string (sym).c_str (),
- print_scm_val (val),
- ly_scm2string (type_name).c_str ()));
- progress_indication ("\n");
- }
+ SCM type_name = Lily::type_name (type);
+
+ warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'",
+ ly_symbol2string (sym).c_str (),
+ print_scm_val (val),
+ ly_scm2string (type_name).c_str ()));
+ progress_indication ("\n");
+ return false;
+ }
+ return true;
+}
+
+void
+ly_wrong_smob_arg (bool pred (SCM), SCM var, int number, const char *fun)
+{
+ string type = predicate_to_typename ((void *) pred);
+ if (pred (var))
+ {
+ // Uh oh. unsmob<T> delivered 0, yet
+ // unsmob<T> delivers true. This means that unsmob<T> is a
+ // matching check from a base class of T, but var is of an
+ // incompatible derived type.
+ type = string (_ ("Wrong kind of ")).append (type);