2 paper-outputter.cc -- implement Paper_outputter
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "paper-outputter.hh"
17 #include "dimensions.hh"
18 #include "file-name.hh"
19 #include "font-metric.hh"
21 #include "lily-version.hh"
23 #include "output-def.hh"
24 #include "paper-book.hh"
25 #include "paper-system.hh"
26 #include "scm-hash.hh"
27 #include "string-convert.hh"
30 #include "ly-smobs.icc"
32 Paper_outputter::Paper_outputter (SCM port
, string format
)
35 output_module_
= SCM_EOL
;
38 string module_name
= "scm output-" + format
;
39 output_module_
= scm_c_resolve_module (module_name
.c_str ());
42 Paper_outputter::~Paper_outputter ()
46 IMPLEMENT_SMOBS (Paper_outputter
);
47 IMPLEMENT_DEFAULT_EQUAL_P (Paper_outputter
);
50 Paper_outputter::mark_smob (SCM x
)
52 Paper_outputter
*p
= (Paper_outputter
*) SCM_CELL_WORD_1 (x
);
53 scm_gc_mark (p
->output_module_
);
58 Paper_outputter::print_smob (SCM x
, SCM p
, scm_print_state
*)
61 scm_puts ("#<Paper_outputter>", p
);
66 Paper_outputter::file () const
72 Paper_outputter::dump_string (SCM scm
)
74 return scm_display (scm
, file ());
78 Paper_outputter::scheme_to_string (SCM scm
)
80 return scm_eval (scm
, output_module_
);
84 Paper_outputter::output_scheme (SCM scm
)
86 dump_string (scheme_to_string (scm
));
90 paper_outputter_dump (void *po
, SCM x
)
92 Paper_outputter
*me
= (Paper_outputter
*) po
;
93 me
->output_scheme (x
);
97 Paper_outputter::output_stencil (Stencil stil
)
99 interpret_stencil_expression (stil
.expr (), paper_outputter_dump
,
100 (void *) this, Offset (0, 0));
104 Paper_outputter::close ()
106 if (scm_port_p (file_
) == SCM_BOOL_T
)
107 scm_close_port (file_
);