]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/function-documentation.cc
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / function-documentation.cc
index 46dbbfe5720df38e3da4dc805feb8f4a057bbb2b..7e450528ae13e65813f26cbbd6baeba9fa61a6ef 100644 (file)
@@ -1,30 +1,42 @@
+/*
+  function-documentation.cc -- Scheme doc strings.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
+
+#include <cstring>
+using namespace std;
+
+#include "std-string.hh"
 #include "lily-guile.hh"
-#include "protected-scm.hh"
-#include "string.hh"
 
-static Protected_scm doc_hash_table ;
+static SCM doc_hash_table;
 
 void ly_add_function_documentation (SCM func,
-                                   char const * fname,
-                                   char const * varlist,
-                                   char const * doc)
+                                   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 (!doc_hash_table)
+    doc_hash_table = scm_permanent_object (scm_c_make_hash_table (59));
 
-  String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
-    + "\n" + doc ;
+  string s = string (" - ") + "LilyPond procedure: " + fname + " " + varlist
+    + "\n" + doc;
 
   scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
-                               scm_makfrom0str (s.to_str0 ()));
-  SCM entry = gh_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
+                               ly_string2scm (s));
+  SCM entry = scm_cons (scm_from_locale_string (varlist), scm_from_locale_string (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, (),
-         "Get a hash table with all lilypond Scheme extension functions.")
+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;
 }