+2006-05-31 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * lily/parser.yy (simple_markup): replace THIS with PARSER.
+
+ * ly/Welcome-to-LilyPond-MacOS.ly: include in LilyPond, so version
+ number stays up to date.
+
+ * buildscripts/output-distance.py
+ (ComparisonData.create_html_result_page): new routine: summarise
+ results in HTML page with images.
+ (ComparisonData.create_text_result_page): create summary text files too.
+
+ * GNUmakefile.in (web-ext): package .signature files too. They
+ compress well.
+
+ * scm/stencil.scm (write-system-signature): typo.
+
+ * GNUmakefile.in: create web-root/VERSION to help upload scripts.
+
+ * scm/stencil.scm (write-system-signature): better escaping.
+ only write signature for music systems, not for markup systems.
+
+ * scm/framework-ps.scm (output-framework): dump-signatures support
+ for plain output.
+
+ * make/lilypond-vars.make (LILYPOND_BOOK_FLAGS): add -ddump-signatures.
+
+ * scm/framework-ps.scm (write-preamble): redefine mark_URI to nop
+ for -dno-point-and-click
+
+ * lily/grob.cc (get_print_stencil): don't read
+ point_and_click_global to determine whether to set grob-cause.
+
+ * buildscripts/output-distance.py (main): new function.
+ (ComparisonData): new class.
+
+ * lily/ledger-line-engraver.cc (acknowledge_staff_symbol): be more
+ careful with generating new LedgerLineSpanners.
+
+ * lily/ledger-line-spanner.cc (set_spacing_rods): suicide if no staff.
+
+ * ly/engraver-init.ly: remove Ledger_line_engraver from Voice
+ context. This fixes double ledger lines in output.
+
+ * lily/system.cc (get_paper_system): remove 3 layer limit.
+
+ * buildscripts/output-distance.py (SystemLink.distance): new
+ file. Compare signatures.
+
+ * python/safeeval.py (SafeEval.visitUnarySub): new file.
+
+ * lily/grob-array.cc (remove_duplicates): rename from
+ uniq(). Sort before calling uniq() so it actually works.
+
+ * scripts/lilypond-book.py (Lilypond_file_snippet.ly): strip
+ \version from lilypond file snippet.
+ (Lilypond_file_snippet.ly): oops. typo.
+ (find_toplevel_snippets): urgh. again.
+
+ * lily/system.cc (get_paper_systems): uniq all_elements_ , to
+ prevent duplicated broken items in output.
+
+ * scm/framework-eps.scm (output-classic-framework): only dump if
+ dump-signatures is set.
+
+ * scm/lily.scm (define-scheme-options): add dump-signatures option.
+
+ * scm/stencil.scm (write-system-signature): new routine: write
+ python parseable signature of a separate paper system.
+
+ * lily/stanza-number-engraver.cc (process_music): use is_markup()
+ iso is_string().
+ include header.
+
+ * stepmake/aclocal.m4: STEPMAKE_PYTHON(): clear cached value since
+ arg 2 might point us to a new binary (patch by Karl Hammar)
+
2006-05-25 Joe Neeman <joeneeman@gmail.com>
* lily/stem-tremolo.cc (print): fix whole note tremolo placement
final-install:
@true
-web-ext = html midi pdf png txt ly
+web-ext = html midi pdf png txt ly signature
footify = $(PYTHON) $(step-bindir)/add-html-footer.py --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION)
footifymail = MAILADDRESS='http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs'
## rewrite file names so we lose out-www
rm -rf $(outdir)/web-root/
- mkdir $(outdir)/web-root/
+ mkdir $(outdir)/web-root/
cat $(outdir)/weblist | (cd $(top-build-dir); tar -cf- -T- ) | \
tar -C $(outdir)/web-root/ -xf -
- cd $(outdir)/web-root/ && \
+ for dir in $(outdir)/web-root/ ; do \
+ cd $$dir && \
for a in `find . -name out-www`; do \
rsync -a --link-dest $$a/ $$a/ $$a/.. ; \
rm -rf $$a ; \
- done
+ done \
+ done
+ echo $(TOPLEVEL_VERSION) > $(outdir)/web-root/VERSION
tree-prefix = $(outdir)
tree-bin = $(tree-prefix)/bin
grobs_.clear ();
}
+void
+Grob_array::remove_duplicates ()
+{
+ assert (!ordered_);
+
+ vector_sort (grobs_, default_compare);
+ ::uniq (grobs_);
+}
+
bool
Grob_array::empty () const
{
ga->add (unsmob_grob (scm_car (s)));
return arr_scm;
}
+
else
{
SCM expr = m->expr ();
- if (point_and_click_global)
- expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
- self_scm (), expr);
+ expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
+ self_scm (), expr);
retval = Stencil (m->extent_box (), expr);
}
Grob *grob (vsize i) { return grobs_.at (i); }
vsize size () const { return grobs_.size (); }
bool empty () const;
+ void remove_duplicates ();
void clear ();
void add (Grob *x) { grobs_.push_back (x); }
void set_array (vector<Grob*> const &src);
implemented separately from the class. */
LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0,
(SCM x),
- "Return #t if @var{x} is an input location.")
+ "Is @var{x} an @code{input-location}?")
{
return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F;
}
return SCM_UNSPECIFIED;
}
-LY_DEFINE (ly_input_file_line_column, "ly:input-file-line-char-column", 1, 0, 0, (SCM sip),
+
+LY_DEFINE (ly_input_file_line_column,
+ "ly:input-file-line-char-column",
+ 1, 0, 0, (SCM sip),
"Return input location in @var{sip} as (file-name line char column).")
{
Input *ip = unsmob_input (sip);
SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
- int l, ch, col;
+ int l = 0;
+ int ch = 0;
+ int col = 0;
ip->get_counts (&l, &ch, &col);
return scm_list_4 (scm_makfrom0str (ip->file_string ().c_str ()),
scm_from_int (l),
scm_from_int (col));
}
-LY_DEFINE (ly_input_both_locations, "ly:input-both-locations", 1, 0, 0, (SCM sip),
- "Return input location in @var{sip} as (file-name first-line first-column last-line last-column).")
+LY_DEFINE (ly_input_both_locations,
+ "ly:input-both-locations",
+ 1, 0, 0, (SCM sip),
+ "Return input location in @var{sip} as "
+ "(file-name first-line first-column last-line last-column).")
{
Input *ip = unsmob_input (sip);
SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
#define YYERROR_VERBOSE 1
#define YYPARSE_PARAM my_lily_parser
#define YYLEX_PARAM my_lily_parser
-#define THIS\
+#define PARSER\
((Lily_parser *) my_lily_parser)
-#define yyerror THIS->parser_error
+#define yyerror PARSER->parser_error
/* We use custom location type: Input objects */
#define YYLTYPE Input
| lilypond assignment {
}
| lilypond error {
- THIS->error_level_ = 1;
+ PARSER->error_level_ = 1;
}
| lilypond INVALID {
- THIS->error_level_ = 1;
+ PARSER->error_level_ = 1;
}
;
toplevel_expression:
lilypond_header {
- THIS->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
+ PARSER->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
}
| book_block {
Book *book = $1;
- SCM proc = THIS->lexer_->lookup_identifier ("toplevel-book-handler");
- scm_call_2 (proc, THIS->self_scm (), book->self_scm ());
+ SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-book-handler");
+ scm_call_2 (proc, PARSER->self_scm (), book->self_scm ());
book->unprotect ();
}
| score_block {
Score *score = $1;
- SCM proc = THIS->lexer_->lookup_identifier ("toplevel-score-handler");
- scm_call_2 (proc, THIS->self_scm (), score->self_scm ());
+ SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-score-handler");
+ scm_call_2 (proc, PARSER->self_scm (), score->self_scm ());
score->unprotect ();
}
| toplevel_music {
Music *music = $1;
- SCM proc = THIS->lexer_->lookup_identifier ("toplevel-music-handler");
- scm_call_2 (proc, THIS->self_scm (), music->self_scm ());
+ SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-music-handler");
+ scm_call_2 (proc, PARSER->self_scm (), music->self_scm ());
music->unprotect ();
}
| full_markup {
- SCM proc = THIS->lexer_->lookup_identifier ("toplevel-text-handler");
- scm_call_2 (proc, THIS->self_scm (), $1);
+ SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-text-handler");
+ scm_call_2 (proc, PARSER->self_scm (), $1);
}
| output_def {
SCM id = SCM_EOL;
else if ($1->c_variable ("is-layout") == SCM_BOOL_T)
id = ly_symbol2scm ("$defaultlayout");
- THIS->lexer_->set_identifier (id, od->self_scm ());
+ PARSER->lexer_->set_identifier (id, od->self_scm ());
od->unprotect();
}
;
lilypond_header_body:
{
- $$ = get_header(THIS);
- THIS->lexer_->add_scope ($$);
+ $$ = get_header(PARSER);
+ PARSER->lexer_->add_scope ($$);
}
| lilypond_header_body assignment {
lilypond_header:
HEADER '{' lilypond_header_body '}' {
- $$ = THIS->lexer_->remove_scope ();
+ $$ = PARSER->lexer_->remove_scope ();
}
;
}
- THIS->lexer_->set_identifier ($1, $3);
+ PARSER->lexer_->set_identifier ($1, $3);
/*
TODO: devise standard for protection in parser.
{
$$ = new Book;
$$->set_spot (@$);
- $$->paper_ = dynamic_cast<Output_def*> (unsmob_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"))->clone ());
+ $$->paper_ = dynamic_cast<Output_def*> (unsmob_output_def (PARSER->lexer_->lookup_identifier ("$defaultpaper"))->clone ());
$$->paper_->unprotect ();
- $$->header_ = THIS->lexer_->lookup_identifier ("$defaultheader");
+ $$->header_ = PARSER->lexer_->lookup_identifier ("$defaultheader");
}
| BOOK_IDENTIFIER {
$$ = unsmob_book ($1);
SCM m = $1->self_scm ();
$1->unprotect();
SCM scorify = ly_lily_module_constant ("scorify-music");
- SCM score = scm_call_2 (scorify, m, THIS->self_scm ());
+ SCM score = scm_call_2 (scorify, m, PARSER->self_scm ());
// pass ownernship to C++ again.
$$ = unsmob_score (score);
| score_body output_def {
if ($2->lookup_variable (ly_symbol2scm ("is-paper")) == SCM_BOOL_T)
{
- THIS->parser_error (@2, _("\\paper cannot be used in \\score, use \\layout instead"));
+ PARSER->parser_error (@2, _("\\paper cannot be used in \\score, use \\layout instead"));
}
else
$$ = $1;
if ($$->lookup_variable (ly_symbol2scm ("is-paper")) != SCM_BOOL_T)
{
- THIS->parser_error (@1, _ ("need \\paper for paper block"));
- $$ = get_paper (THIS);
+ PARSER->parser_error (@1, _ ("need \\paper for paper block"));
+ $$ = get_paper (PARSER);
}
}
;
output_def_body '}' {
$$ = $1;
- THIS->lexer_->remove_scope ();
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->remove_scope ();
+ PARSER->lexer_->pop_state ();
}
;
output_def_head:
PAPER {
- $$ = get_paper (THIS);
+ $$ = get_paper (PARSER);
$$->input_origin_ = @$;
- THIS->lexer_->add_scope ($$->scope_);
+ PARSER->lexer_->add_scope ($$->scope_);
}
| MIDI {
- Output_def *p = get_midi (THIS);
+ Output_def *p = get_midi (PARSER);
$$ = p;
- THIS->lexer_->add_scope (p->scope_);
+ PARSER->lexer_->add_scope (p->scope_);
}
| LAYOUT {
- Output_def *p = get_layout (THIS);
+ Output_def *p = get_layout (PARSER);
- THIS->lexer_->add_scope (p->scope_);
+ PARSER->lexer_->add_scope (p->scope_);
$$ = p;
}
;
output_def_head_with_mode_switch:
output_def_head {
- THIS->lexer_->push_initial_state ();
+ PARSER->lexer_->push_initial_state ();
$$ = $1;
}
;
Output_def *o = unsmob_output_def ($3);
o->input_origin_.set_spot (@$);
$$ = o;
- THIS->lexer_->remove_scope ();
- THIS->lexer_->add_scope (o->scope_);
+ PARSER->lexer_->remove_scope ();
+ PARSER->lexer_->add_scope (o->scope_);
}
| output_def_body assignment {
optional_context_mod:
/**/ { $$ = SCM_EOL; }
- | WITH { THIS->lexer_->push_initial_state (); }
+ | WITH { PARSER->lexer_->push_initial_state (); }
'{' context_mod_list '}'
{
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
$$ = $4;
}
;
Prefix_composite_music:
Generic_prefix_music_scm {
- $$ = run_music_function (THIS, $1);
+ $$ = run_music_function (PARSER, $1);
}
| CONTEXT simple_string optional_id optional_context_mod Music {
$$ = context_spec_music ($2, $3, $5, $4, false);
{
$$ = $2;
}
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
}
| mode_changing_head_with_context optional_context_mod Grouped_music_list {
$$ = context_spec_music ($1, SCM_UNDEFINED, $3, $2, true);
$$->unprotect();
$$ = chm;
}
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
}
| relative_music { $$ = $1; }
| re_rhythmed_music { $$ = $1; }
mode_changing_head:
NOTEMODE {
- SCM nn = THIS->lexer_->lookup_identifier ("pitchnames");
- THIS->lexer_->push_note_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("pitchnames");
+ PARSER->lexer_->push_note_state (alist_to_hashq (nn));
$$ = ly_symbol2scm ("notes");
}
| DRUMMODE
{
- SCM nn = THIS->lexer_->lookup_identifier ("drumPitchNames");
- THIS->lexer_->push_note_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("drumPitchNames");
+ PARSER->lexer_->push_note_state (alist_to_hashq (nn));
$$ = ly_symbol2scm ("drums");
}
| FIGUREMODE {
- THIS->lexer_->push_figuredbass_state ();
+ PARSER->lexer_->push_figuredbass_state ();
$$ = ly_symbol2scm ("figures");
}
| CHORDMODE {
- SCM nn = THIS->lexer_->lookup_identifier ("chordmodifiers");
- THIS->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
- nn = THIS->lexer_->lookup_identifier ("pitchnames");
- THIS->lexer_->push_chord_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("chordmodifiers");
+ PARSER->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
+ nn = PARSER->lexer_->lookup_identifier ("pitchnames");
+ PARSER->lexer_->push_chord_state (alist_to_hashq (nn));
$$ = ly_symbol2scm ("chords");
}
| LYRICMODE
- { THIS->lexer_->push_lyric_state ();
+ { PARSER->lexer_->push_lyric_state ();
$$ = ly_symbol2scm ("lyrics");
}
;
mode_changing_head_with_context:
DRUMS {
- SCM nn = THIS->lexer_->lookup_identifier ("drumPitchNames");
- THIS->lexer_->push_note_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("drumPitchNames");
+ PARSER->lexer_->push_note_state (alist_to_hashq (nn));
$$ = ly_symbol2scm ("DrumStaff");
}
| FIGURES {
- THIS->lexer_->push_figuredbass_state ();
+ PARSER->lexer_->push_figuredbass_state ();
$$ = ly_symbol2scm ("FiguredBass");
}
| CHORDS {
- SCM nn = THIS->lexer_->lookup_identifier ("chordmodifiers");
- THIS->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
- nn = THIS->lexer_->lookup_identifier ("pitchnames");
- THIS->lexer_->push_chord_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("chordmodifiers");
+ PARSER->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
+ nn = PARSER->lexer_->lookup_identifier ("pitchnames");
+ PARSER->lexer_->push_chord_state (alist_to_hashq (nn));
$$ = ly_symbol2scm ("ChordNames");
}
| LYRICS
- { THIS->lexer_->push_lyric_state ();
+ { PARSER->lexer_->push_lyric_state ();
$$ = ly_symbol2scm ("Lyrics");
}
;
;
new_lyrics:
- ADDLYRICS { THIS->lexer_->push_lyric_state (); }
+ ADDLYRICS { PARSER->lexer_->push_lyric_state (); }
/*cont */
Grouped_music_list {
/* Can also use Music at the expensive of two S/Rs similar to
\repeat \alternative */
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
$$ = scm_cons ($3->self_scm (), SCM_EOL);
}
| new_lyrics ADDLYRICS {
- THIS->lexer_->push_lyric_state ();
+ PARSER->lexer_->push_lyric_state ();
} Grouped_music_list {
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
$$ = scm_cons ($4->self_scm (), $1);
}
;
voice->unprotect ();
}
| LYRICSTO simple_string {
- THIS->lexer_->push_lyric_state ();
+ PARSER->lexer_->push_lyric_state ();
} Music {
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
Music *music = $4;
SCM name = $2;
$$ = make_lyric_combine_music (name, music);
$$ = n;
}
| music_function_chord_body {
- $$ = run_music_function (THIS, $1);
+ $$ = run_music_function (PARSER, $1);
$$->set_spot (@$);
}
;
$$->set_spot (@$);
}
| '|' {
- SCM pipe = THIS->lexer_->lookup_identifier ("pipeSymbol");
+ SCM pipe = PARSER->lexer_->lookup_identifier ("pipeSymbol");
if (Music * m = unsmob_music (pipe))
$$ = m->clone ();
key->set_property ("tonic", Pitch (0, 0, 0).smobbed_copy ());
key->transpose (* unsmob_pitch ($2));
} else {
- THIS->parser_error (@3, _ ("second argument must be pitch list"));
+ PARSER->parser_error (@3, _ ("second argument must be pitch list"));
}
$$ = key;
$$ = $1;
}
| '-' music_function_event {
- Music *mus = run_music_function (THIS, $2);
+ Music *mus = run_music_function (PARSER, $2);
mus->set_spot (@1);
$$ = mus;
}
| HYPHEN {
- if (!THIS->lexer_->is_lyric_state ())
- THIS->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
+ if (!PARSER->lexer_->is_lyric_state ())
+ PARSER->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
$$ = MY_MAKE_MUSIC ("HyphenEvent");
}
| EXTENDER {
- if (!THIS->lexer_->is_lyric_state ())
- THIS->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
+ if (!PARSER->lexer_->is_lyric_state ())
+ PARSER->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
$$ = MY_MAKE_MUSIC ("ExtenderEvent");
}
| script_dir direction_reqd_event {
direction_less_event:
direction_less_char {
- SCM predefd = THIS->lexer_->lookup_identifier_symbol ($1);
+ SCM predefd = PARSER->lexer_->lookup_identifier_symbol ($1);
Music * m = 0;
if (unsmob_music (predefd))
{
$$ = $1;
}
| script_abbreviation {
- SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
+ SCM s = PARSER->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
Music *a = MY_MAKE_MUSIC ("ArticulationEvent");
if (scm_is_string (s))
a->set_property ("articulation-type", s);
- else THIS->parser_error (@1, _ ("expecting string as script definition"));
+ else PARSER->parser_error (@1, _ ("expecting string as script definition"));
$$ = a;
}
;
optional_notemode_duration:
{
- Duration dd = THIS->default_duration_;
+ Duration dd = PARSER->default_duration_;
$$ = dd.smobbed_copy ();
}
| multiplied_duration {
$$ = $1;
- THIS->default_duration_ = *unsmob_duration ($$);
+ PARSER->default_duration_ = *unsmob_duration ($$);
}
;
bare_unsigned dots {
int len = 0;
if (!is_duration ($1))
- THIS->parser_error (@1, _f ("not a duration: %d", $1));
+ PARSER->parser_error (@1, _f ("not a duration: %d", $1));
else
len = intlog2 ($1);
}
| ':' bare_unsigned {
if (!is_duration ($2))
- THIS->parser_error (@2, _f ("not a duration: %d", $2));
+ PARSER->parser_error (@2, _f ("not a duration: %d", $2));
$$ = $2;
}
;
simple_element:
pitch exclamations questions octave_check optional_notemode_duration optional_rest {
- if (!THIS->lexer_->is_note_state ())
- THIS->parser_error (@1, _ ("have to be in Note mode for notes"));
+ if (!PARSER->lexer_->is_note_state ())
+ PARSER->parser_error (@1, _ ("have to be in Note mode for notes"));
Music *n = 0;
if ($6)
}
| lyric_element optional_notemode_duration {
- if (!THIS->lexer_->is_lyric_state ())
- THIS->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
+ if (!PARSER->lexer_->is_lyric_state ())
+ PARSER->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
Music *levent = MY_MAKE_MUSIC ("LyricEvent");
levent->set_property ("text", $1);
$$= velt;
}
| new_chord {
- if (!THIS->lexer_->is_chord_state ())
- THIS->parser_error (@1, _ ("have to be in Chord mode for chords"));
+ if (!PARSER->lexer_->is_chord_state ())
+ PARSER->parser_error (@1, _ ("have to be in Chord mode for chords"));
$$ = unsmob_music ($1);
}
;
$$ = $1;
}
| LYRIC_MARKUP
- { THIS->lexer_->push_markup_state (); }
+ { PARSER->lexer_->push_markup_state (); }
markup_top {
$$ = $3;
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
}
;
$$ = $1;
}
| MARKUP
- { THIS->lexer_->push_markup_state (); }
+ { PARSER->lexer_->push_markup_state (); }
markup_top {
$$ = $3;
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
}
;
$$ = $1;
}
| SCORE {
- SCM nn = THIS->lexer_->lookup_identifier ("pitchnames");
- THIS->lexer_->push_note_state (alist_to_hashq (nn));
+ SCM nn = PARSER->lexer_->lookup_identifier ("pitchnames");
+ PARSER->lexer_->push_note_state (alist_to_hashq (nn));
} '{' score_body '}' {
Score * sc = $4;
$$ = scm_list_2 (ly_lily_module_constant ("score-markup"), sc->self_scm ());
sc->unprotect ();
- THIS->lexer_->pop_state ();
+ PARSER->lexer_->pop_state ();
}
| MARKUP_HEAD_SCM0 embedded_scm {
$$ = scm_list_2 ($1, $2);
#include "engraver.hh"
#include "side-position-interface.hh"
+#include "text-interface.hh"
class Stanza_number_engraver : public Engraver
{
{
SCM stanza = get_property ("stanza");
- if (scm_is_string (stanza) && stanza != last_stanza_)
+ if (Text_interface::is_markup (stanza)
+ && stanza != last_stanza_)
{
last_stanza_ = stanza;
{
SCM scm_arr = Grob_array::make_array ();
all_elements_ = unsmob_grob_array (scm_arr);
+ all_elements_->set_ordered (false);
set_object ("all-elements", scm_arr);
}
Grob *
-System::clone (int count) const
+System::clone (int index) const
{
- return new System (*this, count);
+ return new System (*this, index);
}
int
handle_broken_dependencies ();
-#if 0 /* FIXME: strange side effects. */
-
/* Because the this->get_property (all-elements) contains items in 3
versions, handle_broken_dependencies () will leave duplicated
items in all-elements. Strictly speaking this is harmless, but
- it leads to duplicated symbols in the output. ly_list_qsort_uniq_x ()
- makes sure that no duplicates are in the list. */
- for (int i = 0; i < line_count; i++)
+ it leads to duplicated symbols in the output. uniq makes sure
+ that no duplicates are in the list. */
+ for (vsize i = 0; i < broken_intos_.size (); i++)
{
- SCM all = broken_intos_[i]->get_object ("all-elements");
- all = ly_list_qsort_uniq_x (all);
+ System *child = dynamic_cast<System*> (broken_intos_[i]);
+ child->all_elements_->remove_duplicates ();
}
-#endif
if (be_verbose_global)
message (_f ("Element count %d.", count + element_count ()));
- int line_count = broken_intos_.size ();
- SCM lines = scm_c_make_vector (line_count, SCM_EOL);
-
- for (int i = 0; i < line_count; i++)
+ SCM lines = scm_c_make_vector (broken_intos_.size (), SCM_EOL);
+ for (vsize i = 0; i < broken_intos_.size (); i++)
{
if (be_verbose_global)
progress_indication ("[");
}
}
+struct Layer_entry
+{
+ Grob *grob_;
+ int layer_;
+};
+
+bool
+operator< (Layer_entry const &a,
+ Layer_entry const &b)
+{
+ return a.layer_ < b.layer_;
+}
+
+
SCM
System::get_paper_system ()
{
- static int const LAYER_COUNT = 3;
-
SCM exprs = SCM_EOL;
SCM *tail = &exprs;
- /* Output stencils in three layers: 0, 1, 2. Default layer: 1. */
- for (int i = 0; i < LAYER_COUNT; i++)
- for (vsize j = all_elements_->size (); j--;)
- {
- Grob *g = all_elements_->grob (j);
- Stencil st = g->get_print_stencil ();
+ vector<Layer_entry> entries;
+ for (vsize j = 0; j < all_elements_->size (); j++)
+ {
+ Layer_entry e;
+ e.grob_ = all_elements_->grob (j);
+ e.layer_ = robust_scm2int (e.grob_->get_property ("layer"), 1);
+
+ entries.push_back (e);
+ }
- /* Skip empty stencils and grobs that are not in this layer. */
- if (st.expr() == SCM_EOL
- || robust_scm2int (g->get_property ("layer"), 1) != i)
- continue;
+ vector_sort (entries, default_compare);
+ for (vsize j = 0; j < entries.size (); j++)
+ {
+ Grob *g = entries[j].grob_;
+ Stencil st = g->get_print_stencil ();
- Offset o;
- for (int a = X_AXIS; a < NO_AXES; a++)
- o[Axis (a)] = g->relative_coordinate (this, Axis (a));
+ if (st.expr() == SCM_EOL)
+ continue;
+
+ Offset o;
+ for (int a = X_AXIS; a < NO_AXES; a++)
+ o[Axis (a)] = g->relative_coordinate (this, Axis (a));
- Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
- Offset (0, 0))
- * Staff_symbol_referencer::staff_space (g);
+ Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
+ Offset (0, 0))
+ * Staff_symbol_referencer::staff_space (g);
- /* Must copy the stencil, for we cannot change the stencil
- cached in G. */
+ /* Must copy the stencil, for we cannot change the stencil
+ cached in G. */
- st.translate (o + extra);
+ st.translate (o + extra);
- *tail = scm_cons (st.expr (), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- }
+ *tail = scm_cons (st.expr (), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
if (Stencil *me = get_stencil ())
exprs = scm_cons (me->expr (), exprs);
Interval staff_refpoints;
staff_refpoints.set_empty ();
extract_grob_set (this, "spaceable-staves", staves);
- for (vsize i = staves.size (); i--;)
+ for (vsize i = 0; i < staves.size (); i++)
{
Grob *g = staves[i];
staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
LILYPOND_BOOK = $(script-dir)/lilypond-book.py
LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/ -I $(top-build-dir)/mf/out/
LILYPOND_BOOK_LILYPOND_FLAGS=-dgs-font-load
-LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png --header=texidoc -I $(top-src-dir)/input/test -dinternal-type-checking -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)"
+LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png --header=texidoc -I $(top-src-dir)/input/test -dinternal-type-checking -ddump-signatures -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)"
TEXINPUTS=$(top-src-dir)/tex/::
export TEXINPUTS
define_pixels (dot_diam);
-code := 31; % , 32
-
-fet_beginchar ("Space", "space");
- set_char_box (0, space#, 0, height#);
-fet_endchar;
-
-
code := 42; % , 43
fet_beginchar ("Plus", "plus");
save tolerance;
save alpha, beta, gamma, delta;
save bow;
+ save x_overshoot;
+
path bow;
- set_char_box (0, 11/15 height# * widen, 0, height#);
+ set_char_box (0, 11/15 height# * widen - thin#, 0, height#);
+ overshoot_x = .75 thin;
message "w:" & decimal w;
message "h:" & decimal h;
alpha = -180;
-if true:
penpos1 (3/2 thick, 180 + alpha);
penpos2 (hair, 180 + alpha - 45);
penpos3 (hair, 180 + alpha + 45);
z2 = z1l + (1/4 sqrt (2) * hair) * dir (alpha - 135);
z3 = z1r + (1/4 sqrt (2) * hair) * dir (alpha - 45);
z4 = z1 + kuulleke * dir (alpha - 90);
-else:
- % does not work
- calc_kuulleke (3/2 thick, -alpha);
-fi;
z1l = (thin, 0);
beta = 55;
penpos5 (thin, 90 + beta);
- z5 = (w, h) + (1/2 sqrt (2) * thin) * dir (-135);
+ z5 = (w, h) + (1/2 sqrt (2) * thin) * dir (-135) + (overshoot_x, 0);
gamma = angle (length (z1r - z1), 2 kuulleke);
delta = 12;
(postprocess-output book framework-eps-module
(format "~a.eps" basename) (ly:output-formats)))
+
+
(define-public (output-classic-framework basename book scopes fields)
(output-scopes scopes fields basename)
+
+ (if (ly:get-option 'dump-signatures)
+ (write-system-signatures basename (ly:paper-book-systems book) 0))
(dump-stencils-as-EPSes
(map paper-system-stencil (ly:paper-book-systems book))
(display (procset "music-drawing-routines.ps") port)
(display (procset "lilyponddefs.ps") port)
+ (if (not (ly:get-option 'point-and-click))
+ (display "/mark_URI { pop pop pop pop pop } bind def\n" port))
+
(display "%%EndProlog\n" port)
(display "%%BeginSetup\ninit-lilypond-parameters\n%%EndSetup\n\n" port))
(open-file filename "wb")
"ps"))
(paper (ly:paper-book-paper book))
+ (systems (ly:paper-book-systems book))
(page-stencils (map page-stencil (ly:paper-book-pages book)))
(landscape? (eq? (ly:output-def-lookup paper 'landscape) #t))
(page-count (length page-stencils))
(port (ly:outputter-port outputter)))
+ (if (ly:get-option 'dump-signatures)
+ (write-system-signatures basename (ly:paper-book-systems book) 0))
+
(output-scopes scopes fields basename)
(display (file-header paper page-count #t) port)
(display "\n%%BeginDefaults
(cons force positions)))
- (define (walk-paths done-lines best-paths current-lines last? current-best)
+ (define (walk-paths done-lines best-paths current-lines last? current-best)
"Return the best optimal-page-break-node that contains
CURRENT-LINES. DONE-LINES.reversed ++ CURRENT-LINES is a consecutive
ascending range of lines, and BEST-PATHS contains the optimal breaks
last?)))
(height (page-printable-height this-page))
(vertical-spacing (space-systems height current-lines ragged?))
+
(satisfied-constraints (car vertical-spacing))
(force (if satisfied-constraints
(if (and last? ragged-last?)
`((point-and-click #t "use point & click")
(paper-size "a4" "the default paper size")
(midi-debug #f "generate human readable MIDI")
+ (dump-signatures #f "dump output signatures of each system (EPS backend)")
(internal-type-checking #f "check every property assignment for types")
(parse-protect #t "continue when finding errors in inline
scheme are caught in the parser. If off, halt
"dump GC protection info")
(show-available-fonts #f
"List font names available.")
- )
- ))
+ )))
;; need to do this in the beginning. Other parts of the
(define-public (paper-system-stencil system)
(ly:prob-property system 'stencil))
+(define-public (paper-system-system-grob paper-system)
+ (ly:prob-property paper-system 'system-grob))
+
(define-public (paper-system-extent system axis)
(ly:stencil-extent (paper-system-stencil system) axis))
(ly:make-stencil "" '(0 . 0) '(0 . 0)))
))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; output signatures.
+
+(define-public (write-system-signatures basename paper-systems count)
+ (if (pair? paper-systems)
+ (begin
+ (let*
+ ((outname (format "~a-~a.signature" basename count)) )
+
+ (ly:message "Writing ~a" outname)
+ (write-system-signature outname (car paper-systems))
+ (write-system-signatures basename (cdr paper-systems) (1+ count))))))
+
+
+(define-public (write-system-signature filename paper-system)
+ (define (float? x)
+ (and (number? x) (inexact? x)))
+
+ (define system-grob
+ (paper-system-system-grob paper-system))
+
+ (define output (open-output-file filename))
+
+ (define (strip-floats expr)
+ "Replace floats by #f"
+ (cond
+ ((float? expr) #f)
+ ((ly:font-metric? expr) (ly:font-name expr))
+ ((pair? expr) (cons (strip-floats (car expr))
+ (strip-floats (cdr expr))))
+ (else expr)))
+
+ (define (fold-false-pairs expr)
+ "Try to remove lists of #f as much as possible."
+ (if (pair? expr)
+ (let*
+ ((first (car expr))
+ (rest (fold-false-pairs (cdr expr))))
+
+ (if first
+ (cons (fold-false-pairs first) rest)
+ rest))
+ expr))
+
+ (define (music-cause grob)
+ (let*
+ ((cause (ly:grob-property grob 'cause)))
+
+ (cond
+ ((ly:music? cause) cause)
+ ((ly:grob? cause) (music-cause cause))
+ (else #f))))
+
+ (define (pythonic-string expr)
+ "escape quotes and slashes for python consumption"
+ (regexp-substitute/global #f "([\\\\'\"])" (format "~a" expr) 'pre "\\" 1 'post))
+
+ (define (pythonic-pair expr)
+ (format "(~a,~a)"
+ (car expr) (cdr expr)))
+
+ (define (found-grob expr)
+ (let*
+ ((grob (car expr))
+ (rest (cdr expr))
+ (collected '())
+ (cause (music-cause grob))
+ (input (if (ly:music? cause) (ly:music-property cause 'origin) #f))
+ (location (if (ly:input-location? input) (ly:input-file-line-char-column input) '()))
+
+ (x-ext (ly:grob-extent grob system-grob X))
+ (y-ext (ly:grob-extent grob system-grob Y))
+ )
+
+ (interpret-for-signature #f (lambda (e)
+ (set! collected (cons e collected)))
+ rest)
+
+ (format output
+ "['~a', '~a', ~a, ~a, '~a'],\n"
+ (cdr (assq 'name (ly:grob-property grob 'meta) ))
+ (pythonic-string location)
+ (pythonic-pair (if (interval-empty? x-ext) '(0 . 0) x-ext))
+ (pythonic-pair (if (interval-empty? y-ext) '(0 . 0) y-ext))
+ (pythonic-string collected))
+ ))
+
+ (define (interpret-for-signature escape collect expr)
+ (define (interpret expr)
+ (let*
+ ((head (if (pair? expr)
+ (car expr)
+ #f)))
+
+ (cond
+ ((eq? head 'grob-cause) (escape (cdr expr)))
+ ((eq? head 'color) (interpret (caddr expr)))
+ ((eq? head 'rotate-stencil) (interpret (caddr expr)))
+ ((eq? head 'translate-stencil) (interpret (caddr expr)))
+ ((eq? head 'combine-stencil)
+ (for-each (lambda (e) (interpret e)) (cdr expr)))
+ (else
+ (collect (fold-false-pairs (strip-floats expr))))
+
+ )))
+
+ (interpret expr))
+
+ (if (ly:grob? system-grob)
+ (begin
+ (display (format "# Output signature\n# Generated by LilyPond ~a\n" (lilypond-version))
+ output)
+ (interpret-for-signature found-grob (lambda (x) #f)
+ (ly:stencil-expr
+ (paper-system-stencil paper-system))))))
+
if test -n "$pv"; then
STEPMAKE_ADD_ENTRY($1, $pv)
fi
+ # clear cached value since arg 2 might point us to a new binary
+ unset ac_cv_path_PYTHON
+
AC_PATH_PROG(PYTHON, $PYTHON)
AC_SUBST(PYTHON)
])