diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2005-06-09 14:09:33 +0000 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2005-06-09 14:09:33 +0000 |
commit | c3043e2b9c1c296af86721617f58601e21eccaa8 (patch) | |
tree | 82b3d31cddd0711fa5afeca2e3a8cf9e2cb370b3 | |
parent | 9299ff9e805b237f22a462cc8c97a6b145c161c0 (diff) |
* lily/program-option.cc: rename from scm-option.cc
* lily/scm-option.cc (LY_DEFINE): handle no-foobar option setting.
(get_help_string): Print pretty help string.
* scripts/lilypond-book.py (PREAMBLE_LY): add no-point-and-click
to snippet preamble.
* lily/scm-option.cc: remove command-line-settings option. Fold
all command-line options plus default settings in a generic
interface.
* flower/getopt-long.cc (table_string): indent 2nd lines of help
texts too.
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | Documentation/user/invoking.itely | 38 | ||||
-rw-r--r-- | Documentation/user/point-and-click.itely | 2 | ||||
-rw-r--r-- | flower/getopt-long.cc | 5 | ||||
-rw-r--r-- | lily/include/program-option.hh (renamed from lily/include/scm-option.hh) | 18 | ||||
-rw-r--r-- | lily/main.cc | 12 | ||||
-rw-r--r-- | lily/midi-item.cc | 6 | ||||
-rw-r--r-- | lily/midi-stream.cc | 4 | ||||
-rw-r--r-- | lily/music-sequence.cc | 2 | ||||
-rw-r--r-- | lily/parser.yy | 2 | ||||
-rw-r--r-- | lily/program-option.cc | 212 | ||||
-rw-r--r-- | lily/relative-octave-music.cc | 2 | ||||
-rw-r--r-- | lily/repeated-music.cc | 2 | ||||
-rw-r--r-- | lily/scm-option.cc | 186 | ||||
-rw-r--r-- | ly/init.ly | 2 | ||||
-rw-r--r-- | make/lilypond-vars.make | 2 | ||||
-rw-r--r-- | scm/backend-library.scm | 3 | ||||
-rw-r--r-- | scm/framework-ps.scm | 10 | ||||
-rw-r--r-- | scm/framework-tex.scm | 4 | ||||
-rw-r--r-- | scm/lily.scm | 5 | ||||
-rw-r--r-- | scripts/lilypond-book.py | 2 |
21 files changed, 299 insertions, 246 deletions
@@ -1,3 +1,20 @@ +2005-06-09 Han-Wen Nienhuys <hanwen@xs4all.nl> + + * lily/program-option.cc: rename from scm-option.cc + + * lily/scm-option.cc (LY_DEFINE): handle no-foobar option setting. + (get_help_string): Print pretty help string. + + * scripts/lilypond-book.py (PREAMBLE_LY): add no-point-and-click + to snippet preamble. + + * lily/scm-option.cc: remove command-line-settings option. Fold + all command-line options plus default settings in a generic + interface. + + * flower/getopt-long.cc (table_string): indent 2nd lines of help + texts too. + 2005-06-09 Jan Nieuwenhuizen <janneke@gnu.org> * flower/file-name.cc: Bugfix: only append DIRSEP if BASE_ @@ -19,21 +36,18 @@ * lily/parser.yy (Repeated_music): remove >? - * scm/framework-ps.scm (write-preamble): Support for -d - gs-font-load=1: read fonts via ghostscript. - * scm/backend-library.scm (postscript->pdf): Support for -dgs-font-load=1 + * scm/framework-ps.scm (write-preamble): make font loading + switchable to GS via --define-default gs-font-load=1 + 2005-06-09 Graham Percival <gperlist@shaw.ca> * Documentation/user/global.itely: added \layout docs. 2005-06-09 Han-Wen Nienhuys <hanwen@xs4all.nl> - * scm/framework-ps.scm (write-preamble): make font loading - switchable to GS via --define-default gs-font-load=1 - * lily/lily-parser-scheme.cc: add unistd.h 2005-06-08 Han-Wen Nienhuys <hanwen@xs4all.nl> diff --git a/Documentation/user/invoking.itely b/Documentation/user/invoking.itely index 115c105054..68cefef9c8 100644 --- a/Documentation/user/invoking.itely +++ b/Documentation/user/invoking.itely @@ -53,9 +53,7 @@ The following options are supported: @item -e,--evaluate=@var{expr} Evaluate the Scheme @var{expr} before parsing any @file{.ly} files. Multiple @code{-e} options may be given, they will be evaluated -sequentially. The function @code{ly:set-option} allows access to -some internal variables. Use @code{-e '(ly:option-usage)'} for more -information. +sequentially. @item -f,--format=@var{format} which formats should be written. Choices are @code{svg}, @code{ps}, @@ -97,19 +95,23 @@ This mode is used by default by lilypond-book. @cindex output format, setting @item -d,--define-default=@var{var}=@var{val} -This defines an internal variable @var{var} as the Scheme value -@var{val}. +This sets the internal program option @var{var} to the Scheme value +@var{val}. If @var{val} is not supplied, then @var{#t} is used. To +switch off an option, @code{no-} may be prefixed to @var{var}, eg. +@example +-dno-point-and-click +@end example -Supported values include: -@table @code -@item resolution -set PNG resolution -@item preview-include-book-title -include book-titles in preview -@end table +@noindent +is the same as +@example +-dpoint-and-click='#f' +@end example + +@cindex point and click -These settings are returned when calling -@code{(ly:get-option 'command-line-settings)} from Scheme. +Setting the @code{help} option will print a summary of the options +available, and exit. @item -h,--help Show a summary of usage. @@ -135,7 +137,11 @@ Generate DVI files. In this case, the @TeX{} backend should be specified, i.e., @code{-f tex}. @item --png -Generate pictures of each page, in PNG format. This implies @code{--ps}. +Generate pictures of each page, in PNG format. This implies +@code{--ps}. The resolution in DPI of the image may be set with +@example +-dresolution=110 +@end example @item --pdf Generate PDF. This implies @code{--ps}. @@ -191,7 +197,7 @@ being compiled. For a softer but secure alternative you can use the @item -j,--jail=@var{user},@var{group},@var{jail},@var{dir} -Run LilyPond in a jail. +Run LilyPond in a chroot jail. The @code{--jail} option provides a more flexible alternative to @code{--safe} when LilyPond formatting is available through a web diff --git a/Documentation/user/point-and-click.itely b/Documentation/user/point-and-click.itely index 3c1f8d1155..65fd27643c 100644 --- a/Documentation/user/point-and-click.itely +++ b/Documentation/user/point-and-click.itely @@ -103,6 +103,6 @@ in a @file{.ly} file. Alternately, you may pass this as an command-line option @example -lilypond -e "(ly:set-option 'point-and-click #f)" file.ly +lilypond -dno-point-and-click file.ly @end example diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc index 85b5f0ba9b..9c24d78fba 100644 --- a/flower/getopt-long.cc +++ b/flower/getopt-long.cc @@ -306,7 +306,6 @@ const int EXTRA_SPACES = 5; String Long_option_init::table_string (Long_option_init *l) { - String argstr = "ARG"; String tabstr = ""; int wid = 0; @@ -320,7 +319,9 @@ Long_option_init::table_string (Long_option_init *l) String s = " " + l[i].str_for_help (); s += String_convert::char_string (' ', wid - s.length () + EXTRA_SPACES); - tabstr += s + gettext (l[i].help_str0_) + "\n"; + String help_text (gettext (l[i].help_str0_)); + help_text.substitute ("\n", "\n" + String_convert::char_string (' ', wid + EXTRA_SPACES + 2)); + tabstr += s + help_text + "\n"; } return tabstr; diff --git a/lily/include/scm-option.hh b/lily/include/program-option.hh index 8fd01f3ef2..251db9d7f4 100644 --- a/lily/include/scm-option.hh +++ b/lily/include/program-option.hh @@ -1,5 +1,5 @@ /* - scm-option.hh -- declare Scheme options + program-option.hh -- declare Scheme options source file of the GNU LilyPond music typesetter @@ -8,10 +8,24 @@ #ifndef SCM_OPTION_HH #define SCM_OPTION_HH +#include "lily-guile.hh" + /* options */ -extern bool midi_debug_global_b; +extern bool do_midi_debugging_global; extern int testing_level_global; extern bool lily_1_8_relative; extern bool lily_1_8_compatibility_used; + +SCM ly_get_option (SCM); +SCM ly_set_option (SCM, SCM); + +struct Lilypond_option_init +{ + char const *name_; + char const *init_; + char const *descr_; +}; + + #endif /* SCM_OPTION_HH */ diff --git a/lily/main.cc b/lily/main.cc index 3986817c6e..415425bef6 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -137,12 +137,13 @@ static Getopt_long *option_parser = 0; static Long_option_init options_static[] = { - {_i ("BACK"), "backend", 'b', _i ("use backend BACK (gnome, ps [default],\n scm, svg, tex, texstr)")}, + {_i ("BACK"), "backend", 'b', _i ("use backend BACK (gnome, ps [default],\nscm, svg, tex, texstr)")}, {_i ("SYM=VAL"), "define-default", 'd', - _i ("define a default Scheme setting.")}, + _i ("set a Scheme program option. Uses #t if VAL is not specified\n" + "Try -dhelp for help.")}, - {_i ("EXPR"), "evaluate", 'e', _i ("set scheme option, for help use\n -e '(ly:option-usage)'")}, + {_i ("EXPR"), "evaluate", 'e', _i ("evaluate scheme code")}, /* Bug in option parser: --output =foe is taken as an abbreviation for --output-format. */ {_i ("FORMATs"), "formats", 'f', _i ("dump FORMAT,... Also as separate options:")}, @@ -157,7 +158,8 @@ static Long_option_init options_static[] {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, {_i ("FILE"), "output", 'o', _i ("write output to FILE (suffix will be added)")}, #if HAVE_CHROOT - {_i ("USER,GROUP,JAIL,DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n and cd into DIR")}, + {_i ("USER,GROUP,JAIL,DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n" + "and cd into DIR")}, #endif {0, "no-print", 0, _i ("do not generate printed output")}, {0, "preview", 'p', _i ("generate a preview of the first system")}, @@ -535,7 +537,7 @@ main_with_guile (void *, int, char **) if (!init_scheme_variables.is_empty () || !init_scheme_code_string.is_empty ()) { - init_scheme_variables = "(ly:set-option 'command-line-settings (list " + init_scheme_variables = "(map (lambda (x) (ly:set-option (car x) (cdr x))) (list " + init_scheme_variables + "))"; init_scheme_code_string diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 48f0061d70..501bb66f2d 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -14,7 +14,7 @@ #include "string-convert.hh" #include "midi-stream.hh" #include "duration.hh" -#include "scm-option.hh" +#include "program-option.hh" #include "killing-cons.tcc" #define PITCH_WHEEL_TOP 0x3FFF @@ -455,12 +455,12 @@ String Midi_track::data_string () const { String str = Midi_chunk::data_string (); - if (midi_debug_global_b) + if (do_midi_debugging_global) str += "\n"; for (Cons<Midi_event> *i = event_p_list_.head_; i; i = i->next_) { str += i->car_->to_string (); - if (midi_debug_global_b) + if (do_midi_debugging_global) str += "\n"; } return str; diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index b3f3f6df14..99010d32de 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -17,7 +17,7 @@ #include "misc.hh" #include "midi-item.hh" #include "warn.hh" -#include "scm-option.hh" +#include "program-option.hh" Midi_stream::Midi_stream (String file_name) { @@ -52,7 +52,7 @@ Midi_stream::operator << (Midi_item const &midi_c_r) String str = midi_c_r.to_string (); // ugh, should have separate debugging output with Midi*::print routines - if (midi_debug_global_b) + if (do_midi_debugging_global) { str = String_convert::bin2hex (str) + "\n"; for (int i = str.index ("0a"); i >= 0; i = str.index ("0a")) diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 9879da98e0..86bddb5ece 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -7,7 +7,7 @@ */ #include "warn.hh" -#include "scm-option.hh" +#include "program-option.hh" #include "pitch.hh" #include "input.hh" #include "music-sequence.hh" diff --git a/lily/parser.yy b/lily/parser.yy index 7b2b22b362..9cfa833ddf 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -41,7 +41,7 @@ FIXME: #include "paper-book.hh" #include "output-def.hh" #include "scm-hash.hh" -#include "scm-option.hh" +#include "program-option.hh" #include "score.hh" #include "text-interface.hh" #include "warn.hh" diff --git a/lily/program-option.cc b/lily/program-option.cc new file mode 100644 index 0000000000..0769fcb95e --- /dev/null +++ b/lily/program-option.cc @@ -0,0 +1,212 @@ +/* + scm-option.cc -- implement option setting from Scheme + + source file of the GNU LilyPond music typesetter + + (c) 2001--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl> +*/ + +#include "program-option.hh" + +#include <cstdio> +#include <string.h> + +#include "string-convert.hh" +#include "protected-scm.hh" +#include "parse-scm.hh" +#include "warn.hh" +#include "main.hh" + + +/* Write midi as formatted ascii stream? */ +bool do_midi_debugging_global; + +/* + Backwards compatibility. +*/ +bool lily_1_8_relative = false; +bool lily_1_8_compatibility_used = false; + +/* + crash if internally the wrong type is used for a grob property. +*/ +bool do_internal_type_checking_global; + + +static Lilypond_option_init options[] = { + {"point-and-click", "#t", + "use point & click"}, + {"midi-debug", "#f", + "generate human readable MIDI",}, + {"internal-type-checking", "#f", + "check every property assignment for types"}, + {"parse-protect", "#t", + "continue when finding errors in inline\n" + "scheme are caught in the parser. If off, halt \n" + "on errors, and print a stack trace."}, + {"old-relative", "#f", + "relative for simultaneous music works\n" + "similar to chord syntax"}, + {"resolution", "90", + "resolution for generating bitmaps"}, + {"preview-include-book-title", "#t", + "include book-titles in preview images."}, + {"gs-font-load", "#f", + "load fonts via Ghostscript."}, + {0,0,0}, +}; + +Protected_scm option_hash_; + +void internal_set_option (SCM var, SCM val) +{ + scm_hashq_set_x (option_hash_, var, val); + + if (var == ly_symbol2scm ("midi-debug")) + { + do_midi_debugging_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("point-and-click")) + { + point_and_click_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("parse-protect")) + { + parse_protect_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("internal-type-checking")) + { + do_internal_type_checking_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("old-relative")) + { + lily_1_8_relative = to_boolean (val); + /* Needs to be reset for each file that uses this option. */ + lily_1_8_compatibility_used = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } +} + +const int HELP_INDENT = 30; +const int INDENT = 2; +const int SEPARATION = 5; + +static String +get_help_string () +{ + String help ("Options supported by ly:set-option\n\n"); + for (Lilypond_option_init *p = options; p->name_; p ++) + { + String opt_spec = + String_convert::char_string (' ', INDENT) + + String (p->name_) + + " (" + + String (p->init_) + + ")"; + + + if (opt_spec.length () + SEPARATION > HELP_INDENT) + { + opt_spec += "\n" + + String_convert::char_string (' ', HELP_INDENT); + } + else + opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ()); + + String opt_help = p->descr_; + opt_help.substitute (String ("\n"), + String ("\n") + + String_convert::char_string (' ', HELP_INDENT)); + + help += opt_spec + opt_help + "\n"; + } + + help += String ("\n"); + return help; +} + +static void +init_program_options () +{ + option_hash_ = scm_c_make_hash_table (11); + + for (Lilypond_option_init *p = options; p->name_; p ++) + { + SCM sym = ly_symbol2scm (p->name_); + SCM val = scm_c_eval_string (p->init_); + + internal_set_option (sym, val); + } + + String help = get_help_string (); + + + + internal_set_option (ly_symbol2scm ("help"), + scm_makfrom0str (help.to_str0 ())); +} + +ADD_SCM_INIT_FUNC(scm_option, init_program_options); + + +/* + 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. + +*/ + +Protected_scm command_line_settings = SCM_EOL; + +LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (), + "Print ly:set-option usage") +{ + SCM stdout = scm_current_output_port(); + scm_display (ly_get_option (ly_symbol2scm ("help")), stdout); + exit (0); + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), + "Set a program option. Try setting 'help for a help string.") +{ + SCM_ASSERT_TYPE (scm_is_symbol (var), var, SCM_ARG1, + __FUNCTION__, "symbol"); + + if (ly_symbol2scm ("help") == var) + { + ly_option_usage (); + } + + if (val == SCM_UNDEFINED) + val = SCM_BOOL_T; + + String varstr = ly_scm2string (scm_symbol_to_string (var)); + if (varstr.left_string (3) == String ("no-")) + { + var = ly_symbol2scm (varstr.nomid_string (0, 3).to_str0 ()); + val = scm_from_bool (!to_boolean (val)); + } + + SCM handle = scm_hashq_get_handle (option_hash_, var); + if (handle == SCM_BOOL_F) + { + warning (_f ("no such internal option: %s", varstr.to_str0 ())); + } + + internal_set_option (var, val); + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), + "Get a global option setting.") +{ + SCM_ASSERT_TYPE (scm_is_symbol (var), var, + SCM_ARG1, __FUNCTION__, "symbol"); + return scm_hashq_ref (option_hash_, var, SCM_BOOL_F); +} diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc index a04b735cbf..e3ee638953 100644 --- a/lily/relative-octave-music.cc +++ b/lily/relative-octave-music.cc @@ -9,7 +9,7 @@ #include "music.hh" #include "pitch.hh" #include "warn.hh" -#include "scm-option.hh" +#include "program-option.hh" class Relative_octave_music { diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index 0081363e7f..ee586efc89 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -10,7 +10,7 @@ #include "music-sequence.hh" #include "pitch.hh" #include "warn.hh" -#include "scm-option.hh" +#include "program-option.hh" Music * Repeated_music::body (Music *me) diff --git a/lily/scm-option.cc b/lily/scm-option.cc deleted file mode 100644 index 7e007cadb9..0000000000 --- a/lily/scm-option.cc +++ /dev/null @@ -1,186 +0,0 @@ -/* - scm-option.cc -- implement option setting from Scheme - - source file of the GNU LilyPond music typesetter - - (c) 2001--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl> -*/ - -#include <cstdio> - -#include "scm-option.hh" -#include "protected-scm.hh" -#include "parse-scm.hh" -#include "warn.hh" -#include "main.hh" - -/* - 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. - - - 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; - -/* - Backwards compatibility. -*/ -bool lily_1_8_relative = false; -bool lily_1_8_compatibility_used = false; - -/* - crash if internally the wrong type is used for a grob property. -*/ -bool do_internal_type_checking_global; - -Protected_scm command_line_settings = SCM_EOL; - -/* - What is this function for ? -*/ -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 (_ ("Use help as SYMBOL to get online help.").to_str0 ()); - puts ("\n"); - - exit (0); - return SCM_UNSPECIFIED; -} - -/* 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 (ly_set_option, "ly:set-option", 1, 1, 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 point-and-click\n" - "Switch point & click on or off.\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" - "@item old-relative\n" - "Relative for simultaneous music functions similar to chord syntax\n" - "@item new-relative\n" - "Relative for simultaneous music functions similar to sequential music\n" - "@item command-line-settings\n" - "An alist of generic key/value pairs\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") -{ - if (val == SCM_UNDEFINED) - val = SCM_BOOL_T; - - if (var == ly_symbol2scm ("help")) - /* lilypond -e "(ly:set-option 'help #t)" */ - ly_option_usage (SCM_EOL); - else if (var == ly_symbol2scm ("midi-debug")) - midi_debug_global_b = to_boolean (val); - else if (var == ly_symbol2scm ("testing-level")) - testing_level_global = scm_to_int (val); - else if (var == ly_symbol2scm ("point-and-click")) - point_and_click_global = to_boolean (val); - else if (var == ly_symbol2scm ("parse-protect")) - parse_protect_global = to_boolean (val); - else if (var == ly_symbol2scm ("internal-type-checking")) - do_internal_type_checking_global = to_boolean (val); - else if (var == ly_symbol2scm ("old-relative")) - { - lily_1_8_relative = true; - /* Needs to be reset for each file that uses this option. */ - lily_1_8_compatibility_used = false; - } - else if (var == ly_symbol2scm ("new-relative")) - lily_1_8_relative = false; - else if (var == ly_symbol2scm ("command-line-settings")) - { - SCM_ASSERT_TYPE(scm_list_p (val) == SCM_BOOL_T, - val, SCM_ARG2, __FUNCTION__, "alist"); - command_line_settings = scm_append (scm_list_2 (val, command_line_settings)); - } - else - { - if (scm_is_symbol (var)) - var = scm_symbol_to_string (var); - - warning (_f ("no such internal option: %s", ly_scm2string (var))); - } - return SCM_UNSPECIFIED; -} - -LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), - "Get a global option setting. Supported options include\n" - "@table @code\n" - "@item old-relative-used\n" - "Report whether old-relative compatibility mode is necessary\n" - "@item point-and-click\n" - "Report whether point & click is switched on.\n" - "@item old-relative\n" - "Report whether old-relative compatibility mode is used\n" - "@item verbose\n" - "Report whether we are running in verbose mode\n" - "@item command-line-settings\n" - - "@end table\n" - "\n") -{ - SCM o = SCM_UNSPECIFIED; - - if (var == ly_symbol2scm ("safe")) // heavily used; put in front. - o = ly_bool2scm (be_safe_global); - else if (var == ly_symbol2scm ("old-relative-used")) - o = ly_bool2scm (lily_1_8_compatibility_used); - else if (var == ly_symbol2scm ("old-relative")) - o = ly_bool2scm (lily_1_8_relative); - else if (var == ly_symbol2scm ("verbose")) - o = ly_bool2scm (be_verbose_global); - else if (var == ly_symbol2scm ("command-line-settings")) - { - o = command_line_settings; - } - else - { - if (scm_is_symbol (var)) - var = scm_symbol_to_string (var); - - String s = ly_scm2string (var); - - warning (_f ("no such internal option: %s", s.to_str0 ())); - } - return o; -} diff --git a/ly/init.ly b/ly/init.ly index cf7245980c..e8bdf7ab35 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -12,7 +12,7 @@ \include "declarations-init.ly" -#(ly:set-option 'new-relative) +#(ly:set-option 'old-relative #f) #(define toplevel-scores '()) #(define $globalheader #f) #(define version-seen? #f) diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make index 7306b20b22..b099a45d33 100644 --- a/make/lilypond-vars.make +++ b/make/lilypond-vars.make @@ -18,7 +18,7 @@ CONVERT_LY = $(script-dir)/convert-ly.py LILYPOND = $(builddir)/lily/$(outconfbase)/lilypond LILYPOND_BOOK = $(script-dir)/lilypond-book.py LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(builddir)/mf/$(outconfbase)/ -I $(builddir)/mf/out/ -LILYPOND_BOOK_FLAGS = --process="$(LILYPOND) --backend=eps --formats=ps,png --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'" +LILYPOND_BOOK_FLAGS = --process="$(LILYPOND) --backend=eps --formats=ps,png --header=texidoc -I $(srcdir)/input/test -dinternal-type-checking" #texi-html for www only: diff --git a/scm/backend-library.scm b/scm/backend-library.scm index f39ac71471..7293b7be95 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -48,8 +48,7 @@ -c .setpdfwrite\ -f ~S\ " - (if (assoc 'gs-font-load - (ly:get-option 'command-line-settings)) + (if (ly:get-option 'gs-font-load) " -dNOSAFER " " -dSAFER ") (sanitize-command-option papersizename) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 46ede2e15a..b4f23a7416 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -379,8 +379,7 @@ (lambda (x y) (string<? (cadr x) (cadr y)))))) - (font-loader (if (assoc 'gs-font-load - (ly:get-option 'command-line-settings)) + (font-loader (if (ly:get-option 'gs-font-load) load-font-via-GS load-font)) @@ -478,9 +477,7 @@ ;; skip booktitles. (if (and (not - (cdr (assoc - 'preview-include-book-title - (ly:get-option 'command-line-settings)))) + (ly:get-option 'preview-include-book-title)) (< 1 (length systems)) (ly:paper-system-title? (list-ref systems 0)) (ly:paper-system-title? (list-ref systems 1))) @@ -542,8 +539,7 @@ (defs-resolution (ly:output-def-lookup defs 'pngresolution)) (resolution (if (number? defs-resolution) defs-resolution - (cdr (assoc 'resolution - (ly:get-option 'command-line-settings))))) + (ly:get-option 'resolution))) (papersizename (ly:output-def-lookup defs 'papersizename))) (postscript->png resolution diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index 568c5e7c40..55fc402d8c 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -300,9 +300,7 @@ (postscript->png (if (number? resolution) resolution - (assoc - 'resolution - (ly:get-option 'command-line-settings))) + (ly:get-option 'resolution)) (if (string? papersizename) papersizename diff --git a/scm/lily.scm b/scm/lily.scm index 66bedac613..4b5f1311f4 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -37,11 +37,6 @@ (debug-enable 'backtrace) (read-enable 'positions))) -;; initialize defaults. -(ly:set-option 'command-line-settings - '((resolution . 90) - (preview-include-book-title . #t) - )) (define-public tex-backend? (member (ly:output-backend) '("texstr" "tex"))) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 193c94bd84..feb5394690 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -557,6 +557,8 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s (ly:parser-print-score p (ly:music-scorify m p)))) +#(ly:set-option (quote no-point-and-click)) + #(define version-seen? #t) %(preamble_string)s |