aboutsummaryrefslogtreecommitdiff
path: root/src/types.c
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-03 03:42:41 -0500
committerMustafa Quraish <[email protected]>2022-02-03 03:42:41 -0500
commit3a7588e5c5b7718012917b608e2346dc066cecc2 (patch)
treeaa88655cf4210d5256377ab44ec1915a0bcebcfc /src/types.c
parentMove builtins to a separate file (diff)
downloadcup-3a7588e5c5b7718012917b608e2346dc066cecc2.tar.xz
cup-3a7588e5c5b7718012917b608e2346dc066cecc2.zip
Remove `putc` intrinsic and replace with `write(fd, buf, size)`
`putc`, `puts`, and `putnum` in `std/common.cup` are now implemented in terms of the `write()` syscall.
Diffstat (limited to 'src/types.c')
-rw-r--r--src/types.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/types.c b/src/types.c
index 31edc4b..b2709f8 100644
--- a/src/types.c
+++ b/src/types.c
@@ -59,6 +59,14 @@ Type *type_new(DataType type)
return self;
}
+Type *type_new_ptr(DataType type)
+{
+ Type *self = type_new(TYPE_PTR);
+ self->ptr = type_new(type);
+ return self;
+}
+
+
bool is_string_type(Type *type)
{
return type