2 tex-stream.cc -- implement Tex_stream
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
15 #include "tex-stream.hh"
18 const int MAXLINELEN = 200;
20 Tex_stream::Tex_stream (String filename)
22 os = new ofstream (filename.ch_C ());
24 error (_("can't open `") + filename+"\'");
27 outputting_comment=false;
33 *os << _("% Creator: ") << get_version_str() << "\n";
34 *os << _("% Automatically generated, at ");
36 *os << ctime (&t)<<"\n";
38 Tex_stream::~Tex_stream()
43 warning(_("error syncing file (disk full?)"));
47 assert (nest_level == 0);
50 // print string. don't forget indent.
52 Tex_stream::operator<<(String s)
55 for (char const *cp = s.ch_C (); *cp; cp++)
57 if (outputting_comment)
62 outputting_comment=false;
71 outputting_comment = true;
84 delete os; // we want to see the remains.
85 assert (nest_level>=0);
94 if (line_len_i_ > MAXLINELEN)
107 Tex_stream::break_line()
110 *os << String (' ', nest_level);