Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Finalized cli.cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Jan 18, 2020
1 parent 051aada commit e4f888f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 42 deletions.
24 changes: 17 additions & 7 deletions include/cli.cli.go.h
Original file line number Diff line number Diff line change
@@ -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;
72 changes: 39 additions & 33 deletions lib/cgo/cli.cli.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"reflect"
"unsafe"

"github.com/SkycoinProject/skycoin/src/cli"
cli "github.com/SkycoinProject/skycoin/src/cli"
)

/*
Expand All @@ -12,76 +13,81 @@ import (
#include <stdlib.h>
#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
}
4 changes: 2 additions & 2 deletions lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e4f888f

Please sign in to comment.