lua_Reference is int, so say so.

This commit is contained in:
Roberto Ierusalimschy 1996-04-25 11:10:00 -03:00
parent 25116a3065
commit bced00ab9e
5 changed files with 18 additions and 20 deletions

View File

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_fallback="$Id: fallback.c,v 1.23 1996/03/21 16:31:32 roberto Exp roberto $"; char *rcs_fallback="$Id: fallback.c,v 1.24 1996/04/22 18:00:37 roberto Exp roberto $";
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -122,7 +122,7 @@ static struct ref {
} *refArray = NULL; } *refArray = NULL;
static int refSize = 0; static int refSize = 0;
lua_Reference luaI_ref (Object *object, int lock) int luaI_ref (Object *object, int lock)
{ {
int i; int i;
int oldSize; int oldSize;
@ -144,14 +144,14 @@ lua_Reference luaI_ref (Object *object, int lock)
} }
void lua_unref (lua_Reference ref) void lua_unref (int ref)
{ {
if (ref >= 0 && ref < refSize) if (ref >= 0 && ref < refSize)
refArray[ref].status = FREE; refArray[ref].status = FREE;
} }
Object *luaI_getref (lua_Reference ref) Object *luaI_getref (int ref)
{ {
static Object nul = {LUA_T_NIL, {0}}; static Object nul = {LUA_T_NIL, {0}};
if (ref == -1) if (ref == -1)

View File

@ -1,5 +1,5 @@
/* /*
** $Id: fallback.h,v 1.11 1996/01/30 15:25:23 roberto Exp roberto $ ** $Id: fallback.h,v 1.12 1996/04/22 18:00:37 roberto Exp roberto $
*/ */
#ifndef fallback_h #ifndef fallback_h
@ -27,8 +27,8 @@ extern struct FB {
#define FB_GETGLOBAL 9 #define FB_GETGLOBAL 9
void luaI_setfallback (void); void luaI_setfallback (void);
lua_Reference luaI_ref (Object *object, int lock); int luaI_ref (Object *object, int lock);
Object *luaI_getref (lua_Reference ref); Object *luaI_getref (int ref);
void luaI_travlock (int (*fn)(Object *)); void luaI_travlock (int (*fn)(Object *));
void luaI_invalidaterefs (void); void luaI_invalidaterefs (void);
char *luaI_travfallbacks (int (*fn)(Object *)); char *luaI_travfallbacks (int (*fn)(Object *));

12
lua.h
View File

@ -2,7 +2,7 @@
** LUA - Linguagem para Usuarios de Aplicacao ** LUA - Linguagem para Usuarios de Aplicacao
** Grupo de Tecnologia em Computacao Grafica ** Grupo de Tecnologia em Computacao Grafica
** TeCGraf - PUC-Rio ** TeCGraf - PUC-Rio
** $Id: lua.h,v 3.25 1996/03/21 21:30:29 roberto Exp roberto $ ** $Id: lua.h,v 3.26 1996/04/22 18:00:37 roberto Exp roberto $
*/ */
@ -81,12 +81,10 @@ lua_Object lua_getsubscript (void);
int lua_type (lua_Object object); int lua_type (lua_Object object);
typedef int lua_Reference; int lua_ref (int lock);
lua_Object lua_getref (int ref);
lua_Reference lua_ref (int lock); void lua_pushref (int ref);
lua_Object lua_getref (lua_Reference ref); void lua_unref (int ref);
void lua_pushref (lua_Reference ref);
void lua_unref (lua_Reference ref);
lua_Object lua_createtable (void); lua_Object lua_createtable (void);

View File

@ -3,7 +3,7 @@
** Mathematics library to LUA ** Mathematics library to LUA
*/ */
char *rcs_mathlib="$Id: mathlib.c,v 1.14 1996/02/09 17:21:27 roberto Exp roberto $"; char *rcs_mathlib="$Id: mathlib.c,v 1.15 1996/04/22 18:00:37 roberto Exp roberto $";
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
@ -104,7 +104,7 @@ static void math_sqrt (void)
lua_pushnumber (sqrt(d)); lua_pushnumber (sqrt(d));
} }
static lua_Reference old_pow; static int old_pow;
static void math_pow (void) static void math_pow (void)
{ {

View File

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_opcode="$Id: opcode.c,v 3.66 1996/03/22 19:12:15 roberto Exp roberto $"; char *rcs_opcode="$Id: opcode.c,v 3.67 1996/04/22 18:00:37 roberto Exp roberto $";
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
@ -717,7 +717,7 @@ void *lua_getuserdata (lua_Object object)
} }
lua_Object lua_getref (lua_Reference ref) lua_Object lua_getref (int ref)
{ {
Object *o = luaI_getref(ref); Object *o = luaI_getref(ref);
if (o == NULL) if (o == NULL)
@ -729,7 +729,7 @@ lua_Object lua_getref (lua_Reference ref)
} }
void lua_pushref (lua_Reference ref) void lua_pushref (int ref)
{ {
Object *o = luaI_getref(ref); Object *o = luaI_getref(ref);
if (o == NULL) if (o == NULL)
@ -738,7 +738,7 @@ void lua_pushref (lua_Reference ref)
} }
lua_Reference lua_ref (int lock) int lua_ref (int lock)
{ {
adjustC(1); adjustC(1);
return luaI_ref(--top, lock); return luaI_ref(--top, lock);