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