From 739b5c1888b38b2580adbe52a42b86372a7d146b Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 16 Feb 2017 11:55:54 +0100 Subject: lua_pushnumber, lua_pushinteger, lua_pushstring, lua_pushboolean --- src/lundump.js | 68 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/lundump.js') diff --git a/src/lundump.js b/src/lundump.js index 67867bb..0ff3143 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -134,7 +134,7 @@ class BytecodeParser { sBx: ((ins >> o.POS_Bx) & p.MASK1(o.SIZE_Bx, 0)) - o.MAXARG_sBx }; - console.log(` [${i}] Op: ${o.OpCodes[f.code[i].opcode]} A: ${f.code[i].A} B: ${f.code[i].B} C: ${f.code[i].C} Ax: ${f.code[i].Ax} Bx: ${f.code[i].Bx} sBx: ${f.code[i].sBx}`); + // console.log(` [${i}] Op: ${o.OpCodes[f.code[i].opcode]} A: ${f.code[i].A} B: ${f.code[i].B} C: ${f.code[i].C} Ax: ${f.code[i].Ax} Bx: ${f.code[i].Bx} sBx: ${f.code[i].sBx}`); } } @@ -148,11 +148,11 @@ class BytecodeParser { idx: this.readByte() }; - console.log(` - f.upvalues[${i}].name = ${f.upvalues[i].name} - f.upvalues[${i}].instack = ${f.upvalues[i].instack} - f.upvalues[${i}].idx = ${f.upvalues[i].idx} - `); + // console.log(` + // f.upvalues[${i}].name = ${f.upvalues[i].name} + // f.upvalues[${i}].instack = ${f.upvalues[i].instack} + // f.upvalues[${i}].idx = ${f.upvalues[i].idx} + // `); } } @@ -165,24 +165,24 @@ class BytecodeParser { switch (t) { case constant_types.LUA_TNIL: f.k.push(new TValue(constant_types.LUA_TNIL, null)); - console.log(` LUA_TNIL = ${f.k[f.k.length - 1].value}`); + // console.log(` LUA_TNIL = ${f.k[f.k.length - 1].value}`); break; case constant_types.LUA_TBOOLEAN: f.k.push(new TValue(constant_types.LUA_TBOOLEAN, this.readByte())); - console.log(` LUA_TBOOLEAN = ${f.k[f.k.length - 1].value}`); + // console.log(` LUA_TBOOLEAN = ${f.k[f.k.length - 1].value}`); break; case constant_types.LUA_TNUMFLT: f.k.push(new TValue(constant_types.LUA_TNUMFLT, this.readNumber())); - console.log(` LUA_TNUMFLT = ${f.k[f.k.length - 1].value}`); + // console.log(` LUA_TNUMFLT = ${f.k[f.k.length - 1].value}`); break; case constant_types.LUA_TNUMINT: f.k.push(new TValue(constant_types.LUA_TNUMINT, this.readInteger())); - console.log(` LUA_TNUMINT = ${f.k[f.k.length - 1].value}`); + // console.log(` LUA_TNUMINT = ${f.k[f.k.length - 1].value}`); break; case constant_types.LUA_TSHRSTR: case constant_types.LUA_TLNGSTR: f.k.push(new TValue(constant_types.LUA_TLNGSTR, this.readString())); - console.log(` LUA_TLNGSTR = ${f.k[f.k.length - 1].value}`); + // console.log(` LUA_TLNGSTR = ${f.k[f.k.length - 1].value}`); break; default: throw new Error(`unrecognized constant '${t}'`); @@ -212,20 +212,20 @@ class BytecodeParser { endpc: this.readInt() }; - console.log(` - f.locvars[${i}].varname = ${f.locvars[i].varname} - f.locvars[${i}].startpc = ${f.locvars[i].startpc} - f.locvars[${i}].endpc = ${f.locvars[i].endpc} - `); + // console.log(` + // f.locvars[${i}].varname = ${f.locvars[i].varname} + // f.locvars[${i}].startpc = ${f.locvars[i].startpc} + // f.locvars[${i}].endpc = ${f.locvars[i].endpc} + // `); } n = this.readInt(); for (let i = 0; i < n; i++) { f.upvalues[i].name = this.readString(); - console.log(` - f.upvalues[${i}].name = ${f.upvalues[i].name} - `); + // console.log(` + // f.upvalues[${i}].name = ${f.upvalues[i].name} + // `); } } @@ -239,14 +239,14 @@ class BytecodeParser { f.is_vararg = this.readByte(); f.maxstacksize = this.readByte(); - console.log(` - f.source = ${f.source} - f.linedefined = ${f.linedefined} - f.lastlinedefined = ${f.lastlinedefined} - f.numparams = ${f.numparams} - f.is_vararg = ${f.is_vararg} - f.maxstacksize = ${f.maxstacksize} - `); + // console.log(` + // f.source = ${f.source} + // f.linedefined = ${f.linedefined} + // f.lastlinedefined = ${f.lastlinedefined} + // f.numparams = ${f.numparams} + // f.is_vararg = ${f.is_vararg} + // f.maxstacksize = ${f.maxstacksize} + // `); this.readCode(f); this.readConstants(f); @@ -274,13 +274,13 @@ class BytecodeParser { this.integerSize = this.readByte(); this.numberSize = this.readByte(); - console.log(` - intSize = ${this.intSize} - size_tSize = ${this.size_tSize} - instructionSize = ${this.instructionSize} - integerSize = ${this.integerSize} - numberSize = ${this.numberSize} - `) + // console.log(` + // intSize = ${this.intSize} + // size_tSize = ${this.size_tSize} + // instructionSize = ${this.instructionSize} + // integerSize = ${this.integerSize} + // numberSize = ${this.numberSize} + // `) if (this.readInteger() !== 0x5678) throw new Error("endianness mismatch"); -- cgit v1.2.3-54-g00ecf