// File : mstream.h   
// Header file for using the MDA output stream, mout.

#ifndef __MSTREAM_H
#define __MSTREAM_H

#include <iostream.h>    // for ostream class
#include <strstrea.h>    // for streambuf class
#include <_defs.h>       // for _CLASSDEF and _CLASSTYPE

_CLASSDEF(mstreambuf)    // create typedefs for the class
class _CLASSTYPE mstreambuf : public streambuf
{
    private:
        static unsigned int far* screen;  // monochrome memory area pointer
        static int column;                // current column position
      static int row;                     // current row position
        void newline();                   // generates a new line on monitor
    public:
        mstreambuf(char* s, int n);
        ~mstreambuf();
        virtual int sync();               // Empties the put area
        virtual int overflow(int);        // Also empties the put area
};

_CLASSDEF(mstream)       // create typedefs for the class
class _CLASSTYPE mstream : public ostream
{
    private:
        enum {bsize=128};                 // stream buffer size
        char msgs[bsize];                 // stream buffer
        Pmstreambuf strbuf;               // pointer to mstreambuf
    public:
        mstream();
        ~mstream();
};

extern mstream mout;                      // reference to global instance

#endif    // End of File : MSTREAM.H   


