From 48631a04b6181cd7be65702574eaaa6c52284bd2 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 15 Aug 2002 00:16:25 +0000 Subject: [PATCH] * lily/include/file-results.hh (class Input_file_settings): encapsulate file settings in a class, Input_file_settings. * lily/scores.cc: new function ly_set_point_and_click_x --- ChangeLog | 12 ++ Documentation/user/refman.itely | 14 +- Documentation/user/tutorial.itely | 16 +-- input/les-nereides.ly | 3 +- input/mutopia/F.Schubert/standchen.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-1.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-2.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-3.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-4.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-5.ly | 4 +- .../J.S.Bach/Petites-Preludes/preludes-6.ly | 4 +- .../J.S.Bach/baerenreiter-sarabande.ly | 4 +- input/mutopia/J.S.Bach/wtk1-fugue1.ly | 4 +- input/mutopia/W.A.Mozart/mozart-hrn3-defs.ly | 4 +- input/regression/pc-mmrest.ly | 4 +- input/tutorial/miniatures.ly | 4 +- input/tutorial/os-flute-2.ly | 4 +- input/tutorial/os-score.ly | 4 +- lily/grob.cc | 17 +-- lily/include/file-results.hh | 30 ++++- lily/include/lily-proto.hh | 1 + lily/include/main.hh | 1 - lily/include/my-lily-parser.hh | 4 +- lily/include/paper-def.hh | 4 +- lily/include/score.hh | 3 +- lily/lexer.ll | 6 +- lily/my-lily-lexer.cc | 4 +- lily/my-lily-parser.cc | 8 +- lily/paper-def.cc | 2 +- lily/paper-score.cc | 10 +- lily/parser.yy | 8 +- lily/performance.cc | 3 +- lily/score.cc | 14 +- lily/scores.cc | 124 +++++++++++------- lily/system.cc | 1 - scm/ps.scm | 9 +- scm/tex.scm | 4 +- scripts/convert-ly.py | 13 ++ 38 files changed, 220 insertions(+), 147 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e8cf6ff68..50370331e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-08-15 Han-Wen Nienhuys + + * lily/include/file-results.hh (class Input_file_settings): + encapsulate file settings in a class, Input_file_settings. + + * lily/scores.cc: new function ly_set_point_and_click_x + + * Documentation/topdocs/README.texi (Top): add note about xdelta + + * Documentation/topdocs/INSTALL.texi (Top): move kpathsea to problems + section. + 2002-08-14 Jan Nieuwenhuizen * scripts/ly2dvi.py: Remove debug printing. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 8086da140e..40939ff3c7 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -632,14 +632,20 @@ To use it, you need the following software a few versions behind the official Xdvi. To find out which xdvi you are running, try @code{xdvi -version} or @code{xdvi.bin -version}. @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or -newer. Enablle the menu Settings -> Inverse search. +newer. Enable option @emph{Inverse search} in the menu @emph{Settings}. @cindex Xdvi @cindex KDVI @cindex KDE + + @end itemize -@item An editor with a client/server interface (or a lightweight GUI editor). +@item An editor with a client/server interface (or a lightweight GUI +editor). + +@cindex editor + @itemize @bullet @item Emacs. Emacs is an extensible text-editor. It is available from @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use @@ -682,7 +688,7 @@ fonts. Refer to the Xdvi documentation for more information. To use point-and-click, add one of these lines to the top of your .ly file. @example -#(set! point-and-click line-location) +#(set-point-and-click! 'line) @end example @cindex line-location @@ -722,7 +728,7 @@ apply @file{server.el.patch} (version 21.2 and earlier). At the top of the @code{ly} file, replace the @code{set!} line with the following line, @example -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) @end example @cindex line-colomn-location and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index 31efc44306..7a292eacb3 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -1573,7 +1573,7 @@ Opus 2. For example, consider the following file (@file{miniatures.ly}) @example -\version "1.5.60" +\version "1.5.72" \header @{ title = "Two miniatures" composer = "F. Bar Baz" @@ -1706,7 +1706,7 @@ will be at the left. @example -\version "1.5.60" +\version "1.5.72" \header @{ title = "Two miniatures" composer = "F. Bar Baz" @@ -1731,7 +1731,7 @@ will be at the left. @separate @example -\version "1.6.0" +\version "1.5.72" @end example Lilypond and its language are still under development, and occasionally, details of the syntax are changed. This fragment @@ -2383,7 +2383,7 @@ conductor's score. \include "os-music.ly" \include "paper13.ly" -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) #(define text-flat '((font-relative-size . -2) (music "accidentals--1"))) @@ -2468,12 +2468,12 @@ First, we need to include the music definitions we made in @separate @example -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) @end example -This piece of Scheme code sets the Scheme variable -@code{point-and-click} to the value @var{line-column-location} (which -itself is a Scheme procedure). +This piece of Scheme code executes the function +@code{set-point-and-click!}, with the argument @code{line-column}, a +symbol). Editing input files can be complicated if you're working with large files: if you're digitizing existing music, you have to synchronize diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 63ac72d446..b801e9bfc1 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -1,4 +1,4 @@ -\version "1.5.68" +\version "1.5.72" \header { composer = "ARTHUR GRAY" @@ -10,6 +10,7 @@ description = "Nastiest piece of competition at http://www.orphee.com/comparison/study.html, see http://www.orphee.com/comparison/gray.pdf" } +#(set-point-and-click! 'line-column) #(set! point-and-click line-column-location) #(define (make-text-checker text) diff --git a/input/mutopia/F.Schubert/standchen.ly b/input/mutopia/F.Schubert/standchen.ly index 639d37b5bd..812702c86b 100644 --- a/input/mutopia/F.Schubert/standchen.ly +++ b/input/mutopia/F.Schubert/standchen.ly @@ -1,5 +1,5 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) instrument = "Piano" @@ -41,7 +41,7 @@ instrument = "Piano" footer = "Mutopia-2001/04/27-xx" } -\version "1.5.68" +\version "1.5.72" dynamicUp = \property Voice.DynamicLineSpanner \override #'direction = #1 dynamicRevert = \property Voice.DynamicLineSpanner \revert #'direction diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly index 6929f205db..edc1f9b2e4 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly @@ -1,4 +1,4 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) opus = "BWV 924" piece = "1" @@ -18,7 +18,7 @@ Lemoine puts fermatas on ending bar lines everywhere. -\version "1.5.68" +\version "1.5.72" lowstaff = \translator "Staff" = "lower" diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly index da564a4ea1..db203fce4e 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly @@ -1,10 +1,10 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) opus= "BWV 939" piece = "2" -\version "1.5.68" +\version "1.5.72" upper = \context Staff \notes\relative c{ \context Voice=i \property Voice.TextScript \set #'font-style = #'italic diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly index 75967087e9..45681e07d3 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly @@ -1,4 +1,4 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) opus= "BWV 999" piece = "3" @@ -14,7 +14,7 @@ note, some have dotted half notes. This file was partly generated using m4. %} -\version "1.5.68" +\version "1.5.72" upper = \notes \transpose c'' { diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly index 8fbe892a5f..7fd814331a 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly @@ -1,9 +1,9 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) opus = "BWV 925" piece = "4" -\version "1.5.68" +\version "1.5.72" %{ diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly index 9ba8f523e2..a1b45db8f2 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly @@ -1,9 +1,9 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) piece = "5" opus = "BWV 926" -\version "1.5.68" +\version "1.5.72" upper = \context Staff \notes\relative c \context Voice=i { diff --git a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly index c9ae424b19..d678d0b14f 100644 --- a/input/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly +++ b/input/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly @@ -1,9 +1,9 @@ -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) opus = "BWV 940" piece = "6" -\version "1.5.68" +\version "1.5.72" diff --git a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly index 2f00f25f85..0c8172b9df 100644 --- a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly +++ b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly @@ -1,6 +1,6 @@ -\version "1.5.68" +\version "1.5.72" -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) forcedBreak = \notes { } %%forcedBreak = \notes { \break } diff --git a/input/mutopia/J.S.Bach/wtk1-fugue1.ly b/input/mutopia/J.S.Bach/wtk1-fugue1.ly index 896656baf6..0a6303a852 100644 --- a/input/mutopia/J.S.Bach/wtk1-fugue1.ly +++ b/input/mutopia/J.S.Bach/wtk1-fugue1.ly @@ -19,9 +19,9 @@ enteredby = "Shay Rojansky" %{ TODO: use autobeaming. %} -\version "1.5.68" +\version "1.5.72" -% #(set! point-and-click line-column-location) +% #(set-point-and-click! 'line-column) tenor = \context Voice = tenor \notes \relative c' { diff --git a/input/mutopia/W.A.Mozart/mozart-hrn3-defs.ly b/input/mutopia/W.A.Mozart/mozart-hrn3-defs.ly index d5ae59b1b8..5378aab226 100644 --- a/input/mutopia/W.A.Mozart/mozart-hrn3-defs.ly +++ b/input/mutopia/W.A.Mozart/mozart-hrn3-defs.ly @@ -1,12 +1,12 @@ -% #(set! point-and-click line-column-location) +% #(set-point-and-click! 'line-column) longgrace = \property Voice.Stem \override #'flag-style = #'() endlonggrace = \property Voice.Stem \revert #'flag-style ritenuto = \textscript #'(italic "rit.") -\version "1.5.68" +\version "1.5.72" #(define italic-bf '((font-shape . italic) (font-series . bold))) diff --git a/input/regression/pc-mmrest.ly b/input/regression/pc-mmrest.ly index f29a3b878a..48a3a13a40 100644 --- a/input/regression/pc-mmrest.ly +++ b/input/regression/pc-mmrest.ly @@ -1,10 +1,10 @@ -\version "1.5.68" +\version "1.5.72" \header { texidoc="Multi measure rests of second voice should not disappear." } -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) one = \notes\relative c'' { f4 \!e-.\f r2| diff --git a/input/tutorial/miniatures.ly b/input/tutorial/miniatures.ly index 6150bb2b30..c7d27f5f1d 100644 --- a/input/tutorial/miniatures.ly +++ b/input/tutorial/miniatures.ly @@ -1,10 +1,10 @@ -\version "1.5.68" +\version "1.5.72" \header { title = "Two miniatures" tagline = "Small is beatiful" } -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) \paper { linewidth = -1.0 } diff --git a/input/tutorial/os-flute-2.ly b/input/tutorial/os-flute-2.ly index fe890a021f..8586e97589 100644 --- a/input/tutorial/os-flute-2.ly +++ b/input/tutorial/os-flute-2.ly @@ -1,4 +1,4 @@ -\version "1.5.68" +\version "1.5.72" \include "os-music.ly" \include "paper16.ly" @@ -26,4 +26,4 @@ % switch off settings of -score file, so the rest of the % tutorial isn't \special -#(set! point-and-click #f) +#(set-point-and-click! 'none) diff --git a/input/tutorial/os-score.ly b/input/tutorial/os-score.ly index bab0b5270d..2d923dad79 100644 --- a/input/tutorial/os-score.ly +++ b/input/tutorial/os-score.ly @@ -1,10 +1,10 @@ -\version "1.5.68" +\version "1.5.72" \include "os-music.ly" \include "paper13.ly" -#(set! point-and-click line-column-location) +#(set-point-and-click! 'line-column) #(define text-flat '((font-relative-size . -2) (music "accidentals--1"))) \score { diff --git a/lily/grob.cc b/lily/grob.cc index 883b0ce046..9c8833f8f3 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -260,14 +260,15 @@ Grob::get_uncached_molecule ()const { SCM origin = ly_symbol2scm ("no-origin"); - if (store_locations_global_b){ - SCM cause = get_grob_property ("cause"); - if (Music*m = unsmob_music (cause)) - { - SCM music_origin = m->get_mus_property ("origin"); - if (unsmob_input (music_origin)) - origin = music_origin; - } + if (store_locations_global_b) + { + SCM cause = get_grob_property ("cause"); + if (Music*m = unsmob_music (cause)) + { + SCM music_origin = m->get_mus_property ("origin"); + if (unsmob_input (music_origin)) + origin = music_origin; + } } // ugr. diff --git a/lily/include/file-results.hh b/lily/include/file-results.hh index af58d0d2a4..890dedaa13 100644 --- a/lily/include/file-results.hh +++ b/lily/include/file-results.hh @@ -9,15 +9,31 @@ #ifndef FILE_RESULTS_HH #define FILE_RESULTS_HH -#include "flower-proto.hh" + +#include "lily-proto.hh" +#include "source.hh" +#include "parray.hh" +#include "scm-hash.hh" + +class Input_file_settings +{ +public: + Sources sources_; + Array inclusion_names_; + Array target_strings_; + Link_array scores_; + Scheme_hash_table * global_header_; + + void do_deps( ); + void do_scores(); + + Input_file_settings (String file,String init); + ~Input_file_settings(); +}; + +extern Input_file_settings* global_input_file; void do_one_file (String init_string, String file_string); -extern Scheme_hash_table *global_header; -extern Array target_string_globals; -extern Array inclusion_globals; -extern Link_array score_globals; -void do_scores (); -void clear_scores (); #endif /* FILE_RESULTS_HH */ diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index a73992fe2b..e09de5f1f6 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -68,6 +68,7 @@ class Hara_kiri_line_group_engraver; class Hyphen_req; class Includable_lexer; +class Input_file_settings; class Input; class Item; class Key_change_req; diff --git a/lily/include/main.hh b/lily/include/main.hh index 4d7cb1c002..8c1e55d19c 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -42,6 +42,5 @@ extern All_font_metrics *all_fonts_global; extern int exit_status_global; extern File_path global_path; extern int score_count_global; -extern Sources* source_global; #endif /* MAIN_HH */ diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index c30fca5742..38d39ac4c3 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -30,7 +30,7 @@ class My_lily_parser { public: - My_lily_parser (Sources * sources); + My_lily_parser (Input_file_settings * sources); ~My_lily_parser (); void do_init_file (); @@ -42,7 +42,7 @@ public: Scheme_hash_table *default_header_; int fatal_error_; - Sources * source_; + Input_file_settings * input_file_; int error_level_; My_lily_lexer * lexer_; diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 2744224538..b434c92759 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -48,8 +48,9 @@ class Paper_def : public Music_output_def protected: VIRTUAL_COPY_CONS (Music_output_def); - public: + Paper_outputter* get_paper_outputter () ; + SCM font_descriptions ()const; virtual ~Paper_def (); static int score_count_; @@ -70,7 +71,6 @@ public: virtual int get_next_score_count () const; static void reset_score_count (); void output_settings (Paper_outputter*) const; - Paper_outputter* get_paper_outputter () ; Font_metric * find_font (SCM name, Real mag); diff --git a/lily/include/score.hh b/lily/include/score.hh index ff0a311243..c401c57f73 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -23,7 +23,8 @@ public: Link_array defs_; SCM music_; Scheme_hash_table * header_; - + Input_file_settings* input_file_; + int errorlevel_; /// construction diff --git a/lily/lexer.ll b/lily/lexer.ll index c1451847d1..e02376b983 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -34,7 +34,7 @@ #include "string.hh" #include "string-convert.hh" #include "my-lily-lexer.hh" -#include "array.hh" +#include "file-results.hh" #include "interval.hh" #include "lily-guile.hh" #include "parser.hh" @@ -199,7 +199,7 @@ HYPHEN -- String s (YYText ()+1); s = s.left_string (s.index_last ('"')); - new_input (s,source_global); + new_input (s, &global_input_file->sources_ ); yy_pop_state (); } \\{BLACK}*;?{WHITE} { /* got the include identifier */ @@ -210,7 +210,7 @@ HYPHEN -- SCM sid = lookup_identifier (s); if (gh_string_p (sid)) { - new_input (ly_scm2string (sid), source_global); + new_input (ly_scm2string (sid), &global_input_file->sources_); yy_pop_state (); } else { String msg (_f ("wrong or undefined identifier: `%s'", s )); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 538729df9d..121d676de1 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -13,7 +13,7 @@ #include "lily-proto.hh" #include "scm-hash.hh" #include "interval.hh" - +#include "file-results.hh" #include "lily-guile.hh" #include "parser.hh" #include "keyword.hh" @@ -126,7 +126,7 @@ My_lily_lexer::lookup_identifier (String s) void My_lily_lexer::start_main_input () { - new_input (main_input_string_, source_global); + new_input (main_input_string_, &global_input_file->sources_); allow_includes_b_ = allow_includes_b_ && ! (safe_global_b); } diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index f79fee6660..ee06d6bf3f 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -15,9 +15,9 @@ #include "file-results.hh" #include "scm-hash.hh" -My_lily_parser::My_lily_parser (Sources * source) +My_lily_parser::My_lily_parser (Input_file_settings * source) { - source_ = source; + input_file_ = source; lexer_ = 0; default_duration_ = Duration (2,0); error_level_ = 0; @@ -44,7 +44,7 @@ My_lily_parser::parse_file (String init, String s) progress_indication (_ ("Parsing...")); set_yydebug (0); - lexer_->new_input (init, source_); + lexer_->new_input (init, &input_file_->sources_); do_yyparse (); progress_indication ("\n"); @@ -55,7 +55,7 @@ My_lily_parser::parse_file (String init, String s) error_level_ = 1; } - inclusion_globals = lexer_->filename_strings_; + input_file_->inclusion_names_ = lexer_->filename_strings_; error_level_ = error_level_ | lexer_->errorlevel_; // ugh naming. } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 1dae6c8f72..03a4b322f8 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -122,7 +122,7 @@ Paper_def::get_paper_outputter () progress_indication (_f ("paper output to `%s'...", outname == "-" ? String ("") : outname)); - target_string_globals.push (outname); + global_input_file->target_strings_.push (outname); Paper_outputter * po = new Paper_outputter (outname); Path p = split_path (outname); p.ext = ""; diff --git a/lily/paper-score.cc b/lily/paper-score.cc index fc0c5933b5..eb30b41a81 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -6,6 +6,7 @@ (c) 1996--2002 Han-Wen Nienhuys */ +#include "score.hh" #include "main.hh" #include "warn.hh" #include "font-metric.hh" @@ -92,18 +93,17 @@ Paper_score::process () system_->break_into_pieces (breaking); outputter_ = paper_->get_paper_outputter (); -; outputter_->output_header (); outputter_->output_version (); progress_indication ("\n"); - if (global_header) + if (global_input_file->global_header_) { - - outputter_->output_scope (global_header, "lilypond"); - outputter_->write_header_fields_to_file (global_header); + outputter_->output_scope (global_input_file->global_header_, "lilypond"); + outputter_->write_header_fields_to_file (global_input_file->global_header_); } + if (header_) { outputter_->output_scope (header_, "lilypond"); diff --git a/lily/parser.yy b/lily/parser.yy index 73e7d91721..9c1cee4c17 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -349,12 +349,12 @@ toplevel_expression: THIS->lexer_->chordmodifier_tab_ = $1; } | lilypond_header { - if (global_header) - scm_gc_unprotect_object (global_header->self_scm ()); - global_header = $1; + if (THIS->input_file_->global_header_) + scm_gc_unprotect_object (THIS->input_file_->global_header_->self_scm ()); + THIS->input_file_->global_header_ = $1; } | score_block { - score_globals.push ($1); + THIS->input_file_->scores_.push ($1); } | output_def { if (dynamic_cast ($1)) diff --git a/lily/performance.cc b/lily/performance.cc index bbaadb50da..f47aaa78d2 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -167,7 +167,8 @@ Performance::process () Midi_stream midi_stream (out); progress_indication (_f ("MIDI output to `%s'...", out)); - target_string_globals.push (out); + + global_input_file->target_strings_.push (out); output (midi_stream); progress_indication ("\n"); diff --git a/lily/score.cc b/lily/score.cc index 4f203c8033..1c0956d857 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -29,6 +29,7 @@ Score::Score () : Input () { + input_file_ = 0; header_ = 0; music_ = SCM_EOL; errorlevel_ = 0; @@ -82,8 +83,6 @@ Score::~Score () void Score::run_translator (Music_output_def *odef) { - - #ifdef PARANOIA if (verbose_global_b) { @@ -150,14 +149,8 @@ Score::run_translator (Music_output_def *odef) progress_indication ("\n"); output->process (); + delete output ; - - /* - force GC. At this point, GUILE may give back mallocated area to - the system. - */ - - scm_gc (); } void @@ -166,7 +159,6 @@ Score::process () if (!unsmob_music (music_)) return; - for (int i=0; i < defs_.size (); i++) { if (no_paper_global_b @@ -177,8 +169,6 @@ Score::process () } - - void Score::add_output (Music_output_def *pap) { diff --git a/lily/scores.cc b/lily/scores.cc index 4680cd2a0b..6f9e679ee6 100644 --- a/lily/scores.cc +++ b/lily/scores.cc @@ -31,15 +31,36 @@ #include "lily-version.hh" #include "scm-hash.hh" -Sources* source_global = 0; -Array inclusion_globals; -Array target_string_globals; -Link_array score_globals; -Scheme_hash_table * global_header; +LY_DEFINE(ly_set_point_and_click_x, "set-point-and-click!", 1, 0, 0, + (SCM what), + "Set the options for Point-and-click source specials output. The +argument is a symbol. Possible options are @code{none} (no source specials), +@code{line} and @code{line-column}") +{ + /* + UGH. + */ + SCM val = SCM_BOOL_F; + if (ly_symbol2scm ("line-column") == what) + val = gh_eval_str ("line-column-location"); + else if (what == ly_symbol2scm ("line")) + val = gh_eval_str ("line-location"); + + /* + UGH. + + How do you do set! from C ? + */ + scm_primitive_eval (scm_list_n (ly_symbol2scm ("set!"), + ly_symbol2scm ("point-and-click"), val, SCM_UNDEFINED)); + return SCM_UNSPECIFIED; +} -void write_dependency_file (String fn, Array targets, - Array deps) +void +write_dependency_file (String fn, + Array targets, + Array deps) { const int WRAPWIDTH = 65; @@ -79,29 +100,32 @@ void write_dependency_file (String fn, Array targets, fprintf (f, "%s\n", out.to_str0 ()); } + void -do_deps () +Input_file_settings::do_deps () { if (dependency_global_b) { Path p = split_path (output_name_global); p.ext = "dep"; write_dependency_file (p.string (), - target_string_globals, - inclusion_globals); + target_strings_, + inclusion_names_); } } void -do_scores () +Input_file_settings::do_scores () { - if (!global_header) - global_header = new Scheme_hash_table; - for (int i=0; i < score_globals.size (); i++) - { - Score* is = score_globals[i]; + if (!global_header_) + global_header_ = new Scheme_hash_table; + for (int i=0; i < scores_.size (); i++) + { + Score* is = scores_[i]; + is->input_file_ = this; + if (is->errorlevel_) { is->warning (_ ("Score contains errors; will not process it")); @@ -115,24 +139,49 @@ do_scores () do_deps (); } -void -clear_scores () +Input_file_settings::~Input_file_settings () +{ + for (int i=0; i < scores_.size (); i++) + scm_gc_unprotect_object (scores_[i]->self_scm ()); + scores_.clear (); + + inclusion_names_.clear (); + if (global_header_) + scm_gc_unprotect_object (global_header_ ->self_scm ()); + + global_input_file =0; +} + + +Input_file_settings* global_input_file; + +Input_file_settings::Input_file_settings (String init_string, String file_string) { - for (int i=0; i < score_globals.size (); i++) - scm_gc_unprotect_object (score_globals[i]->self_scm ()); - score_globals.clear (); + global_input_file = this; + ly_set_point_and_click_x (SCM_BOOL_F); + + sources_.set_path (&global_path); + + My_lily_parser parser (this); + + progress_indication (_f ("Now processing: `%s'", file_string.to_str0 ())); + progress_indication ("\n"); + parser.parse_file (init_string, file_string); + + if (parser.error_level_) + { + exit_status_global = 1; + } + else + do_scores (); - inclusion_globals.clear (); - if (global_header) - scm_gc_unprotect_object (global_header ->self_scm ()); - global_header =0; } void -do_one_file (String init_string, String file_string) +do_one_file (String init_string, String file_string) { - if (init_string.length () && global_path.find (init_string).empty_b ()) + if (init_string.length () && global_path.find (init_string).empty_b ()) { warning (_f ("can't find file: `%s'", init_string)); warning (_f ("(search path: `%s')", global_path.string ().to_str0 ())); @@ -144,24 +193,5 @@ do_one_file (String init_string, String file_string) return; } - Sources sources; - source_global = &sources; - source_global->set_path (&global_path); - { - My_lily_parser parser (source_global); - - progress_indication (_f ("Now processing: `%s'", file_string.to_str0 ())); - progress_indication ("\n"); - parser.parse_file (init_string, file_string); - - if (parser.error_level_) - { - exit_status_global = 1; - } - else - do_scores (); - clear_scores (); - } - source_global = 0; + Input_file_settings inp_file(init_string, file_string); } - diff --git a/lily/system.cc b/lily/system.cc index 6731500db6..f1994d2129 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -290,7 +290,6 @@ System::output_molecule (SCM expr, Offset o) { Input * ip = unsmob_input (head); - pscore_->outputter_->output_scheme (scm_list_n (ly_symbol2scm ("define-origin"), scm_makfrom0str (ip->file_string ().to_str0 ()), gh_int2scm (ip->line_number ()), diff --git a/scm/ps.scm b/scm/ps.scm index 423c3326ad..ab2520e3b1 100644 --- a/scm/ps.scm +++ b/scm/ps.scm @@ -202,9 +202,12 @@ " {exch pop //systemdict /run get exec} " (ly-gulp-file "music-drawing-routines.ps") "{ exch pop //systemdict /run get exec } " -;; ps-testing is broken: global module - (if (defined? 'ps-testing) "\n /testing true def" "") -;; "\n /testing true def" + +;; ps-testing wreaks havoc when used with lilypond-book. +;; (if (defined? 'ps-testing) "\n /testing true def" "") + + + ;; "\n /testing true def" )) (define (lily-def key val) diff --git a/scm/tex.scm b/scm/tex.scm index 4df648dd0b..4f997945c4 100644 --- a/scm/tex.scm +++ b/scm/tex.scm @@ -177,7 +177,7 @@ (regexp-substitute/global #f "\n" (ly-gulp-file "music-drawing-routines.ps") 'pre " %\n" 'post) (ly-gulp-file "music-drawing-routines.ps")) - (if (defined? 'ps-testing) "/testing true def%\n" "") +; (if (defined? 'ps-testing) "/testing true def%\n" "") "}" "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit" "\\turnOnPostScript")) @@ -239,7 +239,7 @@ "}\\vss}") (define (filledbox breapth width depth height) - (if (defined? 'ps-testing) + (if (and #f (defined? 'ps-testing)) (embedded-ps (string-append (numbers->string (list breapth width depth height)) " draw_box" )) diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 61ea65b0f7..b571c8330b 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -953,6 +953,19 @@ if 1: conversions.append (((1,5,71), conv, 'extent-[XY] -> [XY]-extent')) +if 1: + def conv (str): + str = re.sub ("""#\(set! +point-and-click +line-column-location\)""", + """#(set-point-and-click! \'line-column)""", str) + str = re.sub ("""#\(set![ \t]+point-and-click +line-location\)""", + '#(set-point-and-click! \'line)', str) + str = re.sub ('#\(set! +point-and-click +#f\)', + '#(set-point-and-click! \'none)', str) + return str + + conversions.append (((1,5,72), conv, 'set! point-and-click -> set-point-and-click!')) + + ################################ # END OF CONVERSIONS ################################ -- 2.39.2