Phase 4: Ereignisschleife und klassische Traps

This commit is contained in:
2026-09-04 15:56:47 +02:00
parent 060674b466
commit 5cf5a6582c
40 changed files with 4024 additions and 176 deletions

View File

@@ -153,11 +153,16 @@ fn cmd_run(args: &[String]) -> ExitCode {
struct PipeHost {
puffer: std::collections::VecDeque<Ereignis>,
eof: bool,
start: std::time::Instant,
}
impl PipeHost {
fn new() -> Self {
PipeHost { puffer: std::collections::VecDeque::new(), eof: false }
PipeHost {
puffer: std::collections::VecDeque::new(),
eof: false,
start: std::time::Instant::now(),
}
}
/// Eine Zeile von stdin in Tastendrücke zerlegen.
@@ -177,10 +182,12 @@ impl PipeHost {
zeile.pop();
}
for c in zeile.chars() {
self.puffer.push_back(Ereignis::Taste(c.to_string()));
self.puffer.push_back(Ereignis::Taste(c.to_string(), 0));
}
self.puffer
.push_back(Ereignis::Taste(tb_runtime::host::taste::ENTER.to_string()));
self.puffer.push_back(Ereignis::Taste(
tb_runtime::host::taste::ENTER.to_string(),
0,
));
}
}
}
@@ -195,4 +202,8 @@ impl Host for PipeHost {
}
self.puffer.pop_front()
}
fn jetzt_ms(&mut self) -> u64 {
self.start.elapsed().as_millis() as u64
}
}