]> git.donarmstrong.com Git - lilypond.git/blob - lily/scm-option.cc
525c2e54f3212b376497c4b9bbeb0b9950ad838b
[lilypond.git] / lily / scm-option.cc
1 /*   
2   scm-option.cc --  implement option setting from Scheme
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include <iostream.h>
11 #include "string.hh"
12 #include "lily-guile.hh"
13 #include "scm-option.hh"
14
15
16 /*
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.
21
22
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.
26   
27  */
28
29
30 /* Write midi as formatted ascii stream? */
31 bool midi_debug_global_b;
32
33 /* General purpose testing flag */
34 int testing_level_global;
35
36
37
38 /*
39
40   TODO: verzin iets tegen optie code bloot
41
42
43   other interesting stuff to add:
44
45 @item -T,--no-timestamps
46 don't timestamp the output
47
48 @item -t,--test
49 Switch on any experimental features.  Not for general public use.
50
51  */
52
53 SCM
54 set_lily_option (SCM var, SCM val)
55 {
56   /*
57     Scheme option usage:
58     lilypond -e "(set-lily-option 'help 0)"
59    */
60   if (var == ly_symbol2scm ("help"))
61     {
62       cout << '\n';
63       cout << _ ("Scheme options:");
64       cout << '\n';
65       cout << "  help (any-symbol)"; 
66       cout << '\n';
67       cout << "  midi-debug (boolean)"; 
68       cout << '\n';
69       cout << "  testing-level (int)"; 
70       cout << '\n';
71       exit (0);
72     }
73   else if (var == ly_symbol2scm ("midi-debug"))
74     {
75       midi_debug_global_b = to_boolean (val);
76     }
77   else if (var == ly_symbol2scm ("testing-level"))
78     {
79      testing_level_global = gh_scm2int (val); 
80     }
81   else if (var == ly_symbol2scm ("find-old-relative"))
82     {
83       /*
84         Seems to have been broken for some time!
85         
86         @item  -Q,--find-old-relative
87         show all changes needed to convert a file to  relative octave syntax.
88
89
90         
91       */
92
93       ;
94       
95     }
96
97   return SCM_UNSPECIFIED;
98 }
99
100
101 static void
102 init_functions ()
103 {
104   scm_c_define_gsubr ("set-lily-option", 2, 0, 0, (Scheme_function_unknown)set_lily_option);
105 }
106
107
108 ADD_SCM_INIT_FUNC (init_functions_sopt, init_functions);
109
110