Files
scummvm/engine/lua/lzio.h
T
Pawel Kolodziejski 198249fdf4 formating code
2008-07-29 14:57:13 +00:00

46 lines
794 B
C++

/*
** $Id$
** Buffered streams
** See Copyright Notice in lua.h
*/
#ifndef lzio_h
#define lzio_h
#include <common/sys.h>
namespace Common {
class File;
}
// For Lua only
#define zopen luaZ_mopen
#define EOZ (-1) // end of stream
typedef struct zio ZIO;
ZIO *zopen(ZIO *z, const char *b, int32 size, const char *name);
int32 zread(ZIO *z, void *b, int32 n); // read next n bytes
int32 zgeteoz(ZIO *);
#define zgetc(z) (--(z)->n >= 0 ? ((int32)*(z)->p++): zgeteoz(z))
#define zungetc(z) (++(z)->n, --(z)->p)
#define zname(z) ((z)->name)
// --------- Private Part ------------------
#define ZBSIZE 256 // buffer size
struct zio {
int32 n; // bytes still unread
const byte *p; // current position in buffer
const char *name;
byte buffer[ZBSIZE]; // buffer
};
#endif