]> git.donarmstrong.com Git - lilypond.git/blob - lily/function-documentation.cc
Compile fix: Include <string.h>.
[lilypond.git] / lily / function-documentation.cc
1 /*   
2   function-documentation.cc -- 
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #include <string.h>
11
12 #include "lily-guile.hh"
13 #include "protected-scm.hh"
14 #include "string.hh"
15
16 static Protected_scm doc_hash_table ;
17
18 void ly_add_function_documentation (SCM func,
19                                     char const * fname,
20                                     char const * varlist,
21                                     char const * doc)
22 {
23   if (!strlen (doc))
24     return ; 
25     
26   if (!gh_vector_p (doc_hash_table ))
27     doc_hash_table = scm_make_vector (gh_int2scm (59), SCM_EOL);
28
29   String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
30     + "\n" + doc ;
31
32   scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
33                                 scm_makfrom0str (s.to_str0 ()));
34   SCM entry = gh_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
35   scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry);
36 }
37
38
39 LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
40           0,0,0, (),
41           "Get a hash table with all lilypond Scheme extension functions.")
42 {
43   return doc_hash_table;
44 }