From: hanwen <hanwen>
Date: Sun, 14 Nov 2004 14:26:25 +0000 (+0000)
Subject: * lily/grob-scheme.cc (LY_DEFINE): add new function ly:grob-key.
X-Git-Tag: release/2.5.23~980
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=52a2fbd208d4a8c91afe438e2992b9a5219a005b;p=lilypond.git

* lily/grob-scheme.cc (LY_DEFINE): add new function ly:grob-key.

* lily/include/global-context.hh (Context): take \score key upon init.

* lily/context.cc (Context): take key argument in ctor.
(create_context): new function
---

diff --git a/ChangeLog b/ChangeLog
index b79a8d1df0..f078e68997 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2004-11-14  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+	* lily/grob-scheme.cc (LY_DEFINE): add new function ly:grob-key.
+
 	* lily/include/object-key-undumper.hh (Module): new file.
 
 	* lily/object-key-undumper.cc (Module): New file. Deserialize
@@ -10,7 +12,6 @@
 
 	* lily/include/object-key-dumper.hh (class Object_key_dumper): 
 	new file. Serialize object keys.
-
 	
 	* lily/object-key.cc (dump): new function.
 	(as_scheme): new virtual function
diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc
index d3a0d0a05f..6b7fdc2332 100644
--- a/lily/grob-scheme.cc
+++ b/lily/grob-scheme.cc
@@ -223,3 +223,14 @@ LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
   return scm_int2num (me->break_status_dir ());
 }
 
+
+LY_DEFINE(ly_grob_key, "ly:grob-key",
+	  1,0,0,
+	  (SCM grob),
+	  "Return the object-key for @var{grob}."
+	  )
+{
+  Grob *me = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "Grob");
+  return me->get_key ()->self_scm ();
+}