From 9abc4399f5ae5318ed40a7ed764044ebb87fc8c4 Mon Sep 17 00:00:00 2001 From: Misha Vicha Date: Tue, 30 Sep 2025 16:53:19 +0200 Subject: [PATCH] Adds parsing of the remaining Record arguments --- src/headproc.rs | 54 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/src/headproc.rs b/src/headproc.rs index eb271c2..3e4b23e 100644 --- a/src/headproc.rs +++ b/src/headproc.rs @@ -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 { 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 = None; - let base_counter_val: Option = None; - let sample_num: Option = None; - let basetime: Option = None; - let basedate: Option = None; + let mut base_counter_val: Option = None; + let mut sample_num: Option = None; + let mut basetime: Option = None; + let mut basedate: Option = 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::() { + Ok(value) => { + base_counter_val = Some(value); + } + Err(_) => {} + } + + if args.len() <= 4 {break;} + + match args[4].parse::() { + 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 = None; let desc: Option = None; - + // TODO: implement samples per frame, skew, and offset match args[1].parse::() { 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,