diff options
Diffstat (limited to 'stdlib/channels.h')
| -rw-r--r-- | stdlib/channels.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/stdlib/channels.h b/stdlib/channels.h index c960452a..9a848107 100644 --- a/stdlib/channels.h +++ b/stdlib/channels.h @@ -20,9 +20,22 @@ void Channel$peek(Channel_t *channel, void *out, bool front, int64_t item_size); #define Channel$peek_value(channel, front, t) ({ t _val; Channel$peek(channel, &_val, front, sizeof(t)); _val; }) void Channel$clear(Channel_t *channel); Array_t Channel$view(Channel_t *channel); -PUREFUNC uint64_t Channel$hash(Channel_t **channel, const TypeInfo_t *type); -PUREFUNC int32_t Channel$compare(Channel_t **x, Channel_t **y, const TypeInfo_t *type); -PUREFUNC bool Channel$equal(Channel_t **x, Channel_t **y, const TypeInfo_t *type); -Text_t Channel$as_text(Channel_t **channel, bool colorize, const TypeInfo_t *type); +PUREFUNC uint64_t Channel$hash(const void *channel, const TypeInfo_t *type); +PUREFUNC int32_t Channel$compare(const void *x, const void *y, const TypeInfo_t *type); +PUREFUNC bool Channel$equal(const void *x, const void *y, const TypeInfo_t *type); +Text_t Channel$as_text(const void *channel, bool colorize, const TypeInfo_t *type); +PUREFUNC bool Channel$is_none(const void *obj, const TypeInfo_t*); + +#define Channel$metamethods ((metamethods_t){ \ + .as_text=Channel$as_text, \ + .compare=Channel$compare, \ + .equal=Channel$equal, \ + .hash=Channel$hash, \ + .is_none=Channel$is_none, \ +}) + +#define Channel$info(item_info) &((TypeInfo_t){.size=sizeof(Channel_t), .align=__alignof__(Channel_t), \ + .tag=ChannelInfo, .ChannelInfo.item=item_info, \ + .metamethods=Channel$metamethods}) // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 |
