diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-12-28 10:55:47 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-12-28 10:55:47 -0200 |
| commit | df3a81ec88cdab5afca66e550c9bd768c21963e2 (patch) | |
| tree | 4241b194d250d78ee5a18de51bce4a00e1c188f9 /opcode.c | |
| parent | b8e76d9b5c86182998c0616627607181154a60b1 (diff) | |
| download | lua-df3a81ec88cdab5afca66e550c9bd768c21963e2.tar.gz lua-df3a81ec88cdab5afca66e550c9bd768c21963e2.tar.bz2 lua-df3a81ec88cdab5afca66e550c9bd768c21963e2.zip | |
functions that no more return error codes now have return type void
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 43 |
1 files changed, 16 insertions, 27 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 3.28 1994/12/20 21:20:36 roberto Exp celes $"; | 6 | char *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 | */ |
| 482 | int lua_storesubscript (void) | 482 | void 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 | */ |
| 589 | int lua_storeglobal (char *name) | 587 | void 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 | */ |
| 600 | int lua_pushnil (void) | 597 | void 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 | */ |
| 610 | int lua_pushnumber (real n) | 606 | void 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 | */ |
| 620 | int lua_pushstring (char *s) | 615 | void 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 | */ |
| 633 | int lua_pushliteral (char *s) | 626 | void 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 | */ |
| 645 | int lua_pushcfunction (lua_CFunction fn) | 637 | void 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 | */ |
| 655 | int lua_pushusertag (void *u, int tag) | 646 | void 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 | */ |
| 666 | int lua_pushobject (lua_Object o) | 656 | void 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 | ||
| 682 | int lua_type (lua_Object o) | 671 | int 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)); |
