Skip to content

Commit 5d8f391

Browse files
committed
feat: function blocks have a vtable entry
function blocks now contain an extra entry for the vtable standard lib functions now account for the exta entry
1 parent 09a2579 commit 5d8f391

File tree

74 files changed

+2809
-1570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2809
-1570
lines changed

libs/stdlib/src/bistable_functionblocks.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#[repr(C)]
22
#[derive(Debug, Default)]
33
pub struct SetResetParams {
4+
__vtable: usize,
45
set: bool,
56
reset: bool,
67
output: bool,
@@ -12,6 +13,21 @@ impl SetResetParams {
1213
}
1314
}
1415

16+
#[repr(C)]
17+
pub struct VTable {
18+
pub body: extern "C" fn(&mut SetResetParams),
19+
}
20+
21+
#[allow(non_upper_case_globals)]
22+
#[no_mangle]
23+
#[used]
24+
pub static __vtable_SR: VTable = VTable { body: SR };
25+
26+
#[allow(non_upper_case_globals)]
27+
#[no_mangle]
28+
#[used]
29+
pub static __SR__init: SetResetParams =
30+
SetResetParams { __vtable: 0, set: false, reset: false, output: false };
1531
///.
1632
/// Bistable function, set dominant
1733
///
@@ -21,6 +37,17 @@ pub extern "C" fn SR(params: &mut SetResetParams) {
2137
params.set_output(params.set | (!params.reset & params.output));
2238
}
2339

40+
#[allow(non_upper_case_globals)]
41+
#[no_mangle]
42+
#[used]
43+
pub static __vtable_RS: VTable = VTable { body: RS };
44+
45+
#[allow(non_upper_case_globals)]
46+
#[no_mangle]
47+
#[used]
48+
pub static __RS__init: SetResetParams =
49+
SetResetParams { __vtable: 0, set: false, reset: false, output: false };
50+
2451
///.
2552
/// Bistable function, reset dominant
2653
///

0 commit comments

Comments
 (0)