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

This commit is contained in:
Roberto Ierusalimschy
1994-12-28 10:55:47 -02:00
parent b8e76d9b5c
commit df3a81ec88
2 changed files with 26 additions and 37 deletions

20
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.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); lua_CFunction lua_getcfunction (lua_Object object);
void *lua_getuserdata (lua_Object object); void *lua_getuserdata (lua_Object object);
int lua_pushnil (void); void lua_pushnil (void);
int lua_pushnumber (float n); void lua_pushnumber (float n);
int lua_pushstring (char *s); void lua_pushstring (char *s);
int lua_pushliteral (char *s); void lua_pushliteral (char *s);
int lua_pushcfunction (lua_CFunction fn); void lua_pushcfunction (lua_CFunction fn);
int lua_pushusertag (void *u, int tag); void lua_pushusertag (void *u, int tag);
int lua_pushobject (lua_Object object); void lua_pushobject (lua_Object object);
lua_Object lua_getglobal (char *name); 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); lua_Object lua_getsubscript (void);
int lua_type (lua_Object object); int lua_type (lua_Object object);

View File

@@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** 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 <setjmp.h>
#include <stdio.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. ** API: receives on the stack the table, the index, and the new value.
*/ */
int lua_storesubscript (void) void lua_storesubscript (void)
{ {
adjustC(3); adjustC(3);
storesubscript(); storesubscript();
return 0;
} }
/* /*
@@ -584,90 +583,80 @@ lua_Object lua_getglobal (char *name)
/* /*
** Store top of the stack at a global variable array field. ** 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); Word n = luaI_findsymbolbyname(name);
adjustC(1); adjustC(1);
s_object(n) = *(--top); s_object(n) = *(--top);
return 0;
} }
/* /*
** Push a nil object ** Push a nil object
*/ */
int lua_pushnil (void) void lua_pushnil (void)
{ {
lua_checkstack(top-stack+1); lua_checkstack(top-stack+1);
tag(top++) = LUA_T_NIL; 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); lua_checkstack(top-stack+1);
tag(top) = LUA_T_NUMBER; nvalue(top++) = n; 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); lua_checkstack(top-stack+1);
tsvalue(top) = lua_createstring(s); tsvalue(top) = lua_createstring(s);
tag(top) = LUA_T_STRING; tag(top) = LUA_T_STRING;
top++; top++;
return 0;
} }
/* /*
** Push an object (tag=string) on stack and register it on the constant table. ** 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); lua_checkstack(top-stack+1);
tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))]; tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))];
tag(top) = LUA_T_STRING; tag(top) = LUA_T_STRING;
top++; 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); lua_checkstack(top-stack+1);
tag(top) = LUA_T_CFUNCTION; fvalue(top++) = fn; 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); lua_checkstack(top-stack+1);
if (tag < LUA_T_USERDATA) return 1;
tag(top) = tag; uvalue(top++) = u; tag(top) = tag; uvalue(top++) = u;
return 0;
} }
/* /*
** Push a lua_Object to stack. ** Push a lua_Object to stack.
*/ */
int lua_pushobject (lua_Object o) void lua_pushobject (lua_Object o)
{ {
lua_checkstack(top-stack+1); lua_checkstack(top-stack+1);
*top++ = *Address(o); *top++ = *Address(o);
return 0;
} }
/* /*
@@ -681,7 +670,7 @@ void luaI_pushobject (Object *o)
int lua_type (lua_Object o) int lua_type (lua_Object o)
{ {
if (o == 0) if (o == LUA_NOOBJECT)
return LUA_T_NIL; return LUA_T_NIL;
else else
return tag(Address(o)); return tag(Address(o));