blob: c03b90207ef0156c516a17c19b8ad191c98961b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
program()
type
File = record
fd: Int
end
Cell#[T] = record
held: ^T
end
var
files: Cell#[File]
bytes: Cell#[Word8]
f: File
b: Word8
s: []const Word8
proc identity#[T](value: ^T) -> ^T
return value
proc store#[T](target: ^Cell#[T]; value: ^T)
target^.held := value
return
proc relay#[T](target: ^Cell#[T]; value: ^T)
store(target, value)
return
begin
store(@files, @f);
relay(@bytes, @b);
store(@files, cast(0u: ^File));
s := identity(@b)[1 to 1]
end.
|