| 1 | (* import SYSTEM (report section 3): SYSTEM.ADR, SYSTEM.PTR, |
| 2 | SYSTEM.SYSCALL and SYSTEM.ARGV are the built-ins of section 6.8, |
| 3 | written by that name, and a local given to SYSTEM.ADR is that |
| 4 | variable, however busy. *) |
| 5 | module SystemImport; |
| 6 | import Out, SYSTEM; |
| 7 | |
| 8 | proc main*; |
| 9 | var k, i: INT; p: ^INT; a: [4]U8; s: []U8; q: ^U8; |
| 10 | begin |
| 11 | for i := 1 to 10 do INC(k); end; |
| 12 | p := SYSTEM.ADR(k); |
| 13 | p^ := p^ + 100; |
| 14 | for i := 1 to 10 do INC(k); end; |
| 15 | Out.int(k); |
| 16 | a := "abcd"; |
| 17 | s := a; |
| 18 | q := SYSTEM.PTR(s); |
| 19 | Out.char(q^); |
| 20 | if SYSTEM.ARGV() # nil then Out.char('v'); end; |
| 21 | if SYSTEM.SYSCALL(39) > 0 then Out.char('p'); end; (* getpid *) |
| 22 | Out.char(10); |
| 23 | end; |
| 24 | |
| 25 | end SystemImport. |