.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
boot/
bootstrap/
compiler/
cycles/
dispatch/
format/
host/
integration/
kernel/
loader/
manifests/
mmio/
native/
packages/
runtime/
scheduling/
shared/
errors/
app.manifest
8 B
app.rad
983 B
build.rad
12.1 KiB
support.rad
1.7 KiB
slots/
smp/
std/
sync/
termination/
tests/
trap/
verify/
Makefile
9.2 KiB
kernel.rad
776 B
runner.rad
11.6 KiB
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
test/shared/app.rad
raw
| 1 | //! Shared entry with callbacks, initialized data pointers, and private counters. |
| 2 | |
| 3 | use support; |
| 4 | |
| 5 | /// Callback table contains a linked dependency function address. |
| 6 | static CALLBACKS: [fn() -> i32; 1] = [support::read]; |
| 7 | /// The slice contains a pointer into this domain's string storage. |
| 8 | constant TEXT: *[u8] = "xy"; |
| 9 | /// Number of calls in the current domain. |
| 10 | unsafe static calls: i32 = 0; |
| 11 | |
| 12 | /// Read dependency state through calls and data, then advance private state. |
| 13 | @default export fn main() -> i32 { |
| 14 | let number = support::Number { value: 23, extra: 47 }; |
| 15 | let borrowed = support::borrow(&number); |
| 16 | let copied = support::copied(borrowed); |
| 17 | assert copied.value == 23; |
| 18 | assert copied.extra == 47; |
| 19 | let referenced = support::referenced(&number); |
| 20 | assert referenced.value.value == 23; |
| 21 | assert support::reading(&copied) == 23; |
| 22 | unsafe { |
| 23 | set calls += 1; |
| 24 | return support::read() + CALLBACKS[0]() + support::value + TEXT[0] as i32 + calls; |
| 25 | } |
| 26 | } |