Fucking whatever there you go
parent: tbd commit: 57c2ca5
1 | use ; |
2 | |
3 | use Error; |
4 | use Container; |
5 | use Version; |
6 | use ; |
7 | |
8 | use crate:: |
9 | , |
10 | |
11 | ObjectOperationPair, ObjectSettingPair, ObjectValuePair, PluginMeta, PluginState, |
12 | RuntimeHandlers, TypeMetadata, |
13 | , |
14 | , |
15 | GiteratedPluginApi, |
16 | ; |
17 | |
18 | |
19 | |
20 | pub meta: PluginMeta, |
21 | pub raw: , |
22 | pub initialization: , |
23 | pub state: PluginState, |
24 | |
25 | |
26 | unsafe |
27 | unsafe |
28 | |
29 | |
30 | |
31 | let mut handle = unsafe ?; |
32 | |
33 | // Initialize the raw handle |
34 | let init_state = Self initialize_raw_handle?; |
35 | |
36 | let metadata = Self get_meta?; |
37 | |
38 | let initalization = Self initialize_registration?; |
39 | |
40 | trace! |
41 | "Loaded plugin {} (Version: {})", |
42 | metadata.name, |
43 | metadata.version |
44 | ; |
45 | |
46 | Ok |
47 | raw: new, |
48 | meta: metadata, |
49 | initialization: new, |
50 | state: init_state, |
51 | |
52 | |
53 | |
54 | /// Builds the Plugin's Substack. |
55 | /// |
56 | /// Builds the Plugin into a substack, which can then be provided to the Giterated Runtime. |
57 | |
58 | todo! |
59 | |
60 | |
61 | |
62 | let meta = unsafe ; |
63 | |
64 | let name = unsafe ; |
65 | let version = unsafe ; |
66 | |
67 | let name = from_utf8 .unwrap; |
68 | let version = from_utf8 .unwrap; |
69 | |
70 | Ok |
71 | name: String from, |
72 | version: parse .unwrap, |
73 | |
74 | |
75 | |
76 | |
77 | handle: &mut , |
78 | |
79 | debug!; |
80 | let mut builder = default; |
81 | |
82 | // SAFETY: The lifetime of the returned type is only valid as long |
83 | // as the builder that returned it lives |
84 | let func_table = unsafe ; |
85 | |
86 | let state = Box new; |
87 | |
88 | unsafe ; |
89 | let state = unsafe ; |
90 | |
91 | debug!; |
92 | Ok |
93 | |
94 | |
95 | |
96 | handle: &mut , |
97 | |
98 | debug!; |
99 | |
100 | let state = unsafe ; |
101 | |
102 | debug!; |
103 | |
104 | Ok |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | |
111 | LoadingLibrary, |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | pub type_metadata: TypeMetadata, |
119 | pub operation_handlers: , |
120 | pub value_getters: , |
121 | pub setting_getters: , |
122 | |
123 | |
124 | |
125 | |
126 | Self default |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | _marker: , |
133 | |
134 | |
135 | |
136 | pub unsafe |
137 | InitializationVTable |
138 | register_object, |
139 | register_operation, |
140 | register_setting, |
141 | register_value, |
142 | operation_handler, |
143 | value_getter, |
144 | setting_getter, |
145 | |
146 | |
147 | |
148 | |
149 | unsafe extern "C" |
150 | state: *mut PluginInitializationState, |
151 | object_kind: &'static str, |
152 | vtable: ObjectVtable, |
153 | |
154 | let mut state = Box from_raw; |
155 | |
156 | state.type_metadata.register_object; |
157 | |
158 | Box into_raw; |
159 | |
160 | |
161 | unsafe extern "C" |
162 | state: *mut PluginInitializationState, |
163 | object_kind: &'static str, |
164 | operation_name: &'static str, |
165 | vtable: OperationVTable, |
166 | |
167 | let mut state = Box from_raw; |
168 | |
169 | state |
170 | .type_metadata |
171 | .register_operation; |
172 | |
173 | Box into_raw; |
174 | |
175 | |
176 | unsafe extern "C" |
177 | state: *mut PluginInitializationState, |
178 | object_kind: &'static str, |
179 | setting_name: &'static str, |
180 | vtable: SettingVtable, |
181 | |
182 | let mut state = Box from_raw; |
183 | |
184 | state |
185 | .type_metadata |
186 | .register_setting; |
187 | |
188 | Box into_raw; |
189 | |
190 | |
191 | unsafe extern "C" |
192 | state: *mut PluginInitializationState, |
193 | object_kind: &'static str, |
194 | value_name: &'static str, |
195 | vtable: ValueVTable, |
196 | |
197 | let mut state = Box from_raw; |
198 | |
199 | state |
200 | .type_metadata |
201 | .register_value; |
202 | |
203 | Box into_raw; |
204 | |
205 | |
206 | unsafe extern "C" |
207 | state: *mut PluginInitializationState, |
208 | object_kind: &'static str, |
209 | operation_name: &'static str, |
210 | handler: OperationHandlerCallback, |
211 | |
212 | let mut state = Box from_raw; |
213 | |
214 | trace!; |
215 | |
216 | state.operation_handlers.insert |
217 | , | new
218 | handler, |
219 | ; |
220 | |
221 | Box into_raw; |
222 | |
223 | |
224 | unsafe extern "C" |
225 | state: *mut PluginInitializationState, |
226 | object_kind: &'static str, |
227 | value_name: &'static str, |
228 | handler: ValueGetterCallback, |
229 | |
230 | let mut state = Box from_raw; |
231 | |
232 | trace!; |
233 | |
234 | state |
235 | .value_getters |
236 | .insert; |
237 | |
238 | Box into_raw; |
239 | |
240 | |
241 | unsafe extern "C" |
242 | state: *mut PluginInitializationState, |
243 | object_kind: &'static str, |
244 | setting_name: &'static str, |
245 | handler: SettingGetterCallback, |
246 | |
247 | let mut state = Box from_raw; |
248 | |
249 | trace!; |
250 | |
251 | state |
252 | .setting_getters |
253 | .insert; |
254 | |
255 | Box into_raw; |
256 | |
257 |