forked from rogchap/v8go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv8go.h
56 lines (46 loc) · 1.26 KB
/
v8go.h
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 V8GO_H
#define V8GO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
typedef void* IsolatePtr;
typedef void* ContextPtr;
typedef void* ValuePtr;
typedef struct {
const char* msg;
const char* location;
const char* stack;
} RtnError;
typedef struct {
ValuePtr value;
RtnError error;
} RtnValue;
typedef struct {
size_t total_heap_size;
size_t total_heap_size_executable;
size_t total_physical_size;
size_t total_available_size;
size_t used_heap_size;
size_t heap_size_limit;
size_t malloced_memory;
size_t external_memory;
size_t peak_malloced_memory;
size_t number_of_native_contexts;
size_t number_of_detached_contexts;
} IsolateHStatistics;
extern void Init();
extern IsolatePtr NewIsolate();
extern void IsolateDispose(IsolatePtr ptr);
extern void IsolateTerminateExecution(IsolatePtr ptr);
extern IsolateHStatistics IsolationGetHeapStatistics(IsolatePtr ptr);
extern ContextPtr NewContext(IsolatePtr prt);
extern void ContextDispose(ContextPtr ptr);
extern RtnValue RunScript(ContextPtr ctx_ptr, const char* source, const char* origin);
extern void ValueDispose(ValuePtr ptr);
const char* ValueToString(ValuePtr ptr);
const char* Version();
#ifdef __cplusplus
} // extern "C"
#endif
#endif // V8GO_H