2 paper-outputter.cc -- implement Paper_outputter
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "dimensions.hh"
14 #include "virtual-methods.hh"
15 #include "paper-outputter.hh"
18 #include "string-convert.hh"
20 #include "font-metric.hh"
22 #include "scm-hash.hh"
23 #include "lily-version.hh"
24 #include "paper-def.hh"
25 #include "input-file-results.hh"
26 #include "ly-modules.hh"
29 Paper_outputter::Paper_outputter (String name)
33 gh_define ("security-paranoia", SCM_BOOL_T);
36 file_ = scm_open_file (scm_makfrom0str (name.to_str0 ()),
37 scm_makfrom0str ("w"));
39 static SCM find_dumper;
41 find_dumper = scm_c_eval_string ("find-dumper");
44 output_func_ = scm_call_1 (find_dumper,scm_makfrom0str (output_format_global.to_str0 ()));
45 output_scheme (gh_cons (ly_symbol2scm ("top-of-file"), SCM_EOL));
48 Paper_outputter::~Paper_outputter ()
50 scm_close_port (file_);
55 Paper_outputter::output_scheme (SCM scm)
57 gh_call2 (output_func_, scm, file_);
61 Paper_outputter::output_metadata (SCM scopes, Paper_def *paper)
64 for (int i = dump_header_fieldnames_global.size (); i--; )
65 fields = gh_cons (ly_symbol2scm (dump_header_fieldnames_global[i].to_str0 ()),
68 output_scheme (scm_list_n (ly_symbol2scm ("output-scopes"),
70 scm_list_n (ly_symbol2scm ("quote"),
71 scopes, SCM_UNDEFINED),
72 scm_list_n (ly_symbol2scm ("quote"),
73 fields, SCM_UNDEFINED),
74 scm_makfrom0str (basename_.to_str0 ()),
80 Paper_outputter::output_music_output_def (Music_output_def* odef)
82 output_scheme (scm_list_n (ly_symbol2scm ("output-paper-def"),
83 odef->self_scm (), SCM_UNDEFINED));