diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-11 14:47:34 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-11 14:47:34 -0400 |
| commit | 2ecb5fe885042ca6c25ee0a3e3da070ddec9e07e (patch) | |
| tree | cdd7c7d1d51982d4074f76a1bccc522fbc8b5eee /builtins/types.h | |
| parent | 3bf8ea8e12a2728bf63968ca7b42359b089e318b (diff) | |
Add channels and threads
Diffstat (limited to 'builtins/types.h')
| -rw-r--r-- | builtins/types.h | 6 |
1 files changed, 4 insertions, 2 deletions
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*), \ |
