Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.SecKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 3055c3d commit 425b1cf
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,17 @@ typedef Handle PexNodeIteratorMocks__Handle;
* PexNodeSetMocks__Handle Handle, struct mocks.PexNodeSet
*/
typedef Handle PexNodeSetMocks__Handle;

/**
* PubKeyMocks__Handle Handle, struct mocks.PubKey
*/
typedef Handle PubKeyMocks__Handle;

/**
* SecKeyMocks__Handle Handle, struct mocks.SecKey
*/
typedef Handle SecKeyMocks__Handle;

// Callbacks

/**
Expand Down
50 changes: 50 additions & 0 deletions lib/cgo/coin.mocks.SecKey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package main

import "reflect"

/*
#include <string.h>
#include <stdlib.h>
#include "fctypes.h"
*/
import "C"

//export FC_mocks_SecKey_Bytes
func FC_mocks_SecKey_Bytes(__m *C.SecKeyMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupSecKeyMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Bytes()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_SecKey_Null
func FC_mocks_SecKey_Null(__m *C.SecKeyMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupSecKeyMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Null()
*_arg0 = __arg0
return
}

//export FC_mocks_SecKey_Verify
func FC_mocks_SecKey_Verify(__m *C.SecKeyMocks__Handle) (____error_code uint32) {
_m, ok_m := lookupSecKeyMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
____return_err := _m.Verify()
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
}
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ CGOGEN HANDLES mocks__PEX|PEXMocks
CGOGEN HANDLES mocks__PexNode|PexNodeMocks
CGOGEN HANDLES mocks__PexNodeIterator|PexNodeIteratorMocks
CGOGEN HANDLES mocks__PexNodeSet|PexNodeSetMocks
CGOGEN HANDLES mocks__PubKey|PubKeyMocks
CGOGEN HANDLES mocks__PubKey|PubKeyMocks
CGOGEN HANDLES mocks__SecKey|SecKeyMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,3 +807,17 @@ func lookupPubKeyMocksHandle(handle C.PubKeyMocks__Handle) (*mocks.PubKey, bool)
func registerPubKeyMocksHandle(obj *mocks.PubKey) C.PubKeyMocks__Handle {
return (C.PubKeyMocks__Handle)(registerHandle(obj))
}

func lookupSecKeyMocksHandle(handle C.SecKeyMocks__Handle) (*mocks.SecKey, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.SecKey); isOK {
return obj, true
}
}
return nil, false
}

func registerSecKeyMocksHandle(obj *mocks.SecKey) C.SecKeyMocks__Handle {
return (C.SecKeyMocks__Handle)(registerHandle(obj))
}

0 comments on commit 425b1cf

Please sign in to comment.