diff --git a/src/main.ha b/src/main.ha index 48ce353..cf97281 100644 --- a/src/main.ha +++ b/src/main.ha @@ -60,8 +60,6 @@ export fn main() void = { }; let path = os::args[1]; - // let console: bufio::scanner = bufio::newscanner(os::stdin); - // defer bufio::finish(&console); //Setting up pollfds for uni::poll const consolefd: []unix::poll::pollfd = [unix::poll::pollfd { fd = os::stdin_file, @@ -110,60 +108,23 @@ export fn main() void = { }; i+=1; //TODO using i here seems inelegant }; - // for( state.dev[0x0f] == 0; i+=1 ){ - const pollr = unix::poll::poll(consolefd, unix::poll::NONBLOCK); - if(pollr > 0){ - // fmt::println("Input!")!; - let buf: [MAX_CONSOLE_INPUT]u8 = [0...]; - io::read(os::stdin_file, buf)!; - for( let b .. buf ){ - // fmt::printfln("Input: {}",buf[0])!; - match (uxn::console_input(b,1,state)) { - case done => - yield done; - case let val: u8 => - fmt::fatalf("Unhandled Opcode: {:x}", val); - }; - // uxn::console_input(b,1,state); - }; - // match(bufio::read_byte(os::stdin)){ - // case let b: u8 => - // match (uxn::console_input(b,1,state)) { - // case done => - // yield done; - // case let val: u8 => - // fmt::fatalf("Unhandled Opcode: {:x}", val); - // }; - // case io::EOF => - // yield; - // case let err: io::error => - // fmt::fatalf("IO Error: {}", io::strerror(err)); - - // }; + const pollr = unix::poll::poll(consolefd, unix::poll::NONBLOCK); + if(pollr > 0){ + // fmt::println("Input!")!; + let buf: [MAX_CONSOLE_INPUT]u8 = [0...]; + io::read(os::stdin_file, buf)!; + for( let b .. buf ){ + // fmt::printfln("Input: {}",buf[0])!; + match (uxn::console_input(b,1,state)) { + case done => + yield done; + case let val: u8 => + fmt::fatalf("Unhandled Opcode: {:x}", val); + }; + // uxn::console_input(b,1,state); }; + }; - // let buf: [1]u8 = [0]; - // fmt::println("About to read input")!; - // let count = io::read(os::stdin, buf)!; - // fmt::println("Read input")!; - // if(count != 0) { - // match (uxn::console_input(buf[0],1,state)) { - // case done => - // yield done; - // case let val: u8 => - // fmt::fatalf("Unhandled Opcode: {:x}", val); - // }; - // // fmt::println("Retuned from console_input")!; - // }; - // }; - // fmt::println("Extra input thing?!")!; - // match (uxn::console_input('\n',4,state)) { //TODO should this run? - // case done => - // yield done; - // case let val: u8 => - // fmt::fatalf("Unhandled Opcode: {:x}", val); - // }; - // fmt::println("Finished Console!")!; }; };