diff --git a/include/cli.cli.go.h b/include/cli.cli.go.h index c8b119586..c9e706b03 100644 --- a/include/cli.cli.go.h +++ b/include/cli.cli.go.h @@ -1,7 +1,17 @@ -typedef struct { - void* data; ///< Pointer to buffer containing slice data. - GoInt_ len; ///< Number of items stored in slice buffer - GoInt_ cap; ///< Maximum number of items that fits in this slice - ///< considering allocated memory and item type's - ///< size. -} cli__PasswordFromBytes; +typedef struct{ + GoString_ DataDir; + GoString_ Coin; + GoString_ RPCAddress; + GoString_ RPCUsername; + GoString_ RPCPassword; +} cli__Config; +typedef struct{ + GoInt32_ _unnamed; +} cli__WalletLoadError; +typedef struct{ + GoInt32_ _unnamed; +} cli__WalletSaveError; +typedef GoInterface_ cli__PasswordReader; +typedef GoSlice_ cli__PasswordFromBytes; +typedef struct{ +} cli__PasswordFromTerm; diff --git a/lib/cgo/cli.cli.go b/lib/cgo/cli.cli.go index 3d44f8bb2..2e2dbe26e 100644 --- a/lib/cgo/cli.cli.go +++ b/lib/cgo/cli.cli.go @@ -1,9 +1,10 @@ package main import ( + "reflect" "unsafe" - "github.com/SkycoinProject/skycoin/src/cli" + cli "github.com/SkycoinProject/skycoin/src/cli" ) /* @@ -12,76 +13,81 @@ import ( #include #include "skytypes.h" + #include "skyfee.h" */ import "C" //export SKY_cli_LoadConfig -func SKY_cli_LoadConfig(_arg0 *C.Config__Handle) (____error_code uint32) { +func SKY_cli_LoadConfig(_arg0 *C.cli__Config) (____error_code uint32) { __arg0, ____return_err := cli.LoadConfig() ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg0 = registerConfigHandle(&__arg0) + *_arg0 = *(*C.cli__Config)(unsafe.Pointer(&__arg0)) } return } //export SKY_cli_Config_FullDBPath -func SKY_cli_Config_FullDBPath(_c C.Config__Handle, _arg0 *string) (____error_code uint32) { - __c, okc := lookupConfigHandle(_c) - if !okc { - ____error_code = SKY_BAD_HANDLE - return - } - c := *__c - *_arg0 = c.FullDBPath() +func SKY_cli_Config_FullDBPath(_c *C.cli__Config, _arg0 *C.GoString_) (____error_code uint32) { + c := *(*cli.Config)(unsafe.Pointer(_c)) + __arg0 := c.FullDBPath() + copyString(__arg0, _arg0) return } //export SKY_cli_NewCLI -func SKY_cli_NewCLI(_cfg C.Config__Handle, _arg1 *C.CLI__Handle) (____error_code uint32) { - __cfg, okcfg := lookupConfigHandle(_cfg) - if !okcfg { - ____error_code = SKY_BAD_HANDLE - return - } - cfg := *__cfg +func SKY_cli_NewCLI(_cfg *C.cli__Config, _arg1 *C.CLI__Handle) (____error_code uint32) { + cfg := *(*cli.Config)(unsafe.Pointer(_cfg)) __arg1, ____return_err := cli.NewCLI(cfg) ____error_code = libErrorCode(____return_err) if ____return_err == nil { - if cmd, ok := inplaceCobraCommand(__arg1); ok { - *_arg1 = registerCLIHandle(cmd) - } else { - ____error_code = SKY_ERROR - } + *_arg1 = registerCLIHandle(__arg1) } return } -//export SKY_cli_NewPasswordReader -func SKY_cli_NewPasswordReader(_password []byte, passwordReader *C.PasswordReader__Handle) { - password := *(*[]byte)(unsafe.Pointer(&_password)) - pr := cli.NewPasswordReader(password) - *passwordReader = registerPasswordReaderHandle(&pr) +//export SKY_cli_WalletLoadError_Error +func SKY_cli_WalletLoadError_Error(_e *C.cli__WalletLoadError, _arg0 *C.GoString_) (____error_code uint32) { + e := *(*cli.WalletLoadError)(unsafe.Pointer(_e)) + __arg0 := e.Error() + copyString(__arg0, _arg0) + return +} + +//export SKY_cli_WalletSaveError_Error +func SKY_cli_WalletSaveError_Error(_e *C.cli__WalletSaveError, _arg0 *C.GoString_) (____error_code uint32) { + e := *(*cli.WalletSaveError)(unsafe.Pointer(_e)) + __arg0 := e.Error() + copyString(__arg0, _arg0) + return } //export SKY_cli_PasswordFromBytes_Password -func SKY_cli_PasswordFromBytes_Password(_p *C.cli__PasswordFromBytes, _arg0 *[]byte) (____error_code uint32) { +func SKY_cli_PasswordFromBytes_Password(_p *C.cli__PasswordFromBytes, _arg0 *C.GoSlice_) (____error_code uint32) { p := *(*cli.PasswordFromBytes)(unsafe.Pointer(_p)) __arg0, ____return_err := p.Password() ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg0 = __arg0 + copyToGoSlice(reflect.ValueOf(__arg0), _arg0) } return } //export SKY_cli_PasswordFromTerm_Password -func SKY_cli_PasswordFromTerm_Password(_arg0 *[]byte) (____error_code uint32) { - p := cli.PasswordFromTerm{} +func SKY_cli_PasswordFromTerm_Password(_p *C.cli__PasswordFromTerm, _arg0 *C.GoSlice_) (____error_code uint32) { + p := *(*cli.PasswordFromTerm)(unsafe.Pointer(_p)) __arg0, ____return_err := p.Password() ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg0 = __arg0 + copyToGoSlice(reflect.ValueOf(__arg0), _arg0) } return } + +//export SKY_cli_NewPasswordReader +func SKY_cli_NewPasswordReader(_p []byte, _arg1 *C.PasswordReader__Handle) (____error_code uint32) { + p := *(*[]byte)(unsafe.Pointer(&_p)) + __arg1 := cli.NewPasswordReader(p) + *_arg1 = registerPasswordReaderHandle(&__arg1) + return +} diff --git a/lib/cgo/handles b/lib/cgo/handles index 7093d6817..f8fa7c1ee 100644 --- a/lib/cgo/handles +++ b/lib/cgo/handles @@ -15,8 +15,8 @@ CGOGEN HANDLES api__WalletSeedResponse|WalletSeedResponse CGOGEN HANDLES params__Distribution|Distribution CGOGEN HANDLES api__CreateWalletOptions|CreateWalletOptions CGOGEN HANDLES api__WalletRecoverRequest|WalletRecoverRequest -CGOGEN HANDLES bip32__Publickey|Publickey -CGOGEN HANDLES bip32__Privatekey|Privatekey +CGOGEN HANDLES bip32__PublicKey|PublicKey +CGOGEN HANDLES bip32__PrivateKey|PrivateKey CGOGEN HANDLES bip32__Path|Path CGOGEN HANDLES bip44__Coin|Coin CGOGEN HANDLES bip44__Account|Account