]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scm-option.cc
* lily/scores.cc (Input_file_settings): Initalize global_header_.
[lilypond.git] / lily / scm-option.cc
index 2eac1482aca2df84441d60cfb0a720e54163d4db..ab4e73f1cacdfc760f592efb484cc897567e5b4b 100644 (file)
@@ -6,12 +6,12 @@
   (c) 2001--2002  Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+#include <stdio.h>
 
-#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 +40,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 +50,22 @@ 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
+@item internal-type-checking
+Set paranoia for property assignments 
+@end table
+
+This function is useful to call from the command line: @code{lilypond -e
+\"(set-lily-option 'midi-debug #t)\"}.
+")
 {
   /*
     Scheme option usage:
@@ -62,7 +73,7 @@ set_lily_option (SCM var, SCM val)
    */
   if (var == ly_symbol2scm ("help"))
     {
-      cout << _("lilypond -e EXPR means
+      printf ( _("lilypond -e EXPR means
 
 evalute EXPR as Scheme after init.scm has been read.  In particular,
 the function set-lily-option allows for access to some internal
@@ -71,13 +82,12 @@ variables. Usage:
   (set-lily-option SYMBOL VAL)
 
 possible options for SYMBOL are :
-")<<endl;
-      
-      cout << "  help (any-symbol)"<<endl; 
-      cout << "  internal-type-checks #t"<<endl; 
-      cout << "  midi-debug (boolean)"<<endl; 
-      cout << "  testing-level (int)"<<endl; 
-
+").to_str0 ());
+      printf ( "  help (any-symbol)\n"
+              "  internal-type-checking (boolean)\n"
+              "  midi-debug (boolean)\n"
+              "  testing-level (int)\n");
+              
       exit (0);
     }
   else if (var == ly_symbol2scm ("midi-debug"))
@@ -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);