]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scm-option.cc
Add cautionary-style to interface.
[lilypond.git] / lily / scm-option.cc
index 2eac1482aca2df84441d60cfb0a720e54163d4db..e924020aa78624e2e7fa332c23fe054b45d05849 100644 (file)
@@ -8,10 +8,11 @@
  */
 
 #include <iostream.h>
+
 #include "string.hh"
 #include "lily-guile.hh"
 #include "scm-option.hh"
-
+#include "warn.hh"
 
 /*
   This interface to option setting is meant for setting options are
@@ -40,10 +41,7 @@ bool internal_type_checking_global_b;
 
 /*
 
-  TODO: verzin iets tegen optie code bloot
-
-
-  other interesting stuff to add:
+add these as well:
 
 @item -T,--no-timestamps
 don't timestamp the output
@@ -53,8 +51,20 @@ Switch on any experimental features.  Not for general public use.
 
  */
 
-SCM
-set_lily_option (SCM var, SCM val)
+LY_DEFINE(set_lily_option,"set-lily-option", 2, 0, 0,  (SCM var, SCM val),
+         "Set a global option for the program. Supported options  include
+
+
+@table @code
+@item help
+List all options.
+@item midi-debug
+If set to true, generate human  readable MIDI
+@end table
+
+This function is useful to call from the command line: @code{lilypond -e
+\"(set-lily-option 'midi-debug #t)\"}.
+")
 {
   /*
     Scheme option usage:
@@ -71,10 +81,10 @@ variables. Usage:
   (set-lily-option SYMBOL VAL)
 
 possible options for SYMBOL are :
-")<<endl;
+").ch_C()<<endl;
       
       cout << "  help (any-symbol)"<<endl; 
-      cout << "  internal-type-checks #t"<<endl; 
+      cout << "  internal-type-checking (boolean)"<<endl; 
       cout << "  midi-debug (boolean)"<<endl; 
       cout << "  testing-level (int)"<<endl; 
 
@@ -88,7 +98,7 @@ possible options for SYMBOL are :
     {
      testing_level_global = gh_scm2int (val); 
     }
-  else if (var == ly_symbol2scm ("internal-type-checks"))
+  else if (var == ly_symbol2scm ("internal-type-checking"))
     {
      internal_type_checking_global_b = to_boolean (val); 
     }
@@ -105,20 +115,16 @@ possible options for SYMBOL are :
       */
 
       ;
-      
     }
+  else
+    {
+      warning (_("Unknown internal option!"));
+    }
+  
 
   return SCM_UNSPECIFIED;
 }
 
 
-static void
-init_functions ()
-{
-  scm_c_define_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option);
-}
-
-
-ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions);