ableos/sysdata/libraries/stn/src/buffer.hb

41 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-09-18 03:38:49 -05:00
string := @use("string.hb")
2024-07-07 08:35:07 -05:00
$await := fn(buffer_id: uint): void {
return @eca(7, buffer_id)
}
$recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
2024-10-23 15:22:28 -05:00
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
2024-07-07 08:35:07 -05:00
}
$write := fn($Expr: type, buffer_id: uint, msg: ^Expr): void {
2024-10-23 15:22:28 -05:00
return @eca(3, buffer_id, msg, @sizeof(Expr))
2024-07-07 08:35:07 -05:00
}
$recv_length := fn(length: uint, memory_map_location: ^u8, buffer_id: uint): void {
2024-10-25 10:37:38 -05:00
return @eca(4, buffer_id, memory_map_location, length)
}
$write_length := fn(length: uint, msg: ^u8, buffer_id: uint): void {
2024-10-25 10:37:38 -05:00
return @eca(3, buffer_id, msg, length)
}
2024-10-20 06:36:34 -05:00
BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint}
2024-11-10 12:57:48 -06:00
create := fn(msg: ^u8): uint {
2024-12-16 07:22:03 -06:00
// for some reason not inlining here breaks things
2024-10-20 06:36:34 -05:00
return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
}
2024-11-13 11:03:31 -06:00
$create_nameless := fn(): uint {
return @eca(1, 0)
}
$delete_buffer := fn(buffer_id: uint): void {
return @eca(2, buffer_id)
}
2024-11-10 12:57:48 -06:00
search := fn(msg: ^u8): uint {
2024-12-16 07:22:03 -06:00
// for some reason not inlining here breaks things
2024-10-20 06:36:34 -05:00
return @eca(3, 0, BufferMsg.(3, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
2024-07-20 12:54:58 -05:00
}