sane import and export behaviors

This commit is contained in:
Yehowshua Immanuel 2022-10-26 01:16:39 -04:00
parent d343b6f5ff
commit 9f18b166a5
12 changed files with 62 additions and 62 deletions

View file

@ -2,38 +2,26 @@
// This program is distributed under both the GPLV3 license
// and the YEHOWSHUA license, both of which can be found at
// the root of the folder containing the sources for this program.
use num::BigUint;
use std::collections::HashMap;
use std::fs::File;
use super::*;
mod combinator_atoms;
use combinator_atoms::*;
mod types;
use types::*;
mod metadata;
use metadata::*;
mod scopes;
use scopes::*;
mod events;
use events::*;
pub fn parse_vcd(file: File) -> Result<VCD, String> {
let mut word_gen = WordReader::new(file);
let header = parse_metadata(&mut word_gen)?;
pub fn parse_vcd(file: File) -> Result<super::types::VCD, String> {
let mut word_gen = super::reader::WordReader::new(file);
let header = metadata::parse_metadata(&mut word_gen)?;
// later, we'll need to map parsed ascii symbols to their
// respective signal indexes
let mut signal_map = std::collections::HashMap::new();
// after we parse metadata, we form the VCD object
let mut vcd = VCD {
let mut vcd = super::types::VCD {
metadata: header,
tmstmps_encoded_as_u8s: vec![],
all_signals: vec![],
@ -41,8 +29,8 @@ pub fn parse_vcd(file: File) -> Result<VCD, String> {
root_scopes: vec![],
};
parse_scopes(&mut word_gen, &mut vcd, &mut signal_map)?;
parse_events(&mut word_gen, &mut vcd, &mut signal_map)?;
scopes::parse_scopes(&mut word_gen, &mut vcd, &mut signal_map)?;
events::parse_events(&mut word_gen, &mut vcd, &mut signal_map)?;
Ok(vcd)
}