|
KiCad PCB EDA Suite
|
Prefix framing machinery and readers for the prefix-framed OrCAD structures found in Page/Cache/Schematic/Hierarchy streams. More...
#include <cstdint>#include <map>#include <string>#include <utility>#include <variant>#include <vector>#include <wx/string.h>#include <sch_io/orcad/orcad_records.h>#include <sch_io/orcad/orcad_stream.h>Go to the source code of this file.
Classes | |
| struct | ORCAD_PREFIXES |
| The decoded prefix chain of one framed structure. More... | |
| struct | ORCAD_READ_RESULT |
| class | ORCAD_STRUCT_READER |
| Stateful reader shared by all structure parsers. More... | |
Typedefs | |
| using | ORCAD_RECORD_VARIANT |
| Result of reading one structure of any type. | |
Functions | |
| ORCAD_DISPLAY_PROP | OrcadReadDisplayProp (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| ORCAD_ALIAS | OrcadReadAlias (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| ORCAD_WIRE | OrcadReadWire (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| Types 20 (wire) and 21 (bus); isBus is set from the prefix type. | |
| ORCAD_PLACED_INSTANCE | OrcadReadPlacedInstance (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| ORCAD_GRAPHIC_INST | OrcadReadGraphicInst (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| Common body of Port/Global/OffPageConnector/TitleBlock/ERCObject/Graphic*Inst. | |
| ORCAD_GRAPHIC_INST | OrcadReadPort (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| GraphicInst body followed by a 9-byte trailer. | |
| ORCAD_GRAPHIC_INST | OrcadReadTitleBlock (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| GraphicInst body followed by a 12-byte trailer. | |
| ORCAD_GRAPHIC_INST | OrcadReadErcObject (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| GraphicInst body followed by 3 lzt strings. | |
| ORCAD_PIN_INST | OrcadReadPinInst (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| ORCAD_BUS_ENTRY | OrcadReadBusEntry (ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes) |
| std::vector< ORCAD_DISPLAY_PROP > | OrcadReadDisplayPropList (ORCAD_STRUCT_READER &aReader) |
| Read a u16-counted list of framed DisplayProp structures via ReadStructure(), keeping only the successfully parsed ones. | |
| void | OrcadReadT0x34Raw (ORCAD_STREAM &aStream) |
| T0x34 records are NOT prefix-framed. | |
| void | OrcadReadT0x35Raw (ORCAD_STREAM &aStream) |
| T0x35 = the T0x34 raw layout followed by u16 n and 4 * n bytes. | |
Prefix framing machinery and readers for the prefix-framed OrCAD structures found in Page/Cache/Schematic/Hierarchy streams.
Every framed structure is
N x long prefix u8 typeId, u32 bodyLen, u32 (zeros) 1 x short prefix u8 typeId, i16 nProps, nProps x ( u32 nameIdx, u32 valIdx ) preamble FF E4 5C 39, u32 trailLen, trailLen bytes body...
The number of long prefixes is structure-type dependent and discovered by trial (longest chain first). Each long-prefix bodyLen counts the bytes from the end of its own 9-byte record to the end of the structure, which yields reliable skip offsets ("stops") for structures whose body cannot be fully interpreted.
Implemented in orcad_structures.cpp (except the readers declared in orcad_cache.h, which orcad_structures.cpp's dispatcher calls for nested SthInPages0 bodies and DrawnInstance blocks).
Definition in file orcad_structures.h.
| using ORCAD_RECORD_VARIANT |
Result of reading one structure of any type.
record holds std::monostate when the structure was skipped (no reader for its type) or its body parse failed and was recovered by skipping to the prefix end.
Definition at line 83 of file orcad_structures.h.
| ORCAD_ALIAS OrcadReadAlias | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Definition at line 325 of file orcad_structures.cpp.
References ORCAD_ALIAS::color, ORCAD_ALIAS::fontIdx, ORCAD_ALIAS::name, ORCAD_STREAM::ReadI32(), ORCAD_STREAM::ReadLzt(), ORCAD_STREAM::ReadU32(), ORCAD_ALIAS::rotation, ORCAD_STRUCT_READER::Stream(), ORCAD_ALIAS::x, and ORCAD_ALIAS::y.
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_BUS_ENTRY OrcadReadBusEntry | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Definition at line 545 of file orcad_structures.cpp.
References ORCAD_BUS_ENTRY::color, ORCAD_STREAM::ReadI32(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::Skip(), ORCAD_STRUCT_READER::Stream(), ORCAD_BUS_ENTRY::x1, ORCAD_BUS_ENTRY::x2, ORCAD_BUS_ENTRY::y1, and ORCAD_BUS_ENTRY::y2.
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_DISPLAY_PROP OrcadReadDisplayProp | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Definition at line 301 of file orcad_structures.cpp.
References ORCAD_DISPLAY_PROP::color, ORCAD_DISPLAY_PROP::dispMode, ORCAD_STREAM::ExpectByte(), ORCAD_DISPLAY_PROP::fontIdx, ORCAD_DISPLAY_PROP::name, ORCAD_DISPLAY_PROP::nameIdx, ORCAD_STREAM::ReadI16(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::ReadU8(), ORCAD_STRUCT_READER::Resolve(), ORCAD_DISPLAY_PROP::rotation, ORCAD_STRUCT_READER::Stream(), ORCAD_DISPLAY_PROP::x, and ORCAD_DISPLAY_PROP::y.
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| std::vector< ORCAD_DISPLAY_PROP > OrcadReadDisplayPropList | ( | ORCAD_STRUCT_READER & | aReader | ) |
Read a u16-counted list of framed DisplayProp structures via ReadStructure(), keeping only the successfully parsed ones.
Also used by the Cache readers.
Definition at line 562 of file orcad_structures.cpp.
References ORCAD_STRUCT_READER::ReadStructure(), ORCAD_STREAM::ReadU16(), ORCAD_READ_RESULT::record, and ORCAD_STRUCT_READER::Stream().
Referenced by OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPinInst(), and OrcadReadPlacedInstance().
| ORCAD_GRAPHIC_INST OrcadReadErcObject | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
GraphicInst body followed by 3 lzt strings.
Definition at line 511 of file orcad_structures.cpp.
References OrcadReadGraphicInst(), ORCAD_STREAM::ReadLzt(), and ORCAD_STRUCT_READER::Stream().
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_GRAPHIC_INST OrcadReadGraphicInst | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Common body of Port/Global/OffPageConnector/TitleBlock/ERCObject/Graphic*Inst.
Definition at line 439 of file orcad_structures.cpp.
References ORCAD_GRAPHIC_INST::bbox, ORCAD_GRAPHIC_INST::color, ORCAD_GRAPHIC_INST::dbId, ORCAD_GRAPHIC_INST::displayProps, flag, ORCAD_GRAPHIC_INST::logicalName, ORCAD_GRAPHIC_INST::mirror, ORCAD_GRAPHIC_INST::name, ORCAD_GRAPHIC_INST::nested, OrcadReadDisplayPropList(), ORCAD_GRAPHIC_INST::props, ORCAD_STRUCT_READER::PropsDict(), ORCAD_STREAM::ReadI16(), ORCAD_STREAM::ReadLzt(), ORCAD_STRUCT_READER::ReadStructure(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::ReadU8(), ORCAD_READ_RESULT::record, ORCAD_STRUCT_READER::Resolve(), ORCAD_GRAPHIC_INST::rotation, ORCAD_STREAM::Skip(), ORCAD_STRUCT_READER::Stream(), ORCAD_GRAPHIC_INST::typeId, ORCAD_PREFIXES::typeId, ORCAD_GRAPHIC_INST::x, ORCAD_BBOX::x1, ORCAD_BBOX::x2, ORCAD_GRAPHIC_INST::y, ORCAD_BBOX::y1, and ORCAD_BBOX::y2.
Referenced by OrcadReadErcObject(), OrcadReadPort(), OrcadReadTitleBlock(), and ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_PIN_INST OrcadReadPinInst | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Definition at line 524 of file orcad_structures.cpp.
References ORCAD_PREFIXES::end, ORCAD_STREAM::GetOffset(), OrcadReadDisplayPropList(), pin, ORCAD_STREAM::ReadI16(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::Seek(), and ORCAD_STRUCT_READER::Stream().
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_PLACED_INSTANCE OrcadReadPlacedInstance | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Definition at line 379 of file orcad_structures.cpp.
References ORCAD_PLACED_INSTANCE::bbox, ORCAD_PLACED_INSTANCE::color, ORCAD_PLACED_INSTANCE::dbId, ORCAD_PLACED_INSTANCE::displayProps, ORCAD_PLACED_INSTANCE::mirror, OrcadReadDisplayPropList(), pin, ORCAD_PLACED_INSTANCE::pins, ORCAD_PLACED_INSTANCE::pkgName, ORCAD_PLACED_INSTANCE::props, ORCAD_STRUCT_READER::PropsDict(), ORCAD_STREAM::ReadI16(), ORCAD_STREAM::ReadLzt(), ORCAD_STRUCT_READER::ReadStructure(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::ReadU8(), ORCAD_READ_RESULT::record, ORCAD_PLACED_INSTANCE::reference, ORCAD_STRUCT_READER::Resolve(), ORCAD_PLACED_INSTANCE::rotation, ORCAD_STREAM::Skip(), ORCAD_PLACED_INSTANCE::sourcePackage, ORCAD_STRUCT_READER::Stream(), ORCAD_PLACED_INSTANCE::value, ORCAD_PLACED_INSTANCE::x, ORCAD_BBOX::x1, ORCAD_BBOX::x2, ORCAD_PLACED_INSTANCE::y, ORCAD_BBOX::y1, and ORCAD_BBOX::y2.
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_GRAPHIC_INST OrcadReadPort | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
GraphicInst body followed by a 9-byte trailer.
Definition at line 492 of file orcad_structures.cpp.
References OrcadReadGraphicInst(), ORCAD_STREAM::Skip(), and ORCAD_STRUCT_READER::Stream().
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| void OrcadReadT0x34Raw | ( | ORCAD_STREAM & | aStream | ) |
T0x34 records are NOT prefix-framed.
Raw layout: 9 bytes, u32 id, lzt string, u32, u32 color, u32 lineStyle, u32 lineWidth. Content is not used; the reader only keeps the stream aligned.
Definition at line 580 of file orcad_structures.cpp.
References ORCAD_STREAM::ReadLzt(), ORCAD_STREAM::ReadU32(), and ORCAD_STREAM::Skip().
Referenced by OrcadParsePage(), and OrcadReadT0x35Raw().
| void OrcadReadT0x35Raw | ( | ORCAD_STREAM & | aStream | ) |
T0x35 = the T0x34 raw layout followed by u16 n and 4 * n bytes.
Definition at line 592 of file orcad_structures.cpp.
References OrcadReadT0x34Raw(), ORCAD_STREAM::ReadU16(), and ORCAD_STREAM::Skip().
Referenced by OrcadParsePage().
| ORCAD_GRAPHIC_INST OrcadReadTitleBlock | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
GraphicInst body followed by a 12-byte trailer.
Definition at line 501 of file orcad_structures.cpp.
References OrcadReadGraphicInst(), ORCAD_STREAM::Skip(), and ORCAD_STRUCT_READER::Stream().
Referenced by ORCAD_STRUCT_READER::ReadStructure().
| ORCAD_WIRE OrcadReadWire | ( | ORCAD_STRUCT_READER & | aReader, |
| const ORCAD_PREFIXES & | aPrefixes ) |
Types 20 (wire) and 21 (bus); isBus is set from the prefix type.
Definition at line 341 of file orcad_structures.cpp.
References ORCAD_WIRE::aliases, ORCAD_WIRE::color, ORCAD_WIRE::id, ORCAD_WIRE::isBus, ORCAD_WIRE::lineStyle, ORCAD_WIRE::lineWidth, ORCAD_ST_WIRE_BUS, ORCAD_STREAM::ReadI32(), ORCAD_STRUCT_READER::ReadStructure(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), ORCAD_READ_RESULT::record, ORCAD_STREAM::Skip(), ORCAD_STRUCT_READER::Stream(), ORCAD_PREFIXES::typeId, ORCAD_WIRE::x1, ORCAD_WIRE::x2, ORCAD_WIRE::y1, and ORCAD_WIRE::y2.
Referenced by ORCAD_STRUCT_READER::ReadStructure().