From a02dc4ccc321bdee2a670eecdf5c3bac01fc290b Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 18 Oct 2014 13:23:01 +0200 Subject: Using proper naming scheme. Fixes #63 --- ethutil/script_unix.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ethutil/script_unix.go (limited to 'ethutil/script_unix.go') diff --git a/ethutil/script_unix.go b/ethutil/script_unix.go new file mode 100644 index 000000000..bd087e7e0 --- /dev/null +++ b/ethutil/script_unix.go @@ -0,0 +1,47 @@ +package ethutil + +import ( + "fmt" + "strings" + + "github.com/obscuren/mutan" + "github.com/obscuren/mutan/backends" + "github.com/obscuren/serpent-go" +) + +// General compile function +func Compile(script string, silent bool) (ret []byte, err error) { + if len(script) > 2 { + line := strings.Split(script, "\n")[0] + + if len(line) > 1 && line[0:2] == "#!" { + switch line { + case "#!serpent": + byteCode, err := serpent.Compile(script) + if err != nil { + return nil, err + } + + return byteCode, nil + } + } else { + + compiler := mutan.NewCompiler(backend.NewEthereumBackend()) + compiler.Silent = silent + byteCode, errors := compiler.Compile(strings.NewReader(script)) + if len(errors) > 0 { + var errs string + for _, er := range errors { + if er != nil { + errs += er.Error() + } + } + return nil, fmt.Errorf("%v", errs) + } + + return byteCode, nil + } + } + + return nil, nil +} -- cgit v1.2.3 From e73aad959e530ecfbaff0c041ea881d4c9c95867 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 24 Oct 2014 01:04:10 +0200 Subject: ethutil: re-add build constraints in script*.go (fixes #151) --- ethutil/script_unix.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ethutil/script_unix.go') diff --git a/ethutil/script_unix.go b/ethutil/script_unix.go index bd087e7e0..37e5bf91b 100644 --- a/ethutil/script_unix.go +++ b/ethutil/script_unix.go @@ -1,3 +1,5 @@ +// +build !windows + package ethutil import ( -- cgit v1.2.3 From 7db44b56b05a0b859e4d369736cdb86d35cbb860 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 5 Nov 2014 00:32:51 +0100 Subject: Updated to ethereum serpent --- ethutil/script_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethutil/script_unix.go') diff --git a/ethutil/script_unix.go b/ethutil/script_unix.go index 37e5bf91b..6827d4e2f 100644 --- a/ethutil/script_unix.go +++ b/ethutil/script_unix.go @@ -6,9 +6,9 @@ import ( "fmt" "strings" + "github.com/ethereum/serpent-go" "github.com/obscuren/mutan" "github.com/obscuren/mutan/backends" - "github.com/obscuren/serpent-go" ) // General compile function -- cgit v1.2.3 From 3db9c8007086e0735695a6477c21056737519db9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 17:13:23 +0100 Subject: Removed mutan. Closes #183 --- ethutil/script_unix.go | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) (limited to 'ethutil/script_unix.go') diff --git a/ethutil/script_unix.go b/ethutil/script_unix.go index 6827d4e2f..9250dda57 100644 --- a/ethutil/script_unix.go +++ b/ethutil/script_unix.go @@ -2,47 +2,17 @@ package ethutil -import ( - "fmt" - "strings" - - "github.com/ethereum/serpent-go" - "github.com/obscuren/mutan" - "github.com/obscuren/mutan/backends" -) +import "github.com/ethereum/serpent-go" // General compile function func Compile(script string, silent bool) (ret []byte, err error) { if len(script) > 2 { - line := strings.Split(script, "\n")[0] - - if len(line) > 1 && line[0:2] == "#!" { - switch line { - case "#!serpent": - byteCode, err := serpent.Compile(script) - if err != nil { - return nil, err - } - - return byteCode, nil - } - } else { - - compiler := mutan.NewCompiler(backend.NewEthereumBackend()) - compiler.Silent = silent - byteCode, errors := compiler.Compile(strings.NewReader(script)) - if len(errors) > 0 { - var errs string - for _, er := range errors { - if er != nil { - errs += er.Error() - } - } - return nil, fmt.Errorf("%v", errs) - } - - return byteCode, nil + byteCode, err := serpent.Compile(script) + if err != nil { + return nil, err } + + return byteCode, nil } return nil, nil -- cgit v1.2.3