X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscm-option.cc;h=ab4e73f1cacdfc760f592efb484cc897567e5b4b;hb=b592e19981c26c381a4347a615f97abbd0838666;hp=666f08c5759e6af61129b7aa9ff65fd2c1d27ed1;hpb=9943c08d29026b5a582e15d661c9a0d0b5e37501;p=lilypond.git diff --git a/lily/scm-option.cc b/lily/scm-option.cc index 666f08c575..ab4e73f1ca 100644 --- a/lily/scm-option.cc +++ b/lily/scm-option.cc @@ -3,40 +3,44 @@ source file of the GNU LilyPond music typesetter - (c) 2001 Han-Wen Nienhuys + (c) 2001--2002 Han-Wen Nienhuys */ +#include -#include #include "string.hh" #include "lily-guile.hh" #include "scm-option.hh" +#include "warn.hh" /* - TODO: mooie onschuldige test, en koel om allerleide dingen te kunnen zetten, - maar is dit nou wel handig voor gebruikert? + This interface to option setting is meant for setting options are + useful to a limited audience. The reason for this interface is that + making command line options clutters up the command-line option name + space. - -X, of -fps is hendiger dan - -e "(set-lily-option 'midi-debug #t)' - - [niet voor niets tiepo in 139 announs..] - -*/ + preferably, also dont use TESTING_LEVEL_GLOBAL, since it defeats + another purpose of this very versatile interface, which is to + support multiple debug/testing options concurrently. + + */ /* Write midi as formatted ascii stream? */ bool midi_debug_global_b; + /* General purpose testing flag */ int testing_level_global; - /* + crash if internally the wrong type is used for a grob property. + */ +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 @@ -46,17 +50,44 @@ 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: + lilypond -e "(set-lily-option 'help 0)" + */ if (var == ly_symbol2scm ("help")) { - cout << '\n'; - cout << _ ("Scheme options:"); - cout << "help"; - cout << "midi-debug (boolean)"; - cout << "testing-level (int)"; - cout << '\n'; + 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 +variables. Usage: + + (set-lily-option SYMBOL VAL) + +possible options for SYMBOL are : +").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")) @@ -67,6 +98,10 @@ set_lily_option (SCM var, SCM val) { testing_level_global = gh_scm2int (val); } + else if (var == ly_symbol2scm ("internal-type-checking")) + { + internal_type_checking_global_b = to_boolean (val); + } else if (var == ly_symbol2scm ("find-old-relative")) { /* @@ -80,20 +115,16 @@ set_lily_option (SCM var, SCM val) */ ; - } + else + { + warning (_("Unknown internal option!")); + } + return SCM_UNSPECIFIED; } -static void -init_functions () -{ - scm_make_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option); -} - - -ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions);