summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog20
-rw-r--r--lily/accidental-engraver.cc2
-rw-r--r--lily/auto-beam-engraver.cc2
-rw-r--r--lily/auto-change-iterator.cc1
-rw-r--r--lily/bar-check-iterator.cc3
-rw-r--r--lily/beam-engraver.cc1
-rw-r--r--lily/beam-performer.cc1
-rw-r--r--lily/chord-name-engraver.cc1
-rw-r--r--lily/cluster-engraver.cc1
-rw-r--r--lily/coherent-ligature-engraver.cc1
-rw-r--r--lily/completion-note-heads-engraver.cc6
-rw-r--r--lily/context.cc15
-rw-r--r--lily/custos-engraver.cc2
-rw-r--r--lily/drum-note-engraver.cc1
-rw-r--r--lily/drum-note-performer.cc2
-rw-r--r--lily/dynamic-performer.cc2
-rw-r--r--lily/event-chord-iterator.cc11
-rw-r--r--lily/event.cc37
-rw-r--r--lily/fingering-engraver.cc2
-rw-r--r--lily/forbid-break-engraver.cc4
-rw-r--r--lily/global-context.cc2
-rw-r--r--lily/grace-music.cc2
-rw-r--r--lily/gregorian-ligature-engraver.cc1
-rw-r--r--lily/grid-point-engraver.cc1
-rw-r--r--lily/grob-pitch-tuple.cc2
-rw-r--r--lily/grob.cc9
-rw-r--r--lily/include/engraver.hh2
-rw-r--r--lily/include/event-chord-iterator.hh1
-rw-r--r--lily/include/event.hh27
-rw-r--r--lily/include/ligature-engraver.hh2
-rw-r--r--lily/include/main.hh1
-rw-r--r--lily/include/minterval.hh10
-rw-r--r--lily/include/music.hh7
-rw-r--r--lily/include/performer.hh1
-rw-r--r--lily/include/program-option.hh1
-rw-r--r--lily/key-engraver.cc1
-rw-r--r--lily/key-performer.cc15
-rw-r--r--lily/lyric-combine-music-iterator.cc2
-rw-r--r--lily/lyric-combine-music.cc1
-rw-r--r--lily/lyric-performer.cc1
-rw-r--r--lily/mensural-ligature-engraver.cc2
-rw-r--r--lily/music-constructor.cc46
-rw-r--r--lily/music-scheme.cc10
-rw-r--r--lily/music.cc23
-rw-r--r--lily/new-lyric-combine-music-iterator.cc3
-rw-r--r--lily/note-head.cc2
-rw-r--r--lily/note-heads-engraver.cc4
-rw-r--r--lily/note-performer.cc1
-rw-r--r--lily/parser.yy10
-rw-r--r--lily/part-combine-iterator.cc2
-rw-r--r--lily/piano-pedal-performer.cc1
-rw-r--r--lily/program-option.cc5
-rw-r--r--lily/quote-iterator.cc3
-rw-r--r--lily/rest-engraver.cc6
-rw-r--r--lily/slur-performer.cc1
-rw-r--r--lily/span-dynamic-performer.cc1
-rw-r--r--lily/stem-engraver.cc1
-rw-r--r--lily/swallow-perf.cc2
-rw-r--r--lily/tab-note-heads-engraver.cc4
-rw-r--r--lily/tempo-performer.cc6
-rw-r--r--lily/tie-performer.cc5
-rw-r--r--lily/type-swallow-translator.cc2
-rw-r--r--scm/define-music-properties.scm1
-rw-r--r--scm/define-music-types.scm2
-rw-r--r--scm/lily.scm3
-rw-r--r--scm/output-socket.scm11
-rw-r--r--scm/safe-lily.scm2
67 files changed, 186 insertions, 177 deletions
diff --git a/ChangeLog b/ChangeLog
index b5354cf886..7b5a298b8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2005-07-13 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/include/event.hh: remove file.
+
+ * lily/include/music-constructor.hh: remove file.
+
+ * lily/parser.yy (Lily_lexer): check EVENT_IDENTIFIER using 'event
+ in 'types property.
+
+ * lily/music.cc (duration_length_callback): new function.
+
+ * lily/event.cc: remove file.
+
+ * lily/music-constructor.cc: remove file.
+
+ * lily/music-scheme.cc (LY_DEFINE): rename to ly:make-music
+
+ * lily/context.cc (get_grob_key): nop if use_object_keys not set.
+ (get_context_key): idem.
+
+ * scm/lily.scm (lambda): new option object-keys (default to #f)
+
* scm/output-svg.scm (utf-8-string): rename from utf8-string.
* scm/output-gnome.scm: remove beam routine.
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc
index 93744e5a7b..9dc3010382 100644
--- a/lily/accidental-engraver.cc
+++ b/lily/accidental-engraver.cc
@@ -16,6 +16,8 @@
#include "side-position-interface.hh"
#include "tie.hh"
#include "warn.hh"
+#include "music.hh"
+#include "pitch.hh"
class Accidental_entry
{
diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc
index 46f0bf36bb..636caeae8a 100644
--- a/lily/auto-beam-engraver.cc
+++ b/lily/auto-beam-engraver.cc
@@ -16,6 +16,8 @@
#include "item.hh"
#include "spanner.hh"
#include "context.hh"
+#include "duration.hh"
+
class Auto_beam_engraver : public Engraver
{
diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc
index 1d07d6a7de..e88692123a 100644
--- a/lily/auto-change-iterator.cc
+++ b/lily/auto-change-iterator.cc
@@ -7,7 +7,6 @@
*/
#include "context.hh"
-#include "event.hh"
#include "music-wrapper-iterator.hh"
#include "direction.hh"
diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc
index 46479892ef..bc617a3d11 100644
--- a/lily/bar-check-iterator.cc
+++ b/lily/bar-check-iterator.cc
@@ -7,8 +7,9 @@
*/
#include "simple-music-iterator.hh"
-#include "event.hh"
+#include "music.hh"
#include "context.hh"
+#include "input.hh"
/*
Check bar checks. We do this outside the engravers so that you can
diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc
index 917d2db3c1..8a9bb34b2d 100644
--- a/lily/beam-engraver.cc
+++ b/lily/beam-engraver.cc
@@ -17,6 +17,7 @@
#include "item.hh"
#include "spanner.hh"
#include "context.hh"
+#include "duration.hh"
class Beam_engraver : public Engraver
{
diff --git a/lily/beam-performer.cc b/lily/beam-performer.cc
index 0b88e90086..679bb6b352 100644
--- a/lily/beam-performer.cc
+++ b/lily/beam-performer.cc
@@ -11,6 +11,7 @@
#include "audio-column.hh"
#include "global-context.hh"
#include "warn.hh"
+#include "music.hh"
class Beam_performer : public Performer
{
diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc
index 2eb1f1a695..d3109d4d14 100644
--- a/lily/chord-name-engraver.cc
+++ b/lily/chord-name-engraver.cc
@@ -16,6 +16,7 @@
#include "protected-scm.hh"
#include "context.hh"
#include "warn.hh"
+#include "pitch.hh"
class Chord_name_engraver : public Engraver
{
diff --git a/lily/cluster-engraver.cc b/lily/cluster-engraver.cc
index 565754199e..261df08564 100644
--- a/lily/cluster-engraver.cc
+++ b/lily/cluster-engraver.cc
@@ -11,6 +11,7 @@
#include "note-head.hh"
#include "note-column.hh"
#include "group-interface.hh"
+#include "pitch.hh"
class Cluster_spanner_engraver : public Engraver
{
diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc
index bac7e8af09..c695b7a76a 100644
--- a/lily/coherent-ligature-engraver.cc
+++ b/lily/coherent-ligature-engraver.cc
@@ -12,6 +12,7 @@
#include "staff-symbol-referencer.hh"
#include "spanner.hh"
#include "paper-column.hh"
+#include "pitch.hh"
/*
* This abstract class serves as common superclass for all ligature
diff --git a/lily/completion-note-heads-engraver.cc b/lily/completion-note-heads-engraver.cc
index 8a9ac0fbef..88ca639052 100644
--- a/lily/completion-note-heads-engraver.cc
+++ b/lily/completion-note-heads-engraver.cc
@@ -8,7 +8,7 @@
#include "rhythmic-head.hh"
#include "output-def.hh"
-#include "event.hh"
+#include "music.hh"
#include "dots.hh"
#include "dot-column.hh"
#include "staff-symbol-referencer.hh"
@@ -18,6 +18,10 @@
#include "spanner.hh"
#include "tie.hh"
#include "global-context.hh"
+#include "duration.hh"
+#include "pitch.hh"
+
+
/*
TODO: make matching rest engraver.
diff --git a/lily/context.cc b/lily/context.cc
index b6ded9ec05..e57593e287 100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -8,6 +8,7 @@
#include "context.hh"
+#include "program-option.hh"
#include "context-def.hh"
#include "ly-smobs.icc"
#include "main.hh"
@@ -97,7 +98,9 @@ Context::Context (Object_key const *key)
smobify_self ();
properties_scm_ = (new Scheme_hash_table)->self_scm ();
scm_gc_unprotect_object (properties_scm_);
- scm_gc_unprotect_object (key_->self_scm ());
+
+ if (key_)
+ scm_gc_unprotect_object (key_->self_scm ());
}
/* TODO: this shares code with find_create_context (). */
@@ -234,6 +237,9 @@ Context::create_context (Context_def *cdef,
Object_key const *
Context::get_context_key (String type, String id)
{
+ if (!use_object_keys)
+ return 0;
+
String now_key = type + "@" + id;
int disambiguation_count = 0;
@@ -253,6 +259,9 @@ Context::get_context_key (String type, String id)
Object_key const *
Context::get_grob_key (String name)
{
+ if (!use_object_keys)
+ return 0;
+
int disambiguation_count = 0;
if (grob_counts_.find (name) != grob_counts_.end ())
{
@@ -494,7 +503,9 @@ SCM
Context::mark_smob (SCM sm)
{
Context *me = (Context *) SCM_CELL_WORD_1 (sm);
- scm_gc_mark (me->key_->self_scm ());
+ if (me->key_)
+ scm_gc_mark (me->key_->self_scm ());
+
scm_gc_mark (me->context_list_);
scm_gc_mark (me->aliases_);
scm_gc_mark (me->definition_);
diff --git a/lily/custos-engraver.cc b/lily/custos-engraver.cc
index 2e232ea8ca..05532c117e 100644
--- a/lily/custos-engraver.cc
+++ b/lily/custos-engraver.cc
@@ -13,6 +13,8 @@
#include "note-head.hh"
#include "staff-symbol-referencer.hh"
#include "warn.hh"
+#include "pitch.hh"
+
/*
* This class implements an engraver for custos symbols.
diff --git a/lily/drum-note-engraver.cc b/lily/drum-note-engraver.cc
index 2d19c7d4bf..8e9386a441 100644
--- a/lily/drum-note-engraver.cc
+++ b/lily/drum-note-engraver.cc
@@ -13,6 +13,7 @@
#include "script-interface.hh"
#include "stem.hh"
#include "note-column.hh"
+#include "duration.hh"
class Drum_notes_engraver : public Engraver
{
diff --git a/lily/drum-note-performer.cc b/lily/drum-note-performer.cc
index aa867c44e7..f913318735 100644
--- a/lily/drum-note-performer.cc
+++ b/lily/drum-note-performer.cc
@@ -11,6 +11,8 @@
#include "audio-column.hh"
#include "global-context.hh"
#include "warn.hh"
+#include "pitch.hh"
+#include "music.hh"
class Drum_note_performer : public Performer
{
diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc
index 12312c74c8..3fda6d4dbe 100644
--- a/lily/dynamic-performer.cc
+++ b/lily/dynamic-performer.cc
@@ -7,7 +7,9 @@
*/
#include "performer.hh"
+
#include "audio-item.hh"
+#include "music.hh"
/*
TODO:
diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc
index 212dccc371..01e839b40d 100644
--- a/lily/event-chord-iterator.cc
+++ b/lily/event-chord-iterator.cc
@@ -10,7 +10,10 @@
#include "context.hh"
#include "warn.hh"
-#include "event.hh"
+#include "music.hh"
+#include "input.hh"
+#include "pitch.hh"
+#include "duration.hh"
Event_chord_iterator::Event_chord_iterator ()
{
@@ -34,12 +37,6 @@ Event_chord_iterator::construct_children ()
get_bottom_context ();
}
-Event_chord *
-Event_chord_iterator::get_elt () const
-{
- return (Event_chord *) get_music ();
-}
-
void
Event_chord_iterator::process (Moment m)
{
diff --git a/lily/event.cc b/lily/event.cc
deleted file mode 100644
index efea416800..0000000000
--- a/lily/event.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- event.cc -- implement Event
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "event.hh"
-#include "warn.hh"
-
-MAKE_SCHEME_CALLBACK (Event, length_callback, 1);
-SCM
-Event::length_callback (SCM m)
-{
- Music *me = unsmob_music (m);
- Duration *d = unsmob_duration (me->get_property ("duration"));
-
- Moment mom;
- if (d)
- {
- mom = d->get_length ();
- }
- return mom.smobbed_copy ();
-}
-
-Event::Event (SCM i)
- : Music (i)
-{
- if (!ly_is_procedure (length_callback_))
- {
- length_callback_ = length_callback_proc;
- }
-}
-
-ADD_MUSIC (Event);
-
diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc
index 00e468a781..73e78489fe 100644
--- a/lily/fingering-engraver.cc
+++ b/lily/fingering-engraver.cc
@@ -11,6 +11,8 @@
#include "stem.hh"
#include "rhythmic-head.hh"
#include "self-alignment-interface.hh"
+#include "pitch.hh"
+
class Fingering_engraver : public Engraver
{
diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc
index fa4138bc48..4741887060 100644
--- a/lily/forbid-break-engraver.cc
+++ b/lily/forbid-break-engraver.cc
@@ -8,6 +8,10 @@
#include "rhythmic-head.hh"
#include "grob.hh"
#include "score-engraver.hh"
+#include "input.hh"
+#include "pitch.hh"
+#include "duration.hh"
+#include "moment.hh"
class Forbid_line_break_engraver : public Engraver
{
diff --git a/lily/global-context.cc b/lily/global-context.cc
index 7f342a182f..fe5429c8b9 100644
--- a/lily/global-context.cc
+++ b/lily/global-context.cc
@@ -11,7 +11,7 @@
#include <cstdio>
#include "warn.hh"
-#include "event.hh"
+#include "music.hh"
#include "music-iterator.hh"
#include "score-context.hh"
#include "context-def.hh"
diff --git a/lily/grace-music.cc b/lily/grace-music.cc
index b6ae587881..3ed2d14aaf 100644
--- a/lily/grace-music.cc
+++ b/lily/grace-music.cc
@@ -8,6 +8,8 @@
#include "music.hh"
#include "music-wrapper.hh"
+#include "moment.hh"
+
class Grace_music
{
diff --git a/lily/gregorian-ligature-engraver.cc b/lily/gregorian-ligature-engraver.cc
index 7af8430ade..4840904b8e 100644
--- a/lily/gregorian-ligature-engraver.cc
+++ b/lily/gregorian-ligature-engraver.cc
@@ -13,6 +13,7 @@
#include "staff-symbol-referencer.hh"
#include "spanner.hh"
#include "paper-column.hh"
+#include "pitch.hh"
/*
* This abstract class is the common superclass for all ligature
diff --git a/lily/grid-point-engraver.cc b/lily/grid-point-engraver.cc
index f2125a36cd..d7e019b70b 100644
--- a/lily/grid-point-engraver.cc
+++ b/lily/grid-point-engraver.cc
@@ -9,6 +9,7 @@
#include "engraver.hh"
#include "item.hh"
+#include "moment.hh"
class Grid_point_engraver : public Engraver
{
diff --git a/lily/grob-pitch-tuple.cc b/lily/grob-pitch-tuple.cc
index 62ede1af08..452d035e3d 100644
--- a/lily/grob-pitch-tuple.cc
+++ b/lily/grob-pitch-tuple.cc
@@ -8,7 +8,7 @@
#include "grob-pitch-tuple.hh"
-#include "event.hh"
+#include "music.hh"
int compare (Grob_pitch_tuple const &a, Grob_pitch_tuple const &b)
{
diff --git a/lily/grob.cc b/lily/grob.cc
index 87e81ebef9..e0868978e7 100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -63,7 +63,8 @@ Grob::Grob (SCM basicprops,
/*
We always get a new key object for a new grob.
*/
- scm_gc_unprotect_object (key_->self_scm ());
+ if (key_)
+ scm_gc_unprotect_object (key_->self_scm ());
SCM meta = get_property ("meta");
if (scm_is_pair (meta))
{
@@ -123,7 +124,7 @@ Grob::Grob (SCM basicprops,
Grob::Grob (Grob const &s, int copy_index)
: dim_cache_ (s.dim_cache_)
{
- key_ = new Copied_key (s.key_, copy_index);
+ key_ = (use_object_keys) ? new Copied_key (s.key_, copy_index) : 0;
original_ = (Grob *) & s;
self_scm_ = SCM_EOL;
@@ -645,7 +646,9 @@ Grob::mark_smob (SCM ses)
{
Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
scm_gc_mark (s->immutable_property_alist_);
- scm_gc_mark (s->key_->self_scm ());
+
+ if (s->key_)
+ scm_gc_mark (s->key_->self_scm ());
for (int a = 0; a < 2; a++)
{
scm_gc_mark (s->dim_cache_[a].offset_callbacks_);
diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh
index 8031efebcb..b3335bab41 100644
--- a/lily/include/engraver.hh
+++ b/lily/include/engraver.hh
@@ -9,7 +9,7 @@
#ifndef ENGRAVER_HH
#define ENGRAVER_HH
-#include "event.hh"
+#include "music.hh"
#include "grob-info.hh"
#include "translator.hh"
diff --git a/lily/include/event-chord-iterator.hh b/lily/include/event-chord-iterator.hh
index 946e4bebb4..c65a9dedcc 100644
--- a/lily/include/event-chord-iterator.hh
+++ b/lily/include/event-chord-iterator.hh
@@ -16,7 +16,6 @@
*/
class Event_chord_iterator : public Simple_music_iterator
{
- Event_chord *get_elt () const;
/**
Find a bottom notation context to deliver events to.
*/
diff --git a/lily/include/event.hh b/lily/include/event.hh
deleted file mode 100644
index 41d24d2041..0000000000
--- a/lily/include/event.hh
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- event.hh -- declare Event baseclasses.
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#ifndef EVENT_HH
-#define EVENT_HH
-
-#include "input.hh"
-#include "music.hh"
-#include "duration.hh"
-#include "pitch.hh"
-
-/* An atom of musical information. This is an abstract class for any
- piece of music that does not contain other Music. */
-class Event : public Music
-{
-public:
- Event (SCM);
- VIRTUAL_COPY_CONSTRUCTOR (Music, Event);
- DECLARE_SCHEME_CALLBACK (length_callback, (SCM));
-};
-
-#endif
diff --git a/lily/include/ligature-engraver.hh b/lily/include/ligature-engraver.hh
index fe3bcb052d..a7e32816ff 100644
--- a/lily/include/ligature-engraver.hh
+++ b/lily/include/ligature-engraver.hh
@@ -9,6 +9,8 @@
#define LIGATURE_ENGRAVER_HH
#include "engraver.hh"
+#include "moment.hh"
+
/*
* FIXME: Spanner *create_ligature_spanner () and virtual void
diff --git a/lily/include/main.hh b/lily/include/main.hh
index b8bd188db6..5e6192d1fb 100644
--- a/lily/include/main.hh
+++ b/lily/include/main.hh
@@ -35,6 +35,7 @@ extern bool is_pango_format_global;
extern bool is_TeX_format_global;
extern bool point_and_click_global;
extern String prefix_directory;
+extern bool use_object_keys;
/*
todo: collect in Output_option struct?
diff --git a/lily/include/minterval.hh b/lily/include/minterval.hh
index 5476f10af9..d08c0b4984 100644
--- a/lily/include/minterval.hh
+++ b/lily/include/minterval.hh
@@ -1,16 +1,18 @@
/*
- minterval.hh -- declare MInterval
+ -- declare MInterval
source file of the GNU LilyPond music typesetter
(c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#ifndef MINTERVAL_HH
-#define MINTERVAL_HH
+#ifndef
+#define
#include "moment.hh"
typedef Interval_t<Moment> MInterval;
-#endif // MINTERVAL_HH
+#endif //
+
+#error
diff --git a/lily/include/music.hh b/lily/include/music.hh
index f0415ff0d0..71e4d00741 100644
--- a/lily/include/music.hh
+++ b/lily/include/music.hh
@@ -10,8 +10,9 @@
#define MUSIC_HH
#include "virtual-methods.hh"
-#include "minterval.hh"
-#include "music-constructor.hh"
+#include "smobs.hh"
+#include "moment.hh"
+#include "pitch.hh"
#define is_mus_type(x) internal_is_music_type (ly_symbol2scm (x))
@@ -44,8 +45,10 @@ public:
/// Scale the music in time by #factor#.
void compress (Moment factor);
+ DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
protected:
DECLARE_SMOBS (Music,);
+
SCM immutable_property_alist_;
SCM mutable_property_alist_;
protected:
diff --git a/lily/include/performer.hh b/lily/include/performer.hh
index b912cd720c..9d224cc460 100644
--- a/lily/include/performer.hh
+++ b/lily/include/performer.hh
@@ -9,7 +9,6 @@
#define PERFORMER_HH
#include "audio-element-info.hh"
-#include "event.hh"
#include "grob-info.hh"
#include "translator.hh"
diff --git a/lily/include/program-option.hh b/lily/include/program-option.hh
index 61ed103882..c4279a9714 100644
--- a/lily/include/program-option.hh
+++ b/lily/include/program-option.hh
@@ -16,7 +16,6 @@ extern int testing_level_global;
extern bool lily_1_8_relative;
extern bool lily_1_8_compatibility_used;
-
SCM ly_get_option (SCM);
SCM ly_set_option (SCM, SCM);
diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc
index f7fd06fc52..acd5aaa68d 100644
--- a/lily/key-engraver.cc
+++ b/lily/key-engraver.cc
@@ -13,6 +13,7 @@
#include "engraver.hh"
#include "protected-scm.hh"
#include "clef.hh"
+#include "pitch.hh"
/*
TODO: The representation of key sigs is all fucked.
diff --git a/lily/key-performer.cc b/lily/key-performer.cc
index 9443d33eff..3f7cc6ac2f 100644
--- a/lily/key-performer.cc
+++ b/lily/key-performer.cc
@@ -23,7 +23,7 @@ protected:
virtual void stop_translation_timestep ();
private:
- Event *key_ev_;
+ Music *key_ev_;
Audio_key *audio_;
};
@@ -88,17 +88,12 @@ Key_performer::stop_translation_timestep ()
bool
Key_performer::try_music (Music *ev)
{
- if (Event *kc = dynamic_cast<Event *> (ev))
+ if (!key_ev_)
{
- if (!key_ev_)
- {
- key_ev_ = kc;
- }
-
- return true;
+ key_ev_ = ev;
}
-
- return false;
+
+ return true;
}
ADD_TRANSLATOR (Key_performer,
diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc
index ca31364695..91ec3ab04f 100644
--- a/lily/lyric-combine-music-iterator.cc
+++ b/lily/lyric-combine-music-iterator.cc
@@ -7,7 +7,7 @@
*/
#include "context.hh"
-#include "event.hh"
+#include "music.hh"
#include "note-head.hh"
#include "grob.hh"
#include "music-iterator.hh"
diff --git a/lily/lyric-combine-music.cc b/lily/lyric-combine-music.cc
index 5b2764d894..dca904f2e8 100644
--- a/lily/lyric-combine-music.cc
+++ b/lily/lyric-combine-music.cc
@@ -8,6 +8,7 @@
#include "music.hh"
#include "pitch.hh"
+#include "moment.hh"
struct Lyric_combine_music
{
diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc
index f9faa72693..9d747f4e77 100644
--- a/lily/lyric-performer.cc
+++ b/lily/lyric-performer.cc
@@ -8,6 +8,7 @@
#include "audio-item.hh"
#include "performer.hh"
+#include "music.hh"
class Lyric_performer : public Performer
{
diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc
index 59c65531fe..bca756e2f3 100644
--- a/lily/mensural-ligature-engraver.cc
+++ b/lily/mensural-ligature-engraver.cc
@@ -9,7 +9,7 @@
#include "coherent-ligature-engraver.hh"
#include "mensural-ligature.hh"
-#include "event.hh"
+#include "music.hh"
#include "warn.hh"
#include "spanner.hh"
#include "paper-column.hh"
diff --git a/lily/music-constructor.cc b/lily/music-constructor.cc
deleted file mode 100644
index 481b9ebc90..0000000000
--- a/lily/music-constructor.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- music-constructor.cc -- implement Music_constructor
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2001--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "music-constructor.hh"
-
-#include <map> // UGH.
-#include <cassert>
-
-#include "warn.hh"
-
-static std::map<String, Music_ctor> *ctors_map_;
-
-void
-add_music_ctor (String s, Music_ctor c)
-{
- if (!ctors_map_)
- ctors_map_ = new std::map<String, Music_ctor>;
-
- (*ctors_map_)[s] = c;
-}
-
-Music_ctor
-get_music_ctor (String s)
-{
- if (ctors_map_->find (s) == ctors_map_->end ())
- return 0;
-
- return (*ctors_map_)[s];
-}
-
-Music *
-make_music (String s, SCM init)
-{
- Music_ctor c = get_music_ctor (s);
- if (!c)
- programming_error (String ("No constructor for music: ") + s);
- assert (c);
-
- return (*c) (init);
-}
-
diff --git a/lily/music-scheme.cc b/lily/music-scheme.cc
index da81ec6381..e2e4c73d1f 100644
--- a/lily/music-scheme.cc
+++ b/lily/music-scheme.cc
@@ -61,17 +61,17 @@ LY_DEFINE (ly_music_name, "ly:music-name",
}
/* todo: property args */
-LY_DEFINE (ly_extended_make_music, "ly:make-bare-music",
- 2, 0, 0, (SCM type, SCM props),
- "Make a C++ music object of type @var{type}, initialize with\n"
+LY_DEFINE (ly_make_music, "ly:make-music",
+ 1, 0, 0, (SCM props),
+ "Make a C++ Music object, initialize with\n"
"@var{props}. \n\n"
""
"This function is for internal use, and is only called by "
"@code{make-music}, which is the preferred interface "
"for creating music objects. ")
{
- SCM_ASSERT_TYPE (scm_is_string (type), type, SCM_ARG1, __FUNCTION__, "string");
- SCM s = make_music (ly_scm2string (type), props)->self_scm ();
+ Music *ms = new Music (props);
+ SCM s = ms->self_scm ();
scm_gc_unprotect_object (s);
return s;
}
diff --git a/lily/music.cc b/lily/music.cc
index c34e970e74..a3a6deb437 100644
--- a/lily/music.cc
+++ b/lily/music.cc
@@ -53,6 +53,11 @@ Music::Music (SCM init)
smobify_self ();
length_callback_ = get_property ("length-callback");
+ if (!ly_is_procedure (length_callback_))
+ {
+ length_callback_ = duration_length_callback_proc;
+ }
+
start_callback_ = get_property ("start-callback");
}
@@ -76,7 +81,6 @@ Music::~Music ()
{
}
-ADD_MUSIC (Music);
SCM
Music::get_property_alist (bool m) const
@@ -297,7 +301,6 @@ Music::origin () const
return ip ? ip : &dummy_input_global;
}
-
Music *
make_music_by_name (SCM sym)
{
@@ -308,3 +311,19 @@ make_music_by_name (SCM sym)
scm_gc_protect_object (rv);
return unsmob_music (rv);
}
+
+
+MAKE_SCHEME_CALLBACK (Music, duration_length_callback, 1);
+SCM
+Music::duration_length_callback (SCM m)
+{
+ Music *me = unsmob_music (m);
+ Duration *d = unsmob_duration (me->get_property ("duration"));
+
+ Moment mom;
+ if (d)
+ {
+ mom = d->get_length ();
+ }
+ return mom.smobbed_copy ();
+}
diff --git a/lily/new-lyric-combine-music-iterator.cc b/lily/new-lyric-combine-music-iterator.cc
index 0144e9e5e1..49e496ff70 100644
--- a/lily/new-lyric-combine-music-iterator.cc
+++ b/lily/new-lyric-combine-music-iterator.cc
@@ -7,9 +7,10 @@
*/
#include "context.hh"
-#include "event.hh"
+#include "music.hh"
#include "grob.hh"
#include "music-iterator.hh"
+#include "input.hh"
class New_lyric_combine_music_iterator : public Music_iterator
{
diff --git a/lily/note-head.cc b/lily/note-head.cc
index b3fb07b8fc..67935a0a2d 100644
--- a/lily/note-head.cc
+++ b/lily/note-head.cc
@@ -20,7 +20,7 @@ using namespace std;
#include "dots.hh"
#include "warn.hh"
#include "font-interface.hh"
-#include "event.hh"
+#include "music.hh"
#include "rhythmic-head.hh"
#include "staff-symbol-referencer.hh"
#include "lookup.hh"
diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc
index 8bcd41237c..b74d9faff1 100644
--- a/lily/note-heads-engraver.cc
+++ b/lily/note-heads-engraver.cc
@@ -4,6 +4,8 @@
(c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "engraver.hh"
+
#include <cctype>
#include "rhythmic-head.hh"
@@ -12,8 +14,8 @@
#include "dot-column.hh"
#include "staff-symbol-referencer.hh"
#include "item.hh"
-#include "engraver.hh"
#include "warn.hh"
+#include "duration.hh"
class Note_heads_engraver : public Engraver
{
diff --git a/lily/note-performer.cc b/lily/note-performer.cc
index 3bdbcb0df3..640449cc3a 100644
--- a/lily/note-performer.cc
+++ b/lily/note-performer.cc
@@ -11,6 +11,7 @@
#include "audio-column.hh"
#include "global-context.hh"
#include "warn.hh"
+#include "music.hh"
/**
Convert evs to audio notes.
diff --git a/lily/parser.yy b/lily/parser.yy
index 78d54517a3..2b5b6c0caa 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -28,7 +28,7 @@ FIXME:
#include "book.hh"
#include "context-def.hh"
#include "dimensions.hh"
-#include "event.hh"
+#include "music.hh"
#include "file-path.hh"
#include "input-smob.hh"
#include "input.hh"
@@ -45,6 +45,7 @@ FIXME:
#include "score.hh"
#include "text-interface.hh"
#include "warn.hh"
+#include "music.hh"
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
@@ -2693,8 +2694,11 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
*destination = mus->self_scm ();
unsmob_music (*destination)->
set_property ("origin", make_input (last_input_));
- return dynamic_cast<Event*> (mus)
- ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
+
+ bool is_event = scm_memq (ly_symbol2scm ("event"), mus->get_property ("types"))
+ != SCM_BOOL_F;
+
+ return is_event ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
} else if (unsmob_duration (sid)) {
*destination = unsmob_duration (sid)->smobbed_copy ();
return DURATION_IDENTIFIER;
diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc
index fea8256ca1..577552579f 100644
--- a/lily/part-combine-iterator.cc
+++ b/lily/part-combine-iterator.cc
@@ -7,7 +7,7 @@
*/
#include "context.hh"
-#include "event.hh"
+#include "music.hh"
#include "music-sequence.hh"
#include "lily-guile.hh"
#include "warn.hh"
diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc
index 242a181fcd..dd118981ab 100644
--- a/lily/piano-pedal-performer.cc
+++ b/lily/piano-pedal-performer.cc
@@ -8,6 +8,7 @@
#include "performer.hh"
#include "audio-item.hh"
+#include "music.hh"
/**
perform Piano pedals
diff --git a/lily/program-option.cc b/lily/program-option.cc
index 552987904b..19d18acf51 100644
--- a/lily/program-option.cc
+++ b/lily/program-option.cc
@@ -20,6 +20,7 @@
/* Write midi as formatted ascii stream? */
bool do_midi_debugging_global;
+bool use_object_keys;
/*
Backwards compatibility.
@@ -65,6 +66,10 @@ void internal_set_option (SCM var, SCM val)
lily_1_8_compatibility_used = to_boolean (val);
val = scm_from_bool (to_boolean (val));
}
+ else if (var == ly_symbol2scm ("object-keys"))
+ {
+ use_object_keys = scm_from_bool (to_boolean (val));
+ }
}
const int HELP_INDENT = 30;
diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc
index 45e0f066a7..fd7498d7be 100644
--- a/lily/quote-iterator.cc
+++ b/lily/quote-iterator.cc
@@ -7,11 +7,12 @@
*/
#include "context.hh"
-#include "event.hh"
+#include "music.hh"
#include "music-sequence.hh"
#include "lily-guile.hh"
#include "music-wrapper-iterator.hh"
#include "warn.hh"
+#include "input.hh"
class Quote_iterator : public Music_wrapper_iterator
{
diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc
index 009d16f768..0116992b67 100644
--- a/lily/rest-engraver.cc
+++ b/lily/rest-engraver.cc
@@ -6,11 +6,15 @@
(c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "engraver.hh"
+
+#include "duration.hh"
#include "item.hh"
#include "staff-symbol-referencer.hh"
#include "dots.hh"
#include "rhythmic-head.hh"
-#include "engraver.hh"
+#include "music.hh"
+
class Rest_engraver : public Engraver
{
diff --git a/lily/slur-performer.cc b/lily/slur-performer.cc
index 573e2426c1..eb879a7f99 100644
--- a/lily/slur-performer.cc
+++ b/lily/slur-performer.cc
@@ -11,6 +11,7 @@
#include "audio-column.hh"
#include "global-context.hh"
#include "warn.hh"
+#include "music.hh"
/*
this is C&P from beam_performer.
diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc
index 5754244f61..bb99c70487 100644
--- a/lily/span-dynamic-performer.cc
+++ b/lily/span-dynamic-performer.cc
@@ -8,6 +8,7 @@
#include "performer.hh"
#include "audio-item.hh"
+#include "music.hh"
/*
TODO: fold this into 1 engraver: \< and \> should also stop when
diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc
index 71ef4b46f8..a469c78cb1 100644
--- a/lily/stem-engraver.cc
+++ b/lily/stem-engraver.cc
@@ -16,6 +16,7 @@
#include "staff-symbol-referencer.hh"
#include "stem-tremolo.hh"
#include "stem.hh"
+#include "duration.hh"
/**
Make stems upon receiving noteheads.
diff --git a/lily/swallow-perf.cc b/lily/swallow-perf.cc
index 92c7c4ba9c..3bf237d101 100644
--- a/lily/swallow-perf.cc
+++ b/lily/swallow-perf.cc
@@ -7,6 +7,8 @@
*/
#include "performer.hh"
+#include "music.hh"
+
class Swallow_performer : public Performer
{
diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc
index aff6336ab7..d4210c42fc 100644
--- a/lily/tab-note-heads-engraver.cc
+++ b/lily/tab-note-heads-engraver.cc
@@ -11,13 +11,15 @@
#include "rhythmic-head.hh"
#include "output-def.hh"
-#include "event.hh"
+#include "music.hh"
#include "dots.hh"
#include "dot-column.hh"
#include "staff-symbol-referencer.hh"
#include "item.hh"
#include "score-engraver.hh"
#include "warn.hh"
+#include "duration.hh"
+
/**
make (guitar-like) tablature note
diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc
index 540db7dcac..58310da1dc 100644
--- a/lily/tempo-performer.cc
+++ b/lily/tempo-performer.cc
@@ -6,9 +6,12 @@
(c) 1997--2005 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "audio-item.hh"
#include "performer.hh"
+#include "audio-item.hh"
+#include "music.hh"
+#include "duration.hh"
+
class Tempo_performer : public Performer
{
public:
@@ -41,7 +44,6 @@ Tempo_performer::create_audio_elements ()
{
if (tempo_req_)
{
-
SCM met = tempo_req_->get_property ("metronome-count");
Duration *d = unsmob_duration (tempo_req_->get_property ("tempo-unit"));
diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc
index 652046e0a6..7dc078bd95 100644
--- a/lily/tie-performer.cc
+++ b/lily/tie-performer.cc
@@ -6,10 +6,13 @@
(c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "performer.hh"
+
+#include "music.hh"
#include "context.hh"
#include "audio-item.hh"
#include "pqueue.hh"
-#include "performer.hh"
+
class Tie_performer : public Performer
{
diff --git a/lily/type-swallow-translator.cc b/lily/type-swallow-translator.cc
index 616099fbed..47c40fe0eb 100644
--- a/lily/type-swallow-translator.cc
+++ b/lily/type-swallow-translator.cc
@@ -7,7 +7,7 @@
*/
#include "translator.hh"
-#include "event.hh"
+#include "music.hh"
class Skip_event_swallow_translator : public virtual Translator
{
diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm
index 18f9011fc5..3cd631bad8 100644
--- a/scm/define-music-properties.scm
+++ b/scm/define-music-properties.scm
@@ -56,7 +56,6 @@ descend in the context tree.")
(length ,ly:moment? "The duration of this music")
(length-callback ,procedure? "How to compute the duration of this music. This property
can only be defined as initializer in @file{define-music-types.scm}.")
- (internal-class-name ,string? "C++ class to use for this Music object")
(name ,symbol? "Name of this music object")
(numerator ,integer? "numerator of a time signature")
(once ,boolean? "Apply this operation only during one time step?")
diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm
index f0d555743b..24e45dad8a 100644
--- a/scm/define-music-types.scm
+++ b/scm/define-music-types.scm
@@ -814,7 +814,7 @@ and values. E.g:
(let ((props (hashq-ref music-name-to-property-table name '())))
(if (not (pair? props))
(ly:error (_ "can't find music object: ~S") name))
- (let ((m (ly:make-bare-music (cdr (assoc 'internal-class-name props)) props)))
+ (let ((m (ly:make-music props)))
(define (set-props mus-props)
(if (and (not (null? mus-props))
(not (null? (cdr mus-props))))
diff --git a/scm/lily.scm b/scm/lily.scm
index 25165c605d..18a19eeb75 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -18,7 +18,8 @@ on errors, and print a stack trace.")
(old-relative #f
"relative for simultaneous music works
similar to chord syntax")
-
+ (object-keys #f
+ "experimental mechanism for remembering tweaks")
(resolution 101 "resolution for generating bitmaps")
(anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG")
(preview-include-book-title #t "include book-titles in preview images.")
diff --git a/scm/output-socket.scm b/scm/output-socket.scm
index 17967425a1..ddecbd0712 100644
--- a/scm/output-socket.scm
+++ b/scm/output-socket.scm
@@ -95,14 +95,19 @@
)))
+(define (escape-string str)
+ (string-regexp-substitute
+ " " "\\040"
+ (string-regexp-substitute "\"" "\\\"" str)))
+
(define-public (utf-8-string
descr
string)
- (format "utf-8 \"~a\" \"~a\"" descr
+ (format "utf-8 \"~a\" \"~a\""
+ (escape-string descr)
;; don't want unescaped spaces.
- (string-regexp-substitute " " "\\040"
- (string-regexp-substitute "\"" "\\\"" string))
+ (escape-string string)
))
diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm
index 2f1e7dec53..9e43ef1ab8 100644
--- a/scm/safe-lily.scm
+++ b/scm/safe-lily.scm
@@ -67,7 +67,7 @@
ly:item-break-dir
ly:item?
ly:iterator?
- ly:make-bare-music
+ ly:make-music
ly:make-duration
ly:make-moment
ly:make-music-function