2 scm-option.cc -- implement option setting from Scheme
4 source file of the GNU LilyPond music typesetter
6 (c) 2001--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "lily-guile.hh"
13 #include "scm-option.hh"
17 This interface to option setting is meant for setting options are
18 useful to a limited audience. The reason for this interface is that
19 making command line options clutters up the command-line option name
23 preferably, also dont use TESTING_LEVEL_GLOBAL, since it defeats
24 another purpose of this very versatile interface, which is to
25 support multiple debug/testing options concurrently.
30 /* Write midi as formatted ascii stream? */
31 bool midi_debug_global_b
;
33 /* General purpose testing flag */
34 int testing_level_global
;
37 crash if internally the wrong type is used for a grob property.
39 bool internal_type_checking_global_b
;
41 LY_DEFINE (ly_option_usage
, "ly-option-usage", 0, 0, 0, (SCM
),
42 "Print ly-set-option usage")
44 printf ( _("lilypond -e EXPR means:").to_str0 ());
46 printf (_ (" Evalute the Scheme EXPR before parsing any .ly files.").to_str0 ());
48 printf (_ (" Multiple -e options may be given, they will be evaluated sequentially.").to_str0 ());
50 printf (_(" The function ly-set-option allows for access to some internal variables.").to_str0 ());
52 printf (_ ("Usage: lilypond -e \"(ly-set-option SYMBOL VAL)\"").to_str0 ());
54 printf (_ ("Where SYMBOL VAL pair is any of:").to_str0 ());
56 printf ( " help ANY-SYMBOL\n"
57 " internal-type-checking BOOLEAN\n"
58 " midi-debug BOOLEAN\n"
59 " testing-level INTEGER\n");
62 return SCM_UNSPECIFIED
;
67 @item -T,--no-timestamps
68 don't timestamp the output
71 Switch on any experimental features. Not for general public use. */
73 LY_DEFINE (ly_set_option
, "ly-set-option", 2, 0, 0, (SCM var
, SCM val
),
74 "Set a global option value. Supported options include
80 If set to true, generate human readable MIDI
81 @item internal-type-checking
82 Set paranoia for property assignments
85 This function is useful to call from the command line: @code{lilypond -e
86 \"(ly-set-option 'midi-debug #t)\"}.
89 if (var
== ly_symbol2scm ("help"))
91 /* lilypond -e "(ly-set-option 'help #t)" */
92 ly_option_usage (SCM_EOL
);
94 else if (var
== ly_symbol2scm ("midi-debug"))
96 midi_debug_global_b
= to_boolean (val
);
98 else if (var
== ly_symbol2scm ("testing-level"))
100 testing_level_global
= gh_scm2int (val
);
102 else if (var
== ly_symbol2scm ("internal-type-checking"))
104 internal_type_checking_global_b
= to_boolean (val
);
106 else if (var
== ly_symbol2scm ("find-old-relative"))
109 Seems to have been broken for some time!
111 @item -Q,--find-old-relative
112 show all changes needed to convert a file to relative octave syntax.
122 warning (_("Unknown internal option!"));
126 return SCM_UNSPECIFIED
;