|
KiCad PCB EDA Suite
|
Parsers for the per-page streams 'Views/<folder>/Pages/<page>', the per-folder page-order stream 'Views/<folder>/Schematic', and — for hierarchy DETECTION only — the 'Views/<folder>/Hierarchy/Hierarchy' stream. More...
#include <cstdint>#include <map>#include <string>#include <vector>#include <sch_io/orcad/orcad_records.h>Go to the source code of this file.
Functions | |
| ORCAD_RAW_PAGE | OrcadParsePage (const std::vector< char > &aData, const std::vector< std::string > &aStrings, const ORCAD_WARN_FN &aWarn) |
| Parse one 'Views/<folder>/Pages/<page>' stream into raw structure lists. | |
| std::vector< std::string > | OrcadParsePageOrder (const std::vector< char > &aData) |
| Parse the 'Views/<folder>/Schematic' stream and return the folder's page names in display order. | |
| std::map< uint32_t, std::string > | OrcadReadHierarchyLinks (const std::vector< char > &aData, const std::vector< std::string > &aStrings, const ORCAD_WARN_FN &aWarn, std::map< uint32_t, std::string > *aOccurrenceRefs=nullptr) |
| Parse a 'Views/<folder>/Hierarchy/Hierarchy' stream into block-instance links: block db id -> child folder name. | |
| ORCAD_OCC_SCOPE | OrcadReadOccurrenceTree (const std::vector< char > &aData, const ORCAD_WARN_FN &aWarn) |
| Parse the root folder 'Hierarchy/Hierarchy' stream into the full occurrence tree: per-scope part reference designators (keyed by placed-instance db id) and the hierarchical block occurrences that descend into child schematics, each with its own nested scope so a schematic reused N times yields N per-occurrence ref sets. | |
| ORCAD_RAW_PAGE | OrcadParsePageV2 (const std::vector< char > &aData, const std::vector< std::string > &aStrings, const ORCAD_WARN_FN &aWarn) |
| Parse one v2.0 (pre-2003) 'Views/<folder>/Pages/<page>' stream. | |
| void | OrcadParseOlbSymbolStreamV2 (const std::vector< char > &aData, const std::vector< std::string > &aStrings, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols) |
| Parse one v2.0 .OLB 'Symbols/<name>' stream (a single special symbol: power, port, off-page, title block or ERC) into aSymbols, keyed by symbol name. | |
| void | OrcadParseOlbPackageStreamV2 (const std::vector< char > &aData, const std::vector< std::string > &aStrings, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages) |
| Parse one v2.0 .OLB 'Packages/<name>' stream (a part's inline symbol definitions plus its package/device pin maps) into aSymbols (keyed by view name, e.g. | |
| bool | OrcadPageHasHierarchyBlocks (const ORCAD_RAW_PAGE &aPage) |
| True when the page contains hierarchical block instances (DrawnInstance, type 12). | |
Parsers for the per-page streams 'Views/<folder>/Pages/<page>', the per-folder page-order stream 'Views/<folder>/Schematic', and — for hierarchy DETECTION only — the 'Views/<folder>/Hierarchy/Hierarchy' stream.
Implemented in orcad_page.cpp.
Definition in file orcad_page.h.
|
inline |
True when the page contains hierarchical block instances (DrawnInstance, type 12).
Definition at line 152 of file orcad_page.h.
References ORCAD_RAW_PAGE::blocks.
Referenced by SCH_IO_ORCAD::LoadSchematicFile().
| void OrcadParseOlbPackageStreamV2 | ( | const std::vector< char > & | aData, |
| const std::vector< std::string > & | aStrings, | ||
| std::map< std::string, ORCAD_SYMBOL_DEF > & | aSymbols, | ||
| std::map< std::string, ORCAD_PACKAGE > & | aPackages ) |
Parse one v2.0 .OLB 'Packages/<name>' stream (a part's inline symbol definitions plus its package/device pin maps) into aSymbols (keyed by view name, e.g.
"7400.Normal") and aPackages (keyed by package name). Throws on a framing error.
Definition at line 1156 of file orcad_page.cpp.
References g_v2ShortDisplayProp, ORCAD_PACKAGE::name, ORCAD_SYMBOL_DEF::name, ORCAD_STREAM::ReadU16(), ORCAD_PACKAGE::refDes, ORCAD_STREAM::Remaining(), THROW_IO_ERROR, v2CheckCount(), v2Package(), and v2PartCell().
Referenced by SCH_IO_ORCAD::loadOlbSymbols().
| void OrcadParseOlbSymbolStreamV2 | ( | const std::vector< char > & | aData, |
| const std::vector< std::string > & | aStrings, | ||
| std::map< std::string, ORCAD_SYMBOL_DEF > & | aSymbols ) |
Parse one v2.0 .OLB 'Symbols/<name>' stream (a single special symbol: power, port, off-page, title block or ERC) into aSymbols, keyed by symbol name.
Throws IO_ERROR on a framing error.
Definition at line 1119 of file orcad_page.cpp.
References g_v2ShortDisplayProp, ORCAD_SYMBOL_DEF::name, ORCAD_STREAM::Remaining(), THROW_IO_ERROR, v2LibSymbolDef(), and v2Prefix().
Referenced by SCH_IO_ORCAD::loadOlbSymbols().
| ORCAD_RAW_PAGE OrcadParsePage | ( | const std::vector< char > & | aData, |
| const std::vector< std::string > & | aStrings, | ||
| const ORCAD_WARN_FN & | aWarn ) |
Parse one 'Views/<folder>/Pages/<page>' stream into raw structure lists.
Stream layout: one framed structure of type 10 (Page) whose body starts with lzt page name, lzt page-size name, then the 156-byte PageSettings block (OrcadParsePageSettings — supplies width/height/isMetric), followed by these u16-counted lists in order:
ERC objects framed (type 77)
The net table is authoritative for net names and junction computation: wires carry ids that key it. Structures that fail to parse are skipped with a warning via aWarn (never aborting the page); only a structurally unreadable Page structure itself throws IO_ERROR.
Definition at line 68 of file orcad_page.cpp.
References ORCAD_RAW_PAGE::blocks, ORCAD_RAW_PAGE::busEntries, ORCAD_RAW_PAGE::ercObjects, ORCAD_RAW_PAGE::globals, ORCAD_RAW_PAGE::graphics, ORCAD_PAGE_SETTINGS::height, ORCAD_RAW_PAGE::height, ORCAD_RAW_PAGE::instances, ORCAD_PAGE_SETTINGS::isMetric, ORCAD_RAW_PAGE::isMetric, ORCAD_RAW_PAGE::name, ORCAD_RAW_PAGE::netmap, ORCAD_RAW_PAGE::offpage, ORCAD_ST_PAGE, OrcadParsePageSettings(), OrcadReadT0x34Raw(), OrcadReadT0x35Raw(), ORCAD_RAW_PAGE::pageSize, ORCAD_RAW_PAGE::ports, ORCAD_STREAM::ReadLzt(), ORCAD_STRUCT_READER::ReadPrefixes(), ORCAD_STRUCT_READER::ReadStructure(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), result, ORCAD_STREAM::Skip(), THROW_IO_ERROR, ORCAD_RAW_PAGE::titleBlocks, ORCAD_PREFIXES::typeId, ORCAD_PAGE_SETTINGS::width, ORCAD_RAW_PAGE::width, and ORCAD_RAW_PAGE::wires.
Referenced by SCH_IO_ORCAD::LoadSchematicFile().
| std::vector< std::string > OrcadParsePageOrder | ( | const std::vector< char > & | aData | ) |
Parse the 'Views/<folder>/Schematic' stream and return the folder's page names in display order.
Layout: one prefix chain, lzt folder name, 4 bytes, u16 page count, then the lzt page names stored LAST-FIRST (the returned vector is already reversed into display order).
The caller (plugin shell) must intersect the result with the page streams that actually exist under 'Views/<folder>/Pages/', append any pages missing from the order stream, and fall back to name-sorted order with a warning when this parser throws IO_ERROR.
Definition at line 159 of file orcad_page.cpp.
References ORCAD_STREAM::ReadLzt(), ORCAD_STRUCT_READER::ReadPrefixes(), ORCAD_STREAM::ReadU16(), and ORCAD_STREAM::Skip().
Referenced by SCH_IO_ORCAD::LoadSchematicFile().
| ORCAD_RAW_PAGE OrcadParsePageV2 | ( | const std::vector< char > & | aData, |
| const std::vector< std::string > & | aStrings, | ||
| const ORCAD_WARN_FN & | aWarn ) |
Parse one v2.0 (pre-2003) 'Views/<folder>/Pages/<page>' stream.
v2.0 uses short-prefix-only framing (no long prefixes, no FF E4 5C 39 preambles) with u16 string-table indices and a collapsed primitive envelope, but the same record vocabulary as the modern format. Throws IO_ERROR on any framing error (the format has no per-record skip offsets, so recovery is per-page).
Definition at line 990 of file orcad_page.cpp.
References ORCAD_RAW_PAGE::busEntries, ORCAD_BUS_ENTRY::color, ORCAD_RAW_PAGE::ercObjects, ORCAD_RAW_PAGE::globals, ORCAD_RAW_PAGE::graphics, group, ORCAD_PAGE_SETTINGS::height, ORCAD_RAW_PAGE::height, ORCAD_RAW_PAGE::instances, ORCAD_PAGE_SETTINGS::isMetric, ORCAD_RAW_PAGE::isMetric, ORCAD_RAW_PAGE::name, ORCAD_RAW_PAGE::netGroups, ORCAD_RAW_PAGE::netmap, ORCAD_RAW_PAGE::offpage, ORCAD_ST_PAGE, OrcadParsePageSettings(), ORCAD_RAW_PAGE::pageSize, ORCAD_RAW_PAGE::ports, ORCAD_STREAM::ReadI32(), ORCAD_STREAM::ReadLzt(), ORCAD_STREAM::ReadU16(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::Skip(), THROW_IO_ERROR, ORCAD_RAW_PAGE::titleBlocks, v2CheckCount(), v2GraphicInst(), v2PlacedInstance(), v2Prefix(), v2Wire(), ORCAD_PAGE_SETTINGS::width, ORCAD_RAW_PAGE::width, ORCAD_RAW_PAGE::wires, ORCAD_BUS_ENTRY::x1, ORCAD_BUS_ENTRY::x2, ORCAD_BUS_ENTRY::y1, and ORCAD_BUS_ENTRY::y2.
Referenced by BOOST_AUTO_TEST_CASE(), and SCH_IO_ORCAD::LoadSchematicFile().
| std::map< uint32_t, std::string > OrcadReadHierarchyLinks | ( | const std::vector< char > & | aData, |
| const std::vector< std::string > & | aStrings, | ||
| const ORCAD_WARN_FN & | aWarn, | ||
| std::map< uint32_t, std::string > * | aOccurrenceRefs = nullptr ) |
Parse a 'Views/<folder>/Hierarchy/Hierarchy' stream into block-instance links: block db id -> child folder name.
Used to name skipped child folders in hierarchy warnings (hierarchical designs are converted flat).
The stream header is version-fragile, so the reader scans for preambles and backtracks prefix chains (OrcadFindStructureStart), keeping only type-66 structures. Type-66 body: u32, u32 instance db id, u8 inner-frame marker that must equal 0x42, u32, u32, lzt child folder name, lzt occurrence reference. Bad candidates are skipped silently; the scan never throws.
When aOccurrenceRefs is non-null it receives instance db id -> reference designator from the second lzt, which occurrence-annotated designs use to store the real refdes that the placed instance itself leaves as "C?".
Definition at line 184 of file orcad_page.cpp.
References ORCAD_STREAM::Data(), ORCAD_PREFIXES::end, ORCAD_STREAM::ExpectByte(), ORCAD_STREAM::FindPreamble(), ORCAD_STREAM::GetOffset(), ORCAD_STREAM::npos, ORCAD_ST_HIERARCHY_LINK, OrcadFindStructureStart(), ORCAD_STREAM::ReadLzt(), ORCAD_STRUCT_READER::ReadPrefixes(), ORCAD_STREAM::ReadU32(), and ORCAD_STREAM::Seek().
Referenced by SCH_IO_ORCAD::LoadSchematicFile().
| ORCAD_OCC_SCOPE OrcadReadOccurrenceTree | ( | const std::vector< char > & | aData, |
| const ORCAD_WARN_FN & | aWarn ) |
Parse the root folder 'Hierarchy/Hierarchy' stream into the full occurrence tree: per-scope part reference designators (keyed by placed-instance db id) and the hierarchical block occurrences that descend into child schematics, each with its own nested scope so a schematic reused N times yields N per-occurrence ref sets.
Returns an empty scope for legacy pre-preamble streams (which are instance- annotated) and on any parse error (the caller then falls back to the scan-based OrcadReadHierarchyLinks for the flat root-scope refs).
Definition at line 1212 of file orcad_page.cpp.
References ORCAD_STREAM::ReadLzt(), readOccScope(), ORCAD_STREAM::ReadU32(), ORCAD_STREAM::ReadU8(), ORCAD_STREAM::Skip(), and IO_ERROR::What().
Referenced by SCH_IO_ORCAD::LoadSchematicFile().