2 paper-outputter.cc -- implement Paper_outputter
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "paper-outputter.hh"
16 #include "dimensions.hh"
17 #include "file-name.hh"
18 #include "font-metric.hh"
19 #include "input-smob.hh"
20 #include "lily-version.hh"
22 #include "output-def.hh"
23 #include "paper-book.hh"
24 #include "paper-system.hh"
25 #include "scm-hash.hh"
26 #include "string-convert.hh"
29 #include "ly-smobs.icc"
31 Paper_outputter::Paper_outputter (SCM port, String format)
34 output_module_ = SCM_EOL;
37 String module_name = "scm output-" + format;
38 output_module_ = scm_c_resolve_module (module_name.to_str0 ());
41 Paper_outputter::~Paper_outputter ()
45 IMPLEMENT_SMOBS (Paper_outputter);
46 IMPLEMENT_DEFAULT_EQUAL_P (Paper_outputter);
49 Paper_outputter::mark_smob (SCM x)
51 Paper_outputter *p = (Paper_outputter *) SCM_CELL_WORD_1 (x);
52 scm_gc_mark (p->output_module_);
57 Paper_outputter::print_smob (SCM x, SCM p, scm_print_state*)
60 scm_puts ("#<Paper_outputter>", p);
65 Paper_outputter::file () const
71 Paper_outputter::dump_string (SCM scm)
73 return scm_display (scm, file ());
77 Paper_outputter::scheme_to_string (SCM scm)
79 return scm_eval (scm, output_module_);
83 Paper_outputter::output_scheme (SCM scm)
85 dump_string (scheme_to_string (scm));
89 paper_outputter_dump (void *po, SCM x)
91 Paper_outputter *me = (Paper_outputter *) po;
92 me->output_scheme (x);
96 Paper_outputter::output_stencil (Stencil stil)
98 interpret_stencil_expression (stil.expr (), paper_outputter_dump,
99 (void *) this, Offset (0, 0));
103 Paper_outputter::close ()
105 if (scm_port_p (file_) == SCM_BOOL_T)
106 scm_close_port (file_);