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++) {
55 if (outputting_comment) {
58 outputting_comment=false;
67 outputting_comment = true;
79 delete os; // we want to see the remains.
80 assert(nest_level>=0);
89 if (line_len_i_ > MAXLINELEN)
102 Tex_stream::break_line()
105 *os << String(' ', nest_level);
109 /* *************************************************************** */