]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
release: 1.1.51
[lilypond.git] / lily / paper-outputter.cc
index 308c07734d1b784cf41961abbb4df748c5d59c0c..1df5d85a38a85637893ab26dd1dc40063e5fe05a 100644 (file)
@@ -30,12 +30,24 @@ 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 +59,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)
@@ -111,7 +123,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)
            {
@@ -158,24 +170,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 +288,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);
+}