github.com/igggame/nebulas-go@v2.1.0+incompatible/nf/nbre/nbre_callback.go (about) 1 // Copyright (C) 2018 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // the go-nebulas library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 package nbre 20 21 /* 22 #include <stdint.h> 23 */ 24 import "C" 25 import ( 26 "unsafe" 27 ) 28 29 // NbreVersionFunc returns nbre version 30 //export NbreVersionFunc 31 func NbreVersionFunc(code C.int, holder unsafe.Pointer, major C.uint32_t, minor C.uint32_t, patch C.uint32_t) { 32 version := &Version{ 33 Major: uint64(major), 34 Minor: uint64(minor), 35 Patch: uint64(patch), 36 } 37 nbreHandled(code, holder, version, nil) 38 } 39 40 // NbreIrListFunc returns nbre ir list 41 //export NbreIrListFunc 42 func NbreIrListFunc(code C.int, holder unsafe.Pointer, ir_name_list *C.char) { 43 result := C.GoString(ir_name_list) 44 nbreHandled(code, holder, result, nil) 45 } 46 47 // NbreIrVersionsFunc returns nbre ir versions 48 //export NbreIrVersionsFunc 49 func NbreIrVersionsFunc(code C.int, holder unsafe.Pointer, ir_versions *C.char) { 50 result := C.GoString(ir_versions) 51 nbreHandled(code, holder, result, nil) 52 } 53 54 // NbreNrHandleFunc returns nbre nr handle 55 //export NbreNrHandleFunc 56 func NbreNrHandleFunc(code C.int, holder unsafe.Pointer, nr_handle *C.char) { 57 result := C.GoString(nr_handle) 58 nbreHandled(code, holder, result, nil) 59 } 60 61 // NbreNrResultByhandleFunc returns nbre nr list 62 //export NbreNrResultByhandleFunc 63 func NbreNrResultByhandleFunc(code C.int, holder unsafe.Pointer, nr_result *C.char) { 64 result := C.GoString(nr_result) 65 nbreHandled(code, holder, result, nil) 66 } 67 68 // NbreNrResultByHeightFunc returns nbre nr list 69 //export NbreNrResultByHeightFunc 70 func NbreNrResultByHeightFunc(code C.int, holder unsafe.Pointer, nr_result *C.char) { 71 result := C.GoString(nr_result) 72 nbreHandled(code, holder, result, nil) 73 } 74 75 // NbreNrSumFunc returns nbre nr summary data 76 //export NbreNrSumFunc 77 func NbreNrSumFunc(code C.int, holder unsafe.Pointer, nr_sum *C.char) { 78 result := C.GoString(nr_sum) 79 nbreHandled(code, holder, result, nil) 80 } 81 82 // NbreDipRewardFunc returns nbre dip list 83 //export NbreDipRewardFunc 84 func NbreDipRewardFunc(code C.int, holder unsafe.Pointer, dip_reward *C.char) { 85 result := C.GoString(dip_reward) 86 nbreHandled(code, holder, result, nil) 87 }