1
0
Fork 0
forked from AbleOS/ableos
ableos/sysdata/libraries/stn/src/buffer.hb
2024-10-25 16:37:38 +01:00

27 lines
839 B
Plaintext

string := @use("string.hb")
recv := fn($Expr: type, buffer_id: int, memory_map_location: ^u8): ^Expr {
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
}
write := fn($Expr: type, msg: ^Expr, buffer_id: int): void {
return @eca(3, buffer_id, msg, @sizeof(Expr))
}
recv_length := fn(buffer_id: int, memory_map_location: ^u8, length: int): void {
return @eca(4, buffer_id, memory_map_location, length)
}
write_length := fn(msg: ^u8, buffer_id: int, length: int): void {
return @eca(3, buffer_id, msg, length)
}
BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint}
create := fn(msg: ^u8): int {
return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
}
search := fn(msg: ^u8): int {
return @eca(3, 0, BufferMsg.(3, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
}