]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/program-option.cc
fix midi lengths for drum notes too.
[lilypond.git] / lily / program-option.cc
index b12a246f311f8ae023d0a4b8aa31f0a82afe3877..8f593aaa393c3d9e8a8a28bbd3fecd25a258914b 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2001--2006  Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2001--2007  Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "program-option.hh"
@@ -12,6 +12,7 @@
 #include <cstring>
 using namespace std;
 
+#include "profile.hh"
 #include "international.hh"
 #include "main.hh"
 #include "parse-scm.hh"
@@ -20,7 +21,7 @@ using namespace std;
 
 /* Write midi as formatted ascii stream? */
 bool do_midi_debugging_global;
-bool use_object_keys;
+bool debug_skylines;
 
 /*
   Backwards compatibility.
@@ -34,7 +35,6 @@ bool profile_property_accesses = false;
 bool do_internal_type_checking_global;
 bool strict_infinity_checking = false; 
 
-
 static SCM option_hash;
 
 void internal_set_option (SCM var, SCM val)
@@ -73,6 +73,11 @@ void internal_set_option (SCM var, SCM val)
       parsed_objects_should_be_dead = to_boolean (val);
       val = scm_from_bool (parsed_objects_should_be_dead);
     }
+  else if (var == ly_symbol2scm ("safe"))
+    {
+      be_safe_global = to_boolean (val);
+      val = scm_from_bool (be_safe_global);
+    }
   else if (var == ly_symbol2scm ("old-relative"))
     {
       lily_1_8_relative = to_boolean (val);
@@ -80,14 +85,14 @@ void internal_set_option (SCM var, SCM val)
       lily_1_8_compatibility_used = to_boolean (val);
       val = scm_from_bool (to_boolean (val));
     }
-  else if (var == ly_symbol2scm ("object-keys"))
+  else if (var == ly_symbol2scm ("strict-infinity-checking"))
     {
-      use_object_keys = to_boolean (val);
+      strict_infinity_checking = to_boolean (val);
       val = scm_from_bool (to_boolean (val));
     }
-  else if (var == ly_symbol2scm ("strict-infinity-checking"))
+  else if (var == ly_symbol2scm ("debug-skylines"))
     {
-      strict_infinity_checking = to_boolean (val);
+      debug_skylines = to_boolean (val);
       val = scm_from_bool (to_boolean (val));
     }
 }
@@ -147,12 +152,11 @@ get_help_string ()
 }
 
 LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
-          "Print ly:set-option usage")
+          "Print @code{ly:set-option} usage")
 {
   string help = get_help_string ();
-  fputs (help.c_str (), stdout);
+  progress_indication (help);
 
-  exit (0);
   return SCM_UNSPECIFIED;
 }
 
@@ -183,7 +187,10 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
                   __FUNCTION__, "symbol");
 
   if (ly_symbol2scm ("help") == var)
-    ly_option_usage ();
+    {
+      ly_option_usage ();
+      exit (0);
+    }
 
   if (val == SCM_UNDEFINED)
     val = SCM_BOOL_T;
@@ -203,12 +210,34 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
   return SCM_UNSPECIFIED;
 }
 
+LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (),
+          "The Scheme specified on command-line with @samp{-d}.")
+{
+  return ly_string2scm (init_scheme_variables_global); 
+}
+
+LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (),
+          "The Scheme specified on command-line with @samp{-e}.")
+{
+  return ly_string2scm (init_scheme_code_global); 
+}
+
 LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (),
           "Was be_verbose_global set?")
 {
   return scm_from_bool (be_verbose_global);
 }
 
+
+
+LY_DEFINE (ly_all_option, "ly:all-options",
+          0, 0, 0, (),
+          "Get all option settings in an alist.")
+{
+  return ly_hash2alist (option_hash);
+}
+
+
 LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
           "Get a global option setting.")
 {
@@ -216,3 +245,13 @@ LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
                   SCM_ARG1, __FUNCTION__, "symbol");
   return scm_hashq_ref (option_hash, var, SCM_BOOL_F);
 }
+
+
+
+bool
+get_program_option (const char *s)
+{
+  SCM sym = ly_symbol2scm (s);
+
+  return to_boolean (ly_get_option (sym));
+}