+2004-01-09 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/main.cc (main_prog): print summary of failed files.
+
+ * lily/axis-group-engraver.cc: move all spanner creation to
+ process_music (). Now staffs can be adjusted with \override too.
+
+ * lily/chord-tremolo-engraver.cc (try_music): fix spurious warning.
+
2004-01-08 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/translator-def.cc (get_translator_names): accept user
+ tweaks too.
+
+ * mf/feta-bolletjes.mf (overdone_heads): oops, slashes are twice
+ as big as normal heads.
+
* input/*ly: run convert-ly
* lily/tuplet-bracket.cc (brew_molecule): call after_line_breaking
Unreleased:
@itemize
-@item Features of spanner contexts, like Staff, can now be changed easily:
+
+@item The syntax for changing staffs has changed. The keyword
+@code{\change} should now be used, e.g.
+
+@example
+ \change Staff = up
+@end example
+
+@item Features of spanner contexts, like @code{Staff}, can now be changed easily:
@example
\new Staff \with @{
@itemize @bullet
@item Multi measure rests are now truly centered between the
-clefs/barlines of the staff, independent of symbols on the other staffs.
+clefs/barlines of the staff, their position is independent of symbols
+on the other staffs.
@item Collision resolution for dots in chords has been improved greatly.
\version "2.1.7"
+
\header {
texidoc = "The staff is a grob, and may be adjusted as well: this one
shows a staff with 6 thick line, and a slightly large staffspace.
Beams remain correctly quantized."
+
}
\score {
\notes <<
- \new Staff \mus
- \new Staff \with {
- StaffSymbol \set #'thickness = #2.0
- StaffSymbol \set #'line-count = #6
- StaffSymbol \set #'staff-space = #1.1
- } \mus
+ \new Staff {
+ \property
+ Staff. StaffSymbol \set #'thickness = #2.0
+ \property
+ Staff.StaffSymbol \set #'line-count = #6
+ \property
+ Staff.StaffSymbol \set #'staff-space = #1.1
+ \mus
+ }
+ \mus
>>
\paper {
raggedright = ##t
- }
+ }
}
c'''32 \change Staff = down
g16]
\change Staff = up
-\property Voice.Stem \revert #'direction
+ \property Voice.Stem \revert #'direction
\property Voice.followVoice = ##t
c'''32([ b''16 a''16 gis''16 g''32)] } \\
{ s4 \times 2/3 { d'16[ f' g'] } as'32[ b''32 e'' d''] } \\
protected:
Spanner *staffline_;
Link_array<Grob> elts_;
- virtual void initialize ();
+ virtual void process_music ();
virtual void finalize ();
virtual void acknowledge_grob (Grob_info);
virtual void process_acknowledged_grobs ();
}
void
-Axis_group_engraver::initialize ()
+Axis_group_engraver::process_music ()
{
- staffline_ = get_spanner ();
+if (!staffline_)
+ {
+ staffline_ = get_spanner ();
Grob * it = unsmob_grob (get_property ("currentCommandColumn"));
announce_grob(staffline_, SCM_EOL);
}
+}
Spanner*
Axis_group_engraver::get_spanner () const
#include "lookup.hh"
#include "paper-column.hh"
-#include "main.hh"
#include "grob.hh"
#include "bar-line.hh"
#include "string.hh"
{
SCM bn = get_property ("currentBarNumber");
SCM proc = get_property ("barNumberVisibility");
- if (gh_number_p (bn) && to_boolean(gh_call1(proc, bn)))
+ if (gh_number_p (bn) && gh_procedure_p (proc)
+ && to_boolean(gh_call1(proc, bn)))
{
create_items ();
// guh.
#include "paper-def.hh"
#include "font-interface.hh"
#include "paper-def.hh"
-#include "main.hh"
#include "dimensions.hh"
#include "item.hh"
#include "pitch.hh"
int elt_count = seq ? scm_ilength (seq-> music_list ()) : 1;
- if (elt_count != 2)
+ if (seq && elt_count != 2)
{
rp->origin ()->warning (_f ("Chord tremolo with %d elements. Must have two elements.", elt_count));
}
#include "engraver.hh"
#include "engraver-group-engraver.hh"
#include "grob.hh"
-#include "main.hh"
#include "score-engraver.hh"
#include "warn.hh"
TODO: junk grob-info, and make a cause grob-property to store
`causes' generically.
*/
-
if (unsmob_music (cause) || unsmob_grob (cause))
e->set_grob_property ("cause", cause);
#define MAIN_HH
#include "lily-proto.hh"
+#include "array.hh"
void debug_init ();
void set_debug (bool);
/* misc */
extern All_font_metrics *all_fonts_global;
+extern Array<String> failed_files;
extern int exit_status_global;
extern File_path global_path;
extern int score_count_global;
+++ /dev/null
-/*
- output-property.hh -- declare Output_property
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2000--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#ifndef OUTPUT_PROPERTY_HH
-#define OUTPUT_PROPERTY_HH
-
-#include "music.hh"
-
-
-/*
-
-props:
-
- relevant stuff: the predicate, the symbol, the value
-
- */
-class Output_property : public Music
-{
-public:
- VIRTUAL_COPY_CONS (Music);
- Output_property (SCM, SCM, SCM);
-};
-
-#endif /* OUTPUT_PROPERTY_HH */
-
-#error
SCM default_child_context_name ();
SCM get_context_name () const;
SCM get_accepted () const;
- SCM get_translator_names () const;
+ SCM get_property_ops () const { return property_ops_; }
+ SCM get_translator_names (SCM) const;
void set_acceptor (SCM accepts, bool add);
Link_array<Translator_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
- Translator_group * instantiate (Music_output_def*);
+ Translator_group * instantiate (Music_output_def*, SCM extra_ops);
SCM to_alist () const;
bool is_alias (SCM) const;
VIRTUAL_COPY_CONS (Translator);
Translator_group (Translator_group const &);
Translator_group ();
- void add_fresh_group_translator (Translator *trans, SCM ops);
+ void add_fresh_group_translator (Translator *trans);
void add_used_group_translator (Translator *trans);
/// Score_register = 0, Staff_registers = 1, etc)
if (parser.error_level_)
{
exit_status_global = 1;
+ failed_files.push (in_file);
}
#include "global-ctor.hh"
#include "kpath.hh"
+Array<String> failed_files;
+
static int sane_putenv (char const* key, char const* value, bool overwrite = false);
/*
} while ((arg = oparser_p_static->get_next_arg ()));
delete oparser_p_static;
oparser_p_static = 0;
+
+ if (exit_status_global)
+ {
+ printf ("Failed files: ");
+ for (int i = 0; i < failed_files.size (); i++)
+ printf ("%s", failed_files[i].to_str0 ());
+ }
exit (exit_status_global);
}
if (!t)
error (_f ("can't find `%s' context", "Score"));
- Translator_group * tg = t->instantiate (this);
+ Translator_group * tg = t->instantiate (this, SCM_EOL);
tg->initialize ();
%type <i> exclamations questions dots optional_rest
%type <i> bass_mod
%type <scm> grace_head
-%type <scm> property_operation_list
+%type <scm> context_mod_list
%type <scm> lyric_element
%type <scm> bass_number br_bass_figure bass_figure figure_list figure_spec
%token <i> DIGIT
%token <scm> FRACTION
%token <id> IDENTIFIER
%token <scm> CHORDNAMES
-
-%token <scm> CHORD_MODIFIER
-
+%token <scm> CHORD_MODIFIER
%token <scm> SCORE_IDENTIFIER
%token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
%token <scm> NUMBER_IDENTIFIER
%type <music> relative_music re_rhythmed_music part_combined_music
%type <music> music_property_def context_change
%type <scm> Music_list
-%type <scm> property_operation context_mod translator_mod
+%type <scm> property_operation context_mod translator_mod optional_context_mod
%type <outputdef> music_output_def_body
%type <music> shorthand_command_req
%type <music> post_event tagged_post_event
;
+optional_context_mod:
+ /**/ { $$ = SCM_EOL; }
+ | WITH '{' context_mod_list '}' { $$ = $3; }
+ ;
+
grace_head:
GRACE { $$ = scm_makfrom0str ("Grace"); }
| ACCIACCATURA { $$ = scm_makfrom0str ("Acciaccatura"); }
| APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); }
;
-property_operation_list:
+context_mod_list:
/* */ { $$ = SCM_EOL; }
- | property_operation_list property_operation {
+ | context_mod_list context_mod {
$$ = gh_cons ($2, $1);
}
;
scm_gc_unprotect_object ($2->self_scm ());
#endif
}
- | CONTEXT string '=' string Music {
- $$ = context_spec_music ($2, $4, $5, SCM_EOL);
+ | CONTEXT string '=' string optional_context_mod Music {
+ $$ = context_spec_music ($2, $4, $6, $5);
}
- | CONTEXT STRING Music {
- $$ = context_spec_music ($2, SCM_UNDEFINED, $3, SCM_EOL);
+ | CONTEXT STRING optional_context_mod Music {
+ $$ = context_spec_music ($2, SCM_UNDEFINED, $4, $3);
}
- | NEWCONTEXT string Music {
+ | NEWCONTEXT string optional_context_mod Music {
$$ = context_spec_music ($2, get_next_unique_context (),
- $3, SCM_EOL);
- }
- | TRANSLATOR string '{' property_operation_list '}' Music {
- $$ = context_spec_music ($2, get_next_unique_context (),
- $6, $4);
-
- }
- | TRANSLATOR string '=' string '{' property_operation_list '}' Music {
- $$ = context_spec_music ($2, $4,
- $8, $6);
+ $4, $3);
}
+
| TIMES {
THIS->push_spot ();
}
void
Piano_pedal_engraver::initialize ()
{
-
previous_.clear ();
char * names [] = { "Sostenuto", "Sustain", "UnaCorda", 0 };
*/
#include "protected-scm.hh"
#include "lily-guile.hh"
-#include "main.hh"
Protected_scm::Protected_scm ()
{
Spanner * sep_span_;
virtual void acknowledge_grob (Grob_info);
- virtual void initialize ();
+ virtual void process_music ();
virtual void finalize ();
virtual void stop_translation_timestep ();
virtual void start_translation_timestep ();
}
void
-Separating_line_group_engraver::initialize ()
+Separating_line_group_engraver::process_music ()
{
- sep_span_ = new Spanner (get_property ("SeparatingGroupSpanner"));
- announce_grob(sep_span_, SCM_EOL);
- sep_span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
-}
+ if (!sep_span_)
+ {
+ sep_span_ = new Spanner (get_property ("SeparatingGroupSpanner"));
+ announce_grob(sep_span_, SCM_EOL);
+ sep_span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ }
+}
void
Separating_line_group_engraver::finalize ()
{
#include "warn.hh"
#include "paper-def.hh"
#include "slur-bezier-bow.hh"
-#include "main.hh"
Slur_bezier_bow::Slur_bezier_bow (Array<Offset> encompass, Direction dir,
Real h_inf, Real r_0)
virtual void acknowledge_grob (Grob_info);
virtual void start_translation_timestep ();
virtual void stop_translation_timestep ();
- virtual void initialize ();
+ virtual void process_music ();
virtual void finalize ();
};
}
void
-Spacing_engraver::initialize ()
+Spacing_engraver::process_music ()
{
- spacing_ =new Spanner (get_property ("SpacingSpanner"));
- spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
- announce_grob(spacing_, SCM_EOL);
+ if (!spacing_)
+ {
+ spacing_ =new Spanner (get_property ("SpacingSpanner"));
+ spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ announce_grob(spacing_, SCM_EOL);
+ }
}
-
void
Spacing_engraver::finalize ()
{
/*
TODO: this file/class is too complex. Should figure out how to chop
this up even more.
-
+
*/
class Spacing_spanner
virtual ~Staff_symbol_engraver ();
virtual void acknowledge_grob (Grob_info);
virtual void finalize ();
- virtual void initialize ();
+ virtual void process_music ();
};
}
void
-Staff_symbol_engraver::initialize ()
+Staff_symbol_engraver::process_music ()
{
- span_ = new Spanner (get_property ("StaffSymbol"));
+ if (!span_)
+ {
+ span_ = new Spanner (get_property ("StaffSymbol"));
- span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
- announce_grob(span_, SCM_EOL);
+ announce_grob(span_, SCM_EOL);
+ }
}
void
+++ /dev/null
-#include "config.h"
-
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#include <iostream>
-#include <fstream>
-
-#include "stream.hh"
-#include "file-path.hh"
-#include "warn.hh"
-#include "main.hh"
-
-#if __GNUC__ > 2
-std::ostream *
-open_file_stream (String filename, std::ios_base::openmode mode)
-#else
-std::ostream *
-open_file_stream (String filename, int mode)
-#endif
-{
- std::ostream *os;
- if ((filename == "-"))
- os = &std::cout;
- else
- {
- Path p = split_path (filename);
- if (!p.dir.is_empty ())
- if (mkdir (p.dir.to_str0 (), 0777) == -1 && errno != EEXIST)
- error (_f ("can't create directory: `%s'", p.dir));
- os = new std::ofstream (filename.to_str0 (), mode);
- }
- if (!*os)
- error (_f ("can't open file: `%s'", filename));
- return os;
-}
-
-void
-close_file_stream (std::ostream *os)
-{
- *os << std::flush;
- if (!*os)
- {
- warning (_ ("Error syncing file (disk full?)"));
- exit_status_global = 1;
- }
- if (os != &std::cout)
- delete os;
- os = 0;
-}
protected:
Spanner * delim_;
virtual void acknowledge_grob (Grob_info);
- virtual void initialize ();
+ virtual void process_music ();
virtual void finalize ();
};
}
void
-System_start_delimiter_engraver::initialize ()
+System_start_delimiter_engraver::process_music ()
{
- SCM delim_name =get_property ("systemStartDelimiter");
- delim_ = new Spanner (internal_get_property (delim_name));
+ if (!delim_)
+ {
+ SCM delim_name =get_property ("systemStartDelimiter");
+ delim_ = new Spanner (internal_get_property (delim_name));
- delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
- announce_grob (delim_, SCM_EOL);
+ delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ announce_grob (delim_, SCM_EOL);
+ }
}
-
void
System_start_delimiter_engraver::finalize ()
{
smobify_self();
description_ = s.description_;
-
accept_mods_ = s.accept_mods_;
property_ops_ = s.property_ops_;
translator_mods_ = s.translator_mods_;
}
}
-SCM
-Translator_def::get_translator_names () const
-{
- SCM l1 = SCM_EOL;
- SCM l2 = SCM_EOL;
-
- SCM mods = scm_reverse (translator_mods_);
- for (SCM s = mods; gh_pair_p (s); s = gh_cdr (s))
- {
- SCM tag = gh_caar (s);
- SCM arg = gh_cadar (s);
-
- if (ly_symbol2scm ("consists") == tag)
- l1 = gh_cons (arg, l1);
- else if (ly_symbol2scm ("consists-end") == tag)
- l2 = gh_cons (arg, l2);
- else if (ly_symbol2scm ("remove") == tag)
- {
- l1 = scm_delete_x (arg, l1);
- l2 = scm_delete_x (arg, l2);
- }
- }
- return scm_append_x (scm_list_2 (l1, l2));
-}
SCM
Translator_def::get_context_name () const
scm_gc_unprotect_object (str);
}
}
- return l;
+ return l;
+}
+
+
+SCM
+Translator_def::get_translator_names (SCM user_mod) const
+{
+ SCM l1 = SCM_EOL;
+ SCM l2 = SCM_EOL;
+
+ SCM mods = scm_reverse_x (scm_list_copy (translator_mods_),
+ user_mod);
+
+ for (SCM s = mods; gh_pair_p (s); s = gh_cdr (s))
+ {
+ SCM tag = gh_caar (s);
+ SCM arg = gh_cadar (s);
+
+ if (gh_string_p (arg))
+ arg = scm_string_to_symbol (arg);
+
+ if (ly_symbol2scm ("consists") == tag)
+ l1 = gh_cons (arg, l1);
+ else if (ly_symbol2scm ("consists-end") == tag)
+ l2 = gh_cons (arg, l2);
+ else if (ly_symbol2scm ("remove") == tag)
+ {
+ l1 = scm_delete_x (arg, l1);
+ l2 = scm_delete_x (arg, l2);
+ }
+ }
+
+ return scm_append_x (scm_list_2 (l1, l2));
}
Translator_group *
-Translator_def::instantiate (Music_output_def* md)
+Translator_def::instantiate (Music_output_def* md, SCM ops)
{
Translator * g = get_translator (translator_group_type_);
g = g->clone ();
tg->output_def_ = md;
tg->definition_ = self_scm ();
- SCM trans_names = get_translator_names ();
+ SCM trans_names = get_translator_names (ops);
tg->simple_trans_list_ = names_to_translators (trans_names, tg);
-
- return tg;
-}
-void
-Translator_def::apply_default_property_operations (Translator_group*tg)
-{
- apply_property_operations (tg, property_ops_);
+ return tg;
}
-
SCM
Translator_def::clone_scm () const
{
SCM d = get_accepted ();
return gh_pair_p (d) ? ly_car (scm_last_pair (d)) : SCM_EOL;
}
+void
+Translator_def::apply_default_property_operations (Translator_group *tg)
+{
+ apply_property_operations (tg , property_ops_);
+}
SCM
Translator_def::to_alist () const
{
SCM l = SCM_EOL;
- l = gh_cons (gh_cons (ly_symbol2scm ("consists"), get_translator_names ()), l);
+ l = gh_cons (gh_cons (ly_symbol2scm ("consists"),
+ get_translator_names (SCM_EOL)), l);
l = gh_cons (gh_cons (ly_symbol2scm ("description"), description_), l);
l = gh_cons (gh_cons (ly_symbol2scm ("aliases"), context_aliases_), l);
l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), get_accepted ()), l);
void
-Translator_group::add_fresh_group_translator (Translator*t, SCM pre_init_ops)
+Translator_group::add_fresh_group_translator (Translator*t)
{
Translator_group*tg = dynamic_cast<Translator_group*> (t);
- assert (tg);
trans_group_list_ = add_translator (trans_group_list_,t);
- unsmob_translator_def (tg->definition_)->apply_default_property_operations (tg);
- apply_property_operations (tg, pre_init_ops);
+
+ Translator_def * td = unsmob_translator_def (tg->definition_);
+ td->apply_default_property_operations (tg);
+
t->initialize ();
}
// start at 1. The first one (index 0) will be us.
for (int i=0; i < path.size (); i++)
{
- Translator_group * new_group = path[i]->instantiate (output_def_);
+ SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
+
+ Translator_group * new_group
+ = path[i]->instantiate (output_def_, ops);
- SCM ops = SCM_EOL;
if (i == path.size () -1)
{
new_group->id_string_ = id;
- ops = operations;
}
- current->add_fresh_group_translator (new_group, ops);
+ current->add_fresh_group_translator (new_group);
+ apply_property_operations (new_group, ops);
+
current = new_group;
}
warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ()));
t = unsmob_translator_def (this->definition_);
}
- Translator_group *tg = t->instantiate (output_def_);
- add_fresh_group_translator (tg, SCM_EOL);
+ Translator_group *tg = t->instantiate (output_def_, SCM_EOL);
+ add_fresh_group_translator (tg);
if (!tg->is_bottom_translator_b ())
return tg->get_default_interpreter ();
return ly_symbol2string (td->get_context_name ());
}
+/*
+ PRE_INIT_OPS is in the order specified, and hence must be reversed.
+ */
void
apply_property_operations (Translator_group*tg, SCM pre_init_ops)
{
TRANSLATOR_DECLARATIONS(Vertical_align_engraver);
protected:
virtual void acknowledge_grob (Grob_info);
- virtual void initialize ();
+ virtual void process_music ();
virtual void finalize ();
};
}
void
-Vertical_align_engraver::initialize ()
+Vertical_align_engraver::process_music ()
{
- valign_ =new Spanner (get_property ("VerticalAlignment"));
- valign_->set_bound (LEFT,unsmob_grob (get_property ("currentCommandColumn")));
- announce_grob(valign_ , SCM_EOL);
+ if (!valign_)
+ {
+ valign_ =new Spanner (get_property ("VerticalAlignment"));
+ valign_->set_bound (LEFT,unsmob_grob (get_property ("currentCommandColumn")));
+ announce_grob(valign_ , SCM_EOL);
+ }
}
void
fet_endchar;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
+%
+% slash heads are for indicating improvisation. They are
+% twice as high as normal heads.
+%
def draw_slash(expr hwid_hash) =
+ save exact_height;
+ save ne_dir;
+ pair ne_dir;
+ exact_height = staff_space# + stafflinethickness#/2;
-
- set_char_box (0, staff_space# / slash_slope + hwid_hash,
- staff_space#/2 + stafflinethickness#/2,
- staff_space#/2 + stafflinethickness#/2);
+ set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
+ exact_height, exact_height);
charwx := charwd;
charwy := charht;
bot y1 = - d;
top y2 = h;
lft x1 = 0;
- lft x2 = staff_space / slash_slope;
+ lft x2 = 2 h / slash_slope;
rt x3 = w;
y3 = y2;
y4 = y1;
x3- x2 = x4 - x1;
+ ne_dir := unitvector( z3 - z4);
filldraw z1 --- z2 --- z3 --- z4 --- cycle;
if hwid_hash > 2 slash_thick#:
y5 = y8;
y3 - y7 = th;
y5 - y1 = th;
- z6 - z5 = whatever * (1, slash_slope);
- z8 - z7 = whatever * (1, slash_slope);
+ z6 - z5 = whatever * ne_dir;
+ z8 - z7 = whatever * ne_dir;
- z5 = z1 + whatever * (1, slash_slope) + (th, 0);
- z8 = z4 + whatever * (1, slash_slope) + (-th, 0);
+ z5 = z1 + whatever * ne_dir + th * (ne_dir rotated -90);
+ z8 = z4 + whatever * ne_dir + th * (ne_dir rotated 90);
unfill
z5 -- z6 -- z7 -- z8 -- cycle;
enddef;
fet_beginchar("Whole slashhead","0slash","wholeslashhead")
- draw_slash(2 slash_thick# + 0.5 staff_space#);
+ draw_slash(4 slash_thick# + 0.5 staff_space#);
fet_endchar;
fet_beginchar("Half slashhead","1slash","halfslashhead")
- draw_slash(2 slash_thick# + 0.15 staff_space#);
+ draw_slash(3.0 slash_thick# + 0.15 staff_space#);
fet_endchar;
fet_beginchar("Quart slashhead","2slash","quartslashhead")
- draw_slash(slash_thick#);
+ draw_slash(1.5 slash_thick#);
fet_endchar;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
% thick is the distance between the NE/SW parallel lines in the cross
% (distance between centres of lines)
% in stafflinethickness def