]> git.donarmstrong.com Git - lilypond.git/blob - lily/function-documentation.cc
* scripts/lilypond-book.py (compose_ly): bugfix for relative < 0.
[lilypond.git] / lily / function-documentation.cc
1 #include "lily-guile.hh"
2 #include "protected-scm.hh"
3 #include "string.hh"
4
5 static Protected_scm doc_hash_table ;
6
7 void ly_add_function_documentation (SCM func,
8                                     char const * fname,
9                                     char const * varlist,
10                                     char const * doc)
11 {
12   if (!strlen (doc))
13     return ; 
14     
15   if (!gh_vector_p (doc_hash_table ))
16     doc_hash_table = scm_make_vector (gh_int2scm (59), SCM_EOL);
17
18   String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
19     + "\n" + doc ;
20
21   scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
22                                 scm_makfrom0str (s.to_str0 ()));
23   SCM entry = gh_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
24   scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry);
25 }
26
27
28 LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
29           0,0,0, (),
30           "Get a hash table with all lilypond Scheme extension functions.")
31 {
32   return doc_hash_table;
33 }