2018-02-22 19:38:27 +00:00
|
|
|
#ifndef __KF_IO_H__
|
|
|
|
#define __KF_IO_H__
|
|
|
|
|
|
|
|
#include "defs.h"
|
2018-02-28 03:59:29 +00:00
|
|
|
#include "stack.h"
|
2018-02-22 19:38:27 +00:00
|
|
|
|
|
|
|
class IO {
|
|
|
|
public:
|
|
|
|
// Virtual destructor is required in all ABCs.
|
|
|
|
virtual ~IO() {};
|
|
|
|
|
|
|
|
// Building block methods.
|
|
|
|
virtual char rdch(void) = 0;
|
|
|
|
virtual void wrch(char c) = 0;
|
|
|
|
|
|
|
|
// Buffer I/O.
|
|
|
|
virtual size_t rdbuf(char *buf, size_t len, bool stopat, char stopch) = 0;
|
|
|
|
virtual void wrbuf(char *buf, size_t len) = 0;
|
|
|
|
|
|
|
|
// Line I/O
|
|
|
|
virtual bool rdln(char *buf, size_t len, size_t *readlen) = 0;
|
|
|
|
virtual void wrln(char *buf, size_t len) = 0;
|
2018-02-28 03:59:29 +00:00
|
|
|
|
|
|
|
virtual void newline(void) = 0;
|
2018-02-22 19:38:27 +00:00
|
|
|
};
|
|
|
|
|
2018-02-25 06:35:58 +00:00
|
|
|
void write_num(IO *, KF_INT);
|
2018-03-01 00:44:43 +00:00
|
|
|
void write_dnum(IO *, KF_LONG);
|
2018-02-28 03:59:29 +00:00
|
|
|
void write_dstack(IO *, Stack<KF_INT>);
|
2018-02-24 03:19:29 +00:00
|
|
|
|
|
|
|
|
2018-02-22 19:38:27 +00:00
|
|
|
#endif // __KF_IO_H__
|