diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-16 21:28:33 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-16 21:28:33 +0800 |
commit | 702218008ee2b6d708d6b2821cdef80736bb3224 (patch) | |
tree | d55ff7ce88187082378e7d8e4c2f3aad14d23b4e /Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go | |
parent | 202362d9258335c695eb75f55f4be74a50a1af33 (diff) | |
download | go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.gz go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.zst go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.zip |
Add versioned dependencies from godep
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go new file mode 100644 index 000000000..39b60eed7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent.go @@ -0,0 +1,27 @@ +package serpent + +// #cgo CXXFLAGS: -I. -Ilangs/ -std=c++0x -Wall -fno-strict-aliasing +// #cgo LDFLAGS: -lstdc++ +// +// #include "cpp/api.h" +// +import "C" + +import ( + "encoding/hex" + "errors" + "unsafe" +) + +func Compile(str string) ([]byte, error) { + var err C.int + out := C.GoString(C.compileGo(C.CString(str), (*C.int)(unsafe.Pointer(&err)))) + + if err == C.int(1) { + return nil, errors.New(out) + } + + bytes, _ := hex.DecodeString(out) + + return bytes, nil +} |