]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-outputter.cc
* lily/paper-outputter.cc (file): New method.
[lilypond.git] / lily / paper-outputter.cc
index 163673e31ec62cd0b907f408daf4b2d5d112d714..bb9c3812cf8ed9138793f8a04dcc8f1efdaf3c48 100644 (file)
@@ -38,9 +38,6 @@ Paper_outputter::Paper_outputter (String filename, String format)
   smobify_self ();
   
   filename_ = filename;
-  file_ = scm_open_file (scm_makfrom0str (filename.to_str0 ()),
-                        scm_makfrom0str ("w"));
-
   String module_name = "scm output-" + format;
   output_module_ = scm_c_resolve_module (module_name.to_str0 ());
 }
@@ -69,10 +66,19 @@ Paper_outputter::print_smob (SCM x, SCM p, scm_print_state*)
   return 1;
 }
 
+SCM
+Paper_outputter::file ()
+{
+  if (file_ == SCM_EOL)
+    file_ = scm_open_file (scm_makfrom0str (filename_.to_str0 ()),
+                          scm_makfrom0str ("w"));
+  return file_;
+}
+
 SCM
 Paper_outputter::dump_string (SCM scm)
 {
-  return scm_display (scm, file_);
+  return scm_display (scm, file ());
 }
 
 SCM
@@ -101,7 +107,6 @@ Paper_outputter::output_stencil (Stencil stil)
                                 (void*) this, Offset (0,0));
 }
 
-
 Paper_outputter *
 get_paper_outputter (String outname, String f) 
 {