2 output-property-engraver.cc -- implement Output_property_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "engraver.hh"
12 #include "output-property-music-iterator.hh"
14 class Output_property_engraver
: public Engraver
17 VIRTUAL_COPY_CONS (Translator
);
21 should do this with \once and \push ?
24 \property Voice.outputProperties \push #pred = #modifier
26 where both MODIFIER and PRED are functions taking a
32 Link_array
<Music
> props_
;
34 virtual void stop_translation_timestep ();
35 virtual void acknowledge_grob (Grob_info
);
36 virtual bool try_music (Music
*);
41 Output_property_engraver::try_music (Music
* m
)
43 if (m
->get_mus_property ("iterator-ctor") ==
44 Output_property_music_iterator::constructor_cxx_function
)
53 Output_property_engraver::acknowledge_grob (Grob_info inf
)
55 for (int i
=props_
.size (); i
--;)
57 Music
* o
= props_
[i
];
58 SCM pred
= o
->get_mus_property ("predicate");
61 should typecheck pred.
63 SCM result
=gh_apply (pred
,
64 gh_list (inf
.elem_l_
->self_scm (), SCM_UNDEFINED
));
65 if (to_boolean (result
))
67 SCM sym
= o
->get_mus_property ("symbol");
68 SCM val
= o
->get_mus_property ("value");
69 inf
.elem_l_
->set_grob_property (sym
, val
);
75 Output_property_engraver::stop_translation_timestep ()
80 ADD_THIS_TRANSLATOR (Output_property_engraver
);