ICFP 2007 Contest: https://web.archive.org/web/20090301164728/https://save-endo.cs.uu.nl/
1mod bitmap;
2mod rna_processor;
3
4use crate::rna_processor::RnaProcessor;
5use std::env;
6use std::fs;
7
8fn main() {
9 let args: Vec<String> = env::args().collect();
10 if args.len() < 3 {
11 println!("Usage: {} <rna file> <bmp file>", args[0]);
12 return;
13 }
14
15 let contents = fs::read_to_string(&args[1]);
16 if let Ok(rna) = contents {
17 let mut processor = RnaProcessor::new();
18 processor.process_rna(rna.lines().collect());
19 if let Some(bmp) = processor.bitmap() {
20 if fs::write(&args[2], bmp.to_data()).is_err() {
21 println!("Could not write to {}", args[2]);
22 }
23 } else {
24 println!("No bitmap after RNA processing");
25 }
26 } else {
27 println!("Could not open {}", args[1]);
28 return;
29 }
30}