use fmt; use os; use io; use fs; use errors; use drawing::{pos}; // type chunk = struct { // fd: io::file, // d: []u32, // }; // def CHUNKSIZE: size = 512; // def CHUNK_LENGTH: size = CHUNKSIZE*CHUNKSIZE*size(u32); // fn open_chunk_file(chunkpos: pos) (chunk | fs::error) = { // const path = fmt::asprintf("c.{}.{}.dat", chunkpos.0, chunkpos.1); // defer free(path); // const fd = fs::create_file(os::cwd, path, // fs::mode::USER_RW | fs::mode::GROUP_RW, // fs::flag::RDWR)?; // io::trunc(fd, CHUNK_LENGTH)?; // const dp = io::mmap(null, CHUNK_LENGTH, // io::prot::READ | io::prot::WRITE, // io::mflag::SHARED, // fd, 0)?; // const d = (dp: *[*]u32)[..CHUNKSIZE*CHUNKSIZE]; // return chunk { fd = fd, d = d }; // }; export fn main() void = { // match (open_chunk_file((-3,12))) { // case let e: fs::error => // fmt::fatal(fs::strerror(e)); // case let ch: chunk => // ch.d[0] = 0x12345678; // ch.d[CHUNKSIZE*CHUNKSIZE - 1]=0xdeadbeef; // }; const t = test2 { a=4, b=5 }; thethe(&t); };