forked from AbleOS/ableos
35 lines
983 B
Plaintext
35 lines
983 B
Plaintext
string := @use("string.hb")
|
|
|
|
$recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
|
|
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
|
|
}
|
|
|
|
$write := fn($Expr: type, buffer_id: uint, msg: ^Expr): void {
|
|
return @eca(3, buffer_id, msg, @sizeof(Expr))
|
|
}
|
|
|
|
$recv_length := fn(length: uint, memory_map_location: ^u8, buffer_id: uint): void {
|
|
return @eca(4, buffer_id, memory_map_location, length)
|
|
}
|
|
|
|
$write_length := fn(length: uint, msg: ^u8, buffer_id: uint): void {
|
|
return @eca(3, buffer_id, msg, length)
|
|
}
|
|
|
|
BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint}
|
|
|
|
create := fn(msg: ^u8): uint {
|
|
return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
|
|
}
|
|
|
|
$create_nameless := fn(): uint {
|
|
return @eca(1, 0)
|
|
}
|
|
|
|
$delete_buffer := fn(buffer_id: uint): void {
|
|
return @eca(2, buffer_id)
|
|
}
|
|
|
|
search := fn(msg: ^u8): uint {
|
|
return @eca(3, 0, BufferMsg.(3, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
|
|
} |