blob: 1cda57fc06bc439153d215a04e5be218f087dc29 (
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
|
program()
type
File = record
fd: Int
end
Pair#[K, V] = record
key: ^K;
value: ^V
end
var
entry: Pair#[File, Word8]
proc allocate#[T](size: Word) -> ^T
extern
proc first#[K, V](entry_ptr: ^Pair#[K, V]) -> ^K
return entry_ptr^.key
begin
entry.key := allocate#[File](#size(File));
assert(#size(Pair#[File, Word8]) = #size(Pointer) * 2u);
assert(#offset(Pair#[File, Word8], value) = #size(Pointer));
assert(first#[File, Word8](@entry) = entry.key)
end.
|