Read gzip-compressed GDSII directly in the CLI
Detect gzip headers on every CLI input and decode all members before parsing. Keep report offsets relative to the decompressed stream and report corrupt archives as invalid input. Recognize OASIS headers and explain how to provide GDSII data. Cover mixed compressed and plain comparisons, corrupt trailers, and layer-name output from compressed input.
This commit is contained in:
parent
58adf0cc99
commit
6e4b371046
1 changed files with 185 additions and 9 deletions
|
|
@ -500,6 +500,16 @@ fn object<'a>(records: &[Record<'a>], issues: &mut Vec<Diagnostic>) -> Result<Ob
|
|||
}
|
||||
|
||||
fn read_records(input: &[u8]) -> Result<Vec<Record<'_>>, String> {
|
||||
if input.starts_with(b"\x1f\x8b") {
|
||||
return Err(error(
|
||||
0,
|
||||
"gzip-compressed input. Decompress it before reading GDSII",
|
||||
));
|
||||
}
|
||||
if input.starts_with(b"%SEMI-OASIS\r\n") {
|
||||
return Err(error(0, "OASIS input. Export the layout as GDSII"));
|
||||
}
|
||||
|
||||
let mut records = Vec::new();
|
||||
let mut offset = 0;
|
||||
while offset < input.len() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue