]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
release: 1.2.0
[lilypond.git] / lily / paper-outputter.cc
index 308c07734d1b784cf41961abbb4df748c5d59c0c..564314efd1d6ce825b4fe5ec7a1d9736666d8599 100644 (file)
@@ -30,12 +30,25 @@ Paper_outputter::Paper_outputter (Paper_stream *s)
 {
   outstream_l_ = s;
   output_header ();
+
+  if (output_global_ch == String ("scm"))
+    *outstream_l_->os << ""
+      "(primitive-load-path 'lily.scm)\n"
+      "(eval (tex-scm 'all-definitions))\n"
+      ";(eval (ps-scm 'all-definitions))\n"
+      "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n"
+    ;
 }
 
 Paper_outputter::~Paper_outputter ()
 {
   SCM scm = gh_list (ly_symbol ("end-output"), SCM_UNDEFINED);
   output_scheme (scm);
+
+  if (String (output_global_ch) == "scm")
+    {
+      *outstream_l_->os << ")))";
+    }
 }
 
 void
@@ -47,7 +60,7 @@ Paper_outputter::output_header ()
       //      gh_eval_str ("(set! security-paranoia #t)");
     }
   String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))";
-  gh_eval_str (s.ch_C());
+  gh_eval_str (s.ch_C ());
   
   String creator;
   if (no_timestamps_global_b)
@@ -103,6 +116,9 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
     {
       Atom * i = ptr->car_;
 #endif
+#if 0
+    }
+#endif      
       Offset a_off = i->off_;
       a_off += o;
 
@@ -111,7 +127,7 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
 
       if (a_off.length () > 100 CM)
        {
-         warning (_f("Improbable dimension for object type `%s\'", nm));
+         warning (_f("Improbable offset for object type `%s\'", nm));
          Axis a  =X_AXIS;
          while (a < NO_AXES)
            {
@@ -125,6 +141,7 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
        {
          output_scheme (gh_list (ly_symbol ("select-font"),
                                  gh_str02scm (symbol_to_string (i->font_).ch_C()),
+                                 SCM (i->magn_),
                                  SCM_UNDEFINED));
        }
 
@@ -158,24 +175,8 @@ Paper_outputter::output_scheme (SCM scm)
 {
   if (String (output_global_ch) == "scm")
     {
-      static SCM port = 0;
-
-      // urg
-      if (!port)
-        {
-         int fd = 1;
-         ofstream * of = dynamic_cast<ofstream*> (outstream_l_->os);
-         if (of)
-           fd = of->rdbuf()->fd();
-         FILE *file = fdopen (fd, "a");
-         port = scm_standard_stream_to_port (file, "a", "");
-         scm_display (gh_str02scm ("(load 'lily.scm)\n"), port);
-       }
-
-      scm_display (gh_str02scm ("("), port);
-      scm_write (scm, port);
-      scm_display (gh_str02scm (")\n"),port);
-      scm_fflush (port);
+      SCM result =  scm_eval (scm_listify (ly_symbol ("scm->string"), ly_quote_scm (scm), SCM_UNDEFINED));
+    *outstream_l_->os << ly_scm2string (result)        << endl;
     }
   else
     {
@@ -292,3 +293,10 @@ Paper_outputter::stop_line ()
   SCM scm = gh_list (ly_symbol ("stop-line"), SCM_UNDEFINED);
   output_scheme (scm);
 }
+
+void
+Paper_outputter::stop_last_line ()
+{
+  SCM scm = gh_list (ly_symbol ("stop-last-line"), SCM_UNDEFINED);
+  output_scheme (scm);
+}