1#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
2
3use std::ffi::c_void;
4use std::os::raw::{c_char, c_double, c_int};
5
6use crate::plugin2::EDIT_SECTION;
7
8#[repr(i32)]
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
11pub enum PARAM_TYPE {
12 NONE = -1,
13 NIL = 0,
14 BOOLEAN = 1,
15 LIGHTUSERDATA = 2,
16 NUMBER = 3,
17 STRING = 4,
18 TABLE = 5,
19 FUNCTION = 6,
20 USERDATA = 7,
21 THREAD = 8,
22}
23
24#[repr(C)]
26#[derive(Debug, Clone, Copy)]
27pub struct SCRIPT_MODULE_PARAM {
28 pub get_param_num: unsafe extern "C" fn() -> c_int,
31
32 pub get_param_int: unsafe extern "C" fn(index: c_int) -> c_int,
36
37 pub get_param_double: unsafe extern "C" fn(index: c_int) -> c_double,
41
42 pub get_param_string: unsafe extern "C" fn(index: c_int) -> *const c_char,
46
47 pub get_param_data: unsafe extern "C" fn(index: c_int) -> *mut c_void,
51
52 pub get_param_table_int: unsafe extern "C" fn(index: c_int, key: *const c_char) -> c_int,
57
58 pub get_param_table_double: unsafe extern "C" fn(index: c_int, key: *const c_char) -> c_double,
63
64 pub get_param_table_string:
69 unsafe extern "C" fn(index: c_int, key: *const c_char) -> *const c_char,
70
71 pub get_param_array_num: unsafe extern "C" fn(index: c_int) -> c_int,
75
76 pub get_param_array_int: unsafe extern "C" fn(index: c_int, key: c_int) -> c_int,
81
82 pub get_param_array_double: unsafe extern "C" fn(index: c_int, key: c_int) -> c_double,
87
88 pub get_param_array_string: unsafe extern "C" fn(index: c_int, key: c_int) -> *const c_char,
93
94 pub push_result_int: unsafe extern "C" fn(value: c_int),
97
98 pub push_result_double: unsafe extern "C" fn(value: c_double),
101
102 pub push_result_string: unsafe extern "C" fn(value: *const c_char),
105
106 pub push_result_data: unsafe extern "C" fn(value: *const c_void),
109
110 pub push_result_table_int:
115 unsafe extern "C" fn(key: *const *const c_char, value: *const c_int, num: c_int),
116
117 pub push_result_table_double:
122 unsafe extern "C" fn(key: *const *const c_char, value: *const c_double, num: c_int),
123
124 pub push_result_table_string:
129 unsafe extern "C" fn(key: *const *const c_char, value: *const *const c_char, num: c_int),
130
131 pub push_result_array_int: unsafe extern "C" fn(value: *const c_int, num: c_int),
135
136 pub push_result_array_double: unsafe extern "C" fn(value: *const c_double, num: c_int),
140
141 pub push_result_array_string: unsafe extern "C" fn(value: *const *const c_char, num: c_int),
145
146 pub set_error: unsafe extern "C" fn(message: *const c_char),
150
151 pub get_param_boolean: unsafe extern "C" fn(index: c_int) -> bool,
155
156 pub push_result_boolean: unsafe extern "C" fn(value: bool),
159
160 pub get_param_table_boolean: unsafe extern "C" fn(index: c_int, key: *const c_char) -> bool,
165
166 pub push_result_array_boolean: unsafe extern "C" fn(value: *const bool, num: c_int),
170
171 pub push_result_table_boolean:
176 unsafe extern "C" fn(key: *const *const c_char, value: *const bool, num: c_int),
177
178 pub edit: *mut EDIT_SECTION,
181
182 pub push_result_function: unsafe extern "C" fn(
186 func: unsafe extern "C" fn(smp: *mut SCRIPT_MODULE_PARAM),
187 userdata: *mut c_void,
188 ),
189
190 pub deprecated_push_result_meta_table: unsafe extern "C" fn(
192 func_getter: unsafe extern "C" fn(smp: *mut SCRIPT_MODULE_PARAM),
193 func_setter: unsafe extern "C" fn(smp: *mut SCRIPT_MODULE_PARAM),
194 userdata: *mut c_void,
195 ),
196
197 pub userdata: *mut c_void,
200
201 pub push_result_meta_table: unsafe extern "C" fn(
206 meta_method_functions: *const META_METHOD_FUNCTION,
207 userdata: *mut c_void,
208 ),
209
210 pub get_param_meta_table: unsafe extern "C" fn(
215 index: c_int,
216 meta_method_functions: *mut META_METHOD_FUNCTION,
217 ) -> *mut c_void,
218
219 pub get_param_type: unsafe extern "C" fn(index: c_int) -> PARAM_TYPE,
223}
224
225#[repr(C)]
227#[derive(Debug, Clone, Copy)]
228pub struct META_METHOD_FUNCTION {
229 pub method: *const c_char,
231 pub func: unsafe extern "C" fn(smp: *mut SCRIPT_MODULE_PARAM),
233}
234
235#[repr(C)]
237#[derive(Debug, Clone, Copy)]
238pub struct SCRIPT_MODULE_FUNCTION {
239 pub name: *const u16,
241 pub func: unsafe extern "C" fn(smp: *mut SCRIPT_MODULE_PARAM),
243}
244
245#[repr(C)]
247#[derive(Debug, Clone, Copy)]
248pub struct SCRIPT_MODULE_TABLE {
249 pub information: *const u16,
251 pub functions: *const SCRIPT_MODULE_FUNCTION,
253}