diff options
| author | Mustafa Quraish <[email protected]> | 2022-02-04 07:38:53 -0500 |
|---|---|---|
| committer | Mustafa Quraish <[email protected]> | 2022-02-05 08:56:15 -0500 |
| commit | 6a376cfd6f89a6ceb39a8c425cf8095647170c7e (patch) | |
| tree | 0f5b6e0dee971222824c71e8ec207bbdbd1eb3ec /std/common.cup | |
| parent | Allow `builtins.c` to inject constants into program, use for syscalls (diff) | |
| download | cup-6a376cfd6f89a6ceb39a8c425cf8095647170c7e.tar.xz cup-6a376cfd6f89a6ceb39a8c425cf8095647170c7e.zip | |
Add `void` type and allow void* to be assigned to other ptr types
Diffstat (limited to 'std/common.cup')
| -rw-r--r-- | std/common.cup | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/std/common.cup b/std/common.cup index 24e24b7..68cf3a6 100644 --- a/std/common.cup +++ b/std/common.cup @@ -1,10 +1,14 @@ + const true = 1; const false = 0; +// This should really be a constant, but we only allow integers... +let null: void*; // Zero initialized by default. + /////////////////////////////////////////////////////////////////////////////// // Syscalls -fn write(fd: int, s: char*, n: int): int { +fn write(fd: int, s: void*, n: int): int { return syscall3(SYS_write, fd, s, n); } @@ -12,7 +16,7 @@ fn exit(status: int): int { return syscall1(SYS_exit, status); } -fn read(fd: int, s: char*, n: int): int { +fn read(fd: int, s: void*, n: int): int { return syscall3(SYS_read, fd, s, n); } |