2 tex-stream.cc -- implement Tex_stream
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
14 #include "tex-stream.hh"
17 const int MAXLINELEN
= 200;
19 Tex_stream::Tex_stream(String filename
)
21 os
= new ofstream(filename
);
23 error("can't open `" + filename
+"\'");
26 outputting_comment
=false;
32 *os
<< "% Creator: " << get_version_str();
33 *os
<< "% Automatically generated, at ";
35 *os
<< ctime(&t
)<<"\n";
37 Tex_stream::~Tex_stream()
40 assert(nest_level
== 0);
43 // print string. don't forget indent.
45 Tex_stream::operator<<(String s
)
48 for (char const *cp
= s
; *cp
; cp
++) {
49 if (outputting_comment
) {
52 outputting_comment
=false;
61 outputting_comment
= true;
73 delete os
; // we want to see the remains.
74 assert(nest_level
>=0);
83 if (line_len_i_
> MAXLINELEN
)
96 Tex_stream::break_line()
99 *os
<< String(' ', nest_level
);
103 /* *************************************************************** */