Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Clean old definitions in libsky_handle.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Feb 2, 2020
1 parent a68941d commit 71dc78d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 211 deletions.
210 changes: 0 additions & 210 deletions lib/cgo/libsky_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ package main
import "C"

import (
"hash"

"github.com/spf13/cobra"

"github.com/SkycoinProject/skycoin/src/api"
Expand Down Expand Up @@ -67,10 +65,6 @@ func lookupWalletHandle(handle C.Wallet__Handle) (*wallet.Wallet, bool) {
return nil, false
}

func registerCollectionWalletHandle(obj *wallet.CollectionWallet) C.CollectionWallet__Handle {
return (C.CollectionWallet__Handle)(registerHandle(obj))
}

func lookupCollectionWalletHandle(handle C.Wallet__Handle) (*wallet.CollectionWallet, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -81,10 +75,6 @@ func lookupCollectionWalletHandle(handle C.Wallet__Handle) (*wallet.CollectionWa
return nil, false
}

func registerMetaWalletHandle(obj *wallet.Meta) C.MetaWallet__Handle {
return (C.MetaWallet__Handle)(registerHandle(obj))
}

func lookupMetaWalletHandle(handle C.MetaWallet__Handle) (*wallet.Meta, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -95,34 +85,10 @@ func lookupMetaWalletHandle(handle C.MetaWallet__Handle) (*wallet.Meta, bool) {
return nil, false
}

func registerReadableWalletHandle(obj *wallet.Readable) C.ReadableWallet__Handle {
return (C.ReadableWallet__Handle)(registerHandle(obj))
}

func lookupReadableWalletHandle(handle C.ReadableWallet__Handle) (*wallet.Readable, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*wallet.Readable); isOK {
return obj, true
}
}
return nil, false
}

func registerReadableEntryHandle(obj *wallet.ReadableEntry) C.ReadableEntry__Handle {
return (C.ReadableEntry__Handle)(registerHandle(obj))
}

func lookupReadableEntryHandle(handle C.ReadableEntry__Handle) (*wallet.ReadableEntry, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*wallet.ReadableEntry); isOK {
return obj, true
}
}
return nil, false
}

func registerOptionsHandle(obj *wallet.Options) C.Options__Handle {
return (C.Options__Handle)(registerHandle(obj))
}
Expand All @@ -137,10 +103,6 @@ func lookupOptionsHandle(handle C.Options__Handle) (*wallet.Options, bool) {
return nil, false
}

func registerConfigHandle(obj *cli.Config) C.Config__Handle {
return (C.Config__Handle)(registerHandle(obj))
}

func lookupConfigHandle(handle C.Config__Handle) (*cli.Config, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -151,10 +113,6 @@ func lookupConfigHandle(handle C.Config__Handle) (*cli.Config, bool) {
return nil, false
}

func registerCLIHandle(obj *cobra.Command) C.CLI__Handle {
return (C.CLI__Handle)(registerHandle(obj))
}

func lookupCLIHandle(handle C.CLI__Handle) (*cobra.Command, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand Down Expand Up @@ -207,10 +165,6 @@ func lookupWalletResponseHandle(handle C.WalletResponse__Handle) (*api.WalletRes
return nil, false
}

func registerCreateTransactionRequestHandle(obj *api.CreateTransactionRequest) C.CreateTransactionRequest__Handle {
return (C.CreateTransactionRequest__Handle)(registerHandle(obj))
}

func lookupCreateTransactionRequestHandle(handle C.CreateTransactionRequest__Handle) (*api.CreateTransactionRequest, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand Down Expand Up @@ -263,10 +217,6 @@ func lookupTransactionsHandle(handle C.Transactions__Handle) (*coin.Transactions
return nil, false
}

func registerSortableTransactionsHandle(obj *coin.SortableTransactions) C.SortableTransactions__Handle {
return (C.Transactions__Handle)(registerHandle(obj))
}

func lookupSortableTransactionsHandle(handle C.SortableTransactions__Handle) (*coin.SortableTransactions, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -291,10 +241,6 @@ func lookupBlockHandle(handle C.Block__Handle) (*coin.Block, bool) {
return nil, false
}

func registerSignedBlockHandle(obj *coin.SignedBlock) C.SignedBlock__Handle {
return (C.SignedBlock__Handle)(registerHandle(obj))
}

func lookupSignedBlockHandle(handle C.SignedBlock__Handle) (*coin.SignedBlock, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand Down Expand Up @@ -337,118 +283,22 @@ func registerCreatedTransactionOutputHandle(obj *api.CreatedTransactionOutput) C
return (C.CreatedTransactionOutput__Handle)(registerHandle(obj))
}

func lookupCreatedTransactionOutputHandle(handle C.CreatedTransactionOutput__Handle) (*api.CreatedTransactionOutput, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*api.CreatedTransactionOutput); isOK {
return obj, true
}
}
return nil, false
}

func registerCreatedTransactionInputHandle(obj *api.CreatedTransactionInput) C.CreatedTransactionInput__Handle {
return (C.CreatedTransactionInput__Handle)(registerHandle(obj))
}

func lookupCreatedTransactionInputHandle(handle C.CreatedTransactionInput__Handle) (*api.CreatedTransactionInput, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*api.CreatedTransactionInput); isOK {
return obj, true
}
}
return nil, false
}

func registerCreateTransactionResponseHandle(obj *api.CreateTransactionResponse) C.CreateTransactionResponse__Handle {
return (C.CreateTransactionResponse__Handle)(registerHandle(obj))
}

func lookupCreateTransactionResponseHandle(handle C.CreateTransactionResponse__Handle) (*api.CreateTransactionResponse, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*api.CreateTransactionResponse); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupBalanceResultHandle(handle C.BalanceResult__Handle) (*cli.BalanceResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.BalanceResult); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupTransactionResultHandle(handle C.TransactionResult__Handle) (*cli.TxnResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.TxnResult); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupSortableTransactionHandle(handle C.SortableTransactions__Handle) (*coin.SortableTransactions, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*coin.SortableTransactions); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupOutputsResultHandle(handle C.OutputsResult__Handle) (*cli.OutputsResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.OutputsResult); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupStatusResultHandle(handle C.StatusResult__Handle) (*cli.StatusResult, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*cli.StatusResult); isOK {
return obj, true
}
}
return nil, false
}

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

func lookupAddressUxOutHandle(handle C.AddressUxOuts__Handle) (*coin.AddressUxOuts, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -459,20 +309,6 @@ func lookupAddressUxOutHandle(handle C.AddressUxOuts__Handle) (*coin.AddressUxOu
return nil, false
}

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

func lookupHashHandle(handle C.Hash__Handle) (*hash.Hash, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*hash.Hash); isOK {
return obj, true
}
}
return nil, false
}

func closeHandle(handle Handle) {
delete(handleMap, handle)
}
Expand All @@ -493,20 +329,6 @@ 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 lookupReadableUnspentOutputsSummaryHandle(handle C.ReadableUnspentOutputsSummary__Handle) (*readable.UnspentOutputsSummary, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*readable.UnspentOutputsSummary); isOK {
return obj, true
}
}
return nil, false
}

func registerBuildInfoHandle(obj *readable.BuildInfo) C.BuildInfo__Handle {
return (C.BuildInfo__Handle)(registerHandle(obj))
}
Expand Down Expand Up @@ -539,16 +361,6 @@ func registerWalletSeedResponseHandle(obj *api.WalletSeedResponse) C.WalletSeedR
return (C.WalletResponse__Handle)(registerHandle(obj))
}

func lookupWalletSeedResponseHandle(handle C.WalletSeedResponse__Handle) (*api.WalletSeedResponse, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*api.WalletSeedResponse); isOK {
return obj, true
}
}
return nil, false
}

func registerDistributionHandle(obj *params.Distribution) C.Distribution__Handle {
return (C.Distribution__Handle)(registerHandle(obj))
}
Expand All @@ -563,10 +375,6 @@ func lookupDistributionHandle(handle C.Distribution__Handle) (*params.Distributi
return nil, false
}

func registerCreateWalletOptionsHandle(obj *api.CreateWalletOptions) C.CreateWalletOptions__Handle {
return (C.CreateWalletOptions__Handle)(registerHandle(obj))
}

func lookupCreateWalletOptionsHandle(handle C.CreateWalletOptions__Handle) (*api.CreateWalletOptions, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -577,10 +385,6 @@ func lookupCreateWalletOptionsHandle(handle C.CreateWalletOptions__Handle) (*api
return nil, false
}

func registerWalletRecoverRequestHandle(obj *api.WalletRecoverRequest) C.WalletRecoverRequest__Handle {
return (C.CreateWalletOptions__Handle)(registerHandle(obj))
}

func lookupWalletRecoverRequestHandle(handle C.WalletRecoverRequest__Handle) (*api.WalletRecoverRequest, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand Down Expand Up @@ -661,10 +465,6 @@ func lookupAccountHandle(handle C.Account__Handle) (*bip44.Account, bool) {
return nil, false
}

func registerGetOutputserHandle(obj *cli.GetOutputser) C.GetOutputser__Handle {
return (C.GetOutputser__Handle)(registerHandle(obj))
}

func lookupGetOutputserHandle(handle C.GetOutputser__Handle) (*cli.GetOutputser, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
Expand All @@ -679,16 +479,6 @@ func registerUnspentOutputsSummaryHandle(obj *readable.UnspentOutputsSummary) C.
return (C.UnspentOutputsSummary__Handle)(registerHandle(obj))
}

func lookupUnspentOutputsSummaryHandle(handle C.UnspentOutputsSummary__Handle) (*readable.UnspentOutputsSummary, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*readable.UnspentOutputsSummary); isOK {
return obj, true
}
}
return nil, false
}

func registerAddressUxOutsHandle(obj *coin.AddressUxOuts) C.AddressUxOuts__Handle {
return (C.AddressUxOuts__Handle)(registerHandle(obj))
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cgo/tests/check_coin.transactions.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ START_TEST(TestTransactionOutputHours)
makeEmptyTransaction(&handle);
cipher__Address addr;
makeAddress(&addr);
int result;
GoUint32_ result;
result = SKY_coin_Transaction_PushOutput(&handle, &addr, 1000000, 100);
ck_assert(result == SKY_OK);
makeAddress(&addr);
Expand Down

0 comments on commit 71dc78d

Please sign in to comment.