aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Celes <celes@tecgraf.puc-rio.br>1994-04-15 18:30:12 -0300
committerWaldemar Celes <celes@tecgraf.puc-rio.br>1994-04-15 18:30:12 -0300
commit3ee5e71d0b8cda5e24fe3645baf26d3b97c86022 (patch)
treee2807d48695e050333d606e1f83f07b1af225fb5
parentc77d27afa2d66b1d3e979664fdea51f664d9690a (diff)
downloadlua-3ee5e71d0b8cda5e24fe3645baf26d3b97c86022.tar.gz
lua-3ee5e71d0b8cda5e24fe3645baf26d3b97c86022.tar.bz2
lua-3ee5e71d0b8cda5e24fe3645baf26d3b97c86022.zip
Correcao da funcao PrintCode
-rw-r--r--lua.stx33
1 files changed, 28 insertions, 5 deletions
diff --git a/lua.stx b/lua.stx
index 2b663e06..9dca9e76 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 1.6 1994/04/13 21:37:20 celes Exp celes $"; 3char *rcs_luastx = "$Id: lua.stx,v 2.1 1994/04/15 19:02:04 celes Exp celes $";
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
@@ -14,7 +14,7 @@ char *rcs_luastx = "$Id: lua.stx,v 1.6 1994/04/13 21:37:20 celes Exp celes $";
14#include "table.h" 14#include "table.h"
15#include "lua.h" 15#include "lua.h"
16 16
17#define LISTING 0 17#define LISTING 1
18 18
19#ifndef MAXCODE 19#ifndef MAXCODE
20#define MAXCODE 1024 20#define MAXCODE 1024
@@ -219,9 +219,6 @@ functionlist : /* empty */
219 | functionlist { pc=basepc=maincode; nlocalvar=0;} stat sc 219 | functionlist { pc=basepc=maincode; nlocalvar=0;} stat sc
220 { 220 {
221 maincode=pc; 221 maincode=pc;
222#if LISTING
223 PrintCode(basepc,maincode,(Byte*)mainbuffer);
224#endif
225 } 222 }
226 | functionlist function 223 | functionlist function
227 | functionlist setdebug 224 | functionlist setdebug
@@ -705,6 +702,9 @@ int lua_parse (void)
705 err = 0; 702 err = 0;
706 if (yyparse () || (err==1)) return 1; 703 if (yyparse () || (err==1)) return 1;
707 *maincode++ = HALT; 704 *maincode++ = HALT;
705#if LISTING
706 PrintCode(basepc,maincode,(Byte*)mainbuffer);
707#endif
708 if (lua_execute (initcode)) return 1; 708 if (lua_execute (initcode)) return 1;
709 maincode = initcode; 709 maincode = initcode;
710 return 0; 710 return 0;
@@ -887,6 +887,29 @@ static void PrintCode (Byte *p, Byte *end, Byte *code)
887 printf ("%d RETCODE %d\n", p-code, *(++p)); 887 printf ("%d RETCODE %d\n", p-code, *(++p));
888 p++; 888 p++;
889 break; 889 break;
890 case HALT: printf ("%d HALT\n", (p++)-code); break;
891 case SETFUNCTION:
892 {
893 CodeWord c1, c2;
894 int n = p-code;
895 p++;
896 get_word(c1,p);
897 get_word(c2,p);
898 printf ("%d SETFUNCTION %d %d\n", n, c1.w, c2.w);
899 }
900 break;
901 case SETLINE:
902 {
903 CodeWord c;
904 int n = p-code;
905 p++;
906 get_word(c,p);
907 printf ("%d SETLINE %d\n", n, c.w);
908 }
909 break;
910
911 case RESET: printf ("%d RESET\n", (p++)-code); break;
912
890 default: printf ("%d Cannot happen: code %d\n", (p++)-code, *(p-1)); break; 913 default: printf ("%d Cannot happen: code %d\n", (p++)-code, *(p-1)); break;
891 } 914 }
892 } 915 }