diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-28 00:05:30 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-28 00:05:30 +0800 |
commit | 5516efdfa0494e028fc3649e4a38da81c56ed598 (patch) | |
tree | d3880e5b7d51c808192a4a79dc10f6ad02735d9b | |
parent | 21f8806eed4c926ea31144c0e061ca8e0bbe35f8 (diff) | |
download | go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar.gz go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar.bz2 go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar.lz go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar.xz go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.tar.zst go-tangerine-5516efdfa0494e028fc3649e4a38da81c56ed598.zip |
Removed old code
-rw-r--r-- | ethchain/asm.go | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/ethchain/asm.go b/ethchain/asm.go index a6c85cb60..3194549ba 100644 --- a/ethchain/asm.go +++ b/ethchain/asm.go @@ -4,55 +4,8 @@ import ( "fmt" "github.com/ethereum/eth-go/ethutil" "math/big" - "regexp" ) -func CompileInstr(s interface{}) ([]byte, error) { - switch s.(type) { - case string: - str := s.(string) - isOp := IsOpCode(str) - if isOp { - return []byte{OpCodes[str]}, nil - } - - num := new(big.Int) - _, success := num.SetString(str, 0) - // Assume regular bytes during compilation - if !success { - num.SetBytes([]byte(str)) - } else { - // tmp fix for 32 bytes - n := ethutil.BigToBytes(num, 256) - return n, nil - } - - return num.Bytes(), nil - case int: - num := ethutil.BigToBytes(big.NewInt(int64(s.(int))), 256) - return num, nil - case []byte: - return ethutil.BigD(s.([]byte)).Bytes(), nil - } - - return nil, nil -} - -// Script compilation functions -// Compiles strings to machine code -func Assemble(instructions ...interface{}) (script []byte) { - //script = make([]string, len(instructions)) - - for _, val := range instructions { - instr, _ := CompileInstr(val) - - //script[i] = string(instr) - script = append(script, instr...) - } - - return -} - func Disassemble(script []byte) (asm []string) { pc := new(big.Int) for { @@ -104,24 +57,3 @@ func Disassemble(script []byte) (asm []string) { return } - -func PreProcess(data string) (mainInput, initInput string) { - // Regexp for parsing anything between brackets - reg := "\\(\\)\\s*{([\\d\\w\\W\\n\\s]+?)}" - mainReg := regexp.MustCompile("main" + reg) - initReg := regexp.MustCompile("init" + reg) - - main := mainReg.FindStringSubmatch(data) - if len(main) > 0 { - mainInput = main[1] - } else { - mainInput = data - } - - init := initReg.FindStringSubmatch(data) - if len(init) > 0 { - initInput = init[1] - } - - return -} |