Hi, The patch in the attachment implements the command line option --display-music. If it's on it will print the internal representation of the score like \displayMusic and exit.
The main use for this option is to use the output of --display-music as the input for other programs (it's easier to parse this internal format than the whole lilypond language). Pedro
>From 928f332e59337a86cf884937a23e3532228b95ab Mon Sep 17 00:00:00 2001 From: Pedro Kroger <pedro.kro...@gmail.com> Date: Mon, 23 Mar 2009 00:04:16 -0700 Subject: [PATCH] Initial implementation of the --display-music option Display the internal representation of a music in the console and exit (don't typeset the music). --- lily/include/main.hh | 2 +- lily/main.cc | 5 ++++- lily/score.cc | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lily/include/main.hh b/lily/include/main.hh index 8b0df58..953d686 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -39,7 +39,7 @@ extern bool use_object_keys; extern bool strict_infinity_checking; extern string init_scheme_code_global; extern string init_scheme_variables_global; - +extern bool display_music_global; /* todo: collect in Output_option struct? */ diff --git a/lily/main.cc b/lily/main.cc index 2d29334..db74c80 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -76,7 +76,7 @@ string init_scheme_code_global; string init_scheme_variables_global; bool relocate_binary = true; - +bool display_music_global = false; /* * Miscellaneous global stuff. @@ -154,6 +154,7 @@ static Long_option_init options_static[] #endif {_i ("FILE"), "output", 'o', _i ("write output to FILE (suffix will be added)")}, {0, "relocate", 0, _i ("relocate using directory of lilypond program")}, + {0, "display-music", 0, _i ("print lilypond internal representation of music")}, {0, "version", 'v', _i ("show version number and exit")}, {0, "verbose", 'V', _i ("be verbose")}, {0, "warranty", 'w', _i ("show warranty and copyright")}, @@ -469,6 +470,8 @@ parse_argv (int argc, char **argv) add_output_format (opt->longname_str0_); else if (string (opt->longname_str0_) == "relocate") relocate_binary = true; + else if (string (opt->longname_str0_) == "display-music") + display_music_global = true; break; case 'd': diff --git a/lily/score.cc b/lily/score.cc index ac79dd1..284572c 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -115,6 +115,13 @@ SCM Score::book_rendering (Output_def *layoutbook, Output_def *default_def) { + if (display_music_global) + { + printf("\n"); + scm_call_1 (ly_lily_module_constant ("display-scheme-music"), music_); + exit(0); + } + if (error_found_) return SCM_EOL; -- 1.6.2
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel