KiCad PCB EDA Suite
Loading...
Searching...
No Matches
allegro_pcb_structs.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 Quilter
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include "string_any_map.h"
24
25
26#include <array>
27#include <concepts>
28#include <cstdint>
29#include <optional>
30#include <memory>
31#include <stdexcept>
32#include <string>
33#include <unordered_map>
34#include <variant>
35#include <vector>
36
37
38namespace ALLEGRO
39{
40
51{
52public:
53 BLOCK_BASE( uint8_t aBlockType, size_t aOffset ) :
54 m_blockType( aBlockType ),
55 m_offset( aOffset ),
56 m_Key( 0 ), // Key and next are set later, during parse
57 m_Next( 0 )
58 {
59 }
60
61 virtual ~BLOCK_BASE() = default;
62
68 uint8_t GetBlockType() const { return m_blockType; }
69 size_t GetOffset() const { return m_offset; }
70
71 // Unique object identifier for this block, or 0 if it has none.
72 uint32_t GetKey() const { return m_Key; }
73 // Object key of the next block in this block's primary linked-list, or 0.
74 uint32_t GetNext() const { return m_Next; }
75
76 void SetKey( uint32_t aKey ) { m_Key = aKey; }
77 void SetNext( uint32_t aNext ) { m_Next = aNext; }
78
79private:
80 uint8_t m_blockType;
81 size_t m_offset;
82 uint32_t m_Key;
83 uint32_t m_Next;
84};
85
86
90template <typename T>
91concept HAS_BLOCK_TYPE_CODE = requires
92{
93 T::BLOCK_TYPE_CODE;
94};
95
96
97template <typename T>
98class BLOCK : public BLOCK_BASE
99{
100public:
102 explicit BLOCK( size_t aOffset ) requires HAS_BLOCK_TYPE_CODE<T>
103 : BLOCK_BASE( T::BLOCK_TYPE_CODE, aOffset )
104 {
105 }
106
108 BLOCK( uint8_t aBlockType, size_t aOffset ) :
109 BLOCK_BASE( aBlockType, aOffset )
110 {
111 }
112
113 const T& GetData() const { return m_data; }
114 T& GetData() { return m_data; }
115
116private:
118};
119
120
131enum class FMT_VER
132{
134 V_PRE_V16, // Allegro versions before 16.0 (unsupported binary format)
135 V_160, // Allegro 16.0, 0x00130000
136 V_162, // Allegro 16.2 0x00130400, 0x00130500
137 V_164, // Allegro 16.4, 0x00130C00
138 V_165, // Allegro 16.5, 0x00131000
139 V_166, // Allegro 16.6, 0x00131500
140 V_172, // Allegro 17.2, 0x00140400
141 V_174, // Allegro 17.4, 0x00140900
142 V_175, // Allegro 17.5, 0x00141500
143 V_180, // Allegro 18.0, 0x00150000
144 V_181, // Allegro 18.1, 0x00150200
145 V_190, // Allegro 19.0, 0x00160100
146};
147
148constexpr bool operator>=( FMT_VER lhs, FMT_VER rhs )
149{
150 return static_cast<uint32_t>( lhs ) >= static_cast<uint32_t>( rhs );
151}
152
153
157template <typename P>
158concept FMT_VER_PREDICATE = requires( P p, FMT_VER v )
159{
160 { p( v ) }->std::convertible_to<bool>;
161};
162
163
168template <FMT_VER_PREDICATE auto Pred, typename T>
170{
171 using value_type = T;
172
173 static constexpr bool exists( FMT_VER aVer ) { return Pred( aVer ); }
174
175 // Access to the value (use std::optional-like semantics)
176 T& value() { return *m_Value; }
177 const T& value() const { return *m_Value; }
178 bool has_value() const { return m_Value.has_value(); }
179
180 const T& value_or( const T& aDefault ) const { return has_value() ? value() : aDefault; }
181
182 T& operator*() { return *m_Value; }
183 const T& operator*() const { return *m_Value; }
184
185 T* operator->() { return &m_Value.value(); }
186 const T* operator->() const { return &*m_Value; }
187
188 // Assignment operator
189 COND_FIELD& operator=( const T& aValue )
190 {
191 m_Value = aValue;
192 return *this;
193 }
194
195 COND_FIELD& operator=( T&& aValue )
196 {
197 m_Value = std::move( aValue );
198 return *this;
199 }
200
201private:
202 std::optional<T> m_Value;
203};
204
205
206// Predicate functors
207
208template <FMT_VER Min>
209struct VER_GE
210{
211 constexpr bool operator()( FMT_VER v ) const { return v >= Min; }
212};
213
214template <FMT_VER Max>
215struct VER_LT
216{
217 constexpr bool operator()( FMT_VER v ) const { return v < Max; }
218};
219
220template <FMT_VER Min, FMT_VER Max>
222{
223 constexpr bool operator()( FMT_VER v ) const { return v >= Min && v < Max; }
224};
225
226
227// Useful aliases for common cases
228
230template <FMT_VER Min, typename T>
232
234template <FMT_VER Max, typename T>
236
238template <FMT_VER Min, FMT_VER Max, typename T>
240
244template <typename T>
245concept VERSIONED_COND_FIELD = requires( FMT_VER v )
246{
247 { T::exists( v ) }->std::convertible_to<bool>;
248 typename T::value_type;
249};
250
251
253{
254 MILS = 0x01,
255 INCHES = 0x02,
259};
260
261
270{
272 {
273 uint32_t m_A;
275 };
276
283 {
284 uint32_t m_Tail;
285 uint32_t m_Head;
286 };
287
288 uint32_t m_Magic;
289
290 uint32_t m_Unknown1a; // 0x03
291 uint32_t m_FileRole; // 0x01 (.brd) or 0x02 (.dra) (?)
292 uint32_t m_Unknown1b; // 0x03
293 uint32_t m_WriterProgram; // 0x09 (Allegro) or 0x130000 (DB Doctor) (?)
294
296
297 uint32_t m_UnknownMagic; // This is always 0x000a0d0a?
298 uint32_t m_UnknownFlags; // This looks like flags: 0x01000000, 0x0400000, 0x06000000
299
300 // In this block of 7 uint32s, it seems they have very different meanings pre and post v18
301
302 // Pre v18, these are all unknown
303 // - 3 and 4 are the same.
304 // - 5 and 6 arer of a similar size
306
307 // V18
308 COND_GE<FMT_VER::V_180, uint32_t> m_Unknown2a_V18; // Looks like an 'end pointer' like 0x27_end
315
316 // V180 has 6 additional linked lists in the header
317 // 5 of them are at the start
323
324 // Linked lists grouping top-level elements by type
325 LINKED_LIST m_LL_0x04; // Net assignments
326 LINKED_LIST m_LL_0x06; // Component definitions
327 LINKED_LIST m_LL_0x0C; // Pin definitions
328 LINKED_LIST m_LL_Shapes; // Shape segments (0x0E) and shapes (0x28)
331 LINKED_LIST m_LL_0x1C; // Padstacks
332 LINKED_LIST m_LL_0x24_0x28; // Rects and shapes
334 LINKED_LIST m_LL_0x2B; // Footprint definitions
335 LINKED_LIST m_LL_0x03_0x30; // Fields (0x03) and string wrappers (0x30)
336 LINKED_LIST m_LL_0x0A; // DRC elements
337 LINKED_LIST m_LL_0x1D_0x1E_0x1F; // Constraint sets, SI models, padstack dims
341 LINKED_LIST m_LL_0x0C_2; // Secondary pin definitions
343
344 // For some reason the 0x35 extents are recorded in the header
347
351
354
356
358
360
362
364
365 // Fixed length string field
366 std::array<char, 60> m_AllegroVersion;
367
368 uint32_t m_Unknown4;
369
370 uint32_t m_MaxKey;
371
374
376 // 3 empty bytes here?
377
378 uint32_t m_Unknown6;
380
381 // The end of the 0x27 object(?)
382 // In V18, this is relocated to m_0x27_End_V18
384
385 uint32_t m_Unknown8;
386
388
389 std::array<uint32_t, 50> m_Unknown9;
390
391 uint32_t m_Unknown10a; // Often 0x000500FF
392 uint32_t m_Unknown10b; // Similar to 0xFFA60000
393 uint32_t m_Unknown10c; // Usually 0x01
394
395 // E.g. 1000 for mils
397
404 std::array<LAYER_MAP_ENTRY, 25> m_LayerMap;
405
406 uint32_t GetStringsCount() const
407 {
408 if( m_StringCount_V18.has_value() )
409 return m_StringCount_V18.value();
410
411 return m_StringCount_preV18.value();
412 }
413
414 uint32_t Get_0x27_End() const
415 {
416 if( m_0x27_End_V18.has_value() )
417 return m_0x27_End_V18.value();
418
419 return m_0x27_End_preV18.value();
420 }
421
423 {
424 if( m_LL_Unknown5_V18.has_value() )
425 return m_LL_Unknown5_V18.value();
426
427 return m_LL_Unknown5_preV18.value();
428 }
429};
430
431
433{
459
466 {
467 // BOARD_GEOMETRY
468 // BGEOM_PASTEMASK_BOTTOM = 0x??
469 // BGEOM_PASTEMASK_TOP = 0x??
490
491 // COMPONENT_VALUE / DEVICE_TYPE / USER_PART_NUMBER
492 // REF_DES / TOLERANCE
499
500 // ANALYSIS
507
508 // DRAWING_FORMAT
514
515 // PACKAGE_GEOMETRY
533
534 // MANUFACTURING
549
550 // CONSTRAINTS_REGION
551 CREG_ALL = 0xFD,
552
553 // PACKAGE_KEEPIN / ROUTE_KEEPIN
555
556 // PACKAGE_KEEPOUT / ROUTE_KEEPOUT / VIA_KEEPOUT
560 };
561
562 uint8_t m_Class;
563 uint8_t m_Subclass;
564
565 bool operator==( const LAYER_INFO& ) const = default;
566};
567
568
575{
576 static constexpr uint8_t BLOCK_TYPE_CODE = 0x01;
577
579 uint8_t m_SubType;
580 uint32_t m_Key;
581 uint32_t m_Next;
582 uint32_t m_Parent;
583 uint32_t m_Unknown1;
584
586
587 uint32_t m_Width;
588
589 int32_t m_StartX;
590 int32_t m_StartY;
591 int32_t m_EndX;
592 int32_t m_EndY;
593
594 double m_CenterX; // Center
595 double m_CenterY;
596 double m_Radius;
597
598 std::array<int32_t, 4> m_BoundingBoxCoords;
599};
600
601
607{
608 static constexpr uint8_t BLOCK_TYPE_CODE = 0x03;
609
610 struct SUB_0x6C
611 {
612 uint32_t m_NumEntries;
613 std::vector<uint32_t> m_Entries;
614 };
615
617 {
618 uint16_t m_X0;
619 uint16_t m_X1;
620 std::vector<uint32_t> m_Entries;
621 };
622
623 struct SUB_0xF6
624 {
625 std::array<uint32_t, 20> m_Entries;
626 };
627
628 uint16_t m_Hdr1;
629
630 uint32_t m_Key;
631 uint32_t m_Next;
632
633
635
636 uint8_t m_SubType;
637 uint8_t m_Hdr2;
638 uint16_t m_Size;
639
641
642 std::variant<uint32_t, std::array<uint32_t, 2>, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6> m_Substruct;
643};
644
660
661
668{
669 static constexpr uint8_t BLOCK_TYPE_CODE = 0x04;
670
671 uint8_t m_Type;
672 uint16_t m_R;
673 uint32_t m_Key;
674 uint32_t m_Next;
675 uint32_t m_Net;
676 uint32_t m_ConnItem;
677
679};
680
681
712
713
719{
720 static constexpr uint8_t BLOCK_TYPE_CODE = 0x06;
721
722 uint32_t m_Key;
723
724 // Pointer to the next BLK_0x06_COMPONENT
725 uint32_t m_Next;
726 // Pointer to COMP_DEVICE_TYPE string
728 // Pointer to SYM_NAME string
729 uint32_t m_SymbolName;
730 // Points to 0x07, first instance
732 // Points to 0x0F, function slot
734 // Points to 0x08, pin number
736
737 // Points to 0x03, first 'field'
738 uint32_t m_Fields;
739
741};
742
743
771
772
779{
780 static constexpr uint8_t BLOCK_TYPE_CODE = 0x08;
781
782 uint8_t m_Type;
783 uint16_t m_R;
784 uint32_t m_Key;
785
788
789 uint32_t m_Next;
790
792
794 uint32_t m_PinNamePtr;
795
797
798 uint32_t m_Ptr4;
799
800 uint32_t GetStrPtr() const
801 {
802 return m_StrPtr.value_or( m_StrPtr16x.value_or( 0 ) );
803 }
804};
805
806
812{
813 static constexpr uint8_t BLOCK_TYPE_CODE = 0x09;
814
815 uint32_t m_Key;
816
817 std::array<uint32_t, 4> m_UnknownArray;
818
820
823 uint32_t m_Unknown2;
826
828};
829
830
835{
836 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0A;
837
838 uint8_t m_T;
840 uint32_t m_Key;
841 uint32_t m_Next;
842 uint32_t m_Unknown1;
843
845
846 std::array<int32_t, 4> m_Coords;
847 std::array<uint32_t, 4> m_Unknown4;
848 std::array<uint32_t, 5> m_Unknown5;
849
851};
852
853
859{
860 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0C;
861
863 {
864 // These are in the same order as the pad shapes, at least for the 'simple' shapes
865 CIRCLE = 0x02,
866 OCTAGON = 0x03,
867 CROSS = 0x04,
868 SQUARE = 0x05,
869 RECTANGLE = 0x06,
870 DIAMOND = 0x07,
871 PENTAGON = 0x0a,
872 OBLONG_X = 0x0b,
873 OBLONG_Y = 0x0c,
874 HEXAGON_X = 0x0f,
875 HEXAGON_Y = 0x10,
876 TRIANGLE = 0x12,
877 };
878
879 uint8_t m_T;
881 uint32_t m_Key;
882 uint32_t m_Next;
883
884 uint32_t m_Unknown1;
885 uint32_t m_Unknown2;
886
890
894
895 uint32_t m_Unknown4;
896
898
899 std::array<int32_t, 2> m_Coords;
900 std::array<int32_t, 2> m_Size;
901
902 uint32_t m_GroupPtr;
903 uint32_t m_Unknown6;
904 uint32_t m_Unknown7;
905
907
908 uint32_t GetShape() const
909 {
910 return m_Shape16x.value_or( m_Shape.value_or( 0 ) );
911 }
912};
913
914
921{
922 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0D;
923
924 uint32_t m_Key;
925 uint32_t m_NameStrId;
926 uint32_t m_Next;
927
929
930 int32_t m_CoordsX;
931 int32_t m_CoordsY;
932
933 uint32_t m_PadStack;
934 uint32_t m_Unknown2;
935
937
938 uint32_t m_Flags;
939 uint32_t m_Rotation;
940};
941
942
947{
948 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0E;
949
950 uint8_t m_T;
952 uint32_t m_Key;
953 uint32_t m_Next;
954 uint32_t m_FpPtr;
955
956 uint32_t m_Unknown1;
957 uint32_t m_Unknown2;
958 uint32_t m_Unknown3;
959
962
963 std::array<int32_t, 4> m_Coords;
964
965 std::array<uint32_t, 3> m_UnknownArr;
967 uint32_t m_Rotation;
968};
969
970
977{
978 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0F;
979
980 uint32_t m_Key;
981
982 uint32_t m_SlotName;
983
985
986 std::array<char, 32> m_CompDeviceType;
987
989
991
992 uint32_t m_Ptr0x06;
993 uint32_t m_Ptr0x11;
994
995 uint32_t m_Unknown2;
996
997 std::string GetCompDeviceTypeStr() const
998 {
999 // The string is stored as a fixed-length array, but is null-terminated
1000 return std::string( m_CompDeviceType.data(), strnlen( m_CompDeviceType.data(), m_CompDeviceType.size() ) );
1001 }
1002};
1003
1004
1011{
1012 static constexpr uint8_t BLOCK_TYPE_CODE = 0x10;
1013
1014 uint32_t m_Key;
1015
1017
1019
1021
1022 uint32_t m_PtrX12;
1023 uint32_t m_Unknown3;
1025 uint32_t m_Slots; // 0x0F?
1026 uint32_t m_Fields; // Presumably a pointer to a string
1027};
1028
1029
1035{
1036 static constexpr uint8_t BLOCK_TYPE_CODE = 0x11;
1037
1038 uint8_t m_Type;
1039 uint16_t m_R;
1040 uint32_t m_Key;
1044 uint32_t m_Next;
1047 uint32_t m_Unknown1;
1048
1050};
1051
1052
1058{
1059 static constexpr uint8_t BLOCK_TYPE_CODE = 0x12;
1060
1061 uint8_t m_Type;
1062 uint16_t m_R;
1063 uint32_t m_Key;
1064 uint32_t m_Ptr1;
1065 uint32_t m_Ptr2;
1066 uint32_t m_Ptr3;
1067 uint32_t m_Unknown1;
1068
1071};
1072
1073
1080{
1081 static constexpr uint8_t BLOCK_TYPE_CODE = 0x14;
1082
1083 uint8_t m_Type;
1085 uint32_t m_Key;
1086 uint32_t m_Next;
1087 uint32_t m_Parent;
1088 uint32_t m_Flags;
1089
1091
1093 uint32_t m_Ptr0x03;
1094 uint32_t m_Ptr0x26;
1095};
1096
1097
1106{
1107 // Segments can be one of 3 codes, so we don't have a BLOCK_TYPE_CODE constant
1108 // for this struct.
1109
1110 uint32_t m_Key;
1111 uint32_t m_Next;
1112 uint32_t m_Parent;
1113 uint32_t m_Flags;
1114
1116
1117 uint32_t m_Width;
1118
1119 int32_t m_StartX;
1120 int32_t m_StartY;
1121 int32_t m_EndX;
1122 int32_t m_EndY;
1123};
1124
1131{
1132 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1B;
1133
1134 uint32_t m_Key;
1135 uint32_t m_Next;
1136 uint32_t m_NetName;
1137
1138 uint32_t m_Unknown1;
1139
1141
1142 uint32_t m_Type;
1143
1145 uint32_t m_Ratline;
1147 uint32_t m_FieldsPtr;
1149 uint32_t m_ModelPtr;
1153};
1154
1155
1169
1170
1176{
1200
1201 uint8_t m_Type;
1205
1207
1208 // Pad size
1209 int32_t m_W;
1210 int32_t m_H;
1211
1212 // In rounded rectangles, this is the corner radius.
1213 // In chamfered rectangles, this is the chamfer size.
1215
1216 // This is the pad component offset
1217 int32_t m_OffsetX;
1218 int32_t m_OffsetY;
1219
1226 uint32_t m_ShapePtr;
1227
1228 // In versions < 17.2, seems to be not present in the last entry.
1229 std::optional<uint32_t> m_Z2;
1230};
1231
1232
1241{
1242 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1C;
1243
1245 {
1250 {
1252 // NPTHs seem to have this instead of 0x01
1253 // SMDs seems to have this or 0x01, no clear pattern identified
1255 };
1256
1257 uint32_t m_DrillSize;
1261 // Not sure these are in the right place but they're in here somewhere (usually zero)
1264
1265 // Drill char presumably somewhere in here - can cross-match with 0x0C PIN_DEF to find
1267 // Mask or enum of pad flags, including plating
1268 uint8_t m_Flags;
1269 // An ASCII char, or 0x00
1271 uint8_t m_D;
1272
1273 // Probably some kind of type:
1274 // 0x0000 for through-hole
1275 // 0x0002 for SMD
1276 // 0x0400 for slots
1277 uint16_t m_Unknown_1;
1278
1279 uint16_t m_ArrayNX;
1280 uint16_t m_ArrayNY;
1281
1283 // Also unsure if these are in the right place (all usually 0?)
1286
1289 uint32_t m_Unknown_2;
1290 uint32_t m_SlotX;
1291 uint32_t m_SlotY;
1292 uint32_t m_Unknown_3;
1293
1295 };
1296
1298 {
1303 {
1304 // Some through-holes have this, some don't
1307 };
1308
1309 // Presumably the same as the one in the v16x header
1311 uint32_t m_Unknown1; // 0?
1312 uint32_t m_Unknown2; // 0?
1313
1315
1316 // Not sure if this is really a substruct
1317 uint8_t m_A; // Only lower 4 bits (top 4 are type)
1318 uint8_t m_B;
1320 uint8_t m_Flags;
1321 uint8_t m_D;
1322
1323 uint32_t m_unknown3; // 1?
1324 uint32_t m_Unknown4; // 0?
1325
1326 uint16_t m_ArrayNX;
1327 uint16_t m_ArrayNY;
1329 uint16_t m_Unknown5; // 0?
1330
1331 // Again, these are tentatively placed, they're always zero so far,
1332 // so it's hard to say where they go.
1333 // Assuming they follow the v16x layout and come after the layer count
1336 uint32_t m_Unknown6a;
1337 uint32_t m_Unknown6b;
1338
1339 uint32_t m_DrillSize;
1342 uint32_t m_SlotX;
1343 uint32_t m_SlotY;
1344 uint32_t m_ToleranceTravelPos; // "TOLERANCE_TRAVEL" in BeagleBone_Black drill table
1346
1350 uint32_t m_DrillChars; // Presumably 4 drill chars
1351
1352 // Probably holds secondary drill parameters and other new V17.2 features
1353 std::array<uint32_t, 21> m_UnknownArr3;
1354
1355 // To check - this could be another component?
1357 };
1358
1360
1364 uint8_t m_N;
1366 uint32_t m_Key;
1367 uint32_t m_Next;
1368
1369 // The name of the padstack
1370 uint32_t m_PadStr;
1371
1372 // The header fields are very different between v16x and v17.x+
1373 using HEADER = std::variant<HEADER_v16x, HEADER_v17x>;
1375
1418
1424 {
1425 // First slot: Antipad
1427 // Thermal relief shape
1429 // Pad shape
1430 PAD = 2,
1431 // Unsure what this layer component slot is
1432 // But I suspect it's keepout, as that was added in V172.
1434 };
1435
1448 std::vector<PADSTACK_COMPONENT> m_Components;
1449
1455
1462 std::vector<uint32_t> m_UnknownArrN;
1463
1464
1465 // Dispatch common properties to the header variant.
1466 // Each method uses a local Visitor struct so that adding a new HEADER alternative
1467 // produces a compile error rather than a silent runtime fallback.
1468 uint32_t GetDrillSize() const
1469 {
1470 struct Visitor
1471 {
1472 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_DrillSize; }
1473 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_DrillSize; }
1474 };
1475 return std::visit( Visitor{}, m_Header );
1476 }
1477
1478 uint32_t GetLayerCount() const
1479 {
1480 struct Visitor
1481 {
1482 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_LayerCount; }
1483 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_LayerCount; }
1484 };
1485 return std::visit( Visitor{}, m_Header );
1486 }
1487
1488 bool IsPlated() const
1489 {
1490 struct Visitor
1491 {
1492 bool operator()( const HEADER_v16x& h ) const
1493 {
1494 return ( h.m_Flags & HEADER_v16x::PAD_FLAGS::FLAG_PLATED ) != 0;
1495 }
1496 bool operator()( const HEADER_v17x& h ) const
1497 {
1498 return ( h.m_Flags & HEADER_v17x::PAD_FLAGS::FLAG_PLATED ) != 0;
1499 }
1500 };
1501 return std::visit( Visitor{}, m_Header );
1502 }
1503};
1504
1505
1510{
1511 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1D;
1512
1513 uint32_t m_Key;
1514 uint32_t m_Next;
1515 uint32_t m_NameStrKey;
1516 uint32_t m_FieldPtr;
1517 uint16_t m_SizeA;
1518 uint16_t m_SizeB;
1519
1525 std::vector<std::array<uint8_t, 56>> m_DataB;
1530 std::vector<std::array<uint8_t, 256>> m_DataA;
1531
1533};
1534
1535
1541{
1542 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1E;
1543
1544 uint8_t m_Type;
1545 uint16_t m_T2;
1546 uint32_t m_Key;
1547 uint32_t m_Next;
1548
1549 // Present in 16.2 (TWR-MCF51JG LAY-26493) and Kinoma (V_164); no 16.0 sample yet
1552
1553 uint32_t m_StrPtr;
1554 uint32_t m_Size;
1555
1556 std::string m_String;
1557
1559};
1560
1561
1566{
1567 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1F;
1568
1569 uint32_t m_Key;
1570 uint32_t m_Next;
1571 uint32_t m_Unknown2;
1572 uint32_t m_Unknown3;
1573 uint32_t m_Unknown4;
1574 uint16_t m_Unknown5;
1575 uint16_t m_Size;
1576
1580 std::vector<uint8_t> m_Substruct;
1581};
1582
1583
1595{
1596 static constexpr uint8_t BLOCK_TYPE_CODE = 0x20;
1597
1598 uint8_t m_Type;
1599 uint16_t m_R;
1600 uint32_t m_Key;
1601 uint32_t m_Next;
1602 std::array<uint32_t, 7> m_UnknownArray1;
1603
1605};
1606
1613{
1614 static constexpr uint8_t BLOCK_TYPE_CODE = 0x21;
1615
1616 uint8_t m_Type;
1617 uint16_t m_R;
1618 uint32_t m_Size;
1619 uint32_t m_Key;
1620
1626 std::vector<uint8_t> m_Data;
1627};
1628
1629
1634{
1635 static constexpr uint8_t BLOCK_TYPE_CODE = 0x22;
1636
1637 uint8_t m_Type;
1638 uint16_t m_T2;
1639 uint32_t m_Key;
1640
1642
1643 std::array<uint32_t, 8> m_UnknownArray;
1644};
1645
1646
1651{
1652 static constexpr uint8_t BLOCK_TYPE_CODE = 0x23;
1653
1654 uint8_t m_Type;
1656 uint32_t m_Key;
1657 uint32_t m_Next;
1658
1659 std::array<uint32_t, 2> m_Flags;
1660
1661 uint32_t m_Ptr1;
1662 uint32_t m_Ptr2;
1663 uint32_t m_Ptr3;
1664
1665 std::array<int32_t, 5> m_Coords;
1666
1667 std::array<uint32_t, 4> m_Unknown1;
1668
1670
1672};
1673
1674
1682{
1683 static constexpr uint8_t BLOCK_TYPE_CODE = 0x24;
1684
1685 uint8_t m_Type;
1687 uint32_t m_Key;
1688 uint32_t m_Next;
1689 uint32_t m_Parent;
1690 uint32_t m_Unknown1;
1691
1693
1694 std::array<int32_t, 4> m_Coords;
1695
1696 uint32_t m_Ptr2;
1697
1698 uint32_t m_Unknown3;
1699 uint32_t m_Unknown4;
1701 uint32_t m_Rotation;
1702};
1703
1704
1710{
1711 static constexpr uint8_t BLOCK_TYPE_CODE = 0x26;
1712
1713 uint8_t m_Type;
1714 uint16_t m_R;
1715 uint32_t m_Key;
1716 uint32_t m_MemberPtr;
1717
1719
1720 uint32_t m_GroupPtr;
1721 uint32_t m_ConstPtr;
1722
1724};
1725
1726
1736{
1737 static constexpr uint8_t BLOCK_TYPE_CODE = 0x27;
1738
1739 std::vector<uint32_t> m_Refs;
1740};
1741
1742
1753{
1754 static constexpr uint8_t BLOCK_TYPE_CODE = 0x28;
1755
1756 uint8_t m_Type;
1758 uint32_t m_Key;
1759 uint32_t m_Next;
1760 uint32_t m_Ptr1;
1761 uint32_t m_Unknown1;
1762
1765
1766 uint32_t m_Ptr2;
1767 uint32_t m_Ptr3;
1770 uint32_t m_Unknown4;
1771 uint32_t m_Unknown5;
1772
1774
1775 uint32_t m_Ptr6;
1776
1778
1779 std::array<int32_t, 4> m_Coords;
1780
1781 uint32_t GetTablePtr() const
1782 {
1783 return m_TablePtr.value_or( m_TablePtr_16x.value_or( 0 ) );
1784 }
1785};
1786
1787
1794{
1795 static constexpr uint8_t BLOCK_TYPE_CODE = 0x29;
1796
1797 uint8_t m_Type;
1798 uint16_t m_T;
1799 uint32_t m_Key;
1800
1801 // Points to something in the header
1802 uint32_t m_Ptr1;
1803 uint32_t m_Ptr2;
1804
1805 uint32_t m_Null; // Null value
1806
1807 uint32_t m_Ptr3;
1808
1809 int32_t m_Coord1;
1810 int32_t m_Coord2;
1811
1813
1814 uint32_t m_Unknown1;
1815
1816 // Pointer to a string, e.g., "2" in R0603
1817 uint32_t m_PtrX30;
1818
1819 uint32_t m_Unknown2;
1820 uint32_t m_Unknown3;
1821 uint32_t m_Unknown4;
1822};
1823
1824
1853
1854
1862{
1863 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2B;
1864
1865 uint32_t m_Key;
1866
1867 uint32_t m_FpStrRef;
1868 uint32_t m_Unknown1;
1869
1870 // Could these be signed?
1871 std::array<uint32_t, 4> m_Coords;
1872
1873 uint32_t m_Next;
1878
1880 uint32_t m_FieldsPtr;
1881
1885
1888};
1889
1890
1948
1949
1958{
1959 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2D;
1960
1962 uint8_t m_Layer; // 0 = top (F_Cu), 1 = bottom (B_Cu)
1964
1965 uint32_t m_Key;
1966
1967 uint32_t m_Next;
1968
1970
1971 // Unsure what 16x means
1973
1974 uint16_t m_Unknown2;
1975 uint16_t m_Unknown3;
1976
1978
1979 uint32_t m_Flags;
1980
1981 uint32_t m_Rotation;
1982 int32_t m_CoordX;
1983 int32_t m_CoordY;
1984
1985 // Presumably equivalent to m_InstRef16x
1987
1990 uint32_t m_TextPtr; // Points to 0x30
1991
1993 uint32_t m_AreasPtr;
1996
1997 uint32_t GetInstRef() const
1998 {
1999 return m_InstRef.value_or( m_InstRef16x.value_or( 0 ) );
2000 }
2001};
2002
2003
2009{
2010 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2E;
2011
2012 uint8_t m_Type;
2013 uint16_t m_T2;
2014 uint32_t m_Key;
2015 uint32_t m_Next;
2017 uint32_t m_Unknown1;
2018 int32_t m_CoordX;
2019 int32_t m_CoordY;
2021 uint32_t m_Unknown2;
2022
2024};
2025
2026
2031{
2032 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2F;
2033
2034 uint8_t m_Type;
2035 uint16_t m_T2;
2036 uint32_t m_Key;
2037
2038 std::array<uint32_t, 6> m_UnknownArray;
2039};
2040
2041
2109
2110
2116{
2117 static constexpr uint8_t BLOCK_TYPE_CODE = 0x31;
2118
2130
2131 uint8_t m_T;
2133 uint32_t m_Key;
2135
2136 int32_t m_CoordsX;
2137 int32_t m_CoordsY;
2138
2139 uint16_t m_Unknown;
2140 uint16_t m_Len;
2141
2143
2144 std::string m_Value;
2145};
2146
2147
2154{
2155 static constexpr uint8_t BLOCK_TYPE_CODE = 0x32;
2156
2157 uint8_t m_Type;
2159 uint32_t m_Key;
2160 uint32_t m_Next;
2161 uint32_t m_NetPtr;
2162 uint32_t m_Flags;
2163
2165
2166 uint32_t m_NextInFp;
2167 uint32_t m_ParentFp;
2168 uint32_t m_Track;
2169 uint32_t m_PadPtr;
2170 uint32_t m_Ptr6;
2171 uint32_t m_Ratline;
2174
2176
2177 uint32_t m_NameText;
2178 uint32_t m_Ptr11;
2179
2180 std::array<int32_t, 4> m_Coords;
2181};
2182
2183
2190{
2191 static constexpr uint8_t BLOCK_TYPE_CODE = 0x33;
2192
2194 uint32_t m_Key;
2195 uint32_t m_Next;
2196 uint32_t m_NetPtr;
2197 uint32_t m_Unknown2;
2198
2200
2202
2204
2205 int32_t m_CoordsX;
2206 int32_t m_CoordsY;
2207
2209 uint32_t m_Padstack;
2212
2213 uint32_t m_Unknown4;
2214 uint32_t m_Unknown5;
2215
2216 std::array<int32_t, 4> m_BoundingBoxCoords;
2217};
2218
2219
2224{
2225 static constexpr uint8_t BLOCK_TYPE_CODE = 0x34;
2226
2227 uint8_t m_T;
2229 uint32_t m_Key;
2230 uint32_t m_Next;
2231 uint32_t m_Ptr1;
2232
2234
2235 uint32_t m_Flags;
2237 uint32_t m_Ptr3;
2238 uint32_t m_Unknown2;
2239};
2240
2241
2247{
2248 static constexpr uint8_t BLOCK_TYPE_CODE = 0x35;
2249
2250 uint8_t m_T2;
2251 uint16_t m_T3;
2252
2253 std::array<uint8_t, 120> m_Content;
2254};
2255
2256
2263{
2264 static constexpr uint8_t BLOCK_TYPE_CODE = 0x36;
2265
2266 uint16_t m_Code;
2267 uint32_t m_Key;
2268 uint32_t m_Next;
2269
2271
2272 uint32_t m_NumItems;
2273 uint32_t m_Count;
2274 uint32_t m_LastIdx;
2275 uint32_t m_Unknown2;
2276
2278
2287
2294
2295 struct X05
2296 {
2297 std::array<uint8_t, 28> m_Unknown;
2298
2299 // The trailing word first appears in 17.5. On 17.4 the record is 28 bytes, and
2300 // reading a phantom word here overruns every slot and desyncs the object stream.
2302 };
2303
2304 struct X06
2305 {
2306 uint16_t m_N;
2307 uint8_t m_R;
2308 uint8_t m_S;
2309 uint32_t m_Unknown1;
2310
2312 };
2313
2330
2331 struct X0B
2332 {
2333 std::array<uint8_t, 1016> m_Unknown;
2334 };
2335
2336 struct X0C
2337 {
2338 std::array<uint8_t, 232> m_Unknown;
2339 };
2340
2341 struct X0D
2342 {
2343 std::array<uint8_t, 200> m_Unknown;
2344 };
2345
2346 struct X0F
2347 {
2348 uint32_t m_Key;
2349 std::array<uint32_t, 3> m_Ptrs;
2350 uint32_t m_Ptr2;
2351 };
2352
2353 struct X10
2354 {
2355 std::array<uint8_t, 108> m_Unknown;
2356
2357 // V18 has an extra uint32 "somewhere" in this block
2359 };
2360
2361 // So far only seen in a V175 file (Jetson)
2362 struct X12
2363 {
2364 // No point reading this before we can use it
2365 // std::array<uint8_t, 1052> m_Unknown;
2366 };
2367
2368 using SubstructVariant = std::variant<X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10, X12>;
2369
2370 std::vector<SubstructVariant> m_Items;
2371};
2372
2373
2380{
2381 static constexpr uint8_t BLOCK_TYPE_CODE = 0x37;
2382
2383 uint8_t m_T;
2384 uint16_t m_T2;
2385 uint32_t m_Key;
2386 uint32_t m_GroupPtr;
2387 uint32_t m_Next;
2388 uint32_t m_Capacity;
2389 uint32_t m_Count;
2390 uint32_t m_Unknown2;
2391
2393
2394 std::array<uint32_t, 100> m_Ptrs;
2395};
2396
2397
2418
2419
2424{
2425 static constexpr uint8_t BLOCK_TYPE_CODE = 0x39;
2426
2427 uint32_t m_Key;
2428 uint32_t m_Parent;
2429 uint32_t m_Head;
2430
2431 // Array of 22 uint16_t values
2432 std::array<uint16_t, 22> m_X;
2433};
2434
2435
2440{
2441 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3A;
2442
2444 uint32_t m_Key;
2445 uint32_t m_Next;
2446 uint32_t m_Unknown;
2447
2449};
2450
2451
2457{
2458 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3B;
2459
2460 uint8_t m_T;
2461 uint16_t m_SubType;
2462 uint32_t m_Len;
2463
2464 std::string m_Name;
2465 std::string m_Type;
2466
2467 uint32_t m_Unknown1;
2468 uint32_t m_Unknown2;
2469
2471
2472 std::string m_Value;
2473};
2474
2475
2481{
2482 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3E;
2483
2484 uint32_t m_Key;
2485 std::array<uint32_t, 9> m_Unknown;
2486};
2487
2488
2490{
2491 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3C;
2492
2493 uint8_t m_T;
2494 uint16_t m_T2;
2495 uint32_t m_Key;
2496
2498
2500 std::vector<uint32_t> m_Entries;
2501};
2502
2503
2510template <typename T>
2511concept ALLEGRO_BLOCK_DATA = requires
2512{
2513 { T::BLOCK_TYPE_CODE }->std::convertible_to<uint8_t>;
2514}
2515|| std::is_same_v<T, BLK_0x15_16_17_SEGMENT>;
2516
2517
2518} // namespace ALLEGRO
void SetNext(uint32_t aNext)
uint32_t GetKey() const
virtual ~BLOCK_BASE()=default
uint8_t GetBlockType() const
This is the actual type code as read from the file.
uint32_t GetNext() const
BLOCK_BASE(uint8_t aBlockType, size_t aOffset)
void SetKey(uint32_t aKey)
BLOCK(uint8_t aBlockType, size_t aOffset)
Explicit type code for multi-code types (e.g. segments 0x15/0x16/0x17)
BLOCK(size_t aOffset)
Deduce the type code from T::BLOCK_TYPE_CODE (single-code types only)
const T & GetData() const
Satisfied by any Allegro block data structs that can be used with BLOCK_REF.
A constexpr predicate that decides whether a field exists for a given FMT_VER.
Concept that is statisfied by any struct that has a block tpye code.
Satisfied by any COND_FIELD instantiation (COND_GE, COND_LT, COND_GE_LT, ...)
COND_FIELD< VER_GE< Min >{}, T > COND_GE
Exists for all versions greater than or equal to Min.
COND_FIELD< VER_LT< Max >{}, T > COND_LT
Exists for all versions less than (and not equal to) Max.
FIELD_KEYS
Hdr1 keys for field roles.
@ MODEL_3D_PLACEMENT
3D model units, XYZ offset and XYZ rotation
@ MODEL_3D_FILE
3D model file name, size, mtime and display colour
@ PHYS_CONSTRAINT_SET
Physical Constraint Set assignment.
@ NET_SCHEDULE
Net class/schedule assignment.
PAD_TYPE
The type of the padstack.
constexpr bool operator>=(FMT_VER lhs, FMT_VER rhs)
FMT_VER
The format of an Allegro file.
COND_FIELD< VER_GE_LT< Min, Max >{}, T > COND_GE_LT
Exists for all versions greater than or equal to Min and less than Max.
Arc segment used in tracks, zone outlines, and shape boundaries.
std::array< int32_t, 4 > m_BoundingBoxCoords
uint8_t m_SubType
Bit 6 (0x40) = clockwise direction.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown6
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 20 > m_Entries
Field/property references with variable-typed substructs.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
static constexpr uint8_t BLOCK_TYPE_CODE
std::variant< uint32_t, std::array< uint32_t, 2 >, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6 > m_Substruct
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
Net assignment linking a net (0x1B) to its member objects.
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
Track segment container.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5b
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5a
static constexpr uint8_t BLOCK_TYPE_CODE
Component/symbol definitions.
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
Component instance reference data.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_UnknownPtr1
Pin number within a component.
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Previous
COND_LT< FMT_VER::V_172, uint32_t > m_StrPtr16x
COND_GE< FMT_VER::V_172, uint32_t > m_StrPtr
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
uint32_t m_PinNamePtr
Pointer to 0x11 PIN_NAME object.
0x0A objects represent DRC (Design Rule Check) elements.
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 4 > m_Unknown4
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown6
std::array< uint32_t, 5 > m_Unknown5
Pin definition with shape type, drill character, coordinates, and size.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown_16x
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown5
COND_LT< FMT_VER::V_172, uint8_t > m_DrillChar
COND_GE_LT< FMT_VER::V_174, FMT_VER::V_180, uint32_t > m_Unknown8
COND_LT< FMT_VER::V_172, uint8_t > m_Shape
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< int32_t, 2 > m_Size
COND_GE< FMT_VER::V_172, uint32_t > m_DrillChars
COND_GE< FMT_VER::V_172, uint32_t > m_Shape16x
std::array< int32_t, 2 > m_Coords
COND_LT< FMT_VER::V_172, uint16_t > m_UnknownPadding
Pad geometry and placement in board-absolute coordinates.
static constexpr uint8_t BLOCK_TYPE_CODE
uint32_t m_Rotation
Board-absolute millidegrees. Subtract footprint rotation for FP-local orientation.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
int32_t m_CoordsX
Board coordinates. Use SetFPRelativePosition() for KiCad FP-local space.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
int32_t m_CoordsY
Board coordinates. Use SetFPRelativePosition() for KiCad FP-local space.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown5
std::array< uint32_t, 3 > m_UnknownArr
uint32_t m_Rotation
Rotation in millidegrees.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< int32_t, 4 > m_Coords
Function slot in a multi-slot component (e.g.
COND_GE< FMT_VER::V_172, uint32_t > m_Next
std::array< char, 32 > m_CompDeviceType
COND_GE< FMT_VER::V_190, uint32_t > m_CompDeviceTypePtr
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
static constexpr uint8_t BLOCK_TYPE_CODE
Function instance linking a component instance (0x07) to its schematic function, pin cross-references...
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
static constexpr uint8_t BLOCK_TYPE_CODE
Pin name within a component, linked from function slots (0x0F).
uint32_t m_PinNameStrPtr
Pointer to pin name string.
uint32_t m_PinNumberPtr
Pointer to 0x08 PIN_NUMBER object.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
uint32_t m_Next
Pointer to next 0x11 PIN_NAME object or 0x0F SLOT.
static constexpr uint8_t BLOCK_TYPE_CODE
Cross-reference between objects.
COND_GE< FMT_VER::V_165, uint32_t > m_Unknown2
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
Graphics container holding a chain of line segments and arcs.
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
0x15 , 0x16, 0x17 are segments:
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
0x1B objects are nets.
uint32_t m_FieldsPtr
Pointer to first 0x03 FIELD object or null.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
static constexpr uint8_t BLOCK_TYPE_CODE
uint32_t m_MatchGroupPtr
Diff pair / match group pointer (0x26 or 0x2C)
PAD_FLAGS
Pad flags are founds in a byte of the pad info.
COND_GE< FMT_VER::V_165, uint32_t > m_Unknown_4
COND_GE< FMT_VER::V_180, std::array< uint32_t, 8 > > m_UnknownArr_v180
uint8_t m_Flags
Mask of PAD_FLAGS values.
PAD_FLAGS
Pad flags are founds in a byte of the pad info.
Padstack definition containing drill dimensions and a table of per-layer pad/antipad/thermal componen...
std::variant< HEADER_v16x, HEADER_v17x > HEADER
LAYER_COMP_SLOT
Component table layer offsets In the component table's layer section, each layer has 3 or 4 slots,...
static constexpr uint8_t BLOCK_TYPE_CODE
std::vector< uint32_t > m_UnknownArrN
Some structure of m_N * 8 or 10:
size_t m_NumFixedCompEntries
How many of the entries are fixed roles (after this is n*layers)
uint8_t m_N
The number of something.
std::vector< PADSTACK_COMPONENT > m_Components
Collection of components that make up the padstack.
SLOTS
Fixed slot indices in the component table.
Physical constraint sets containing trace width, clearance, and routing rules.
static constexpr uint8_t BLOCK_TYPE_CODE
uint32_t m_FieldPtr
Pointer to 0x03 FIELD with CS name (fallback when m_NameStrKey fails)
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
uint32_t m_NameStrKey
String table key for constraint set name.
std::vector< std::array< uint8_t, 256 > > m_DataA
Records contain ASCII padstack/via name strings (null-terminated at offset 4) and file path reference...
std::vector< std::array< uint8_t, 56 > > m_DataB
Per-copper-layer dimension values, 14 x int32 per record.
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
Signal integrity and simulation model data (IBIS netlists).
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_162, uint16_t > m_Unknown3
COND_GE< FMT_VER::V_162, uint16_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
Per-padstack dimension records with name and value.
std::vector< uint8_t > m_Substruct
Version-dependent substruct holding padstack dimension name and value.
static constexpr uint8_t BLOCK_TYPE_CODE
uint32_t m_Next
Linked list next pointer (used by LL_WALKER)
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, std::array< uint32_t, 10 > > m_UnknownArray2
std::array< uint32_t, 7 > m_UnknownArray1
Headered data blob containing structured board data such as layer stackup definitions,...
static constexpr uint8_t BLOCK_TYPE_CODE
std::vector< uint8_t > m_Data
An array of bytes that seems to be a variable length.
Purpose not determined.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 8 > m_UnknownArray
0x23 objects represent ratlines.
COND_GE< FMT_VER::V_164, std::array< uint32_t, 4 > > m_Unknown2
std::array< uint32_t, 4 > m_Unknown1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 2 > m_Flags
std::array< int32_t, 5 > m_Coords
Rectangle defined by four coordinates.
uint32_t m_Rotation
Rotation in millidegrees.
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
Match group indirection for differential pairs and match groups.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
uint32_t m_ConstPtr
Points to timing/delay constraints (field type 0x63), not physical constraints.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
static constexpr uint8_t BLOCK_TYPE_CODE
Serialized Constraint Manager database containing secondary name table (V172+), material stackup,...
static constexpr uint8_t BLOCK_TYPE_CODE
Polygon shape defined by a linked list of segments starting at m_FirstSegmentPtr (0x15/0x16/0x17 line...
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
std::array< int32_t, 4 > m_Coords
COND_LT< FMT_VER::V_172, uint32_t > m_TablePtr_16x
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_TablePtr
0x29 objects may represent pins in .dra files.
static constexpr uint8_t BLOCK_TYPE_CODE
std::string m_Name
uint32_t m_Properties
uint32_t m_Unknown
uint32_t mLayerNameId
Represents a list of layers.
COND_GE< FMT_VER::V_165, std::vector< REF_ENTRY > > m_RefEntries
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
COND_LT< FMT_VER::V_165, std::vector< NONREF_ENTRY > > m_NonRefEntries
Footprint definition (template) shared by multiple placed instances.
static constexpr uint8_t BLOCK_TYPE_CODE
uint32_t m_FieldsPtr
Pointer to first 0x03 FIELD object or null.
COND_GE< FMT_VER::V_164, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
std::array< uint32_t, 4 > m_Coords
Lookup table used for named associations.
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
SUBTYPE
The subtype of a table.
@ SUBTYPE_0x102
Some kind of net match group.
@ SUBTYPE_GRAPHICAL_GROUP
Used for drill charts and x-section charts.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
Placed footprint instance on the board.
uint32_t m_Rotation
Millidegrees (divide by 1000 for degrees)
COND_LT< FMT_VER::V_172, uint32_t > m_InstRef16x
COND_GE< FMT_VER::V_172, uint32_t > m_InstRef
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown4
Connection point at a track junction or pad-to-track transition.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
static constexpr uint8_t BLOCK_TYPE_CODE
Purpose not determined.
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 6 > m_UnknownArray
Text object with position, rotation, layer, font properties, and alignment.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, TEXT_PROPERTIES > m_Font
COND_LT< FMT_VER::V_172, uint32_t > m_PtrGroup_16x
COND_GE< FMT_VER::V_172, uint32_t > m_PtrGroup_17x
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, uint32_t > m_Ptr2
COND_LT< FMT_VER::V_172, uint32_t > m_Unknown4
COND_GE< FMT_VER::V_172, uint32_t > m_Ptr1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_LT< FMT_VER::V_172, TEXT_PROPERTIES > m_Font16x
static constexpr uint8_t BLOCK_TYPE_CODE
String graphic content holding the actual text value and its display layer category.
COND_GE< FMT_VER::V_174, uint32_t > m_Un2
static constexpr uint8_t BLOCK_TYPE_CODE
Placed pad instance linking a pad definition (0x0D via m_PadPtr) to its parent footprint (m_ParentFp)...
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown2
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< int32_t, 4 > m_Coords
COND_GE< FMT_VER::V_172, uint32_t > m_Prev
Via instance with board position, padstack reference (m_Padstack for drill/annular ring definitions),...
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_UnknownPtr2
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< int32_t, 4 > m_BoundingBoxCoords
0x34 objects represent keepouts.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
static constexpr uint8_t BLOCK_TYPE_CODE
File path references to Allegro log and report files (terminator.log, eclrpt.txt).
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint8_t, 120 > m_Content
COND_GE< FMT_VER::V_172, std::array< uint32_t, 8 > > m_Ys
COND_GE_LT< FMT_VER::V_174, FMT_VER::V_190, uint32_t > m_Unknown2
COND_GE< FMT_VER::V_172, std::array< uint32_t, 2 > > m_Zs
COND_GE< FMT_VER::V_164, std::array< uint32_t, 3 > > m_Ys
COND_GE< FMT_VER::V_172, std::string > m_Str
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
COND_LT< FMT_VER::V_172, std::string > m_Str16x
std::array< uint8_t, 28 > m_Unknown
COND_GE< FMT_VER::V_175, uint32_t > m_Unknown2
COND_LT< FMT_VER::V_172, std::array< uint32_t, 50 > > m_Unknown2
std::array< uint8_t, 1016 > m_Unknown
std::array< uint8_t, 232 > m_Unknown
std::array< uint8_t, 200 > m_Unknown
std::array< uint8_t, 108 > m_Unknown
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2
Heterogeneous definition table containing font metrics (FontDef_X08), layer name definitions (X03),...
std::variant< X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10, X12 > SubstructVariant
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
std::vector< SubstructVariant > m_Items
static constexpr uint8_t BLOCK_TYPE_CODE
Fixed-capacity pointer array (100 entries).
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
std::array< uint32_t, 100 > m_Ptrs
0x38 objects represent films.
COND_GE< FMT_VER::V_166, uint32_t > m_Unknown2
std::array< uint32_t, 7 > m_UnknownArray1
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
COND_GE< FMT_VER::V_166, uint32_t > m_LayerNameStr
static constexpr uint8_t BLOCK_TYPE_CODE
COND_LT< FMT_VER::V_166, std::string > m_FilmName
0x39 objects represent a film layer list.
static constexpr uint8_t BLOCK_TYPE_CODE
0x3A objects represent a list of films
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown1
Named property with type and value strings.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown3
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
std::vector< uint32_t > m_Entries
static constexpr uint8_t BLOCK_TYPE_CODE
Ordered list of block keys.
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< uint32_t, 9 > m_Unknown
Version-conditional field.
static constexpr bool exists(FMT_VER aVer)
COND_FIELD & operator=(const T &aValue)
const T & value() const
const T & operator*() const
const T & value_or(const T &aDefault) const
COND_FIELD & operator=(T &&aValue)
const T * operator->() const
uint32_t m_LayerList0x2A
uint32_t m_A
This is apparently some kind of linked list that chains though subsets objects in the file.
Allegro files start with this header.
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_4
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2g_V18
COND_LT< FMT_VER::V_180, std::array< uint32_t, 7 > > m_Unknown2_preV18
COND_LT< FMT_VER::V_180, uint32_t > m_0x35_Start_preV18
COND_GE< FMT_VER::V_180, std::array< uint32_t, 9 > > m_Unknown5_V18
std::array< char, 60 > m_AllegroVersion
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_5
COND_GE< FMT_VER::V_180, uint32_t > m_0x35_Start_V18
COND_LT< FMT_VER::V_180, LINKED_LIST > m_LL_Unknown5_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_3
COND_LT< FMT_VER::V_180, uint32_t > m_Unknown7
std::array< LAYER_MAP_ENTRY, 25 > m_LayerMap
The layer maps is a list of groups of two numbers.
COND_GE< FMT_VER::V_181, std::array< uint32_t, 8 > > m_Unknown_V181
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2e_V18
std::array< uint32_t, 50 > m_Unknown9
COND_LT< FMT_VER::V_180, uint32_t > m_0x27_End_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_Unknown5_V18
COND_GE< FMT_VER::V_180, uint32_t > m_0x27_End_V18
COND_GE< FMT_VER::V_180, uint32_t > m_0x35_End_V18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_6
uint32_t Get_0x27_End() const
const LINKED_LIST & GetUnknown5() const
COND_LT< FMT_VER::V_180, std::array< uint32_t, 17 > > m_Unknown5_preV18
COND_LT< FMT_VER::V_180, uint32_t > m_Unknown3
COND_LT< FMT_VER::V_180, uint32_t > m_0x35_End_preV18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_1
COND_LT< FMT_VER::V_180, uint32_t > m_StringCount_preV18
COND_GE< FMT_VER::V_180, uint32_t > m_StringCount_V18
uint32_t GetStringsCount() const
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2b_V18
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2d_V18
COND_GE< FMT_VER::V_180, LINKED_LIST > m_LL_V18_2
COND_GE< FMT_VER::V_180, uint32_t > m_Unknown2a_V18
SUBCLASS
The second byte in a CLASS:SUBCLASS pair.
bool operator==(const LAYER_INFO &) const =default
Substruct in a padstack object.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
COND_GE< FMT_VER::V_172, int32_t > m_Z1
std::optional< uint32_t > m_Z2
uint32_t m_ShapePtr
Seems to point to various things:
constexpr bool operator()(FMT_VER v) const
constexpr bool operator()(FMT_VER v) const
constexpr bool operator()(FMT_VER v) const