From: fred Date: Tue, 26 Mar 2002 22:45:57 +0000 (+0000) Subject: lilypond-1.3.27 X-Git-Tag: release/1.5.59~1880 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ba8af0055ab7c5db178ed20381e9055e884e5c2a;p=lilypond.git lilypond-1.3.27 --- diff --git a/TODO b/TODO index cdde07acc9..9fb9933e9f 100644 --- a/TODO +++ b/TODO @@ -14,10 +14,35 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. lilypond --paper=paper16 foo.ly lilypond --paper=paper20 foo.ly lilypond --paper=paper-as9 foo.ly +. * entangle ly/* paper-params papersize stuff . * fix tremolos. . * 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 @@ -27,7 +52,6 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. . * \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 { @@ -71,9 +95,6 @@ level elements (key, clef, meter, etc). This construction makes - 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 @@ -101,8 +122,6 @@ 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. @@ -192,12 +211,10 @@ repeated section with different words for each repeat. . * \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 @@ -215,10 +232,6 @@ to provide IO handling for TeX stream, mudela stream, data-file. . * 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? @@ -235,15 +248,12 @@ to provide IO handling for TeX stream, mudela stream, data-file. 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. @@ -253,6 +263,7 @@ 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) @@ -266,7 +277,6 @@ touching it. . * work out sizes of character fonts. . * more symbols . * piano pedals: Ped/* -. * maxima notehead . * coda signs: Segno, O+ . * glissando, arpeggio . * lengthened trill @@ -285,34 +295,11 @@ touching it. 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 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: @@ -364,14 +351,6 @@ touching it. . * 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) diff --git a/flower/include/hash-table.hh b/flower/include/hash-table.hh index 491feb3df7..aec7ae31af 100644 --- a/flower/include/hash-table.hh +++ b/flower/include/hash-table.hh @@ -151,8 +151,8 @@ public: } /** - Find and return element. If #s# is not in the table, create an entry in the table, and init - */ + Find and return element. If #s# is not in the table, create an + entry in the table, and init */ V& elem (K s) { int l; diff --git a/input/bugs/b.ly b/input/bugs/b.ly new file mode 100644 index 0000000000..87ff53e5a3 --- /dev/null +++ b/input/bugs/b.ly @@ -0,0 +1,2 @@ + +\score { \notes <{ [ r8 g''16 des'] [r8 c16 a] }>} diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 89936e5f0f..88f46c07a9 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -39,11 +39,10 @@ All_font_metrics::find_afm (String name) afm_p->name_ = ly_symbol2scm (name.ch_C ()); progress_indication ("]"); - afm_p_dict_[sname] = afm_p->self_scm_; - scm_unprotect_object (afm_p->self_scm_); + afm_p_dict_.set (sname,afm_p->self_scm_); } - return dynamic_cast (unsmob_metrics (afm_p_dict_[sname])); + return dynamic_cast (unsmob_metrics (afm_p_dict_.get (sname))); } Scaled_font_metric * @@ -58,12 +57,11 @@ All_font_metrics::find_scaled (String nm, int m) { Font_metric *f = find_font (nm); s = new Scaled_font_metric (f, m); - scaled_p_dict_[sname] = s->self_scm_; + scaled_p_dict_.set (sname, s->self_scm_); fm = s; - scm_unprotect_object (s->self_scm_); } else - fm = unsmob_metrics (scaled_p_dict_[sname]); + fm = unsmob_metrics (scaled_p_dict_.get (sname)); return dynamic_cast (fm); } @@ -83,12 +81,11 @@ All_font_metrics::find_tfm (String name) tfm_p->name_ = ly_symbol2scm (name.ch_C( )); progress_indication ("]"); - tfm_p_dict_[sname] = tfm_p->self_scm_; - scm_unprotect_object (tfm_p->self_scm_); + tfm_p_dict_.set (sname, tfm_p->self_scm_); } return - dynamic_cast (unsmob_metrics (tfm_p_dict_[sname])); + dynamic_cast (unsmob_metrics (tfm_p_dict_.get(sname))); } diff --git a/lily/engraver.cc b/lily/engraver.cc index 7b2fb0c90c..40bc87f9c1 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -1,7 +1,7 @@ /* engraver.cc -- implement Engraver - Sourcefile of GNU LilyPond musictypesetter + Sourcefile of GNU LilyPond music type setter (c) 1997--2000 Han-Wen Nienhuys */ @@ -13,6 +13,7 @@ #include "debug.hh" #include "paper-def.hh" #include "score-element.hh" +#include "group-interface.hh" void Engraver::fill_staff_info (Staff_info&) @@ -23,6 +24,9 @@ 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); diff --git a/lily/include/scm-hash.hh b/lily/include/scm-hash.hh index a0382d0446..0a15bfce9a 100644 --- a/lily/include/scm-hash.hh +++ b/lily/include/scm-hash.hh @@ -17,9 +17,18 @@ /** auto resizing hash table. This should come from GUILE. */ -class Scheme_hash_table : public Hash_table +class Scheme_hash_table : private Hash_table { -public: +public: + // bool elem_b (SCM k) const; + Hash_table::try_retrieve; + Hash_table::elem_b; + /** + WARNING: putting something in assumes responsibility for cleaning + up. */ + void set (SCM k, SCM v); + SCM get (SCM k) const; + Scheme_hash_table (); void operator = (Scheme_hash_table const &); Scheme_hash_table (Scheme_hash_table const &); diff --git a/lily/moment.cc b/lily/moment.cc index ebe3b0b190..3d7a69474e 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -39,21 +39,27 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *) 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" diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 7b3309513b..59d61683ab 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -122,7 +122,10 @@ Paper_column::column_l () const 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; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 233e2075d2..2f60f9e14c 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -81,7 +81,7 @@ Paper_def::get_realvar (SCM s) const Interval Paper_def::line_dimensions_int (int n) const { - SCM s = default_properties_ [ly_symbol2scm ("margin-shape")]; + SCM s = default_properties_.get (ly_symbol2scm ("margin-shape")); if (!gh_pair_p (s)) { Real lw = get_var ("linewidth"); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 9e9a57d9b1..c8dbed177d 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include "dimensions.hh" #include "dictionary-iter.hh" @@ -132,6 +133,21 @@ Paper_outputter::output_scheme (SCM scm) } +int +count_cells (SCM s) +{ + if (Atom * a = unsmob_atom (s)) + { + return 2 + count_cells (a->func_); + } + else if (gh_pair_p (s)) + { + return 2 + count_cells (gh_car (s))+ count_cells (gh_cdr (s)); + } + else + return 1; +} + void Paper_outputter::dump_onto (Paper_stream *ps) { @@ -206,7 +222,7 @@ Paper_outputter::dump_onto (Paper_stream *ps) *ps << c; free (c); } - } + } } void @@ -283,7 +299,7 @@ Paper_outputter::output_Real_def (String k, Real v) SCM_UNDEFINED); output_scheme (scm); - gh_define (k.ch_l (), gh_double2scm (v)); + // gh_define (k.ch_l (), gh_double2scm (v)); } void @@ -296,7 +312,7 @@ Paper_outputter::output_String_def (String k, String v) SCM_UNDEFINED); output_scheme (scm); - gh_define (k.ch_l (), ly_str02scm (v.ch_l ())); + // gh_define (k.ch_l (), ly_str02scm (v.ch_l ())); } void @@ -308,7 +324,7 @@ Paper_outputter::output_int_def (String k, int v) SCM_UNDEFINED); output_scheme (scm); - gh_define (k.ch_l (), gh_int2scm (v)); + // gh_define (k.ch_l (), gh_int2scm (v)); } diff --git a/lily/scm-hash.cc b/lily/scm-hash.cc index 4d417416f1..e864d60875 100644 --- a/lily/scm-hash.cc +++ b/lily/scm-hash.cc @@ -6,6 +6,7 @@ (c) 1999 Han-Wen Nienhuys */ +#include #include "scm-hash.hh" #include "hash-table-iter.hh" @@ -63,6 +64,9 @@ int Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*) { assert (SMOB_IS_TYPE_B (Scheme_hash_table, s)); + char str[1000]; + sprintf (str, "# i (*me); i.ok(); i++) { @@ -71,10 +75,23 @@ Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*) scm_display (i.val (), p); scm_puts ("\n",p); } + scm_puts ("> ",p); return 1; } +void +Scheme_hash_table::set (SCM k, SCM v) +{ + elem (k ) = v; + scm_unprotect_object (v); +} + +SCM +Scheme_hash_table::get (SCM k)const +{ + return const_elem (k); +} Scheme_hash_table::~Scheme_hash_table( ) diff --git a/lily/score-element.cc b/lily/score-element.cc index 42a7d083c2..cfa1bfd569 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -51,6 +51,7 @@ Score_element::Score_element() set_elt_property ("dependencies", SCM_EOL); + set_elt_property ("interfaces", SCM_EOL); } SCM ly_deep_copy (SCM); @@ -164,7 +165,11 @@ Score_element::molecule_extent(Dimension_cache const *c) { Score_element *s = dynamic_cast(c->element_l()); Molecule*m = s->do_brew_molecule_p(); - return m->extent()[c->axis ()]; + + Interval iv = m->extent()[c->axis ()]; + + delete m; + return iv; } @@ -647,3 +652,62 @@ Score_element::equal_p (SCM a, SCM b) { 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); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 812e94ff8f..ed74043951 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -171,28 +171,31 @@ void Score_engraver::set_columns (Paper_column *new_command_l, Paper_column *new_musical_l) { - if (command_column_l_ && command_column_l_->linked_b()) - { - pscore_p_->add_column (command_column_l_); - scoreline_l_->add_column (command_column_l_); - } - else - command_column_l_ =0; + Paper_column * news[] = {new_command_l, new_musical_l}; + Paper_column **current[] = {&command_column_l_, &musical_column_l_}; - if (new_command_l) - command_column_l_ = new_command_l; - - if (musical_column_l_ && musical_column_l_->linked_b()) + for (int i=00; i< 2; i++) { - pscore_p_->add_column (musical_column_l_); - scoreline_l_->add_column (musical_column_l_); - } - else - musical_column_l_ = 0; - - if (new_musical_l) - { - musical_column_l_ = new_musical_l; + if (*current[i]) + { + 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]; } } diff --git a/lily/score.cc b/lily/score.cc index 3eda39de70..da9c2d1da1 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -6,6 +6,8 @@ (c) 1997--2000 Han-Wen Nienhuys */ +#include + #include "score.hh" #include "debug.hh" #include "music-output-def.hh" @@ -22,7 +24,7 @@ Score::Score() - : Input() + : Input() { header_p_ = 0; music_p_ = 0; @@ -50,6 +52,8 @@ void Score::run_translator (Music_output_def *odef_l) { Cpu_timer timer; + + Global_translator * trans_p = odef_l->get_global_translator_p(); if (!trans_p) { @@ -94,6 +98,13 @@ Score::run_translator (Music_output_def *odef_l) progress_indication ("\n"); output->process(); delete output ; + + /* + force GC. At this point, GUILE may give back mallocated area to + the system. + */ + + scm_gc(); } void diff --git a/lily/slur.cc b/lily/slur.cc index 9cd4ab1d2d..57a01433b3 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -73,9 +73,13 @@ Slur::do_add_processing () { Link_array 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 ()); + } } diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 8f4672537e..7f3ac132fc 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -97,11 +97,14 @@ Spacing_engraver::do_pre_move_processing () Paper_column * sc = dynamic_cast (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 diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index d08cee919e..64522e734f 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -55,7 +55,7 @@ Staff_symbol_referencer_interface::staff_space () const 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; } diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 5331074f1f..f80b2c49de 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -436,7 +436,7 @@ Translator_group::get_property (SCM sym, Translator_group **where_l) const { if (where_l) *where_l = (Translator_group*) this; // ugh - return properties_dict_[sym]; + return properties_dict_.get (sym); } if (daddy_trans_l_) @@ -451,5 +451,5 @@ Translator_group::get_property (SCM sym, Translator_group **where_l) const void Translator_group::set_property (String id, SCM val) { - properties_dict_[ly_symbol2scm (id.ch_C())] = val; + properties_dict_.set (ly_symbol2scm (id.ch_C()), val); }