X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fscm-option.cc;h=d05f3a06f94798fab16484505c85940ab7551023;hb=b9955d706ca6f136b160f0611db85c6bdf0fea9b;hp=fca566f9bde50e8602b89f29d3b337b974973faa;hpb=91ad96d55a9848ab482d0946987aaa68af76d357;p=lilypond.git diff --git a/lily/scm-option.cc b/lily/scm-option.cc index fca566f9bd..d05f3a06f9 100644 --- a/lily/scm-option.cc +++ b/lily/scm-option.cc @@ -3,12 +3,12 @@ source file of the GNU LilyPond music typesetter - (c) 2001--2002 Han-Wen Nienhuys + (c) 2001--2003 Han-Wen Nienhuys */ +#include -#include - +#include "parse-scm.hh" #include "string.hh" #include "lily-guile.hh" #include "scm-option.hh" @@ -39,56 +39,60 @@ int testing_level_global; */ bool internal_type_checking_global_b; -/* +LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (SCM), + "Print ly-set-option usage") +{ + printf ( _("lilypond -e EXPR means:").to_str0 ()); + puts (""); + printf (_ (" Evalute the Scheme EXPR before parsing any .ly files.").to_str0 ()); + puts (""); + printf (_ (" Multiple -e options may be given, they will be evaluated sequentially.").to_str0 ()); + puts (""); + printf (_(" The function ly-set-option allows for access to some internal variables.").to_str0 ()); + puts ("\n"); + printf (_ ("Usage: lilypond -e \"(ly-set-option SYMBOL VAL)\"").to_str0 ()); + puts ("\n"); + printf (_ ("Where SYMBOL VAL pair is any of:").to_str0 ()); + puts (""); + printf ( " help ANY-SYMBOL\n" + " internal-type-checking BOOLEAN\n" + " midi-debug BOOLEAN\n" + " parse-protect BOOLEAN\n" + " testing-level INTEGER\n"); + + exit (0); + return SCM_UNSPECIFIED; +} -add these as well: +/* Add these as well: @item -T,--no-timestamps don't timestamp the output @item -t,--test -Switch on any experimental features. Not for general public use. - - */ - -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)\"}. -") +Switch on any experimental features. Not for general public use. */ +LY_DEFINE (ly_set_option, "ly:set-option", 2, 0, 0, (SCM var, SCM val), + "Set a global option value. Supported options include\n" +"\n" +"@table @code\n" +"@item help\n" +"List all options.\n" +"@item midi-debug\n" +"If set to true, generate human readable MIDI\n" +"@item internal-type-checking\n" +"Set paranoia for property assignments\n" +"@item parse-protect\n" +"If protection is switched on, errors in inline scheme are caught in the parser. \n" +"If off, GUILE will halt on errors, and give a stack trace. Default is protected evaluation. \n" +"@end table\n" +"\n" +"This function is useful to call from the command line: @code{lilypond -e\n" +"\"(ly-set-option 'midi-debug #t)\"}.\n") { - /* - Scheme option usage: - lilypond -e "(set-lily-option 'help 0)" - */ if (var == ly_symbol2scm ("help")) { - std::cout << _("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 -variables. Usage: - - (set-lily-option SYMBOL VAL) - -possible options for SYMBOL are : -").ch_C()<< std::endl; - - std::cout << " help (any-symbol)"<< std::endl; - std::cout << " internal-type-checking (boolean)"<< std::endl; - std::cout << " midi-debug (boolean)"<< std::endl; - std::cout << " testing-level (int)"<< std::endl; - - exit (0); + /* lilypond -e "(ly-set-option 'help #t)" */ + ly_option_usage (SCM_EOL); } else if (var == ly_symbol2scm ("midi-debug")) { @@ -98,6 +102,10 @@ possible options for SYMBOL are : { testing_level_global = gh_scm2int (val); } + else if (var == ly_symbol2scm ("parse-protect" )) + { + parse_protect_global = to_boolean(val); + } else if (var == ly_symbol2scm ("internal-type-checking")) { internal_type_checking_global_b = to_boolean (val); @@ -113,18 +121,14 @@ possible options for SYMBOL are : */ - ; } else { warning (_("Unknown internal option!")); } - return SCM_UNSPECIFIED; } - -