Browse Source

lua_Chunkreader gets a lua_State, to avoid future incompatibilities

v5-2
Roberto Ierusalimschy 23 years ago
parent
commit
d3dd337fca
  1. 8
      lauxlib.c
  2. 4
      lua.h
  3. 4
      lzio.c

8
lauxlib.c

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.79 2002/08/05 17:36:24 roberto Exp roberto $
** $Id: lauxlib.c,v 1.80 2002/08/06 15:32:22 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -315,8 +315,9 @@ typedef struct LoadF {
} LoadF;
static const char *getF (void *ud, size_t *size) {
static const char *getF (lua_State *L, void *ud, size_t *size) {
LoadF *lf = (LoadF *)ud;
(void)L;
if (feof(lf->f)) return NULL;
*size = fread(lf->buff, 1, LUAL_BUFFERSIZE, lf->f);
return (*size > 0) ? lf->buff : NULL;
@ -365,8 +366,9 @@ typedef struct LoadS {
} LoadS;
static const char *getS (void *ud, size_t *size) {
static const char *getS (lua_State *L, void *ud, size_t *size) {
LoadS *ls = (LoadS *)ud;
(void)L;
if (ls->size == 0) return NULL;
*size = ls->size;
ls->size = 0;

4
lua.h

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.149 2002/08/06 15:32:22 roberto Exp roberto $
** $Id: lua.h,v 1.150 2002/08/06 17:06:56 roberto Exp roberto $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org
@ -54,7 +54,7 @@ typedef int (*lua_CFunction) (lua_State *L);
/*
** functions that read blocks when loading Lua chunk
*/
typedef const char * (*lua_Chunkreader) (void *ud, size_t *size);
typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *size);
/*

4
lzio.c

@ -1,5 +1,5 @@
/*
** $Id: lzio.c,v 1.19 2002/06/06 12:40:22 roberto Exp roberto $
** $Id: lzio.c,v 1.20 2002/08/05 18:45:02 roberto Exp roberto $
** a generic input stream interface
** See Copyright Notice in lua.h
*/
@ -16,7 +16,7 @@
int luaZ_fill (ZIO *z) {
size_t size;
const char *buff = z->reader(z->data, &size);
const char *buff = z->reader(NULL, z->data, &size);
if (buff == NULL || size == 0) return EOZ;
z->n = size - 1;
z->p = buff;

Loading…
Cancel
Save