Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added util.cipher
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Feb 4, 2020
1 parent c89ef43 commit 0d89afd
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ docs: docs-libc ## Generate documentation for all libraries
lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
# lib/cgo needs separate linting rules
golangci-lint run -c .golangci.libcgo.yml ./lib/cgo/...
golangci-lint run -c .golangci.yml ./lib/cgo/...
# The govet version in golangci-lint is out of date and has spurious warnings, run it separately
go vet -all ./...

Expand Down
83 changes: 83 additions & 0 deletions lib/cgo/util.cipher.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package main

import (
"reflect"
"unsafe"

util "github.com/fibercrypto/fibercryptowallet/src/util"
)

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

//export FC_util_NewGenericAddress
func FC_util_NewGenericAddress(_addr string, _arg1 *C.util__GenericAddress) (____error_code uint32) {
addr := _addr
__arg1 := util.NewGenericAddress(addr)
*_arg1 = *(*C.util__GenericAddress)(unsafe.Pointer(&__arg1))
return
}

//export FC_util_GenericAddress_Bytes
func FC_util_GenericAddress_Bytes(_ga *C.util__GenericAddress, _arg0 *C.GoSlice_) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.Bytes()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_util_GenericAddress_Checksum
func FC_util_GenericAddress_Checksum(_ga *C.util__GenericAddress, _arg0 *C.core__Checksum) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.Checksum()
*_arg0 = *(*C.core__Checksum)(unsafe.Pointer(&__arg0))
return
}

//export FC_util_GenericAddress_Verify
func FC_util_GenericAddress_Verify(_ga *C.util__GenericAddress) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
____return_err := ga.Verify(nil)
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
}
return
}

//export FC_util_GenericAddress_Null
func FC_util_GenericAddress_Null(_ga *C.util__GenericAddress, _arg0 *bool) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.Null()
*_arg0 = __arg0
return
}

//export FC_util_GenericAddress_IsBip32
func FC_util_GenericAddress_IsBip32(_ga *C.util__GenericAddress, _arg0 *bool) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.IsBip32()
*_arg0 = __arg0
return
}

//export FC_util_GenericAddress_String
func FC_util_GenericAddress_String(_ga *C.util__GenericAddress, _arg0 *C.GoString_) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.String()
copyString(__arg0, _arg0)
return
}

//export FC_util_GenericAddress_GetCryptoAccount
func FC_util_GenericAddress_GetCryptoAccount(_ga *C.util__GenericAddress, _arg0 *C.core__CryptoAccount) (____error_code uint32) {
ga := (*util.GenericAddress)(unsafe.Pointer(_ga))
__arg0 := ga.GetCryptoAccount()
*_arg0 = *(*C.core__CryptoAccount)(unsafe.Pointer(&__arg0))
return
}

0 comments on commit 0d89afd

Please sign in to comment.