mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
rename ffi func
This commit is contained in:
parent
e7cc11cc44
commit
76691e3e8c
@ -101,7 +101,7 @@ Completer<Uint8List> _sendToRust(FFIRequest request) {
|
||||
|
||||
final completer = Completer<Uint8List>();
|
||||
final port = singleCompletePort(completer);
|
||||
ffi.async_command(port.nativePort, input, bytes.length);
|
||||
ffi.async_event(port.nativePort, input, bytes.length);
|
||||
calloc.free(input);
|
||||
|
||||
return completer;
|
||||
|
@ -20,8 +20,8 @@ DynamicLibrary _open() {
|
||||
throw UnsupportedError('This platform is not supported.');
|
||||
}
|
||||
|
||||
/// C function `async_command`.
|
||||
void async_command(
|
||||
/// C function `async_event`.
|
||||
void async_event(
|
||||
int port,
|
||||
Pointer<Uint8> input,
|
||||
int len,
|
||||
@ -29,7 +29,7 @@ void async_command(
|
||||
_invoke_async(port, input, len);
|
||||
}
|
||||
|
||||
final _invoke_async_Dart _invoke_async = _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_command');
|
||||
final _invoke_async_Dart _invoke_async = _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
|
||||
typedef _invoke_async_C = Void Function(
|
||||
Int64 port,
|
||||
Pointer<Uint8> input,
|
||||
@ -41,15 +41,15 @@ typedef _invoke_async_Dart = void Function(
|
||||
int len,
|
||||
);
|
||||
|
||||
/// C function `command_sync`.
|
||||
Pointer<Uint8> sync_command(
|
||||
/// C function `sync_event`.
|
||||
Pointer<Uint8> sync_event(
|
||||
Pointer<Uint8> input,
|
||||
int len,
|
||||
) {
|
||||
return _invoke_sync(input, len);
|
||||
}
|
||||
|
||||
final _invoke_sync_Dart _invoke_sync = _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_command');
|
||||
final _invoke_sync_Dart _invoke_sync = _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
|
||||
typedef _invoke_sync_C = Pointer<Uint8> Function(
|
||||
Pointer<Uint8> input,
|
||||
Uint64 len,
|
||||
|
@ -3,12 +3,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int64_t init_sdk(char *path);
|
||||
|
||||
void async_command(int64_t port, const uint8_t *input, uintptr_t len);
|
||||
void async_event(int64_t port, const uint8_t *input, uintptr_t len);
|
||||
|
||||
const uint8_t *sync_command(const uint8_t *input, uintptr_t len);
|
||||
const uint8_t *sync_event(const uint8_t *input, uintptr_t len);
|
||||
|
||||
int32_t set_stream_port(int64_t port);
|
||||
|
||||
|
@ -3,12 +3,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int64_t init_sdk(char *path);
|
||||
|
||||
void async_command(int64_t port, const uint8_t *input, uintptr_t len);
|
||||
void async_event(int64_t port, const uint8_t *input, uintptr_t len);
|
||||
|
||||
const uint8_t *sync_command(const uint8_t *input, uintptr_t len);
|
||||
const uint8_t *sync_event(const uint8_t *input, uintptr_t len);
|
||||
|
||||
int32_t set_stream_port(int64_t port);
|
||||
|
||||
|
@ -33,7 +33,7 @@ pub extern "C" fn init_sdk(path: *mut c_char) -> i64 {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn async_command(port: i64, input: *const u8, len: usize) {
|
||||
pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) {
|
||||
let request: ModuleRequest = FFIRequest::from_u8_pointer(input, len).into();
|
||||
log::trace!(
|
||||
"[FFI]: {} Async Event: {:?} with {} port",
|
||||
@ -49,7 +49,7 @@ pub extern "C" fn async_command(port: i64, input: *const u8, len: usize) {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sync_command(input: *const u8, len: usize) -> *const u8 {
|
||||
pub extern "C" fn sync_event(input: *const u8, len: usize) -> *const u8 {
|
||||
let request: ModuleRequest = FFIRequest::from_u8_pointer(input, len).into();
|
||||
log::trace!("[FFI]: {} Sync Event: {:?}", &request.id, &request.event,);
|
||||
let _response = EventDispatch::sync_send(dispatch(), request);
|
||||
|
Loading…
Reference in New Issue
Block a user