You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
857 B

#![allow(dead_code)]
use std::convert::TryFrom;
#[macro_export] macro_rules! unwrap {
(return $($code:expr)?; $err:expr) => {
{
match $err {
Ok(v) => v,
Err(e) => {
eprintln!("Error: {}", e);
#[allow(unused_variables)]
let rc = -1;
$(let rc = $code;)?
std::process::exit(rc)
},
}
}
};
}
mod state;
mod pool;
mod map;
mod job;
mod work;
mod arg;
mod open;
mod consts;
#[cfg(feature="threads")] mod par;
#[cfg(not(feature="threads"))] mod ser;
#[inline] fn work(op: arg::Operation) -> Result<(), Box<dyn std::error::Error>>
{
#[cfg(feature="threads")] return par::work(op);
#[cfg(not(feature="threads"))] return ser::work(op);
}
fn main() {
match arg::parse_args() {
Ok(op) => unwrap!(return 1; work(op)),
Err(arg::ArgParseError::NoOutput) => arg::usage(),
}
}