new API function lua_pushlocked & lua_checkstack is a macro

This commit is contained in:
Waldemar Celes
1995-01-27 15:19:06 -02:00
parent f83db16cab
commit 8795aab83e

View File

@@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_opcode="$Id: opcode.c,v 3.30 1994/12/28 12:55:47 roberto Exp roberto $"; char *rcs_opcode="$Id: opcode.c,v 3.31 1994/12/30 17:45:11 roberto Exp celes $";
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
@@ -96,9 +96,9 @@ static void lua_initstack (void)
/* /*
** Check stack overflow and, if necessary, realloc vector ** Check stack overflow and, if necessary, realloc vector
*/ */
static void lua_checkstack (StkId n) #define lua_checkstack(n) if ((Long)(n) > maxstack) checkstack(n)
{
if ((Long)n > maxstack) static void checkstack (StkId n)
{ {
StkId t; StkId t;
if (stack == NULL) if (stack == NULL)
@@ -112,7 +112,6 @@ static void lua_checkstack (StkId n)
stack = growvector(stack, maxstack, Object); stack = growvector(stack, maxstack, Object);
top = stack + t; top = stack + t;
} }
}
/* /*
@@ -565,6 +564,14 @@ lua_Object lua_getlocked (int ref)
} }
void lua_pushlocked (int ref)
{
lua_checkstack(top-stack+1);
*top = *luaI_getlocked(ref);
top++;
}
int lua_lock (void) int lua_lock (void)
{ {
adjustC(1); adjustC(1);