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];
79 arg_dir (int a, int b)
88 int function_argument_direction;
92 function_argument_direction = arg_dir (2,3);
94 ly_add_type_predicate ((void*) &scm_is_integer, "integer");
95 ly_add_type_predicate ((void*) &scm_is_bool, "boolean");
96 ly_add_type_predicate ((void*) &scm_is_pair, "pair");
97 ly_add_type_predicate ((void*) &is_number_pair, "number pair");
98 ly_add_type_predicate ((void*) &scm_is_number, "number");
99 ly_add_type_predicate ((void*) &scm_is_string, "string");
100 ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
101 ly_add_type_predicate ((void*) &scm_is_vector, "vector");
102 ly_add_type_predicate ((void*) &is_axis, "axis");
105 ADD_SCM_INIT_FUNC(func_doc, init_func_doc);