Browse Source

functions that no more return error codes now have return type void

Roberto Ierusalimschy 31 years ago
parent
commit
df3a81ec88
2 changed files with 26 additions and 37 deletions
  1. 10 10
      lua.h
  2. 16 27
      opcode.c

+ 10 - 10
lua.h

@@ -2,7 +2,7 @@
 ** LUA - Linguagem para Usuarios de Aplicacao
 ** Grupo de Tecnologia em Computacao Grafica
 ** TeCGraf - PUC-Rio
-** $Id: lua.h,v 3.12 1994/12/13 15:54:21 roberto Exp roberto $
+** $Id: lua.h,v 3.13 1994/12/16 15:55:55 roberto Exp roberto $
 */
 
 
@@ -49,18 +49,18 @@ char          *lua_getstring 		(lua_Object object);
 lua_CFunction  lua_getcfunction 	(lua_Object object);
 void          *lua_getuserdata  	(lua_Object object);
 
-int 	       lua_pushnil 		(void);
-int            lua_pushnumber 		(float n);
-int            lua_pushstring 		(char *s);
-int            lua_pushliteral 		(char *s);
-int            lua_pushcfunction	(lua_CFunction fn);
-int            lua_pushusertag     	(void *u, int tag);
-int            lua_pushobject       	(lua_Object object);
+void 	       lua_pushnil 		(void);
+void           lua_pushnumber 		(float n);
+void           lua_pushstring 		(char *s);
+void           lua_pushliteral 		(char *s);
+void           lua_pushcfunction	(lua_CFunction fn);
+void           lua_pushusertag     	(void *u, int tag);
+void           lua_pushobject       	(lua_Object object);
 
 lua_Object     lua_getglobal 		(char *name);
-int            lua_storeglobal		(char *name);
+void           lua_storeglobal		(char *name);
 
-int            lua_storesubscript	(void);
+void           lua_storesubscript	(void);
 lua_Object     lua_getsubscript         (void);
 
 int            lua_type 		(lua_Object object);

+ 16 - 27
opcode.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 */
 
-char *rcs_opcode="$Id: opcode.c,v 3.28 1994/12/20 21:20:36 roberto Exp celes $";
+char *rcs_opcode="$Id: opcode.c,v 3.29 1994/12/27 20:53:15 celes Exp roberto $";
 
 #include <setjmp.h>
 #include <stdio.h>
@@ -479,11 +479,10 @@ void lua_endblock (void)
 /* 
 ** API: receives on the stack the table, the index, and the new value.
 */
-int lua_storesubscript (void)
+void lua_storesubscript (void)
 {
   adjustC(3);
   storesubscript();
-  return 0;
 }
 
 /*
@@ -584,90 +583,80 @@ lua_Object lua_getglobal (char *name)
 
 /*
 ** Store top of the stack at a global variable array field.
-** Return 1 on error, 0 on success.
 */
-int lua_storeglobal (char *name)
+void lua_storeglobal (char *name)
 {
  Word n = luaI_findsymbolbyname(name);
  adjustC(1);
  s_object(n) = *(--top);
- return 0;
 }
 
 /*
 ** Push a nil object
 */
-int lua_pushnil (void)
+void lua_pushnil (void)
 {
  lua_checkstack(top-stack+1);
  tag(top++) = LUA_T_NIL;
- return 0;
 }
 
 /*
-** Push an object (tag=number) to stack. Return 0 on success or 1 on error.
+** Push an object (tag=number) to stack.
 */
-int lua_pushnumber (real n)
+void lua_pushnumber (real n)
 {
  lua_checkstack(top-stack+1);
  tag(top) = LUA_T_NUMBER; nvalue(top++) = n;
- return 0;
 }
 
 /*
-** Push an object (tag=string) to stack. Return 0 on success or 1 on error.
+** Push an object (tag=string) to stack.
 */
-int lua_pushstring (char *s)
+void lua_pushstring (char *s)
 {
  lua_checkstack(top-stack+1);
  tsvalue(top) = lua_createstring(s);
  tag(top) = LUA_T_STRING;
  top++;
- return 0;
 }
 
 /*
 ** Push an object (tag=string) on stack and register it on the constant table.
-   Return 0 on success or 1 on error.
 */
-int lua_pushliteral (char *s)
+void lua_pushliteral (char *s)
 {
  lua_checkstack(top-stack+1);
  tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))];
  tag(top) = LUA_T_STRING;
  top++;
- return 0;
 }
 
 /*
-** Push an object (tag=cfunction) to stack. Return 0 on success or 1 on error.
+** Push an object (tag=cfunction) to stack.
 */
-int lua_pushcfunction (lua_CFunction fn)
+void lua_pushcfunction (lua_CFunction fn)
 {
  lua_checkstack(top-stack+1);
  tag(top) = LUA_T_CFUNCTION; fvalue(top++) = fn;
- return 0;
 }
 
 /*
-** Push an object (tag=userdata) to stack. Return 0 on success or 1 on error.
+** Push an object (tag=userdata) to stack.
 */
-int lua_pushusertag (void *u, int tag)
+void lua_pushusertag (void *u, int tag)
 {
+ if (tag < LUA_T_USERDATA) return;
  lua_checkstack(top-stack+1);
- if (tag < LUA_T_USERDATA) return 1;
  tag(top) = tag; uvalue(top++) = u;
- return 0;
 }
 
 /*
 ** Push a lua_Object to stack.
 */
-int lua_pushobject (lua_Object o)
+void lua_pushobject (lua_Object o)
 {
  lua_checkstack(top-stack+1);
  *top++ = *Address(o);
- return 0;
 }
 
 /*
@@ -681,7 +670,7 @@ void luaI_pushobject (Object *o)
 
 int lua_type (lua_Object o)
 {
-  if (o == 0)
+  if (o == LUA_NOOBJECT)
     return LUA_T_NIL;
   else
     return tag(Address(o));