| 1 | module BufFull; |
| 2 | (* a Buf whose allocator runs out stops the program, with the calls |
| 3 | under way, rather than dropping what it was given *) |
| 4 | import Buf, Arena, Rt; |
| 5 | import SYSTEM; |
| 6 | |
| 7 | proc main*; |
| 8 | var ar: Arena.Arena; b: Buf.Buf; big: [10000]U8; |
| 9 | begin |
| 10 | if not Arena.init(ar, 4096) then Rt.stop("no arena"); end; |
| 11 | Buf.init(b, SYSTEM.ADR(ar.base)); |
| 12 | Buf.str(b, big); |
| 13 | end; |
| 14 | |
| 15 | end BufFull. |