]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / paper-outputter.cc
index 7976b17a478963f3443f67ef2acff220e99617a9..23e5f9cfc62c7f61091a9c4afbdef1ef0ae82024 100644 (file)
@@ -7,37 +7,34 @@
                  Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include <math.h>
-#include <time.h>
+#include "paper-outputter.hh"
+
+#include <cmath>
+#include <ctime>
 
-#include "array.hh"
 #include "dimensions.hh"
 #include "file-name.hh"
 #include "font-metric.hh"
 #include "input-smob.hh"
-#include "lily-guile.hh"
 #include "lily-version.hh"
 #include "ly-module.hh"
 #include "main.hh"
 #include "output-def.hh"
 #include "paper-book.hh"
-#include "paper-outputter.hh"
 #include "paper-system.hh"
 #include "scm-hash.hh"
-#include "stencil.hh"
 #include "string-convert.hh"
 #include "warn.hh"
 
 #include "ly-smobs.icc"
 
-
-Paper_outputter::Paper_outputter (String filename, String format)
+Paper_outputter::Paper_outputter (String file_name, String format)
 {
   file_ = SCM_EOL;
   output_module_ = SCM_EOL;
   smobify_self ();
   
-  filename_ = filename;
+  file_name_ = file_name;
   String module_name = "scm output-" + format;
   output_module_ = scm_c_resolve_module (module_name.to_str0 ());
 }
@@ -70,8 +67,11 @@ SCM
 Paper_outputter::file ()
 {
   if (file_ == SCM_EOL)
-    file_ = scm_open_file (scm_makfrom0str (filename_.to_str0 ()),
-                          scm_makfrom0str ("w"));
+    if (file_name_ == "-")
+      file_ = scm_current_output_port();
+    else
+      file_ = scm_open_file (scm_makfrom0str (file_name_.to_str0 ()),
+                            scm_makfrom0str ("w"));
   return file_;
 }
 
@@ -110,8 +110,9 @@ Paper_outputter::output_stencil (Stencil stil)
 Paper_outputter *
 get_paper_outputter (String outname, String f) 
 {
-  progress_indication (_f ("paper output to `%s'...",
+  progress_indication (_f ("Layout output to `%s'...",
                           outname == "-" ? String ("<stdout>") : outname));
+  progress_indication ("\n");
   return new Paper_outputter (outname, f);
 }
 
@@ -134,7 +135,7 @@ LY_DEFINE (ly_outputter_dump_string, "ly:outputter-dump-string",
 {
   Paper_outputter *po = unsmob_outputter (outputter);
   SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
-  SCM_ASSERT_TYPE (ly_c_string_p (str), str, SCM_ARG1, __FUNCTION__, "Paper_outputter");
+  SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "Paper_outputter");
   
   return po->dump_string (str);
 }
@@ -142,5 +143,6 @@ LY_DEFINE (ly_outputter_dump_string, "ly:outputter-dump-string",
 void
 Paper_outputter::close ()
 {
-  scm_close_port (file_);
+  if (scm_port_p (file_) == SCM_BOOL_T)
+    scm_close_port (file_);
 }