]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
release: 1.3.61
[lilypond.git] / lily / paper-outputter.cc
index 3e2bcaa7d267ac5c515cddab94dc55a96e9e3f60..832905198153213e79695361adfd1da07473e6e8 100644 (file)
@@ -13,7 +13,6 @@
 #include <iostream.h>
 
 #include "dimensions.hh"
-#include "dictionary-iter.hh"
 #include "virtual-methods.hh"
 #include "paper-outputter.hh"
 #include "paper-stream.hh"
 
 Paper_outputter::Paper_outputter (Paper_stream  * ps )
 {
-#if 0 
-  molecules_ = gh_cons (SCM_EOL, SCM_EOL);
-  last_cons_ = molecules_;
-#endif
-
  /*
    lilypond -f scm x.ly
    guile -s x.scm
@@ -124,28 +118,14 @@ Paper_outputter::output_comment (String str)
 void
 Paper_outputter::output_scheme (SCM scm)
 {
-#if 0
-  SCM c = gh_cons (scm,gh_cdr (last_cons_));
-  gh_set_cdr_x(last_cons_, c);
-  last_cons_ = c;
-#endif
-
+  /*
+    we don't rename dump_scheme, because we might in the future want
+    to remember Scheme. We don't now, because it sucks up a lot of memory.
+  */
   dump_scheme (scm);
 }
 
 
-#if 0
-void
-Paper_outputter::dump ()
-{
-
-  for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s))
-    {
-      dump_scheme (gh_car (s));
-    }
-}
-#endif
-
 void
 Paper_outputter::dump_scheme (SCM s)
 {
@@ -168,25 +148,25 @@ Paper_outputter::dump_scheme (SCM s)
 void
 Paper_outputter::output_scope (Scope *scope, String prefix)
 {
-  for (Scope_iter i (*scope); i.ok (); i++)
+  SCM al = scope->to_alist ();
+  for (SCM s = al ; gh_pair_p (s); s = gh_cdr (s))
     {
-      if (dynamic_cast<String_identifier*> (i.val ()))
-       {
-         String val = *i.val()->access_content_String (false);
+      SCM k = gh_caar (s);
+      SCM v = gh_cdar (s);
+      String s = ly_symbol2string (k);
 
-         output_String_def (prefix + i.key (), val);
+      
+      if (gh_string_p (v))
+       {
+         output_String_def (prefix + s, ly_scm2string (v));
        }
-      else if(dynamic_cast<Real_identifier*> (i.val ()))
+      else if (scm_integer_p (v) == SCM_BOOL_T)
        {
-         Real val  = *i.val ()->access_content_Real (false);
-
-         output_Real_def (prefix + i.key (), val);       
+         output_int_def (prefix + s, gh_scm2int (v));    
        }
-      else if (dynamic_cast<int_identifier*> (i.val ()))
+      else if (gh_number_p (v))
        {
-         int val  = *i.val ()->access_content_int (false);       
-         
-         output_int_def (prefix + i.key (), val);        
+         output_Real_def (prefix + s, gh_scm2double (v));        
        }
     }
 }