]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/property-engraver.cc
release: 1.5.19
[lilypond.git] / lily / property-engraver.cc
index 4ece8f391927ecc1ceb4b71c40fad3eedd5d9584..25ca3af774e08250cd6f5def1705b46791754dd4 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -31,19 +31,18 @@ protected:
   virtual void initialize ();
   virtual void finalize ();
 public:
-  ~Property_engraver();
-  Property_engraver();
-  VIRTUAL_COPY_CONS(Translator);
+  ~Property_engraver ();
+  TRANSLATOR_DECLARATIONS(Property_engraver);
 };
 
 
 
-Property_engraver::Property_engraver()
+Property_engraver::Property_engraver ()
 {
   prop_dict_ = 0;
 }
 void
-Property_engraver::finalize()
+Property_engraver::finalize ()
 {
   
 }
@@ -51,7 +50,7 @@ Property_engraver::finalize()
 Property_engraver::~Property_engraver ()
 {
   if (prop_dict_)
-    scm_unprotect_object (prop_dict_->self_scm ());
+    scm_gc_unprotect_object (prop_dict_->self_scm ());
 }
 
 void
@@ -59,30 +58,30 @@ Property_engraver::initialize ()
 {
   prop_dict_ = new Scheme_hash_table;
 
-  SCM plist = get_property (ly_symbol2scm ("Generic_property_list"));
-  for (; gh_pair_p (plist); plist = gh_cdr (plist))
+  SCM plist = get_property ("Generic_property_list");
+  for (; gh_pair_p (plist); plist = ly_cdr (plist))
     {
-      SCM elt_props = gh_car (plist);
-      prop_dict_->set (gh_car (elt_props), gh_cdr (elt_props));
+      SCM elt_props = ly_car (plist);
+      prop_dict_->set (ly_car (elt_props), ly_cdr (elt_props));
     }
 }
 
 void
 Property_engraver::acknowledge_grob (Grob_info i)
 {
- SCM ifs = i.elem_l_->get_grob_property ("interfaces");
+ SCM ifs = i.grob_l_->get_grob_property ("interfaces");
   SCM props;
-  for (; gh_pair_p (ifs); ifs = gh_cdr (ifs))
+  for (; gh_pair_p (ifs); ifs = ly_cdr (ifs))
     {      
-      if (prop_dict_->try_retrieve (gh_car (ifs), &props))
+      if (prop_dict_->try_retrieve (ly_car (ifs), &props))
        {
-         apply_properties (props,i.elem_l_, i.origin_trans_l_->daddy_trans_l_);
+         apply_properties (props,i.grob_l_, i.origin_trans_l_->daddy_trans_l_);
        }
     }
 
   if (prop_dict_->try_retrieve (ly_symbol2scm ("all"), &props))
     {
-      apply_properties (props, i.elem_l_, i.origin_trans_l_->daddy_trans_l_);
+      apply_properties (props, i.grob_l_, i.origin_trans_l_->daddy_trans_l_);
     }
 }
 
@@ -90,7 +89,7 @@ Property_engraver::acknowledge_grob (Grob_info i)
 void
 Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin)
 {
-  for (; gh_pair_p (p); p = gh_cdr (p))
+  for (; gh_pair_p (p); p = ly_cdr (p))
     {
       /*
        Try each property in order; earlier descriptions take
@@ -98,30 +97,30 @@ Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin)
        they're already set.
       */
       
-      SCM entry = gh_car (p);
-      SCM prop_sym = gh_car (entry);
-      SCM type_p   = gh_cadr (entry);
-      SCM elt_prop_sym = gh_caddr (entry);
+      SCM entry = ly_car (p);
+      SCM prop_sym = ly_car (entry);
+      SCM type_p   = ly_cadr (entry);
+      SCM elt_prop_sym = ly_caddr (entry);
 
-      SCM preset = scm_assq(elt_prop_sym, e->mutable_property_alist_);
+      SCM preset = scm_assq (elt_prop_sym, e->mutable_property_alist_);
       if (preset != SCM_BOOL_F)
        continue;
   
-      SCM val = get_property (prop_sym);
+      SCM val = internal_get_property (prop_sym);
 
       if (val == SCM_EOL)
        ;                       // Not defined in context.
-      else if (gh_apply (type_p, scm_listify (val, SCM_UNDEFINED))
+      else if (gh_apply (type_p, scm_list_n (val, SCM_UNDEFINED))
               == SCM_BOOL_T)   // defined and  right type: do it
        {
-         e->set_grob_property (elt_prop_sym, val);
+         e->internal_set_grob_property (elt_prop_sym, val);
 
          SCM meta = e->get_grob_property ("meta");
          SCM name = scm_assoc (ly_symbol2scm ("name"), meta);
-         warning (_f ("%s is deprecated.  Use\n \\property %s.%s \\override #'%s = #%s",
+         warning (_f ("`%s' is deprecated.  Use\n \\property %s.%s \\override #'%s = #%s",
                       ly_symbol2string (prop_sym).ch_C (),
                       origin->type_str_.ch_C (),
-                      ly_scm2string (gh_cdr (name)).ch_C (),
+                      ly_scm2string (ly_cdr (name)).ch_C (),
                       ly_symbol2string (elt_prop_sym).ch_C (),
                       ly_scm2string (ly_write2scm (val)).ch_C ()));
        }
@@ -140,7 +139,7 @@ Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin)
        if (val != SCM_EOL)
          {                     // not the right type: error message.
            SCM errport = scm_current_error_port ();
-           SCM typefunc = scm_eval2 (ly_symbol2scm ("type-name"), SCM_EOL);
+           SCM typefunc = scm_primitive_eval (ly_symbol2scm ("type-name"));
            SCM type_name = gh_call1 (typefunc, type_p);
            warning (_f ("Wrong type for property: %s, type: %s, value found: %s, type: %s",
                         ly_symbol2string (prop_sym).ch_C (),
@@ -152,4 +151,14 @@ Property_engraver::apply_properties (SCM p, Grob *e, Translator_group*origin)
     }
 }
 
-ADD_THIS_TRANSLATOR(Property_engraver);
+
+ENTER_DESCRIPTION(Property_engraver,
+/* descr */       "This is a engraver that converts property settings into
+back-end grob-property settings. Example: Voice.stemLength will set
+#'length in all Stem objects.
+
+Due to CPU and memory requirements, the use of this engraver is deprecated.",
+/* creats*/       "",
+/* acks  */       "grob-interface",
+/* reads */       "Generic_property_list",
+/* write */       "");