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_161, // Between 16.0 and 16.2, 0x00130200
137 V_162, // Allegro 16.2 0x00130400, 0x00130500
138 V_164, // Allegro 16.4, 0x00130C00
139 V_165, // Allegro 16.5, 0x00131000
140 V_166, // Allegro 16.6, 0x00131500
141 V_172, // Allegro 17.2, 0x00140400
142 V_174, // Allegro 17.4, 0x00140900
143 V_175, // Allegro 17.5, 0x00141500
144 V_180, // Allegro 18.0, 0x00150000
145 V_181, // Allegro 18.1, 0x00150200
146 V_190, // Allegro 19.0, 0x00160100
147};
148
149constexpr bool operator>=( FMT_VER lhs, FMT_VER rhs )
150{
151 return static_cast<uint32_t>( lhs ) >= static_cast<uint32_t>( rhs );
152}
153
154
158template <typename P>
159concept FMT_VER_PREDICATE = requires( P p, FMT_VER v )
160{
161 { p( v ) }->std::convertible_to<bool>;
162};
163
164
169template <FMT_VER_PREDICATE auto Pred, typename T>
171{
172 using value_type = T;
173
174 static constexpr bool exists( FMT_VER aVer ) { return Pred( aVer ); }
175
176 // Access to the value (use std::optional-like semantics)
177 T& value() { return *m_Value; }
178 const T& value() const { return *m_Value; }
179 bool has_value() const { return m_Value.has_value(); }
180
181 const T& value_or( const T& aDefault ) const { return has_value() ? value() : aDefault; }
182
183 T& operator*() { return *m_Value; }
184 const T& operator*() const { return *m_Value; }
185
186 T* operator->() { return &m_Value.value(); }
187 const T* operator->() const { return &*m_Value; }
188
189 // Assignment operator
190 COND_FIELD& operator=( const T& aValue )
191 {
192 m_Value = aValue;
193 return *this;
194 }
195
196 COND_FIELD& operator=( T&& aValue )
197 {
198 m_Value = std::move( aValue );
199 return *this;
200 }
201
202private:
203 std::optional<T> m_Value;
204};
205
206
207// Predicate functors
208
209template <FMT_VER Min>
210struct VER_GE
211{
212 constexpr bool operator()( FMT_VER v ) const { return v >= Min; }
213};
214
215template <FMT_VER Max>
216struct VER_LT
217{
218 constexpr bool operator()( FMT_VER v ) const { return v < Max; }
219};
220
221template <FMT_VER Min, FMT_VER Max>
223{
224 constexpr bool operator()( FMT_VER v ) const { return v >= Min && v < Max; }
225};
226
227
228// Useful aliases for common cases
229
231template <FMT_VER Min, typename T>
233
235template <FMT_VER Max, typename T>
237
239template <FMT_VER Min, FMT_VER Max, typename T>
241
245template <typename T>
246concept VERSIONED_COND_FIELD = requires( FMT_VER v )
247{
248 { T::exists( v ) }->std::convertible_to<bool>;
249 typename T::value_type;
250};
251
252
254{
255 MILS = 0x01,
256 INCHES = 0x02,
260};
261
262
271{
273 {
274 uint32_t m_A;
276 };
277
284 {
285 uint32_t m_Tail;
286 uint32_t m_Head;
287 };
288
289 uint32_t m_Magic;
290
291 uint32_t m_Unknown1a; // 0x03
292 uint32_t m_FileRole; // 0x01 (.brd) or 0x02 (.dra) (?)
293 uint32_t m_Unknown1b; // 0x03
294 uint32_t m_WriterProgram; // 0x09 (Allegro) or 0x130000 (DB Doctor) (?)
295
297
298 uint32_t m_UnknownMagic; // This is always 0x000a0d0a?
299 uint32_t m_UnknownFlags; // This looks like flags: 0x01000000, 0x0400000, 0x06000000
300
301 // In this block of 7 uint32s, it seems they have very different meanings pre and post v18
302
303 // Pre v18, these are all unknown
304 // - 3 and 4 are the same.
305 // - 5 and 6 arer of a similar size
307
308 // V18
309 COND_GE<FMT_VER::V_180, uint32_t> m_Unknown2a_V18; // Looks like an 'end pointer' like 0x27_end
316
317 // V180 has 6 additional linked lists in the header
318 // 5 of them are at the start
324
325 // Linked lists grouping top-level elements by type
326 LINKED_LIST m_LL_0x04; // Net assignments
327 LINKED_LIST m_LL_0x06; // Component definitions
328 LINKED_LIST m_LL_0x0C; // Pin definitions
329 LINKED_LIST m_LL_Shapes; // Shape segments (0x0E) and shapes (0x28)
332 LINKED_LIST m_LL_0x1C; // Padstacks
333 LINKED_LIST m_LL_0x24_0x28; // Rects and shapes
335 LINKED_LIST m_LL_0x2B; // Footprint definitions
336 LINKED_LIST m_LL_0x03_0x30; // Fields (0x03) and string wrappers (0x30)
337 LINKED_LIST m_LL_0x0A; // DRC elements
338 LINKED_LIST m_LL_0x1D_0x1E_0x1F; // Constraint sets, SI models, padstack dims
342 LINKED_LIST m_LL_0x0C_2; // Secondary pin definitions
344
345 // For some reason the 0x35 extents are recorded in the header
348
352
355
357
359
361
363
365
366 // Fixed length string field
367 std::array<char, 60> m_AllegroVersion;
368
369 uint32_t m_Unknown4;
370
371 uint32_t m_MaxKey;
372
375
377 // 3 empty bytes here?
378
379 uint32_t m_Unknown6;
381
382 // The end of the 0x27 object(?)
383 // In V18, this is relocated to m_0x27_End_V18
385
386 uint32_t m_Unknown8;
387
389
390 std::array<uint32_t, 50> m_Unknown9;
391
392 uint32_t m_Unknown10a; // Often 0x000500FF
393 uint32_t m_Unknown10b; // Similar to 0xFFA60000
394 uint32_t m_Unknown10c; // Usually 0x01
395
396 // E.g. 1000 for mils
398
405 std::array<LAYER_MAP_ENTRY, 25> m_LayerMap;
406
407 uint32_t GetStringsCount() const
408 {
409 if( m_StringCount_V18.has_value() )
410 return m_StringCount_V18.value();
411
412 return m_StringCount_preV18.value();
413 }
414
415 uint32_t Get_0x27_End() const
416 {
417 if( m_0x27_End_V18.has_value() )
418 return m_0x27_End_V18.value();
419
420 return m_0x27_End_preV18.value();
421 }
422
424 {
425 if( m_LL_Unknown5_V18.has_value() )
426 return m_LL_Unknown5_V18.value();
427
428 return m_LL_Unknown5_preV18.value();
429 }
430};
431
432
434{
460
467 {
468 // BOARD_GEOMETRY
469 // BGEOM_PASTEMASK_BOTTOM = 0x??
470 // BGEOM_PASTEMASK_TOP = 0x??
491
492 // COMPONENT_VALUE / DEVICE_TYPE / USER_PART_NUMBER
493 // REF_DES / TOLERANCE
500
501 // ANALYSIS
508
509 // DRAWING_FORMAT
515
516 // PACKAGE_GEOMETRY
534
535 // MANUFACTURING
550
551 // CONSTRAINTS_REGION
552 CREG_ALL = 0xFD,
553
554 // PACKAGE_KEEPIN / ROUTE_KEEPIN
556
557 // PACKAGE_KEEPOUT / ROUTE_KEEPOUT / VIA_KEEPOUT
561 };
562
563 uint8_t m_Class;
564 uint8_t m_Subclass;
565
566 bool operator==( const LAYER_INFO& ) const = default;
567};
568
569
576{
577 static constexpr uint8_t BLOCK_TYPE_CODE = 0x01;
578
580 uint8_t m_SubType;
581 uint32_t m_Key;
582 uint32_t m_Next;
583 uint32_t m_Parent;
584 uint32_t m_Unknown1;
585
587
588 uint32_t m_Width;
589
590 int32_t m_StartX;
591 int32_t m_StartY;
592 int32_t m_EndX;
593 int32_t m_EndY;
594
595 double m_CenterX; // Center
596 double m_CenterY;
597 double m_Radius;
598
599 std::array<int32_t, 4> m_BoundingBoxCoords;
600};
601
602
608{
609 static constexpr uint8_t BLOCK_TYPE_CODE = 0x03;
610
611 struct SUB_0x6C
612 {
613 uint32_t m_NumEntries;
614 std::vector<uint32_t> m_Entries;
615 };
616
618 {
619 uint16_t m_X0;
620 uint16_t m_X1;
621 std::vector<uint32_t> m_Entries;
622 };
623
624 struct SUB_0xF6
625 {
626 std::array<uint32_t, 20> m_Entries;
627 };
628
629 uint16_t m_Hdr1;
630
631 uint32_t m_Key;
632 uint32_t m_Next;
633
634
636
637 uint8_t m_SubType;
638 uint8_t m_Hdr2;
639 uint16_t m_Size;
640
642
643 std::variant<uint32_t, std::array<uint32_t, 2>, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6> m_Substruct;
644};
645
661
662
669{
670 static constexpr uint8_t BLOCK_TYPE_CODE = 0x04;
671
672 uint8_t m_Type;
673 uint16_t m_R;
674 uint32_t m_Key;
675 uint32_t m_Next;
676 uint32_t m_Net;
677 uint32_t m_ConnItem;
678
680};
681
682
713
714
720{
721 static constexpr uint8_t BLOCK_TYPE_CODE = 0x06;
722
723 uint32_t m_Key;
724
725 // Pointer to the next BLK_0x06_COMPONENT
726 uint32_t m_Next;
727 // Pointer to COMP_DEVICE_TYPE string
729 // Pointer to SYM_NAME string
730 uint32_t m_SymbolName;
731 // Points to 0x07, first instance
733 // Points to 0x0F, function slot
735 // Points to 0x08, pin number
737
738 // Points to 0x03, first 'field'
739 uint32_t m_Fields;
740
742};
743
744
772
773
780{
781 static constexpr uint8_t BLOCK_TYPE_CODE = 0x08;
782
783 uint8_t m_Type;
784 uint16_t m_R;
785 uint32_t m_Key;
786
789
790 uint32_t m_Next;
791
793
795 uint32_t m_PinNamePtr;
796
798
799 uint32_t m_Ptr4;
800
801 uint32_t GetStrPtr() const
802 {
803 return m_StrPtr.value_or( m_StrPtr16x.value_or( 0 ) );
804 }
805};
806
807
813{
814 static constexpr uint8_t BLOCK_TYPE_CODE = 0x09;
815
816 uint32_t m_Key;
817
818 std::array<uint32_t, 4> m_UnknownArray;
819
821
824 uint32_t m_Unknown2;
827
829};
830
831
836{
837 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0A;
838
839 uint8_t m_T;
841 uint32_t m_Key;
842 uint32_t m_Next;
843 uint32_t m_Unknown1;
844
846
847 std::array<int32_t, 4> m_Coords;
848 std::array<uint32_t, 4> m_Unknown4;
849 std::array<uint32_t, 5> m_Unknown5;
850
852};
853
854
860{
861 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0C;
862
864 {
865 // These are in the same order as the pad shapes, at least for the 'simple' shapes
866 CIRCLE = 0x02,
867 OCTAGON = 0x03,
868 CROSS = 0x04,
869 SQUARE = 0x05,
870 RECTANGLE = 0x06,
871 DIAMOND = 0x07,
872 PENTAGON = 0x0a,
873 OBLONG_X = 0x0b,
874 OBLONG_Y = 0x0c,
875 HEXAGON_X = 0x0f,
876 HEXAGON_Y = 0x10,
877 TRIANGLE = 0x12,
878 };
879
880 uint8_t m_T;
882 uint32_t m_Key;
883 uint32_t m_Next;
884
885 uint32_t m_Unknown1;
886 uint32_t m_Unknown2;
887
891
895
896 uint32_t m_Unknown4;
897
899
900 std::array<int32_t, 2> m_Coords;
901 std::array<int32_t, 2> m_Size;
902
903 uint32_t m_GroupPtr;
904 uint32_t m_Unknown6;
905 uint32_t m_Unknown7;
906
908
909 uint32_t GetShape() const
910 {
911 return m_Shape16x.value_or( m_Shape.value_or( 0 ) );
912 }
913};
914
915
922{
923 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0D;
924
925 uint32_t m_Key;
926 uint32_t m_NameStrId;
927 uint32_t m_Next;
928
930
931 int32_t m_CoordsX;
932 int32_t m_CoordsY;
933
934 uint32_t m_PadStack;
935 uint32_t m_Unknown2;
936
938
939 uint32_t m_Flags;
940 uint32_t m_Rotation;
941};
942
943
948{
949 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0E;
950
951 uint8_t m_T;
953 uint32_t m_Key;
954 uint32_t m_Next;
955 uint32_t m_FpPtr;
956
957 uint32_t m_Unknown1;
958 uint32_t m_Unknown2;
959 uint32_t m_Unknown3;
960
963
964 std::array<int32_t, 4> m_Coords;
965
966 std::array<uint32_t, 3> m_UnknownArr;
968 uint32_t m_Rotation;
969};
970
971
978{
979 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0F;
980
981 uint32_t m_Key;
982
983 uint32_t m_SlotName;
984
986
987 std::array<char, 32> m_CompDeviceType;
988
990
992
993 uint32_t m_Ptr0x06;
994 uint32_t m_Ptr0x11;
995
996 uint32_t m_Unknown2;
997
998 std::string GetCompDeviceTypeStr() const
999 {
1000 // The string is stored as a fixed-length array, but is null-terminated
1001 return std::string( m_CompDeviceType.data(), strnlen( m_CompDeviceType.data(), m_CompDeviceType.size() ) );
1002 }
1003};
1004
1005
1012{
1013 static constexpr uint8_t BLOCK_TYPE_CODE = 0x10;
1014
1015 uint32_t m_Key;
1016
1018
1020
1022
1023 uint32_t m_PtrX12;
1024 uint32_t m_Unknown3;
1026 uint32_t m_Slots; // 0x0F?
1027 uint32_t m_Fields; // Presumably a pointer to a string
1028};
1029
1030
1036{
1037 static constexpr uint8_t BLOCK_TYPE_CODE = 0x11;
1038
1039 uint8_t m_Type;
1040 uint16_t m_R;
1041 uint32_t m_Key;
1045 uint32_t m_Next;
1048 uint32_t m_Unknown1;
1049
1051};
1052
1053
1059{
1060 static constexpr uint8_t BLOCK_TYPE_CODE = 0x12;
1061
1062 uint8_t m_Type;
1063 uint16_t m_R;
1064 uint32_t m_Key;
1065 uint32_t m_Ptr1;
1066 uint32_t m_Ptr2;
1067 uint32_t m_Ptr3;
1068 uint32_t m_Unknown1;
1069
1072};
1073
1074
1081{
1082 static constexpr uint8_t BLOCK_TYPE_CODE = 0x14;
1083
1084 uint8_t m_Type;
1086 uint32_t m_Key;
1087 uint32_t m_Next;
1088 uint32_t m_Parent;
1089 uint32_t m_Flags;
1090
1092
1094 uint32_t m_Ptr0x03;
1095 uint32_t m_Ptr0x26;
1096};
1097
1098
1107{
1108 // Segments can be one of 3 codes, so we don't have a BLOCK_TYPE_CODE constant
1109 // for this struct.
1110
1111 uint32_t m_Key;
1112 uint32_t m_Next;
1113 uint32_t m_Parent;
1114 uint32_t m_Flags;
1115
1117
1118 uint32_t m_Width;
1119
1120 int32_t m_StartX;
1121 int32_t m_StartY;
1122 int32_t m_EndX;
1123 int32_t m_EndY;
1124};
1125
1131{
1132 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1A;
1133
1134 uint8_t m_Type;
1135 uint16_t m_T2;
1136 uint32_t m_Key;
1137
1138 std::array<uint32_t, 20> m_UnknownArray;
1139};
1140
1147{
1148 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1B;
1149
1150 uint32_t m_Key;
1151 uint32_t m_Next;
1152 uint32_t m_NetName;
1153
1154 uint32_t m_Unknown1;
1155
1157
1158 uint32_t m_Type;
1159
1161 uint32_t m_Ratline;
1163 uint32_t m_FieldsPtr;
1165 uint32_t m_ModelPtr;
1169};
1170
1171
1185
1186
1192{
1216
1217 uint8_t m_Type;
1221
1223
1224 // Pad size
1225 int32_t m_W;
1226 int32_t m_H;
1227
1228 // In rounded rectangles, this is the corner radius.
1229 // In chamfered rectangles, this is the chamfer size.
1231
1232 // This is the pad component offset
1233 int32_t m_OffsetX;
1234 int32_t m_OffsetY;
1235
1242 uint32_t m_ShapePtr;
1243
1244 // In versions < 17.2, seems to be not present in the last entry.
1245 std::optional<uint32_t> m_Z2;
1246};
1247
1248
1257{
1258 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1C;
1259
1261 {
1266 {
1268 // NPTHs seem to have this instead of 0x01
1269 // SMDs seems to have this or 0x01, no clear pattern identified
1271 };
1272
1273 uint32_t m_DrillSize;
1277 // Not sure these are in the right place but they're in here somewhere (usually zero)
1280
1281 // Drill char presumably somewhere in here - can cross-match with 0x0C PIN_DEF to find
1283 // Mask or enum of pad flags, including plating
1284 uint8_t m_Flags;
1285 // An ASCII char, or 0x00
1287 uint8_t m_D;
1288
1289 // Probably some kind of type:
1290 // 0x0000 for through-hole
1291 // 0x0002 for SMD
1292 // 0x0400 for slots
1293 uint16_t m_Unknown_1;
1294
1295 uint16_t m_ArrayNX;
1296 uint16_t m_ArrayNY;
1297
1299 // Also unsure if these are in the right place (all usually 0?)
1302
1305 uint32_t m_Unknown_2;
1306 uint32_t m_SlotX;
1307 uint32_t m_SlotY;
1308 uint32_t m_Unknown_3;
1309
1311 };
1312
1314 {
1319 {
1320 // Some through-holes have this, some don't
1323 };
1324
1325 // Presumably the same as the one in the v16x header
1327 uint32_t m_Unknown1; // 0?
1328 uint32_t m_Unknown2; // 0?
1329
1331
1332 // Not sure if this is really a substruct
1333 uint8_t m_A; // Only lower 4 bits (top 4 are type)
1334 uint8_t m_B;
1336 uint8_t m_Flags;
1337 uint8_t m_D;
1338
1339 uint32_t m_unknown3; // 1?
1340 uint32_t m_Unknown4; // 0?
1341
1342 uint16_t m_ArrayNX;
1343 uint16_t m_ArrayNY;
1345 uint16_t m_Unknown5; // 0?
1346
1347 // Again, these are tentatively placed, they're always zero so far,
1348 // so it's hard to say where they go.
1349 // Assuming they follow the v16x layout and come after the layer count
1352 uint32_t m_Unknown6a;
1353 uint32_t m_Unknown6b;
1354
1355 uint32_t m_DrillSize;
1358 uint32_t m_SlotX;
1359 uint32_t m_SlotY;
1360 uint32_t m_ToleranceTravelPos; // "TOLERANCE_TRAVEL" in BeagleBone_Black drill table
1362
1366 uint32_t m_DrillChars; // Presumably 4 drill chars
1367
1368 // Probably holds secondary drill parameters and other new V17.2 features
1369 std::array<uint32_t, 21> m_UnknownArr3;
1370
1371 // To check - this could be another component?
1373 };
1374
1376
1380 uint8_t m_N;
1382 uint32_t m_Key;
1383 uint32_t m_Next;
1384
1385 // The name of the padstack
1386 uint32_t m_PadStr;
1387
1388 // The header fields are very different between v16x and v17.x+
1389 using HEADER = std::variant<HEADER_v16x, HEADER_v17x>;
1391
1414 {
1415 // V<172 verified slots
1420
1421 // V>=172 verified slots
1426 };
1427
1433 {
1434 // First slot: Antipad
1436 // Thermal relief shape
1438 // Pad shape
1439 PAD = 2,
1440 // Unsure what this layer component slot is
1441 // But I suspect it's keepout, as that was added in V172.
1443 };
1444
1457 std::vector<PADSTACK_COMPONENT> m_Components;
1458
1464
1471 std::vector<uint32_t> m_UnknownArrN;
1472
1473
1474 // Dispatch common properties to the header variant.
1475 // Each method uses a local Visitor struct so that adding a new HEADER alternative
1476 // produces a compile error rather than a silent runtime fallback.
1477 uint32_t GetDrillSize() const
1478 {
1479 struct Visitor
1480 {
1481 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_DrillSize; }
1482 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_DrillSize; }
1483 };
1484 return std::visit( Visitor{}, m_Header );
1485 }
1486
1487 uint32_t GetLayerCount() const
1488 {
1489 struct Visitor
1490 {
1491 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_LayerCount; }
1492 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_LayerCount; }
1493 };
1494 return std::visit( Visitor{}, m_Header );
1495 }
1496
1497 bool IsPlated() const
1498 {
1499 struct Visitor
1500 {
1501 bool operator()( const HEADER_v16x& h ) const
1502 {
1503 return ( h.m_Flags & HEADER_v16x::PAD_FLAGS::FLAG_PLATED ) != 0;
1504 }
1505 bool operator()( const HEADER_v17x& h ) const
1506 {
1507 return ( h.m_Flags & HEADER_v17x::PAD_FLAGS::FLAG_PLATED ) != 0;
1508 }
1509 };
1510 return std::visit( Visitor{}, m_Header );
1511 }
1512};
1513
1514
1519{
1520 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1D;
1521
1522 uint32_t m_Key;
1523 uint32_t m_Next;
1524 uint32_t m_NameStrKey;
1525 uint32_t m_FieldPtr;
1526 uint16_t m_SizeA;
1527 uint16_t m_SizeB;
1528
1534 std::vector<std::array<uint8_t, 56>> m_DataB;
1539 std::vector<std::array<uint8_t, 256>> m_DataA;
1540
1542};
1543
1544
1550{
1551 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1E;
1552
1553 uint8_t m_Type;
1554 uint16_t m_T2;
1555 uint32_t m_Key;
1556 uint32_t m_Next;
1557
1558 // Present in V_161, 16.2 (TWR-MCF51JG LAY-26493) and Kinoma (V_164); no 16.0 sample yet
1561
1562 uint32_t m_StrPtr;
1563 uint32_t m_Size;
1564
1565 std::string m_String;
1566
1568};
1569
1570
1575{
1576 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1F;
1577
1578 uint32_t m_Key;
1579 uint32_t m_Next;
1580 uint32_t m_Unknown2;
1581 uint32_t m_Unknown3;
1582 uint32_t m_Unknown4;
1583 uint16_t m_Unknown5;
1584 uint16_t m_Size;
1585
1589 std::vector<uint8_t> m_Substruct;
1590};
1591
1592
1604{
1605 static constexpr uint8_t BLOCK_TYPE_CODE = 0x20;
1606
1607 uint8_t m_Type;
1608 uint16_t m_R;
1609 uint32_t m_Key;
1610 uint32_t m_Next;
1611 std::array<uint32_t, 7> m_UnknownArray1;
1612
1614};
1615
1622{
1623 static constexpr uint8_t BLOCK_TYPE_CODE = 0x21;
1624
1625 uint8_t m_Type;
1626 uint16_t m_R;
1627 uint32_t m_Size;
1628 uint32_t m_Key;
1629
1635 std::vector<uint8_t> m_Data;
1636};
1637
1638
1643{
1644 static constexpr uint8_t BLOCK_TYPE_CODE = 0x22;
1645
1646 uint8_t m_Type;
1647 uint16_t m_T2;
1648 uint32_t m_Key;
1649
1651
1652 std::array<uint32_t, 8> m_UnknownArray;
1653};
1654
1655
1660{
1661 static constexpr uint8_t BLOCK_TYPE_CODE = 0x23;
1662
1663 uint8_t m_Type;
1665 uint32_t m_Key;
1666 uint32_t m_Next;
1667
1668 std::array<uint32_t, 2> m_Flags;
1669
1670 uint32_t m_Ptr1;
1671 uint32_t m_Ptr2;
1672 uint32_t m_Ptr3;
1673
1674 std::array<int32_t, 5> m_Coords;
1675
1676 std::array<uint32_t, 4> m_Unknown1;
1677
1679
1681};
1682
1683
1691{
1692 static constexpr uint8_t BLOCK_TYPE_CODE = 0x24;
1693
1694 uint8_t m_Type;
1696 uint32_t m_Key;
1697 uint32_t m_Next;
1698 uint32_t m_Parent;
1699 uint32_t m_Unknown1;
1700
1702
1703 std::array<int32_t, 4> m_Coords;
1704
1705 uint32_t m_Ptr2;
1706
1707 uint32_t m_Unknown3;
1708 uint32_t m_Unknown4;
1710 uint32_t m_Rotation;
1711};
1712
1713
1719{
1720 static constexpr uint8_t BLOCK_TYPE_CODE = 0x26;
1721
1722 uint8_t m_Type;
1723 uint16_t m_R;
1724 uint32_t m_Key;
1725 uint32_t m_MemberPtr;
1726
1728
1729 uint32_t m_GroupPtr;
1730 uint32_t m_ConstPtr;
1731
1733};
1734
1735
1745{
1746 static constexpr uint8_t BLOCK_TYPE_CODE = 0x27;
1747
1748 std::vector<uint32_t> m_Refs;
1749};
1750
1751
1762{
1763 static constexpr uint8_t BLOCK_TYPE_CODE = 0x28;
1764
1765 uint8_t m_Type;
1767 uint32_t m_Key;
1768 uint32_t m_Next;
1769 uint32_t m_Ptr1;
1770 uint32_t m_Unknown1;
1771
1774
1775 uint32_t m_Ptr2;
1776 uint32_t m_Ptr3;
1779 uint32_t m_Unknown4;
1780 uint32_t m_Unknown5;
1781
1783
1784 uint32_t m_Ptr6;
1785
1787
1788 std::array<int32_t, 4> m_Coords;
1789
1790 uint32_t GetTablePtr() const
1791 {
1792 return m_TablePtr.value_or( m_TablePtr_16x.value_or( 0 ) );
1793 }
1794};
1795
1796
1803{
1804 static constexpr uint8_t BLOCK_TYPE_CODE = 0x29;
1805
1806 uint8_t m_Type;
1807 uint16_t m_T;
1808 uint32_t m_Key;
1809
1810 // Points to something in the header
1811 uint32_t m_Ptr1;
1812 uint32_t m_Ptr2;
1813
1814 uint32_t m_Null; // Null value
1815
1816 uint32_t m_Ptr3;
1817
1818 int32_t m_Coord1;
1819 int32_t m_Coord2;
1820
1822
1823 uint32_t m_Unknown1;
1824
1825 // Pointer to a string, e.g., "2" in R0603
1826 uint32_t m_PtrX30;
1827
1828 uint32_t m_Unknown2;
1829 uint32_t m_Unknown3;
1830 uint32_t m_Unknown4;
1831};
1832
1833
1863
1864
1872{
1873 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2B;
1874
1875 uint32_t m_Key;
1876
1877 uint32_t m_FpStrRef;
1878 uint32_t m_Unknown1;
1879
1880 // Could these be signed?
1881 std::array<uint32_t, 4> m_Coords;
1882
1883 uint32_t m_Next;
1888
1890 uint32_t m_FieldsPtr;
1891
1895
1898};
1899
1900
1958
1959
1968{
1969 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2D;
1970
1972 uint8_t m_Layer; // 0 = top (F_Cu), 1 = bottom (B_Cu)
1974
1975 uint32_t m_Key;
1976
1977 uint32_t m_Next;
1978
1980
1981 // Unsure what 16x means
1983
1984 uint16_t m_Unknown2;
1985 uint16_t m_Unknown3;
1986
1988
1989 uint32_t m_Flags;
1990
1991 uint32_t m_Rotation;
1992 int32_t m_CoordX;
1993 int32_t m_CoordY;
1994
1995 // Presumably equivalent to m_InstRef16x
1997
2000 uint32_t m_TextPtr; // Points to 0x30
2001
2003 uint32_t m_AreasPtr;
2006
2007 uint32_t GetInstRef() const
2008 {
2009 return m_InstRef.value_or( m_InstRef16x.value_or( 0 ) );
2010 }
2011};
2012
2013
2019{
2020 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2E;
2021
2022 uint8_t m_Type;
2023 uint16_t m_T2;
2024 uint32_t m_Key;
2025 uint32_t m_Next;
2027 uint32_t m_Unknown1;
2028 int32_t m_CoordX;
2029 int32_t m_CoordY;
2031 uint32_t m_Unknown2;
2032
2034};
2035
2036
2041{
2042 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2F;
2043
2044 uint8_t m_Type;
2045 uint16_t m_T2;
2046 uint32_t m_Key;
2047
2048 std::array<uint32_t, 6> m_UnknownArray;
2049};
2050
2051
2119
2120
2126{
2127 static constexpr uint8_t BLOCK_TYPE_CODE = 0x31;
2128
2140
2141 uint8_t m_T;
2143 uint32_t m_Key;
2145
2146 int32_t m_CoordsX;
2147 int32_t m_CoordsY;
2148
2149 uint16_t m_Unknown;
2150 uint16_t m_Len;
2151
2153
2154 std::string m_Value;
2155};
2156
2157
2164{
2165 static constexpr uint8_t BLOCK_TYPE_CODE = 0x32;
2166
2167 uint8_t m_Type;
2169 uint32_t m_Key;
2170 uint32_t m_Next;
2171 uint32_t m_NetPtr;
2172 uint32_t m_Flags;
2173
2175
2176 uint32_t m_NextInFp;
2177 uint32_t m_ParentFp;
2178 uint32_t m_Track;
2179 uint32_t m_PadPtr;
2180 uint32_t m_Ptr6;
2181 uint32_t m_Ratline;
2184
2186
2187 uint32_t m_NameText;
2188 uint32_t m_Ptr11;
2189
2190 std::array<int32_t, 4> m_Coords;
2191};
2192
2193
2200{
2201 static constexpr uint8_t BLOCK_TYPE_CODE = 0x33;
2202
2204 uint32_t m_Key;
2205 uint32_t m_Next;
2206 uint32_t m_NetPtr;
2207 uint32_t m_Unknown2;
2208
2210
2212
2214
2215 int32_t m_CoordsX;
2216 int32_t m_CoordsY;
2217
2219 uint32_t m_Padstack;
2222
2223 uint32_t m_Unknown4;
2224 uint32_t m_Unknown5;
2225
2226 std::array<int32_t, 4> m_BoundingBoxCoords;
2227};
2228
2229
2234{
2235 static constexpr uint8_t BLOCK_TYPE_CODE = 0x34;
2236
2237 uint8_t m_T;
2239 uint32_t m_Key;
2240 uint32_t m_Next;
2241 uint32_t m_Ptr1;
2242
2244
2245 uint32_t m_Flags;
2247 uint32_t m_Ptr3;
2248 uint32_t m_Unknown2;
2249};
2250
2251
2257{
2258 static constexpr uint8_t BLOCK_TYPE_CODE = 0x35;
2259
2260 uint8_t m_T2;
2261 uint16_t m_T3;
2262
2263 std::array<uint8_t, 120> m_Content;
2264};
2265
2266
2273{
2274 static constexpr uint8_t BLOCK_TYPE_CODE = 0x36;
2275
2276 uint16_t m_Code;
2277 uint32_t m_Key;
2278 uint32_t m_Next;
2279
2281
2282 uint32_t m_NumItems;
2283 uint32_t m_Count;
2284 uint32_t m_LastIdx;
2285 uint32_t m_Unknown2;
2286
2288
2297
2304
2305 struct X05
2306 {
2307 std::array<uint8_t, 28> m_Unknown;
2308
2309 // The trailing word first appears in 17.5. On 17.4 the record is 28 bytes, and
2310 // reading a phantom word here overruns every slot and desyncs the object stream.
2312 };
2313
2314 struct X06
2315 {
2316 uint16_t m_N;
2317 uint8_t m_R;
2318 uint8_t m_S;
2319 uint32_t m_Unknown1;
2320
2322 };
2323
2340
2341 struct X0B
2342 {
2343 std::array<uint8_t, 1016> m_Unknown;
2344 };
2345
2346 struct X0C
2347 {
2348 std::array<uint8_t, 232> m_Unknown;
2349 };
2350
2351 struct X0D
2352 {
2353 std::array<uint8_t, 200> m_Unknown;
2354 };
2355
2356 struct X0F
2357 {
2358 uint32_t m_Key;
2359 std::array<uint32_t, 3> m_Ptrs;
2360 uint32_t m_Ptr2;
2361 };
2362
2363 struct X10
2364 {
2365 std::array<uint8_t, 108> m_Unknown;
2366
2367 // V18 has an extra uint32 "somewhere" in this block
2369 };
2370
2371 // So far only seen in a V175 file (Jetson)
2372 struct X12
2373 {
2374 // No point reading this before we can use it
2375 // std::array<uint8_t, 1052> m_Unknown;
2376 };
2377
2378 using SubstructVariant = std::variant<X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10, X12>;
2379
2380 std::vector<SubstructVariant> m_Items;
2381};
2382
2383
2390{
2391 static constexpr uint8_t BLOCK_TYPE_CODE = 0x37;
2392
2393 uint8_t m_T;
2394 uint16_t m_T2;
2395 uint32_t m_Key;
2396 uint32_t m_GroupPtr;
2397 uint32_t m_Next;
2398 uint32_t m_Capacity;
2399 uint32_t m_Count;
2400 uint32_t m_Unknown2;
2401
2403
2404 std::array<uint32_t, 100> m_Ptrs;
2405};
2406
2407
2428
2429
2434{
2435 static constexpr uint8_t BLOCK_TYPE_CODE = 0x39;
2436
2437 uint32_t m_Key;
2438 uint32_t m_Parent;
2439 uint32_t m_Head;
2440
2441 // Array of 22 uint16_t values
2442 std::array<uint16_t, 22> m_X;
2443};
2444
2445
2450{
2451 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3A;
2452
2454 uint32_t m_Key;
2455 uint32_t m_Next;
2456 uint32_t m_Unknown;
2457
2459};
2460
2461
2467{
2468 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3B;
2469
2470 uint8_t m_T;
2471 uint16_t m_SubType;
2472 uint32_t m_Len;
2473
2474 std::string m_Name;
2475 std::string m_Type;
2476
2477 uint32_t m_Unknown1;
2478 uint32_t m_Unknown2;
2479
2481
2482 std::string m_Value;
2483};
2484
2485
2491{
2492 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3E;
2493
2494 uint32_t m_Key;
2495 std::array<uint32_t, 9> m_Unknown;
2496};
2497
2498
2500{
2501 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3C;
2502
2503 uint8_t m_T;
2504 uint16_t m_T2;
2505 uint32_t m_Key;
2506
2508
2510 std::vector<uint32_t> m_Entries;
2511};
2512
2513
2520template <typename T>
2521concept ALLEGRO_BLOCK_DATA = requires
2522{
2523 { T::BLOCK_TYPE_CODE }->std::convertible_to<uint8_t>;
2524}
2525|| std::is_same_v<T, BLK_0x15_16_17_SEGMENT>;
2526
2527
2528} // 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
Purpose not determined.
std::array< uint32_t, 20 > m_UnknownArray
static constexpr uint8_t BLOCK_TYPE_CODE
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_161, uint16_t > m_Unknown2
COND_GE< FMT_VER::V_161, uint16_t > m_Unknown3
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
Same layer flags as REF_ENTRY, stored after the 32 byte 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