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 /* type predicates. */
21 static SCM doc_hash_table;
24 ly_check_name (string cxx, string scm_name)
26 string mangle = mangle_cxx_identifier (cxx);
27 if (mangle != scm_name)
29 programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name);
35 ly_add_function_documentation (SCM func,
44 doc_hash_table = scm_permanent_object (scm_c_make_hash_table (59));
46 string s = string (" - ") + "LilyPond procedure: " + fname + " " + varlist
49 scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
51 SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc));
52 scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str()), entry);
55 LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
57 "Get a hash table with all lilypond Scheme extension functions.")
59 return doc_hash_table;
65 map<void *, string> type_names;
68 ly_add_type_predicate (void *ptr,
71 type_names[ptr] = name;
75 predicate_to_typename (void *ptr)
77 if (type_names.find (ptr) == type_names.end ())
78 return "unknown type";
80 return type_names[ptr];
84 arg_dir (int a, int b)
93 int function_argument_direction;
97 function_argument_direction = arg_dir (2,3);
99 ly_add_type_predicate ((void*) &scm_is_integer, "integer");
100 ly_add_type_predicate ((void*) &scm_is_bool, "boolean");
101 ly_add_type_predicate ((void*) &scm_is_pair, "pair");
102 ly_add_type_predicate ((void*) &is_number_pair, "number pair");
103 ly_add_type_predicate ((void*) &scm_is_number, "number");
104 ly_add_type_predicate ((void*) &scm_is_string, "string");
105 ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
106 ly_add_type_predicate ((void*) &scm_is_vector, "vector");
107 ly_add_type_predicate ((void*) &is_axis, "axis");
108 ly_add_type_predicate ((void*) &unsmob_spanner, "spanner");
109 ly_add_type_predicate ((void*) &unsmob_item, "item");
112 ADD_SCM_INIT_FUNC(func_doc, init_func_doc);