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>
10 make an abstract interface to output, operations:
12 move (x,y), put (symbol).
20 #include "tex-stream.hh"
23 const int MAXLINELEN = 200;
25 Tex_stream::Tex_stream (String filename)
27 os = new ofstream (filename);
29 error ("can't open `" + filename+"\'");
32 outputting_comment=false;
38 *os << "% Creator: " << get_version_str() << "\n";
39 *os << "% Automatically generated, at ";
41 *os << ctime (&t)<<"\n";
43 Tex_stream::~Tex_stream()
46 assert (nest_level == 0);
49 // print string. don't forget indent.
51 Tex_stream::operator<<(String s)
54 for (char const *cp = s; *cp; cp++)
56 if (outputting_comment)
61 outputting_comment=false;
70 outputting_comment = true;
83 delete os; // we want to see the remains.
84 assert (nest_level>=0);
93 if (line_len_i_ > MAXLINELEN)
106 Tex_stream::break_line()
109 *os << String (' ', nest_level);
113 /* *************************************************************** */