ScummVM API documentation
lzio.h
1 /*
2 ** Buffered streams
3 ** See Copyright Notice in lua.h
4 */
5 
6 
7 #ifndef GRIM_LZIO_H
8 #define GRIM_LZIO_H
9 
10 #include "common/scummsys.h"
11 
12 namespace Common {
13  class File;
14 }
15 
16 namespace Grim {
17 
18 // For Lua only
19 #define zopen luaZ_mopen
20 
21 #define EOZ (-1) // end of stream
22 
23 typedef struct zio ZIO;
24 
25 ZIO *zopen(ZIO *z, const char *b, int32 size, const char *name);
26 int32 zread(ZIO *z, void *b, int32 n); // read next n bytes
27 int32 zgeteoz(ZIO *);
28 
29 #define zgetc(z) (--(z)->n >= 0 ? ((int32)*(z)->p++): zgeteoz(z))
30 #define zungetc(z) (++(z)->n, --(z)->p)
31 #define zname(z) ((z)->name)
32 
33 
34 // --------- Private Part ------------------
35 
36 #define ZBSIZE 256 // buffer size
37 
38 struct zio {
39  int32 n; // bytes still unread
40  const byte *p; // current position in buffer
41  const char *name;
42  byte buffer[ZBSIZE]; // buffer
43 };
44 
45 } // end of namespace Grim
46 
47 #endif
Definition: lzio.h:38
Definition: actor.h:33
Definition: algorithm.h:29
Definition: lzio.h:56