diff options
Diffstat (limited to 'lzio.c')
-rw-r--r-- | lzio.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lzio.c,v 1.16 2002/04/29 12:37:41 roberto Exp roberto $ | 2 | ** $Id: lzio.c,v 1.17 2002/06/03 17:46:34 roberto Exp roberto $ |
3 | ** a generic input stream interface | 3 | ** a generic input stream interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,6 +24,17 @@ int luaZ_fill (ZIO *z) { | |||
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | int luaZ_lookahead (ZIO *z) { | ||
28 | if (z->n == 0) { | ||
29 | int c = luaZ_fill(z); | ||
30 | if (c == EOZ) return c; | ||
31 | z->n++; | ||
32 | z->p--; | ||
33 | } | ||
34 | return *z->p; | ||
35 | } | ||
36 | |||
37 | |||
27 | void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name) { | 38 | void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name) { |
28 | z->getblock = getblock; | 39 | z->getblock = getblock; |
29 | z->ud = ud; | 40 | z->ud = ud; |