encapsulate file settings in a class, Input_file_settings.
* lily/scores.cc: new function ly_set_point_and_click_x
+2002-08-15 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * 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 <janneke@gnu.org>
* scripts/ly2dvi.py: Remove debug printing.
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
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
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}.
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"
@example
-\version "1.5.60"
+\version "1.5.72"
\header @{
title = "Two miniatures"
composer = "F. Bar Baz"
@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
\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")))
@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
-\version "1.5.68"
+\version "1.5.72"
\header {
composer = "ARTHUR GRAY"
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)
-#(set! point-and-click line-column-location)
+#(set-point-and-click! 'line-column)
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
-#(set! point-and-click line-column-location)
+#(set-point-and-click! 'line-column)
opus = "BWV 924"
piece = "1"
-\version "1.5.68"
+\version "1.5.72"
lowstaff = \translator "Staff" = "lower"
-#(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
-#(set! point-and-click line-column-location)
+#(set-point-and-click! 'line-column)
opus= "BWV 999"
piece = "3"
This file was partly generated using m4.
%}
-\version "1.5.68"
+\version "1.5.72"
upper = \notes \transpose c'' {
-#(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"
%{
-#(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 {
-#(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"
-\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 }
%{
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' {
-% #(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)))
-\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|
-\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 }
-\version "1.5.68"
+\version "1.5.72"
\include "os-music.ly"
\include "paper16.ly"
% 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)
-\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 {
{
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.
#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<String> inclusion_names_;
+ Array<String> target_strings_;
+ Link_array<Score> 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<String> target_string_globals;
-extern Array<String> inclusion_globals;
-extern Link_array<Score> score_globals;
-void do_scores ();
-void clear_scores ();
#endif /* FILE_RESULTS_HH */
class Hyphen_req;
class Includable_lexer;
+class Input_file_settings;
class Input;
class Item;
class Key_change_req;
extern int exit_status_global;
extern File_path global_path;
extern int score_count_global;
-extern Sources* source_global;
#endif /* MAIN_HH */
class My_lily_parser
{
public:
- My_lily_parser (Sources * sources);
+ My_lily_parser (Input_file_settings * sources);
~My_lily_parser ();
void do_init_file ();
Scheme_hash_table *default_header_;
int fatal_error_;
- Sources * source_;
+ Input_file_settings * input_file_;
int error_level_;
My_lily_lexer * lexer_;
protected:
VIRTUAL_COPY_CONS (Music_output_def);
-
public:
+ Paper_outputter* get_paper_outputter () ;
+
SCM font_descriptions ()const;
virtual ~Paper_def ();
static int score_count_;
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);
Link_array<Music_output_def> defs_;
SCM music_;
Scheme_hash_table * header_;
-
+ Input_file_settings* input_file_;
+
int errorlevel_;
/// construction
#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"
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 ();
}
<incl>\\{BLACK}*;?{WHITE} { /* got the include identifier */
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 ));
#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"
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);
}
#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;
progress_indication (_ ("Parsing..."));
set_yydebug (0);
- lexer_->new_input (init, source_);
+ lexer_->new_input (init, &input_file_->sources_);
do_yyparse ();
progress_indication ("\n");
error_level_ = 1;
}
- inclusion_globals = lexer_->filename_strings_;
+ input_file_->inclusion_names_ = lexer_->filename_strings_;
error_level_ = error_level_ | lexer_->errorlevel_; // ugh naming.
}
progress_indication (_f ("paper output to `%s'...",
outname == "-" ? String ("<stdout>") : 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 = "";
(c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "score.hh"
#include "main.hh"
#include "warn.hh"
#include "font-metric.hh"
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");
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<Paper_def*> ($1))
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");
Score::Score ()
: Input ()
{
+ input_file_ = 0;
header_ = 0;
music_ = SCM_EOL;
errorlevel_ = 0;
void
Score::run_translator (Music_output_def *odef)
{
-
-
#ifdef PARANOIA
if (verbose_global_b)
{
progress_indication ("\n");
output->process ();
+
delete output ;
-
- /*
- force GC. At this point, GUILE may give back mallocated area to
- the system.
- */
-
- scm_gc ();
}
void
if (!unsmob_music (music_))
return;
-
for (int i=0; i < defs_.size (); i++)
{
if (no_paper_global_b
}
-
-
void
Score::add_output (Music_output_def *pap)
{
#include "lily-version.hh"
#include "scm-hash.hh"
-Sources* source_global = 0;
-Array<String> inclusion_globals;
-Array<String> target_string_globals;
-Link_array<Score> 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<String> targets,
- Array<String> deps)
+void
+write_dependency_file (String fn,
+ Array<String> targets,
+ Array<String> deps)
{
const int WRAPWIDTH = 65;
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"));
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 ()));
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);
}
-
{
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 ()),
" {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)
(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"))
"}\\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" ))
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
################################