KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_records.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
38
39#ifndef ORCAD_RECORDS_H_
40#define ORCAD_RECORDS_H_
41
42#include <cstdint>
43#include <functional>
44#include <map>
45#include <memory>
46#include <optional>
47#include <string>
48#include <utility>
49#include <vector>
50
51#include <wx/string.h>
52
54using ORCAD_WARN_FN = std::function<void( const wxString& aMsg )>;
55
56
60enum ORCAD_ST : int
61{
110};
111
112
131
132
147
148
164
165
168{
169 int x = 0;
170 int y = 0;
171
172 bool operator==( const ORCAD_POINT& aOther ) const { return x == aOther.x && y == aOther.y; }
173 bool operator!=( const ORCAD_POINT& aOther ) const { return !( *this == aOther ); }
174};
175
176
179{
180 int x1 = 0;
181 int y1 = 0;
182 int x2 = 0;
183 int y2 = 0;
184};
185
186
195{
196 uint32_t nameIdx = 0;
197 std::string name;
198 int x = 0;
199 int y = 0;
200 int rotation = 0;
201 int fontIdx = 0;
202 int color = 0;
203 int dispMode = 0;
204};
205
206
214{
215 std::string name;
216 int x = 0;
217 int y = 0;
218 int rotation = 0;
219 int color = 0;
220 int fontIdx = 0;
221};
222
223
232{
233 uint32_t id = 0;
234 int x1 = 0;
235 int y1 = 0;
236 int x2 = 0;
237 int y2 = 0;
238 bool isBus = false;
239 int color = 0;
240 int lineWidth = 3;
241 int lineStyle = 5;
242 std::vector<ORCAD_ALIAS> aliases;
243};
244
245
254{
255 int x = 0;
256 int y = 0;
257 uint32_t wordA = 0;
258 uint32_t wordB = 0;
259 std::vector<ORCAD_DISPLAY_PROP> displayProps;
260};
261
262
278{
279 std::string pkgName;
280 uint32_t dbId = 0;
281 int x = 0;
282 int y = 0;
283 std::string reference;
284 std::string value;
285 std::map<std::string, std::string> props;
286 std::vector<ORCAD_DISPLAY_PROP> displayProps;
287 int color = 0;
288 int rotation = 0;
289 bool mirror = false;
291 std::string sourcePackage;
292 std::vector<ORCAD_PIN_INST> pins;
293};
294
295
296struct ORCAD_SYMBOL_DEF; // defined below (ORCAD_GRAPHIC_INST holds one by pointer)
297
298
318{
319 int typeId = 0;
320 std::string name;
321 uint32_t dbId = 0;
322 int x = 0;
323 int y = 0;
325 int color = 0;
326 std::map<std::string, std::string> props;
327 std::vector<ORCAD_DISPLAY_PROP> displayProps;
328 std::unique_ptr<ORCAD_SYMBOL_DEF> nested;
329 int rotation = 0;
330 bool mirror = false;
331 std::string logicalName;
332};
333
334
361{
363 int x1 = 0;
364 int y1 = 0;
365 int x2 = 0;
366 int y2 = 0;
367 std::optional<ORCAD_POINT> start;
368 std::optional<ORCAD_POINT> end;
369 std::vector<ORCAD_POINT> points;
370 std::string text;
371 int fontIdx = 0;
372 int lineStyle = 5;
373 int lineWidth = 3;
374 int fillStyle = 1;
375 int hatchStyle = 0;
376 std::vector<uint8_t> data;
377 std::vector<ORCAD_PRIMITIVE> children;
378};
379
380
391{
392 std::string name;
393 int position = -1;
394 int startX = 0;
395 int startY = 0;
396 int hotptX = 0;
397 int hotptY = 0;
399 int shapeBits = 0;
400};
401
402
418{
419 int typeId = 0;
420 std::string name;
421 std::string sourceLib;
422 int color = 0;
423 std::vector<ORCAD_PRIMITIVE> primitives;
424 std::vector<ORCAD_SYMBOL_PIN> pins;
425 std::optional<ORCAD_BBOX> bbox;
426 std::map<std::string, std::string> props;
427
435 std::vector<ORCAD_SYMBOL_DEF> variants;
436
439 int generalFlags = -1;
440
441 bool synthesized = false;
442};
443
444
453{
454 std::string unitRef;
455 std::string refDes;
456 std::vector<std::string> pinNumbers;
457 std::vector<bool> pinIgnore;
458};
459
460
468{
469 std::string name;
470 std::string sourceLib;
471 std::string refDes;
472 std::string pcbFootprint;
473 std::vector<ORCAD_DEVICE> devices;
474};
475
476
479{
480 std::string name;
482 int x = 0;
483 int y = 0;
484};
485
486
496{
497 uint32_t dbId = 0;
498 std::string reference;
499 int x1 = 0;
500 int y1 = 0;
501 int w = 0;
502 int h = 0;
503 std::vector<ORCAD_BLOCK_PIN> pins;
504 std::vector<ORCAD_DISPLAY_PROP> displayProps;
505 std::string childName;
506};
507
508
514{
515 int x1 = 0;
516 int y1 = 0;
517 int x2 = 0;
518 int y2 = 0;
519 int color = 0;
520};
521
522
531{
532 int height = 0;
533 std::string face;
534 bool italic = false;
535 bool bold = false;
536};
537
538
550{
551 uint32_t width = 0;
552 uint32_t height = 0;
553 uint32_t pinToPin = 100;
554 bool isMetric = false;
555};
556
557
559{
560 uint32_t id = 0;
561 std::string name;
562 std::vector<uint32_t> members;
563};
564
565
571{
572 std::string introduction;
575 std::vector<ORCAD_FONT> fonts;
576 std::vector<std::string> partFields;
577 std::vector<std::string> strings;
578 std::vector<std::pair<std::string, std::string>> partAliases;
579 std::string schematicName;
580 uint32_t pinToPin = 100;
581};
582
583
590{
591 // Move-only: the graphic-instance lists hold unique_ptrs, and the netmap's
592 // non-noexcept move would otherwise make vector growth fall back to the
593 // (deleted) copy constructor via move_if_noexcept.
594 ORCAD_RAW_PAGE() = default;
595 ORCAD_RAW_PAGE( const ORCAD_RAW_PAGE& ) = delete;
599
600 std::string name;
601 std::string pageSize;
602 uint32_t width = 0;
603 uint32_t height = 0;
604 bool isMetric = false;
605 std::vector<ORCAD_GRAPHIC_INST> titleBlocks;
606 std::vector<ORCAD_WIRE> wires;
607 std::vector<ORCAD_PLACED_INSTANCE> instances;
608 std::vector<ORCAD_GRAPHIC_INST> ports;
609 std::vector<ORCAD_GRAPHIC_INST> globals;
610 std::vector<ORCAD_GRAPHIC_INST> offpage;
611 std::vector<ORCAD_GRAPHIC_INST> ercObjects;
612 std::vector<ORCAD_BUS_ENTRY> busEntries;
613 std::vector<ORCAD_GRAPHIC_INST> graphics;
614 std::map<uint32_t, std::string> netmap;
615 std::vector<ORCAD_NET_GROUP> netGroups;
616 std::vector<ORCAD_DRAWN_INSTANCE> blocks;
617};
618
619
620struct ORCAD_OCC_BLOCK; // defined below (a scope owns child block occurrences)
621
622
630{
631 std::map<uint32_t, std::string> partRefs;
632 std::vector<ORCAD_OCC_BLOCK> blocks;
633};
634
635
643{
644 uint32_t targetDbId = 0;
645 std::string childFolder;
647};
648
649
657{
658 std::string name;
660 std::map<std::string, ORCAD_SYMBOL_DEF> symbols;
661 std::map<std::string, ORCAD_PACKAGE> packages;
662 std::vector<ORCAD_RAW_PAGE> pages;
663
666 std::map<std::string, std::vector<ORCAD_RAW_PAGE>> childFolderPages;
667
673
674 bool hasHierarchyBlocks = false;
675};
676
677#endif // ORCAD_RECORDS_H_
Generic cubic Bezier representation.
Plain ellipse / elliptical-arc data.
Definition ellipse.h:32
Manage an 8-bit channel image.
Definition image.h:86
Definition line.h:32
std::function< void(const wxString &aMsg)> ORCAD_WARN_FN
Warning sink shared by all parser entry points (recoverable-issue channel).
ORCAD_PRIM
Graphic primitive type ids, stored as a doubled u8 pair (t, t) before each primitive body inside symb...
@ ORCAD_PRIM_ARC
@ ORCAD_PRIM_BEZIER
@ ORCAD_PRIM_POLYLINE
@ ORCAD_PRIM_COMMENT_TEXT
@ ORCAD_PRIM_LINE
@ ORCAD_PRIM_ELLIPSE
@ ORCAD_PRIM_BITMAP
plain DIB (BITMAPINFOHEADER + pixels)
@ ORCAD_PRIM_OLE_IMAGE
OLE compound document embed.
@ ORCAD_PRIM_POLYGON
@ ORCAD_PRIM_RECT
@ ORCAD_PRIM_SYMBOL_VECTOR
nested prefix-framed vector graphic
ORCAD_PORT_TYPE
Pin electrical type codes (u32 portType field of a symbol pin).
ORCAD_ST
Structure type ids as they appear in the u8 type byte of the long/short prefixes.
@ ORCAD_ST_HIERARCHY_LINK
block dbId -> child folder link
@ ORCAD_ST_STH_IN_PAGES0
nested symbol body inside Graphic*Inst
@ ORCAD_ST_T0X34
raw record, not prefix-framed
@ ORCAD_ST_PORT_SYMBOL
@ ORCAD_ST_TITLEBLOCK_SYMBOL
@ ORCAD_ST_T0X10
scalar pin instance (absolute pos)
@ ORCAD_ST_T0X35
raw record, not prefix-framed
@ ORCAD_ST_WIRE_SCALAR
@ ORCAD_ST_PLACED_INSTANCE
@ ORCAD_ST_GRAPHIC_ARC_INST
@ ORCAD_ST_SYMBOL_PIN_SCALAR
@ ORCAD_ST_PART_CELL
@ ORCAD_ST_DRAWN_INSTANCE
hierarchical block instance
@ ORCAD_ST_TITLEBLOCK
@ ORCAD_ST_SYMBOL_VECTOR
@ ORCAD_ST_GLOBAL
placed power symbol
@ ORCAD_ST_PAGE
@ ORCAD_ST_GRAPHIC_BITMAP_INST
@ ORCAD_ST_LIBRARY_PART
@ ORCAD_ST_OFFPAGE_CONNECTOR
@ ORCAD_ST_DEVICE
@ ORCAD_ST_PORT
@ ORCAD_ST_GRAPHIC_LINE_INST
@ ORCAD_ST_GLOBAL_SYMBOL
power symbol definition
@ ORCAD_ST_BOOKMARK_SYMBOL
@ ORCAD_ST_PACKAGE
@ ORCAD_ST_GRAPHIC_COMMENT_TEXT_INST
@ ORCAD_ST_GRAPHIC_ELLIPSE_INST
@ ORCAD_ST_GRAPHIC_BOX_INST
@ ORCAD_ST_ERC_OBJECT
placed ERC marker (no-connect)
@ ORCAD_ST_SYMBOL_PIN_BUS
@ ORCAD_ST_GRAPHIC_POLYLINE_INST
@ ORCAD_ST_BOOKMARK_INST
@ ORCAD_ST_GRAPHIC_BEZIER_INST
@ ORCAD_ST_GRAPHIC_POLYGON_INST
@ ORCAD_ST_ALIAS
net alias attached to a wire
@ ORCAD_ST_WIRE_BUS
@ ORCAD_ST_SCH_LIB
@ ORCAD_ST_SYMBOL_DISPLAY_PROP
@ ORCAD_ST_T0X11
bus pin instance (absolute pos)
@ ORCAD_ST_ERC_SYMBOL
@ ORCAD_ST_BUS_ENTRY
@ ORCAD_ST_GRAPHIC_OLE_INST
@ ORCAD_ST_OFFPAGE_SYMBOL
@ ORCAD_ST_PART_INSTANCE
@ ORCAD_ST_NET_GROUP
@ ORCAD_ST_PIN_SHAPE_SYMBOL
@ ORCAD_ST_DSN_STREAM
ORCAD_PRIM_KIND
Decoded primitive kind after parsing.
Net alias attached to a wire (becomes a local label).
std::string name
int rotation
0..3 quarter turns
Axis-aligned box in OrCAD DBU; corner order as stored (not normalized).
One interface pin of a hierarchical block, at its absolute page position.
ORCAD_PORT_TYPE portType
std::string name
Bus entry (structure type 29).
int y1
int color
int x2
int y2
int x1
Everything parsed from one .DSN, as handed to ORCAD_CONVERTER.
ORCAD_LIBRARY_INFO library
ORCAD_OCC_SCOPE occurrenceRoot
Occurrence tree from the root folder Hierarchy stream.
std::map< std::string, ORCAD_SYMBOL_DEF > symbols
cache, keyed by cache name
bool hasHierarchyBlocks
std::map< std::string, ORCAD_PACKAGE > packages
keyed by package name
std::string name
design (root schematic) name
std::map< std::string, std::vector< ORCAD_RAW_PAGE > > childFolderPages
Child schematic folder pages, keyed by lower-cased folder name; instantiated once per hierarchical bl...
std::vector< ORCAD_RAW_PAGE > pages
root schematic folder pages
One device of a package: the pin-number map of a unit (structure type 32).
std::vector< std::string > pinNumbers
std::string refDes
std::vector< bool > pinIgnore
std::string unitRef
One displayed property of an instance (Part Reference, Value, user fields).
int fontIdx
1-based into ORCAD_LIBRARY_INFO::fonts; 0 = default
int rotation
0..3 quarter turns
std::string name
resolved property name (empty when index invalid)
Structure type 12: a hierarchical block instance placed on a page.
int x1
block rectangle top-left, page DBU
std::vector< ORCAD_BLOCK_PIN > pins
std::vector< ORCAD_DISPLAY_PROP > displayProps
std::string childName
child folder, when embedded
One text font from the Library stream (a Win32 LOGFONTA record, 60 bytes: lfHeight i32 at +0,...
bool bold
lfWeight >= 600
std::string face
int height
raw lfHeight (typically negative)
Shared body of Port / Global / OffPageConnector / TitleBlock / ERCObject and the Graphic*Inst shapes ...
std::unique_ptr< ORCAD_SYMBOL_DEF > nested
SthInPages0 body, else nullptr.
std::map< std::string, std::string > props
int rotation
0..3 quarter turns
std::string name
cache symbol name
std::vector< ORCAD_DISPLAY_PROP > displayProps
std::string logicalName
ports: resolved net/port name
int typeId
ORCAD_ST value.
Decoded Library stream: format version, fonts, and the string table that all property name/value indi...
std::string introduction
fixed 32-byte NUL-terminated buffer
std::vector< std::string > strings
global string table
std::vector< ORCAD_FONT > fonts
std::vector< std::pair< std::string, std::string > > partAliases
std::string schematicName
root schematic folder name
std::vector< std::string > partFields
the 8 named part fields
std::vector< uint32_t > members
std::string name
A hierarchical block occurrence: one placement of a child schematic folder on a parent page.
uint32_t targetDbId
type-12 drawn-instance dbId on the parent page
ORCAD_OCC_SCOPE scope
the child's occurrences under this path
std::string childFolder
child schematic folder name
One node of the design occurrence tree parsed from the root Hierarchy stream.
std::vector< ORCAD_OCC_BLOCK > blocks
hierarchical block occurrences
std::map< uint32_t, std::string > partRefs
type-13 dbId -> occurrence refdes
A package: refdes prefix, footprint and per-unit devices (structure type 31).
std::string refDes
std::string sourceLib
std::vector< ORCAD_DEVICE > devices
std::string pcbFootprint
std::string name
The 156-byte PageSettings block embedded in the Library stream and in every Page stream: 8 bytes crea...
T0x10: one pin of a placed instance, carrying the pin's absolute page position (the connection point ...
std::vector< ORCAD_DISPLAY_PROP > displayProps
uint32_t wordA
two flag/id words after (x, y)
A placed part instance on a page (structure type 13).
std::string sourcePackage
package base name
std::vector< ORCAD_DISPLAY_PROP > displayProps
ORCAD_BBOX bbox
placed box, page DBU
int rotation
0..3 quarter turns
std::map< std::string, std::string > props
short-prefix property pairs
bool mirror
orientation bit 2
std::string value
resolved Part Value
std::vector< ORCAD_PIN_INST > pins
successfully parsed T0x10 records
Integer point in OrCAD DBU.
bool operator==(const ORCAD_POINT &aOther) const
bool operator!=(const ORCAD_POINT &aOther) const
One graphic primitive of a symbol body or nested page graphic.
int fillStyle
0 solid, 1 none, 2 hatch pattern
std::string text
kind == TEXT
std::vector< ORCAD_PRIMITIVE > children
kind == GROUP, translated by (x1, y1)
std::vector< ORCAD_POINT > points
polygon/polyline/bezier vertices
ORCAD_PRIM_KIND kind
std::vector< uint8_t > data
kind == IMAGE: raw embedded payload
int lineStyle
0 solid, 1 dash, 2 dot, 3 dash-dot, 4 dash-dot-dot, 5 default
std::optional< ORCAD_POINT > start
arc start point
std::optional< ORCAD_POINT > end
arc end point
int lineWidth
Capture width enum: 0 thin, 1 medium, 2 wide, 3 default.
ORCAD_RAW_PAGE & operator=(ORCAD_RAW_PAGE &&)=default
std::vector< ORCAD_GRAPHIC_INST > ports
ORCAD_RAW_PAGE(ORCAD_RAW_PAGE &&)=default
std::string name
std::vector< ORCAD_GRAPHIC_INST > globals
placed power symbols
ORCAD_RAW_PAGE(const ORCAD_RAW_PAGE &)=delete
ORCAD_RAW_PAGE()=default
ORCAD_RAW_PAGE & operator=(const ORCAD_RAW_PAGE &)=delete
std::map< uint32_t, std::string > netmap
net db id -> net name
std::vector< ORCAD_WIRE > wires
uint32_t width
mils, or um when isMetric
std::vector< ORCAD_NET_GROUP > netGroups
bus net id -> member net ids
std::vector< ORCAD_DRAWN_INSTANCE > blocks
hierarchical blocks (detection only)
std::vector< ORCAD_PLACED_INSTANCE > instances
std::vector< ORCAD_GRAPHIC_INST > graphics
free comment text/shapes/images
std::vector< ORCAD_GRAPHIC_INST > offpage
off-page connectors
std::vector< ORCAD_GRAPHIC_INST > titleBlocks
std::vector< ORCAD_BUS_ENTRY > busEntries
std::string pageSize
page-size name string, e.g. "B"
std::vector< ORCAD_GRAPHIC_INST > ercObjects
no-connect markers
A symbol definition from the design Cache (LibraryPart / GlobalSymbol / PortSymbol / OffPageSymbol / ...
std::string name
cache name, e.g. "C.Normal"
std::vector< ORCAD_SYMBOL_PIN > pins
std::vector< ORCAD_PRIMITIVE > primitives
bool synthesized
placeholder built from T0x10 data
std::map< std::string, std::string > props
int typeId
ORCAD_ST value.
std::string sourceLib
std::optional< ORCAD_BBOX > bbox
symbol-space body box
std::vector< ORCAD_SYMBOL_DEF > variants
Stale same-name cache entries (older library versions), in cache order, EXCLUDING this entry itself.
int generalFlags
LibraryPart GeneralProperties flags (-1 = absent); bit0 = pin numbers visible, bit2 = pin names hidde...
One pin of a symbol definition (structure types 26/27).
int position
slot in the parent symbol pin vector
ORCAD_PORT_TYPE portType
One wire or bus segment.
bool isBus
true for structure type 21
std::vector< ORCAD_ALIAS > aliases