-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathffi_api.h
More file actions
56 lines (40 loc) · 1.17 KB
/
ffi_api.h
File metadata and controls
56 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef FFI_API_H
#define FFI_API_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> // For size_t
#ifdef _WIN32
#define EXPORT_API __declspec(dllexport)
#else
#define EXPORT_API __attribute__((visibility("default")))
#endif
typedef struct {
char** strings;
size_t count;
} StringArray;
typedef struct {
int* data;
size_t count;
} IntArray;
typedef struct {
int code; // 0 for success, non-zero for error
char* message; // Error message string (allocated by C++, freed by Dart)
} FfiResult;
// 函数名称改为更能反映其作用的
EXPORT_API StringArray* get_hardcoded_vm_instructions();
EXPORT_API void free_string_array(StringArray* array);
EXPORT_API void free_int_array_data(int* data);
EXPORT_API void free_ffi_result_message(char* message);
EXPORT_API size_t get_vm_pc();
EXPORT_API void step_vm();
EXPORT_API void reset_vm_program();
EXPORT_API IntArray get_vm_all_registers();
EXPORT_API IntArray get_vm_all_memory();
EXPORT_API bool get_vm_zero_flag();
EXPORT_API bool get_vm_sign_flag();
EXPORT_API FfiResult load_program(const char* source, StringArray** out_program_array);
#ifdef __cplusplus
}
#endif
#endif // FFI_API_H