aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-28 10:55:47 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-28 10:55:47 -0200
commitdf3a81ec88cdab5afca66e550c9bd768c21963e2 (patch)
tree4241b194d250d78ee5a18de51bce4a00e1c188f9
parentb8e76d9b5c86182998c0616627607181154a60b1 (diff)
downloadlua-df3a81ec88cdab5afca66e550c9bd768c21963e2.tar.gz
lua-df3a81ec88cdab5afca66e550c9bd768c21963e2.tar.bz2
lua-df3a81ec88cdab5afca66e550c9bd768c21963e2.zip
functions that no more return error codes now have return type void
-rw-r--r--lua.h20
-rw-r--r--opcode.c43
2 files changed, 26 insertions, 37 deletions
diff --git a/lua.h b/lua.h
index 8aba1579..dd368d67 100644
--- a/lua.h
+++ b/lua.h
@@ -2,7 +2,7 @@
2** LUA - Linguagem para Usuarios de Aplicacao 2** LUA - Linguagem para Usuarios de Aplicacao
3** Grupo de Tecnologia em Computacao Grafica 3** Grupo de Tecnologia em Computacao Grafica
4** TeCGraf - PUC-Rio 4** TeCGraf - PUC-Rio
5** $Id: lua.h,v 3.12 1994/12/13 15:54:21 roberto Exp roberto $ 5** $Id: lua.h,v 3.13 1994/12/16 15:55:55 roberto Exp roberto $
6*/ 6*/
7 7
8 8
@@ -49,18 +49,18 @@ char *lua_getstring (lua_Object object);
49lua_CFunction lua_getcfunction (lua_Object object); 49lua_CFunction lua_getcfunction (lua_Object object);
50void *lua_getuserdata (lua_Object object); 50void *lua_getuserdata (lua_Object object);
51 51
52int lua_pushnil (void); 52void lua_pushnil (void);
53int lua_pushnumber (float n); 53void lua_pushnumber (float n);
54int lua_pushstring (char *s); 54void lua_pushstring (char *s);
55int lua_pushliteral (char *s); 55void lua_pushliteral (char *s);
56int lua_pushcfunction (lua_CFunction fn); 56void lua_pushcfunction (lua_CFunction fn);
57int lua_pushusertag (void *u, int tag); 57void lua_pushusertag (void *u, int tag);
58int lua_pushobject (lua_Object object); 58void lua_pushobject (lua_Object object);
59 59
60lua_Object lua_getglobal (char *name); 60lua_Object lua_getglobal (char *name);
61int lua_storeglobal (char *name); 61void lua_storeglobal (char *name);
62 62
63int lua_storesubscript (void); 63void lua_storesubscript (void);
64lua_Object lua_getsubscript (void); 64lua_Object lua_getsubscript (void);
65 65
66int lua_type (lua_Object object); 66int lua_type (lua_Object object);
diff --git a/opcode.c b/opcode.c
index f1d021f7..25485101 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.28 1994/12/20 21:20:36 roberto Exp celes $"; 6char *rcs_opcode="$Id: opcode.c,v 3.29 1994/12/27 20:53:15 celes Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -479,11 +479,10 @@ void lua_endblock (void)
479/* 479/*
480** API: receives on the stack the table, the index, and the new value. 480** API: receives on the stack the table, the index, and the new value.
481*/ 481*/
482int lua_storesubscript (void) 482void lua_storesubscript (void)
483{ 483{
484 adjustC(3); 484 adjustC(3);
485 storesubscript(); 485 storesubscript();
486 return 0;
487} 486}
488 487
489/* 488/*
@@ -584,90 +583,80 @@ lua_Object lua_getglobal (char *name)
584 583
585/* 584/*
586** Store top of the stack at a global variable array field. 585** Store top of the stack at a global variable array field.
587** Return 1 on error, 0 on success.
588*/ 586*/
589int lua_storeglobal (char *name) 587void lua_storeglobal (char *name)
590{ 588{
591 Word n = luaI_findsymbolbyname(name); 589 Word n = luaI_findsymbolbyname(name);
592 adjustC(1); 590 adjustC(1);
593 s_object(n) = *(--top); 591 s_object(n) = *(--top);
594 return 0;
595} 592}
596 593
597/* 594/*
598** Push a nil object 595** Push a nil object
599*/ 596*/
600int lua_pushnil (void) 597void lua_pushnil (void)
601{ 598{
602 lua_checkstack(top-stack+1); 599 lua_checkstack(top-stack+1);
603 tag(top++) = LUA_T_NIL; 600 tag(top++) = LUA_T_NIL;
604 return 0;
605} 601}
606 602
607/* 603/*
608** Push an object (tag=number) to stack. Return 0 on success or 1 on error. 604** Push an object (tag=number) to stack.
609*/ 605*/
610int lua_pushnumber (real n) 606void lua_pushnumber (real n)
611{ 607{
612 lua_checkstack(top-stack+1); 608 lua_checkstack(top-stack+1);
613 tag(top) = LUA_T_NUMBER; nvalue(top++) = n; 609 tag(top) = LUA_T_NUMBER; nvalue(top++) = n;
614 return 0;
615} 610}
616 611
617/* 612/*
618** Push an object (tag=string) to stack. Return 0 on success or 1 on error. 613** Push an object (tag=string) to stack.
619*/ 614*/
620int lua_pushstring (char *s) 615void lua_pushstring (char *s)
621{ 616{
622 lua_checkstack(top-stack+1); 617 lua_checkstack(top-stack+1);
623 tsvalue(top) = lua_createstring(s); 618 tsvalue(top) = lua_createstring(s);
624 tag(top) = LUA_T_STRING; 619 tag(top) = LUA_T_STRING;
625 top++; 620 top++;
626 return 0;
627} 621}
628 622
629/* 623/*
630** Push an object (tag=string) on stack and register it on the constant table. 624** Push an object (tag=string) on stack and register it on the constant table.
631 Return 0 on success or 1 on error.
632*/ 625*/
633int lua_pushliteral (char *s) 626void lua_pushliteral (char *s)
634{ 627{
635 lua_checkstack(top-stack+1); 628 lua_checkstack(top-stack+1);
636 tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))]; 629 tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))];
637 tag(top) = LUA_T_STRING; 630 tag(top) = LUA_T_STRING;
638 top++; 631 top++;
639 return 0;
640} 632}
641 633
642/* 634/*
643** Push an object (tag=cfunction) to stack. Return 0 on success or 1 on error. 635** Push an object (tag=cfunction) to stack.
644*/ 636*/
645int lua_pushcfunction (lua_CFunction fn) 637void lua_pushcfunction (lua_CFunction fn)
646{ 638{
647 lua_checkstack(top-stack+1); 639 lua_checkstack(top-stack+1);
648 tag(top) = LUA_T_CFUNCTION; fvalue(top++) = fn; 640 tag(top) = LUA_T_CFUNCTION; fvalue(top++) = fn;
649 return 0;
650} 641}
651 642
652/* 643/*
653** Push an object (tag=userdata) to stack. Return 0 on success or 1 on error. 644** Push an object (tag=userdata) to stack.
654*/ 645*/
655int lua_pushusertag (void *u, int tag) 646void lua_pushusertag (void *u, int tag)
656{ 647{
648 if (tag < LUA_T_USERDATA) return;
657 lua_checkstack(top-stack+1); 649 lua_checkstack(top-stack+1);
658 if (tag < LUA_T_USERDATA) return 1;
659 tag(top) = tag; uvalue(top++) = u; 650 tag(top) = tag; uvalue(top++) = u;
660 return 0;
661} 651}
662 652
663/* 653/*
664** Push a lua_Object to stack. 654** Push a lua_Object to stack.
665*/ 655*/
666int lua_pushobject (lua_Object o) 656void lua_pushobject (lua_Object o)
667{ 657{
668 lua_checkstack(top-stack+1); 658 lua_checkstack(top-stack+1);
669 *top++ = *Address(o); 659 *top++ = *Address(o);
670 return 0;
671} 660}
672 661
673/* 662/*
@@ -681,7 +670,7 @@ void luaI_pushobject (Object *o)
681 670
682int lua_type (lua_Object o) 671int lua_type (lua_Object o)
683{ 672{
684 if (o == 0) 673 if (o == LUA_NOOBJECT)
685 return LUA_T_NIL; 674 return LUA_T_NIL;
686 else 675 else
687 return tag(Address(o)); 676 return tag(Address(o));