]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/context-scheme.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / context-scheme.cc
index 3ea9718f53769f18467a18e5a18a4a4028aa592e..92240a9b1d8dc1636d4cce9e89538eeda7a6ce95 100644 (file)
@@ -3,12 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--2005 Jan Nieuwenhuizen <janneke@gnu.org>
-  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+  Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "context.hh"
 #include "context-def.hh"
+#include "dispatcher.hh"
 
 LY_DEFINE (ly_context_id, "ly:context-id",
           1, 0, 0, (SCM context),
@@ -19,7 +20,7 @@ LY_DEFINE (ly_context_id, "ly:context-id",
   Context *tr = unsmob_context (context);
   SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
 
-  return scm_makfrom0str (tr->id_string ().to_str0 ());
+  return scm_makfrom0str (tr->id_string ().c_str ());
 }
 
 LY_DEFINE (ly_context_name, "ly:context-name",
@@ -30,7 +31,7 @@ LY_DEFINE (ly_context_name, "ly:context-name",
 {
   Context *tr = unsmob_context (context);
   SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
-  return ly_symbol2scm (tr->context_name ().to_str0 ());
+  return ly_symbol2scm (tr->context_name ().c_str ());
 }
 
 LY_DEFINE (ly_context_grob_definition, "ly:context-grob-definition",
@@ -97,7 +98,8 @@ LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined
   SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
   SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
 
-  tr = tr->where_defined (name);
+  SCM val;
+  tr = tr->where_defined (name, &val);
   if (tr)
     return tr->self_scm ();
 
@@ -150,3 +152,30 @@ LY_DEFINE (ly_context_find, "ly:context-find",
   return SCM_BOOL_F;
 }
 
+LY_DEFINE (ly_context_now, "ly:context-now",
+          1, 0, 0, (SCM context),
+          "Return now-moment of context CONTEXT")
+{
+  Context *ctx = unsmob_context (context);
+  SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context");
+  return ctx->now_mom ().smobbed_copy ();
+}
+
+LY_DEFINE (ly_context_event_source, "ly:context-event-source",
+           1, 0, 0, (SCM context),
+           "Return event-source of context CONTEXT")
+{
+  Context *ctx = unsmob_context (context);
+  SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context");
+  return ctx->event_source ()->self_scm ();
+}
+
+LY_DEFINE (ly_context_events_below, "ly:context-events-below",
+           1, 0, 0, (SCM context),
+           "Return a stream-distributor that distributes all events\n"
+           " from @var{context} and all its subcontexts.")
+{
+  Context *ctx = unsmob_context (context);
+  SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context");
+  return ctx->events_below ()->self_scm ();
+}