raz / commit 264716cb

commit
264716cb2c895c8e1e682ff920d946b64d6eefdb
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
ddf0eb5f
The tests, conform/, examples/ and the docs' examples held to report 2026-10.37 whole

import SYSTEM where a program reaches memory other than through a
variable, []const U8 where a string is only read, atomics on the
variable; err tests keep their point, their messages moved by the
added import line. make check passes as it is and with RAZ_STRICT=1.

patch · log

204 files changed, +479 -369

conform/err/ArrayConstAdr.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module ArrayConstAdr;
2+import SYSTEM;
23 const P: [2]I64 = [1, 2];
34 proc main*;
45 var p: ^[2]I64;
56 begin
6- p := ADR(P);
7+ p := SYSTEM.ADR(P);
78 end;
89 end ArrayConstAdr.

conform/err/AtPAdr.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module AtPAdr;
2+import SYSTEM;
23 proc main*;
34 var p: ^I64;
45 begin
5- p := ADR(1);
6+ p := SYSTEM.ADR(1);
67 end;
78 end AtPAdr.

conform/err/AtomicI64.raz (history) modified +1 -1

@@ -2,6 +2,6 @@
22 proc main*;
33 var n: I64; _ok: BOOL;
44 begin
5- _ok := CAS(ADR(n), 0, 1);
5+ _ok := CAS(n, 0, 1);
66 end;
77 end AtomicI64.

conform/err/BytesVolatile.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module BytesVolatile;
2+import SYSTEM;
23 type Regs = record ctrl: U32; status: U32; end;
34 proc main*;
45 var r: ^VOLATILE Regs; b: []U8;

conform/err/ConstAdr.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module ConstAdr;
2+import SYSTEM;
23 type R = record n: INT; end;
34 proc f(const r: R): ^R;
45 begin
5- return ADR(r);
6+ return SYSTEM.ADR(r);
67 end;
78 proc main*;
89 var r: R;

conform/err/ExportAdr.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module ExportAdr;
22 import Owner;
3+import SYSTEM;
34 proc main*;
45 var _p: ^INT;
56 begin
6- _p := ADR(Owner.n);
7+ _p := SYSTEM.ADR(Owner.n);
78 end;
89 end ExportAdr.

conform/err/GenDotsRecord.raz (history) modified +1 -0

@@ -1,5 +1,6 @@
11 module GenDotsRecord;
22 import C;
3+import SYSTEM;
34 type R = record a, b: I64; end;
45 proc main*;
56 var r: R;

conform/err/PackedAddress.raz (history) modified +4 -3

@@ -1,4 +1,5 @@
11 module PackedAddress;
2+import SYSTEM;
23 (* A field of a packed record may be misaligned: it has no address,
34 and no volatile access *)
45 type
@@ -12,12 +13,12 @@
1213 proc main*;
1314 var h: Header; p: ^U32; q: ^VOLATILE Header; k: ^U8; s: []U16;
1415 begin
15- p := ADR(h.len);
16+ p := SYSTEM.ADR(h.len);
1617 put(h.len);
1718 s := h.vals[0..1];
18- q := ADR(h);
19+ q := SYSTEM.ADR(h);
1920 q^.len := 2;
20- k := ADR(h.tag);
21+ k := SYSTEM.ADR(h.tag);
2122 h.len := 3;
2223 end;
2324

conform/err/PtrArray.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module PtrArray;
2+import SYSTEM;
23 proc main*;
34 var a: [4]I64; p: ^[4]I64;
45 begin
5- p := ADR(a);
6+ p := SYSTEM.ADR(a);
67 p[1] := 0;
78 end;
89 end PtrArray.

conform/err/PtrAsSlice.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module PtrAsSlice;
2+import SYSTEM;
23 proc main*;
34 var a: [4]U8; s: []U8;
45 begin
5- s := PTR(a);
6+ s := SYSTEM.PTR(a);
67 end;
78 end PtrAsSlice.

conform/err/PtrElement.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module PtrElement;
2+import SYSTEM;
23 proc main*;
34 var a: [4]U8; p: ^INT;
45 begin
5- p := PTR(a);
6+ p := SYSTEM.PTR(a);
67 end;
78 end PtrElement.

conform/err/PtrExport.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module PtrExport;
22 import Owner;
3+import SYSTEM;
34 proc main*;
45 var p: ^INT;
56 begin
6- p := PTR(Owner.a);
7+ p := SYSTEM.PTR(Owner.a);
78 end;
89 end PtrExport.

conform/err/PtrInteger.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module PtrInteger;
2+import SYSTEM;
23 proc main*;
34 var n: INT; p: ^INT;
45 begin
56 n := 1;
6- p := PTR(n);
7+ p := SYSTEM.PTR(n);
78 end;
89 end PtrInteger.

conform/err/PtrLiteral.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module PtrLiteral;
2+import SYSTEM;
23 proc main*;
34 var p: ^U8;
45 begin
5- p := PTR([]);
6+ p := SYSTEM.PTR([]);
67 end;
78 end PtrLiteral.

conform/err/PtrPacked.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module PtrPacked;
2+import SYSTEM;
23 type R = packed record tag: U8; words: [3]I32; end;
34 proc main*;
45 var r: R; p: ^I32;
56 begin
6- p := PTR(r.words);
7+ p := SYSTEM.PTR(r.words);
78 end;
89 end PtrPacked.

conform/err/PtrPointer.raz (history) modified +4 -3

@@ -1,9 +1,10 @@
11 module PtrPointer;
2+import SYSTEM;
23 proc main*;
34 var a: [4]U8; p, q: ^U8; pa: ^[4]U8;
45 begin
5- p := ADR(a[0]); pa := ADR(a);
6- q := PTR(p);
7- q := PTR(pa);
6+ p := SYSTEM.ADR(a[0]); pa := SYSTEM.ADR(a);
7+ q := SYSTEM.PTR(p);
8+ q := SYSTEM.PTR(pa);
89 end;
910 end PtrPointer.

conform/err/PtrView.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module PtrView;
2+import SYSTEM;
23 proc main*;
34 var w: I64; p: ^U8;
45 begin
56 w := 0;
6- p := PTR(w.([8]U8));
7+ p := SYSTEM.PTR(w.([8]U8));
78 end;
89 end PtrView.

conform/err/PtrVolatile.raz (history) modified +3 -2

@@ -1,9 +1,10 @@
11 module PtrVolatile;
2+import SYSTEM;
23 var regs: [4]U32;
34 proc main*;
45 var v: ^VOLATILE [4]U32; p: ^U32;
56 begin
6- v := ADR(regs);
7- p := PTR(v^);
7+ v := SYSTEM.ADR(regs);
8+ p := SYSTEM.PTR(v^);
89 end;
910 end PtrVolatile.

conform/err/SliceLiteralPart.raz (history) modified +1 -1

@@ -1,3 +1,3 @@
11 module SliceLiteralPart;
2-const Rows: [][]INT = [[1, 2], 3];
2+const Rows: []const []const INT = [[1, 2], 3];
33 end SliceLiteralPart.

conform/err/SliceLiteralRecord.raz (history) modified +1 -1

@@ -1,4 +1,4 @@
11 module SliceLiteralRecord;
2-type Rule = record name: []U8; keys: []INT; end;
2+type Rule = record name: []const U8; keys: []const INT; end;
33 const Rules: [1]Rule = [{name: "up", keys: [[1]]}];
44 end SliceLiteralRecord.

conform/err/StmtVarOrProc.raz (history) modified +1 -0

@@ -1,3 +1,4 @@
11 module StmtVarOrProc;
2+import SYSTEM;
23 extern 5;
34 end StmtVarOrProc.

conform/err/ViewAdr.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module ViewAdr;
2+import SYSTEM;
23 var mem: [16]U8; p: ^I64;
34 proc main*;
45 begin
5- p := ADR(mem[0].(I64));
6+ p := SYSTEM.ADR(mem[0].(I64));
67 end;
78 end ViewAdr.

conform/err/Volatile.raz (history) modified +2 -1

@@ -1,8 +1,9 @@
11 module Volatile;
2+import SYSTEM;
23 proc main*;
34 var x: I64; p: ^VOLATILE I64; q: ^I64;
45 begin
5- p := ADR(x);
6+ p := SYSTEM.ADR(x);
67 q := p;
78 end;
89 end Volatile.

conform/run/Args.raz (history) modified +2 -1

@@ -1,10 +1,11 @@
11 module Args;
22 import Out;
3+import SYSTEM;
34
45 proc main*: INT;
56 var i, n: INT; a: ^^U8; s: ^U8;
67 begin
7- a := ARGV();
8+ a := SYSTEM.ARGV();
89 for i := 1 to ARGC() - 1 do
910 s := a[i];
1011 n := 0;

conform/run/Arith.raz (history) modified +2 -2

@@ -8,12 +8,12 @@
88
99 var g: I64;
1010
11-proc show(s: []U8; n: I64);
11+proc show(s: []const U8; n: I64);
1212 begin
1313 Out.str(s); Out.str(" "); Out.int(n); Out.ln;
1414 end;
1515
16-proc showb(s: []U8; t: BOOL);
16+proc showb(s: []const U8; t: BOOL);
1717 begin
1818 if t then show(s, 1); else show(s, 0); end;
1919 end;

conform/run/ArrayConst.raz (history) modified +1 -1

@@ -13,7 +13,7 @@
1313 Mixes: [2]set of Color = [{red, blue}, {}];
1414 Neg: [3]I16 = [-1, -32768, 32767];
1515
16-proc sum(a: []I64): I64;
16+proc sum(a: []const I64): I64;
1717 var s: I64; i: INT;
1818 begin
1919 for i := 0 to LEN(a) - 1 do s := s + a[i]; end;

conform/run/ArrayConstLen.raz (history) modified +6 -6

@@ -1,17 +1,17 @@
11 module ArrayConstLen;
22 import Out, Widths;
33
4-type Rule = record class: []U8; tag: INT; end;
4+type Rule = record class: []const U8; tag: INT; end;
55
66 const
7- Primes: []I64 = [2, 3, 5, 7, 11];
8- Rules: []Rule = [{class: "firefox", tag: 2}, {class: "mpv", tag: 3}];
9- Names: [][]U8 = ["one", "two", "three"];
7+ Primes: []const I64 = [2, 3, 5, 7, 11];
8+ Rules: []const Rule = [{class: "firefox", tag: 2}, {class: "mpv", tag: 3}];
9+ Names: []const []const U8 = ["one", "two", "three"];
1010 Count = LEN(Primes); (* a constant *)
1111
1212 var buf: [Count]I64;
1313
14-proc sum(a: []I64): I64;
14+proc sum(a: []const I64): I64;
1515 var s: I64; i: INT;
1616 begin
1717 for i := 0 to LEN(a) - 1 do s := s + a[i]; end;
@@ -28,7 +28,7 @@
2828 end;
2929
3030 proc main*;
31-const Local: []U8 = [1, 2, 3, 4];
31+const Local: []const U8 = [1, 2, 3, 4];
3232 var i: INT;
3333 begin
3434 Out.int(LEN(Primes)); Out.str(" "); Out.int(sum(Primes)); Out.str(" ");

conform/run/ArrayEq.raz (history) modified +3 -2

@@ -1,5 +1,6 @@
11 module ArrayEq;
22 import Out;
3+import SYSTEM;
34
45 type Colour = (red, green, blue);
56
@@ -30,8 +31,8 @@
3031 say(f[0..1] = f[2..3]); say(f[0..1] = [true, false]);
3132 m := [{red}, {green, blue}]; n := m;
3233 say(m = n); n[1] := {blue}; say(m = n);
33- p := [ADR(x), nil]; q := p;
34- say(p = q); q[1] := ADR(x); say(p = q);
34+ p := [SYSTEM.ADR(x), nil]; q := p;
35+ say(p = q); q[1] := SYSTEM.ADR(x); say(p = q);
3536 t := [104, 101, 108, 108, 111];
3637 say(t = "hello"); say("hello" = t[0..5]); say("hell" = t[0..4]);
3738 say("help" # t[0..4]); say("" = t[0..0]);

conform/run/BytesOf.raz (history) modified +2 -1

@@ -6,6 +6,7 @@
66 with a view of the same place, which is the target's order too. *)
77 module BytesOf;
88 import Out;
9+import SYSTEM;
910
1011 type
1112 Header = record magic: U32; count: U16; flags: U8; end;
@@ -62,7 +63,7 @@
6263 Out.int(LEN(BYTES(none))); Out.str(" "); Out.int(LEN(BYTES(g[2..2]))); Out.ln;
6364 Out.int(LEN(gBytes())); Out.str(" "); Out.int(I64(gBytes()[4].(I32))); Out.ln;
6465
65- p := ADR(h);
66+ p := SYSTEM.ADR(h);
6667 n := 0;
6768 for i := 0 to OFFSET(Header, flags) do (* not the padding after *)
6869 INC(n, I32(BYTES(p^)[i]));

conform/run/CallArrayKept.raz (history) modified +2 -2

@@ -23,13 +23,13 @@
2323 end;
2424
2525 (* The array in r, as a slice *)
26-proc bytes(const r: R): []U8;
26+proc bytes(const r: R): []const U8;
2727 begin
2828 return r.a[0..8];
2929 end;
3030
3131 proc main*;
32-var s, t, u, v: []U8; i: INT;
32+var s, t, u, v: []const U8; i: INT;
3333 begin
3434 s := name('a')[0..8];
3535 t := name('b')[0..8];

conform/run/ConstParam.raz (history) modified +2 -2

@@ -5,7 +5,7 @@
55 Big = record a: [100]INT; name: []U8; n: INT; end;
66 Shape = variant circle(r: INT); rect(w, h: INT); end;
77
8-const Ten: Big = {n: 10, name: "ten"};
8+const Ten: Big = {n: 10};
99
1010 var g: Big;
1111
@@ -17,7 +17,7 @@
1717 return s;
1818 end;
1919
20-proc first(const s: []U8): U8;
20+proc first(const s: []const U8): U8;
2121 begin
2222 return s[0];
2323 end;

conform/run/ConstParamSlice.raz (history) modified +3 -3

@@ -8,12 +8,12 @@
88
99 var line: Line;
1010
11-proc used(const l: Line): []U8;
11+proc used(const l: Line): []const U8;
1212 begin
1313 return l.text[0..l.len];
1414 end;
1515
16-proc make(s: []U8): Line;
16+proc make(s: []const U8): Line;
1717 var l: Line;
1818 begin
1919 COPY(l.text, s);
@@ -22,7 +22,7 @@
2222 end;
2323
2424 proc main*;
25-var s: []U8;
25+var s: []const U8;
2626 begin
2727 line := make("hello");
2828 s := used(line);

conform/run/ConstSlice.raz (history) modified +1 -1

@@ -24,7 +24,7 @@
2424 end;
2525
2626 proc main*;
27-var a: [5]U8; w: []U8; r, b: []const U8; shapes: [2]Shape; cs: []const Shape;
27+var a: [5]U8; w: []const U8; r, b: []const U8; shapes: [2]Shape; cs: []const Shape;
2828 begin
2929 a := "hello";
3030 w := a;

conform/run/Continue.raz (history) modified +1 -1

@@ -6,7 +6,7 @@
66 import Out;
77
88 proc main*;
9-var i, j, n: INT; t: []U8;
9+var i, j, n: INT; t: []const U8;
1010 begin
1111 for i := 1 to 10 do
1212 if i mod 3 = 0 then continue; end; (* a lone continue *)

conform/run/CopyOverlap.raz (history) modified +1 -1

@@ -11,7 +11,7 @@
1111 cases, wrong: INT;
1212
1313 (* Says where a copy came out wrong. *)
14-proc fail(kind: []U8; d, s, n: INT);
14+proc fail(kind: []const U8; d, s, n: INT);
1515 begin
1616 Out.str(kind); Out.str(" wrong: d "); Out.int(I64(d)); Out.str(" s "); Out.int(I64(s));
1717 Out.str(" n "); Out.int(I64(n)); Out.ln;

conform/run/Defers.raz (history) modified +2 -2

@@ -5,12 +5,12 @@
55
66 var depth: I64;
77
8-proc enter(s: []U8);
8+proc enter(s: []const U8);
99 begin
1010 Out.str(s); INC(depth);
1111 end;
1212
13-proc leave(s: []U8);
13+proc leave(s: []const U8);
1414 begin
1515 Out.str(s); DEC(depth);
1616 end;

conform/run/EmptySliceConst.raz (history) modified +7 -7

@@ -4,16 +4,16 @@
44 (* A constant typed []T whose literal is [] is the empty slice, used as
55 a slice is: as a table with nothing in it, or a part of a constant *)
66
7-type Prop = record name: []U8; runs: [][2]I32; end;
7+type Prop = record name: []const U8; runs: []const [2]I32; end;
88
99 const
10- None: []I64 = [];
11- Wide: [][2]I32 = [[1100H, 115FH]];
12- Narrow: [][2]I32 = [];
13- Props: []Prop = [{name: "wide", runs: Wide}, {name: "narrow", runs: Narrow}, {name: "none", runs: []},
10+ None: []const I64 = [];
11+ Wide: []const [2]I32 = [[1100H, 115FH]];
12+ Narrow: []const [2]I32 = [];
13+ Props: []const Prop = [{name: "wide", runs: Wide}, {name: "narrow", runs: Narrow}, {name: "none", runs: []},
1414 {name: "Widths.Wide", runs: Widths.Wide}, {name: "Widths.Narrow", runs: Widths.Narrow}];
1515
16-proc sum(a: []I64): I64;
16+proc sum(a: []const I64): I64;
1717 var s: I64; i: INT;
1818 begin
1919 for i := 0 to LEN(a) - 1 do s := s + a[i]; end;
@@ -21,7 +21,7 @@
2121 end;
2222
2323 proc main*;
24-var s: []I64; i: INT;
24+var s: []const I64; i: INT;
2525 begin
2626 s := None;
2727 Out.int(LEN(None)); Out.str(" "); Out.int(sum(None)); Out.str(" "); Out.int(LEN(s)); Out.str(" ");

conform/run/ErrorValues.raz (history) modified +1 -1

@@ -8,7 +8,7 @@
88 One: ERROR = "same";
99 Two: ERROR = "same";
1010
11-proc yes(name: []U8; b: BOOL);
11+proc yes(name: []const U8; b: BOOL);
1212 begin
1313 Out.str(name);
1414 if b then Out.str(" true"); else Out.str(" false"); end;

conform/run/Escapes.raz (history) modified +1 -1

@@ -3,7 +3,7 @@
33 import Out;
44
55 proc main*;
6-var s: []U8; i: INT;
6+var s: []const U8; i: INT;
77 begin
88 s := "\xaF\xAF\u{1f600}\u{1F600}\x41\u{e9}";
99 for i := 0 to LEN(s) - 1 do

conform/run/Fill.raz (history) modified +4 -3

@@ -3,6 +3,7 @@
33 U64s := Filled(U64), I8s := Filled(I8), Bools := Filled(BOOL), Ptrs := Filled(^I64),
44 Sets := Filled(FillKinds.Colours), Colours := Filled(FillKinds.Colour),
55 Rgbs := Filled(FillKinds.Rgb), Spans := Filled(FillKinds.Span);
6+import SYSTEM;
67
78 var
89 calls: INT; (* how many times next has been called *)
@@ -47,7 +48,7 @@
4748 U64s.check("U64", 0123456789ABCDEFH, 1);
4849 I8s.check("I8", -2, 3);
4950 Bools.check("BOOL", true, false);
50- Ptrs.check("pointer", ADR(x), ADR(y));
51+ Ptrs.check("pointer", SYSTEM.ADR(x), SYSTEM.ADR(y));
5152 Sets.check("set", {FillKinds.red, FillKinds.blue}, {FillKinds.green});
5253 Colours.check("enumeration", FillKinds.blue, FillKinds.green);
5354 Rgbs.check("3-byte record", {r: 1, g: 2, b: 3}, {r: 9, g: 9, b: 9});
@@ -74,13 +75,13 @@
7475 FILL(s[1..8], 0);
7576 Out.int(sum(a)); Out.char(' ');
7677 for i := 0 to 99 do big[i] := U64(i); end;
77- p := ADR(big);
78+ p := SYSTEM.ADR(big);
7879 FILL(p^[10..100], 0);
7980 t := 0;
8081 for i := 0 to 99 do INC(t, I64(big[i])); end;
8182 Out.int(t); Out.char(' ');
8283 FILL(p^, 0);
83- FILL(ps, ADR(x));
84+ FILL(ps, SYSTEM.ADR(x));
8485 FILL(ps, nil);
8586 if (big[1] = 0) and (ps[2] = nil) then Out.str("zero"); end;
8687 Out.ln;

conform/run/FirstUse.raz (history) modified +5 -4

@@ -1,15 +1,16 @@
11 module FirstUse;
22 import Out, Str, Table := Table([]const U8, Colour, Str.hash, Str.eq),
33 Ints := Pile(I64), More := Pile(I64), Never := Loud(I64), Ones := Loud(U8);
4+import SYSTEM;
45
56 type Colour = (red, green, blue);
67
78 var names: Table.Table; (* Table is made here, after Colour *)
89
9-proc show(k: []U8);
10+proc show(k: []const U8);
1011 var c: Colour; found: BOOL;
1112 begin
12- c, found := Table.get(ADR(names), k);
13+ c, found := Table.get(SYSTEM.ADR(names), k);
1314 Out.str(k);
1415 if not found then Out.str(" -"); elsif c = red then Out.str(" red"); else Out.str(" not red"); end;
1516 Out.ln;
@@ -28,6 +29,6 @@
2829 end;
2930
3031 begin
31- _ := Table.put(ADR(names), "rose", red);
32- _ := Table.put(ADR(names), "sky", blue);
32+ _ := Table.put(SYSTEM.ADR(names), "rose", red);
33+ _ := Table.put(SYSTEM.ADR(names), "sky", blue);
3334 end FirstUse.

conform/run/Generic.raz (history) modified +9 -8

@@ -1,5 +1,6 @@
11 module Generic;
2-import Out, Stack, Ints := Pile(I64), More := Pile(I64), Strs := Pile([]U8);
2+import Out, Stack, Ints := Pile(I64), More := Pile(I64), Strs := Pile([]const U8);
3+import SYSTEM;
34
45 proc yes(b: BOOL);
56 begin
@@ -7,19 +8,19 @@
78 end;
89
910 proc main*;
10-var l: Strs.Pile; v: I64; s: []U8; ok: BOOL;
11+var l: Strs.Pile; v: I64; s: []const U8; ok: BOOL;
1112 begin
1213 ok := Ints.push(Stack.p, 7);
1314 ok := More.push(Stack.p, 8); (* two imports, one instance: one pile *)
1415 Out.int(Stack.top()); Out.char(' '); Out.int(Stack.p^.len); Out.char(' '); yes(ok); Out.ln;
1516 v, ok := Ints.pop(Stack.p);
1617 Out.int(v); Out.char(' '); Out.int(Stack.p^.len); Out.ln;
17- ok := Strs.push(ADR(l), "b");
18- ok := Strs.push(ADR(l), "a");
19- s, ok := Strs.pop(ADR(l));
20- Out.str(s); Out.str(Strs.top(ADR(l))); yes(ok); Out.ln;
21- s, ok := Strs.pop(ADR(l));
22- s, ok := Strs.pop(ADR(l));
18+ ok := Strs.push(SYSTEM.ADR(l), "b");
19+ ok := Strs.push(SYSTEM.ADR(l), "a");
20+ s, ok := Strs.pop(SYSTEM.ADR(l));
21+ Out.str(s); Out.str(Strs.top(SYSTEM.ADR(l))); yes(ok); Out.ln;
22+ s, ok := Strs.pop(SYSTEM.ADR(l));
23+ s, ok := Strs.pop(SYSTEM.ADR(l));
2324 Out.char('['); Out.str(s); Out.str("] "); yes(ok); Out.ln;
2425 end;
2526

conform/run/Inline.raz (history) modified +3 -3

@@ -73,7 +73,7 @@
7373 return incr(n);
7474 end;
7575
76-proc second(s: []U8): U8;
76+proc second(s: []const U8): U8;
7777 begin
7878 return s[1];
7979 end;
@@ -91,13 +91,13 @@
9191 return (n # 0) and even(n - 1);
9292 end;
9393
94-proc show(s: []U8; n: INT);
94+proc show(s: []const U8; n: INT);
9595 begin
9696 Out.str(s); Out.str(" "); Out.int(n); Out.ln;
9797 end;
9898
9999 proc main*;
100-var i, n: INT; s: []U8; p: Pair; f: proc(a, b: INT): INT; c: U8;
100+var i, n: INT; s: []const U8; p: Pair; f: proc(a, b: INT): INT; c: U8;
101101 begin
102102 show("sub", sub(note(10), note(3)));
103103 show("order", trace[0] * 10 + trace[1]);

conform/run/IntWiden.raz (history) modified +2 -2

@@ -27,14 +27,14 @@
2727 return three();
2828 end;
2929
30-proc show(label: []U8; v: I64);
30+proc show(label: []const U8; v: I64);
3131 begin
3232 Out.str(label); Out.str(" "); Out.int(v); Out.str("\n");
3333 end;
3434
3535 proc main*;
3636 var
37- a, b, c, i: I64; n: INT; s: []U8; u: U64; w: UINT;
37+ a, b, c, i: I64; n: INT; s: []const U8; u: U64; w: UINT;
3838 begin
3939 s := "hello";
4040 n := -2;

conform/run/JoinStr.raz (history) modified +1 -1

@@ -8,7 +8,7 @@
88 Word = ("sat" + " ") + "on";
99
1010 proc main*;
11-var w: []U8;
11+var w: []const U8;
1212 begin
1313 Out.str(Line);
1414 Out.str(Both); Out.ln;

conform/run/Kinds.raz (history) modified +2 -2

@@ -5,7 +5,7 @@
55 Color* = (red, green, blue, black);
66 Colors* = set of Color;
77 Cell = record ch: U8; attr: U8; fg: Color; end;
8- Point = record x, y: I64; name: []U8; end;
8+ Point = record x, y: I64; name: []const U8; end;
99 Line = record a, b: Point; end;
1010
1111 var log: [8]U8; nlog: I64;
@@ -25,7 +25,7 @@
2525 Out.str(" ");
2626 end;
2727
28-proc name(c: Color): []U8;
28+proc name(c: Color): []const U8;
2929 begin
3030 match c of
3131 | red: return "red";

conform/run/LaterCallback.raz (history) modified +4 -3

@@ -2,10 +2,11 @@
22 (* A procedure type's parameter or result may name a type declared later
33 in its type section, however passed (report, 4 and 5.9). *)
44 import Out;
5+import SYSTEM;
56
67 type
78 Lines = record
8- each: proc(var r: Lines; s: []U8);
9+ each: proc(var r: Lines; s: []const U8);
910 look: proc(const r: Lines): INT;
1011 copy: proc(r: Lines): Lines;
1112 at: proc(p: ^Lines): (INT, Lines);
@@ -29,7 +30,7 @@
2930 name: [8]U8;
3031 end;
3132
32-proc count(var r: Lines; s: []U8);
33+proc count(var r: Lines; s: []const U8);
3334 begin
3435 INC(r.n, LEN(s));
3536 end;
@@ -76,7 +77,7 @@
7677 Out.int(r.look(r)); Out.ln;
7778 c := r.copy(r);
7879 Out.int(c.n); Out.char(' '); Out.int(r.n); Out.ln;
79- k, c := r.at(ADR(r));
80+ k, c := r.at(SYSTEM.ADR(r));
8081 Out.int(k); Out.char(' '); Out.int(c.n); Out.ln;
8182 pi.hit := hit; po.back := back;
8283 Out.int(pi.hit(po)); Out.char(' '); Out.int(pi.hit(po)); Out.ln;

conform/run/MatchInt.raz (history) modified +1 -1

@@ -38,7 +38,7 @@
3838 end;
3939
4040 proc main*;
41-var i: INT; s: []U8;
41+var i: INT; s: []const U8;
4242 begin
4343 s := "a1 _Z\t9?";
4444 for i := 0 to LEN(s) - 1 do Out.int(kind(s[i])); end;

conform/run/MatchStr.raz (history) modified +2 -2

@@ -6,7 +6,7 @@
66
77 type Op = (none, add, sub, mul);
88
9-proc op(word: []U8): Op;
9+proc op(word: []const U8): Op;
1010 begin
1111 match word of
1212 | "add", Plus, `+`: return add;
@@ -18,7 +18,7 @@
1818 end;
1919
2020 proc main*;
21-var a: [3]U8; s: []U8;
21+var a: [3]U8; s: []const U8;
2222 begin
2323 Out.int(I64(op("add"))); Out.int(I64(op("plus"))); Out.int(I64(op("+")));
2424 Out.int(I64(op("sub"))); Out.int(I64(op("-"))); Out.int(I64(op("mul")));

conform/run/Offsets.raz (history) modified +1 -1

@@ -20,7 +20,7 @@
2020 Typed = U8(OFFSET(Mixed, e) + 250); (* 24 + 250 wraps to 18 *)
2121
2222 (* name, then the offset and the size of a field *)
23-proc row(name: []U8; off, size: INT);
23+proc row(name: []const U8; off, size: INT);
2424 begin
2525 Out.str(name); Out.str(" "); Out.int(off); Out.str(" "); Out.int(size); Out.ln;
2626 end;

conform/run/PackedFields.raz (history) modified +2 -1

@@ -1,6 +1,7 @@
11 module PackedFields;
22 (* A packed record's fields are read and written wherever they sit *)
33 import Out;
4+import SYSTEM;
45
56 type
67 Header = packed record kind: U8; len: U32; big: I64; tag: U8; end;
@@ -16,7 +17,7 @@
1617 Out.hex(U64(g.len), 8); Out.str(" ");
1718 Out.int(g.big); Out.str(" ");
1819 Out.int(I64(g.tag)); Out.ln;
19- b := ADR(g.kind);
20+ b := SYSTEM.ADR(g.kind);
2021 Out.int(I64(b[1])); Out.ln;
2122 end;
2223

conform/run/Pow2.raz (history) modified +1 -1

@@ -5,7 +5,7 @@
55
66 var bad: I64;
77
8-proc check(s: []U8; x, got, want: I64);
8+proc check(s: []const U8; x, got, want: I64);
99 begin
1010 if got # want then
1111 Out.str(s); Out.str(" "); Out.int(x); Out.str(": ");

conform/run/Ptr.raz (history) modified +12 -11

@@ -1,8 +1,9 @@
1-(* PTR(s), the address a slice starts at (report section 6.8): ADR(s[0])
1+(* SYSTEM.PTR(s), the address a slice starts at (report section 6.8): SYSTEM.ADR(s[0])
22 when s isn't empty; nil for a slice as it starts and for []; and, of
33 an array, the address of its first element. *)
44 module Ptr;
55 import Out;
6+import SYSTEM;
67
78 type Value = record n: INT; p: ^U8; end;
89
@@ -13,7 +14,7 @@
1314 (* a slice as a pointer and a length, with no test for the empty one *)
1415 proc valueOf(s: []U8): Value;
1516 begin
16- return {n: LEN(s), p: PTR(s)};
17+ return {n: LEN(s), p: SYSTEM.PTR(s)};
1718 end;
1819
1920 (* and back: empty when n is 0, whatever p is *)
@@ -29,7 +30,7 @@
2930
3031 proc first(const a: [3]I64): ^I64;
3132 begin
32- return PTR(a);
33+ return SYSTEM.PTR(a);
3334 end;
3435
3536 proc main*;
@@ -41,24 +42,24 @@
4142 s := a[0..6];
4243 Out.str(bytes(valueOf(s)));
4344 Out.str(bytes(valueOf(s[1..3]))); Out.str("\n");
44- if PTR(s) = ADR(s[0]) then Out.str("a slice: ADR(s[0])\n"); end;
45- if PTR(a) = ADR(a[0]) then Out.str("an array: ADR(a[0])\n"); end;
46- if PTR(s[2..5]) = ADR(a[2]) then Out.str("a slice of it: ADR(a[2])\n"); end;
47- if PTR(same(s)) = ADR(a[0]) then Out.str("a call's slice\n"); end;
45+ if SYSTEM.PTR(s) = SYSTEM.ADR(s[0]) then Out.str("a slice: ADR(s[0])\n"); end;
46+ if SYSTEM.PTR(a) = SYSTEM.ADR(a[0]) then Out.str("an array: ADR(a[0])\n"); end;
47+ if SYSTEM.PTR(s[2..5]) = SYSTEM.ADR(a[2]) then Out.str("a slice of it: ADR(a[2])\n"); end;
48+ if SYSTEM.PTR(same(s)) = SYSTEM.ADR(a[0]) then Out.str("a call's slice\n"); end;
4849 v := valueOf(none);
4950 if v.p = nil then Out.str("a slice as it starts: nil\n"); end;
5051 v := valueOf([]);
5152 if v.p = nil then Out.str("[]: nil\n"); end;
5253 Out.int(LEN(bytes(v))); Out.str(" bytes back\n");
5354 kept := s[3..5];
54- Out.str(PTR(kept)[0..2]); Out.str("\n");
55+ Out.str(SYSTEM.PTR(kept)[0..2]); Out.str("\n");
5556 w := [10, 20, 30];
56- if first(w) = ADR(w[0]) then Out.str("a const parameter: in place\n"); end;
57+ if first(w) = SYSTEM.ADR(w[0]) then Out.str("a const parameter: in place\n"); end;
5758 ws := w[0..3];
58- q := PTR(ws);
59+ q := SYSTEM.PTR(ws);
5960 for i := 0 to 2 do Out.int(q[i]); Out.str(" "); end;
6061 Out.str("\n");
61- d := PTR(Digits);
62+ d := SYSTEM.PTR(Digits);
6263 Out.int(d[3]); Out.str("\n");
6364 end;
6465

conform/run/PtrOrder.raz (history) modified +4 -3

@@ -1,6 +1,7 @@
11 (* Pointers compare with = # < <= > >=, as unsigned addresses. *)
22 module PtrOrder;
33 import Out;
4+import SYSTEM;
45
56 proc yes(b: BOOL);
67 begin
@@ -10,10 +11,10 @@
1011 proc main*;
1112 var a: [3]I64; p, q: ^I64;
1213 begin
13- p := ADR(a[0]);
14- q := ADR(a[2]);
14+ p := SYSTEM.ADR(a[0]);
15+ q := SYSTEM.ADR(a[2]);
1516 yes(p < q); yes(p <= q); yes(p > q); yes(p >= q); yes(p = q); yes(p # q);
16- q := ADR(a[0]);
17+ q := SYSTEM.ADR(a[0]);
1718 yes(p <= q); yes(p >= q); yes(p < q);
1819 Out.ln;
1920 end;

conform/run/RawStrings.raz (history) modified +2 -2

@@ -9,9 +9,9 @@
99 -v say what is done
1010 `;
1111 Joined = `back` + "`" + `quote`;
12- Names: [2][]U8 = [`one`, `two`];
12+ Names: [2][]const U8 = [`one`, `two`];
1313
14-proc show(s: []U8);
14+proc show(s: []const U8);
1515 begin
1616 Out.int(LEN(s)); Out.str(" |"); Out.str(s); Out.str("|\n");
1717 end;

conform/run/RealRead.raz (history) modified +2 -1

@@ -2,11 +2,12 @@
22 bits, for numbers a reader of decimals easily gets one off. *)
33 module RealRead;
44 import Out;
5+import SYSTEM;
56
67 proc bits(x: F64): U64;
78 var p: ^U64;
89 begin
9- p := ^U64(ADR(x));
10+ p := ^U64(SYSTEM.ADR(x));
1011 return p^;
1112 end;
1213

conform/run/RecordConst.raz (history) modified +2 -2

@@ -2,12 +2,12 @@
22 import Out;
33 type
44 Act = (quit, focus, spawn);
5- Rule = record cls: []U8; tag: INT; float: BOOL; end;
5+ Rule = record cls: []const U8; tag: INT; float: BOOL; end;
66 Key = record mods: U8; sym: U32; act: Act; arg: [8]U8; run: proc(n: INT); end;
77 const
88 Rules: [3]Rule = [{cls: "firefox", tag: 2}, {cls: "mpv", float: true}, {}];
99 Nums: [3]I64 = [10, 20, 30];
10- Lists: [2][]I64 = [Nums, Nums];
10+ Lists: [2][]const I64 = [Nums, Nums];
1111 Home: Rule = {cls: "home", tag: 7};
1212 Grid: [2][2]U8 = [[1, 2], [3, 4]];
1313 proc hello(n: INT);

conform/run/Sameness.raz (history) modified +3 -2

@@ -3,6 +3,7 @@
33 anonymous one. *)
44 module Sameness;
55 import Out;
6+import SYSTEM;
67
78 type
89 Node = record v: I64; end;
@@ -14,11 +15,11 @@
1415 var r: Node; p1: P1; p2: P2; n: ^Node; q: NodePtr;
1516 begin
1617 r.v := 7;
17- n := ADR(r);
18+ n := SYSTEM.ADR(r);
1819 p1 := n;
1920 n := p1;
2021 p2 := n;
21- q := ADR(r);
22+ q := SYSTEM.ADR(r);
2223 Out.int(p2^.v + q^.v); Out.ln;
2324 end;
2425

conform/run/Sizes.raz (history) modified +2 -2

@@ -5,7 +5,7 @@
55
66 type Empty = record end;
77
8-proc line(name: []U8; b: BOOL);
8+proc line(name: []const U8; b: BOOL);
99 begin
1010 Out.str(name);
1111 if b then Out.str(" yes"); else Out.str(" NO"); end;
@@ -21,7 +21,7 @@
2121 line("UINT is an address", SIZE(UINT) = SIZE(^U8));
2222 line("procedure is an address", SIZE(proc) = SIZE(^U8));
2323 line("ERROR is an address", SIZE(ERROR) = SIZE(^U8));
24- line("slice is two", SIZE([]U8) = 2 * SIZE(^U8));
24+ line("slice is two", SIZE([]const U8) = 2 * SIZE(^U8));
2525 line("empty record", SIZE(Empty) = 0);
2626 end;
2727

conform/run/SliceLiteralConst.raz (history) modified +7 -7

@@ -5,17 +5,17 @@
55 import Out;
66
77 type
8- Rule = record name: []U8; keys: []INT; end;
9- Shape = variant dot; poly(xs: []INT); end;
8+ Rule = record name: []const U8; keys: []const INT; end;
9+ Shape = variant dot; poly(xs: []const INT); end;
1010
1111 const
12- Rows: [][]INT = [[1, 2], [3], []];
13- Deep: [][][]U8 = [[['a', 'b'], "cd"], [], [['e']]];
14- Rules: []Rule = [{name: "up", keys: [107, 65]}, {name: "none", keys: []}];
12+ Rows: []const []const INT = [[1, 2], [3], []];
13+ Deep: []const []const []const U8 = [[['a', 'b'], "cd"], [], [['e']]];
14+ Rules: []const Rule = [{name: "up", keys: [107, 65]}, {name: "none", keys: []}];
1515 Shapes: [2]Shape = [poly([1, 2, 3]), dot];
16- Words: [][]U8 = [['h', 'i'], "there"];
16+ Words: []const []const U8 = [['h', 'i'], "there"];
1717
18-proc sum(xs: []INT): INT;
18+proc sum(xs: []const INT): INT;
1919 var i, s: INT;
2020 begin
2121 s := 0;

conform/run/SlicePtrBackwards.raz (history) modified +2 -1

@@ -2,11 +2,12 @@
22 (* A slice of a pointer isn't checked against a length, but it can't
33 run backwards *)
44 import Out;
5+import SYSTEM;
56
67 proc main*;
78 var a: [8]U8; p: ^U8; hi: I64;
89 begin
9- p := ADR(a[0]);
10+ p := SYSTEM.ADR(a[0]);
1011 for hi := 4 to 0 by -2 do
1112 Out.int(LEN(p[2..hi]));
1213 Out.str(" ");

conform/run/SmallWiden.raz (history) modified +1 -1

@@ -28,7 +28,7 @@
2828 end;
2929
3030 proc main*;
31-var s: []U8; a, b: U8; c: I8; w: U16; n, i: INT; u: UINT;
31+var s: []const U8; a, b: U8; c: I8; w: U16; n, i: INT; u: UINT;
3232 begin
3333 s := "7319";
3434 for i := 0 to LEN(s) - 1 do n := n * 10 + s[i] - '0'; end;

conform/run/Sorted.raz (history) modified +1 -1

@@ -3,7 +3,7 @@
33 module Sorted;
44 import Out, Rt, Ints := Order(I64, below), ByAge := Order(Person, younger);
55
6-type Person = record name: []U8; age: I64; end;
6+type Person = record name: []const U8; age: I64; end;
77
88 proc below(a, b: I64): BOOL;
99 begin

conform/run/Strings.raz (history) modified +2 -2

@@ -5,7 +5,7 @@
55
66 var buf: [8]U8;
77
8-proc count(xs: []I64): I64;
8+proc count(xs: []const I64): I64;
99 var i: INT; s: I64;
1010 begin
1111 s := 0;
@@ -14,7 +14,7 @@
1414 end;
1515
1616 proc main*;
17-var a: []U8; b: [5]U8; c: [3]I64; d: [][]U8;
17+var a: []const U8; b: [5]U8; c: [3]I64; d: [][]const U8;
1818 begin
1919 a := "hello";
2020 if a = greeting then Out.str("eq "); end;

conform/run/SystemInt.raz (history) modified +4 -3

@@ -2,6 +2,7 @@
22 (* INT and UINT: what gives them, where they widen, shifts modulo the
33 width, and another module's variables read but not changed *)
44 import Out, Shared;
5+import SYSTEM;
56
67 var cells: [10]I32;
78
@@ -11,7 +12,7 @@
1112 end;
1213
1314 (* an INT returned as an I64 *)
14-proc len(s: []U8): I64;
15+proc len(s: []const U8): I64;
1516 begin
1617 return LEN(s);
1718 end;
@@ -30,8 +31,8 @@
3031 Out.int(i); Out.str(" "); Out.int(I64(b)); Out.str(" "); Out.int(len("abc"));
3132 Out.str(" "); Out.int(I64(w)); Out.ln;
3233
33- p := ADR(cells[2]);
34- q := ADR(cells[9]);
34+ p := SYSTEM.ADR(cells[2]);
35+ q := SYSTEM.ADR(cells[9]);
3536 n := q - p; (* an INT *)
3637 u := UINT(q) - UINT(p);
3738 Out.int(n); Out.str(" "); Out.int(I64(u)); Out.str(" ");

conform/run/Try.raz (history) modified +1 -1

@@ -141,7 +141,7 @@
141141 return 0;
142142 end;
143143
144-proc show(what: []U8; v: INT; e: ERROR);
144+proc show(what: []const U8; v: INT; e: ERROR);
145145 begin
146146 Out.str(what); Out.str(": "); Out.int(v);
147147 if e = nil then Out.str(" ok"); else Out.str(" "); Out.str(MSG(e)); end;

conform/run/TwoWords.raz (history) modified +3 -2

@@ -4,6 +4,7 @@
44 on, through a procedure value, run off the end, and with a call in
55 the second. *)
66 import Out;
7+import SYSTEM;
78
89 var log: INT;
910
@@ -34,7 +35,7 @@
3435 return nested(n);
3536 end;
3637
37-proc tail(s: []U8; i: INT): []U8;
38+proc tail(s: []const U8; i: INT): []const U8;
3839 begin
3940 defer note;
4041 return s[i..LEN(s)];
@@ -60,7 +61,7 @@
6061 _, v := nested(3); Out.int(v); Out.str(" "); Out.int(log); Out.ln;
6162 (* in order: the second result is the one left *)
6263 v, v := nested(4); Out.int(v); Out.ln;
63- pv := ADR(q); pv^, p := nested(5); Out.int(q); Out.str(" "); Out.int(p); Out.ln;
64+ pv := SYSTEM.ADR(q); pv^, p := nested(5); Out.int(q); Out.str(" "); Out.int(p); Out.ln;
6465 (* three results, which come back in memory, some dropped *)
6566 _, p, q := three(1); Out.int(p); Out.str(" "); Out.int(q); Out.ln;
6667 p, _, _ := three(7); Out.int(p); Out.ln;

conform/run/VariantConst.raz (history) modified +1 -1

@@ -2,7 +2,7 @@
22 import Out;
33
44 type
5- Shape = variant circle(r: F64); rect(w, h: INT); dot; named(name: []U8; n: U8); end;
5+ Shape = variant circle(r: F64); rect(w, h: INT); dot; named(name: []const U8; n: U8); end;
66 Rule = record tag: INT; s: Shape; end;
77
88 const

conform/run/Views.raz (history) modified +4 -3

@@ -4,6 +4,7 @@
44 bytes are written here a byte at a time where order matters. *)
55 module Views;
66 import Out, ViewData;
7+import SYSTEM;
78
89 type
910 Header = record magic: U32; count: U32; end;
@@ -13,7 +14,7 @@
1314 mem: [64]U8; (* a module's array *)
1415 regs: [4]U64;
1516
16-proc show(label: []U8; v: I64);
17+proc show(label: []const U8; v: I64);
1718 begin
1819 Out.str(label); Out.str(" "); Out.int(v); Out.ln;
1920 end;
@@ -25,7 +26,7 @@
2526 end;
2627
2728 (* a slice parameter's element, viewed *)
28-proc sum(s: []U8): I64;
29+proc sum(s: []const U8): I64;
2930 var i, t: INT;
3031 begin
3132 t := 0;
@@ -74,7 +75,7 @@
7475 (* a packed record, and a pointer read from bytes, then followed *)
7576 mem[40].(Pair) := {tag: 1, value: 300};
7677 show("Pair's value", I64(mem[41].(I32)));
77- p := ADR(n);
78+ p := SYSTEM.ADR(n);
7879 mem[48].(^I64) := p;
7980 mem[48].(^I64)^ := 77;
8081 show("n through a pointer from bytes", n);

conform/run/ZeroStart.raz (history) modified +4 -4

@@ -10,17 +10,17 @@
1010 Shape = variant first(x: I64); second(y: I64); end;
1111
1212 var
13- n: I64; u: U8; ok: BOOL; p: ^Rec; f: proc; e: ERROR; s: []U8;
13+ n: I64; u: U8; ok: BOOL; p: ^Rec; f: proc; e: ERROR; s: []const U8;
1414 c: Colour; fl: Flags; r: Rec; a: [3]I64; v: Shape;
1515
16-proc line(name: []U8; zero: BOOL);
16+proc line(name: []const U8; zero: BOOL);
1717 begin
1818 Out.str(name);
1919 if zero then Out.str(" zero"); else Out.str(" NOT ZERO"); end;
2020 Out.ln;
2121 end;
2222
23-proc which(name: []U8; v: Shape);
23+proc which(name: []const U8; v: Shape);
2424 begin
2525 Out.str(name);
2626 match v of
@@ -39,7 +39,7 @@
3939
4040 proc locals;
4141 var
42- n: I64; u: U8; ok: BOOL; p: ^Rec; f: proc; e: ERROR; s: []U8;
42+ n: I64; u: U8; ok: BOOL; p: ^Rec; f: proc; e: ERROR; s: []const U8;
4343 c: Colour; fl: Flags; r: Rec; a: [3]I64; v: Shape;
4444 begin
4545 line("local number", (n = 0) and (u = 0));

conform/run/mods/Filled.raz (history) modified +4 -3

@@ -4,6 +4,7 @@
44 may be a record, which = doesn't compare. *)
55 module Filled(T);
66 import Out;
7+import SYSTEM;
78
89 (* The lengths of the slices filled *)
910 const Lens: [7]INT = [0, 1, 2, 7, 8, 9, 100];
@@ -24,7 +25,7 @@
2425 wrong: INT; (* elements that hold what they shouldn't *)
2526
2627 (* The bytes of the T at p: BYTES takes no BOOL, set or enumeration *)
27-proc bytesAt(p: ^T): []U8;
28+proc bytesAt(p: ^T): []const U8;
2829 var q: ^U8;
2930 begin
3031 q := ^U8(p);
@@ -36,7 +37,7 @@
3637 var i: INT;
3738 begin
3839 for i := 0 to LEN(a) - 1 do
39- if bytesAt(ADR(a[i])) # bytesAt(ADR(v)) then INC(wrong); end;
40+ if bytesAt(SYSTEM.ADR(a[i])) # bytesAt(SYSTEM.ADR(v)) then INC(wrong); end;
4041 end;
4142 end;
4243
@@ -81,7 +82,7 @@
8182
8283 (* Fills slices and arrays with v, around s, and says how many elements
8384 were filled and how many are wrong, after name *)
84-proc check*(name: []U8; v, s: T);
85+proc check*(name: []const U8; v, s: T);
8586 begin
8687 filled := 0;
8788 wrong := 0;

conform/run/mods/Stack.raz (history) modified +2 -1

@@ -1,5 +1,6 @@
11 module Stack;
22 import Ints := Pile(I64);
3+import SYSTEM;
34
45 var
56 s: Ints.Pile;
@@ -11,5 +12,5 @@
1112 end;
1213
1314 begin
14- p := ADR(s);
15+ p := SYSTEM.ADR(s);
1516 end Stack.

doc/raz-lib.md (history) modified +1 -1

@@ -211,7 +211,7 @@
211211
212212 ```
213213 module Both;
214-import Out, C; (* C: printf, fflush and C's FILE *stdout *)
214+import Out, C, SYSTEM; (* C: printf, fflush and C's FILE *stdout *)
215215
216216 proc main*;
217217 begin

doc/raz-tutorial.7 (history) modified +10 -10

@@ -74,7 +74,7 @@
7474
7575 var count*: INT; (* the greetings so far *)
7676
77-proc hello*(name: []U8);
77+proc hello*(name: []const U8);
7878 begin
7979 Out.str("hello, ");
8080 Out.str(name);
@@ -540,7 +540,7 @@
540540
541541 type Span = record p: ^U8; n: INT; end;
542542
543-proc spanOf(s: []U8): Span;
543+proc spanOf(s: []const U8): Span;
544544 begin
545545 return {p: SYSTEM.PTR(s), n: LEN(s)};
546546 end;
@@ -847,7 +847,7 @@
847847 TooBig*: ERROR = "not a number up to 1000";
848848
849849 (* the number s holds, up to 1000 *)
850-proc number(s: []U8): (INT, ERROR);
850+proc number(s: []const U8): (INT, ERROR);
851851 var n: I64; ok: BOOL;
852852 begin
853853 if LEN(s) = 0 then return 0, Empty; end;
@@ -857,7 +857,7 @@
857857 end;
858858
859859 (* the sum of the numbers in words: the first error ends it *)
860-proc total(words: [][]U8): (INT, ERROR);
860+proc total(words: [][]const U8): (INT, ERROR);
861861 var i, sum: INT;
862862 begin
863863 for i := 0 to LEN(words) - 1 do
@@ -867,7 +867,7 @@
867867 end;
868868
869869 proc main*;
870-var words: [3][]U8; i, n: INT; err: ERROR;
870+var words: [3][]const U8; i, n: INT; err: ERROR;
871871 begin
872872 words := ["42", "", "12345"];
873873 for i := 0 to 2 do
@@ -949,7 +949,7 @@
949949 end;
950950
951951 (* the lines of the file at path, or -1 if it can't be read *)
952-proc lines(path: []U8): INT;
952+proc lines(path: []const U8): INT;
953953 var fd, n, i, count: INT; buf: [4096]U8;
954954 begin
955955 fd := Sys.openRead(path);
@@ -1077,7 +1077,7 @@
10771077 end;
10781078 end;
10791079
1080-proc kind(c: I32): []U8;
1080+proc kind(c: I32): []const U8;
10811081 begin
10821082 match c of
10831083 | ' ', '\et', '\en': return "space";
@@ -1087,7 +1087,7 @@
10871087 end;
10881088 end;
10891089
1090-proc colour(name: []U8): Colour;
1090+proc colour(name: []const U8): Colour;
10911091 begin
10921092 match name of
10931093 | "red", "rose": return red;
@@ -1178,14 +1178,14 @@
11781178 .Bd -literal -offset indent
11791179 module Generics;
11801180 import Out, Ints := Biggest(INT, before),
1181- Words := Biggest([]U8, shorter), Order := Sort(INT, before);
1181+ Words := Biggest([]const U8, shorter), Order := Sort(INT, before);
11821182
11831183 proc before(a, b: INT): BOOL;
11841184 begin
11851185 return a < b;
11861186 end;
11871187
1188-proc shorter(a, b: []U8): BOOL;
1188+proc shorter(a, b: []const U8): BOOL;
11891189 begin
11901190 return LEN(a) < LEN(b);
11911191 end;

doc/raz.md (history) modified +1 -1

@@ -1535,7 +1535,7 @@
15351535 import Sys, Out;
15361536
15371537 (* Prints the first line of the file at path. *)
1538-proc head(path: []U8): BOOL;
1538+proc head(path: []const U8): BOOL;
15391539 var fd, n, i: INT; buf: [256]U8;
15401540 begin
15411541 fd := Sys.openRead(path);

examples/Args.raz (history) modified +2 -1

@@ -1,6 +1,7 @@
11 (* Prints its arguments, one per line, and exits with how many. *)
22 module Args;
33 import Out;
4+import SYSTEM;
45
56 (* The length of a C string. *)
67 proc len(s: ^U8): INT;
@@ -15,7 +16,7 @@
1516 var i: INT; s: ^U8;
1617 begin
1718 for i := 1 to ARGC() - 1 do
18- s := ARGV()[i];
19+ s := SYSTEM.ARGV()[i];
1920 Out.str(s[0..len(s)]);
2021 Out.ln;
2122 end;

examples/Cpu.raz (history) modified +2 -1

@@ -2,6 +2,7 @@
22 other procedure. cpuid's vendor string, from leaf 0. *)
33 module Cpu;
44 import Out;
5+import SYSTEM;
56
67 (* cpuid leaf 0: puts the 12 bytes of the vendor in buf, rdi. *)
78 proc vendor(buf: ^U8);
@@ -20,7 +21,7 @@
2021 proc main*;
2122 var buf: [12]U8; i: INT; ok: BOOL;
2223 begin
23- vendor(ADR(buf[0]));
24+ vendor(SYSTEM.ADR(buf[0]));
2425 ok := true;
2526 for i := 0 to 11 do
2627 if (buf[i] < ' ') or (buf[i] > '~') then ok := false; end;

examples/Printf.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 a buffer of its own, so each is flushed before the other writes. *)
33 module Printf;
44 import Out, C;
5+import SYSTEM;
56
67 proc main*;
78 var i: INT;

examples/Pthreads.raz (history) modified +2 -1

@@ -2,6 +2,7 @@
22 and using the heap and Out, which lock themselves. *)
33 module Pthreads;
44 import Out, C, Heap, Mem;
5+import SYSTEM;
56
67 const
78 Workers = 4;
@@ -35,7 +36,7 @@
3536 for i := 0 to N - 1 do numbers^[i] := i + 1; end;
3637 for i := 0 to Workers - 1 do
3738 parts[i] := {lo: i * N div Workers, hi: (i + 1) * N div Workers};
38- if C.pthread_create(ADR(t[i]), nil, work, ^U8(ADR(parts[i]))) # 0 then
39+ if C.pthread_create(SYSTEM.ADR(t[i]), nil, work, ^U8(SYSTEM.ADR(parts[i]))) # 0 then
3940 Out.str("can't start a thread\n");
4041 return 1;
4142 end;

examples/Sh.raz (history) modified +9 -8

@@ -13,6 +13,7 @@
1313 bg), assignments, globs, $(...), if and while. *)
1414 module Sh;
1515 import Opt, Files, Sys, Str, Buf, Fmt, Out, Arena, Heap, Rt;
16+import SYSTEM;
1617
1718 const
1819 maxWords = 64; (* of a command *)
@@ -85,7 +86,7 @@
8586 proc readWord;
8687 var b: Buf.Buf; q: U8;
8788 begin
88- Buf.init(b, ADR(arena.base));
89+ Buf.init(b, SYSTEM.ADR(arena.base));
8990 while (at < LEN(s)) and not special(s[at]) do
9091 q := s[at];
9192 match q of
@@ -148,7 +149,7 @@
148149 var t: Token; c: ^Command;
149150 begin
150151 p^ := {n: 1};
151- c := ADR(p^.cmds[0]);
152+ c := SYSTEM.ADR(p^.cmds[0]);
152153 t := next();
153154 while (t # sep) and (t # amp) and (t # eof) do
154155 if t = word then
@@ -157,7 +158,7 @@
157158 INC(c^.n);
158159 elsif t = pipe then
159160 if (c^.n = 0) or (p^.n = maxCmds) then say("a | without a command", []); return t, false; end;
160- c := ADR(p^.cmds[p^.n]);
161+ c := SYSTEM.ADR(p^.cmds[p^.n]);
161162 INC(p^.n);
162163 else
163164 if next() # word then say("a redirection without a file", []); return t, false; end;
@@ -185,7 +186,7 @@
185186 if (i = LEN(path)) or (path[i] = ':') then
186187 dir := path[start..i];
187188 start := i + 1;
188- Buf.init(b, ADR(arena.base));
189+ Buf.init(b, SYSTEM.ADR(arena.base));
189190 Fmt.write(b, "{}/{}", [Fmt.str(dir), Fmt.str(name)]);
190191 info, err := Sys.info(Buf.bytes(b));
191192 if (err = 0) and info.file and (info.mode & 49H # 0) then return Buf.bytes(b), true; end;
@@ -246,11 +247,11 @@
246247 pids: [maxCmds]INT; fds: [3]INT; i, j, inNext, r, w, leader, joins, how, _pid: INT;
247248 c: ^Command; path: []const U8; found, _ok: BOOL; st: Sys.Status;
248249 begin
249- if (p^.n = 1) and not p^.background and builtin(ADR(p^.cmds[0])) then return; end;
250+ if (p^.n = 1) and not p^.background and builtin(SYSTEM.ADR(p^.cmds[0])) then return; end;
250251 leader := 0;
251252 inNext := 0;
252253 for i := 0 to p^.n - 1 do
253- c := ADR(p^.cmds[i]);
254+ c := SYSTEM.ADR(p^.cmds[i]);
254255 fds := [inNext, 0, 0];
255256 inNext := 0;
256257 if i < p^.n - 1 then r, w := Sys.pipe(); fds[1] := w; inNext := r; end;
@@ -306,9 +307,9 @@
306307 s := script;
307308 at := 0;
308309 repeat
309- t, ok := parse(ADR(p));
310+ t, ok := parse(SYSTEM.ADR(p));
310311 if not ok then status := 2; return; end;
311- if p.cmds[0].n > 0 then start(ADR(p)); end;
312+ if p.cmds[0].n > 0 then start(SYSTEM.ADR(p)); end;
312313 until t = eof;
313314 end;
314315

examples/Volatile.raz (history) modified +2 -1

@@ -4,6 +4,7 @@
44 size, in the order written. *)
55 module Volatile;
66 import Out;
7+import SYSTEM;
78
89 type
910 Uart = record
@@ -17,7 +18,7 @@
1718 proc main*;
1819 var dev: ^VOLATILE Uart; i: INT;
1920 begin
20- dev := ^VOLATILE Uart(ADR(page));
21+ dev := ^VOLATILE Uart(SYSTEM.ADR(page));
2122 dev^.control := 1;
2223 dev^.status := 0FFH;
2324 for i := 0 to 2 do

examples/Window.raz (history) modified +3 -2

@@ -4,6 +4,7 @@
44 check, not run: it needs a display. *)
55 module Window;
66 import Out;
7+import SYSTEM;
78 link "libX11.so.6";
89
910 const
@@ -56,12 +57,12 @@
5657 _ := XSelectInput(d, w, ExposureMask + KeyPressMask);
5758 _ := XMapWindow(d, w);
5859 repeat
59- _ := XNextEvent(d, ^U8(ADR(ev)));
60+ _ := XNextEvent(d, ^U8(SYSTEM.ADR(ev)));
6061 if I32(ev[0]) = Expose then
6162 _ := XDrawString(d, w, XDefaultGC(d, s), 20, 45, text, I32(LEN(text)));
6263 end;
6364 until I32(ev[0]) = KeyPress;
64- key := ^KeyEvent(ADR(ev));
65+ key := ^KeyEvent(SYSTEM.ADR(ev));
6566 Out.str("key "); Out.int(INT(key^.keycode)); Out.ln;
6667 _ := XCloseDisplay(d);
6768 return 0;

examples/Workers.raz (history) modified +3 -2

@@ -2,6 +2,7 @@
22 from a shared counter and add up their results under a Mutex. *)
33 module Workers;
44 import Out, Thread;
5+import SYSTEM;
56
67 const
78 Workers = 4;
@@ -24,13 +25,13 @@
2425 proc work(_arg: ^U8);
2526 var n, r: INT;
2627 begin
27- n := XADD(ADR(next), 1);
28+ n := XADD(next, 1);
2829 while n < Jobs do
2930 r := job(n * 1000);
3031 Thread.lock(m);
3132 total := total + r;
3233 Thread.unlock(m);
33- n := XADD(ADR(next), 1);
34+ n := XADD(next, 1);
3435 end;
3536 end;
3637

test/bench/Grep.raz (history) modified +4 -3

@@ -8,6 +8,7 @@
88 whole only where both are. *)
99 module Grep;
1010 import Out;
11+import SYSTEM;
1112 check off;
1213
1314 const
@@ -42,7 +43,7 @@
4243 begin
4344 i := 0;
4445 while i + 8 <= LEN(s) do
45- p := ^U64(ADR(s[i]));
46+ p := ^U64(SYSTEM.ADR(s[i]));
4647 m := zeros(p^ xor 0A0A0A0A0A0A0A0AH);
4748 if m # 0 then return i + lowest(m); end;
4849 i := i + 8;
@@ -60,8 +61,8 @@
6061 wb := U64(Word[B]) * Ones;
6162 i := 0;
6263 while i + 7 <= last do
63- p := ^U64(ADR(s[i + A]));
64- q := ^U64(ADR(s[i + B]));
64+ p := ^U64(SYSTEM.ADR(s[i + A]));
65+ q := ^U64(SYSTEM.ADR(s[i + B]));
6566 m := zeros(p^ xor wa) & zeros(q^ xor wb);
6667 while m # 0 do
6768 j := i + lowest(m);

test/bench/Heapsort.raz (history) modified +1 -0

@@ -1,6 +1,7 @@
11 (* A heap sort of pseudo-random numbers. *)
22 module Heapsort;
33 import Out;
4+import SYSTEM;
45 check off;
56
67 const

test/bench/Jacobi.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 neighbours, the edges held. *)
33 module Jacobi;
44 import Out;
5+import SYSTEM;
56 check off;
67
78 const

test/bench/Lines.raz (history) modified +1 -0

@@ -3,6 +3,7 @@
33 IndexByte, which is assembly, and a counting loop. *)
44 module Lines;
55 import Out, Bytes;
6+import SYSTEM;
67 check off;
78
89 const

test/bench/NBody.raz (history) modified +1 -0

@@ -3,6 +3,7 @@
33 inner loop. *)
44 module NBody;
55 import Out, Math;
6+import SYSTEM;
67 check off;
78
89 const

test/bench/Search.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 turn, over a text of four letters. *)
33 module Search;
44 import Out;
5+import SYSTEM;
56 check off;
67
78 const

test/bench/Sum.raz (history) modified +1 -0

@@ -1,6 +1,7 @@
11 (* A sum over a slice: the loop of a procedure that takes one. *)
22 module Sum;
33 import Out;
4+import SYSTEM;
45 check off;
56
67 const

test/err/AsmControl.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmControl.raz:4:5: error: can't assemble mov with these operands
2- 4 | mov eax, cr0;
1+test/err/AsmControl.raz:5:5: error: can't assemble mov with these operands
2+ 5 | mov eax, cr0;
33 | ^^^
44 raz: 1 error

test/err/AsmControl.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmControl;
2+import SYSTEM;
23 proc f;
34 code
45 mov eax, cr0;

test/err/AsmJccRegister.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmJccRegister.raz:4:5: error: unknown instruction jz
2- 4 | jz rax;
1+test/err/AsmJccRegister.raz:5:5: error: unknown instruction jz
2+ 5 | jz rax;
33 | ^^
44 raz: 1 error

test/err/AsmJccRegister.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmJccRegister;
2+import SYSTEM;
23 proc f;
34 code
45 jz rax;

test/err/AsmLabel.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmLabel.raz:4:9: error: label nowhere isn't defined
2- 4 | jmp nowhere;
1+test/err/AsmLabel.raz:5:9: error: label nowhere isn't defined
2+ 5 | jmp nowhere;
33 | ^^^^^^^
44 raz: 1 error

test/err/AsmLabel.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmLabel;
2+import SYSTEM;
23 proc f;
34 code
45 jmp nowhere;

test/err/AsmMemory.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmMemory.raz:4:16: error: expected a memory operand, [base + index * scale + disp]
2- 4 | mov rax, [8];
1+test/err/AsmMemory.raz:5:16: error: expected a memory operand, [base + index * scale + disp]
2+ 5 | mov rax, [8];
33 | ^
44 raz: 1 error

test/err/AsmMemory.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmMemory;
2+import SYSTEM;
23 proc f;
34 code
45 mov rax, [8];

test/err/AsmOperands.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmOperands.raz:4:5: error: can't assemble lea with these operands
2- 4 | lea rax, rbx;
1+test/err/AsmOperands.raz:5:5: error: can't assemble lea with these operands
2+ 5 | lea rax, rbx;
33 | ^^^
44 raz: 1 error

test/err/AsmOperands.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmOperands;
2+import SYSTEM;
23 proc f;
34 code
45 lea rax, rbx;

test/err/AsmUnknown.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AsmUnknown.raz:4:5: error: unknown instruction frob
2- 4 | frob rax;
1+test/err/AsmUnknown.raz:5:5: error: unknown instruction frob
2+ 5 | frob rax;
33 | ^^^^
44 raz: 1 error

test/err/AsmUnknown.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AsmUnknown;
2+import SYSTEM;
23 proc f;
34 code
45 frob rax;

test/err/AtPByte.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/AtPByte.raz:4:11: error: expected a byte from 0 to 255, found 300
2- 4 | db 1, 300;
1+test/err/AtPByte.raz:5:11: error: expected a byte from 0 to 255, found 300
2+ 5 | db 1, 300;
33 | ^^^
44 raz: 1 error

test/err/AtPByte.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module AtPByte;
2+import SYSTEM;
23 proc f(a: I64);
34 code
45 db 1, 300;

test/err/BareC.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module BareC;
2+import SYSTEM;
23 extern proc getpid(): I32;
34 proc main*;
45 begin

test/err/ConvDeref.err (history) modified +2 -2

@@ -1,5 +1,5 @@
1-test/err/ConvDeref.raz:4:15: error: a conversion can't be dereferenced
2- 4 | b := ^INT(a)^
1+test/err/ConvDeref.raz:5:15: error: a conversion can't be dereferenced
2+ 5 | b := ^INT(a)^
33 | ^
44 help: convert into a pointer variable, then dereference that
55 raz: 1 error

test/err/ConvDeref.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module ConvDeref;
2+import SYSTEM;
23 var a, b: INT;
34 begin
45 b := ^INT(a)^

test/err/DeclAtomicSize.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/DeclAtomicSize.raz:8:15: error: expected an INT or a UINT variable, found ^U8
2- 8 | n := XADD(p, 1);
1+test/err/DeclAtomicSize.raz:9:15: error: expected an INT or a UINT variable, found ^U8
2+ 9 | n := XADD(p, 1);
33 | ^
44 raz: 1 error

test/err/DeclAtomicSize.raz (history) modified +2 -1

@@ -1,10 +1,11 @@
11 module DeclAtomicSize;
2+import SYSTEM;
23 proc main*;
34 var b: U8;
45 var p: ^U8;
56 var n: I64;
67 begin
7- p := ADR(b);
8+ p := SYSTEM.ADR(b);
89 n := XADD(p, 1);
910 end;
1011 end DeclAtomicSize.

test/err/DeclSyscallArg.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-test/err/DeclSyscallArg.raz:5:21: error: expected an integer or a pointer, found 1.5
2- 5 | n := SYSCALL(1, 1.5);
3- | ^^^
1+test/err/DeclSyscallArg.raz:6:28: error: expected an integer or a pointer, found 1.5
2+ 6 | n := SYSTEM.SYSCALL(1, 1.5);
3+ | ^^^
44 raz: 1 error

test/err/DeclSyscallArg.raz (history) modified +2 -1

@@ -1,7 +1,8 @@
11 module DeclSyscallArg;
2+import SYSTEM;
23 proc main*;
34 var n: I64;
45 begin
5- n := SYSCALL(1, 1.5);
6+ n := SYSTEM.SYSCALL(1, 1.5);
67 end;
78 end DeclSyscallArg.

test/err/ExprJoinStrings.err (history) modified +1 -1

@@ -1,4 +1,4 @@
1-test/err/ExprJoinStrings.raz:7:13: error: + doesn't join []U8
1+test/err/ExprJoinStrings.raz:7:13: error: + doesn't join []const U8
22 7 | Out.str(s + "def");
33 | ^
44 help: strings are joined in a Buf: Buf.str(b, s)

test/err/ExprJoinStrings.raz (history) modified +1 -1

@@ -1,7 +1,7 @@
11 module ExprJoinStrings;
22 import Out;
33 proc main*;
4-var s: []U8;
4+var s: []const U8;
55 begin
66 s := "abc";
77 Out.str(s + "def");

test/err/ExprNoField.err (history) modified +4 -4

@@ -1,9 +1,9 @@
1-test/err/ExprNoField.raz:7:10: error: expected a record, found ^R
2- 7 | n := p.x;
1+test/err/ExprNoField.raz:8:10: error: expected a record, found ^R
2+ 8 | n := p.x;
33 | ^
44 help: through a pointer, write p^.x
5-test/err/ExprNoField.raz:8:10: error: expected a record, found []U8
6- 8 | n := s.len;
5+test/err/ExprNoField.raz:9:10: error: expected a record, found []U8
6+ 9 | n := s.len;
77 | ^
88 help: its length is LEN(s)
99 raz: 2 errors

test/err/ExprNoField.raz (history) modified +2 -1

@@ -1,9 +1,10 @@
11 module ExprNoField;
2+import SYSTEM;
23 type R = record x: I64; end;
34 proc main*;
45 var r: R; p: ^R; s: []U8; n: I64;
56 begin
6- p := ADR(r);
7+ p := SYSTEM.ADR(r);
78 n := p.x;
89 n := s.len;
910 end;

test/err/ExternRec.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/ExternRec.raz:5:13: error: C takes integers, BOOL, reals, pointers and procedures
2- 5 | extern proc f(r: R);
1+test/err/ExternRec.raz:6:13: error: C takes integers, BOOL, reals, pointers and procedures
2+ 6 | extern proc f(r: R);
33 | ^
44 raz: 1 error

test/err/ExternRec.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module ExternRec;
2+import SYSTEM;
23
34 type R = record a, b: I64; end;
45

test/err/F32Dots.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/F32Dots.raz:8:22: error: an F32 goes to ... as F64(x)
2- 8 | C.printf("%f\n", x);
1+test/err/F32Dots.raz:9:22: error: an F32 goes to ... as F64(x)
2+ 9 | C.printf("%f\n", x);
33 | ^
44 raz: 1 error

test/err/F32Dots.raz (history) modified +1 -0

@@ -1,5 +1,6 @@
11 module F32Dots;
22 import C;
3+import SYSTEM;
34
45 proc main*;
56 var x: F32;

test/err/GenCodeValue.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/GenCodeValue.raz:6:10: error: a code procedure with two results can only be called
2- 6 | f := Two;
1+test/err/GenCodeValue.raz:7:10: error: a code procedure with two results can only be called
2+ 7 | f := Two;
33 | ^^^
44 raz: 1 error

test/err/GenCodeValue.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module GenCodeValue;
2+import SYSTEM;
23 type F = proc(): (I64, I64); proc Two(): (I64, I64); code ret; end;
34 proc main*;
45 var f: F;

test/err/Static.raz (history) modified +1 -0

@@ -1,5 +1,6 @@
11 module Static;
22 import Bare, C;
3+import SYSTEM;
34
45 proc main*;
56 begin

test/err/StmtCReturns.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCReturns.raz:3:13: error: C returns a single value
2- 3 | extern proc f(): R;
1+test/err/StmtCReturns.raz:4:13: error: C returns a single value
2+ 4 | extern proc f(): R;
33 | ^
44 raz: 1 error

test/err/StmtCReturns.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCReturns;
2+import SYSTEM;
23 type R = record a: I64; end;
34 extern proc f(): R;
45 end StmtCReturns.

test/err/StmtCodeParams.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCodeParams.raz:2:6: error: too many parameters for a code procedure
2- 2 | proc f(a, b, c, d, e, f, g: I64);
1+test/err/StmtCodeParams.raz:3:6: error: too many parameters for a code procedure
2+ 3 | proc f(a, b, c, d, e, f, g: I64);
33 | ^
44 raz: 1 error

test/err/StmtCodeParams.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCodeParams;
2+import SYSTEM;
23 proc f(a, b, c, d, e, f, g: I64);
34 code ret; end;
45 end StmtCodeParams.

test/err/StmtCodeResult.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCodeResult.raz:3:6: error: a code procedure returns a single value
2- 3 | proc f: R;
1+test/err/StmtCodeResult.raz:4:6: error: a code procedure returns a single value
2+ 4 | proc f: R;
33 | ^
44 raz: 1 error

test/err/StmtCodeResult.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCodeResult;
2+import SYSTEM;
23 type R = record a: I64; end;
34 proc f: R;
45 code ret; end;

test/err/StmtCodeSlices.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCodeSlices.raz:2:6: error: too many parameters for a code procedure
2- 2 | proc f(a, b, c, d, e: I64; s: []U8);
1+test/err/StmtCodeSlices.raz:3:6: error: too many parameters for a code procedure
2+ 3 | proc f(a, b, c, d, e: I64; s: []U8);
33 | ^
44 raz: 1 error

test/err/StmtCodeSlices.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCodeSlices;
2+import SYSTEM;
23 proc f(a, b, c, d, e: I64; s: []U8);
34 code ret; end;
45 end StmtCodeSlices.

test/err/StmtCodeTakes.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCodeTakes.raz:3:6: error: a code procedure takes integers, BOOL, reals, pointers, procedures and slices
2- 3 | proc f(r: R);
1+test/err/StmtCodeTakes.raz:4:6: error: a code procedure takes integers, BOOL, reals, pointers, procedures and slices
2+ 4 | proc f(r: R);
33 | ^
44 raz: 1 error

test/err/StmtCodeTakes.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCodeTakes;
2+import SYSTEM;
23 type R = record a: I64; end;
34 proc f(r: R);
45 code ret; end;

test/err/StmtCodeTwo.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-test/err/StmtCodeTwo.raz:2:6: error: a code procedure returns two results only in rax and rdx
2- 2 | proc f: (F64, I64);
1+test/err/StmtCodeTwo.raz:3:6: error: a code procedure returns two results only in rax and rdx
2+ 3 | proc f: (F64, I64);
33 | ^
44 raz: 1 error

test/err/StmtCodeTwo.raz (history) modified +1 -0

@@ -1,4 +1,5 @@
11 module StmtCodeTwo;
2+import SYSTEM;
23 proc f: (F64, I64);
34 code ret; end;
45 end StmtCodeTwo.

test/err/VarGivenAddress.raz (history) modified +4 -3

@@ -1,13 +1,14 @@
11 module VarGivenAddress;
2+import SYSTEM;
23 type B = record n: INT; end;
34 proc f(var b: B); begin b.n := 1; end;
45 proc g(const b: B): INT; begin return b.n; end;
56 proc main*;
67 var b: B; p: ^B;
78 begin
8- p := ADR(b);
9- f(ADR(b));
9+ p := SYSTEM.ADR(b);
10+ f(SYSTEM.ADR(b));
1011 f(p);
11- _ := g(ADR(b));
12+ _ := g(SYSTEM.ADR(b));
1213 end;
1314 end VarGivenAddress.

test/err/ZeroDigit.raz (history) modified +1 -1

@@ -1,7 +1,7 @@
11 module ZeroDigit;
22 (* \0 before a digit is a warning; \x00, \0 at the end, \0 before a
33 letter, an escaped backslash before 0 and a raw string are quiet. *)
4-var s*: []U8; c*: U8;
4+var s*: []const U8; c*: U8;
55 proc main*;
66 begin
77 s := "a\x0012";

test/err/mods/Bare.raz (history) modified +1 -0

@@ -1,5 +1,6 @@
11 (* A module that needs a program without C. *)
22 module Bare;
3+import SYSTEM;
34 link static;
45
56 proc f*: I64;

test/libc/ThreadSignalC.raz (history) modified +3 -2

@@ -4,6 +4,7 @@
44 joined, is -3. ThreadSignal is the same, without C; this copy runs over
55 the C library's Sys. *)
66 import Thread, Sys, Fmt, C;
7+import SYSTEM;
78
89 var
910 r, got, done: INT;
@@ -12,7 +13,7 @@
1213 var buf: [16]U8;
1314 begin
1415 got := Sys.read(r, buf);
15- _ := XCHG(ADR(done), 1);
16+ _ := XCHG(done, 1);
1617 end;
1718
1819 proc quick(_arg: ^U8);
@@ -28,7 +29,7 @@
2829 t, e := Thread.spawn(reader, nil);
2930 if e # nil then Fmt.print("no thread\n", []); return; end;
3031 (* again until it lands: the first may come before the read begins *)
31- while (XADD(ADR(done), 0) = 0) and (tries < 1000) do
32+ while (XADD(done, 0) = 0) and (tries < 1000) do
3233 k := Thread.signal(t, Sys.sigUsr1);
3334 if k # 0 then Fmt.print("signal: {}\n", [Fmt.int(k)]); end;
3435 Sys.sleep(5);

test/libc/Through.raz (history) modified +1 -0

@@ -3,6 +3,7 @@
33 writes out what Out holds. *)
44 module Through;
55 import Out, Heap, Mem;
6+import SYSTEM;
67
78 type Node = record next: ^Node; n: I64; end;
89

test/libc/Through.stderr (history) modified +2 -2

@@ -1,2 +1,2 @@
1-test/libc/Through.raz:30:7: index 3 is out of range for a length of 3
2- in Through.main at test/libc/Through.raz:30:7: p = nil, list = nil, i = 3, sum = 500500
1+test/libc/Through.raz:31:7: index 3 is out of range for a length of 3
2+ in Through.main at test/libc/Through.raz:31:7: p = nil, list = nil, i = 3, sum = 500500

test/list/Listing.expect (history) modified +4 -4

@@ -4,13 +4,13 @@
44 4 ret
55
66 Listing.main:
7- 17 proc main*;
7+ 18 proc main*;
88 0 push rbp
99 1 mov rbp, rsp
1010 4 sub rsp, 32
1111 11 mov [rbp - 8], rbx
1212 15 xor ebx, ebx
13- 20 for i := 1 to 3 do
13+ 21 for i := 1 to 3 do
1414 17 mov rbx, 1
1515 22 cmp rbx, 3
1616 26 jg 168
@@ -20,7 +20,7 @@
2020 53 nop
2121 61 nop
2222 64 add rbx, 1
23- 21 if i # 2 then total := add(total, twice(i)); end;
23+ 22 if i # 2 then total := add(total, twice(i)); end;
2424 68 cmp rbx, 2
2525 72 je 134
2626 78 mov r8, [Listing.total]
@@ -43,7 +43,7 @@
4343 154 add rbx, 1
4444 158 cmp rbx, 3
4545 162 jle 68
46- 23 end main;
46+ 24 end main;
4747 168 mov rbx, [rbp - 8]
4848 172 leave
4949 173 ret

test/list/Listing.raz (history) modified +1 -0

@@ -1,5 +1,6 @@
11 module Listing;
22 (* raz -S: each line of source, and the instructions made for it *)
3+import SYSTEM;
34
45 var total: I64;
56

test/msg/ArrayConstAdr.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/ArrayConstAdr.raz:6:14: error: ADR needs a variable
2- 6 | p := ADR(P);
3- | ^
1+conform/err/ArrayConstAdr.raz:7:21: error: ADR needs a variable
2+ 7 | p := SYSTEM.ADR(P);
3+ | ^
44 raz: 1 error

test/msg/AtPAdr.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/AtPAdr.raz:5:14: error: ADR needs a variable
2- 5 | p := ADR(1);
3- | ^
1+conform/err/AtPAdr.raz:6:21: error: ADR needs a variable
2+ 6 | p := SYSTEM.ADR(1);
3+ | ^
44 raz: 1 error

test/msg/AtomicI64.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/AtomicI64.raz:5:16: error: expected a pointer to an INT, a UINT or a pointer, found ^I64
2- 5 | _ok := CAS(ADR(n), 0, 1);
3- | ^^^^^^
1+conform/err/AtomicI64.raz:5:16: error: expected an INT, a UINT or a pointer variable, found I64
2+ 5 | _ok := CAS(n, 0, 1);
3+ | ^
44 raz: 1 error

test/msg/BytesVolatile.err (history) modified +2 -2

@@ -1,5 +1,5 @@
1-conform/err/BytesVolatile.raz:7:16: error: BYTES can't take a volatile variable
2- 7 | b := BYTES(r^);
1+conform/err/BytesVolatile.raz:8:16: error: BYTES can't take a volatile variable
2+ 8 | b := BYTES(r^);
33 | ^^
44 help: reading and writing its bytes through a slice wouldn't be volatile accesses
55 raz: 1 error

test/msg/ConstAdr.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/ConstAdr.raz:5:16: error: r is only read here, and can't be changed
2- 5 | return ADR(r);
3- | ^
1+conform/err/ConstAdr.raz:6:23: error: r is only read here, and can't be changed
2+ 6 | return SYSTEM.ADR(r);
3+ | ^
44 help: a const parameter, a constant, and the names a match gives their fields, are only read: take a var parameter to change it
55 raz: 1 error

test/msg/ExportAdr.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/ExportAdr.raz:6:15: error: Owner.n is Owner's, and can't be changed outside it
2- 6 | _p := ADR(Owner.n);
3- | ^^^^^^^
1+conform/err/ExportAdr.raz:7:22: error: Owner.n is Owner's, and can't be changed outside it
2+ 7 | _p := SYSTEM.ADR(Owner.n);
3+ | ^^^^^^^
44 raz: 1 error

test/msg/GenDotsRecord.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-conform/err/GenDotsRecord.raz:7:20: error: only a single value goes to ...
2- 7 | C.printf("%d", r);
1+conform/err/GenDotsRecord.raz:8:20: error: only a single value goes to ...
2+ 8 | C.printf("%d", r);
33 | ^
44 raz: 1 error

test/msg/PackedAddress.err (history) modified +9 -9

@@ -1,13 +1,13 @@
1-conform/err/PackedAddress.raz:15:14: error: a field of a packed record has no address
2- 15 | p := ADR(h.len);
3- | ^^^^^
4-conform/err/PackedAddress.raz:16:9: error: a field of a packed record can't be a var parameter
5- 16 | put(h.len);
1+conform/err/PackedAddress.raz:16:21: error: a field of a packed record has no address
2+ 16 | p := SYSTEM.ADR(h.len);
3+ | ^^^^^
4+conform/err/PackedAddress.raz:17:9: error: a field of a packed record can't be a var parameter
5+ 17 | put(h.len);
66 | ^^^^^
7-conform/err/PackedAddress.raz:17:10: error: can't make a slice of a field of a packed record
8- 17 | s := h.vals[0..1];
7+conform/err/PackedAddress.raz:18:10: error: can't make a slice of a field of a packed record
8+ 18 | s := h.vals[0..1];
99 | ^^^^^^
10-conform/err/PackedAddress.raz:19:5: error: a field of a packed record can't be volatile
11- 19 | q^.len := 2;
10+conform/err/PackedAddress.raz:20:5: error: a field of a packed record can't be volatile
11+ 20 | q^.len := 2;
1212 | ^^
1313 raz: 4 errors

test/msg/PtrArray.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-conform/err/PtrArray.raz:6:5: error: a pointer to an array is indexed as p^[i]
2- 6 | p[1] := 0;
1+conform/err/PtrArray.raz:7:5: error: a pointer to an array is indexed as p^[i]
2+ 7 | p[1] := 0;
33 | ^
44 raz: 1 error

test/msg/PtrAsSlice.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/PtrAsSlice.raz:5:10: error: can't use ^U8 as []U8
2- 5 | s := PTR(a);
3- | ^^^^^^
1+conform/err/PtrAsSlice.raz:6:10: error: can't use ^U8 as []U8
2+ 6 | s := SYSTEM.PTR(a);
3+ | ^^^^^^^^^^^^^
44 help: a pointer has no length: p[0..n], for a pointer p, is the slice of the n elements it starts
55 raz: 1 error

test/msg/PtrElement.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/PtrElement.raz:5:10: error: can't use ^U8 as ^INT
2- 5 | p := PTR(a);
3- | ^^^^^^
1+conform/err/PtrElement.raz:6:10: error: can't use ^U8 as ^INT
2+ 6 | p := SYSTEM.PTR(a);
3+ | ^^^^^^^^^^^^^
44 raz: 1 error

test/msg/PtrExport.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/PtrExport.raz:6:14: error: Owner.a is Owner's, and can't be changed outside it
2- 6 | p := PTR(Owner.a);
3- | ^^^^^^^
1+conform/err/PtrExport.raz:7:21: error: Owner.a is Owner's, and can't be changed outside it
2+ 7 | p := SYSTEM.PTR(Owner.a);
3+ | ^^^^^^^
44 help: a pointer to it could change it, as a slice of it could: copy it to a variable here first
55 raz: 1 error

test/msg/PtrInteger.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/PtrInteger.raz:6:14: error: PTR needs a slice or an array, found INT
2- 6 | p := PTR(n);
3- | ^
1+conform/err/PtrInteger.raz:7:21: error: PTR needs a slice or an array, found INT
2+ 7 | p := SYSTEM.PTR(n);
3+ | ^
44 raz: 1 error

test/msg/PtrLiteral.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/PtrLiteral.raz:5:14: error: PTR can't take an array literal, which has no type here
2- 5 | p := PTR([]);
3- | ^
1+conform/err/PtrLiteral.raz:6:21: error: PTR can't take an array literal, which has no type here
2+ 6 | p := SYSTEM.PTR([]);
3+ | ^
44 help: PTR([]) would be nil, the empty slice's pointer; give any other literal a variable first
55 raz: 1 error

test/msg/PtrPacked.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/PtrPacked.raz:6:14: error: PTR can't take a field of a packed record, which has no address
2- 6 | p := PTR(r.words);
3- | ^^^^^^^
1+conform/err/PtrPacked.raz:7:21: error: PTR can't take a field of a packed record, which has no address
2+ 7 | p := SYSTEM.PTR(r.words);
3+ | ^^^^^^^
44 raz: 1 error

test/msg/PtrPointer.err (history) modified +6 -6

@@ -1,9 +1,9 @@
1-conform/err/PtrPointer.raz:6:14: error: PTR needs a slice or an array, found ^U8
2- 6 | q := PTR(p);
3- | ^
1+conform/err/PtrPointer.raz:7:21: error: PTR needs a slice or an array, found ^U8
2+ 7 | q := SYSTEM.PTR(p);
3+ | ^
44 help: p is a pointer already, which is what PTR gives of a slice or an array
5-conform/err/PtrPointer.raz:7:14: error: PTR needs a slice or an array, found ^[4]U8
6- 7 | q := PTR(pa);
7- | ^^
5+conform/err/PtrPointer.raz:8:21: error: PTR needs a slice or an array, found ^[4]U8
6+ 8 | q := SYSTEM.PTR(pa);
7+ | ^^
88 help: write PTR(pa^) for the address of the array's first element, a ^U8
99 raz: 2 errors

test/msg/PtrView.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/PtrView.raz:6:14: error: PTR can't take a view
2- 6 | p := PTR(w.([8]U8));
3- | ^^^^^^^^^
1+conform/err/PtrView.raz:7:21: error: PTR can't take a view
2+ 7 | p := SYSTEM.PTR(w.([8]U8));
3+ | ^^^^^^^^^
44 help: a view has no address, since it may be misaligned: copy it to a variable
55 raz: 1 error

test/msg/PtrVolatile.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/PtrVolatile.raz:7:14: error: PTR can't take an array through a volatile pointer
2- 7 | p := PTR(v^);
3- | ^^
1+conform/err/PtrVolatile.raz:8:21: error: PTR can't take an array through a volatile pointer
2+ 8 | p := SYSTEM.PTR(v^);
3+ | ^^
44 help: ADR(v^[0]) is the address of its first element, a ^VOLATILE U32
55 raz: 1 error

test/msg/SliceLiteralPart.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/SliceLiteralPart.raz:2:32: error: a constant slice is a string, an array constant or literal of its elements, or [], found 3
2- 2 | const Rows: [][]INT = [[1, 2], 3];
3- | ^
1+conform/err/SliceLiteralPart.raz:2:44: error: a constant slice is a string, an array constant or literal of its elements, or [], found 3
2+ 2 | const Rows: []const []const INT = [[1, 2], 3];
3+ | ^
44 raz: 1 error

test/msg/SlicePtrBackwards.stderr (history) modified +2 -2

@@ -1,2 +1,2 @@
1-conform/run/SlicePtrBackwards.raz:11:23: slice 2..0 runs backwards
2- in SlicePtrBackwards.main at conform/run/SlicePtrBackwards.raz:11:23: p = 0x?, hi = 0
1+conform/run/SlicePtrBackwards.raz:12:23: slice 2..0 runs backwards
2+ in SlicePtrBackwards.main at conform/run/SlicePtrBackwards.raz:12:23: p = 0x?, hi = 0

test/msg/StmtVarOrProc.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-conform/err/StmtVarOrProc.raz:2:8: error: expected "proc" or "var", found a number
2- 2 | extern 5;
1+conform/err/StmtVarOrProc.raz:3:8: error: expected "proc" or "var", found a number
2+ 3 | extern 5;
33 | ^
44 raz: 1 error

test/msg/ViewAdr.err (history) modified +3 -3

@@ -1,5 +1,5 @@
1-conform/err/ViewAdr.raz:5:14: error: ADR can't take a view
2- 5 | p := ADR(mem[0].(I64));
3- | ^^^^^^^^^^^^
1+conform/err/ViewAdr.raz:6:21: error: ADR can't take a view
2+ 6 | p := SYSTEM.ADR(mem[0].(I64));
3+ | ^^^^^^^^^^^^
44 help: a view has no address, since it may be misaligned: copy it to a variable
55 raz: 1 error

test/msg/Volatile.err (history) modified +2 -2

@@ -1,4 +1,4 @@
1-conform/err/Volatile.raz:6:10: error: can't use ^VOLATILE I64 as ^I64
2- 6 | q := p;
1+conform/err/Volatile.raz:7:10: error: can't use ^VOLATILE I64 as ^I64
2+ 7 | q := p;
33 | ^
44 raz: 1 error

test/run/Alloc.raz (history) modified +4 -3

@@ -1,5 +1,6 @@
11 module Alloc;
22 import Out, Mem, Arena, Heap;
3+import SYSTEM;
34
45 type
56 Node = record next: ^Node; val: I64; pad: [5]I64; end;
@@ -52,12 +53,12 @@
5253 Out.int(b^.data[999] + b^.data[0]); Out.ln;
5354 Mem.free(Heap.heap, ^U8(b));
5455 if not Arena.init(ar, 8192) then Out.str("no arena"); end;
55- l := build(ADR(ar.base), 100);
56+ l := build(SYSTEM.ADR(ar.base), 100);
5657 Out.int(sum(l)); Out.ln;
57- l := build(ADR(ar.base), 1000);
58+ l := build(SYSTEM.ADR(ar.base), 1000);
5859 if l = nil then Out.str("nil "); end;
5960 Arena.reset(ar);
60- NEW(again, ADR(ar.base));
61+ NEW(again, SYSTEM.ADR(ar.base));
6162 if again # nil then Out.str("again "); Out.int(again^.val); end;
6263 Out.ln;
6364 Arena.done(ar);

test/run/ArenaRelease.raz (history) modified +2 -1

@@ -2,12 +2,13 @@
22 (* a mark from before the arena's present position is released; one past
33 where the arena stands stops the program *)
44 import Arena, Mem, Rt;
5+import SYSTEM;
56
67 proc main*;
78 var ar: Arena.Arena; m: INT;
89 begin
910 if not Arena.init(ar, 4096) then Rt.stop("no arena"); end;
10- _ := Mem.alloc(ADR(ar.base), 10, 1);
11+ _ := Mem.alloc(SYSTEM.ADR(ar.base), 10, 1);
1112 m := Arena.mark(ar);
1213 Arena.release(ar, 0);
1314 Arena.release(ar, m);

test/run/Asm.raz (history) modified +5 -4

@@ -2,6 +2,7 @@
22 (* Code procedures in assembly: the instructions the assembler knows,
33 each checked by what it computes *)
44 import Out;
5+import SYSTEM;
56
67 const
78 Seven = 7;
@@ -154,10 +155,10 @@
154155 begin
155156 Out.int(tens(4, 2)); Out.ln;
156157 a := [1, 20, 300, 4000];
157- Out.int(sum(ADR(a[0]), 4)); Out.str(" "); Out.int(sum(ADR(a[0]), 0)); Out.str(" ");
158- Out.int(around(ADR(a[0]), 1)); Out.ln;
158+ Out.int(sum(SYSTEM.ADR(a[0]), 4)); Out.str(" "); Out.int(sum(SYSTEM.ADR(a[0]), 0)); Out.str(" ");
159+ Out.int(around(SYSTEM.ADR(a[0]), 1)); Out.ln;
159160 s := "abc";
160- Out.int(swapByte(ADR(s[0]), 1, 'z')); Out.str(" "); Out.str(s[0..3]); Out.ln;
161+ Out.int(swapByte(SYSTEM.ADR(s[0]), 1, 'z')); Out.str(" "); Out.str(s[0..3]); Out.ln;
161162 q, r := udivmod(1000, 7);
162163 Out.int(I64(q)); Out.str(" "); Out.int(I64(r)); Out.ln;
163164 Out.int(max(-5, 3)); Out.str(" "); Out.int(max(9, 3)); Out.str(" ");
@@ -166,7 +167,7 @@
166167 Out.int(I64(real(1.0, 3.0))); Out.ln;
167168 Out.int(mix(5)); Out.ln;
168169 c := 40;
169- Out.int(fetchAdd(ADR(c), 2)); Out.str(" "); Out.int(c); Out.ln;
170+ Out.int(fetchAdd(SYSTEM.ADR(c), 2)); Out.str(" "); Out.int(c); Out.ln;
170171 Out.int(I64(two() * 21.0)); Out.str(" "); Out.int(answer()); Out.ln;
171172 Out.int(through(answer)); Out.ln;
172173 t := "abcdef";

test/run/AsmKernel.raz (history) modified +2 -1

@@ -3,10 +3,11 @@
33 back from the procedure they are made in, since they can't run in
44 user mode. Each was checked against GNU as. *)
55 import Out;
6+import SYSTEM;
67
78 const
89 Count = 36;
9- Names: [Count][]U8 = ["cli", "sti", "iretq", "swapgs",
10+ Names: [Count][]const U8 = ["cli", "sti", "iretq", "swapgs",
1011 "rdmsr", "wrmsr", "wbinvd", "lgdt [rdi]",
1112 "lidt [rsi + 8]", "invlpg [rax]", "invlpg [r12 + rcx * 8 + 400]", "xsave [rdi]",
1213 "xrstor [r9]", "ltr ax", "ltr r10w", "mov cr0, rax",

test/run/Atomic.raz (history) modified +9 -8

@@ -1,5 +1,6 @@
11 module Atomic;
22 import Out;
3+import SYSTEM;
34
45 var counter: INT; flag: UINT; p: ^INT;
56
@@ -13,24 +14,24 @@
1314 proc main*;
1415 var old: INT; ok: BOOL; v: ^VOLATILE INT; x: INT;
1516 begin
16- old := XADD(ADR(counter), 5);
17- old := XADD(ADR(counter), 2);
17+ old := XADD(counter, 5);
18+ old := XADD(counter, 2);
1819 Out.int(old); Out.str(" "); Out.int(counter); Out.ln;
19- ok := CAS(ADR(counter), 7, 100);
20+ ok := CAS(counter, 7, 100);
2021 if ok then Out.str("cas1 "); end;
21- ok := CAS(ADR(counter), 7, 200);
22+ ok := CAS(counter, 7, 200);
2223 if not ok then Out.str("cas2 "); end;
2324 Out.int(counter); Out.ln;
24- Out.int(I64(XCHG(ADR(flag), 9))); Out.str(" ");
25- Out.int(I64(XCHG(ADR(flag), 3))); Out.ln;
25+ Out.int(I64(XCHG(flag, 9))); Out.str(" ");
26+ Out.int(I64(XCHG(flag, 3))); Out.ln;
2627 FENCE;
2728 FENCE();
2829 Out.int(add3(1, 20, 300)); Out.ln;
29- v := ADR(x);
30+ v := SYSTEM.ADR(x);
3031 v^ := 5;
3132 v^ := v^ + 1;
3233 Out.int(x); Out.ln;
33- v := ^VOLATILE INT(ADR(counter));
34+ v := ^VOLATILE INT(SYSTEM.ADR(counter));
3435 Out.int(v^); Out.ln;
3536 end;
3637

test/run/BufFull.raz (history) modified +2 -1

@@ -2,12 +2,13 @@
22 (* a Buf whose allocator runs out stops the program, with the calls
33 under way, rather than dropping what it was given *)
44 import Buf, Arena, Rt;
5+import SYSTEM;
56
67 proc main*;
78 var ar: Arena.Arena; b: Buf.Buf; big: [10000]U8;
89 begin
910 if not Arena.init(ar, 4096) then Rt.stop("no arena"); end;
10- Buf.init(b, ADR(ar.base));
11+ Buf.init(b, SYSTEM.ADR(ar.base));
1112 Buf.str(b, big);
1213 end;
1314

test/run/BufFull.stderr (history) modified +1 -1

@@ -1,4 +1,4 @@
11 Buf: out of memory
22 in Buf.need at lib/Buf.raz:51:9: n = 10000
33 in Buf.str at lib/Buf.raz:67:5
4- in BufFull.main at test/run/BufFull.raz:11:5
4+ in BufFull.main at test/run/BufFull.raz:12:5

test/run/CheckOff.raz (history) modified +2 -1

@@ -3,12 +3,13 @@
33 Unchecked reads past an array, into the field after it, and makes a
44 slice past its string's end; then this module's own index fails *)
55 import Out, Unchecked;
6+import SYSTEM;
67
78 proc main*;
89 var p: Unchecked.Pair; i: INT;
910 begin
1011 p.b := 42;
11- Out.int(Unchecked.get(ADR(p), 2)); Out.str(" ");
12+ Out.int(Unchecked.get(SYSTEM.ADR(p), 2)); Out.str(" ");
1213 Out.int(Unchecked.width("abc", 1, 5)); Out.ln;
1314 Out.flush;
1415 i := 2;

test/run/CheckOff.stderr (history) modified +2 -2

@@ -1,2 +1,2 @@
1-test/run/CheckOff.raz:15:17: index 2 is out of range for a length of 2
2- in CheckOff.main at test/run/CheckOff.raz:15:17: i = 2
1+test/run/CheckOff.raz:16:17: index 2 is out of range for a length of 2
2+ in CheckOff.main at test/run/CheckOff.raz:16:17: i = 2

test/run/ConstOfConst.raz (history) modified +1 -1

@@ -3,7 +3,7 @@
33 module ConstOfConst;
44 import Sys;
55
6-type R = record a: INT; s: []U8; end;
6+type R = record a: INT; s: []const U8; end;
77
88 const X: R = {a: 1, s: "one"};
99 const Row: [2]INT = [3, 4];

test/run/Data.raz (history) modified +6 -5

@@ -1,5 +1,6 @@
11 module Data;
22 import Out;
3+import SYSTEM;
34
45 type
56 Cell = record ch: U8; attr: U8; end;
@@ -40,15 +41,15 @@
4041 Out.int(I64(cells[2].ch)); Out.str(" "); Out.int(I64(cells[2].attr)); Out.ln;
4142 for i := 0 to 4 do
4243 nodes[i].val := i * i;
43- if i < 4 then nodes[i].next := ADR(nodes[i + 1]); end;
44+ if i < 4 then nodes[i].next := SYSTEM.ADR(nodes[i + 1]); end;
4445 end;
45- Out.int(sum(ADR(nodes[0]))); Out.ln;
46+ Out.int(sum(SYSTEM.ADR(nodes[0]))); Out.ln;
4647 for i := 0 to 2 do
4748 for j := 0 to 3 do grid[i][j] := I32(i * 10 + j); end;
4849 end;
4950 Out.int(I64(grid[2][3])); Out.str(" "); Out.int(I64(grid[1][0])); Out.ln;
5051 for i := 0 to 7 do arr[i] := i * 100; end;
51- p := ADR(arr[0]);
52+ p := SYSTEM.ADR(arr[0]);
5253 q := p + 5;
5354 Out.int(q^); Out.str(" "); Out.int(q - p); Out.str(" "); Out.int(p[3]); Out.ln;
5455 s := arr[2..6];
@@ -65,8 +66,8 @@
6566 Out.int(gp.x); Out.str(" "); Out.int(gp.y); Out.ln;
6667 m.a := 1; m.b := -2; m.c := 65535;
6768 Out.int(m.b); Out.str(" "); Out.int(I64(m.c)); Out.ln;
68- bp := ^U8(ADR(m));
69- Out.int(INT(ADR(m.c)) - INT(bp)); Out.ln;
69+ bp := ^U8(SYSTEM.ADR(m));
70+ Out.int(INT(SYSTEM.ADR(m.c)) - INT(bp)); Out.ln;
7071 end;
7172
7273 end Data.

test/run/Deep.raz (history) modified +3 -2

@@ -1,5 +1,6 @@
11 module Deep;
22 import Out;
3+import SYSTEM;
34
45 (* Expressions deeper than the registers of the stack, with calls,
56 and, or, constants on the left and system calls among them. *)
@@ -48,10 +49,10 @@
4849 u := 250; u := u + U8(c * 5) + U8(d); Out.int(I64(u)); Out.ln;
4950 (* array elements and pointers among deep values *)
5051 for d := 0 to 7 do s[d] := d * d; end;
51- p := ADR(s[3]);
52+ p := SYSTEM.ADR(s[3]);
5253 Out.int(s[a] + (s[c] * (s[e] - (p^ + s[s[2]] * (s[7] - s[6]))))); Out.ln;
5354 (* a system call under values *)
54- Out.int(a + (c * n(SYSCALL(39) > 0) + d)); Out.ln;
55+ Out.int(a + (c * n(SYSTEM.SYSCALL(39) > 0) + d)); Out.ln;
5556 end;
5657
5758 end Deep.

test/run/Edge.raz (history) modified +3 -2

@@ -1,8 +1,9 @@
11 module Edge;
22 import Out;
3+import SYSTEM;
34
45 type
5- Inner = record vals: [4]I64; name: []U8; end;
6+ Inner = record vals: [4]I64; name: []const U8; end;
67 Outer = record items: [3]Inner; n: I64; end;
78
89 var g: Outer; calls: I64;
@@ -55,7 +56,7 @@
5556 o.items[0].vals[0] := -1;
5657 Out.int(g.items[0].vals[0]); Out.str(" "); Out.int(o.items[0].vals[0]); Out.ln;
5758 Out.int(sumInner(g.items)); Out.str(" "); Out.int(sumInner(g.items[1..3])); Out.ln;
58- pa := ADR(a);
59+ pa := SYSTEM.ADR(a);
5960 pa^[4] := 44;
6061 Out.int(a[4]); Out.str(" "); Out.int(LEN(pa^)); Out.ln;
6162 i := 2;

test/run/Extern.raz (history) modified +3 -2

@@ -2,6 +2,7 @@
22 C variables, raz procedures as C's callbacks. *)
33 module Extern;
44 import Out, C;
5+import SYSTEM;
56 link "libm.so.6";
67
78 extern proc strlen(s: ^U8): U64;
@@ -36,13 +37,13 @@
3637 Out.int(I64(sqrt(2.0) * 1000.0)); Out.ln;
3738
3839 a := [5, -3, 9, 0, 12, 1];
39- qsort(^U8(ADR(a)), 6, 8, cmp);
40+ qsort(^U8(SYSTEM.ADR(a)), 6, 8, cmp);
4041 for i := 0 to 5 do Out.int(a[i]); Out.char(' '); end;
4142 Out.ln;
4243 if calls > 0 then Out.str("cmp called\n"); end;
4344
4445 (* nine arguments after the format: some go on the stack *)
45- n := snprintf(ADR(buf[0]), 64, "%d %d %d %d %d %d %d %s|%.3f %g",
46+ n := snprintf(SYSTEM.ADR(buf[0]), 64, "%d %d %d %d %d %d %d %s|%.3f %g",
4647 1, 2, 3, 4, 5, 6, 7, "eight", 3.14159, 0.5);
4748 Out.str(buf[0..I64(n)]); Out.ln;
4849

test/run/HeapCheck.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 when a block is freed twice. *)
33 module HeapCheck;
44 import Out, Heap, Mem;
5+import SYSTEM;
56
67 proc show(p: ^U8);
78 begin

test/run/HeapDebugEnd.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 (* in debug mode, a write one byte past a block's end is found when the
33 block is freed, and stops the program *)
44 import Heap, Mem;
5+import SYSTEM;
56
67 proc main*;
78 var p: ^U8;

test/run/HeapDebugEnd.stderr (history) modified +1 -1

@@ -4,4 +4,4 @@
44 in Heap.freeDebug at lib/Heap.raz:221:31: h = 0x?, out = nil, p = nil, i = 0, size = 0, b = nil
55 in Heap.free at lib/Heap.raz:253:42: _a = 0x?, p = 0x?, h = 0x?, b = nil, c = 0
66 in Mem.free at lib/Mem.raz:40:5: a = 0x?, p = 0x?
7- in HeapDebugEnd.main at test/run/HeapDebugEnd.raz:12:5: p = 0x?
7+ in HeapDebugEnd.main at test/run/HeapDebugEnd.raz:13:5: p = 0x?

test/run/HeapDebugFree.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 (* in debug mode, a write to a freed block is found when the block
33 leaves the quarantine, 1,024 frees later, and stops the program *)
44 import Heap, Mem;
5+import SYSTEM;
56
67 proc main*;
78 var p, q: ^U8; i: INT;

test/run/HeapDebugFree.stderr (history) modified +1 -1

@@ -4,4 +4,4 @@
44 in Heap.freeDebug at lib/Heap.raz:235:36: h = 0x?, out = 0x?, p = 0x?, i = 0, size = 20, b = nil
55 in Heap.free at lib/Heap.raz:253:42: _a = 0x?, p = 0x?, h = 0x?, b = nil, c = 0
66 in Mem.free at lib/Mem.raz:40:5: a = 0x?, p = 0x?
7- in HeapDebugFree.main at test/run/HeapDebugFree.raz:15:9: p = 0x?, q = 0x?, i = 1023
7+ in HeapDebugFree.main at test/run/HeapDebugFree.raz:16:9: p = 0x?, q = 0x?, i = 1023

test/run/HeapStray.raz (history) modified +2 -1

@@ -1,13 +1,14 @@
11 (* Freeing what the heap never gave out stops the program. *)
22 module HeapStray;
33 import Out, Heap, Mem;
4+import SYSTEM;
45
56 var a: [4]I64;
67
78 proc main*;
89 begin
910 Out.str("freeing a stray pointer\n");
10- Mem.free(Heap.heap, ^U8(ADR(a[2])));
11+ Mem.free(Heap.heap, ^U8(SYSTEM.ADR(a[2])));
1112 Out.str("not reached\n");
1213 end;
1314

test/run/KeptNil.raz (history) modified +2 -1

@@ -2,6 +2,7 @@
22 procedure that keeps it. *)
33 module KeptNil;
44 import Out;
5+import SYSTEM;
56
67 type Rec = record x: INT; end;
78
@@ -16,7 +17,7 @@
1617 begin
1718 r.x := 1;
1819 f := get;
19- Out.int(f(ADR(r), 2)); Out.ln;
20+ Out.int(f(SYSTEM.ADR(r), 2)); Out.ln;
2021 Out.int(f(nil, 5)); Out.ln;
2122 end;
2223

test/run/KeptNil.stderr (history) modified +3 -3

@@ -1,3 +1,3 @@
1-test/run/KeptNil.raz:10:5: stopped by a nil pointer
2- in KeptNil.get at test/run/KeptNil.raz:10:5: p = nil, k = 5
3- in KeptNil.main at test/run/KeptNil.raz:20:5: f = 0x?
1+test/run/KeptNil.raz:11:5: stopped by a nil pointer
2+ in KeptNil.get at test/run/KeptNil.raz:11:5: p = nil, k = 5
3+ in KeptNil.main at test/run/KeptNil.raz:21:5: f = 0x?

test/run/MapDone.raz (history) modified +3 -2

@@ -2,6 +2,7 @@
22 counts its blocks; the map empty after, and used again. *)
33 module MapDone;
44 import Fmt, Heap, Mem, Str, Names := Map([]const U8, INT, Str.hash, Str.eq);
5+import SYSTEM;
56
67 var counting: Mem.Allocator; live: INT;
78
@@ -18,11 +19,11 @@
1819 end;
1920
2021 proc main*;
21-var m: Names.Map; i, v: INT; found, _ok: BOOL; keys: [3][]U8;
22+var m: Names.Map; i, v: INT; found, _ok: BOOL; keys: [3][]const U8;
2223 begin
2324 counting := {alloc: alloc, free: free};
2425 keys := ["node_modules", "target", "build"];
25- Names.init(m, ADR(counting));
26+ Names.init(m, SYSTEM.ADR(counting));
2627 Names.done(m); (* nothing taken yet *)
2728 for i := 0 to 99 do _ok := Names.put(m, keys[i mod 3], i); end;
2829 Fmt.print("{} entries, {} block\n", [Fmt.int(m.len), Fmt.int(live)]);

test/run/PtrPlaces.raz (history) modified +4 -3

@@ -4,6 +4,7 @@
44 registers in a loop gives its pointer's register. *)
55 module PtrPlaces;
66 import Out;
7+import SYSTEM;
78
89 proc main*;
910 var a: [4]U8; s, e: []U8; p: ^U8; i, n: INT;
@@ -11,11 +12,11 @@
1112 a := [1, 2, 3, 4];
1213 s := a[0..4];
1314 e := s[2..2];
14- if PTR(e) = PTR(s) + 2 then Out.str("cut empty: at its place\n"); end;
15- p := PTR("");
15+ if SYSTEM.PTR(e) = SYSTEM.PTR(s) + 2 then Out.str("cut empty: at its place\n"); end;
16+ p := SYSTEM.PTR("");
1617 if p # nil then Out.str("\"\": not nil\n"); end;
1718 n := 0;
18- for i := 0 to 3 do s := a[i..4]; n := n + INT(PTR(s) - PTR(a)); end;
19+ for i := 0 to 3 do s := a[i..4]; n := n + INT(SYSTEM.PTR(s) - SYSTEM.PTR(a)); end;
1920 Out.int(n); Out.str("\n");
2021 end;
2122

test/run/Results.raz (history) modified +3 -2

@@ -1,5 +1,6 @@
11 module Results;
22 import Out;
3+import SYSTEM;
34
45 const
56 NotFound*: ERROR = "not found";
@@ -24,7 +25,7 @@
2425 return -1, NotFound;
2526 end;
2627
27-proc mixed(x: F64): (F64, []U8, Pair, BOOL);
28+proc mixed(x: F64): (F64, []const U8, Pair, BOOL);
2829 var p: Pair;
2930 begin
3031 p.a := 1; p.b := 2;
@@ -48,7 +49,7 @@
4849 end;
4950
5051 proc main*;
51-var q, r, i: I64; e: ERROR; x: F64; s: []U8; p: Pair; ok: BOOL; a: [3]I64; u: U8;
52+var q, r, i: I64; e: ERROR; x: F64; s: []const U8; p: Pair; ok: BOOL; a: [3]I64; u: U8;
5253 begin
5354 q, r := divmod(17, 5);
5455 Out.int(q); Out.str(" "); Out.int(r); Out.ln;

test/run/Shapes.raz (history) modified +1 -1

@@ -5,7 +5,7 @@
55 Shape* = variant
66 circle(r: F64);
77 rect(w, h: F64);
8- label(text: []U8; size: I64);
8+ label(text: []const U8; size: I64);
99 dot;
1010 end;
1111

test/run/Simd.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 (* Code procedures with SSE2 and the bit scans: a search sixteen bytes
33 at a time, and the counts of bits *)
44 import Out;
5+import SYSTEM;
56
67 (* the first place of b in s, or -1: its address in rdi, its length in rsi, b in dl *)
78 proc index(s: []U8; b: U8): INT;

test/run/Single.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 that take either type, calls to C and to code. *)
33 module Single;
44 import Out, C;
5+import SYSTEM;
56 link "libm.so.6";
67
78 const

test/run/Spawn.raz (history) modified +2 -1

@@ -2,6 +2,7 @@
22 every thread at once, and join. *)
33 module Spawn;
44 import Out, Thread, Heap, Mem;
5+import SYSTEM;
56
67 const
78 Workers = 8;
@@ -21,7 +22,7 @@
2122 Thread.lock(m);
2223 INC(count);
2324 Thread.unlock(m);
24- _ := XADD(ADR(atomic), 1);
25+ _ := XADD(atomic, 1);
2526 NEW(p, Heap.heap);
2627 p^.next := list;
2728 list := p;

test/run/SpawnC.raz (history) modified +2 -1

@@ -3,6 +3,7 @@
33 every thread at once, and join. *)
44 module SpawnC;
55 import Out, Thread, Heap, Mem, C;
6+import SYSTEM;
67
78 const
89 Workers = 8;
@@ -22,7 +23,7 @@
2223 Thread.lock(m);
2324 INC(count);
2425 Thread.unlock(m);
25- _ := XADD(ADR(atomic), 1);
26+ _ := XADD(atomic, 1);
2627 NEW(p, Heap.heap);
2728 p^.next := list;
2829 list := p;

test/run/TaskTest.raz (history) modified +3 -2

@@ -2,6 +2,7 @@
22 its job at once after spawn, and the threads' copies are not changed. *)
33 module TaskTest;
44 import Check, Jobs := Task(Job), Rt, Thread;
5+import SYSTEM;
56
67 const Threads = 8;
78
@@ -21,11 +22,11 @@
2122 var t: [Threads]^Thread.Thread; j: Job; i: INT; err: ERROR;
2223 begin
2324 for i := 0 to Threads - 1 do
24- j := {n: i + 1, out: ADR(results[i])};
25+ j := {n: i + 1, out: SYSTEM.ADR(results[i])};
2526 t[i], err := Jobs.spawn(work, j);
2627 if err # nil then Rt.stop("Task.spawn failed"); end;
2728 j.n := 1000; (* the thread must not see this *)
28- j.out := ADR(results[0]);
29+ j.out := SYSTEM.ADR(results[0]);
2930 end;
3031 for i := 0 to Threads - 1 do Thread.join(t[i]); end;
3132 for i := 0 to Threads - 1 do

test/run/ThreadSignal.raz (history) modified +3 -2

@@ -3,6 +3,7 @@
33 handled: the read fails with -4. A thread that has ended, not yet
44 joined, is -3. ThreadSignalC is the same, over C. *)
55 import Thread, Sys, Fmt;
6+import SYSTEM;
67
78 var
89 r, got, done: INT;
@@ -11,7 +12,7 @@
1112 var buf: [16]U8;
1213 begin
1314 got := Sys.read(r, buf);
14- _ := XCHG(ADR(done), 1);
15+ _ := XCHG(done, 1);
1516 end;
1617
1718 proc quick(_arg: ^U8);
@@ -26,7 +27,7 @@
2627 t, e := Thread.spawn(reader, nil);
2728 if e # nil then Fmt.print("no thread\n", []); return; end;
2829 (* again until it lands: the first may come before the read begins *)
29- while (XADD(ADR(done), 0) = 0) and (tries < 1000) do
30+ while (XADD(done, 0) = 0) and (tries < 1000) do
3031 k := Thread.signal(t, Sys.sigUsr1);
3132 if k # 0 then Fmt.print("signal: {}\n", [Fmt.int(k)]); end;
3233 Sys.sleep(5);

test/run/ThreadSignalC.raz (history) modified +3 -2

@@ -3,6 +3,7 @@
33 handled: the read fails with -4. A thread that has ended, not yet
44 joined, is -3. ThreadSignal is the same, without C. *)
55 import Thread, Sys, Fmt, C;
6+import SYSTEM;
67
78 var
89 r, got, done: INT;
@@ -11,7 +12,7 @@
1112 var buf: [16]U8;
1213 begin
1314 got := Sys.read(r, buf);
14- _ := XCHG(ADR(done), 1);
15+ _ := XCHG(done, 1);
1516 end;
1617
1718 proc quick(_arg: ^U8);
@@ -27,7 +28,7 @@
2728 t, e := Thread.spawn(reader, nil);
2829 if e # nil then Fmt.print("no thread\n", []); return; end;
2930 (* again until it lands: the first may come before the read begins *)
30- while (XADD(ADR(done), 0) = 0) and (tries < 1000) do
31+ while (XADD(done, 0) = 0) and (tries < 1000) do
3132 k := Thread.signal(t, Sys.sigUsr1);
3233 if k # 0 then Fmt.print("signal: {}\n", [Fmt.int(k)]); end;
3334 Sys.sleep(5);

test/run/VecFull.raz (history) modified +2 -1

@@ -2,12 +2,13 @@
22 (* a Vec whose allocator runs out stops the program, with the calls
33 under way, rather than dropping what it was given *)
44 import Arena, Rt, Ints := Vec(INT);
5+import SYSTEM;
56
67 proc main*;
78 var ar: Arena.Arena; v: Ints.Vec; i: INT;
89 begin
910 if not Arena.init(ar, 4096) then Rt.stop("no arena"); end;
10- Ints.init(v, ADR(ar.base));
11+ Ints.init(v, SYSTEM.ADR(ar.base));
1112 for i := 1 to 10000 do Ints.push(v, i); end;
1213 end;
1314

test/run/VecFull.stderr (history) modified +1 -1

@@ -1,4 +1,4 @@
11 Vec: out of memory
22 in Vec(INT).need at lib/Vec.raz:57:9: n = 1
33 in Vec(INT).push at lib/Vec.raz:65:5: x = 257
4- in VecFull.main at test/run/VecFull.raz:11:28: i = 257
4+ in VecFull.main at test/run/VecFull.raz:12:28: i = 257

test/run/VecTest.raz (history) modified +1 -1

@@ -3,7 +3,7 @@
33 module VecTest;
44 import Fmt, Heap, Ints := Vec(INT), Pts := Vec(Point);
55
6-type Point = record x, y: INT; name: []U8; end;
6+type Point = record x, y: INT; name: []const U8; end;
77
88 proc main*;
99 var v: Ints.Vec; w: Pts.Vec; i, sum, top: INT; ok: BOOL; p: ^Point; s: []INT;

test/run/VecTry.raz (history) modified +2 -1

@@ -2,12 +2,13 @@
22 array as it was, and the program going on. *)
33 module VecTry;
44 import Arena, Fmt, Rt, Ints := Vec(INT);
5+import SYSTEM;
56
67 proc main*;
78 var ar: Arena.Arena; v: Ints.Vec; n: INT; p: ^INT; ok: BOOL;
89 begin
910 if not Arena.init(ar, 4096) then Rt.stop("no arena"); end;
10- Ints.init(v, ADR(ar.base));
11+ Ints.init(v, SYSTEM.ADR(ar.base));
1112 n := 0;
1213 while Ints.tryPush(v, n) do INC(n); end;
1314 p, ok := Ints.tryAdd(v);

test/run/mods/IndexParamOff.raz (history) modified +1 -0

@@ -2,6 +2,7 @@
22 parameter of 1, 2, 4 or 8 bytes is read and written as the operand
33 [pointer + index * size], where the index comes with no check. *)
44 module IndexParamOff;
5+import SYSTEM;
56 check off;
67
78 const N = 8;

test/run/mods/Unchecked.raz (history) modified +2 -1

@@ -1,4 +1,5 @@
11 module Unchecked;
2+import SYSTEM;
23 (* A module without index and slice checks *)
34 check off;
45
@@ -9,7 +10,7 @@
910 return p^.a[i];
1011 end;
1112
12-proc width*(s: []U8; lo, hi: INT): INT;
13+proc width*(s: []const U8; lo, hi: INT): INT;
1314 begin
1415 return LEN(s[lo..hi]);
1516 end;