1 /********************* */
4 ** Original author: Morgan Deters
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2014 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief Output utility classes and functions
14 ** Output utility classes and functions.
17 #include "base/output.h"
25 /* Definitions of the declared globals from output.h... */
27 null_streambuf null_sb
;
28 ostream
null_os(&null_sb
);
30 NullC nullCvc4Stream CVC4_PUBLIC
;
32 const std::string
CVC4ostream::s_tab
= " ";
33 const int CVC4ostream::s_indentIosIndex
= ios_base::xalloc();
35 DebugC DebugChannel
CVC4_PUBLIC (&cout
);
36 WarningC WarningChannel
CVC4_PUBLIC (&cerr
);
37 MessageC MessageChannel
CVC4_PUBLIC (&cout
);
38 NoticeC NoticeChannel
CVC4_PUBLIC (&null_os
);
39 ChatC ChatChannel
CVC4_PUBLIC (&null_os
);
40 TraceC TraceChannel
CVC4_PUBLIC (&cout
);
41 std::ostream
DumpOutC::dump_cout(cout
.rdbuf());// copy cout stream buffer
42 DumpOutC DumpOutChannel
CVC4_PUBLIC (&DumpOutC::dump_cout
);
46 # if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
48 int DebugC::printf(const char* tag
, const char* fmt
, ...) {
49 if(d_tags
.find(string(tag
)) == d_tags
.end()) {
53 // chop off output after 1024 bytes
57 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
63 int DebugC::printf(std::string tag
, const char* fmt
, ...) {
64 if(d_tags
.find(tag
) == d_tags
.end()) {
68 // chop off output after 1024 bytes
72 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
78 # endif /* CVC4_DEBUG && CVC4_TRACING */
80 int WarningC::printf(const char* fmt
, ...) {
81 // chop off output after 1024 bytes
85 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
91 int MessageC::printf(const char* fmt
, ...) {
92 // chop off output after 1024 bytes
96 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
102 int NoticeC::printf(const char* fmt
, ...) {
103 // chop off output after 1024 bytes
107 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
113 int ChatC::printf(const char* fmt
, ...) {
114 // chop off output after 1024 bytes
118 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
126 int TraceC::printf(const char* tag
, const char* fmt
, ...) {
127 if(d_tags
.find(string(tag
)) == d_tags
.end()) {
131 // chop off output after 1024 bytes
135 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
141 int TraceC::printf(std::string tag
, const char* fmt
, ...) {
142 if(d_tags
.find(tag
) == d_tags
.end()) {
146 // chop off output after 1024 bytes
150 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
156 # endif /* CVC4_TRACING */
160 int DumpOutC::printf(const char* tag
, const char* fmt
, ...) {
161 if(d_tags
.find(string(tag
)) == d_tags
.end()) {
165 // chop off output after 1024 bytes
169 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
175 int DumpOutC::printf(std::string tag
, const char* fmt
, ...) {
176 if(d_tags
.find(tag
) == d_tags
.end()) {
180 // chop off output after 1024 bytes
184 int retval
= vsnprintf(buf
, sizeof(buf
), fmt
, vl
);
190 # endif /* CVC4_DUMPING */
192 #endif /* ! CVC4_MUZZLE */
194 }/* CVC4 namespace */