diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/main.ha | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server/main.ha b/server/main.ha new file mode 100644 index 0000000..43bdf34 --- /dev/null +++ b/server/main.ha @@ -0,0 +1,43 @@ +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); + +}; |