aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/cfile.h
blob: 57ff38831cdc72b59635a7040549ef3e04a4ef4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef		__CFILE__
#define		__CFILE__

#include	<general.h>
#include	<io.h>


#define		LINE_MAX	512

#ifndef		IOBUF_SIZE
  #define	IOBUF_SIZE	K(2)
#endif

#define		CFREAD(x)	Read((byte far *)(x),sizeof(*(x)))




class IOBUF : public IOHAND
{
protected:
  byte far * Buff;
  word Ptr, Lim;
  long BufMark;
  word Seed;
  CRYPT * Crypt;
  virtual void ReadBuff (void);
  virtual void WriteBuff (void);
public:
  IOBUF (IOMODE mode, CRYPT * crpt = NULL);
  IOBUF (const char * name, IOMODE mode, CRYPT * crpt = NULL);
  virtual ~IOBUF (void);
  word Read (void far * buf, word len);
  word Read (char far * buf);
  int Read (void);
  word Write (void far * buf, word len);
  word Write (byte far * buf);
  void Write (byte b);
};



class CFILE : public IOBUF
{
public:
  static word MaxLineLen;
  CFILE (const char near * name, IOMODE mode = REA, CRYPT * crpt = NULL);
  virtual ~CFILE (void);
  void Flush (void);
  long Mark (void);
  long Seek (long pos);
  void Append (CFILE& f);
};


#endif