Eliminate stdostream (finally, that was awful.)
This commit is contained in:
@@ -66,35 +66,38 @@ static DrivenEngine *make_engine(std::string_view kind) {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The stdostream
|
||||
// A std::ostream that sends its output to a StreamBuffer.
|
||||
//
|
||||
// This is not currently used so it's commented out. But if it's
|
||||
// needed, it works fine: it can be ressurected.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class StreamBufferWriter : public std::streambuf, public eng::opnew {
|
||||
private:
|
||||
StreamBuffer *target_;
|
||||
public:
|
||||
StreamBufferWriter(StreamBuffer *t) : target_(t) {}
|
||||
// class StreamBufferWriter : public std::streambuf, public eng::opnew {
|
||||
// private:
|
||||
// StreamBuffer *target_;
|
||||
// public:
|
||||
// StreamBufferWriter(StreamBuffer *t) : target_(t) {}
|
||||
|
||||
virtual int_type overflow(int_type c) {
|
||||
if (c != EOF) {
|
||||
target_->write_uint8(c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
};
|
||||
// virtual int_type overflow(int_type c) {
|
||||
// if (c != EOF) {
|
||||
// target_->write_uint8(c);
|
||||
// }
|
||||
// return c;
|
||||
// }
|
||||
// };
|
||||
|
||||
class StreamBufferOStream : public std::ostream, public eng::opnew {
|
||||
private:
|
||||
StreamBufferWriter writer_;
|
||||
public:
|
||||
StreamBufferOStream(StreamBuffer *t) : std::ostream(nullptr), writer_(t) {
|
||||
rdbuf(&writer_);
|
||||
}
|
||||
virtual ~StreamBufferOStream() {
|
||||
}
|
||||
};
|
||||
// class StreamBufferOStream : public std::ostream, public eng::opnew {
|
||||
// private:
|
||||
// StreamBufferWriter writer_;
|
||||
// public:
|
||||
// StreamBufferOStream(StreamBuffer *t) : std::ostream(nullptr), writer_(t) {
|
||||
// rdbuf(&writer_);
|
||||
// }
|
||||
// virtual ~StreamBufferOStream() {
|
||||
// }
|
||||
// };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -186,7 +189,6 @@ void DrivenEngine::stop_driver() {
|
||||
DrivenEngine::DrivenEngine() {
|
||||
next_unused_chid_ = 1;
|
||||
stdio_channel_ = eng::make_shared<Channel>(this, 0, 0, "", false);
|
||||
stdostream_.reset(new StreamBufferOStream(stdio_channel_->out()));
|
||||
channels_[0] = stdio_channel_;
|
||||
rescan_lua_source_ = false;
|
||||
clock_ = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user