avoid names that differ only in capitalization
This commit is contained in:
34
lcode.c
34
lcode.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lcode.c,v 1.95 2002/04/09 18:49:30 roberto Exp roberto $
|
||||
** $Id: lcode.c,v 1.96 2002/04/22 14:37:09 roberto Exp roberto $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ void luaK_nil (FuncState *fs, int from, int n) {
|
||||
|
||||
|
||||
int luaK_jump (FuncState *fs) {
|
||||
int j = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP);
|
||||
int j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
|
||||
if (j == fs->lasttarget) { /* possible jumps to this jump? */
|
||||
luaK_concat(fs, &j, fs->jlt); /* keep them on hold */
|
||||
fs->jlt = NO_JUMP;
|
||||
@@ -56,19 +56,19 @@ int luaK_jump (FuncState *fs) {
|
||||
|
||||
static int luaK_condjump (FuncState *fs, OpCode op, int A, int B, int C) {
|
||||
luaK_codeABC(fs, op, A, B, C);
|
||||
return luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP);
|
||||
return luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
|
||||
}
|
||||
|
||||
|
||||
static void luaK_fixjump (FuncState *fs, int pc, int dest) {
|
||||
Instruction *jmp = &fs->f->code[pc];
|
||||
if (dest == NO_JUMP)
|
||||
SETARG_sBc(*jmp, NO_JUMP); /* point to itself to represent end of list */
|
||||
SETARG_sBx(*jmp, NO_JUMP); /* point to itself to represent end of list */
|
||||
else { /* jump is relative to position following jump instruction */
|
||||
int offset = dest-(pc+1);
|
||||
if (abs(offset) > MAXARG_sBc)
|
||||
if (abs(offset) > MAXARG_sBx)
|
||||
luaK_error(fs->ls, "control structure too long");
|
||||
SETARG_sBc(*jmp, offset);
|
||||
SETARG_sBx(*jmp, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int luaK_getlabel (FuncState *fs) {
|
||||
|
||||
|
||||
static int luaK_getjump (FuncState *fs, int pc) {
|
||||
int offset = GETARG_sBc(fs->f->code[pc]);
|
||||
int offset = GETARG_sBx(fs->f->code[pc]);
|
||||
if (offset == NO_JUMP) /* point to itself represents end of list */
|
||||
return NO_JUMP; /* end of list */
|
||||
else
|
||||
@@ -213,7 +213,7 @@ static int addk (FuncState *fs, TObject *k, TObject *v) {
|
||||
TObject o;
|
||||
Proto *f = fs->f;
|
||||
luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject,
|
||||
MAXARG_Bc, "constant table overflow");
|
||||
MAXARG_Bx, "constant table overflow");
|
||||
setobj(&f->k[fs->nk], v);
|
||||
setnvalue(&o, fs->nk);
|
||||
luaH_set(fs->L, fs->h, k, &o);
|
||||
@@ -267,7 +267,7 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
|
||||
break;
|
||||
}
|
||||
case VGLOBAL: {
|
||||
e->info = luaK_codeABc(fs, OP_GETGLOBAL, 0, e->info);
|
||||
e->info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->info);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
|
||||
break;
|
||||
}
|
||||
case VK: {
|
||||
luaK_codeABc(fs, OP_LOADK, reg, e->info);
|
||||
luaK_codeABx(fs, OP_LOADK, reg, e->info);
|
||||
break;
|
||||
}
|
||||
case VRELOCABLE: {
|
||||
@@ -347,7 +347,7 @@ static void luaK_exp2reg (FuncState *fs, expdesc *e, int reg) {
|
||||
/* expression needs values */
|
||||
if (e->k != VJMP) {
|
||||
luaK_getlabel(fs); /* these instruction may be jump target */
|
||||
luaK_codeAsBc(fs, OP_JMP, 0, 2); /* to jump over both pushes */
|
||||
luaK_codeAsBx(fs, OP_JMP, 0, 2); /* to jump over both pushes */
|
||||
}
|
||||
else { /* last expression is a conditional (test + jump) */
|
||||
fs->pc--; /* remove its jump */
|
||||
@@ -433,7 +433,7 @@ void luaK_storevar (FuncState *fs, expdesc *var, expdesc *exp) {
|
||||
}
|
||||
case VGLOBAL: {
|
||||
int e = luaK_exp2anyreg(fs, exp);
|
||||
luaK_codeABc(fs, OP_SETGLOBAL, e, var->info);
|
||||
luaK_codeABx(fs, OP_SETGLOBAL, e, var->info);
|
||||
break;
|
||||
}
|
||||
case VINDEXED: {
|
||||
@@ -509,7 +509,7 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
|
||||
break;
|
||||
}
|
||||
case VFALSE: {
|
||||
pc = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); /* always jump */
|
||||
pc = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); /* always jump */
|
||||
break;
|
||||
}
|
||||
case VJMP: {
|
||||
@@ -537,7 +537,7 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
|
||||
break;
|
||||
}
|
||||
case VTRUE: {
|
||||
pc = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); /* always jump */
|
||||
pc = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); /* always jump */
|
||||
break;
|
||||
}
|
||||
case VJMP: {
|
||||
@@ -739,8 +739,8 @@ int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
|
||||
}
|
||||
|
||||
|
||||
int luaK_codeABc (FuncState *fs, OpCode o, int a, unsigned int bc) {
|
||||
lua_assert(getOpMode(o) == iABc || getOpMode(o) == iAsBc);
|
||||
return luaK_code(fs, CREATE_ABc(o, a, bc));
|
||||
int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
|
||||
lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
|
||||
return luaK_code(fs, CREATE_ABx(o, a, bc));
|
||||
}
|
||||
|
||||
|
||||
6
lcode.h
6
lcode.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lcode.h,v 1.30 2002/04/02 20:34:53 roberto Exp roberto $
|
||||
** $Id: lcode.h,v 1.31 2002/04/09 18:49:30 roberto Exp roberto $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -39,10 +39,10 @@ typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
|
||||
|
||||
#define getcode(fs,e) ((fs)->f->code[(e)->info])
|
||||
|
||||
#define luaK_codeAsBc(fs,o,A,sBc) luaK_codeABc(fs,o,A,(sBc)+MAXARG_sBc)
|
||||
#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
|
||||
|
||||
void luaK_error (LexState *ls, const char *msg);
|
||||
int luaK_codeABc (FuncState *fs, OpCode o, int A, unsigned int Bc);
|
||||
int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
|
||||
int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
|
||||
void luaK_nil (FuncState *fs, int from, int n);
|
||||
void luaK_reserveregs (FuncState *fs, int n);
|
||||
|
||||
14
ldebug.c
14
ldebug.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldebug.c,v 1.108 2002/04/10 12:11:07 roberto Exp roberto $
|
||||
** $Id: ldebug.c,v 1.109 2002/04/22 14:40:23 roberto Exp roberto $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -290,13 +290,13 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) {
|
||||
(c >= MAXSTACK && c-MAXSTACK < pt->sizek));
|
||||
break;
|
||||
}
|
||||
case iABc: {
|
||||
b = GETARG_Bc(i);
|
||||
case iABx: {
|
||||
b = GETARG_Bx(i);
|
||||
if (testOpMode(op, OpModeK)) check(b < pt->sizek);
|
||||
break;
|
||||
}
|
||||
case iAsBc: {
|
||||
b = GETARG_sBc(i);
|
||||
case iAsBx: {
|
||||
b = GETARG_sBx(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -421,8 +421,8 @@ static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,
|
||||
lua_assert(pc != -1);
|
||||
switch (GET_OPCODE(i)) {
|
||||
case OP_GETGLOBAL: {
|
||||
lua_assert(ttype(&p->k[GETARG_Bc(i)]) == LUA_TSTRING);
|
||||
*name = svalue(&p->k[GETARG_Bc(i)]);
|
||||
lua_assert(ttype(&p->k[GETARG_Bx(i)]) == LUA_TSTRING);
|
||||
*name = svalue(&p->k[GETARG_Bx(i)]);
|
||||
return "global";
|
||||
}
|
||||
case OP_MOVE: {
|
||||
|
||||
18
lopcodes.c
18
lopcodes.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lopcodes.c,v 1.15 2002/04/09 19:47:44 roberto Exp roberto $
|
||||
** $Id: lopcodes.c,v 1.16 2002/04/10 18:05:08 roberto Exp roberto $
|
||||
** extracted automatically from lopcodes.h by mkprint.lua
|
||||
** DO NOT EDIT
|
||||
** See Copyright Notice in lua.h
|
||||
@@ -66,13 +66,13 @@ const char *const luaP_opnames[] = {
|
||||
const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
||||
/* T _ B C sA K mode opcode */
|
||||
opmode(0,0,1,0, 1,0,iABC) /* OP_MOVE */
|
||||
,opmode(0,0,0,0, 1,1,iABc) /* OP_LOADK */
|
||||
,opmode(0,0,0,0, 1,1,iABx) /* OP_LOADK */
|
||||
,opmode(0,0,0,0, 1,0,iABC) /* OP_LOADBOOL */
|
||||
,opmode(0,0,1,0, 1,0,iABC) /* OP_LOADNIL */
|
||||
,opmode(0,0,0,0, 1,0,iABC) /* OP_GETUPVAL */
|
||||
,opmode(0,0,0,0, 1,1,iABc) /* OP_GETGLOBAL */
|
||||
,opmode(0,0,0,0, 1,1,iABx) /* OP_GETGLOBAL */
|
||||
,opmode(0,0,1,1, 1,0,iABC) /* OP_GETTABLE */
|
||||
,opmode(0,0,0,0, 0,1,iABc) /* OP_SETGLOBAL */
|
||||
,opmode(0,0,0,0, 0,1,iABx) /* OP_SETGLOBAL */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_SETUPVAL */
|
||||
,opmode(0,0,1,1, 0,0,iABC) /* OP_SETTABLE */
|
||||
,opmode(0,0,0,0, 1,0,iABC) /* OP_NEWTABLE */
|
||||
@@ -85,7 +85,7 @@ const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
||||
,opmode(0,0,1,0, 1,0,iABC) /* OP_UNM */
|
||||
,opmode(0,0,1,0, 1,0,iABC) /* OP_NOT */
|
||||
,opmode(0,0,1,1, 1,0,iABC) /* OP_CONCAT */
|
||||
,opmode(0,0,0,0, 0,0,iAsBc) /* OP_JMP */
|
||||
,opmode(0,0,0,0, 0,0,iAsBx) /* OP_JMP */
|
||||
,opmode(1,0,0,1, 0,0,iABC) /* OP_TESTEQ */
|
||||
,opmode(1,0,0,1, 0,0,iABC) /* OP_TESTNE */
|
||||
,opmode(1,0,0,1, 0,0,iABC) /* OP_TESTLT */
|
||||
@@ -97,12 +97,12 @@ const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_CALL */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_TAILCALL */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_RETURN */
|
||||
,opmode(0,0,0,0, 0,0,iAsBc) /* OP_FORLOOP */
|
||||
,opmode(0,0,0,0, 0,0,iAsBx) /* OP_FORLOOP */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_TFORLOOP */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_TFORPREP */
|
||||
,opmode(0,0,0,0, 0,0,iABc) /* OP_SETLIST */
|
||||
,opmode(0,0,0,0, 0,0,iABc) /* OP_SETLISTO */
|
||||
,opmode(0,0,0,0, 0,0,iABx) /* OP_SETLIST */
|
||||
,opmode(0,0,0,0, 0,0,iABx) /* OP_SETLISTO */
|
||||
,opmode(0,0,0,0, 0,0,iABC) /* OP_CLOSE */
|
||||
,opmode(0,0,0,0, 1,0,iABc) /* OP_CLOSURE */
|
||||
,opmode(0,0,0,0, 1,0,iABx) /* OP_CLOSURE */
|
||||
};
|
||||
|
||||
|
||||
54
lopcodes.h
54
lopcodes.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lopcodes.h,v 1.93 2002/03/25 17:47:14 roberto Exp roberto $
|
||||
** $Id: lopcodes.h,v 1.94 2002/04/09 19:47:44 roberto Exp roberto $
|
||||
** Opcodes for Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -17,8 +17,8 @@
|
||||
`A' : 8 bits (25-32)
|
||||
`B' : 8 bits (17-24)
|
||||
`C' : 10 bits (7-16)
|
||||
`Bc' : 18 bits (`B' and `C' together)
|
||||
`sBc' : signed Bc
|
||||
`Bx' : 18 bits (`B' and `C' together)
|
||||
`sBx' : signed Bx
|
||||
|
||||
A signed argument is represented in excess K; that is, the number
|
||||
value is the unsigned value minus K. K is exactly the maximum value
|
||||
@@ -28,7 +28,7 @@
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
|
||||
enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
|
||||
|
||||
|
||||
/*
|
||||
@@ -36,14 +36,14 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
|
||||
*/
|
||||
#define SIZE_C 10
|
||||
#define SIZE_B 8
|
||||
#define SIZE_Bc (SIZE_C + SIZE_B)
|
||||
#define SIZE_Bx (SIZE_C + SIZE_B)
|
||||
#define SIZE_A 8
|
||||
|
||||
#define SIZE_OP 6
|
||||
|
||||
#define POS_C SIZE_OP
|
||||
#define POS_B (POS_C + SIZE_C)
|
||||
#define POS_Bc POS_C
|
||||
#define POS_Bx POS_C
|
||||
#define POS_A (POS_B + SIZE_B)
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
|
||||
** we use (signed) int to manipulate most arguments,
|
||||
** so they must fit in BITS_INT-1 bits (-1 for sign)
|
||||
*/
|
||||
#if SIZE_Bc < BITS_INT-1
|
||||
#define MAXARG_Bc ((1<<SIZE_Bc)-1)
|
||||
#define MAXARG_sBc (MAXARG_Bc>>1) /* `sBc' is signed */
|
||||
#if SIZE_Bx < BITS_INT-1
|
||||
#define MAXARG_Bx ((1<<SIZE_Bx)-1)
|
||||
#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
|
||||
#else
|
||||
#define MAXARG_Bc MAX_INT
|
||||
#define MAXARG_sBc MAX_INT
|
||||
#define MAXARG_Bx MAX_INT
|
||||
#define MAXARG_sBx MAX_INT
|
||||
#endif
|
||||
|
||||
|
||||
@@ -91,12 +91,12 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
|
||||
#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
|
||||
(cast(Instruction, b)<<POS_C)))
|
||||
|
||||
#define GETARG_Bc(i) (cast(int, ((i)>>POS_Bc) & MASK1(SIZE_Bc,0)))
|
||||
#define SETARG_Bc(i,b) ((i) = (((i)&MASK0(SIZE_Bc,POS_Bc)) | \
|
||||
(cast(Instruction, b)<<POS_Bc)))
|
||||
#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
|
||||
#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
|
||||
(cast(Instruction, b)<<POS_Bx)))
|
||||
|
||||
#define GETARG_sBc(i) (GETARG_Bc(i)-MAXARG_sBc)
|
||||
#define SETARG_sBc(i,b) SETARG_Bc((i),cast(unsigned int, (b)+MAXARG_sBc))
|
||||
#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
|
||||
#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
|
||||
|
||||
|
||||
#define CREATE_ABC(o,a,b,c) (cast(Instruction, o) \
|
||||
@@ -104,9 +104,9 @@ enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
|
||||
| (cast(Instruction, b)<<POS_B) \
|
||||
| (cast(Instruction, c)<<POS_C))
|
||||
|
||||
#define CREATE_ABc(o,a,bc) (cast(Instruction, o) \
|
||||
#define CREATE_ABx(o,a,bc) (cast(Instruction, o) \
|
||||
| (cast(Instruction, a)<<POS_A) \
|
||||
| (cast(Instruction, bc)<<POS_Bc))
|
||||
| (cast(Instruction, bc)<<POS_Bx))
|
||||
|
||||
|
||||
|
||||
@@ -129,15 +129,15 @@ typedef enum {
|
||||
name args description
|
||||
------------------------------------------------------------------------*/
|
||||
OP_MOVE,/* A B R(A) := R(B) */
|
||||
OP_LOADK,/* A Bc R(A) := Kst(Bc) */
|
||||
OP_LOADK,/* A Bx R(A) := Kst(Bx) */
|
||||
OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) PC++ */
|
||||
OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
|
||||
OP_GETUPVAL,/* A B R(A) := UpValue[B] */
|
||||
|
||||
OP_GETGLOBAL,/* A Bc R(A) := Gbl[Kst(Bc)] */
|
||||
OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
|
||||
OP_GETTABLE,/* A B C R(A) := R(B)[R/K(C)] */
|
||||
|
||||
OP_SETGLOBAL,/* A Bc Gbl[Kst(Bc)] := R(A) */
|
||||
OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
|
||||
OP_SETUPVAL,/* A B UpValue[B] := R(A) */
|
||||
OP_SETTABLE,/* A B C R(B)[R/K(C)] := R(A) */
|
||||
|
||||
@@ -155,7 +155,7 @@ OP_NOT,/* A B R(A) := not R(B) */
|
||||
|
||||
OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
|
||||
|
||||
OP_JMP,/* sBc PC += sBc */
|
||||
OP_JMP,/* sBx PC += sBx */
|
||||
|
||||
OP_TESTEQ,/* A C if not (R(A) == R/K(C)) then pc++ */
|
||||
OP_TESTNE,/* A C if not (R(A) ~= R/K(C)) then pc++ */
|
||||
@@ -171,17 +171,17 @@ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
|
||||
OP_TAILCALL,/* A B return R(A)(R(A+1), ... ,R(A+B-1)) */
|
||||
OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see (3)) */
|
||||
|
||||
OP_FORLOOP,/* A sBc R(A)+=R(A+2); if R(A) <?= R(A+1) then PC+= sBc */
|
||||
OP_FORLOOP,/* A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then PC+= sBx */
|
||||
|
||||
OP_TFORLOOP,/* A C R(A+2), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
|
||||
if R(A+2) ~= nil then pc++ */
|
||||
OP_TFORPREP,/* A if type(R(A)) == table then R(A+1):=R(A), R(A):=next */
|
||||
|
||||
OP_SETLIST,/* A Bc R(A)[Bc-Bc%FPF+i] := R(A+i), 1 <= i <= Bc%FPF+1 */
|
||||
OP_SETLISTO,/* A Bc */
|
||||
OP_SETLIST,/* A Bx R(A)[Bx-Bx%FPF+i] := R(A+i), 1 <= i <= Bx%FPF+1 */
|
||||
OP_SETLISTO,/* A Bx */
|
||||
|
||||
OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
|
||||
OP_CLOSURE/* A Bc R(A) := closure(KPROTO[Bc], R(A), ... ,R(A+n)) */
|
||||
OP_CLOSURE/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
|
||||
} OpCode;
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ enum OpModeMask {
|
||||
OpModeBreg = 2, /* B is a register */
|
||||
OpModeCreg, /* C is a register/constant */
|
||||
OpModesetA, /* instruction set register A */
|
||||
OpModeK, /* Bc is a constant */
|
||||
OpModeK, /* Bx is a constant */
|
||||
OpModeT /* operator is a test */
|
||||
};
|
||||
|
||||
|
||||
18
lparser.c
18
lparser.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lparser.c,v 1.176 2002/04/10 19:14:45 roberto Exp roberto $
|
||||
** $Id: lparser.c,v 1.177 2002/04/22 14:38:52 roberto Exp roberto $
|
||||
** Lua Parser
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -354,9 +354,9 @@ static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
|
||||
Proto *f = fs->f;
|
||||
int i;
|
||||
luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,
|
||||
MAXARG_Bc, "constant table overflow");
|
||||
MAXARG_Bx, "constant table overflow");
|
||||
f->p[fs->np++] = func->f;
|
||||
init_exp(v, VRELOCABLE, luaK_codeABc(fs, OP_CLOSURE, 0, fs->np-1));
|
||||
init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1));
|
||||
for (i=0; i<func->f->nupvalues; i++) {
|
||||
luaK_exp2nextreg(fs, &func->upvalues[i]);
|
||||
fs->freereg--; /* CLOSURE will use these values */
|
||||
@@ -563,7 +563,7 @@ static void closelistfield (FuncState *fs, struct ConsControl *cc) {
|
||||
luaK_exp2nextreg(fs, &cc->v);
|
||||
cc->v.k = VVOID;
|
||||
if (cc->tostore == LFIELDS_PER_FLUSH) {
|
||||
luaK_codeABc(fs, OP_SETLIST, cc->t->info, cc->na-1); /* flush */
|
||||
luaK_codeABx(fs, OP_SETLIST, cc->t->info, cc->na-1); /* flush */
|
||||
cc->tostore = 0; /* no more items pending */
|
||||
fs->freereg = cc->t->info + 1; /* free registers */
|
||||
}
|
||||
@@ -574,12 +574,12 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
|
||||
if (cc->tostore == 0) return;
|
||||
if (cc->v.k == VCALL) {
|
||||
luaK_setcallreturns(fs, &cc->v, LUA_MULTRET);
|
||||
luaK_codeABc(fs, OP_SETLISTO, cc->t->info, cc->na-1);
|
||||
luaK_codeABx(fs, OP_SETLISTO, cc->t->info, cc->na-1);
|
||||
}
|
||||
else {
|
||||
if (cc->v.k != VVOID)
|
||||
luaK_exp2nextreg(fs, &cc->v);
|
||||
luaK_codeABc(fs, OP_SETLIST, cc->t->info, cc->na-1);
|
||||
luaK_codeABx(fs, OP_SETLIST, cc->t->info, cc->na-1);
|
||||
}
|
||||
fs->freereg = cc->t->info + 1; /* free registers */
|
||||
}
|
||||
@@ -587,7 +587,7 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
|
||||
|
||||
static void listfield (LexState *ls, struct ConsControl *cc) {
|
||||
expr(ls, &cc->v);
|
||||
luaX_checklimit(ls, cc->na, MAXARG_Bc, "items in a constructor");
|
||||
luaX_checklimit(ls, cc->na, MAXARG_Bx, "items in a constructor");
|
||||
cc->na++;
|
||||
cc->tostore++;
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ static void fornum (LexState *ls, TString *varname, int line) {
|
||||
if (optional(ls, ','))
|
||||
exp1(ls); /* optional step */
|
||||
else { /* default step = 1 */
|
||||
luaK_codeABc(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1));
|
||||
luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1));
|
||||
luaK_reserveregs(fs, 1);
|
||||
}
|
||||
adjustlocalvars(ls, 3); /* scope for control variables */
|
||||
@@ -1024,7 +1024,7 @@ static void fornum (LexState *ls, TString *varname, int line) {
|
||||
check(ls, TK_DO);
|
||||
block(ls);
|
||||
luaK_patchtohere(fs, prep-1);
|
||||
endfor = luaK_codeAsBc(fs, OP_FORLOOP, base, NO_JUMP);
|
||||
endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
|
||||
luaK_patchlist(fs, endfor, prep);
|
||||
fs->f->lineinfo[endfor] = line; /* pretend that `OP_FOR' starts the loop */
|
||||
}
|
||||
|
||||
10
ltests.c
10
ltests.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltests.c,v 1.115 2002/04/02 20:43:08 roberto Exp roberto $
|
||||
** $Id: ltests.c,v 1.116 2002/04/05 18:54:31 roberto Exp roberto $
|
||||
** Internal Module for Debugging of the Lua Implementation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -151,11 +151,11 @@ static char *buildop (Proto *p, int pc, char *buff) {
|
||||
sprintf(buff+strlen(buff), "%-12s%4d %4d %4d", name,
|
||||
GETARG_A(i), GETARG_B(i), GETARG_C(i));
|
||||
break;
|
||||
case iABc:
|
||||
sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_Bc(i));
|
||||
case iABx:
|
||||
sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_Bx(i));
|
||||
break;
|
||||
case iAsBc:
|
||||
sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_sBc(i));
|
||||
case iAsBx:
|
||||
sprintf(buff+strlen(buff), "%-12s%4d %4d", name, GETARG_A(i), GETARG_sBx(i));
|
||||
break;
|
||||
}
|
||||
return buff;
|
||||
|
||||
22
lvm.c
22
lvm.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 1.225 2002/04/10 12:11:07 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 1.226 2002/04/22 14:40:23 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -287,7 +287,7 @@ static void powOp (lua_State *L, StkId ra, StkId rb, StkId rc) {
|
||||
#define RKC(i) ((GETARG_C(i) < MAXSTACK) ? \
|
||||
base+GETARG_C(i) : \
|
||||
k+GETARG_C(i)-MAXSTACK)
|
||||
#define KBc(i) (k+GETARG_Bc(i))
|
||||
#define KBx(i) (k+GETARG_Bx(i))
|
||||
|
||||
#define Arith(op, optm) { \
|
||||
const TObject *b = RB(i); const TObject *c = RKC(i); \
|
||||
@@ -332,7 +332,7 @@ StkId luaV_execute (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
case OP_LOADK: {
|
||||
setobj(ra, KBc(i));
|
||||
setobj(ra, KBx(i));
|
||||
break;
|
||||
}
|
||||
case OP_LOADBOOL: {
|
||||
@@ -353,8 +353,8 @@ StkId luaV_execute (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
case OP_GETGLOBAL: {
|
||||
lua_assert(ttype(KBc(i)) == LUA_TSTRING);
|
||||
luaV_gettable(L, gt(L), KBc(i), ra);
|
||||
lua_assert(ttype(KBx(i)) == LUA_TSTRING);
|
||||
luaV_gettable(L, gt(L), KBx(i), ra);
|
||||
break;
|
||||
}
|
||||
case OP_GETTABLE: {
|
||||
@@ -362,8 +362,8 @@ StkId luaV_execute (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
case OP_SETGLOBAL: {
|
||||
lua_assert(ttype(KBc(i)) == LUA_TSTRING);
|
||||
luaV_settable(L, gt(L), KBc(i), ra);
|
||||
lua_assert(ttype(KBx(i)) == LUA_TSTRING);
|
||||
luaV_settable(L, gt(L), KBx(i), ra);
|
||||
break;
|
||||
}
|
||||
case OP_SETUPVAL: {
|
||||
@@ -434,7 +434,7 @@ StkId luaV_execute (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
case OP_JMP: {
|
||||
dojump(pc, GETARG_sBc(i));
|
||||
dojump(pc, GETARG_sBx(i));
|
||||
break;
|
||||
}
|
||||
case OP_TESTEQ: { /* skip next instruction if test fails */
|
||||
@@ -531,7 +531,7 @@ StkId luaV_execute (lua_State *L) {
|
||||
}
|
||||
case OP_FORLOOP: {
|
||||
lua_Number step, index, limit;
|
||||
int j = GETARG_sBc(i);
|
||||
int j = GETARG_sBx(i);
|
||||
const TObject *plimit = ra+1;
|
||||
const TObject *pstep = ra+2;
|
||||
if (ttype(ra) != LUA_TNUMBER)
|
||||
@@ -574,7 +574,7 @@ StkId luaV_execute (lua_State *L) {
|
||||
Table *h;
|
||||
runtime_check(L, ttype(ra) == LUA_TTABLE);
|
||||
h = hvalue(ra);
|
||||
bc = GETARG_Bc(i);
|
||||
bc = GETARG_Bx(i);
|
||||
if (GET_OPCODE(i) == OP_SETLIST)
|
||||
n = (bc&(LFIELDS_PER_FLUSH-1)) + 1;
|
||||
else {
|
||||
@@ -594,7 +594,7 @@ StkId luaV_execute (lua_State *L) {
|
||||
Proto *p;
|
||||
Closure *ncl;
|
||||
int nup, j;
|
||||
p = cl->p->p[GETARG_Bc(i)];
|
||||
p = cl->p->p[GETARG_Bx(i)];
|
||||
nup = p->nupvalues;
|
||||
ncl = luaF_newLclosure(L, nup);
|
||||
ncl->l.p = p;
|
||||
|
||||
Reference in New Issue
Block a user