diff options
author | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
commit | 75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch) | |
tree | f29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/sword25/util/pluto/pdep/lzio.h | |
parent | 48ee83b88957dab86bc763e9ef21a70179fa8679 (diff) | |
parent | e9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff) | |
download | scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2 scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip |
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend
changes into the branch. I suppose the gp2x backend and probably all new
backends, i.e. gph, dingux etc., might not compile anymore.
Since I have no way of testing those it would be nice if porters could look
into getting those up to speed in this branch.
svn-id: r53399
Diffstat (limited to 'engines/sword25/util/pluto/pdep/lzio.h')
-rw-r--r-- | engines/sword25/util/pluto/pdep/lzio.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/engines/sword25/util/pluto/pdep/lzio.h b/engines/sword25/util/pluto/pdep/lzio.h new file mode 100644 index 0000000000..4e654a52c9 --- /dev/null +++ b/engines/sword25/util/pluto/pdep/lzio.h @@ -0,0 +1,65 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : pdep_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define pdep_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define pdep_buffer(buff) ((buff)->buffer) +#define pdep_sizebuffer(buff) ((buff)->buffsize) +#define pdep_bufflen(buff) ((buff)->n) + +#define pdep_resetbuffer(buff) ((buff)->n = 0) + + +#define pdep_resizebuffer(L, buff, size) \ + (pdep_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define pdep_freebuffer(L, buff) pdep_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *pdep_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void pdep_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t pdep_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int pdep_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int pdep_fill (ZIO *z); + +#endif |