private BhpCode _Convert1by1(VM.OpCode code, OpCode src, BhpMethod to, byte[] data = null) { BhpCode _code = new BhpCode(); int startaddr = addr; _code.addr = addr; if (src != null) { addrconv[src.addr] = addr; _code.debugcode = src.debugcode; _code.debugline = src.debugline; _code.debugILAddr = src.addr; _code.debugILCode = src.code.ToString(); } addr++; _code.code = code; if (data != null) { _code.bytes = data; addr += _code.bytes.Length; } to.body_Codes[startaddr] = _code; return(_code); }
private BhpCode _Insert1(VM.OpCode code, string comment, BhpMethod to, byte[] data = null) { BhpCode _code = new BhpCode(); int startaddr = addr; _code.addr = addr; { _code.debugcode = comment; _code.debugline = 0; } addr++; _code.code = code; if (data != null) { _code.bytes = data; addr += _code.bytes.Length; } to.body_Codes[startaddr] = _code; return(_code); }
//Dictionary<string, string[]> srccodes = new Dictionary<string, string[]>(); //string getSrcCode(string url, int line) //{ // if (url == null || url == "") return ""; // if (srccodes.ContainsKey(url) == false) // { // srccodes[url] = System.IO.File.ReadAllLines(url); // } // if (srccodes.ContainsKey(url) != false) // { // var file = srccodes[url]; // if (line > 0 && line <= file.Length) // { // return file[line - 1]; // } // } // return ""; //} static int getNumber(BhpCode code) { if (code.code <= VM.OpCode.PUSHBYTES75 && code.code >= VM.OpCode.PUSHBYTES1) { return((int)new BigInteger(code.bytes)); } else if (code.code == VM.OpCode.PUSH0) { return(0); } else if (code.code == VM.OpCode.PUSH1) { return(1); } else if (code.code == VM.OpCode.PUSH2) { return(2); } else if (code.code == VM.OpCode.PUSH3) { return(3); } else if (code.code == VM.OpCode.PUSH4) { return(4); } else if (code.code == VM.OpCode.PUSH5) { return(5); } else if (code.code == VM.OpCode.PUSH6) { return(6); } else if (code.code == VM.OpCode.PUSH7) { return(7); } else if (code.code == VM.OpCode.PUSH8) { return(8); } else if (code.code == VM.OpCode.PUSH9) { return(9); } else if (code.code == VM.OpCode.PUSH10) { return(10); } else if (code.code == VM.OpCode.PUSH11) { return(11); } else if (code.code == VM.OpCode.PUSH12) { return(12); } else if (code.code == VM.OpCode.PUSH13) { return(13); } else if (code.code == VM.OpCode.PUSH14) { return(14); } else if (code.code == VM.OpCode.PUSH15) { return(15); } else if (code.code == VM.OpCode.PUSH16) { return(16); } else if (code.code == VM.OpCode.PUSHDATA1) { return(pushdata1bytes2int(code.bytes)); } else { throw new Exception("not support getNumber From this:" + code.ToString()); } }