]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/function-documentation.cc
* lily/include/group-interface.hh (extract_grob_array): rename
[lilypond.git] / lily / function-documentation.cc
index 62740cdd1a42ffa2358f58ec5b23e517ad1695cd..5e57203fc2e55902e654d99e79ef1f5589c1f8ce 100644 (file)
@@ -1,23 +1,42 @@
-#include "lily-guile.hh"
+/*   
+  function-documentation.cc -- Scheme doc strings.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include <cstring>
+
 #include "protected-scm.hh"
+#include "string.hh"
 
 static Protected_scm doc_hash_table ;
 
-void ly_add_function_documentation (char const * fname,
+void ly_add_function_documentation (SCM func,
+                                   char const * fname,
                                    char const * varlist,
                                    char const * doc)
 {
-  if (!gh_vector_p (doc_hash_table ))
-    doc_hash_table = scm_make_vector (gh_int2scm (59), SCM_EOL);
+  if (!strlen (doc))
+    return;
+    
+  if (!scm_is_vector (doc_hash_table))
+    doc_hash_table = scm_make_vector (scm_int2num (59), SCM_EOL);
 
+  String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
+    + "\n" + doc ;
 
-  SCM entry = gh_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
+  scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
+                               scm_makfrom0str (s.to_str0 ()));
+  SCM entry = scm_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
   scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry);
 }
 
 
-LY_DEFINE(ly_get_all_function_documentation, "ly-get-all-function-documentation",
-         0,0,0, (),
+LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
+         0, 0, 0, (),
          "Get a hash table with all lilypond Scheme extension functions.")
 {
   return doc_hash_table;