]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/object-key-dumper-scheme.cc: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Jan 2005 12:28:03 +0000 (12:28 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Jan 2005 12:28:03 +0000 (12:28 +0000)
* lily/object-key-undumper-scheme.cc: new file.

* lily/tweak-registration-scheme.cc: new file.

ChangeLog
lily/lookup.cc
lily/object-key-dumper-scheme.cc [new file with mode: 0644]
lily/object-key-dumper.cc
lily/object-key-undumper-scheme.cc [new file with mode: 0644]
lily/object-key-undumper.cc
lily/stencil-scheme.cc
lily/tweak-registration-scheme.cc [new file with mode: 0644]
lily/tweak-registration.cc

index 2d9347f3045cd1c69cb9f80e7714ef01875d7b82..24bcb3d73fb4919b3b412f45c1c68c9e6feb777e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-01-08  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/object-key-dumper-scheme.cc: new file.
+
+       * lily/object-key-undumper-scheme.cc: new file.
+
+       * lily/tweak-registration-scheme.cc: new file.
+
        * lily/pango-select.cc (symbol_to_pango_variant): init local variable.
 
        * Documentation/user/examples.itely (String quartet): uncomment
index 8bc97ef19013b06939a2b475b7523c6e353241ca..5e9e29d536b827576c13b1031bf75ce1789048e6 100644 (file)
@@ -705,41 +705,3 @@ Lookup::triangle (Interval iv, Real thick, Real protude)
   return tri;
 }
 
-
-LY_DEFINE (ly_bracket ,"ly:bracket",
-         4, 0, 0,
-         (SCM a, SCM iv, SCM t, SCM p),
-         "Make a bracket in direction @var{a}. The extent of the bracket is " 
-         "given by @var{iv}. The wings protude by an amount of @var{p}, which "
-         "may be negative. The thickness is given by @var{t}.")
-{
-  SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis") ;
-  SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair") ;
-  SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number") ;
-  SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number") ;
-
-
-  return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
-                         scm_to_double (t),
-                         scm_to_double (p),
-                         0.95 * scm_to_double (t)).smobbed_copy ();
-}
-
-
-
-LY_DEFINE (ly_filled_box ,"ly:round-filled-box",
-         3, 0, 0,
-         (SCM xext, SCM yext, SCM blot),
-         "Make a @code{Stencil} "
-         "that prints a black box of dimensions @var{xext}, "
-         "@var{yext} and roundness @var{blot}."
-         )
-{
-  SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ;
-  SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ;
-  SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
-
-  return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
-                                  scm_to_double (blot)).smobbed_copy ();
-}
-
diff --git a/lily/object-key-dumper-scheme.cc b/lily/object-key-dumper-scheme.cc
new file mode 100644 (file)
index 0000000..2e1a9a9
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+  object-key-dumper-scheme.cc --  implement Object_key_dumper bindings
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "object-key-dumper.hh"
+
+#include "moment.hh"
+
+LY_DEFINE(ly_make_dumper, "ly:make-dumper",
+         0,0,0,
+         (),
+         "Create a key dumper. "
+         )
+{
+  Object_key_dumper *u = new Object_key_dumper ();
+  SCM x = u->self_scm();
+  scm_gc_unprotect_object (x);
+  return x;
+}
+
+LY_DEFINE(ly_dumper_definitions, "ly:dumper-definitions",
+         1,0,0,
+         (SCM dumper),
+         "Return list of key definitions. "
+         )
+{
+  Object_key_dumper *u = unsmob_key_dumper (dumper);
+  SCM_ASSERT_TYPE(u, dumper, SCM_ARG1, __FUNCTION__, "dumper");
+  return u->get_file_contents();
+}
+
+LY_DEFINE(ly_dumper_key_serial, "ly:dumper-key-serial",
+         2,0,0,
+         (SCM dumper, SCM key),
+         "Return the  key serial number @var{key}. "
+         )
+{
+  Object_key_dumper* u = unsmob_key_dumper (dumper);
+  Object_key *k = unsmob_key (key);
+  SCM_ASSERT_TYPE(u, dumper, SCM_ARG1, __FUNCTION__, "dumper");
+  SCM_ASSERT_TYPE(k, key, SCM_ARG2, __FUNCTION__, "key");
+  return u->dump_key (k);
+}
index 368e2d0402ef96191f36029b8a0e842c97685614..7ff2bb8081d71881e36894018594e21e50c481b2 100644 (file)
@@ -103,42 +103,6 @@ Object_key_dumper::get_file_contents () const
   return scm_reverse (file_contents_);
 }
 
-LY_DEFINE(ly_make_dumper, "ly:make-dumper",
-         0,0,0,
-         (),
-         "Create a key dumper. "
-         )
-{
-  Object_key_dumper *u = new Object_key_dumper ();
-  SCM x = u->self_scm();
-  scm_gc_unprotect_object (x);
-  return x;
-}
-
-LY_DEFINE(ly_dumper_definitions, "ly:dumper-definitions",
-         1,0,0,
-         (SCM dumper),
-         "Return list of key definitions. "
-         )
-{
-  Object_key_dumper *u = unsmob_key_dumper (dumper);
-  SCM_ASSERT_TYPE(u, dumper, SCM_ARG1, __FUNCTION__, "dumper");
-  return u->get_file_contents();
-}
-
-LY_DEFINE(ly_dumper_key_serial, "ly:dumper-key-serial",
-         2,0,0,
-         (SCM dumper, SCM key),
-         "Return the  key serial number @var{key}. "
-         )
-{
-  Object_key_dumper* u = unsmob_key_dumper (dumper);
-  Object_key *k = unsmob_key (key);
-  SCM_ASSERT_TYPE(u, dumper, SCM_ARG1, __FUNCTION__, "dumper");
-  SCM_ASSERT_TYPE(k, key, SCM_ARG2, __FUNCTION__, "key");
-  return u->dump_key (k);
-}
-
 Object_key_dumper::~Object_key_dumper()
 {
 }
diff --git a/lily/object-key-undumper-scheme.cc b/lily/object-key-undumper-scheme.cc
new file mode 100644 (file)
index 0000000..b20f94c
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+  object-key-undumper-scheme.cc --  implement Object_key_undumper bindings
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "object-key-undumper.hh"
+
+LY_DEFINE(ly_undumper_read_keys, "ly:undumper-read-keys",
+         2,0,0,
+         (SCM undumper, SCM keys),
+         "Read serialized @var{keys} into @var{undumper}."
+         )
+{
+  Object_key_undumper *u = unsmob_key_undumper (undumper);
+  SCM_ASSERT_TYPE(u, undumper, SCM_ARG1, __FUNCTION__, "Undumper");
+
+  u->parse_contents (keys);
+  return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE(ly_make_undumper, "ly:make-undumper",
+         0, 0,0,
+         (),
+         "Create a key undumper. "
+         )
+{
+  Object_key_undumper *u = new Object_key_undumper ();
+  SCM x = u->self_scm();
+  scm_gc_unprotect_object (x);
+  return x;
+}
+
+
+LY_DEFINE(ly_undumper_lookup, "ly:undumper-lookup",
+         2,0,0,
+         (SCM undumper, SCM serial),
+         "Return the object key for number @var{serial}. "
+         )
+  
+{
+  Object_key_undumper* u = unsmob_key_undumper (undumper);
+
+  SCM_ASSERT_TYPE(u, undumper, SCM_ARG1, __FUNCTION__, "undumper");
+  SCM_ASSERT_TYPE(scm_is_integer(serial), serial, SCM_ARG2, __FUNCTION__, "integer");
+  return u->get_key (scm_to_int (serial))->self_scm();
+}
+
+
index ba199d8897c341e0c71eb279ace778438d6ab4ae..570e1b6f63c952661d446b5cd979c7a1152f1fc5 100644 (file)
@@ -41,47 +41,6 @@ Object_key_undumper::Object_key_undumper ()
 }
 
 
-LY_DEFINE(ly_undumper_read_keys, "ly:undumper-read-keys",
-         2,0,0,
-         (SCM undumper, SCM keys),
-         "Read serialized @var{keys} into @var{undumper}."
-         )
-{
-  Object_key_undumper *u = unsmob_key_undumper (undumper);
-  SCM_ASSERT_TYPE(u, undumper, SCM_ARG1, __FUNCTION__, "Undumper");
-
-  u->parse_contents (keys);
-  return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE(ly_make_undumper, "ly:make-undumper",
-         0, 0,0,
-         (),
-         "Create a key undumper. "
-         )
-{
-  Object_key_undumper *u = new Object_key_undumper ();
-  SCM x = u->self_scm();
-  scm_gc_unprotect_object (x);
-  return x;
-}
-
-
-LY_DEFINE(ly_undumper_lookup, "ly:undumper-lookup",
-         2,0,0,
-         (SCM undumper, SCM serial),
-         "Return the object key for number @var{serial}. "
-         )
-  
-{
-  Object_key_undumper* u = unsmob_key_undumper (undumper);
-
-  SCM_ASSERT_TYPE(u, undumper, SCM_ARG1, __FUNCTION__, "undumper");
-  SCM_ASSERT_TYPE(scm_is_integer(serial), serial, SCM_ARG2, __FUNCTION__, "integer");
-  return u->get_key (scm_to_int (serial))->self_scm();
-}
-
-
 void
 Object_key_undumper::parse_contents (SCM contents)
 {
index ebd50de6b6bac9a1373a03bc5668cdb7a0eb4fe3..3a4b6e167220969def7cfacac1e0f236a6c241a7 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "font-metric.hh"
 #include "stencil.hh"
+#include "lookup.hh"
 
 /*
   TODO: naming add/combine.
@@ -295,3 +296,42 @@ LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression",
   return SCM_UNSPECIFIED;
 }
 
+
+
+LY_DEFINE (ly_bracket ,"ly:bracket",
+         4, 0, 0,
+         (SCM a, SCM iv, SCM t, SCM p),
+         "Make a bracket in direction @var{a}. The extent of the bracket is " 
+         "given by @var{iv}. The wings protude by an amount of @var{p}, which "
+         "may be negative. The thickness is given by @var{t}.")
+{
+  SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis") ;
+  SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair") ;
+  SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number") ;
+  SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number") ;
+
+
+  return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
+                         scm_to_double (t),
+                         scm_to_double (p),
+                         0.95 * scm_to_double (t)).smobbed_copy ();
+}
+
+
+
+LY_DEFINE (ly_filled_box ,"ly:round-filled-box",
+         3, 0, 0,
+         (SCM xext, SCM yext, SCM blot),
+         "Make a @code{Stencil} "
+         "that prints a black box of dimensions @var{xext}, "
+         "@var{yext} and roundness @var{blot}."
+         )
+{
+  SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ;
+  SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ;
+  SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number") ;
+
+  return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
+                                  scm_to_double (blot)).smobbed_copy ();
+}
+
diff --git a/lily/tweak-registration-scheme.cc b/lily/tweak-registration-scheme.cc
new file mode 100644 (file)
index 0000000..a77aeb3
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+  tweak-registration-scheme.cc --  implement Tweak_registry bindings
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+
+#include "tweak-registration.hh"
+
+LY_DEFINE(ly_clear_tweak_registry, "ly:tweak-clear-registry",
+         0,0,0,(),
+         "Clear global tweak registry"
+         )
+{
+  global_registry_->clear ();
+  return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE(ly_insert_tweak, "ly:insert-tweak",
+         2,0,0,
+         (SCM grob, SCM tweak),
+         "add new tweak for grob."
+         )
+{
+  Grob *gr = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(gr, grob, SCM_ARG1, __FUNCTION__, "Grob");
+  SCM_ASSERT_TYPE(scm_list_p (tweak) == SCM_BOOL_T
+                 && ly_c_procedure_p (scm_car (tweak)),
+                 tweak, SCM_ARG2, __FUNCTION__, "Tweak");
+  
+  global_registry_->insert_grob_tweak (gr, tweak);
+  return SCM_UNSPECIFIED;
+}
+
+
+LY_DEFINE(ly_tweak_read_keys, "ly:tweak-define-keys",
+         1,0,0,(SCM keys),
+         "Read keys"
+         )
+{
+  global_registry_->undumper ()->parse_contents (keys); 
+  return SCM_UNSPECIFIED;
+}
+
+
+LY_DEFINE(ly_all_tweaks, "ly:all-tweaks",
+         0,0,0,(),
+         "all tweaks"
+         )
+{
+  return global_registry_->list_tweaks();
+}
+
+
+LY_DEFINE(ly_tweak_read_tweaks, "ly:tweak-define-tweaks",
+         1,0,0,(SCM tweaks),
+         "Read  tweaks"
+         )
+{
+  for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
+    {
+      global_registry_->insert_tweak_from_file (scm_car (s));
+    }
+  return SCM_UNSPECIFIED;
+}
index d0739a220281c03e35fb7c45f41c476e55f6cbc8..4984922f2b272dc80658e84c5e32cd0bdcacea6a 100644 (file)
@@ -138,61 +138,3 @@ init_global_tweak_registry()
 {
   global_registry_ = new Tweak_registry();
 }
-
-
-LY_DEFINE(ly_clear_tweak_registry, "ly:tweak-clear-registry",
-         0,0,0,(),
-         "Clear global tweak registry"
-         )
-{
-  global_registry_->clear ();
-  return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE(ly_insert_tweak, "ly:insert-tweak",
-         2,0,0,
-         (SCM grob, SCM tweak),
-         "add new tweak for grob."
-         )
-{
-  Grob *gr = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(gr, grob, SCM_ARG1, __FUNCTION__, "Grob");
-  SCM_ASSERT_TYPE(scm_list_p (tweak) == SCM_BOOL_T
-                 && ly_c_procedure_p (scm_car (tweak)),
-                 tweak, SCM_ARG2, __FUNCTION__, "Tweak");
-  
-  global_registry_->insert_grob_tweak (gr, tweak);
-  return SCM_UNSPECIFIED;
-}
-
-
-LY_DEFINE(ly_tweak_read_keys, "ly:tweak-define-keys",
-         1,0,0,(SCM keys),
-         "Read keys"
-         )
-{
-  global_registry_->undumper ()->parse_contents (keys); 
-  return SCM_UNSPECIFIED;
-}
-
-
-LY_DEFINE(ly_all_tweaks, "ly:all-tweaks",
-         0,0,0,(),
-         "all tweaks"
-         )
-{
-  return global_registry_->list_tweaks();
-}
-
-
-LY_DEFINE(ly_tweak_read_tweaks, "ly:tweak-define-tweaks",
-         1,0,0,(SCM tweaks),
-         "Read  tweaks"
-         )
-{
-  for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
-    {
-      global_registry_->insert_tweak_from_file (scm_car (s));
-    }
-  return SCM_UNSPECIFIED;
-}