From 1762e9f622c7a9045e6ea23a92a81d7dfa5dadda Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 28 Mar 2024 18:50:23 +0000 Subject: reörganize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.ha | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 server/main.ha (limited to 'server') 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); + +}; -- cgit v1.2.3