]> git.donarmstrong.com Git - lilypond.git/blob - lily/stream-event-scheme.cc
ea9365496187c371bbe721be6b72906b1b8586f2
[lilypond.git] / lily / stream-event-scheme.cc
1 /*
2   stream-event.cc -- implement Scheme bindings for Stream_event
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2006 Erik Sandberg  <mandolaerik@gmail.com>
7 */
8
9 #include "stream-event.hh"
10
11 LY_DEFINE (ly_make_stream_event, "ly:make-stream-event",
12            1, 1, 0, (SCM cl, SCM proplist),
13            "Creates a stream event of class @var{cl} with the given mutable property list.\n" )
14 {
15   SCM_ASSERT_TYPE (scm_is_symbol (cl), cl, SCM_ARG1, __FUNCTION__, "symbol");
16   if (proplist != SCM_UNDEFINED)
17     {
18       SCM_ASSERT_TYPE (scm_list_p (proplist), proplist, SCM_ARG2, __FUNCTION__, "association list");
19     }
20   else
21     proplist = SCM_EOL;
22   Stream_event *e = new Stream_event (cl, proplist);
23   return e->unprotect ();
24 }
25
26 LY_DEFINE (ly_event_property, "ly:event-property", 
27            2, 0, 0, (SCM sev, SCM sym),
28            "Get the property @var{sym} of stream event @var{mus}.\n"
29            "If @var{sym} is undefined, return @code{' ()}.\n")
30 {
31   Stream_event *e = unsmob_stream_event (sev);
32   SCM_ASSERT_TYPE (e, sev, SCM_ARG1, __FUNCTION__, "stream event");
33   SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
34
35   return e->internal_get_property (sym);
36 }
37
38 LY_DEFINE (ly_event_set_property, "ly:event-set-property!",
39            3, 0, 0, (SCM ev, SCM sym, SCM val),
40            "Set property @var{sym} in event @var{ev} to @var{val}."){
41   Stream_event *sc = unsmob_stream_event (ev);
42   SCM_ASSERT_TYPE (sc, ev, SCM_ARG1, __FUNCTION__, "event");
43   return ly_prob_set_property_x (ev, sym, val);
44 }