KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_cache.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * Based on the dsn2kicad reference implementation and on OrCAD file format
7 * documentation from the OpenOrCadParser project (MIT licensed).
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
39
40#ifndef ORCAD_CACHE_H_
41#define ORCAD_CACHE_H_
42
43#include <cstdint>
44#include <map>
45#include <optional>
46#include <string>
47#include <vector>
48
52
68std::optional<ORCAD_PRIMITIVE> OrcadReadPrimitive( ORCAD_STREAM& aStream );
69
76std::optional<ORCAD_SYMBOL_PIN> OrcadReadSymbolPin( ORCAD_STRUCT_READER& aReader );
77
89 const ORCAD_PREFIXES& aPrefixes, bool aWithPins );
90
98 const ORCAD_PREFIXES& aPrefixes );
99
108 const ORCAD_PREFIXES& aPrefixes );
109
116
121
134std::optional<size_t> OrcadFindStructureStart( const ORCAD_STREAM& aStream,
135 size_t aPreamblePos );
136
154void OrcadParseCache( const std::vector<char>& aData, const std::vector<std::string>& aStrings,
155 const ORCAD_WARN_FN& aWarn, std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
156 std::map<std::string, ORCAD_PACKAGE>& aPackages );
157
164void OrcadMergeCacheStreams( std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
165 std::map<std::string, ORCAD_PACKAGE>& aPackages,
166 std::map<std::string, ORCAD_SYMBOL_DEF>&& aExtraSymbols,
167 std::map<std::string, ORCAD_PACKAGE>&& aExtraPackages );
168
169#endif // ORCAD_CACHE_H_
Little-endian byte cursor over one OrCAD Capture DSN stream.
Stateful reader shared by all structure parsers.
void OrcadMergeCacheStreams(std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages, std::map< std::string, ORCAD_SYMBOL_DEF > &&aExtraSymbols, std::map< std::string, ORCAD_PACKAGE > &&aExtraPackages)
Merge the results of a 'Packages/<name>' stream (locally modified parts) into the main cache maps: a ...
ORCAD_DEVICE OrcadReadDevice(ORCAD_STRUCT_READER &aReader)
Read one Device structure (reads its own prefixes; type must be 32).
std::optional< ORCAD_SYMBOL_PIN > OrcadReadSymbolPin(ORCAD_STRUCT_READER &aReader)
Read one symbol pin.
std::optional< size_t > OrcadFindStructureStart(const ORCAD_STREAM &aStream, size_t aPreamblePos)
Given the absolute position of a preamble magic, backtrack to find a valid prefix chain ending right ...
ORCAD_PACKAGE OrcadReadPackage(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
Read a Package body (type 31); layout documented on ORCAD_PACKAGE.
ORCAD_DRAWN_INSTANCE OrcadReadDrawnInstance(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
Structure type 12 (DrawnInstance): hierarchical block instance.
std::optional< ORCAD_PRIMITIVE > OrcadReadPrimitive(ORCAD_STREAM &aStream)
Read one graphic primitive including its doubled u8 type-pair prefix, at the current cursor.
void OrcadParseCache(const std::vector< char > &aData, const std::vector< std::string > &aStrings, const ORCAD_WARN_FN &aWarn, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages)
Scan a Cache-framed stream (the 'Cache' stream itself, or any 'Packages/<name>' stream — they share t...
ORCAD_SYMBOL_DEF OrcadReadSymbolDef(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes, bool aWithPins)
Read a symbol definition body (LibraryPart / GlobalSymbol / PortSymbol / OffPageSymbol / TitleBlockSy...
ORCAD_SYMBOL_DEF OrcadReadSthInPages0(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
Structure type 2 (SthInPages0): nested symbol body inside Graphic*Inst structures on pages; carries t...
Plain data records produced by the OrCAD Capture DSN stream parsers and consumed by ORCAD_CONVERTER.
std::function< void(const wxString &aMsg)> ORCAD_WARN_FN
Warning sink shared by all parser entry points (recoverable-issue channel).
Prefix framing machinery and readers for the prefix-framed OrCAD structures found in Page/Cache/Schem...
One device of a package: the pin-number map of a unit (structure type 32).
Structure type 12: a hierarchical block instance placed on a page.
A package: refdes prefix, footprint and per-unit devices (structure type 31).
The decoded prefix chain of one framed structure.
A symbol definition from the design Cache (LibraryPart / GlobalSymbol / PortSymbol / OffPageSymbol / ...