diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-07-09 12:50:51 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-07-09 12:50:51 -0300 |
commit | b08c9079c5ab026f07942fb898f791325d270177 (patch) | |
tree | 8252b2f5b1eb75abc678ab4deead8faf218b9322 /ltests.c | |
parent | 06e08c6d05b1346df935634be395f4d86035e3ea (diff) | |
download | lua-b08c9079c5ab026f07942fb898f791325d270177.tar.gz lua-b08c9079c5ab026f07942fb898f791325d270177.tar.bz2 lua-b08c9079c5ab026f07942fb898f791325d270177.zip |
Opcode names moved to a new header file
The array with the names of the opcodes was moved to a header file
('lopnames.h'), as it is not used by the Lua kernel. Files that need
that array ('luac.c' and 'ltests.c') include the header file to get
a private (static) copy.
Diffstat (limited to '')
-rw-r--r-- | ltests.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.244 2018/06/11 14:19:50 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.246 2018/06/26 18:00:55 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -27,6 +27,7 @@ | |||
27 | #include "lfunc.h" | 27 | #include "lfunc.h" |
28 | #include "lmem.h" | 28 | #include "lmem.h" |
29 | #include "lopcodes.h" | 29 | #include "lopcodes.h" |
30 | #include "lopnames.h" | ||
30 | #include "lstate.h" | 31 | #include "lstate.h" |
31 | #include "lstring.h" | 32 | #include "lstring.h" |
32 | #include "ltable.h" | 33 | #include "ltable.h" |
@@ -523,7 +524,7 @@ int lua_checkmemory (lua_State *L) { | |||
523 | static char *buildop (Proto *p, int pc, char *buff) { | 524 | static char *buildop (Proto *p, int pc, char *buff) { |
524 | Instruction i = p->code[pc]; | 525 | Instruction i = p->code[pc]; |
525 | OpCode o = GET_OPCODE(i); | 526 | OpCode o = GET_OPCODE(i); |
526 | const char *name = luaP_opnames[o]; | 527 | const char *name = opnames[o]; |
527 | int line = luaG_getfuncline(p, pc); | 528 | int line = luaG_getfuncline(p, pc); |
528 | sprintf(buff, "(%4d) %4d - ", line, pc); | 529 | sprintf(buff, "(%4d) %4d - ", line, pc); |
529 | switch (getOpMode(o)) { | 530 | switch (getOpMode(o)) { |
@@ -599,7 +600,7 @@ static int printcode (lua_State *L) { | |||
599 | printf("numparams: %d\n", p->numparams); | 600 | printf("numparams: %d\n", p->numparams); |
600 | for (pc=0; pc<p->sizecode; pc++) { | 601 | for (pc=0; pc<p->sizecode; pc++) { |
601 | char buff[100]; | 602 | char buff[100]; |
602 | printf("%d\t%s\n", pc + 1, buildop(p, pc, buff)); | 603 | printf("%s\n", buildop(p, pc, buff)); |
603 | } | 604 | } |
604 | return 0; | 605 | return 0; |
605 | } | 606 | } |