Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std::{
io::{self, Stdout},
process::ExitCode,
};
use lemu::{Executor, Output};
use yumy::Config;
fn main() -> ExitCode {
let mut args = std::env::args();
args.next().unwrap(); // path to executable
for file in args {
let f = std::fs::read_to_string(&file).unwrap();
let mut lex: Executor<Stdout> =
match Executor::with_output(io::stdout()).display().program(&f) {
Ok(x) => x,
Err(e) => {
e.diagnose(&f, Some(&file))
.eprint(&Config::default())
.unwrap();
return ExitCode::FAILURE;
}
};
lex.run();
let Output { displays, .. } = lex.output();
for (d, i) in displays.iter().zip(1..=displays.len()) {
d.save(format!("image{i}.png"));
}
}
ExitCode::SUCCESS
}
|