* lily/music-iterator.cc (quit, do_quit): new function: break link
[lilypond.git] / lily / scm-option.cc
blobf175b214838f7432f76ab61718d02375cccc8f6d
1 /*
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>
8 */
9 #include <stdio.h>
11 #include "string.hh"
12 #include "lily-guile.hh"
13 #include "scm-option.hh"
14 #include "warn.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
20 space.
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 ());
45 puts ("");
46 printf (_ (" Evalute the Scheme EXPR before parsing any .ly files.").to_str0 ());
47 puts ("");
48 printf (_ (" Multiple -e options may be given, they will be evaluated sequentially.").to_str0 ());
49 puts ("");
50 printf (_(" The function ly-set-option allows for access to some internal variables.").to_str0 ());
51 puts ("\n");
52 printf (_ ("Usage: lilypond -e \"(ly-set-option SYMBOL VAL)\"").to_str0 ());
53 puts ("\n");
54 printf (_ ("Where SYMBOL VAL pair is any of:").to_str0 ());
55 puts ("");
56 printf ( " help ANY-SYMBOL\n"
57 " internal-type-checking BOOLEAN\n"
58 " midi-debug BOOLEAN\n"
59 " testing-level INTEGER\n");
61 exit (0);
62 return SCM_UNSPECIFIED;
65 /* Add these as well:
67 @item -T,--no-timestamps
68 don't timestamp the output
70 @item -t,--test
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
76 @table @code
77 @item help
78 List all options.
79 @item midi-debug
80 If set to true, generate human readable MIDI
81 @item internal-type-checking
82 Set paranoia for property assignments
83 @end table
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.
120 else
122 warning (_("Unknown internal option!"));
126 return SCM_UNSPECIFIED;