+
+map<void *, string> type_names;
+
+void
+ly_add_type_predicate (void *ptr,
+ const string &name)
+{
+ type_names[ptr] = name;
+}
+
+string
+predicate_to_typename (void *ptr)
+{
+ if (type_names.find (ptr) == type_names.end ())
+ {
+ programming_error ("Unknown type predicate");
+ return "unknown type";
+ }
+ else
+ return type_names[ptr];
+}
+
+void
+init_func_doc ()
+{
+ ly_add_type_predicate ((void *) &is_direction, "direction");
+ ly_add_type_predicate ((void *) &ly_is_port, "port");
+ ly_add_type_predicate ((void *) &ly_cheap_is_list, "list");
+ ly_add_type_predicate ((void *) &unsmob<Global_context>, "Global_context");
+ ly_add_type_predicate ((void *) &unsmob<Paper_score>, "Paper_score");
+ ly_add_type_predicate ((void *) &unsmob<Performance>, "Performance");
+ ly_add_type_predicate ((void *) &is_axis, "axis");
+ ly_add_type_predicate ((void *) &is_number_pair, "number pair");
+ ly_add_type_predicate ((void *) &ly_is_list, "list");
+ ly_add_type_predicate ((void *) &ly_is_procedure, "procedure");
+ ly_add_type_predicate ((void *) &ly_is_symbol, "symbol");
+ ly_add_type_predicate ((void *) &scm_is_bool, "boolean");
+ ly_add_type_predicate ((void *) &scm_is_integer, "integer");
+ ly_add_type_predicate ((void *) &scm_is_number, "number");
+ ly_add_type_predicate ((void *) &scm_is_pair, "pair");
+ ly_add_type_predicate ((void *) &scm_is_rational, "rational");
+ ly_add_type_predicate ((void *) &scm_is_string, "string");
+ ly_add_type_predicate ((void *) &scm_is_vector, "vector");
+ ly_add_type_predicate ((void *) &unsmob<Item>, "Item");
+ ly_add_type_predicate ((void *) &unsmob<Music>, "Music");
+ ly_add_type_predicate ((void *) &unsmob<Spanner>, "Spanner");
+ ly_add_type_predicate ((void *) &unsmob<Stream_event>, "Stream_event");
+}
+
+ADD_SCM_INIT_FUNC (func_doc, init_func_doc);