summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua.stx16
-rw-r--r--opcode.c16
2 files changed, 18 insertions, 14 deletions
diff --git a/lua.stx b/lua.stx
index 75971a45..ceed9c4b 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 2.10 1994/10/17 19:05:32 celes Exp roberto $"; 3char *rcs_luastx = "$Id: lua.stx,v 2.11 1994/10/21 19:00:12 roberto Exp roberto $";
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
@@ -528,10 +528,8 @@ expr : '(' expr ')' { $$ = $2; }
528 528
529table : 529table :
530 { 530 {
531 code_byte(PUSHWORD);
532 $<vLong>$ = pc; code_word(0);
533 incr_ntemp();
534 code_byte(CREATEARRAY); 531 code_byte(CREATEARRAY);
532 $<vLong>$ = pc; code_word(0);
535 } 533 }
536 '{' fieldlist '}' 534 '{' fieldlist '}'
537 { 535 {
@@ -918,7 +916,15 @@ static void PrintCode (Byte *code, Byte *end)
918 printf ("%d ADJUST %d\n", p-code, *(++p)); 916 printf ("%d ADJUST %d\n", p-code, *(++p));
919 p++; 917 p++;
920 break; 918 break;
921 case CREATEARRAY: printf ("%d CREATEARRAY\n", (p++)-code); break; 919 case CREATEARRAY:
920 {
921 CodeWord c;
922 int n = p-code;
923 p++;
924 get_word(c,p);
925 printf ("%d CREATEARRAY\n", n, c.w);
926 break;
927 }
922 case EQOP: printf ("%d EQOP\n", (p++)-code); break; 928 case EQOP: printf ("%d EQOP\n", (p++)-code); break;
923 case LTOP: printf ("%d LTOP\n", (p++)-code); break; 929 case LTOP: printf ("%d LTOP\n", (p++)-code); break;
924 case LEOP: printf ("%d LEOP\n", (p++)-code); break; 930 case LEOP: printf ("%d LEOP\n", (p++)-code); break;
diff --git a/opcode.c b/opcode.c
index c356bde5..9531f558 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 2.10 1994/10/17 19:00:40 celes Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 2.11 1994/11/01 17:54:31 roberto Exp roberto $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <stdlib.h> 9#include <stdlib.h>
@@ -346,17 +346,15 @@ int lua_execute (Byte *pc)
346 break; 346 break;
347 347
348 case CREATEARRAY: 348 case CREATEARRAY:
349 if (tag(top-1) == T_NIL) 349 {
350 nvalue(top-1) = 1; 350 CodeWord size;
351 else 351 get_word(size,pc);
352 { 352 top++;
353 if (tonumber(top-1)) return 1; 353 avalue(top-1) = lua_createarray(size.w);
354 if (nvalue(top-1) <= 0) nvalue(top-1) = 1;
355 }
356 avalue(top-1) = lua_createarray(nvalue(top-1));
357 if (avalue(top-1) == NULL) 354 if (avalue(top-1) == NULL)
358 return 1; 355 return 1;
359 tag(top-1) = T_ARRAY; 356 tag(top-1) = T_ARRAY;
357 }
360 break; 358 break;
361 359
362 case EQOP: 360 case EQOP: