From d193e16662b1f22476f77fb5ff5fc2500f86d4d7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 10 Nov 2020 12:39:52 +0300 Subject: [PATCH] compiler: support `System.Binary.Atoi/Itoa` syscalls --- pkg/compiler/syscall.go | 2 ++ pkg/interop/binary/binary.go | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index d69952f4d..3ad960b4b 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -5,11 +5,13 @@ import "github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames" // All lists are sorted, keep 'em this way, please. var syscalls = map[string]map[string]string{ "binary": { + "Atoi": interopnames.SystemBinaryAtoi, "Base58Decode": interopnames.SystemBinaryBase58Decode, "Base58Encode": interopnames.SystemBinaryBase58Encode, "Base64Decode": interopnames.SystemBinaryBase64Decode, "Base64Encode": interopnames.SystemBinaryBase64Encode, "Deserialize": interopnames.SystemBinaryDeserialize, + "Itoa": interopnames.SystemBinaryItoa, "Serialize": interopnames.SystemBinarySerialize, }, "blockchain": { diff --git a/pkg/interop/binary/binary.go b/pkg/interop/binary/binary.go index e5f834cfb..a53f51ac4 100644 --- a/pkg/interop/binary/binary.go +++ b/pkg/interop/binary/binary.go @@ -40,3 +40,15 @@ func Base58Encode(b []byte) string { func Base58Decode(b []byte) []byte { return nil } + +// Itoa converts num in a given base to string. Base should be either 10 or 16. +// It uses `System.Binary.Itoa` syscall. +func Itoa(num int, base int) string { + return "" +} + +// Atoi converts string to a number in a given base. Base should be either 10 or 16. +// It uses `System.Binary.Atoi` syscall. +func Atoi(s string, base int) int { + return 0 +}