# bend-raw-cells: raw little-endian 32-bit cells between files and Bend arrays (Array), in place, as foreign effects. # Native builds only (C); the JS stubs throw. Nothing here is proved. # # import bend-raw-cells@/raw.bend as R import Base # Raw.read fills the first `cells` # cells from the file (which must hold exactly cells * 4 bytes), Raw.write writes them. Foreign code. def Raw.read(path: String, a: Array, cells: U32) -> IO(Array): import "./effs/raw_read.c" import "./effs/raw_read.js" def Raw.write(path: String, a: Array, cells: U32) -> IO(Array): import "./effs/raw_write.c" import "./effs/raw_write.js" # Raw.read_at: `cells` cells from byte offset off_hi * 2^32 + off_lo of the file into the array from cell dst on. def Raw.read_at(path: String, off_hi: U32, off_lo: U32, a: Array, dst: U32, cells: U32) -> IO(Array): import "./effs/raw_read_at.c" import "./effs/raw_read_at.js"