lua/lzio.h

45 lines
836 B
C
Raw Normal View History

1997-06-16 09:50:22 -07:00
/*
** $Id: lzio.h,v 1.9 2002/04/29 12:37:41 roberto Exp roberto $
1997-09-16 12:25:59 -07:00
** Buffered streams
** See Copyright Notice in lua.h
1997-06-16 09:50:22 -07:00
*/
1997-09-16 12:25:59 -07:00
#ifndef lzio_h
#define lzio_h
1997-06-16 09:50:22 -07:00
#include "lua.h"
/* For Lua only */
#define zread luaZ_zread
1997-06-16 09:50:22 -07:00
#define EOZ (-1) /* end of stream */
typedef struct zio ZIO;
#define zgetc(z) (((z)->n--)>0 ? \
cast(int, cast(unsigned char, *(z)->p++)) : \
luaZ_fill(z))
1997-06-18 14:39:56 -07:00
1997-12-22 12:57:18 -08:00
#define zname(z) ((z)->name)
1997-06-16 09:50:22 -07:00
void luaZ_init (ZIO *z, lua_Getblock getblock, void *ud, const char *name);
size_t luaZ_zread (ZIO* z, void* b, size_t n); /* read next n bytes */
1997-06-16 09:50:22 -07:00
2000-10-20 09:36:32 -07:00
1997-06-16 09:50:22 -07:00
/* --------- Private Part ------------------ */
struct zio {
size_t n; /* bytes still unread */
const char *p; /* current position in buffer */
lua_Getblock getblock;
void* ud; /* additional data */
1999-08-16 13:52:00 -07:00
const char *name;
1997-06-16 09:50:22 -07:00
};
int luaZ_fill (ZIO *z);
1997-06-16 09:50:22 -07:00
#endif