Browse Source

lua_lock receives its parameter via stack

Roberto Ierusalimschy 31 years ago
parent
commit
333a4f13d0
3 changed files with 9 additions and 8 deletions
  1. 5 5
      fallback.c
  2. 2 1
      fallback.h
  3. 2 2
      mathlib.c

+ 5 - 5
fallback.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 ** TecCGraf - PUC-Rio
 */
 */
  
  
-char *rcs_fallback="$Id: fallback.c,v 1.5 1994/11/10 17:36:54 roberto Exp roberto $";
+char *rcs_fallback="$Id: fallback.c,v 1.6 1994/11/16 17:38:08 roberto Exp roberto $";
 
 
 #include <stdio.h>
 #include <stdio.h>
  
  
@@ -112,16 +112,16 @@ static void GDFB (void) { }
 static Object *lockArray = NULL;
 static Object *lockArray = NULL;
 static int lockSize = 0;
 static int lockSize = 0;
 
 
-int lua_lock (lua_Object object)
+int luaI_lock (Object *object)
 {
 {
   int i;
   int i;
   int oldSize;
   int oldSize;
-  if (lua_isnil(object))
+  if (tag(object) == LUA_T_NIL)
     return -1;
     return -1;
   for (i=0; i<lockSize; i++)
   for (i=0; i<lockSize; i++)
     if (tag(&lockArray[i]) == LUA_T_NIL)
     if (tag(&lockArray[i]) == LUA_T_NIL)
     {
     {
-      lockArray[i] = *luaI_Address(object);
+      lockArray[i] = *object;
       return i;
       return i;
     }
     }
   /* no more empty spaces */
   /* no more empty spaces */
@@ -138,7 +138,7 @@ int lua_lock (lua_Object object)
   }
   }
   for (i=oldSize; i<lockSize; i++)
   for (i=oldSize; i<lockSize; i++)
     tag(&lockArray[i]) = LUA_T_NIL;
     tag(&lockArray[i]) = LUA_T_NIL;
-  lockArray[oldSize] = *luaI_Address(object);
+  lockArray[oldSize] = *object;
   return oldSize;
   return oldSize;
 }
 }
 
 

+ 2 - 1
fallback.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: fallback.h,v 1.3 1994/11/10 17:11:52 roberto Exp roberto $
+** $Id: fallback.h,v 1.4 1994/11/10 17:36:54 roberto Exp roberto $
 */
 */
  
  
 #ifndef fallback_h
 #ifndef fallback_h
@@ -23,6 +23,7 @@ extern struct FB {
 #define FB_GC 8
 #define FB_GC 8
 
 
 void luaI_setfallback (void);
 void luaI_setfallback (void);
+int luaI_lock (Object *object);
 Object *luaI_getlocked (int ref);
 Object *luaI_getlocked (int ref);
 void luaI_travlock (void (*fn)(Object *));
 void luaI_travlock (void (*fn)(Object *));
 
 

+ 2 - 2
mathlib.c

@@ -3,7 +3,7 @@
 ** Mathematics library to LUA
 ** Mathematics library to LUA
 */
 */
 
 
-char *rcs_mathlib="$Id: mathlib.c,v 1.4 1994/10/11 13:06:47 celes Exp roberto $";
+char *rcs_mathlib="$Id: mathlib.c,v 1.5 1994/11/17 19:43:34 roberto Exp roberto $";
 
 
 #include <stdio.h>		/* NULL */
 #include <stdio.h>		/* NULL */
 #include <math.h>
 #include <math.h>
@@ -310,5 +310,5 @@ void mathlib_open (void)
  lua_register ("exp",   math_exp);
  lua_register ("exp",   math_exp);
  lua_register ("deg",   math_deg);
  lua_register ("deg",   math_deg);
  lua_register ("rad",   math_rad);
  lua_register ("rad",   math_rad);
- old_pow = lua_lock(lua_setfallback("arith", math_pow));
+ old_pow = lua_lockobject(lua_setfallback("arith", math_pow));
 }
 }