Adds parsing of the remaining Record arguments
This commit is contained in:
@@ -19,7 +19,7 @@ struct Record {
|
||||
}
|
||||
|
||||
impl Record {
|
||||
/// Attempts to generate the record information from a string
|
||||
/// Attempts to generate the record information from a string of the argument line
|
||||
pub fn from_str(argument_line: &str) -> Result<Record, &str> {
|
||||
let args: Vec<&str> = argument_line.split(' ').collect();
|
||||
if args.len() < 2 {
|
||||
@@ -31,10 +31,10 @@ impl Record {
|
||||
let sampling_freq: u64;
|
||||
// Everything else is initialized with None, this is for sake of me not getting a stroke
|
||||
let mut counter_freq: Option<u64> = None;
|
||||
let base_counter_val: Option<u64> = None;
|
||||
let sample_num: Option<u64> = None;
|
||||
let basetime: Option<String> = None;
|
||||
let basedate: Option<String> = None;
|
||||
let mut base_counter_val: Option<u64> = None;
|
||||
let mut sample_num: Option<u64> = None;
|
||||
let mut basetime: Option<String> = None;
|
||||
let mut basedate: Option<String> = None;
|
||||
|
||||
|
||||
// Signals and segments are kept in a single argument organized as signal/segment
|
||||
@@ -92,7 +92,31 @@ impl Record {
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: Other arguments in the standard
|
||||
if args.len() <= 3 {break;}
|
||||
|
||||
match args[3].parse::<u64>() {
|
||||
Ok(value) => {
|
||||
base_counter_val = Some(value);
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
|
||||
if args.len() <= 4 {break;}
|
||||
|
||||
match args[4].parse::<u64>() {
|
||||
Ok(value) => {
|
||||
sample_num = Some(value);
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
|
||||
if args.len() <= 5 {break;}
|
||||
|
||||
basetime = Some(args[5].to_string());
|
||||
|
||||
if args.len() <= 6 {break;}
|
||||
|
||||
basedate = Some(args[6].to_string());
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -156,7 +180,7 @@ impl SignalSpec {
|
||||
let blocksize: Option<u64> = None;
|
||||
let desc: Option<String> = None;
|
||||
|
||||
|
||||
// TODO: implement samples per frame, skew, and offset
|
||||
match args[1].parse::<u64>() {
|
||||
Ok(value) => {
|
||||
sigformat = SignalSpec::parse_format(value);
|
||||
@@ -166,6 +190,22 @@ impl SignalSpec {
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
if args.len() <= 2 {
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
let bracket_split: Vec<&str> = args[2].split("(").collect();
|
||||
}
|
||||
|
||||
|
||||
if args.len() <= 3 {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Ok(
|
||||
SignalSpec { filename: name,
|
||||
|
||||
Reference in New Issue
Block a user