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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#[link(wasm_import_module = "component")]
extern "C" {
	#[link_name = "listStart"]
	pub fn list_start(type_pointer: *const u8, length: usize) -> i32;

	#[link_name = "listNext"]
	pub fn list_next(buffer: *mut u8) -> i32;

	#[link_name = "listType"]
	pub fn list_type(buffer: *mut u8, length: usize) -> isize;

	#[link_name = "type"]
	pub fn component_type(address: *const u8, buffer: *mut u8, buffer_length: usize) -> isize;

	pub fn slot(address: *const u8, length: usize) -> i32;

	#[link_name = "methodsStartComponent"]
	pub fn methods_start_component(address: *const u8) -> i32;

	#[link_name = "methodsStartValue"]
	pub fn methods_start_value(descriptor: u32) -> i32;

	#[link_name = "methodsNext"]
	pub fn methods_next(buffer: *mut u8, length: usize, attributes: *mut u32) -> isize;

	#[link_name = "documentationComponent"]
	pub fn documentation_component(
		address: *const u8,
		method: *const u8,
		method_length: usize,
		buffer: *mut u8,
		buffer_length: usize,
	) -> isize;

	#[link_name = "documentationValue"]
	pub fn documentation_value(
		descriptor: u32,
		method: *const u8,
		method_length: usize,
		buffer: *mut u8,
		buffer_length: usize,
	) -> isize;

	#[link_name = "invokeComponentMethod"]
	pub fn invoke_component_method(
		address: *const u8,
		method: *const u8,
		method_length: usize,
		params: *const u8,
	) -> i32;

	#[link_name = "invokeValue"]
	pub fn invoke_value(descriptor: u32, params: *const u8) -> i32;

	#[link_name = "invokeValueIndexedRead"]
	pub fn invoke_value_indexed_read(descriptor: u32, params: *const u8) -> i32;

	#[link_name = "invokeValueIndexedWrite"]
	pub fn invoke_value_indexed_write(descriptor: u32, params: *const u8) -> i32;

	#[link_name = "invokeValueMethod"]
	pub fn invoke_value_method(
		descriptor: u32,
		method: *const u8,
		method_length: usize,
		params: *const u8,
	) -> i32;

	#[link_name = "invokeEnd"]
	pub fn invoke_end(buffer: *mut u8, length: usize) -> isize;

	#[link_name = "invokeCancel"]
	pub fn invoke_cancel();

	#[link_name = "lastExceptionMessage"]
	pub fn last_exception_message(buffer: *mut u8, buffer_length: usize) -> isize;

	#[link_name = "lastExceptionIsType"]
	pub fn last_exception_is_type(class: *const u8, class_length: usize) -> i32;
}