2 function-documentation.cc -- Scheme doc strings.
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "std-string.hh"
13 #include "lily-guile.hh"
16 static SCM doc_hash_table;
19 ly_check_name (string cxx, string scm_name)
21 string mangle = mangle_cxx_identifier (cxx);
22 if (mangle != scm_name)
24 programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name);
30 ly_add_function_documentation (SCM func,
39 doc_hash_table = scm_permanent_object (scm_c_make_hash_table (59));
41 string s = string (" - ") + "LilyPond procedure: " + fname + " " + varlist
44 scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
46 SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc));
47 scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str()), entry);
50 LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
52 "Get a hash table with all lilypond Scheme extension functions.")
54 return doc_hash_table;
60 map<void *, string> type_names;
63 ly_add_type_predicate (void *ptr,
66 type_names[ptr] = name;
70 predicate_to_typename (void *ptr)
72 if (type_names.find (ptr) == type_names.end ())
73 return "unknown type";
75 return type_names[ptr];