---- ../lilypond-1.3.26.hwn2/CHANGES Thu Feb 24 13:52:54 2000
-++ b/CHANGES Thu Feb 24 17:15:46 2000
-@@ -2,6 +2,14 @@
- 1.3.26.hwn2
- ===========
+1.3.26.jcn2
+===========
+
+* Bugfix: font used in volta-spanner calculation.
+
+* Added simple selection list to webpage, inspired by sawmill.
+* Devised kludge for ascii 5 character font pitches.
+
+* Substitutions: interline, 1997,1998, @stack.nl and small typo fixes.
+
+1.3.26.hwn1
+===========
+
+* Plug memory leaks related to Moment:
+ - Spacing_engraver::do_pre_move_processing ()
+ - make_rational ()/make-rational
+ - Paper_column::Paper_column ()
+
* Plug memory leak in Paper_outputter::output_{String,Real,int}_def()
* Plug memory leak in Score_engraver::set_columns ()
* Plug memory leak in Score_element::molecule_extent ()
- * Bugfix: don't crash if a slur doesn't span anything.
-
- * Bugfix: don't crash if doing beams without a staff symbol.1.3.26.jcn2
-===========
+* Bugfix: don't crash if a slur doesn't span anything.
-* Bugfix: font used in volta-spanner calculation.
+* Bugfix: don't crash if doing beams without a staff symbol.
-* Added simple selection list to webpage, inspired by sawmill.
+* Generic element property setting:
-1.3.26.jcn1
-===========
+ \outputproperty #predicate #'symbol = #value
-* Devised kludge for ascii 5 character font pitches.
-
-* Substitutions: interline, 1997,1998, @stack.nl and small typo fixes.
+Will set the element property symbol to value, for any elements that
+return true for PREDICATE. This allows you to virtually tweak *ANY*
+property of the output. Example in input/test/generic-output-property.ly
-1.3.25.jcn2
-===========
+1.3.26
+======
* lilypond as as2ly: --help and --version to stdout. Regular identify
to stderr. This fixes help2man's manpage generation.
(But don't forget to read the @uref{Documentation/out-www/faq.html,
Frequently Asked Questions} first.)
+@html
+<p align=center>
+[
+ <a href="#download">Download</a>
+ |
+ <a href="Documentation/out-www/faq.html">FAQ</a>
+ |
+ <a href="Documentation/out-www/index.html">Documentation</a>
+ |
+ <a href="#music">Music archives</a>
+ |
+ <a href="#mailing-lists">Mailing lists</a>
+ |
+ <a href="Documentation/programmer/out-www/regression-test.html">
+ Regression test</a>
+ |
+ <a href="Documentation/out-www/CHANGES.txt">News</a>
+]
+@end html
@table @samp
@item info-gnu-music@@gnu.org
@end example
+@cindex output properties
+
+
+These allow you to tweak what is happening in the back-end
+directly. If you want to control every detail of the output
+formatting, this is the feature to use. The downside to this is that
+you need to know exactly how the backend works. Example:
+
+
+@mudela[fragment,verbatim]
+\relative c'' { c4
+ \context Staff \outputproperty
+ #(make-type-checker 'Note_head)
+ #'extra-offset = #'(5.0 . 7.5)
+<c8 e g> }
+@end mudela
+
+This selects all note heads occurring at current staff level, and sets
+the extra-offset of those heads to (5,7.5), shifting them up and
+right.
+
+Use of this feature is entirely on your own risk: if you use this, the
+result will depend very heavily on the implentation of the backend,
+which we change unscrupulously.
+
+
+
@cindex commands
. * change ) c4 to c4-)
. * internationalize GUILE msgs.
. * unbroken marks.
+. * chubb:
+-- Take a piece of early music, and typeset it as closely as possible to
+the original edition. This means: moveable clefs, sometimes funny or no
+time signatures, few or no bar lines, few or no ties, slurs or
+phrasemarks, ornaments implied by the structure of the music, or
+indicated by, e.g., one or more thick lines through the stem of a note
+(Purcell and Farnaby both use this extensively, but with rather
+different meanings). For Dowland's music it may also mean being able
+to rotate one or more staves (but I can do this in LaTeX).
+
+-- Add to this music a set of critical marks that:
+ * regularises clef, time and key signature.
+ * add slurs, phrase marks, articulation, etc.
+ * Halve or quarter the durations, so that minims become crotchets, say.
+ * add ornaments (mordents, trills, turns etc)
+ * add regular barlines (which sometimes will mean splitting a note
+ and adding a tie, e.g., in some of Byrd's music)
+ * Add footnotes to particular symbols, groups of notes, etc.
+ * When translating from chant notation, add a square bracket over a
+ group of notes to indicate a ligature in the original
+etc.
+ * Discretionary sharp or flat signs, for Musica Ficta
+
+-- print out both editions from the same source.
. * write smobifying howto.
. * put property test files in refman.
. * alignment within @itemize
. * \grace { c d } c1 in midi
. * \prop slurdir in grace notes
. * Make fingering and playing instructions Music_wrappers?
-. * \eltproperty "=Context" "Elt_name" "prop-name" #value
. * script columns
. * Must stop before this music ends:
verse=\lyrics {
- if I change the property minVerticalAlign in a multi staff score with
lyrics the change affects the lyrics too. I would like the change to
_only_ affect staves.
-
-- I would like to be able to influence the sloping of xtuplet brackets
-
- after the leading measure in the above mentioned score I want a double
bar line fully drawn across the staves and after that keep to the
ChoirStaff bar line types in the rest of the scores
. * [c8. c16 c16 c16] in 6/8 timesig.
. * Rewrite Stem, Beam (hairy)
. * beams over barlines
-. * Rests and beams don't work too well together. Example:
- [ r8 g''16 des'] [r8 c16 a]
. * autoBeamMelisma: if I explicitly beam notes in a staff with auto
beaming disabled I would like to have these beams also to be
melismatic.
. * \selectmusic to cut pieces from music.
. * formatting of input stuff.
. * deps for ly2dvi
-. * TODO: merge atom & molecule; make tree from molecule.
. * Align_element::padding ?
. * use streambufs and iostream
to provide IO handling for TeX stream, mudela stream, data-file.
. * seriously buffer TeX output (do profile of writing .5 mb TeX file.)
-. * fix partial measures in meaningful way.
. * uniformise recent feta contributions.
. * bigger and fatter 4/4 C
. * relative mode for midi2ly
. * text-items clash with stems/beams
. * --include, -I option for ly2dvi (pass on to lily)
. * fix placement of beam-less abbrev
-. * \meter 3/4;
- <{\voiceone cis4. cis8 cis4 | cis4 cis cis | r1 }
- {\voicetwo cis,4 r r | r2. | r1 }> |
- }
. * Musical_pitch (analogous to Duration and Rhythmic_req)
think about, analogous to pitch:
* { a4 a16 } c <-- duration of c?
I understand the implementation of repeats well enough.
. * add mudela-book-doc source to webstie.
. * fix singleStaffBracket
-. * rename
-. * partial -> anacrouse
. * move paper vars into engraver properties
. * add new glyphs to font.ly
. * more intelligent file searching
. * disable spaces in TeX stuff
. * handle ^C for tmp/file creation.
. * make LilyPond RPM fully relocatable
-. * better hshift (dots, distance, head dependent)
. * didot / big point.
. * clefs (AG): The "8" should appear closer to the actual clef,
touching it.
.* FONT
. * the bracket is ugly (wings are too parabolic, should be more circular)
+. * fix accordion turning paths.
. * versioning for Feta
. * rewrite dynamic signs. They're kind of spaghetti now.
. * The `3' in the meter key is a one or two pixels too thin (at 600dpi)
. * work out sizes of character fonts.
. * more symbols
. * piano pedals: Ped/*
-. * maxima notehead
. * coda signs: Segno, O+
. * glissando, arpeggio
. * lengthened trill
do_one_file(String,String) [scores.cc:124]
Reading 4 bytes from 0xefffeca8 on the stack.
Address 0xefffeca8 is 728 bytes below frame pointer in function
-. * Array<Axis [2] > axeses;
-
- for (int i=0; i < loose_elems.size (); i++)
- {
- Score_element* elt = loose_elems[i];
- /*
- with which axes do we have to meddle?
- */
- int j =0;
- Axis as [2];
- for (int a = X_AXIS; a < NO_AXES; ++a)
- if (elt->parent_l (Axis (a)) == this)
- as[j++] = Axis (a);
- if (j == 1)
- as[j++] = as[0];
-
- axeses.push (as);
- }
-
. * patch: don't touch timestamp if all patches fail.
. * MetaPost: should not generate setgray for unfill
-. * check out GCC signatures?
. * glibc 2.0:
f = fopen ("/dev/null", "r")
assert (feof (f))
-. * tetex: mfplain.mem -> INSTALL
-. * mfplain.ini not in tetex 0.9 -> INSTALL
-
.* PROJECTS
. * Scripts:
. * output header info to MIDI too.
. * dump \header into easily parsable format.
-. * a musical dictionary. See Documentation/vocabulary-*, other
-languages:
-. * explanations
-. * italian
-. * german
-. * dutch
-. * swedish
-
. * chords
. * guitar chords (fret diagrams)
. * other chord name styles (american(?) style)
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=26
-MY_PATCH_LEVEL=hwn3
+PATCH_LEVEL=27
+MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+
+\score { \notes <{ [ r8 g''16 des'] [r8 c16 a] }>}
--- /dev/null
+
+\score
+{
+\notes {
+ c''4
+ \outputproperty #(make-type-checker 'Note_head) #'staff-position = #20
+ c''4
+
+}
+}
#include "engraver.hh"
#include "stem.hh"
#include "note-head.hh"
+#include "group-interface.hh"
/**
print text & hairpin dynamics.
Dynamic_engraver();
protected:
+
+ void announce_element (Score_element_info);
+
virtual void do_removal_processing ();
virtual void acknowledge_element (Score_element_info);
virtual bool do_try_music (Music *req_l);
virtual void typeset_element (Score_element*);
};
+void
+Dynamic_engraver::announce_element (Score_element_info i)
+{
+ group (i.elem_l_, "interfaces").add_thing (ly_symbol2scm ("dynamic"));
+
+ Engraver::announce_element (i);
+}
Dynamic_engraver::Dynamic_engraver()
/*
engraver.cc -- implement Engraver
- Sourcefile of GNU LilyPond musictypesetter
+ Sourcefile of GNU LilyPond music type setter
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
#include "paper-def.hh"
#include "score-element.hh"
+#include "group-interface.hh"
void
Engraver::fill_staff_info (Staff_info&)
void
Engraver::announce_element (Score_element_info i)
{
+ Score_element * e = i.elem_l_;
+ group (e, "interfaces").add_thing (ly_symbol2scm (e->name()));
+
if (!i.origin_trans_l_)
i.origin_trans_l_ = this;
daddy_grav_l()->announce_element (i);
{
p->used_b_ = true;
elt_l_->used_b_ = true;
-
+
+ add_thing (p->self_scm_);
+}
+
+void
+Group_interface::add_thing (SCM s)
+{
elt_l_->set_elt_property (name_,
- gh_cons (p->self_scm_, elt_l_->get_elt_property (name_)));
+ gh_cons (s, elt_l_->get_elt_property (name_)));
+
}
+
int
Group_interface::count ()
{
#include "lily-guile.hh"
#include "smobs.hh"
+/*
+ rename to list interface?
+ */
+
+/**
+ Look at Score element ELT as thing which has a list property called
+ NAME_. Normally the list would contain Score_elements, but
+ sometimes it can be different things.
+*/
struct Group_interface
{
Score_element * elt_l_;
Group_interface (Score_element const*);
Group_interface (Score_element const*, String);
int count ();
+ void add_thing (SCM);
bool has_interface_b ();
void set_interface ();
void add_element (Score_element*);
Group_interface group (Score_element*);
Group_interface group (Score_element*, String);
-/*
- template<class T>
- Link_array<T> Group_interface__extract_elements (T *, String name);
-*/
+/**
+ Put all score elements of ELT's property called NAME into an array,
+ and return it. */
template<class T>
Link_array<T>
Group_interface__extract_elements (Score_element const *elt, T *, String name)
--- /dev/null
+/*
+ output-property.hh -- declare Output_property
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef OUTPUT_PROPERTY_HH
+#define OUTPUT_PROPERTY_HH
+
+#include "music.hh"
+#include "protected-scm.hh"
+
+class Output_property : public Music
+{
+public:
+ Output_property(SCM, SCM, SCM);
+
+ /**
+ relevant stuff: the predicate, the symbol, the value
+ */
+ Protected_scm pred_sym_val_list_;
+};
+
+#endif /* OUTPUT_PROPERTY_HH */
#include "music-iterator.hh"
-class Request_iterator : public Music_iterator
+class Simple_music_iterator : public Music_iterator
{
public:
- Request_iterator ();
protected:
virtual void do_process_and_next (Moment );
};
WARNING: putting something in assumes responsibility for cleaning
up. */
void set (SCM k, SCM v);
- SCM get (SCM k);
+ SCM get (SCM k) const;
Scheme_hash_table ();
void operator = (Scheme_hash_table const &);
static Interval dim_cache_callback (Dimension_cache const*);
public:
+ static SCM ly_set_elt_property (SCM, SCM,SCM);
+ static SCM ly_get_elt_property (SCM, SCM);
+
virtual void handle_broken_dependencies ();
virtual void handle_prebroken_dependencies ();
virtual Moment now_mom () const;
protected:
+ /*
+ UGH. Clean this up.
+ */
enum {
ORPHAN,
VIRGIN,
}
-void
+static void
init_functions ()
{
scm_make_gsubr ("ly-warn", 1, 0, 0, (SCM(*)(...))ly_warning);
/*
Appendable list L: the cdr contains the list, the car the last cons
in the list.
-
*/
-
SCM
appendable_list ()
{
void
Moment::do_smobify_self ()
-{}
+{
+}
SCM
make_rational (SCM n, SCM d)
{
+ Moment *r;
+ SCM retval = SCM_EOL;
if (SCM_INUMP (n) && SCM_INUMP(d))
{
- Moment *r = new Moment (gh_scm2int (n), gh_scm2int (d));
- return r->smobify_self ();
+ r= new Moment (gh_scm2int (n), gh_scm2int (d));
}
else
{
- ::error ("Not a number");
- assert(false);
+ ::error ("make-moment takes two integer arguments.");
+ r = new Moment (1,1);
}
+
+ retval = r->smobify_self ();
+ scm_unprotect_object (r->self_scm_);
+ return retval ;
}
#include "ly-smobs.icc"
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
+/*
+ UGH. too many includes.
+ */
#include "debug.hh"
#include "music-list.hh"
#include "music-iterator.hh"
#include "auto-change-iterator.hh"
#include "request.hh"
#include "request-iterator.hh"
+#include "output-property.hh"
void
Music_iterator::do_print() const
else
p = new Unfolded_repeat_iterator;
}
- else if (Request const * r = dynamic_cast<Request const* > (m))
+ else
{
- p = new Request_iterator ;
+ p = new Simple_music_iterator ;
}
- else
- assert (0);
p->music_l_ = m;
return p;
{"name", NAME},
{"notenames", NOTENAMES},
{"notes", NOTES},
+ {"outputproperty", OUTPUTPROPERTY},
{"partial", PARTIAL},
{"paper", PAPER},
{"penalty", PENALTY},
--- /dev/null
+/*
+ output-property-engraver.cc -- implement Output_property_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+#include "score-element.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+
+ Link_array<Output_property> props_;
+
+ virtual void do_pre_move_processing ();
+ virtual void acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music*);
+};
+
+
+bool
+Output_property_engraver::do_try_music (Music* m)
+{
+ if (Output_property * o = dynamic_cast<Output_property*> (m))
+ {
+ props_.push (o);
+ return true;
+ }
+ return false;
+}
+
+void
+Output_property_engraver::acknowledge_element (Score_element_info inf)
+{
+ for (int i=props_.size (); i--; )
+ {
+ Output_property * o = props_[i];
+ SCM pred = gh_car (o->pred_sym_val_list_);
+ /*
+ should typecheck pred.
+ */
+ SCM result=gh_apply (pred,
+ gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED));
+ if (to_boolean (result))
+ {
+ Score_element::ly_set_elt_property (inf.elem_l_->self_scm_,
+ gh_cadr (o->pred_sym_val_list_),
+ gh_caddr (o->pred_sym_val_list_));
+ }
+ }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+ props_.clear ();
+}
+
+ADD_THIS_TRANSLATOR(Output_property_engraver);
--- /dev/null
+/*
+ output-property-engraver.cc -- implement Output_property_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+ Output_property_engraver();
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+
+ Link_array<Output_property> props_;
+
+ virtual void do_acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music*);
+};
+
+
+Output_property_engraver::do_try_music (Music* m)
+{
+ if (Output_property * o = dynamic_cast<Output_property*> (m))
+ {
+ props_.push (m);
+ return true;
+ }
+ return false;
+}
+
+void
+Output_property_engraver::do_acknowledge_element (Score_element_info i)
+{
+ for (int i=props_.size (); i--; )
+ {
+ Output_property * o = props_[i];
+ SCM pred = gh_car (o->pred_sym_val_list_);
+ /*
+ should typecheck pred.
+ */
+ SCM result=gh_apply (pred,
+ gh_listify (i.elem_l_->self_scm_, SCM_UNDEFINED));
+ if (to_boolean (result))
+ {
+ i.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_),
+ gh_caddr (o->pred_sym_val_list_));
+ }
+ }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+ props_.clear ();
+}
--- /dev/null
+/*
+ output-property.cc -- implement Output_property
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "output-property.hh"
+#include "lily-guile.hh"
+
+Output_property::Output_property(SCM pred, SCM sym, SCM val)
+{
+ pred_sym_val_list_ = gh_list (pred, sym, val, SCM_UNDEFINED);
+}
+
Paper_column::Paper_column (Moment w)
{
- set_elt_property ("when", (new Moment (w))->smobify_self ());
+ SCM when = (new Moment (w))->smobify_self ();;
+ scm_unprotect_object (when);
+ set_elt_property ("when", when);
+
set_axes (X_AXIS, X_AXIS);
line_l_=0;
*ps << c;
free (c);
}
- cout << "\nCells in use: " << scm_cells_allocated << endl;
- cout << "protects " << scm_ilength (scm_protects) << endl;
-
}
}
#include "mudela-version.hh"
#include "grace-music.hh"
#include "auto-change-music.hh"
+#include "output-property.hh"
// mmm
Mudela_version oldest_version ("1.3.4");
Translator_group* trans;
char c;
int i;
- int ii[10];
}
%{
%token SPANREQUEST
%token COMMANDSPANREQUEST
%token TEMPO
+%token OUTPUTPROPERTY
%token TIME_T
%token TIMES
%token TRANSLATOR
if (!gh_symbol_p ($2))
THIS->parser_error ("expect a symbol as lvalue");
else
- $$->default_properties_[$2] = $4;
+ $$->default_properties_.set ($2, $4);
}
| paper_def_body SCM_T '=' real semicolon {
if (!gh_symbol_p ($2))
THIS->parser_error ("expect a symbol as lvalue");
else
- $$->default_properties_[$2] = gh_double2scm ($4);
+ $$->default_properties_.set ($2, gh_double2scm ($4));
}
| paper_def_body translator_spec_block {
$$->assign_translator ($2);
Simple_music:
request_chord { $$ = $1; }
+ | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
+ SCM pred = $2;
+ if (!gh_symbol_p ($3))
+ {
+ THIS->parser_error (_("Second argument must be a symbol"));
+ }
+ /*hould check # args */
+ if (!gh_procedure_p (pred))
+ {
+ THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
+ }
+
+ $$ = new Output_property (pred,$3, $5);
+ }
| MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
| property_def
| translator_change
/*
- request-iterator.cc -- implement
+ request-iterator.cc -- implement Simple_music_iterator
source file of the GNU LilyPond music typesetter
#include "request-iterator.hh"
#include "music.hh"
-Request_iterator::Request_iterator()
-{
-}
-
void
-Request_iterator::do_process_and_next (Moment m)
+Simple_music_iterator::do_process_and_next (Moment m)
{
if (first_b_)
{
bool g= try_music (music_l_);
if (!g)
- music_l_->warning (_f ("Junking request: `%s'", classname(music_l_)));
+ music_l_->warning (_f ("Junking music: `%s'", classname(music_l_)));
first_b_ = false;
}
{
assert (SMOB_IS_TYPE_B (Scheme_hash_table, s));
char str[1000];
- sprintf (str, "#<Scheme_hash_table 0x%0ulx ", s);
+ sprintf (str, "#<Scheme_hash_table 0x%0x ", s);
scm_puts (str, p);
Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
for (Hash_table_iter<SCM,SCM> i (*me); i.ok(); i++)
}
SCM
-Scheme_hash_table::get (SCM k)
+Scheme_hash_table::get (SCM k)const
{
- return elem (k);
+ return const_elem (k);
}
set_elt_property ("dependencies", SCM_EOL);
+ set_elt_property ("interfaces", SCM_EOL);
}
SCM ly_deep_copy (SCM);
{
return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
}
+
+
+SCM
+Score_element::ly_set_elt_property (SCM elt, SCM sym, SCM val)
+{
+ Score_element * sc = unsmob_element (elt);
+
+ if (!gh_symbol_p (sym))
+ {
+ error ("Not a symbol");
+ ly_display_scm (sym);
+ return SCM_UNDEFINED;
+ }
+
+ if (sc)
+ {
+ sc->element_property_alist_ = scm_assoc_set_x (sc->element_property_alist_, sym, val);
+ }
+ else
+ {
+ error ("Not a score element");
+ ly_display_scm (elt);
+ }
+
+ return SCM_UNDEFINED;
+}
+
+
+SCM
+Score_element::ly_get_elt_property (SCM elt, SCM sym)
+{
+ Score_element * sc = unsmob_element (elt);
+
+ if (sc)
+ {
+ SCM s = scm_assq(sym, sc->element_property_alist_);
+
+ if (s != SCM_BOOL_F)
+ return gh_cdr (s);
+ else
+ return SCM_UNDEFINED;
+ }
+ else
+ {
+ error ("Not a score element");
+ ly_display_scm (elt);
+ }
+ return SCM_UNDEFINED;
+}
+
+
+static void
+init_functions ()
+{
+ scm_make_gsubr ("ly-get-elt-property", 2, 0, 0, (SCM(*)(...))Score_element::ly_get_elt_property);
+ scm_make_gsubr ("ly-set-elt-property", 3, 0, 0, (SCM(*)(...))Score_element::ly_set_elt_property);
+}
+
+ADD_SCM_INIT_FUNC(scoreelt, init_functions);
+++ /dev/null
-/*
- score-elem.cc -- implement Score_element
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#include <string.h>
-
-#include "group-interface.hh"
-#include "misc.hh"
-#include "paper-score.hh"
-#include "paper-def.hh"
-#include "lookup.hh"
-#include "molecule.hh"
-#include "score-element.hh"
-#include "debug.hh"
-#include "spanner.hh"
-#include "line-of-score.hh"
-#include "item.hh"
-#include "paper-column.hh"
-#include "molecule.hh"
-#include "misc.hh"
-#include "paper-outputter.hh"
-#include "dimension-cache.hh"
-#include "side-position-interface.hh"
-#include "item.hh"
-
-Score_element::Score_element()
-{
- output_p_ =0;
- dim_cache_[X_AXIS] = new Dimension_cache;
- dim_cache_[Y_AXIS] = new Dimension_cache;
- dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-
- used_b_ = false;
-
- dim_cache_[X_AXIS]->set_callback (molecule_extent);
- dim_cache_[Y_AXIS]->set_callback (molecule_extent);
- used_b_ = false;
- pscore_l_=0;
- lookup_l_ =0;
- status_i_ = 0;
- self_scm_ = SCM_EOL;
- original_l_ = 0;
- element_property_alist_ = SCM_EOL;
-
- smobify_self ();
-
-
- set_elt_property ("dependencies", SCM_EOL);
-}
-
-SCM ly_deep_copy (SCM);
-
-SCM
-ly_deep_copy (SCM l)
-{
- if (gh_pair_p (l))
- {
- return gh_cons (ly_deep_copy (gh_car (l)), ly_deep_copy (gh_cdr (l)));
- }
- else
- return l;
-}
-
-
-Score_element::Score_element (Score_element const&s)
-{
- dim_cache_[X_AXIS] = new Dimension_cache (*s.dim_cache_[X_AXIS]);
- dim_cache_[Y_AXIS] = new Dimension_cache (*s.dim_cache_[Y_AXIS]);
- dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-
- self_scm_ = SCM_EOL;
- used_b_ = true;
- original_l_ =(Score_element*) &s;
-
- /*
- should protect because smobify_self () might trigger GC.
- */
- SCM onstack = ly_deep_copy (s.element_property_alist_);
- element_property_alist_ = onstack;
-
- output_p_ =0;
- status_i_ = s.status_i_;
- lookup_l_ = s.lookup_l_;
- pscore_l_ = s.pscore_l_;
-
- smobify_self ();
-}
-
-Score_element::~Score_element()
-{
- assert (!output_p_);
- assert (status_i_ >=0);
- status_i_ = -1;
-
- delete dim_cache_[X_AXIS];
- delete dim_cache_[Y_AXIS];
-}
-
-
-Real
-Score_element::get_real (String s) const
-{
- return gh_scm2double (get_elt_property (s));
-}
-
-void
-Score_element::set_real (String s, Real r)
-{
- set_elt_property (s, gh_double2scm (r));
-}
-
-// should also have one that takes SCM arg.
-SCM
-Score_element::get_elt_property (String nm) const
-{
- SCM sym = ly_symbol2scm (nm.ch_C());
- SCM s = scm_assq(sym, element_property_alist_);
-
- if (s != SCM_BOOL_F)
- return gh_cdr (s);
-
- if (pscore_l_)
- {
- SCM sym2 = ly_symbol2scm ((name () + ("::" + nm)).ch_C());
- SCM val;
-
- // should probably check for Type::sym as well.
- Paper_def * p= pscore_l_->paper_l_;
- if (p->default_properties_.try_retrieve (sym2, &val))
- return val;
- else if (p->default_properties_.try_retrieve (sym, &val))
- return val;
- }
-
- return SCM_UNDEFINED;
-}
-
-SCM
-Score_element::remove_elt_property (String key)
-{
- SCM s = get_elt_property (key);
- SCM sym = ly_symbol2scm (key.ch_C());
- element_property_alist_ = scm_assq_remove_x (element_property_alist_, sym);
- return s;
-}
-
-/*
- UGH. assoc vs. assq
- */
-void
-Score_element::set_elt_property (String k, SCM v)
-{
- SCM s = ly_symbol2scm (k.ch_C( ));
- element_property_alist_ = scm_assoc_set_x (element_property_alist_, s, v);
-}
-
-Interval
-Score_element::molecule_extent(Dimension_cache const *c)
-{
- Score_element *s = dynamic_cast<Score_element*>(c->element_l());
- Molecule*m = s->do_brew_molecule_p();
- return m->extent()[c->axis ()];
-}
-
-
-void
-Score_element::print() const
-{
-#ifndef NPRINT
- DEBUG_OUT << classname(this) << "{\n";
-
- if (flower_dstream && !flower_dstream->silent_b ("Score_element"))
- ly_display_scm (element_property_alist_);
-
- if (original_l_)
- DEBUG_OUT << "Copy ";
- do_print();
-
- DEBUG_OUT << "}\n";
-#endif
-}
-
-Paper_def*
-Score_element::paper_l () const
-{
- return pscore_l_ ? pscore_l_->paper_l_ : 0;
-}
-
-Lookup const *
-Score_element::lookup_l () const
-{
- if (!lookup_l_)
- {
- Score_element * urg = (Score_element*)this;
- SCM sz = urg->remove_elt_property ("fontsize");
- int i = (gh_number_p (sz))
- ? gh_scm2int (sz)
- : 0;
-
- urg->lookup_l_ = (Lookup*)pscore_l_->paper_l_->lookup_l (i);
- }
- return lookup_l_;
-}
-
-void
-Score_element::add_processing()
-{
- assert (status_i_ >=0);
- if (status_i_)
- return;
- status_i_ ++;
-
-#if 0
- /*
- UGH. UGH. UGH.
- */
- if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED
- && !dim_cache_[X_AXIS]->off_callback_l_)
- {
- dim_cache_[X_AXIS]->off_callbacks_.push (Side_position_interface::aligned_on_self);
- }
-
- if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED
- && !dim_cache_[X_AXIS]->off_callback_l_)
-
- {
- dim_cache_[Y_AXIS]->set_offset_callback (Side_position_interface::aligned_on_self);
- }
-#endif
-
- do_add_processing();
-}
-
-void
-Score_element::calculate_dependencies (int final, int busy,
- Score_element_method_pointer funcptr)
-{
- assert (status_i_ >=0);
-
- if (status_i_ >= final)
- return;
-
- assert (status_i_!= busy);
- status_i_= busy;
-
- Link_array<Score_element> dependency_arr =
- Group_interface__extract_elements (this, (Score_element*)0, "dependencies");
-
- for (int i=0; i < dependency_arr.size(); i++)
- dependency_arr[i]->calculate_dependencies (final, busy, funcptr);
-
- Link_array<Score_element> extra (get_extra_dependencies());
- for (int i=0; i < extra.size(); i++)
- extra[i]->calculate_dependencies (final, busy, funcptr);
-
- (this->*funcptr)();
- status_i_= final;
-}
-
-void
-Score_element::output_processing ()
-{
- if (to_boolean (get_elt_property ("transparent")))
- return;
-
- // we're being silly here.
- if (output_p_)
- delete output_p_;
-
- output_p_ = do_brew_molecule_p ();
- Offset o (relative_coordinate (0, X_AXIS), relative_coordinate (0, Y_AXIS));
-
- SCM s = get_elt_property ("extra-offset");
- if (gh_pair_p (s))
- {
- Real il = paper_l ()->get_var ("interline");
- o[X_AXIS] += il * gh_scm2double (gh_car (s));
- o[Y_AXIS] += il * gh_scm2double (gh_cdr (s));
- }
-
- pscore_l_->outputter_l_->output_molecule (output_p_,
- o,
- classname(this));
-
- delete output_p_;
- output_p_ =0;
-}
-
-/*
-
- VIRTUAL STUBS
-
- */
-void
-Score_element::do_break_processing()
-{
-}
-
-void
-Score_element::do_post_processing()
-{
-}
-
-void
-Score_element::do_breakable_col_processing()
-{
- handle_prebroken_dependencies();
-}
-
-void
-Score_element::do_pre_processing()
-{
-}
-
-void
-Score_element::do_space_processing ()
-{
-}
-
-void
-Score_element::do_add_processing()
-{
-}
-
-
-
-Molecule*
-Score_element::do_brew_molecule_p() const
-{
- SCM glyph = get_elt_property ("glyph");
- if (gh_string_p (glyph))
- {
- Molecule*output = new Molecule (lookup_l ()->afm_find (String (ly_scm2string (glyph))));
-
- return output;
- }
- else
- {
- Interval emp;
- emp.set_empty ();
- Molecule a (lookup_l ()->fill (Box (emp,emp)));
- return new Molecule (a);
- }
-}
-
-
-Line_of_score *
-Score_element::line_l() const
-{
- return 0;
-}
-
-void
-Score_element::add_dependency (Score_element*e)
-{
- if (e)
- {
- Group_interface gi (this, "dependencies");
- gi.add_element (e);
- }
- else
- programming_error ("Null dependency added");
-}
-
-
-
-
-/**
- Do break substitution in S, using CRITERION. Return new value.
- CRITERION is either a SMOB pointer to the desired line, or a number
- representing the break direction. */
-SCM
-Score_element::handle_broken_smobs (SCM s, SCM criterion)
-{
- again:
-
-
- Score_element *sc = unsmob_element ( s);
- if (sc)
- {
- if (criterion == SCM_UNDEFINED)
- return SCM_UNDEFINED;
- else if (gh_number_p (criterion))
- {
- Item * i = dynamic_cast<Item*> (sc);
- Direction d = to_dir (criterion);
- if (i && i->break_status_dir () != d)
- {
- Item *br = i->find_broken_piece (d);
- return (br) ? br->self_scm_ : SCM_UNDEFINED;
- }
- }
- else
- {
- Score_element * ln = unsmob_element ( criterion);
- Line_of_score * line = dynamic_cast<Line_of_score*> (ln);
- Score_element * br =0;
- Line_of_score * dep_line = sc->line_l ();
- if (dep_line != line)
- {
- br = sc->find_broken_piece (line);
- return (br) ? br->self_scm_ : SCM_UNDEFINED;
- }
- if (!dep_line)
- return SCM_UNDEFINED;
- }
- }
- else if (gh_pair_p (s))
- {
- /*
- UGH! breaks on circular lists.
- */
- SCM car = handle_broken_smobs (gh_car (s), criterion);
- SCM cdr = gh_cdr (s);
-
- if (car == SCM_UNDEFINED
- && (gh_pair_p (cdr) || cdr == SCM_EOL))
- {
- /*
- This is tail-recursion, ie.
-
- return handle_broken_smobs (cdr, criterion);
-
- We don't want to rely on the compiler to do this. */
- s = cdr;
- goto again;
- }
-
- gh_set_car_x (s, car);
- gh_set_cdr_x (s, handle_broken_smobs (cdr, criterion));
- return s;
- }
- return s;
-}
-
-void
-Score_element::handle_broken_dependencies()
-{
- Line_of_score *line = line_l();
- element_property_alist_ = handle_broken_smobs (element_property_alist_,
- line ? line->self_scm_ : SCM_UNDEFINED);
-
- if (!line)
- return;
-}
-
-
-/*
- TODO: cleanify.
- */
-void
-Score_element::handle_prebroken_dependencies()
-{
- if (Item*i =dynamic_cast<Item*> (this))
- {
- element_property_alist_
- = handle_broken_smobs (element_property_alist_,
- gh_int2scm (i->break_status_dir ()));
- }
-}
-
-
-
-
-
-Link_array<Score_element>
-Score_element::get_extra_dependencies() const
-{
- Link_array<Score_element> empty;
- return empty;
-}
-
-bool
-Score_element::linked_b() const
-{
- return used_b_;
-}
-
-void
-Score_element::do_print () const
-{
-}
-
-Score_element*
-Score_element::find_broken_piece (Line_of_score*) const
-{
- return 0;
-}
-
-
-
-void
-Score_element::translate_axis (Real y, Axis a)
-{
- dim_cache_[a]->translate (y);
-}
-
-Real
-Score_element::relative_coordinate (Score_element const*e, Axis a) const
-{
- return dim_cache_[a]->relative_coordinate (e ? e->dim_cache_[a] : 0);
-}
-
-Score_element *
-Score_element::common_refpoint (Score_element const* s, Axis a) const
-{
- Dimension_cache *dim = dim_cache_[a]->common_refpoint (s->dim_cache_[a]);
- return dim ? dim->element_l () : 0;
-}
-
-void
-Score_element::set_empty (Axis a)
-{
- dim_cache_[a]->callback_l_ =0;
-}
-
-bool
-Score_element::empty_b (Axis a)const
-{
- return !dim_cache_[a]->callback_l_;
-}
-
-Interval
-Score_element::extent (Axis a) const
-{
- Dimension_cache const * d = dim_cache_[a];
-
- return d->get_dim ();
-}
-
-
-Score_element*
-Score_element::parent_l (Axis a) const
-{
- Dimension_cache*d= dim_cache_[a]->parent_l_;
- return d ? d->elt_l_ : 0;
-}
-
-Score_element *
-Score_element::common_refpoint (Link_array<Score_element> gs, Axis a) const
-{
- Dimension_cache * common = dim_cache_[a];
- for (int i=0; i < gs.size (); i++)
- {
- common = common->common_refpoint (gs[i]->dim_cache_[a]);
- }
-
- return common->element_l ();
-}
-
-char const *
-Score_element::name () const
-{
- return classname (this);
-}
-
-
-void
-Score_element::set_parent (Score_element *g, Axis a)
-{
- dim_cache_[a]->parent_l_ = g ? g->dim_cache_[a]: 0;
-}
-
-void
-Score_element::fixup_refpoint ()
-{
- for (int a = X_AXIS; a < NO_AXES; a ++)
- {
- Axis ax = (Axis)a;
- Score_element * par = parent_l (ax);
-
- if (!par)
- continue;
-
- if (par->line_l () != line_l ())
- {
- Score_element * newpar = par->find_broken_piece (line_l ());
- set_parent (newpar, ax);
- }
-
- if (Item * i = dynamic_cast<Item*> (this))
- {
- Item *pari = dynamic_cast<Item*> (par);
-
- if (pari && i)
- {
- Direction my_dir = i->break_status_dir () ;
- if (my_dir!= pari->break_status_dir())
- {
- Item *newpar = pari->find_broken_piece (my_dir);
- set_parent (newpar, ax);
- }
- }
- }
- }
-}
-
-
-
-/****************************************************
- SMOB funcs
- ****************************************************/
-
-
-#include "ly-smobs.icc"
-
-IMPLEMENT_SMOBS(Score_element);
-IMPLEMENT_UNSMOB(Score_element, element);
-SCM
-Score_element::mark_smob (SCM ses)
-{
- Score_element * s = SMOB_TO_TYPE (Score_element, ses);
- if (s->self_scm_ != ses)
- {
- programming_error ("SMOB marking gone awry");
- return SCM_EOL;
- }
- return s->element_property_alist_;
-}
-
-int
-Score_element::print_smob (SCM s, SCM port, scm_print_state *)
-{
- Score_element *sc = (Score_element *) gh_cdr (s);
-
- scm_puts ("#<Score_element ", port);
- scm_puts ((char *)sc->name (), port);
-
- // scm_puts (" properties = ", port);
- // scm_display (sc->element_property_alist_, port);
- scm_puts (" >", port);
- return 1;
-}
-
-void
-Score_element::do_smobify_self ()
-{
-}
-
-SCM
-Score_element::equal_p (SCM a, SCM b)
-{
- return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
-}
for (int i=00; i< 2; i++)
{
- if (*current[i] && (*current[i])->linked_b())
+ if (*current[i])
{
- pscore_p_->add_column ((*current[i]));
- scoreline_l_->add_column ((*current[i]));
- }
- else
- {
- *current[i] =0;
-
- /*
- We're forgetting about this column. Dump it, and make SCM
- forget it.
-
- (UGH.) */
- scm_unprotect_object ((*current[i])->self_scm_);
+ if ((*current[i])->linked_b())
+ {
+ pscore_p_->add_column ((*current[i]));
+ scoreline_l_->add_column ((*current[i]));
+ }
+ else
+ {
+ /*
+ We're forgetting about this column. Dump it, and make SCM
+ forget it.
+
+ (UGH.) */
+ scm_unprotect_object ((*current[i])->self_scm_);
+ *current[i] =0;
+ }
}
if (news[i])
*current[i] = news[i];
Score::run_translator (Music_output_def *odef_l)
{
Cpu_timer timer;
- scm_gc();
- cout << "\nCells in use: " << scm_cells_allocated << endl;
- cout << "protects: " << scm_ilength (scm_protects) << endl;
Global_translator * trans_p = odef_l->get_global_translator_p();
output->process();
delete output ;
- // force GC
+ /*
+ force GC. At this point, GUILE may give back mallocated area to
+ the system.
+ */
+
scm_gc();
- cout << "\nCells in use: " << scm_cells_allocated <<endl;
- cout << "protects " << scm_ilength (scm_protects) << endl;
-
}
void
{
Link_array<Note_column> encompass_arr =
Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
- set_bounds (LEFT, encompass_arr[0]);
- if (encompass_arr.size () > 1)
- set_bounds (RIGHT, encompass_arr.top ());
+
+ if (encompass_arr.size ())
+ {
+ set_bounds (LEFT, encompass_arr[0]);
+ if (encompass_arr.size () > 1)
+ set_bounds (RIGHT, encompass_arr.top ());
+ }
}
Paper_column * sc
= dynamic_cast<Paper_column*> (get_staff_info ().musical_pcol_l ());
- sc->set_elt_property ("shortest-playing-duration",
- (new Moment (shortest_playing))->smobify_self ());
+ SCM sh = (new Moment (shortest_playing))->smobify_self ();
+ SCM st = (new Moment (starter))->smobify_self ();
+
+ scm_unprotect_object (st);
+ scm_unprotect_object (sh);
- sc->set_elt_property ("shortest-starter-duration",
- (new Moment (starter))->smobify_self ());
+ sc->set_elt_property ("shortest-playing-duration", sh);
+ sc->set_elt_property ("shortest-starter-duration", st);
}
void
if (st)
return st->staff_space ();
else if (elt_l_->pscore_l_ && elt_l_->paper_l ())
- elt_l_->paper_l ()->get_var ("interline");
+ return elt_l_->paper_l ()->get_var ("interline");
return 0.0;
}
StaffContext=\translator {
\type "Engraver_group_engraver";
\name Staff ;
-
+ \consists "Output_property_engraver";
barAuto = ##t
voltaVisibility = ##t
Generic_property_list = #generic-staff-properties
\type "Engraver_group_engraver";
numberOfStaffLines = #1
\consists "Property_engraver";
-
+ \consists "Output_property_engraver";
+
Generic_property_list = #generic-staff-properties
barSize = #'staff-height
\type "Engraver_group_engraver";
dynamicPadding = #5.0
Generic_property_list = #generic-voice-properties
+ \consists "Output_property_engraver";
\consists "Dynamic_engraver"; % must come before text_engraver.
\name Voice ;
GraceContext=\translator {
\type "Grace_engraver_group";
\name "Grace";
+ \consists "Output_property_engraver";
Generic_property_list = #generic-grace-properties
ThreadContext = \translator{
\type Engraver_group_engraver;
\consists "Note_heads_engraver" ;
+ \consists "Output_property_engraver";
Generic_property_list = #generic-thread-properties
\consists "Property_engraver";
\name Thread;
StaffGroupContext= \translator {
\type "Engraver_group_engraver";
\consists "Span_bar_engraver";
+ \consists "Output_property_engraver";
\consists "Staff_group_bar_engraver";
\name StaffGroup;
\translator{
\type "Engraver_group_engraver";
+ \consists "Output_property_engraver";
\consistsend "Axis_group_engraver";
\name ChordNameVoice ;
\name Score;
\consists "Timing_engraver";
+ \consists "Output_property_engraver";
\consists "Span_score_bar_engraver";
% \consists "Score_priority_engraver";
Begin3
Title: LilyPond
-Version: 1.3.26
-Entered-date: 23FEB00
+Version: 1.3.27
+Entered-date: 24FEB00
Description:
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.26.tar.gz
+ 1000k lilypond-1.3.27.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.26.tar.gz
+ 1000k lilypond-1.3.27.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.3.26
+Version: 1.3.27
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.26.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.27.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# get Packager from (undocumented?) ~/.rpmmacros!
currentpicture := currentpicture shifted (0, r);
fet_endchar;
+%%% strange turning path.
fet_beginchar("accBayanbase", "accBayanbase", "accBayanbase")
save lh;
lh = accreg_lh;
cTwo = 0.60;
enddef;
+%%% strange turning path.
fet_beginchar("accSB", "accSB", "accSB")
set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
def_some_vars;
currentpicture := currentpicture shifted (0, 2.4staff_space);
fet_endchar;
+%%% strange turning path.
fet_beginchar("accBB", "accBB", "accBB")
set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
def_some_vars;
fet_endchar;
+%%% strange turning path.
fet_beginchar("accOldEE", "accOldEE", "accOldEE")
set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
show w;
(font-load-command (car x) (cdr x))) font-name-alist)
))
+;;;;;;;;;;;;;;;;;;;;
+
+; Make a function that checks score element for being of a specific type.
+(define (make-type-checker name)
+ (lambda (elt)
+ (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
+
+
+
+
+
+
+
+
+
+
+
+
+
+;;;;;;;;;;;;;;;;;;; TeX output
(define (tex-scm action-name)
(define (unknown)
"%\n\\unknown%\n")
this.write(r"""
%% \vfill\hfill{\mudelatagline}
\makeatletter
-\renewcommand{\@oddfoot}{\thefooter\hfill{\mudelatagline}}%
+\renewcommand{\@oddfoot}{\mudelatagline}%
\makeatother
\end{document}
""")