aboutsummaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'opcode.c')
-rw-r--r--opcode.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/opcode.c b/opcode.c
index 92b88c83..d1869654 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.16 1994/11/17 19:43:34 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.17 1994/11/17 21:23:43 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -436,21 +436,33 @@ lua_Object lua_getsubscript (void)
436 return 0; 436 return 0;
437} 437}
438 438
439
440#define MAX_C_BLOCKS 10
441
442static int numCblocks = 0;
443static int Cblocks[MAX_C_BLOCKS];
444
439/* 445/*
440** API: starts a new block 446** API: starts a new block
441*/ 447*/
442int lua_beginblock (void) 448void lua_beginblock (void)
443{ 449{
444 return CBase; 450 if (numCblocks < MAX_C_BLOCKS)
451 Cblocks[numCblocks] = CBase;
452 numCblocks++;
445} 453}
446 454
447/* 455/*
448** API: ends a block 456** API: ends a block
449*/ 457*/
450void lua_endblock (int block) 458void lua_endblock (void)
451{ 459{
452 CBase = block; 460 --numCblocks;
453 adjustC(0); 461 if (numCblocks < MAX_C_BLOCKS)
462 {
463 CBase = Cblocks[numCblocks];
464 adjustC(0);
465 }
454} 466}
455 467
456/* 468/*
@@ -468,7 +480,7 @@ int lua_storesubscript (void)
468/* 480/*
469** API: creates a new table 481** API: creates a new table
470*/ 482*/
471lua_Object lua_createTable (int initSize) 483lua_Object lua_createtable (int initSize)
472{ 484{
473 adjustC(0); 485 adjustC(0);
474 avalue(top) = lua_createarray(initSize); 486 avalue(top) = lua_createarray(initSize);
@@ -550,6 +562,14 @@ lua_Object lua_getlocked (int ref)
550 return Ref(top-1); 562 return Ref(top-1);
551} 563}
552 564
565
566int lua_lock (void)
567{
568 adjustC(1);
569 return luaI_lock(--top);
570}
571
572
553/* 573/*
554** Get a global object. Return the object handle or NULL on error. 574** Get a global object. Return the object handle or NULL on error.
555*/ 575*/