From 2ecb5fe885042ca6c25ee0a3e3da070ddec9e07e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Aug 2024 14:47:34 -0400 Subject: Add channels and threads --- builtins/types.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'builtins/types.h') diff --git a/builtins/types.h b/builtins/types.h index 4184e8fa..70f8dc00 100644 --- a/builtins/types.h +++ b/builtins/types.h @@ -18,7 +18,7 @@ typedef CORD (*str_fn_t)(const void*, bool, const struct TypeInfo*); typedef struct TypeInfo { int64_t size, align; struct { // Anonymous tagged union for convenience - enum { CustomInfo, PointerInfo, TextInfo, ArrayInfo, TableInfo, FunctionInfo, TypeInfoInfo, OpaqueInfo, EmptyStruct } tag; + enum { CustomInfo, PointerInfo, TextInfo, ArrayInfo, ChannelInfo, TableInfo, FunctionInfo, TypeInfoInfo, OpaqueInfo, EmptyStruct } tag; union { struct { equal_fn_t equal; @@ -36,7 +36,7 @@ typedef struct TypeInfo { } TextInfo; struct { const struct TypeInfo *item; - } ArrayInfo; + } ArrayInfo, ChannelInfo; struct { const struct TypeInfo *key, *value; } TableInfo; @@ -60,6 +60,8 @@ typedef struct TypeInfo { .tag=ArrayInfo, .ArrayInfo.item=item_info}) #define $SetInfo(item_info) &((TypeInfo){.size=sizeof(table_t), .align=__alignof__(table_t), \ .tag=TableInfo, .TableInfo.key=item_info, .TableInfo.value=&$Void}) +#define $ChannelInfo(item_info) &((TypeInfo){.size=sizeof(channel_t), .align=__alignof__(channel_t), \ + .tag=ChannelInfo, .ChannelInfo.item=item_info}) #define $TableInfo(key_expr, value_expr) &((TypeInfo){.size=sizeof(table_t), .align=__alignof__(table_t), \ .tag=TableInfo, .TableInfo.key=key_expr, .TableInfo.value=value_expr}) #define $FunctionInfo(typestr) &((TypeInfo){.size=sizeof(void*), .align=__alignof__(void*), \ -- cgit v1.2.3