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 ());
}
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_;
}
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);
}
{
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);
}
void
Paper_outputter::close ()
{
- scm_close_port (file_);
+ if (scm_port_p (file_) == SCM_BOOL_T)
+ scm_close_port (file_);
}