From aee1c2b7cdbbca3154cb7198171ae637e36dd508 Mon Sep 17 00:00:00 2001 From: fred <fred> Date: Wed, 27 Mar 2002 00:32:47 +0000 Subject: [PATCH] lilypond-1.3.105 --- CHANGES | 28 +++++- Documentation/user/GNUmakefile | 20 ++++- Documentation/user/lilypond.tely | 4 +- VERSION | 2 +- buildscripts/install-info-html.sh | 27 ++++++ input/test/ancient-font.ly | 102 ++++++++++++++++++++++ lily/arpeggio.cc | 2 +- lily/bar.cc | 2 +- lily/beam-engraver.cc | 6 +- lily/beam.cc | 2 +- lily/breathing-sign.cc | 2 +- lily/chord-name.cc | 2 +- lily/clef-engraver.cc | 3 +- lily/clef-item.cc | 2 +- lily/command-request.cc | 13 +-- lily/crescendo.cc | 2 +- lily/custos.cc | 3 +- lily/dots.cc | 2 +- lily/dynamic-engraver.cc | 24 +++-- lily/font-interface.cc | 125 +++++++++++++++++++++++++++ lily/grace-engraver-group.cc | 3 +- lily/hyphen-spanner.cc | 2 +- lily/include/command-request.hh | 28 ++++-- lily/include/font-interface.hh | 1 + lily/include/lily-guile.hh | 2 +- lily/include/molecule.hh | 17 ++-- lily/include/music-iterator-ctor.hh | 21 +++++ lily/include/music-iterator.hh | 6 ++ lily/include/musical-request.hh | 19 ++-- lily/include/part-combine-music.hh | 4 +- lily/include/request.hh | 3 +- lily/include/score-element.hh | 2 +- lily/key-item.cc | 2 +- lily/lily-guile.cc | 16 ++++ lily/line-of-score.cc | 15 ++-- lily/local-key-engraver.cc | 5 +- lily/local-key-item.cc | 2 +- lily/lyric-extender.cc | 2 +- lily/molecule.cc | 61 ++++++++----- lily/multi-measure-rest-engraver.cc | 4 +- lily/multi-measure-rest.cc | 2 +- lily/music-iterator-ctor.cc | 54 ++++++++++++ lily/musical-request.cc | 5 +- lily/note-head.cc | 2 +- lily/parser.yy | 59 +++++++------ lily/part-combine-music-iterator.cc | 36 ++++---- lily/part-combine-music.cc | 5 +- lily/piano-pedal-engraver.cc | 3 +- lily/piano-pedal-performer.cc | 3 +- lily/rest.cc | 2 +- lily/score-element.cc | 32 +++++-- lily/score-engraver.cc | 7 +- lily/script-engraver.cc | 7 +- lily/script.cc | 12 +-- lily/slur-engraver.cc | 5 +- lily/slur.cc | 2 +- lily/span-dynamic-performer.cc | 8 +- lily/staff-symbol.cc | 2 +- lily/stem-engraver.cc | 3 +- lily/stem-tremolo.cc | 2 +- lily/stem.cc | 2 +- lily/sustain-pedal.cc | 4 +- lily/symbol-cache.cc | 4 +- lily/system-start-delimiter.cc | 2 +- lily/tempo-performer.cc | 5 +- lily/text-item.cc | 17 +--- lily/text-spanner-engraver.cc | 5 +- lily/text-spanner.cc | 2 +- lily/tie.cc | 2 +- lily/time-signature-performer.cc | 5 +- lily/time-signature.cc | 10 ++- lily/timing-translator.cc | 9 +- lily/tuplet-spanner.cc | 2 +- lily/voice-devnull-engraver.cc | 3 +- lily/volta-spanner.cc | 2 +- make/generic-vars.make | 21 +++-- make/mudela-rules.make | 8 +- make/mutopia-rules.make | 12 +-- make/mutopia-targets.make | 4 +- make/toplevel.make.in | 6 +- mf/GNUmakefile | 4 +- scm/backend-documentation-lib.scm | 36 +++++++- scm/documentation-lib.scm | 15 +++- scm/engraver-documentation-lib.scm | 8 +- scm/font.scm | 8 +- scm/generate-documentation.scm | 26 ++++-- scm/translator-description.scm | 18 ++++ stepmake/stepmake/generic-vars.make | 30 ++++--- stepmake/stepmake/texinfo-rules.make | 2 +- 89 files changed, 829 insertions(+), 282 deletions(-) create mode 100644 buildscripts/install-info-html.sh create mode 100644 input/test/ancient-font.ly create mode 100644 lily/include/music-iterator-ctor.hh create mode 100644 lily/music-iterator-ctor.cc diff --git a/CHANGES b/CHANGES index 303cca1570..c72d0969f5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,12 +1,35 @@ -1.3.103.jcn5 +1.3.104.jcn3 ============ +* Bit of temporary makefile hacking to stay in sync with makeinfo patch. + +* Separate interface description (test phase). + +* Makeinfo --html split fix: http://appel.lilypond.org/fred/software/texinfo-4.0.jcn2.diff + +* Use headers for makeinfo html output. + +* Made some --scrdir build fixes. + +1.3.104.uu1 +=========== + +* Smobified molecule, and cache molecule (ie. generate each molecule +only once). Lily should be faster now. (approx. 6 % ?) + +* Coded properties-to-font-name in C++. Measured speedup: 14% (wtk1-fugue2) + +* Use music properties for Request data. + +1.3.104 +======= + * Documentation build fix: don't run LilyPond when generating plain info doc. * Resurrected info documentation and made cross links between manual and generated doco, some small fixes. -* Made small Time signature style fix. +* Made small time signature style fix. * Generate texinfo iso html documentation. @@ -2917,3 +2940,4 @@ pl 15.hwn1 pl 15.jcn4 - direct #... to scm parser (Thanks to Gary Houston) + diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile index 0cee86ef33..70af27845c 100644 --- a/Documentation/user/GNUmakefile +++ b/Documentation/user/GNUmakefile @@ -31,10 +31,17 @@ ps: $(PS_FILES) info: $(INFO_FILES) -default: info +default: local-WWW: $(HTML_FILES) $(datafiles) $(PS_GZ_FILES) backdoc-WWW - true + $(SHELL) $(buildscript-dir)/install-info-html.sh $(outdir) lilypond lilypond-internals + $(MAKE) footify + ln -f $(outdir)/*.png $(outdir)/lilypond + $(MAKE) deep-footify + +deep-footify: + $(PYTHON) $(step-bindir)/add-html-footer.py --index=../../$(depth)/ --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION) --header=$(depth)/Documentation/header.html.in --footer $(depth)/Documentation/footer.html.in $(sort $(wildcard $(outdir)/*/*.html)) + # $(PYTHON) $(step-bindir)/ls-latex.py --title 'User documentation' \ # $(DOC_FILES) $(TEX_FILES) $(TELY_FILES) \ @@ -49,8 +56,13 @@ localclean: rm -f fonts.aux fonts.log feta*.tfm feta*.*pk backdoc-WWW: $(outdir)/lilypond-internals.html + $(MAKE) footify #ugh. lily/OUT/lilypond hardcoded. +# when cross-compiling, we don't have lilypond $(outdir)/lilypond-internals.texi: - (cd $(outdir); $(topdir)/lily/out/lilypond ../$(srcdir)/../ly/generate-documentation) - + if [ -e $(depth)/$(builddir)/lily/out/lilypond ]; then \ + cd $(outdir) && ../$(depth)/$(builddir)/lily/out/lilypond ../$(src-depth)/ly/generate-documentation; \ + else \ + touch $@; \ + fi diff --git a/Documentation/user/lilypond.tely b/Documentation/user/lilypond.tely index d988d77164..71a42333d1 100644 --- a/Documentation/user/lilypond.tely +++ b/Documentation/user/lilypond.tely @@ -80,8 +80,6 @@ than the names being similar :-)" @node Top, , , (dir) @chapter GNU LilyPond --- The music typesetter -@contents - @menu * Tutorial:: A tutorial introduction to lilypond. * Invoking LilyPond:: Operation. @@ -96,6 +94,8 @@ than the names being similar :-)" * Index:: Unified index. @end menu +@contents + @macro keyindex {word} @cindex \word\ diff --git a/VERSION b/VERSION index 3e35f9dbd6..2e7b9bcdf6 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=104 +PATCH_LEVEL=105 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/buildscripts/install-info-html.sh b/buildscripts/install-info-html.sh new file mode 100644 index 0000000000..ba86329fb9 --- /dev/null +++ b/buildscripts/install-info-html.sh @@ -0,0 +1,27 @@ +#!@BASH@ + +dir=$1 +index=$dir/index.html +shift + +rm -f $index +cat > $index <<EOF +<html> +<body> +You want to be <a href=$1/$1.html>here</a> +<p> +<ul> +EOF + +for i in $*; do +cat >> $index <<EOF +<li> <a href=$i/$i.html>$i</a> +EOF +done + +cat >> $index <<EOF +</ul> +</body> +</html> +EOF + diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly new file mode 100644 index 0000000000..f71d198e5a --- /dev/null +++ b/input/test/ancient-font.ly @@ -0,0 +1,102 @@ +\header { + title = "ancient font test"; + date = "2000"; +} + +\version "1.3.59"; + +\include "paper26.ly" + +global = \notes { + \property Score.timing = 1 + \property Staff.TimeSignature \push #'style = #"old" + \time 2/2; +} + +upperVoice = \context Staff = upperVoice < + \global + \property Staff.numberOfStaffLines = 4 + \notes \transpose c' { + \property Staff.Custos \push #'style = #'"vaticana" + \clef "vaticana_fa2"; + c1 d e f g + \clef "vaticana_do2"; + a b c' \bar "|"; + b a g f + \clef "vaticana_fa1"; + e d c\breve \bar "|"; + + \property Staff.Custos \push #'style = #"medicaea" + \clef "medicaea_fa2"; + c1 d e f g + \clef "medicaea_do2"; + a b c' \bar "|"; + b a g f + \clef "medicaea_fa1"; + e d c\breve \bar "|"; + + \property Staff.Custos \push #'style = #'"hufnagel" + \clef "hufnagel_fa2"; + c1 d e f g + \clef "hufnagel_do2"; + a b c' \bar "|"; + b a g f + \clef "hufnagel_fa1"; + e d c\breve \bar "||"; + } +> + +lowerVoice = \context Staff = lowerNotes < + \global + \property Staff.numberOfStaffLines = 5 + \notes \transpose c'' { + \property Staff.Custos \push #'style = #'"mensural" + \clef "mensural1_c2"; + c1 d e f g + \clef "mensural1_c2"; + a b c' \bar "|"; + b a g f + \clef "mensural2_c2"; + e d c\breve \bar "|"; + + \clef "mensural2_c2"; + c1 d e f g + \clef "mensural3_c2"; + a b c' \bar "|"; + b a g f + \clef "mensural3_c2"; + e d c\breve \bar "|"; + + \clef "mensural_f"; + c1 d e f g + \clef "mensural_f"; + a b c' \bar "|"; + b a g f + \clef "mensural_f"; + e d c\breve \bar "|"; + + \clef "hufnagel"; + c,1 d, e, f, g, + \clef "hufnagel"; + a, b, c \bar "||"; + } +> + +\score { + \context ChoirStaff < + \upperVoice + \lowerVoice + > + \paper { +% \paper_twentysix + linewidth = 17.25\cm; + textheight = 26.0\cm; + indent = 0.0; + \translator { + \StaffContext + \consists "Custos_engraver"; +% custosStyle = "mensural"; + } + } +} + diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 1c2d79d14d..39cc20ba49 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -78,7 +78,7 @@ Arpeggio::brew_molecule (SCM smob) } mol.translate_axis (heads[LEFT], Y_AXIS); - return mol.create_scheme (); + return mol.smobbed_copy () ; } /* diff --git a/lily/bar.cc b/lily/bar.cc index 9da7babb50..fa3862786d 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -38,7 +38,7 @@ Bar::brew_molecule (SCM smob) if (sz < 0) return SCM_EOL; - return compound_barline (me, str, sz).create_scheme (); + return compound_barline (me, str, sz).smobbed_copy (); } return SCM_EOL; } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 8b01712e9a..d79b545e41 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -66,7 +66,8 @@ Beam_engraver::do_try_music (Music *m) { if (Span_req * c = dynamic_cast<Span_req*>(m)) { - if (c->span_type_str_ == "abort") + if (scm_equal_p (c->get_mus_property ("span-type"), + ly_str02scm ("abort")) == SCM_BOOL_T) { reqs_drul_[START] = 0; reqs_drul_[STOP] = 0; @@ -74,7 +75,8 @@ Beam_engraver::do_try_music (Music *m) beam_p_->suicide (); beam_p_ = 0; } - else if (c->span_type_str_ == "beam") + else if (scm_equal_p (c->get_mus_property ("span-type"), + ly_str02scm ("beam")) == SCM_BOOL_T) { Direction d =c->get_span_dir (); diff --git a/lily/beam.cc b/lily/beam.cc index 776ea32631..f94c018083 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -806,7 +806,7 @@ Beam::brew_molecule (SCM smob) mol.translate_axis (x0 - dynamic_cast<Spanner*> (me)->get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS); - return mol.create_scheme (); + return mol.smobbed_copy (); } int diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index a00d8c4712..935151e514 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -31,7 +31,7 @@ Breathing_sign::brew_molecule (SCM smob) Interval i1(0, space / 6), i2(-space / 2, space / 2); Box b(i1, i2); - return Lookup::filledbox(b).create_scheme (); + return Lookup::filledbox(b).smobbed_copy (); } MAKE_SCHEME_CALLBACK(Breathing_sign,offset_callback,2); diff --git a/lily/chord-name.cc b/lily/chord-name.cc index 4e6f87cdc4..163371807d 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -72,5 +72,5 @@ Chord_name::brew_molecule (SCM smob) Staff_symbol_referencer::staff_space (me)); } - return mol.create_scheme (); + return mol.smobbed_copy (); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 53d9bd62d4..83eb544afe 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -171,7 +171,8 @@ Clef_engraver::do_try_music (Music * r_l) if (Clef_change_req *cl = dynamic_cast <Clef_change_req *> (r_l)) { clef_req_l_ = cl; - if (!set_type (cl->clef_str_)) + String t = ly_scm2string (cl->get_mus_property ("clef-type")); + if (!set_type (t)) cl->origin ()->warning (_ ("unknown clef type")); return true; diff --git a/lily/clef-item.cc b/lily/clef-item.cc index a96275bb60..1f6ac5627a 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -76,7 +76,7 @@ Clef::brew_molecule (SCM smob) SCM glyph = sc->get_elt_property ("glyph"); if (gh_string_p (glyph)) { - return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).create_scheme (); + return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).smobbed_copy (); } else { diff --git a/lily/command-request.cc b/lily/command-request.cc index 8ea0ef54dd..2f5f83b3f8 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -24,9 +24,9 @@ Barcheck_req::do_equal_b (Request const *r) const } -Clef_change_req::Clef_change_req (String s) +Clef_change_req::Clef_change_req () { - clef_str_ = s; + } @@ -36,20 +36,20 @@ Time_signature_change_req::do_equal_b (Request const *r) const Time_signature_change_req const* m = dynamic_cast <Time_signature_change_req const*> (r); +#if 0 return m && m->beats_i_ == beats_i_ && one_beat_i_ == m->one_beat_i_; +#endif + return m; } Time_signature_change_req::Time_signature_change_req () { - beats_i_ = 0; - one_beat_i_ =0; } Tempo_req::Tempo_req () { - metronome_i_ = 60; dur_. durlog_i_ = 2; } @@ -60,7 +60,8 @@ Tempo_req::do_equal_b (Request const *r) const { Tempo_req const *t = dynamic_cast <Tempo_req const*> (r); - return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_; + return t&& t->dur_.length_mom ()== dur_.length_mom (); + // && metronome_i_ == t->metronome_i_; } diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 4ef0ef6ce5..9bfbf02eff 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -71,7 +71,7 @@ Crescendo::brew_molecule (SCM smob) Molecule mol (b, hairpin); mol.translate_axis (broken_left, X_AXIS); - return mol.create_scheme (); + return mol.smobbed_copy (); } diff --git a/lily/custos.cc b/lily/custos.cc index 24091d6646..91d726e2f7 100644 --- a/lily/custos.cc +++ b/lily/custos.cc @@ -165,8 +165,7 @@ Custos::brew_molecule (SCM smob) else { add_streepjes(me, (int)pos, interspaces, &molecule); - SCM result = molecule.create_scheme(); - return result; + return molecule.smobbed_copy(); } } else diff --git a/lily/dots.cc b/lily/dots.cc index 78a6d41f7e..31facd5fbd 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -65,7 +65,7 @@ Dots::brew_molecule (SCM d) mol.add_at_edge (X_AXIS, RIGHT, d, dw); } } - return mol.create_scheme (); + return mol.smobbed_copy (); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 4a9e01eab7..ee1aea2fbf 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -98,7 +98,8 @@ Dynamic_engraver::do_try_music (Music * m) } else if (Span_req* s = dynamic_cast <Span_req*> (m)) { - if (s->span_type_str_ == "abort") + String t = ly_scm2string (s->get_mus_property ("span-type")); + if (t== "abort") { accepted_spanreqs_drul_[LEFT] = 0; accepted_spanreqs_drul_[RIGHT] = 0; @@ -109,8 +110,8 @@ Dynamic_engraver::do_try_music (Music * m) cresc_p_->suicide (); cresc_p_ = 0; } - else if ((s->span_type_str_ == "crescendo" - || s->span_type_str_ == "decrescendo")) + else if (t == "crescendo" + || t == "decrescendo") { accepted_spanreqs_drul_[s->get_span_dir()] = s; return true; @@ -230,13 +231,18 @@ Dynamic_engraver::do_process_music () /* TODO: Use symbols. */ - SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C()); + String start_type = ly_scm2string (accepted_spanreqs_drul_[START]->get_mus_property ("span-type")); + + /* + ugh. Use push/pop? + */ + SCM s = get_property ((start_type + "Spanner").ch_C()); if (!gh_string_p (s) || ly_scm2string (s) == "hairpin") { cresc_p_ = new Spanner (get_property ("Crescendo")); cresc_p_->set_elt_property ("grow-direction", - gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo") + gh_int2scm ((start_type == "crescendo") ? BIGGER : SMALLER)); } @@ -249,15 +255,15 @@ Dynamic_engraver::do_process_music () { cresc_p_ = new Spanner (get_property ("TextSpanner")); cresc_p_->set_elt_property ("type", s); - daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_ + daddy_trans_l_->set_property (start_type + "Spanner", SCM_UNDEFINED); - s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C()); + s = get_property ((start_type + "Text").ch_C()); if (gh_string_p (s)) { cresc_p_->set_elt_property ("edge-text", gh_cons (s, ly_str02scm (""))); - daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_ - + "Text", SCM_UNDEFINED); + daddy_trans_l_->set_property (start_type + "Text", + SCM_UNDEFINED); } } diff --git a/lily/font-interface.cc b/lily/font-interface.cc index dc6bd81d57..452a956ee6 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -12,6 +12,7 @@ #include "font-interface.hh" #include "score-element.hh" #include "paper-def.hh" +#include "warn.hh" SCM @@ -77,3 +78,127 @@ Font_interface::add_style (Score_element* me, SCM style, SCM chain) } return chain; } + +/* +SCM routines: + +Interpreting music... +MIDI output to wtk1-fugue2.midi... +Track ... + +real 0m31.862s +user 0m29.110s +sys 0m0.260s + +real 0m26.964s +user 0m24.850s +sys 0m0.280s + + +so a 14% speedup. + +*/ + +static SCM name_sym, shape_sym, family_sym, series_sym, rel_sz_sym, pt_sz_sym; + + +static void +init_syms () +{ + name_sym = scm_permanent_object (ly_symbol2scm ("font-name")); + shape_sym = scm_permanent_object (ly_symbol2scm ("font-shape")); + family_sym = scm_permanent_object (ly_symbol2scm ("font-family")); + series_sym = scm_permanent_object (ly_symbol2scm ("font-series")); + rel_sz_sym = scm_permanent_object (ly_symbol2scm ("font-relative-size")); + pt_sz_sym = scm_permanent_object (ly_symbol2scm ("font-point-size")); +} + + +ADD_SCM_INIT_FUNC(Font_interface_syms,init_syms); + + +MAKE_SCHEME_CALLBACK(Font_interface,properties_to_font_name,2); +SCM +Font_interface::properties_to_font_name (SCM fonts, SCM alist_chain) +{ + SCM name = ly_assoc_chain (name_sym, alist_chain); + + SCM shape = SCM_BOOL_F; + SCM family = SCM_BOOL_F; + SCM series = SCM_BOOL_F; + + + SCM point_sz = ly_assoc_chain (pt_sz_sym, alist_chain); + SCM rel_sz = SCM_BOOL_F; + + if (!gh_pair_p (name)) + { + shape = ly_assoc_chain (shape_sym, alist_chain); + family = ly_assoc_chain (family_sym, alist_chain); + series = ly_assoc_chain (series_sym, alist_chain); + + if (gh_pair_p (shape)) + shape = gh_cdr (shape); + if (gh_pair_p (family)) + family = gh_cdr (family); + if (gh_pair_p (series)) + series = gh_cdr (series); + } + else + name = gh_cdr (name); + + + if (gh_pair_p (point_sz)) + point_sz = gh_cdr (point_sz); + else + { + rel_sz = ly_assoc_chain (rel_sz_sym, alist_chain); + if (gh_pair_p (rel_sz)) + rel_sz = gh_cdr (rel_sz); + } + + for (SCM s = fonts ; gh_pair_p (s); s = gh_cdr (s)) + { + SCM qlist = gh_caar (s); + + if (name != SCM_BOOL_F) + { + if (scm_list_ref (qlist, gh_int2scm (4)) != name) + continue; + } + else + { + if (series != SCM_BOOL_F + && scm_list_ref (qlist, gh_int2scm (1)) != series) + continue; + if (shape != SCM_BOOL_F + && scm_list_ref (qlist, gh_int2scm (2)) != shape) + continue; + if (family != SCM_BOOL_F + && scm_list_ref (qlist, gh_int2scm (3)) != family) + continue; + } + + if (point_sz != SCM_BOOL_F) + { + if (scm_list_ref (qlist, gh_int2scm (4)) != name) + continue; + } + else + { + if (rel_sz != SCM_BOOL_F + && gh_car (qlist) != rel_sz) + continue; + } + + + SCM qname = gh_cdar (s); + return qname; + } + + warning (_("couldn't find any font satisfying ") ); + scm_write (gh_list (name, point_sz, shape, series , family, rel_sz, SCM_UNDEFINED), scm_current_error_port ()); + + return gh_str02scm ("cmr10"); + +} diff --git a/lily/grace-engraver-group.cc b/lily/grace-engraver-group.cc index ae3a2f5a3e..db566fe4bb 100644 --- a/lily/grace-engraver-group.cc +++ b/lily/grace-engraver-group.cc @@ -109,7 +109,8 @@ Grace_engraver_group::pass_to_top_b (Music *m) const { if (Span_req * sp = dynamic_cast<Span_req*> (m)) { - if (sp->span_type_str_ == "slur") + if (scm_equal_p (sp->get_mus_property ("span-type"), ly_str02scm ("slur")) + == SCM_BOOL_T) // return true; return false; } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 7827102e91..aa0673eb71 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -83,7 +83,7 @@ Hyphen_spanner::brew_molecule (SCM smob) mol.translate_axis (bounds.center () -sp->relative_coordinate (common, X_AXIS), X_AXIS); - return mol.create_scheme (); + return mol.smobbed_copy (); } void diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 078e02dd2f..862ef287a3 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -16,9 +16,12 @@ #include "musical-pitch.hh" #include "protected-scm.hh" +/* + Real penalty_f_; + */ class Break_req : public Request { public: - Real penalty_f_; + Break_req (); protected: VIRTUAL_COPY_CONS(Music); @@ -39,12 +42,14 @@ public: VIRTUAL_COPY_CONS(Music); }; - +/* + int metronome_i_; + */ class Tempo_req : public Timing_req { public: Duration dur_; - int metronome_i_; + Tempo_req(); protected: @@ -56,15 +61,16 @@ protected: /** todo: allow C time_signature + + int beats_i_; + int one_beat_i_; + */ class Time_signature_change_req : public Timing_req { public: - int beats_i_; - int one_beat_i_; - Time_signature_change_req(); -protected: +protected: bool do_equal_b (Request const *) const; VIRTUAL_COPY_CONS(Music); }; @@ -106,10 +112,14 @@ protected: bool do_equal_b (Request const * )const; }; +/* + String clef_str_; + */ + class Clef_change_req : public Request { public: - String clef_str_; - Clef_change_req (String); + + Clef_change_req (); protected: VIRTUAL_COPY_CONS(Music); diff --git a/lily/include/font-interface.hh b/lily/include/font-interface.hh index 935d866743..399511d103 100644 --- a/lily/include/font-interface.hh +++ b/lily/include/font-interface.hh @@ -19,6 +19,7 @@ struct Font_interface static Font_metric * get_font (Score_element*, SCM alist_chain); static Font_metric * get_default_font (Score_element*); static SCM add_style (Score_element*, SCM style, SCM alist_chain); + DECLARE_SCHEME_CALLBACK(properties_to_font_name, (SCM,SCM)); }; #endif /* FONT_INTERFACE_HH */ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index d69322d91b..8c4cf5d1cd 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -38,7 +38,7 @@ String ly_scm2string (SCM s); String ly_symbol2string (SCM); SCM ly_offset2scm (Offset); Offset ly_scm2offset (SCM); - +SCM ly_assoc_chain (SCM key, SCM achain); Interval ly_scm2interval (SCM); SCM ly_interval2scm (Interval); diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index e61a64c8b9..99ab0a1f32 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -14,6 +14,7 @@ #include "axes.hh" #include "direction.hh" #include "lily-guile.hh" +#include "smobs.hh" /** a group of individually translated symbols. You can add molecules to the top, to the right, etc. @@ -37,23 +38,21 @@ Empty molecules have empty dimensions. If add_at_edge is used to init the molecule, we assume that DIMENSIONS = (Interval(0,0),Interval(0,0) - - TODO: go full smob with Molecule. - */ class Molecule { - /// can't alloc on heap. - void * operator new (size_t s); Box dim_; SCM expr_; -public: - - SCM get_expr () const; + DECLARE_SIMPLE_SMOBS(Molecule,); +public: Molecule (Box, SCM s); Molecule(); + + SCM smobbed_copy () const; + SCM get_expr () const; + /** Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */ void set_empty (bool); @@ -81,6 +80,8 @@ public: bool empty_b() const; }; + +Molecule *unsmob_molecule (SCM); SCM fontify_atom (Font_metric*, SCM atom); Molecule create_molecule (SCM brew_molecule); diff --git a/lily/include/music-iterator-ctor.hh b/lily/include/music-iterator-ctor.hh new file mode 100644 index 0000000000..56fc3c03c2 --- /dev/null +++ b/lily/include/music-iterator-ctor.hh @@ -0,0 +1,21 @@ +/* + score-element-callback.hh -- declare Score_element callbacks + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl> + + */ + +#ifndef SCORE_ELEMENT_CALLBACK_HH +#define SCORE_ELEMENT_CALLBACK_HH + +#include "lily-proto.hh" +#include "lily-guile.hh" + +typedef void * (*Cpp_function) (SCM param); +SCM smobify_cpp_function (Cpp_function cb); + + +#endif /* SCORE_ELEMENT_CALLBACK_HH */ + diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 43d39505d7..30dae48a33 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -105,4 +105,10 @@ private: Interpretation_context_handle handle_; }; + + + + + + #endif // MUSIC_ITERATOR_HH diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 8ecb9a55a2..55aaebe5d6 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -23,7 +23,6 @@ class Rhythmic_req : public virtual Request { public: Duration duration_; - bool do_equal_b (Request const*) const; void compress (Moment); virtual Moment length_mom () const; @@ -40,8 +39,9 @@ public: struct Tremolo_req : public Request { VIRTUAL_COPY_CONS (Music); Tremolo_req (); - int type_i_; + void set_type (int); + int get_type () const; }; @@ -58,7 +58,7 @@ protected: class Articulation_req : public Script_req { public: - String articulation_str_; + String get_articulation_str(); protected: virtual bool do_equal_b (Request const*) const; @@ -106,14 +106,17 @@ struct Bass_req : public Melodic_req VIRTUAL_COPY_CONS (Music); }; -/// Put a note of specified type, height, and with accidental on the staff. -class Note_req : public Rhythmic_req, virtual public Melodic_req { -public: - - /// force/supress printing of accidental. +/* + Put a note of specified type, height, and with accidental on the staff. + /// force/supress printing of accidental. bool forceacc_b_; /// Cautionary, i.e. parenthesized accidental. bool cautionary_b_; + + */ +class Note_req : public Rhythmic_req, virtual public Melodic_req { +public: + Note_req(); protected: diff --git a/lily/include/part-combine-music.hh b/lily/include/part-combine-music.hh index 1c91b340f2..cccfaaa1d3 100644 --- a/lily/include/part-combine-music.hh +++ b/lily/include/part-combine-music.hh @@ -17,7 +17,7 @@ class Part_combine_music : public Music { public: VIRTUAL_COPY_CONS (Music); - Part_combine_music (String, Music*, Music*); + Part_combine_music (SCM what_str, Music*, Music*); Music * first_l () const; Music * second_l () const; @@ -27,8 +27,6 @@ public: virtual Moment length_mom () const; virtual Musical_pitch to_relative_octave (Musical_pitch); virtual void compress (Moment); - - String what_str_; }; #endif /* PART_COMBINE_MUSIC_HH */ diff --git a/lily/include/request.hh b/lily/include/request.hh index f5ab252a52..e05332a7c9 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -53,7 +53,8 @@ public: */ class Span_req : public virtual Request { public: - String span_type_str_; + String get_span_type_str () const; + void set_span_type_str (String); void set_span_dir (Direction d); Direction get_span_dir () const; diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 59e4a49e52..424a182932 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -100,7 +100,7 @@ public: virtual void discretionary_processing (); virtual SCM do_derived_mark (); - Molecule get_molecule () const; + Molecule * get_molecule () const; void suicide (); DECLARE_SCHEME_CALLBACK(preset_extent, (SCM smob, SCM axis)); diff --git a/lily/key-item.cc b/lily/key-item.cc index 2bc9024dfe..9fc51e1161 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -130,7 +130,7 @@ Key_item::brew_molecule (SCM smob) } } - return mol.create_scheme(); + return mol.smobbed_copy(); } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 87ad033329..7f56dbcf3e 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -437,3 +437,19 @@ ly_deep_copy (SCM l) } + + +SCM +ly_assoc_chain (SCM key, SCM achain) +{ + if (gh_pair_p (achain)) + { + SCM handle = scm_assoc (key, gh_car (achain)); + if (gh_pair_p (handle)) + return handle; + else + return ly_assoc_chain (key, gh_cdr (achain)); + } + else + return SCM_BOOL_F; +} diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 14a37b1d23..bb79f780a0 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -305,8 +305,9 @@ Line_of_score::post_processing (bool last_line) (ugh. This is not very memory efficient.) */ for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) - unsmob_element (gh_car (s))->get_molecule (); - + { + unsmob_element (gh_car (s))->get_molecule (); + } /* font defs; */ @@ -327,8 +328,10 @@ Line_of_score::post_processing (bool last_line) */ for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) { - Score_element * sc = unsmob_element (gh_car (s)); - Molecule m = sc->get_molecule (); + Score_element *sc = unsmob_element (gh_car (s)); + Molecule *m = sc->get_molecule (); + if (!m) + continue; Offset o (sc->relative_coordinate (this, X_AXIS), sc->relative_coordinate (this, Y_AXIS)); @@ -337,10 +340,10 @@ Line_of_score::post_processing (bool last_line) if (gh_pair_p (e)) { o[X_AXIS] += gh_scm2double (gh_car (e)); - o[Y_AXIS] += gh_scm2double (gh_cdr (e)); + o[Y_AXIS] += gh_scm2double (gh_cdr (e)); } - output_molecule (m.get_expr (), o); + output_molecule (m->get_expr (), o); } if (last_line) { diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 685f6c0f37..115a5d3a60 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -98,7 +98,8 @@ Local_key_engraver::process_acknowledged () bool different = prev_acc != a; bool tie_changes = tied_l_arr_.find_l (support_l) && different; - if ((note_l->forceacc_b_ || different) && !tie_changes) + if ((to_boolean (note_l->get_mus_property ("force-accidental")) + || different) && !tie_changes) { if (!key_item_p_) { @@ -117,7 +118,7 @@ Local_key_engraver::process_acknowledged () && abs(prev_acc) == 2; Local_key_item::add_pitch (key_item_p_, note_l->pitch_, - note_l->cautionary_b_, + to_boolean (note_l->get_mus_property ("cautionary")), extra_natural); Side_position::add_support (key_item_p_,support_l); } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 69314d50fd..1b37fb22a3 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -159,7 +159,7 @@ Local_key_item::brew_molecule (SCM smob) } while ( flip (&d)!= LEFT); } - return mol.create_scheme(); + return mol.smobbed_copy(); } bool diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index cd207ce9ca..7de58843b4 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -43,7 +43,7 @@ Lyric_extender::brew_molecule (SCM smob) Real h = sl * gh_scm2double (sp->get_elt_property ("height")); Molecule mol (Lookup::filledbox ( Box (Interval (0,w), Interval (0,h)))); mol.translate (Offset (leftext, 0)); - return mol.create_scheme(); + return mol.smobbed_copy(); } void diff --git a/lily/molecule.cc b/lily/molecule.cc index fa83fc6a6c..e135b6b3fc 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -17,6 +17,17 @@ #include "debug.hh" #include "killing-cons.tcc" +#include "ly-smobs.icc" + + +SCM +Molecule::smobbed_copy () const +{ + Molecule * m = new Molecule(*this); + + return m->smobbed_self (); +} + Interval Molecule::extent(Axis a) const { @@ -143,34 +154,38 @@ Molecule::get_expr () const return expr_; } -Molecule -create_molecule (SCM scm_mol) -{ - if (!gh_pair_p (scm_mol)) - return Molecule (); - SCM exp = gh_car (scm_mol); - scm_mol = gh_cdr (scm_mol); - Box b ; - if (gh_pair_p (scm_mol)) - { - Interval i1 = ly_scm2interval (gh_car (scm_mol)); - Interval i2 = ly_scm2interval (gh_cdr (scm_mol)); - b = Box (i1,i2); - } - return Molecule (b, exp); + +Box +Molecule::extent_box () const +{ + return dim_; } +IMPLEMENT_SIMPLE_SMOBS(Molecule); -SCM -Molecule::create_scheme () const + +int +Molecule::print_smob (SCM s, SCM port, scm_print_state *) { - return gh_cons (expr_, - gh_cons (ly_interval2scm (dim_[X_AXIS]), - ly_interval2scm (dim_[Y_AXIS]))); + Molecule *r = (Molecule *) gh_cdr (s); + + scm_puts ("#<Molecule ", port); + /* String str(r->str()); + scm_puts ((char *)str.ch_C(), port);*/ + scm_puts (" >", port); + + return 1; } -Box -Molecule::extent_box () const + +SCM +Molecule::mark_smob (SCM s) { - return dim_; + Molecule *r = (Molecule *) gh_cdr (s); + + return r->expr_; } + +IMPLEMENT_TYPE_P(Molecule, "molecule?"); +IMPLEMENT_DEFAULT_EQUAL_P(Molecule); +IMPLEMENT_UNSMOB(Molecule, molecule); diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index f8d23f7906..228ab780c9 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -73,7 +73,9 @@ Multi_measure_rest_engraver::do_try_music (Music* req_l) { if (Span_req * sp = dynamic_cast<Span_req*> (req_l)) { - if (sp->span_type_str_ == "rest") + + if (scm_equal_p (sp->get_mus_property ("span-type"), + ly_str02scm ("rest"))) { if (sp->get_span_dir() == STOP) { diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 16c6a56e57..c6e143d329 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -150,7 +150,7 @@ Multi_measure_rest::brew_molecule (SCM smob) mol.add_molecule (s); } mol.translate_axis (x_off, X_AXIS); - return mol.create_scheme(); + return mol.smobbed_copy(); } /* diff --git a/lily/music-iterator-ctor.cc b/lily/music-iterator-ctor.cc new file mode 100644 index 0000000000..0af9158698 --- /dev/null +++ b/lily/music-iterator-ctor.cc @@ -0,0 +1,54 @@ +/* + score-element-callback.cc -- implement Callback smob. + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl> + + */ + +#include "music-iterator-ctor.hh" + +static long callback_tag; + +static +SCM mark_smob (SCM) +{ + return SCM_EOL; +} + +static int +print_smob (SCM, SCM port, scm_print_state *) +{ + scm_puts ("#<encapsulated C++ function>", port); + return 1; +} + +static +scm_sizet free_smob (SCM) +{ + return 0; +} + +static +void start_callback_smobs() +{ + callback_tag = scm_make_smob_type_mfpe ("callback", 0, + mark_smob, free_smob, + print_smob, 0); +} + +SCM +smobify_callback (Cpp_function cb ) +{ + SCM z; + + SCM_NEWCELL(z); + SCM_SETCDR (z, (SCM)cb); + SCM_SETCAR (z, (SCM)callback_tag); + + return z; +} + +ADD_SCM_INIT_FUNC(callback, start_callback_smobs); + diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 6cadceb906..0e7ad15a80 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -14,7 +14,6 @@ Tremolo_req::Tremolo_req () { - type_i_ = 0; } @@ -83,8 +82,6 @@ Note_req::do_equal_b (Request const* r) const Note_req::Note_req () { - cautionary_b_ = false; - forceacc_b_ = false; } @@ -117,7 +114,7 @@ Articulation_req::do_equal_b (Request const* r) const { Articulation_req const* a = dynamic_cast<Articulation_req const*> (r); - return a && articulation_str_ == a->articulation_str_; + return a; // && articulation_str_ == a->articulation_str_; } diff --git a/lily/note-head.cc b/lily/note-head.cc index 3bfe6ad551..2d9b47806e 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -101,7 +101,7 @@ Note_head::brew_molecule (SCM smob) out.add_molecule (s); } } - return out.create_scheme(); + return out.smobbed_copy(); } bool diff --git a/lily/parser.yy b/lily/parser.yy index e302696120..76d6d7e169 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -593,7 +593,8 @@ music_output_def_body: junk this ? there already is tempo stuff in music. */ - dynamic_cast<Midi_def*> ($$)->set_tempo ($2->dur_.length_mom (), $2->metronome_i_); + int m = gh_scm2int ( $2->get_mus_property ("metronome-count")); + dynamic_cast<Midi_def*> ($$)->set_tempo ($2->dur_.length_mom (), m); } | music_output_def_body error { @@ -605,7 +606,7 @@ tempo_request: $$ = new Tempo_req; $$->dur_ = *$2; delete $2; - $$-> metronome_i_ = $4; + $$-> set_mus_property ("metronome-count", gh_int2scm ( $4)); } ; @@ -823,7 +824,7 @@ re_rhythmed_music: part_combined_music: PARTCOMBINE STRING Music Music { - Part_combine_music * p = new Part_combine_music (ly_scm2string ($2), $3, $4); + Part_combine_music * p = new Part_combine_music ($2, $3, $4); $$ = p; } ; @@ -946,14 +947,14 @@ shorthand_command_req: | '[' { Span_req*b= new Span_req; b->set_span_dir(START); - b->span_type_str_ = "beam"; + b->set_mus_property ("span-type", ly_str02scm ("beam")); $$ =b; } | ']' { - Span_req*b= new Span_req; - b->set_span_dir( STOP); - b->span_type_str_ = "beam"; - $$ = b; + Span_req*b= new Span_req; + b->set_span_dir( STOP); + b->set_mus_property ("span-type", ly_str02scm ("beam")); + $$ = b; } | BREATHE { $$ = new Breathing_sign_req; @@ -969,7 +970,7 @@ verbose_command_req: | COMMANDSPANREQUEST bare_int STRING { Span_req * sp_p = new Span_req; sp_p-> set_span_dir ( Direction($2)); - sp_p->span_type_str_ = ly_scm2string ($3); + sp_p->set_mus_property ("span-type",$3); sp_p->set_spot (THIS->here_input ()); $$ = sp_p; } @@ -991,13 +992,13 @@ verbose_command_req: | TIME_T bare_unsigned '/' bare_unsigned { Time_signature_change_req *m = new Time_signature_change_req; - m->beats_i_ = $2; - m->one_beat_i_=$4; + m->set_mus_property ("beats", gh_int2scm ( $2)); + m->set_mus_property ("one-beat", gh_int2scm ($4)); $$ = m; } | PENALTY bare_int { Break_req * b = new Break_req; - b->penalty_f_ = $2 / 100.0; + b->set_mus_property ("penalty", gh_double2scm ( $2 / 100.0)); b->set_spot (THIS->here_input ()); $$ = b; } @@ -1011,7 +1012,8 @@ verbose_command_req: $$ = $1; } | CLEF STRING { - $$ = new Clef_change_req (ly_scm2string ($2)); + $$ = new Clef_change_req; + $$->set_mus_property ("clef-type", $2); } | KEY { @@ -1051,7 +1053,7 @@ request_that_take_dir: SCM s = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1)); Articulation_req *a = new Articulation_req; if (gh_string_p (s)) - a->articulation_str_ = ly_scm2string (s); + a->set_mus_property ("articulation-type", s); else THIS->parser_error (_ ("Expecting string as script definition")); $$ = a; } @@ -1091,19 +1093,19 @@ verbose_request: | SPANREQUEST bare_int STRING { Span_req * sp_p = new Span_req; sp_p->set_span_dir( Direction($2)); - sp_p->span_type_str_ = ly_scm2string ($3); + sp_p->set_mus_property ("span-type", $3); sp_p->set_spot (THIS->here_input ()); $$ = sp_p; } | tremolo_type { Tremolo_req* a = new Tremolo_req; a->set_spot (THIS->here_input ()); - a->type_i_ = $1; + a->set_mus_property ("tremolo-type", gh_int2scm ($1)); $$ = a; } | SCRIPT STRING { Articulation_req * a = new Articulation_req; - a->articulation_str_ = ly_scm2string ($2); + a->set_mus_property ("articulation-type", $2); a->set_spot (THIS->here_input ()); $$ = a; } @@ -1213,17 +1215,17 @@ close_request_parens: '(' { Span_req* s= new Span_req; $$ = s; - s->span_type_str_ = "slur"; + s->set_mus_property ("span-type", ly_str02scm( "slur")); } | E_SMALLER { Span_req*s =new Span_req; $$ = s; - s->span_type_str_ = "crescendo"; + s->set_mus_property ("span-type", ly_str02scm ( "crescendo")); } | E_BIGGER { Span_req*s =new Span_req; $$ = s; - s->span_type_str_ = "decrescendo"; + s->set_mus_property ("span-type", ly_str02scm ("decrescendo")); } ; @@ -1231,20 +1233,21 @@ close_request_parens: open_request: open_request_parens { $$ = $1; - dynamic_cast<Span_req*> ($$)->set_span_dir ( STOP); + dynamic_cast<Span_req*> ($$)->set_span_dir (STOP); } ; open_request_parens: E_EXCLAMATION { Span_req *s = new Span_req; - s->span_type_str_ = "crescendo"; + s->set_mus_property ("span-type", ly_str02scm ( "crescendo")); + $$ = s; } | ')' { Span_req* s= new Span_req; $$ = s; - s->span_type_str_ = "slur"; + s->set_mus_property ("span-type", ly_str02scm( "slur")); } ; @@ -1383,8 +1386,10 @@ simple_element: n->pitch_ = *$1; n->duration_ = *$4; - n->cautionary_b_ = $3 % 2; - n->forceacc_b_ = $2 % 2 || n->cautionary_b_; + if ($3 % 2) + n->set_mus_property ("cautionary", SCM_BOOL_T); + if ( $2 % 2 || $3 % 2) + n->set_mus_property ("force-accidental", SCM_BOOL_T); Simultaneous_music*v = new Request_chord (gh_list (n->self_scm (), SCM_UNDEFINED)); @@ -1428,7 +1433,9 @@ simple_element: Span_req *sp2 = new Span_req; sp1-> set_span_dir ( START); sp2-> set_span_dir ( STOP); - sp1->span_type_str_ = sp2->span_type_str_ = "rest"; + SCM r = ly_str02scm ("rest"); + sp1->set_mus_property ("span-type", r); + sp2->set_mus_property ("span-type", r); Request_chord * rqc1 = new Request_chord (gh_list (sp1->self_scm (), SCM_UNDEFINED)); Request_chord * rqc2 = new Request_chord (gh_list (sk->self_scm (), SCM_UNDEFINED));; diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index 498f0fc831..68e41dce09 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -128,7 +128,11 @@ Part_combine_music_iterator::get_state (Moment) { int state = UNKNOWN; Part_combine_music const *p = dynamic_cast<Part_combine_music const* > (music_l_); - Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "one" + suffix_); + + String w = ly_scm2string (p->get_mus_property ("what")); + + + Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (w, "one" + suffix_); SCM s = first_translator->get_property (ly_symbol2scm ("changeMoment")); if (!gh_pair_p (s)) @@ -284,6 +288,8 @@ Part_combine_music_iterator::get_state (Moment) return state; } +static Span_req* abort_req = NULL; + void Part_combine_music_iterator::process (Moment m) { @@ -328,29 +334,25 @@ Part_combine_music_iterator::process (Moment m) /* When combining, abort all running spanners */ + + if (!abort_req) + { + abort_req = new Span_req; + abort_req->set_mus_property ("span-type", ly_str02scm ("abort")); + } + if (combine_b && combine_b != previously_combined_b) { -#if 0 - // Urg: Error in unknown function during GC: rogue pointer in heap - // Who deletes this 'pointer'? - Span_req abort; - abort.span_type_str_ = "abort"; if (second_iter_p_ && second_iter_p_->ok ()) - second_translator->try_music (&abort); -#else - Span_req* abort = new Span_req; - abort->span_type_str_ = "abort"; - if (second_iter_p_ && second_iter_p_->ok ()) - second_iter_p_->try_music (abort); -#endif + second_iter_p_->try_music (abort_req); } - + String w = ly_scm2string (p->get_mus_property ("what")); if (combine_b != previously_combined_b) - change_to (second_iter_p_, p->what_str_, (combine_b ? "one" : "two") + change_to (second_iter_p_, w, (combine_b ? "one" : "two") + suffix_); - Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "one" + suffix_); - Translator_group *second_translator = second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "two" + suffix_); + Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (w, "one" + suffix_); + Translator_group *second_translator = second_iter_p_->report_to_l ()->find_create_translator_l (w, "two" + suffix_); /* hmm diff --git a/lily/part-combine-music.cc b/lily/part-combine-music.cc index 155f2de24c..1375f8d06f 100644 --- a/lily/part-combine-music.cc +++ b/lily/part-combine-music.cc @@ -10,9 +10,10 @@ #include "part-combine-music.hh" #include "musical-pitch.hh" -Part_combine_music::Part_combine_music (String what, Music * f, Music * s) +Part_combine_music::Part_combine_music (SCM what, Music * f, Music * s) { - what_str_ = what; + assert (gh_string_p (what)); + set_mus_property ("what", what); set_mus_property ("one", f->self_scm ()); set_mus_property ("two", s->self_scm ()); diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 667b3fc497..a510a141ff 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -118,7 +118,8 @@ Piano_pedal_engraver::do_try_music (Music *m) { for (Pedal_info*p = info_list_; p->name_; p ++) { - if (s->span_type_str_ == p->name_) + if (scm_equal_p (s->get_mus_property ("span-type"), + ly_str02scm (p->name_))==SCM_BOOL_T) { p->req_l_drul_[s->get_span_dir()] = s; return true; diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index 9bd045aed8..a3c8fb4829 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -132,7 +132,8 @@ Piano_pedal_performer::do_try_music (Music* r) { for (Pedal_info*p = info_alist_; p->name_; p ++) { - if (s->span_type_str_ == String (p->name_)) + if (scm_equal_p (s->get_mus_property ("span-type"), + ly_str02scm (p->name_)) == SCM_BOOL_T) { p->req_l_drul_[s->get_span_dir()] = s; return true; diff --git a/lily/rest.cc b/lily/rest.cc index da9caf8f4a..a6a945cd78 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -64,7 +64,7 @@ Rest::brew_molecule (SCM smob) String idx = ("rests-") + to_str (gh_scm2int (balltype)) + (ledger_b ? "o" : "") + style; - return Font_interface::get_default_font (me)->find_by_name (idx).create_scheme(); + return Font_interface::get_default_font (me)->find_by_name (idx).smobbed_copy(); } diff --git a/lily/score-element.cc b/lily/score-element.cc index fbd44eb4f4..5928d8b874 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -182,8 +182,11 @@ Score_element::molecule_extent (SCM element_smob, SCM scm_axis) Score_element *s = unsmob_element (element_smob); Axis a = (Axis) gh_scm2int (scm_axis); - Molecule m = s->get_molecule (); - return ly_interval2scm ( m.extent(a)); + Molecule *m = s->get_molecule (); + Interval e ; + if (m) + e = m->extent(a); + return ly_interval2scm ( e); } MAKE_SCHEME_CALLBACK(Score_element,preset_extent,2); @@ -248,16 +251,23 @@ Score_element::calculate_dependencies (int final, int busy, SCM funcname) } -Molecule +Molecule * Score_element::get_molecule () const { + SCM mol = get_elt_property ("molecule"); + if (unsmob_molecule (mol)) + return unsmob_molecule (mol); + SCM proc = get_elt_property ("molecule-callback"); - SCM mol = SCM_EOL; + mol = SCM_EOL; if (gh_procedure_p (proc)) mol = gh_apply (proc, gh_list (this->self_scm (), SCM_UNDEFINED)); - + + /* + TODO: add option for not copying origin info. + */ SCM origin =get_elt_property ("origin"); if (!unsmob_input (origin)) origin =ly_symbol2scm ("no-origin"); @@ -268,15 +278,19 @@ Score_element::get_molecule () const mol = gh_cons (gh_list (origin, gh_car (mol), SCM_UNDEFINED), gh_cdr (mol)); } + Molecule *m = unsmob_molecule (mol); - Molecule m (create_molecule (mol)); - + /* transparent retains dimensions of element. */ - if (to_boolean (get_elt_property ("transparent"))) - m = Molecule (m.extent_box (), SCM_EOL); + if (m && to_boolean (get_elt_property ("transparent"))) + mol = Molecule (m->extent_box (), SCM_EOL).smobbed_copy (); + Score_element *me = (Score_element*)this; + me->set_elt_property ("molecule", mol); + + m = unsmob_molecule (mol); return m; } diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 187f1b689a..67801e884c 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -236,8 +236,11 @@ Score_engraver::do_try_music (Music*r) ? gh_scm2double(pen) : 0.0; - total_penalty += b->penalty_f_; - if (b->penalty_f_ > 10000.0) // ugh. arbitrary. + SCM rpen = b->get_mus_property ("penalty"); + if (gh_number_p (rpen)) + total_penalty += gh_scm2double (rpen); + + if (total_penalty > 10000.0) // ugh. arbitrary. forbid_breaks (); command_column_l_->set_elt_property ("penalty", diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 8474f75722..7490bb68f9 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -58,12 +58,13 @@ Script_engraver::do_process_music() Articulation_req* l=script_req_l_arr_[i]; SCM alist = get_property ("scriptDefinitions"); - SCM list = scm_assoc (ly_str02scm (l->articulation_str_.ch_C ()), alist); + SCM list = scm_assoc (l->get_mus_property ("articulation-type"), alist); if (list == SCM_BOOL_F) { - l->origin ()->warning (_f ("Don't know how to interpret articulation `%s'", - l->articulation_str_.ch_C ())); + String a = ly_scm2string (l->get_mus_property ("articulation-type")); + l->origin ()->warning (_f ("Don't know how to interpret articulation `%s'", a.ch_C())); + continue; } // todo -> use result of articulation-to-scriptdef directly as basic prop list. diff --git a/lily/script.cc b/lily/script.cc index 9670115c55..432515c89a 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -56,12 +56,14 @@ SCM Script::brew_molecule (SCM smob) { Score_element *me= unsmob_element (smob); -// Direction dir = DOWN; -// SCM d = me->get_elt_property ("direction"); -// if (isdir_b (d)) -// dir = to_dir (d); +#if 0 + Direction dir = DOWN; + SCM d = me->get_elt_property ("direction"); + if (isdir_b (d)) + dir = to_dir (d); +#endif Direction dir = Side_position::get_direction(me); - return get_molecule (me, dir).create_scheme(); + return get_molecule (me, dir).smobbed_copy(); } bool diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index d59cbbe233..d159020b82 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -46,7 +46,8 @@ Slur_engraver::do_try_music (Music *req_l) { if (Span_req *sl = dynamic_cast <Span_req *> (req_l)) { - if (sl->span_type_str_ == "abort") + String t = ly_scm2string (sl->get_mus_property ("span-type")); + if (t == "abort") { for (int i = 0; i < slur_l_stack_.size (); i++) { @@ -61,7 +62,7 @@ Slur_engraver::do_try_music (Music *req_l) requests_arr_.clear (); new_slur_req_l_arr_.clear (); } - else if (sl->span_type_str_ == "slur") + else if (t == "slur") { /* Let's not start more than one slur per moment. diff --git a/lily/slur.cc b/lily/slur.cc index b7b0c68769..887df0ea65 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -526,7 +526,7 @@ Slur::brew_molecule (SCM smob) else a = Lookup::slur (one, Directional_element_interface::get (me) * thick, thick); - return a.create_scheme(); + return a.smobbed_copy(); } void diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc index ccf0d08234..1775f2681a 100644 --- a/lily/span-dynamic-performer.cc +++ b/lily/span-dynamic-performer.cc @@ -98,8 +98,8 @@ Span_dynamic_performer::do_process_music () if (span_req_l_drul_[START]) { - dir_ = span_req_l_drul_[START]->span_type_str_ == "crescendo" - ? RIGHT : LEFT; + String t = ly_scm2string (span_req_l_drul_[START]->get_mus_property ("span-type")); + dir_ = (t == "crescendo") ? RIGHT : LEFT; span_start_req_l_ = span_req_l_drul_[START]; dynamic_tuple_arr_.clear (); @@ -180,8 +180,8 @@ Span_dynamic_performer::do_try_music (Music* r) { if (Span_req * s = dynamic_cast<Span_req*>(r)) { - if (s-> span_type_str_ == "crescendo" - || s->span_type_str_ == "decrescendo") + String t = ly_scm2string (s->get_mus_property ("span-type")); + if (t == "crescendo" || t == "decrescendo") { span_req_l_drul_[s->get_span_dir()] = s; return true; diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index e7754b799b..f8ebefe16f 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -48,7 +48,7 @@ Staff_symbol::brew_molecule (SCM smob) m.add_molecule (a); } - return m.create_scheme(); + return m.smobbed_copy (); } int diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index f348697f55..caebede28b 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -80,7 +80,8 @@ Stem_engraver::acknowledge_element(Score_element_info i) the first and last (quarter) note bothe get one tremolo flag. */ - int requested_type = tremolo_req_l_->type_i_; + int requested_type = gh_scm2int (tremolo_req_l_->get_mus_property ("tremolo-type")); + SCM f = get_property ("tremoloFlags"); if (!requested_type && gh_number_p (f)) requested_type = gh_scm2int (f); diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 0f3e014375..45fe3dba7d 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -138,7 +138,7 @@ Stem_tremolo::brew_molecule (SCM smob) whole_note_correction, dy)); } - return mol.create_scheme(); + return mol.smobbed_copy (); } diff --git a/lily/stem.cc b/lily/stem.cc index eaf2cb5a6f..94ddf6ca93 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -478,7 +478,7 @@ Stem::brew_molecule (SCM smob) mol.add_molecule (fl); } - return mol.create_scheme(); + return mol.smobbed_copy (); } MAKE_SCHEME_CALLBACK(Stem,off_callback,2); diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index 29df9ec87b..39e6499a17 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -43,7 +43,7 @@ Sustain_pedal::brew_molecule (SCM smob) Molecule mol; SCM glyph = e->get_elt_property ("text"); if (!gh_string_p (glyph)) - return mol.create_scheme(); + return mol.smobbed_copy (); String text = ly_scm2string (glyph); for (int i = 0; i < text.length_i (); i++) @@ -61,6 +61,6 @@ Sustain_pedal::brew_molecule (SCM smob) mol.add_at_edge (X_AXIS, RIGHT, m, 0); } - return mol.create_scheme (); + return mol.smobbed_copy (); } diff --git a/lily/symbol-cache.cc b/lily/symbol-cache.cc index ed801f2fef..dc0d329d24 100644 --- a/lily/symbol-cache.cc +++ b/lily/symbol-cache.cc @@ -60,15 +60,15 @@ symbol (const char*s) global with binsearch. - real 0m19.352s user 0m18.710s sys 0m0.230s + local binsearch user 18.8 - local with binsearch, and other optimizations. + local with binsearch, and other optimizations. 17.7 */ diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 544492852a..fa961c081a 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -111,7 +111,7 @@ System_start_delimiter::brew_molecule (SCM smob) m.translate_axis (ext.center (), Y_AXIS); - return m.create_scheme (); + return m.smobbed_copy (); } Molecule diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc index e4066580ca..1f38e3a809 100644 --- a/lily/tempo-performer.cc +++ b/lily/tempo-performer.cc @@ -28,9 +28,12 @@ Tempo_performer::do_process_music () { if (tempo_req_l_) { + + SCM met = tempo_req_l_->get_mus_property ("metronome-count"); audio_p_ = new Audio_tempo (tempo_req_l_->dur_.length_mom () / Moment (1, 4) - * Moment(tempo_req_l_->metronome_i_)); + * Moment(gh_scm2int (met))); + Audio_element_info info (audio_p_, tempo_req_l_); announce_element (info); tempo_req_l_ = 0; diff --git a/lily/text-item.cc b/lily/text-item.cc index b7cabd16a9..6e159dd3f0 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -67,21 +67,6 @@ Text_item::text2molecule (Score_element *me, SCM text, SCM alist_chain) } return Molecule (); } - -SCM -ly_assoc_chain (SCM key, SCM achain) -{ - if (gh_pair_p (achain)) - { - SCM handle = scm_assoc (key, gh_car (achain)); - if (gh_pair_p (handle)) - return handle; - else - return ly_assoc_chain (key, gh_cdr (achain)); - } - else - return SCM_BOOL_F; -} Molecule Text_item::string2molecule (Score_element *me, SCM text, SCM alist_chain) @@ -210,6 +195,6 @@ Text_item::brew_molecule (SCM smob) mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space) * Staff_symbol_referencer::staff_space (me)); } - return mol.create_scheme (); + return mol.smobbed_copy (); } diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index fe89e752bc..2b04b01a7d 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -65,7 +65,8 @@ Text_spanner_engraver::do_try_music (Music *m) { if (Span_req *s = dynamic_cast <Span_req*> (m)) { - if (s->span_type_str_ == "abort") + String t = ly_scm2string (s->get_mus_property ("span-type")); + if (t == "abort") { req_drul_[LEFT] = 0; req_drul_[RIGHT] = 0; @@ -73,7 +74,7 @@ Text_spanner_engraver::do_try_music (Music *m) span_->suicide (); span_ = 0; } - else if (s->span_type_str_ == "text") + else if (t == "text") { req_drul_[s->get_span_dir()] = s; return true; diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index dafd1b975e..313c0db21b 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -189,7 +189,7 @@ Text_spanner::brew_molecule (SCM smob) m.add_at_edge (X_AXIS, RIGHT, edge[RIGHT], 0); m.translate_axis (broken_left, X_AXIS); - return m.create_scheme (); + return m.smobbed_copy (); } diff --git a/lily/tie.cc b/lily/tie.cc index 80363adcec..403b991a32 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -327,7 +327,7 @@ Tie::brew_molecule (SCM smob) Molecule a = Lookup::slur (b, Directional_element_interface::get (me) * thick, thick); - return a.create_scheme (); + return a.smobbed_copy (); } diff --git a/lily/time-signature-performer.cc b/lily/time-signature-performer.cc index 709087e42b..4c2076fd00 100644 --- a/lily/time-signature-performer.cc +++ b/lily/time-signature-performer.cc @@ -28,7 +28,10 @@ Time_signature_performer::do_process_music () { if (time_signature_req_l_) { - audio_p_ = new Audio_time_signature (time_signature_req_l_->beats_i_, time_signature_req_l_->one_beat_i_); + int b = gh_scm2int (time_signature_req_l_->get_mus_property ("beats")); + int o = gh_scm2int (time_signature_req_l_->get_mus_property ("one-beat")); + + audio_p_ = new Audio_time_signature (b,o); Audio_element_info info (audio_p_, time_signature_req_l_); announce_element (info); time_signature_req_l_ = 0; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index e6afe98bd2..04725d8adc 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -15,7 +15,9 @@ #include "font-interface.hh" MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1); - +/* + TODO: make different functions for special and normal timesigs. + */ SCM Time_signature::brew_molecule (SCM smob) { @@ -36,15 +38,15 @@ Time_signature::brew_molecule (SCM smob) String style (ly_scm2string (st)); if (style[0]=='1') { - return time_signature (me, n, 0).create_scheme(); + return time_signature (me, n, 0).smobbed_copy (); } else { - return special_time_signature (me, style, n, d).create_scheme(); + return special_time_signature (me, style, n, d).smobbed_copy (); } } else - return time_signature (me, n,d).create_scheme(); + return time_signature (me, n,d).smobbed_copy (); } Molecule diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index b69a614ea0..35455683e7 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -45,8 +45,13 @@ Timing_translator::do_try_music (Music*r) */ if (Time_signature_change_req *c = dynamic_cast <Time_signature_change_req *> (t)) - set_time_signature (c->beats_i_, c->one_beat_i_); - + { + int b = gh_scm2int (c->get_mus_property ("beats")); + int o = gh_scm2int (c->get_mus_property ("one-beat")); + + set_time_signature (b, o); + + } timing_req_l_arr_.push(t); return true; } diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 312bb37b96..af67ac641c 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -108,7 +108,7 @@ Tuplet_spanner::brew_molecule (SCM smob) mol.add_molecule (Molecule (b, at)); } } - return mol.create_scheme(); + return mol.smobbed_copy (); } diff --git a/lily/voice-devnull-engraver.cc b/lily/voice-devnull-engraver.cc index 93e17d18db..f334a4c07d 100644 --- a/lily/voice-devnull-engraver.cc +++ b/lily/voice-devnull-engraver.cc @@ -42,7 +42,8 @@ Voice_devnull_engraver::do_try_music (Music *m) { if (Span_req *s = dynamic_cast <Span_req *> (m)) { - if (s->span_type_str_ == *p) + if (scm_equal_p (s->get_mus_property ("span-type"), + ly_str02scm ( *p)) == SCM_BOOL_T) { return true; } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 0de67ae6d6..981d1e7629 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -92,7 +92,7 @@ Volta_spanner::brew_molecule (SCM smob) mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length () - 1.0); mol.translate_axis (left, X_AXIS); - return mol.create_scheme(); + return mol.smobbed_copy (); } diff --git a/make/generic-vars.make b/make/generic-vars.make index 95d6e82f74..3ad2d595d8 100644 --- a/make/generic-vars.make +++ b/make/generic-vars.make @@ -8,16 +8,21 @@ # you do make dist # -buildscripts = $(depth)/buildscripts +# using src-depth iso depth is only necessary for broken rules that do +# cd $(outdir) && foo $(depth) ... +buildscript-dir = $(src-depth)/buildscripts +script-dir = $(src-depth)/scripts +input-dir = $(src-depth)/input -flower-dir = $(depth)/flower -lib-dir = $(depth)/lib -lily-dir = $(depth)/lily -mi2mu-dir = $(depth)/mi2mu -make-dir = $(depth)/make -include-lib = $(depth)/lib/include -include-flower = $(depth)/flower/include + +flower-dir = $(src-depth)/flower +lib-dir = $(src-depth)/lib +lily-dir = $(src-depth)/lily +mi2mu-dir = $(src-depth)/mi2mu +make-dir = $(src-depth)/make +include-lib = $(src-depth)/lib/include +include-flower = $(src-depth)/flower/include diff --git a/make/mudela-rules.make b/make/mudela-rules.make index 9e0e47e6ce..28fd1893a7 100644 --- a/make/mudela-rules.make +++ b/make/mudela-rules.make @@ -5,17 +5,19 @@ SUBST_TEXI_DEPS=sed 's! \.\./! !g' < $(basename $@).dep > $(outdir)/temp.dep ; mv $(outdir)/temp.dep $(basename $@).dep $(outdir)/%.latex: %.doc - cd $(outdir);LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(depth)/../scripts/mudela-book.py -I .. -I $(depth)/../input/test/ --dependencies --dep-prefix=$(outdir)/ ../$< + LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/mudela-book.py --outdir=$(outdir) -I .. -I $(input-dir)/test/ --dependencies --dep-prefix=$(outdir)/ $< $(SUBST_TEXI_DEPS) +# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir. +# it is not, for --scrdir builds $(outdir)/%.texi: %.tely - cd $(outdir); LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(depth)/../scripts/mudela-book.py -I .. -I $(depth)/../input/test/ --dependencies --dep-prefix=$(outdir)/ --format=texi ../$< + LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/mudela-book.py --outdir=$(outdir) -I .. -I $(input-dir)/test/ --dependencies --dep-prefix=$(outdir)/ --format=texi $< $(SUBST_TEXI_DEPS) # nexi: no-lily texi # for plain info doco: don't run lily $(outdir)/%.nexi: %.tely - cd $(outdir); LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(depth)/../scripts/mudela-book.py --no-lily -I .. -I $(depth)/../input/test/ --dependencies --dep-prefix=$(outdir)/ --format=texi ../$< + LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/mudela-book.py --outdir=$(outdir) --no-lily -I .. -I $(input-dir)/test/ --dependencies --dep-prefix=$(outdir)/ --format=texi $< mv $(@D)/$(*F).texi $@ $(SUBST_TEXI_DEPS) diff --git a/make/mutopia-rules.make b/make/mutopia-rules.make index b741023eaf..509de0118a 100644 --- a/make/mutopia-rules.make +++ b/make/mutopia-rules.make @@ -1,12 +1,12 @@ $(outdir)/%.gif: $(outdir)/%.ps - sh $(buildscripts)/ps-to-gifs.sh $< + sh $(buildscript-dir)/ps-to-gifs.sh $< -mv $(name-stem)-page*.gif $(outdir)/ touch $@ $(outdir)/%.png: $(outdir)/%.ps - sh $(buildscripts)/ps-to-pngs.sh $< + sh $(buildscript-dir)/ps-to-pngs.sh $< -mv $(name-stem)-page*.png $(outdir)/ touch $@ @@ -21,10 +21,10 @@ $(outdir)/%.ly.txt: %.abc ln -f $< $@ $(outdir)/%.ly: %.abc - $(PYTHON) $(depth)/scripts/abc2ly.py -o $@ $< + $(PYTHON) $(script-dir)/abc2ly.py -o $@ $< $(outdir)/%.dvi: $(outdir)/%.ly - $(PYTHON) $(depth)/scripts/ly2dvi.py -o $(outdir) $< + $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $< -mv $(basename $(<F))*.midi $(outdir) # don't junk intermediate .dvi files. They're easier to view than @@ -32,9 +32,9 @@ $(outdir)/%.dvi: $(outdir)/%.ly .PRECIOUS: $(outdir)/%.dvi $(outdir)/%.dvi: %.ly - $(PYTHON) $(depth)/scripts/ly2dvi.py -o $(outdir) $< + $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $< -mv $(basename $<)*.midi $(outdir) $(outdir)/%.dvi: %.fly - $(PYTHON) $(depth)/scripts/ly2dvi.py -o $(outdir) $< + $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $< -mv $(basename $<)*.midi $(outdir) diff --git a/make/mutopia-targets.make b/make/mutopia-targets.make index 15a0e4cf73..a55109ab36 100644 --- a/make/mutopia-targets.make +++ b/make/mutopia-targets.make @@ -3,7 +3,7 @@ all: $(OUT_FILES) local-WWW: $(ly_examples) $(fly_examples) $(ps_examples) $(png_examples) -# (cd $(outdir); $(PYTHON) ../$(buildscripts)/mutopia-index.py --prefix=../ --suffix=/$(outdir) $(html_subdirs) $(all_examples)) +# (cd $(outdir); $(PYTHON) ../$(buildscript-dir)/mutopia-index.py --prefix=../ --suffix=/$(outdir) $(html_subdirs) $(all_examples)) # $(footify) $(outdir)/index.html local-web: @@ -13,4 +13,4 @@ convert-mudela: local-convert-mudela $(LOOP) local-convert-mudela: - $(PYTHON) $(depth)/scripts/convert-mudela.py -e *ly + $(PYTHON) $(script-dir)/convert-mudela.py -e *ly diff --git a/make/toplevel.make.in b/make/toplevel.make.in index b433213ffe..db72f683ce 100644 --- a/make/toplevel.make.in +++ b/make/toplevel.make.in @@ -61,8 +61,8 @@ examples: # use recursive make like we do everywhere else; leads to bugs that you # make a specific fix for. - $(PYTHON) $(buildscripts)/mutopia-index.py -o short-examples.html input/ - $(PYTHON) $(buildscripts)/mutopia-index.py -o long-examples.html mutopia/ + $(PYTHON) $(buildscript-dir)/mutopia-index.py -o short-examples.html input/ + $(PYTHON) $(buildscript-dir)/mutopia-index.py -o long-examples.html mutopia/ #$(footify-all-command) $(footify) --index=./ `$(FIND) . -name '*.html' -print` tar --exclude='*.dvi' --exclude='*.tex' --exclude='*.ps' --exclude='*.ppm' -czf $(outdir)/examples.tar.gz *-examples.html `find input mutopia -type d -name 'out-www' -print` @@ -78,5 +78,5 @@ ifeq ($(KPATHSEA),0) endif local-WWW-clean: - $(SHELL) $(depth)/buildscripts/clean-fonts.sh + $(SHELL) $(buildscript-dir)/clean-fonts.sh diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 220f84ef34..02c950bc3e 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -18,7 +18,7 @@ XPM_FONTS = feta20 feta-nummer10 feta-braces20 #CM_AFM_FILES = cmr10 $(outdir)/cmr10.afm: - -$(BASH) $(buildscripts)/tfmtoafm.sh `kpsewhich cmr10.tfm` + -$(GUILE) $(buildscript-dir)/tfm2oafm.scm `kpsewhich cmr10.tfm` -mv $(@F) $@ LOG_FILES = $(addprefix $(outdir)/, $(FET_FILES:.mf=.log)) @@ -56,7 +56,7 @@ export MFINPUTS:=.:$(MFINPUTS) default: $(ALL_GEN_FILES) $(outdir)/%.afm $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log - $(PYTHON) $(buildscripts)/mf-to-table.py --package=$(topdir) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --afm $(outdir)/$(<F:.log=.afm) --tex $(outdir)/$(<F:.log=.tex) $< + $(PYTHON) $(buildscript-dir)/mf-to-table.py --package=$(topdir) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --afm $(outdir)/$(<F:.log=.afm) --tex $(outdir)/$(<F:.log=.tex) $< localclean: rm -f mfplain.mem mfplain.log mpout.log diff --git a/scm/backend-documentation-lib.scm b/scm/backend-documentation-lib.scm index a7d785a00d..529bac67e4 100644 --- a/scm/backend-documentation-lib.scm +++ b/scm/backend-documentation-lib.scm @@ -25,8 +25,9 @@ "not set" ) "}")))) +;; First level Interface description ;; Second level, part of element description -(define (document-interface interface element-description) +(define (document-interface level interface element-description) (let* ((name (car interface)) (desc (cadr interface)) (props (caddr interface)) @@ -35,10 +36,17 @@ props))) (string-append - (section 2 (string-append "Interface: " (symbol->string name))) + (section level (string-append (interface-name (symbol->string name)))) desc (description-list docs)))) +;; First level Interface description +(define (document-separate-interface interface) + (let ((name (car interface))) + (string-append + (node (interface-name name)) + (document-interface 2 interface '())))) + ;; First level element description (define (document-element iname description) (display (string-append "\nProcessing " iname " ... ") (current-error-port)) @@ -51,8 +59,8 @@ (name (cdr (assoc 'name meta))) (ifaces (cdr (assoc 'interface-descriptions meta))) - (ifacedoc (map (lambda (x) (document-interface x description)) - (reverse ifaces)))) + (ifacedoc (map (lambda (x) (document-interface 3 x description)) + (reverse ifaces)))) (string-append (node (element-name name)) @@ -86,3 +94,23 @@ (texi-node-menu name (map (lambda (x) (cons (element-name x) "")) names)) doc))) + +;; testin.. -- how to do this +(eval-string (ly-gulp-file "interface.scm")) +(define interface-description-alist + `( + (general-element . ,general-element-interface) + (beam . ,beam-interface) + (clef . ,clef-interface) + (slur . ,slur-interface) + )) + +(define (document-all-interfaces name) + (string-append + (texi-node-menu name (map (lambda (x) (cons (interface-name x) "")) + (map cadr interface-description-alist))) + (apply string-append + (map document-separate-interface + (map cdr interface-description-alist))))) + + diff --git a/scm/documentation-lib.scm b/scm/documentation-lib.scm index 5bc4476531..b4782af375 100644 --- a/scm/documentation-lib.scm +++ b/scm/documentation-lib.scm @@ -69,10 +69,12 @@ items-alist)) "\n@end menu\n" ;; Menus don't appear in html, so we make a list ourselves + "\n@ignore\n" "\n@ifhtml\n" (description-list (map (lambda (x) (cons (reffy (car x)) (cdr x))) items-alist)) - "\n@end ifhtml\n")) + "\n@end ifhtml\n" + "\n@end ignore\n")) (define (texi-node-menu name items-alist) @@ -83,13 +85,15 @@ (define (texi-file-head name file-name top items-alist) (string-append - "\input texinfo @c -*-texinfo-*-\n" - "@settitle " name + "\\input texinfo @c -*-texinfo-*-" "\n@setfilename " file-name ".info" + "\n@settitle " name (node "Top") top "\n@top" (section 1 name) - (texi-menu items-alist))) + (texi-menu items-alist) + "\n@contents" + )) (define (context-name name) (string-append "Context " name)) @@ -100,6 +104,9 @@ (define (element-name name) (string-append "Element " name)) +(define (interface-name name) + name) + (define (reffy x) (string-append "@ref{" x "}")) diff --git a/scm/engraver-documentation-lib.scm b/scm/engraver-documentation-lib.scm index bdf12cad61..7c8442f3a6 100644 --- a/scm/engraver-documentation-lib.scm +++ b/scm/engraver-documentation-lib.scm @@ -112,9 +112,11 @@ name " can contain \n" (human-listify (map reffy (map context-name accepts))))) - "\n\nThis context is built from the following engravers\n" - (apply string-append - (map document-engraver-by-name consists))))) + "\n\nThis context is built from the following engravers: " + (if no-copies + (human-listify (map reffy (map engraver-name consists))) + (apply string-append + (map document-engraver-by-name consists)))))) ;; First level Context description diff --git a/scm/font.scm b/scm/font.scm index 3d90f422dc..e436fb4866 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -50,6 +50,9 @@ font-descr-alist) ) +;; should really have name/pt size at the front of the list. +;; +;; (also tried to vary the order of this list, with little effect) (define paper20-style-sheet-alist '( ((3 medium upright number feta-nummer 13) . "feta-nummer13") @@ -185,7 +188,10 @@ (Large . ((font-series . bold) (font-family . roman) (font-relative-size . 2))) (dynamic . ((font-series . bold) (font-family . dynamic) (font-relative-size . 0))) )) - (properties-to-font . ,properties-to-font-name) + (properties-to-font . + + ,Font_interface::properties_to_font_name) + ; ,properties-to-font-name) ;; FIXME: this is a not-so-cool idea to use ALIGN ;; RAISE, LOOKUP, since they are not proper elt-properties, diff --git a/scm/generate-documentation.scm b/scm/generate-documentation.scm index d53207faba..09a8a72ee6 100644 --- a/scm/generate-documentation.scm +++ b/scm/generate-documentation.scm @@ -20,14 +20,25 @@ (eval-string (ly-gulp-file "engraver-documentation-lib.scm")) (eval-string (ly-gulp-file "backend-documentation-lib.scm")) + + +;;(define no-copies #t) ; from 490 to 410K, but doesn't look nice yet +;; +;; Also, copies of interfaces use up lots more space, but that's +;; functional because the default property values of the interfaces +;; are described... +(define no-copies #f) + (let* ((doc (string-append - (document-paper "LilyPond interpretation contexts") - (document-all-engravers "LilyPond engravers") - (document-all-elements "LilyPond backend"))) + (document-paper "LilyPond interpretation contexts") + (document-all-engravers "LilyPond engravers") + (document-all-elements "LilyPond backend") + (document-all-interfaces "LilyPond interfaces")) + ) (name "lilypond-internals") (outname (string-append name ".texi")) (out (open-output-file outname))) - + (writing-wip outname) (display (string-append @@ -37,10 +48,11 @@ "LilyPond internals" name "(lilypond.info)" '(("LilyPond interpretation contexts" . "Hierarchy and grouping of Engravers") ("LilyPond engravers" . "Engravers create Elements") - ("LilyPond backend" . "Detailed description of all Elements"))) - + ("LilyPond backend" . "Detailed description of all Elements") + ("LilyPond interfaces" . "Element Interfaces"))) + doc "\n@bye") - out)) + out)) (newline (current-error-port)) diff --git a/scm/translator-description.scm b/scm/translator-description.scm index 6f8beaa2b1..61badb5ef9 100644 --- a/scm/translator-description.scm +++ b/scm/translator-description.scm @@ -459,6 +459,15 @@ If omitted, then dots appear on top of the notes. (translator-property-description 'keySignature list? "") ))) + (cons 'Lyric_engraver + (engraver-description + "Lyric_engraver" + "" + '() + (list + ;; FIXME + ))) + (cons 'Lyric_phrasing_engraver (engraver-description "Lyric_phrasing_engraver" @@ -677,6 +686,15 @@ Description of scripts to use. (fixme) (translator-property-description 'currentCommandColumn ly-element? "") ))) + (cons 'Skip_req_swallow_translator + (engraver-description + "Skip_req_swallow_translator" + "" + '() + (list + ;; FIXME + ))) + (cons 'Slur_engraver (engraver-description diff --git a/stepmake/stepmake/generic-vars.make b/stepmake/stepmake/generic-vars.make index f165a99e93..e8e6cc6162 100644 --- a/stepmake/stepmake/generic-vars.make +++ b/stepmake/stepmake/generic-vars.make @@ -10,39 +10,42 @@ # directory names: # depth from group-dir -# not eh, normally used +# internal, not normally used DEPTH = $(depth)/$(package-depth) -# topdir := $(shell cd $(depth); pwd) ifeq ($(topdir),) topdir := $(shell cd $(depth); pwd) endif pwd := $(shell pwd) +# $(depth) is deprecated, for most cases you'll want $(src-depth) +# +# Well, on second thought. +# It can do no harm, but using src-depth iso depth is only necessary +# for broken rules that do +# cd $(outdir) && foo $(depth) ... +src-depth = $(depth)/$(srcdir) + # derived names ifeq ($(distdir),) -# distdir = $(depth)/$(outdir)/$(DIST_NAME) -# must be absolute for 'make dist' with installed stepmake distdir = $(topdir)/$(outdir)/$(DIST_NAME) DIST_NAME = $(package)-$(TOPLEVEL_VERSION) endif distname = $(package)-$(TOPLEVEL_VERSION) # obsolete? -makeout = $(depth)/make/$(outdir) -docout = $(depth)/Documentation/$(outdir) -binout = $(depth)/bin/$(outdir) +#makeout = $(depth)/make/$(outdir) +#docout = $(depth)/Documentation/$(outdir) +#binout = $(depth)/bin/$(outdir) -doc-dir = $(depth)/Documentation -po-dir = $(depth)/po +doc-dir = $(src-depth)/Documentation +po-dir = $(src-depth)/po # sort-out which of these are still needed # $(package)_bindir = $(depth)/bin step-bindir = $(stepmake)/bin -# deprecated -# abs-step-bindir = $(topdir)/$(stepmake)/bin -# + group-dir = $(shell cd $(DEPTH)/..; pwd) release-dir = $(group-dir)/releases patch-dir = $(group-dir)/patches @@ -136,7 +139,8 @@ endif DO_STRIP=true LOOP=$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) -C $(i) $@ &&) true -ETAGS_FLAGS=-CT +# different redhat releases need different flags for etags. Just use defaults. +ETAGS_FLAGS= # -CT CTAGS_FLAGS=-h include $(stepdir)/files.make diff --git a/stepmake/stepmake/texinfo-rules.make b/stepmake/stepmake/texinfo-rules.make index 796be65295..b4a7e41117 100644 --- a/stepmake/stepmake/texinfo-rules.make +++ b/stepmake/stepmake/texinfo-rules.make @@ -6,7 +6,7 @@ $(outdir)/%.info: $(outdir)/%.texi -$(MAKEINFO) --force --output=$@ $< $(outdir)/%.html: $(outdir)/%.texi - -$(MAKEINFO) --force --output=$@ --html --no-headers $< + -$(MAKEINFO) --force --output=$@ --html $< # we want footers even if website builds (or is built) partly $(footify) $@ -- 2.39.5