Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Correcting name the export var Handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Jan 25, 2020
1 parent 56ecb54 commit 64c0c8a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 36 deletions.
6 changes: 6 additions & 0 deletions include/skytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ typedef Handle UnspentOutputsSummary__Handle;
* */
typedef Handle SortableTransactions__Handle;

/**
* Handle for cipher.Addresser
* */

typedef Handle Addresser__Handle;

typedef GoUint32_ (*FeeCalcFunc)(Transaction__Handle handle, GoUint64_* pFee, void* context);

typedef struct {
Expand Down
11 changes: 5 additions & 6 deletions lib/cgo/cli.generate_addrs.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package main

import (
"reflect"
"unsafe"

cipher "github.com/SkycoinProject/skycoin/src/cipher"
cli "github.com/SkycoinProject/skycoin/src/cli"
"reflect"
"unsafe"
)

/*
Expand Down Expand Up @@ -37,7 +36,7 @@ func SKY_cli_GenerateAddressesInFile(_walletFile string, _num uint64, _pr *C.Pas
}

//export SKY_cli_FormatAddressesAsJSON
func SKY_cli_FormatAddressesAsJSON(_addrs []C.cipher__Addresser, _arg1 *C.GoString_) (____error_code uint32) {
func SKY_cli_FormatAddressesAsJSON(_addrs *C.Addresser__Handle, _arg1 *C.GoString_) (____error_code uint32) {
addrs := *(*[]cipher.Addresser)(unsafe.Pointer(&_addrs))
__arg1, ____return_err := cli.FormatAddressesAsJSON(addrs)
____error_code = libErrorCode(____return_err)
Expand All @@ -48,15 +47,15 @@ func SKY_cli_FormatAddressesAsJSON(_addrs []C.cipher__Addresser, _arg1 *C.GoStri
}

//export SKY_cli_FormatAddressesAsJoinedArray
func SKY_cli_FormatAddressesAsJoinedArray(_addrs []C.cipher__Addresser, _arg1 *C.GoString_) (____error_code uint32) {
func SKY_cli_FormatAddressesAsJoinedArray(_addrs *C.Addresser__Handle, _arg1 *C.GoString_) (____error_code uint32) {
addrs := *(*[]cipher.Addresser)(unsafe.Pointer(&_addrs))
__arg1 := cli.FormatAddressesAsJoinedArray(addrs)
copyString(__arg1, _arg1)
return
}

//export SKY_cli_AddressesToStrings
func SKY_cli_AddressesToStrings(_addrs []C.cipher__Addresser, _arg1 *C.GoSlice_) (____error_code uint32) {
func SKY_cli_AddressesToStrings(_addrs *C.Addresser__Handle, _arg1 *C.GoSlice_) (____error_code uint32) {
addrs := *(*[]cipher.Addresser)(unsafe.Pointer(&_addrs))
__arg1 := cli.AddressesToStrings(addrs)
copyToGoSlice(reflect.ValueOf(__arg1), _arg1)
Expand Down
2 changes: 1 addition & 1 deletion lib/cgo/coin.transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ func SKY_coin_SortTransactions(tsh C.Transactions__Handle, pFeeCalc *C.FeeCalcul
}

//export SKY_coin_NewSortableTransactions
func SKY_coin_NewSortableTransactions(tsh C.Transactions__Handle, pFeeCalc *C.FeeCalculator, ptsh *C.SortableTransactions_Handle) (____error_code uint32) {
func SKY_coin_NewSortableTransactions(tsh C.Transactions__Handle, pFeeCalc *C.FeeCalculator, ptsh *C.SortableTransactions__Handle) (____error_code uint32) {
feeCalc := func(pTx *coin.Transaction) (uint64, error) {
var fee C.GoUint64_
handle := registerTransactionHandle(pTx)
Expand Down
2 changes: 1 addition & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ CGOGEN HANDLES coin__AddressUxOuts|AddressUxOuts
CGOGEN HANDLES readable__BuildInfo|BuildInfo
CGOGEN HANDLES readable__UnspentOutputsSummary|UnspentOutputsSummary
CGOGEN HANDLES hash__Hash|Hash
CGOGEN HANDLES readable__UnspentOutputsSummary|UnspentOutputsSummary
CGOGEN HANDLES cipher__Addresser|Addresser
CGOGEN TYPES_CONVERSION coin__FeeCalculator|FeeCalculator
54 changes: 27 additions & 27 deletions lib/cgo/libsky_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ func lookupCreateTransactionResponseHandle(handle C.CreateTransactionResponse__H
return nil, false
}

func registerBalanceResultHandle(obj *cli.BalanceResult) C.BalanceResult_Handle {
return (C.BalanceResult_Handle)(registerHandle(obj))
func registerBalanceResultHandle(obj *cli.BalanceResult) C.BalanceResult__Handle {
return (C.BalanceResult__Handle)(registerHandle(obj))
}

func lookupBalanceResultHandle(handle C.BalanceResult_Handle) (*cli.BalanceResult, bool) {
func lookupBalanceResultHandle(handle C.BalanceResult__Handle) (*cli.BalanceResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.BalanceResult); isOK {
Expand All @@ -390,11 +390,11 @@ func lookupBalanceResultHandle(handle C.BalanceResult_Handle) (*cli.BalanceResul
return nil, false
}

func registerTransactionResultHandle(obj *cli.TxnResult) C.TransactionResult_Handle {
return (C.TransactionResult_Handle)(registerHandle(obj))
func registerTransactionResultHandle(obj *cli.TxnResult) C.TransactionResult__Handle {
return (C.TransactionResult__Handle)(registerHandle(obj))
}

func lookupTransactionResultHandle(handle C.TransactionResult_Handle) (*cli.TxnResult, bool) {
func lookupTransactionResultHandle(handle C.TransactionResult__Handle) (*cli.TxnResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.TxnResult); isOK {
Expand All @@ -404,11 +404,11 @@ func lookupTransactionResultHandle(handle C.TransactionResult_Handle) (*cli.TxnR
return nil, false
}

func registerSortableTransactiontHandle(obj *coin.SortableTransactions) C.SortableTransactions_Handle {
return (C.SortableTransactions_Handle)(registerHandle(obj))
func registerSortableTransactiontHandle(obj *coin.SortableTransactions) C.SortableTransactions__Handle {
return (C.SortableTransactions__Handle)(registerHandle(obj))
}

func lookupSortableTransactionHandle(handle C.SortableTransactions_Handle) (*coin.SortableTransactions, bool) {
func lookupSortableTransactionHandle(handle C.SortableTransactions__Handle) (*coin.SortableTransactions, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*coin.SortableTransactions); isOK {
Expand All @@ -418,11 +418,11 @@ func lookupSortableTransactionHandle(handle C.SortableTransactions_Handle) (*coi
return nil, false
}

func registerOutputsResultHandle(obj *cli.OutputsResult) C.OutputsResult_Handle {
return (C.OutputsResult_Handle)(registerHandle(obj))
func registerOutputsResultHandle(obj *cli.OutputsResult) C.OutputsResult__Handle {
return (C.OutputsResult__Handle)(registerHandle(obj))
}

func lookupOutputsResultHandle(handle C.OutputsResult_Handle) (*cli.OutputsResult, bool) {
func lookupOutputsResultHandle(handle C.OutputsResult__Handle) (*cli.OutputsResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.OutputsResult); isOK {
Expand All @@ -432,11 +432,11 @@ func lookupOutputsResultHandle(handle C.OutputsResult_Handle) (*cli.OutputsResul
return nil, false
}

func registerStatusResultHandle(obj *cli.StatusResult) C.StatusResult_Handle {
return (C.StatusResult_Handle)(registerHandle(obj))
func registerStatusResultHandle(obj *cli.StatusResult) C.StatusResult__Handle {
return (C.StatusResult__Handle)(registerHandle(obj))
}

func lookupStatusResultHandle(handle C.StatusResult_Handle) (*cli.StatusResult, bool) {
func lookupStatusResultHandle(handle C.StatusResult__Handle) (*cli.StatusResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.StatusResult); isOK {
Expand All @@ -446,11 +446,11 @@ func lookupStatusResultHandle(handle C.StatusResult_Handle) (*cli.StatusResult,
return nil, false
}

func registerAddressUxOutHandle(obj *coin.AddressUxOuts) C.AddressUxOuts_Handle {
return (C.AddressUxOuts_Handle)(registerHandle(obj))
func registerAddressUxOutHandle(obj *coin.AddressUxOuts) C.AddressUxOuts__Handle {
return (C.AddressUxOuts__Handle)(registerHandle(obj))
}

func lookupAddressUxOutHandle(handle C.AddressUxOuts_Handle) (*coin.AddressUxOuts, bool) {
func lookupAddressUxOutHandle(handle C.AddressUxOuts__Handle) (*coin.AddressUxOuts, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*coin.AddressUxOuts); isOK {
Expand All @@ -460,11 +460,11 @@ func lookupAddressUxOutHandle(handle C.AddressUxOuts_Handle) (*coin.AddressUxOut
return nil, false
}

func registerHashHandle(obj *hash.Hash) C.Hash_Handle {
return (C.Hash_Handle)(registerHandle(obj))
func registerHashHandle(obj *hash.Hash) C.Hash__Handle {
return (C.Hash__Handle)(registerHandle(obj))
}

func lookupHashHandle(handle C.Hash_Handle) (*hash.Hash, bool) {
func lookupHashHandle(handle C.Hash__Handle) (*hash.Hash, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*hash.Hash); isOK {
Expand Down Expand Up @@ -494,11 +494,11 @@ func SKY_handle_copy(handle C.Handle, copy *C.Handle) uint32 {
}
}

func registerReadableUnspentOutputsSummaryHandle(obj *readable.UnspentOutputsSummary) C.ReadableUnspentOutputsSummary_Handle {
return (C.ReadableUnspentOutputsSummary_Handle)(registerHandle(obj))
func registerReadableUnspentOutputsSummaryHandle(obj *readable.UnspentOutputsSummary) C.ReadableUnspentOutputsSummary__Handle {
return (C.ReadableUnspentOutputsSummary__Handle)(registerHandle(obj))
}

func lookupReadableUnspentOutputsSummaryHandle(handle C.ReadableUnspentOutputsSummary_Handle) (*readable.UnspentOutputsSummary, bool) {
func lookupReadableUnspentOutputsSummaryHandle(handle C.ReadableUnspentOutputsSummary__Handle) (*readable.UnspentOutputsSummary, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*readable.UnspentOutputsSummary); isOK {
Expand All @@ -508,11 +508,11 @@ func lookupReadableUnspentOutputsSummaryHandle(handle C.ReadableUnspentOutputsSu
return nil, false
}

func registerBuildInfoHandle(obj *readable.BuildInfo) C.BuildInfo_Handle {
return (C.BuildInfo_Handle)(registerHandle(obj))
func registerBuildInfoHandle(obj *readable.BuildInfo) C.BuildInfo__Handle {
return (C.BuildInfo__Handle)(registerHandle(obj))
}

func lookupBuildInfoHandle(handle C.BuildInfo_Handle) (*readable.BuildInfo, bool) {
func lookupBuildInfoHandle(handle C.BuildInfo__Handle) (*readable.BuildInfo, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*readable.BuildInfo); isOK {
Expand Down
2 changes: 1 addition & 1 deletion lib/cgo/libsky_handle_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func SKY_api_Handle_GetWalletLastSeed(handle C.MetaWallet__Handle,
}

//export SKY_api_Handle_GetBuildInfoData
func SKY_api_Handle_GetBuildInfoData(handle C.BuildInfo_Handle,
func SKY_api_Handle_GetBuildInfoData(handle C.BuildInfo__Handle,
version *C.GoString_, commit *C.GoString_, branch *C.GoString_) uint32 {
bi, ok := lookupBuildInfoHandle(handle)
if ok {
Expand Down

0 comments on commit 64c0c8a

Please sign in to comment.