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
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};
145
146constexpr bool operator>=( FMT_VER lhs, FMT_VER rhs )
147{
148 return static_cast<uint32_t>( lhs ) >= static_cast<uint32_t>( rhs );
149}
150
151
155template <typename P>
156concept FMT_VER_PREDICATE = requires( P p, FMT_VER v )
157{
158 { p( v ) }->std::convertible_to<bool>;
159};
160
161
166template <FMT_VER_PREDICATE auto Pred, typename T>
168{
169 using value_type = T;
170
171 static constexpr bool exists( FMT_VER aVer ) { return Pred( aVer ); }
172
173 // Access to the value (use std::optional-like semantics)
174 T& value() { return *m_Value; }
175 const T& value() const { return *m_Value; }
176 bool has_value() const { return m_Value.has_value(); }
177
178 const T& value_or( const T& aDefault ) const { return has_value() ? value() : aDefault; }
179
180 T& operator*() { return *m_Value; }
181 const T& operator*() const { return *m_Value; }
182
183 T* operator->() { return &m_Value.value(); }
184 const T* operator->() const { return &*m_Value; }
185
186 // Assignment operator
187 COND_FIELD& operator=( const T& aValue )
188 {
189 m_Value = aValue;
190 return *this;
191 }
192
193 COND_FIELD& operator=( T&& aValue )
194 {
195 m_Value = std::move( aValue );
196 return *this;
197 }
198
199private:
200 std::optional<T> m_Value;
201};
202
203
204// Predicate functors
205
206template <FMT_VER Min>
207struct VER_GE
208{
209 constexpr bool operator()( FMT_VER v ) const { return v >= Min; }
210};
211
212template <FMT_VER Max>
213struct VER_LT
214{
215 constexpr bool operator()( FMT_VER v ) const { return v < Max; }
216};
217
218template <FMT_VER Min, FMT_VER Max>
220{
221 constexpr bool operator()( FMT_VER v ) const { return v >= Min && v < Max; }
222};
223
224
225// Useful aliases for common cases
226
228template <FMT_VER Min, typename T>
230
232template <FMT_VER Max, typename T>
234
236template <FMT_VER Min, FMT_VER Max, typename T>
238
242template <typename T>
243concept VERSIONED_COND_FIELD = requires( FMT_VER v )
244{
245 { T::exists( v ) }->std::convertible_to<bool>;
246 typename T::value_type;
247};
248
249
251{
252 MILS = 0x01,
253 INCHES = 0x02,
257};
258
259
268{
270 {
271 uint32_t m_A;
273 };
274
281 {
282 uint32_t m_Tail;
283 uint32_t m_Head;
284 };
285
286 uint32_t m_Magic;
287
288 uint32_t m_Unknown1a; // 0x03
289 uint32_t m_FileRole; // 0x01 (.brd) or 0x02 (.dra) (?)
290 uint32_t m_Unknown1b; // 0x03
291 uint32_t m_WriterProgram; // 0x09 (Allegro) or 0x130000 (DB Doctor) (?)
292
294
295 uint32_t m_UnknownMagic; // This is always 0x000a0d0a?
296 uint32_t m_UnknownFlags; // This looks like flags: 0x01000000, 0x0400000, 0x06000000
297
298 // In this block of 7 uint32s, it seems they have very different meanings pre and post v18
299
300 // Pre v18, these are all unknown
301 // - 3 and 4 are the same.
302 // - 5 and 6 arer of a similar size
304
305 // V18
306 COND_GE<FMT_VER::V_180, uint32_t> m_Unknown2a_V18; // Looks like an 'end pointer' like 0x27_end
313
314 // V180 has 6 additional linked lists in the header
315 // 5 of them are at the start
321
322 // Linked lists grouping top-level elements by type
323 LINKED_LIST m_LL_0x04; // Net assignments
324 LINKED_LIST m_LL_0x06; // Component definitions
325 LINKED_LIST m_LL_0x0C; // Pin definitions
326 LINKED_LIST m_LL_Shapes; // Shape segments (0x0E) and shapes (0x28)
329 LINKED_LIST m_LL_0x1C; // Padstacks
330 LINKED_LIST m_LL_0x24_0x28; // Rects and shapes
332 LINKED_LIST m_LL_0x2B; // Footprint definitions
333 LINKED_LIST m_LL_0x03_0x30; // Fields (0x03) and string wrappers (0x30)
334 LINKED_LIST m_LL_0x0A; // DRC elements
335 LINKED_LIST m_LL_0x1D_0x1E_0x1F; // Constraint sets, SI models, padstack dims
339 LINKED_LIST m_LL_0x0C_2; // Secondary pin definitions
341
342 // For some reason the 0x35 extents are recorded in the header
345
349
352
354
356
359
360 // Fixed length string field
361 std::array<char, 60> m_AllegroVersion;
362
363 uint32_t m_Unknown4;
364
365 uint32_t m_MaxKey;
366
369
371 // 3 empty bytes here?
372
373 uint32_t m_Unknown6;
375
376 // The end of the 0x27 object(?)
377 // In V18, this is relocated to m_0x27_End_V18
379
380 uint32_t m_Unknown8;
381
383
384 std::array<uint32_t, 50> m_Unknown9;
385
386 uint32_t m_Unknown10a; // Often 0x000500FF
387 uint32_t m_Unknown10b; // Similar to 0xFFA60000
388 uint32_t m_Unknown10c; // Usually 0x01
389
390 // E.g. 1000 for mils
392
399 std::array<LAYER_MAP_ENTRY, 25> m_LayerMap;
400
401 uint32_t GetStringsCount() const
402 {
403 if( m_StringCount_V18.has_value() )
404 return m_StringCount_V18.value();
405
406 return m_StringCount_preV18.value();
407 }
408
409 uint32_t Get_0x27_End() const
410 {
411 if( m_0x27_End_V18.has_value() )
412 return m_0x27_End_V18.value();
413
414 return m_0x27_End_preV18.value();
415 }
416
418 {
419 if( m_LL_Unknown5_V18.has_value() )
420 return m_LL_Unknown5_V18.value();
421
422 return m_LL_Unknown5_preV18.value();
423 }
424};
425
426
428{
454
461 {
462 // BOARD_GEOMETRY
463 // BGEOM_PASTEMASK_BOTTOM = 0x??
464 // BGEOM_PASTEMASK_TOP = 0x??
485
486 // COMPONENT_VALUE / DEVICE_TYPE / USER_PART_NUMBER
487 // REF_DES / TOLERANCE
494
495 // ANALYSIS
502
503 // DRAWING_FORMAT
509
510 // PACKAGE_GEOMETRY
528
529 // MANUFACTURING
544
545 // CONSTRAINTS_REGION
546 CREG_ALL = 0xFD,
547
548 // PACKAGE_KEEPIN / ROUTE_KEEPIN
550
551 // PACKAGE_KEEPOUT / ROUTE_KEEPOUT / VIA_KEEPOUT
555 };
556
557 uint8_t m_Class;
558 uint8_t m_Subclass;
559
560 bool operator==( const LAYER_INFO& ) const = default;
561};
562
563
570{
571 static constexpr uint8_t BLOCK_TYPE_CODE = 0x01;
572
574 uint8_t m_SubType;
575 uint32_t m_Key;
576 uint32_t m_Next;
577 uint32_t m_Parent;
578 uint32_t m_Unknown1;
579
581
582 uint32_t m_Width;
583
584 int32_t m_StartX;
585 int32_t m_StartY;
586 int32_t m_EndX;
587 int32_t m_EndY;
588
589 double m_CenterX; // Center
590 double m_CenterY;
591 double m_Radius;
592
593 std::array<int32_t, 4> m_BoundingBoxCoords;
594};
595
596
602{
603 static constexpr uint8_t BLOCK_TYPE_CODE = 0x03;
604
605 struct SUB_0x6C
606 {
607 uint32_t m_NumEntries;
608 std::vector<uint32_t> m_Entries;
609 };
610
612 {
613 uint16_t m_X0;
614 uint16_t m_X1;
615 std::vector<uint32_t> m_Entries;
616 };
617
618 struct SUB_0xF6
619 {
620 std::array<uint32_t, 20> m_Entries;
621 };
622
623 uint16_t m_Hdr1;
624
625 uint32_t m_Key;
626 uint32_t m_Next;
627
628
630
631 uint8_t m_SubType;
632 uint8_t m_Hdr2;
633 uint16_t m_Size;
634
636
637 std::variant<uint32_t, std::array<uint32_t, 2>, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6> m_Substruct;
638};
639
653
654
661{
662 static constexpr uint8_t BLOCK_TYPE_CODE = 0x04;
663
664 uint8_t m_Type;
665 uint16_t m_R;
666 uint32_t m_Key;
667 uint32_t m_Next;
668 uint32_t m_Net;
669 uint32_t m_ConnItem;
670
672};
673
674
705
706
712{
713 static constexpr uint8_t BLOCK_TYPE_CODE = 0x06;
714
715 uint32_t m_Key;
716
717 // Pointer to the next BLK_0x06_COMPONENT
718 uint32_t m_Next;
719 // Pointer to COMP_DEVICE_TYPE string
721 // Pointer to SYM_NAME string
722 uint32_t m_SymbolName;
723 // Points to 0x07, first instance
725 // Points to 0x0F, function slot
727 // Points to 0x08, pin number
729
730 // Points to 0x03, first 'field'
731 uint32_t m_Fields;
732
734};
735
736
764
765
772{
773 static constexpr uint8_t BLOCK_TYPE_CODE = 0x08;
774
775 uint8_t m_Type;
776 uint16_t m_R;
777 uint32_t m_Key;
778
781
782 uint32_t m_Next;
783
785
787 uint32_t m_PinNamePtr;
788
790
791 uint32_t m_Ptr4;
792
793 uint32_t GetStrPtr() const
794 {
795 return m_StrPtr.value_or( m_StrPtr16x.value_or( 0 ) );
796 }
797};
798
799
805{
806 static constexpr uint8_t BLOCK_TYPE_CODE = 0x09;
807
808 uint32_t m_Key;
809
810 std::array<uint32_t, 4> m_UnknownArray;
811
813
816 uint32_t m_Unknown2;
819
821};
822
823
828{
829 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0A;
830
831 uint8_t m_T;
833 uint32_t m_Key;
834 uint32_t m_Next;
835 uint32_t m_Unknown1;
836
838
839 std::array<int32_t, 4> m_Coords;
840 std::array<uint32_t, 4> m_Unknown4;
841 std::array<uint32_t, 5> m_Unknown5;
842
844};
845
846
852{
853 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0C;
854
856 {
857 // These are in the same order as the pad shapes, at least for the 'simple' shapes
858 CIRCLE = 0x02,
859 OCTAGON = 0x03,
860 CROSS = 0x04,
861 SQUARE = 0x05,
862 RECTANGLE = 0x06,
863 DIAMOND = 0x07,
864 PENTAGON = 0x0a,
865 OBLONG_X = 0x0b,
866 OBLONG_Y = 0x0c,
867 HEXAGON_X = 0x0f,
868 HEXAGON_Y = 0x10,
869 TRIANGLE = 0x12,
870 };
871
872 uint8_t m_T;
874 uint32_t m_Key;
875 uint32_t m_Next;
876
877 uint32_t m_Unknown1;
878 uint32_t m_Unknown2;
879
883
887
888 uint32_t m_Unknown4;
889
891
892 std::array<int32_t, 2> m_Coords;
893 std::array<int32_t, 2> m_Size;
894
895 uint32_t m_GroupPtr;
896 uint32_t m_Unknown6;
897 uint32_t m_Unknown7;
898
900
901 uint32_t GetShape() const
902 {
903 return m_Shape16x.value_or( m_Shape.value_or( 0 ) );
904 }
905};
906
907
914{
915 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0D;
916
917 uint32_t m_Key;
918 uint32_t m_NameStrId;
919 uint32_t m_Next;
920
922
923 int32_t m_CoordsX;
924 int32_t m_CoordsY;
925
926 uint32_t m_PadStack;
927 uint32_t m_Unknown2;
928
930
931 uint32_t m_Flags;
932 uint32_t m_Rotation;
933};
934
935
940{
941 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0E;
942
943 uint8_t m_T;
945 uint32_t m_Key;
946 uint32_t m_Next;
947 uint32_t m_FpPtr;
948
949 uint32_t m_Unknown1;
950 uint32_t m_Unknown2;
951 uint32_t m_Unknown3;
952
955
956 std::array<int32_t, 4> m_Coords;
957
958 std::array<uint32_t, 3> m_UnknownArr;
960 uint32_t m_Rotation;
961};
962
963
970{
971 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0F;
972
973 uint32_t m_Key;
974
975 uint32_t m_SlotName;
976
978
979 std::array<char, 32> m_CompDeviceType;
980
982
983 uint32_t m_Ptr0x06;
984 uint32_t m_Ptr0x11;
985
986 uint32_t m_Unknown2;
987
988 std::string GetCompDeviceTypeStr() const
989 {
990 // The string is stored as a fixed-length array, but is null-terminated
991 return std::string( m_CompDeviceType.data(), strnlen( m_CompDeviceType.data(), m_CompDeviceType.size() ) );
992 }
993};
994
995
1002{
1003 static constexpr uint8_t BLOCK_TYPE_CODE = 0x10;
1004
1005 uint32_t m_Key;
1006
1008
1010
1012
1013 uint32_t m_PtrX12;
1014 uint32_t m_Unknown3;
1016 uint32_t m_Slots; // 0x0F?
1017 uint32_t m_Fields; // Presumably a pointer to a string
1018};
1019
1020
1026{
1027 static constexpr uint8_t BLOCK_TYPE_CODE = 0x11;
1028
1029 uint8_t m_Type;
1030 uint16_t m_R;
1031 uint32_t m_Key;
1035 uint32_t m_Next;
1038 uint32_t m_Unknown1;
1039
1041};
1042
1043
1049{
1050 static constexpr uint8_t BLOCK_TYPE_CODE = 0x12;
1051
1052 uint8_t m_Type;
1053 uint16_t m_R;
1054 uint32_t m_Key;
1055 uint32_t m_Ptr1;
1056 uint32_t m_Ptr2;
1057 uint32_t m_Ptr3;
1058 uint32_t m_Unknown1;
1059
1062};
1063
1064
1071{
1072 static constexpr uint8_t BLOCK_TYPE_CODE = 0x14;
1073
1074 uint8_t m_Type;
1076 uint32_t m_Key;
1077 uint32_t m_Next;
1078 uint32_t m_Parent;
1079 uint32_t m_Flags;
1080
1082
1084 uint32_t m_Ptr0x03;
1085 uint32_t m_Ptr0x26;
1086};
1087
1088
1097{
1098 // Segments can be one of 3 codes, so we don't have a BLOCK_TYPE_CODE constant
1099 // for this struct.
1100
1101 uint32_t m_Key;
1102 uint32_t m_Next;
1103 uint32_t m_Parent;
1104 uint32_t m_Flags;
1105
1107
1108 uint32_t m_Width;
1109
1110 int32_t m_StartX;
1111 int32_t m_StartY;
1112 int32_t m_EndX;
1113 int32_t m_EndY;
1114};
1115
1122{
1123 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1B;
1124
1125 uint32_t m_Key;
1126 uint32_t m_Next;
1127 uint32_t m_NetName;
1128
1129 uint32_t m_Unknown1;
1130
1132
1133 uint32_t m_Type;
1134
1136 uint32_t m_Ratline;
1138 uint32_t m_FieldsPtr;
1140 uint32_t m_ModelPtr;
1144};
1145
1146
1160
1161
1167{
1191
1192 uint8_t m_Type;
1196
1198
1199 // Pad size
1200 int32_t m_W;
1201 int32_t m_H;
1202
1203 // In rounded rectangles, this is the corner radius.
1204 // In chamfered rectangles, this is the chamfer size.
1206
1207 // This is the pad component offset
1208 int32_t m_X3;
1209 int32_t m_X4;
1210
1217 uint32_t m_StrPtr;
1218
1219 // In versions < 17.2, seems to be not present in the last entry.
1220 std::optional<uint32_t> m_Z2;
1221};
1222
1223
1232{
1233 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1C;
1234
1236 {
1241 {
1243 // NPTHs seem to have this instead of 0x01
1244 // SMDs seems to have this or 0x01, no clear pattern identified
1246 };
1247
1248 uint32_t m_DrillSize;
1252 // Not sure these are in the right place but they're in here somewhere (usually zero)
1255
1256 // Drill char presumably somewhere in here - can cross-match with 0x0C PIN_DEF to find
1258 // Mask or enum of pad flags, including plating
1259 uint8_t m_Flags;
1260 // An ASCII char, or 0x00
1262 uint8_t m_D;
1263
1264 // Probably some kind of type:
1265 // 0x0000 for through-hole
1266 // 0x0002 for SMD
1267 // 0x0400 for slots
1268 uint16_t m_Unknown_1;
1269
1270 uint16_t m_ArrayNX;
1271 uint16_t m_ArrayNY;
1272
1274 // Also unsure if these are in the right place (all usually 0?)
1277
1280 uint32_t m_Unknown_2;
1281 uint32_t m_SlotX;
1282 uint32_t m_SlotY;
1283 uint32_t m_Unknown_3;
1284
1286 };
1287
1289 {
1294 {
1295 // Some through-holes have this, some don't
1298 };
1299
1300 // Presumably the same as the one in the v16x header
1302 uint32_t m_Unknown1; // 0?
1303 uint32_t m_Unknown2; // 0?
1304
1306
1307 // Not sure if this is really a substruct
1308 uint8_t m_A; // Only lower 4 bits (top 4 are type)
1309 uint8_t m_B;
1311 uint8_t m_Flags;
1312 uint8_t m_D;
1313
1314 uint32_t m_unknown3; // 1?
1315 uint32_t m_Unknown4; // 0?
1316
1317 uint16_t m_ArrayNX;
1318 uint16_t m_ArrayNY;
1320 uint16_t m_Unknown5; // 0?
1321
1322 // Again, these are tentatively placed, they're always zero so far,
1323 // so it's hard to say where they go.
1324 // Assuming they follow the v16x layout and come after the layer count
1327 uint32_t m_Unknown6a;
1328 uint32_t m_Unknown6b;
1329
1330 uint32_t m_DrillSize;
1333 uint32_t m_SlotX;
1334 uint32_t m_SlotY;
1335 uint32_t m_ToleranceTravelPos; // "TOLERANCE_TRAVEL" in BeagleBone_Black drill table
1337
1341 uint32_t m_DrillChars; // Presumably 4 drill chars
1342
1343 // Probably holds secondary drill parameters and other new V17.2 features
1344 std::array<uint32_t, 21> m_UnknownArr3;
1345
1346 // To check - this could be another component?
1348 };
1349
1351
1355 uint8_t m_N;
1357 uint32_t m_Key;
1358 uint32_t m_Next;
1359
1360 // The name of the padstack
1361 uint32_t m_PadStr;
1362
1363 // The header fields are very different between v16x and v17.x+
1364 using HEADER = std::variant<HEADER_v16x, HEADER_v17x>;
1366
1392 {
1393 // V<172 verified slots
1397
1398 // V>=172 verified slots
1400 };
1401
1407 {
1408 // First slot: Antipad
1410 // Thermal relief shape
1412 // Pad shape
1413 PAD = 2,
1414 // Unsure what this layer component slot is
1415 // But I suspect it's keepout, as that was added in V172.
1417 };
1418
1431 std::vector<PADSTACK_COMPONENT> m_Components;
1432
1438
1445 std::vector<uint32_t> m_UnknownArrN;
1446
1447
1448 // Dispatch common properties to the header variant.
1449 // Each method uses a local Visitor struct so that adding a new HEADER alternative
1450 // produces a compile error rather than a silent runtime fallback.
1451 uint32_t GetDrillSize() const
1452 {
1453 struct Visitor
1454 {
1455 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_DrillSize; }
1456 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_DrillSize; }
1457 };
1458 return std::visit( Visitor{}, m_Header );
1459 }
1460
1461 uint32_t GetLayerCount() const
1462 {
1463 struct Visitor
1464 {
1465 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_LayerCount; }
1466 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_LayerCount; }
1467 };
1468 return std::visit( Visitor{}, m_Header );
1469 }
1470
1471 bool IsPlated() const
1472 {
1473 struct Visitor
1474 {
1475 bool operator()( const HEADER_v16x& h ) const
1476 {
1477 return ( h.m_Flags & HEADER_v16x::PAD_FLAGS::FLAG_PLATED ) != 0;
1478 }
1479 bool operator()( const HEADER_v17x& h ) const
1480 {
1481 return ( h.m_Flags & HEADER_v17x::PAD_FLAGS::FLAG_PLATED ) != 0;
1482 }
1483 };
1484 return std::visit( Visitor{}, m_Header );
1485 }
1486};
1487
1488
1493{
1494 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1D;
1495
1496 uint32_t m_Key;
1497 uint32_t m_Next;
1498 uint32_t m_NameStrKey;
1499 uint32_t m_FieldPtr;
1500 uint16_t m_SizeA;
1501 uint16_t m_SizeB;
1502
1508 std::vector<std::array<uint8_t, 56>> m_DataB;
1513 std::vector<std::array<uint8_t, 256>> m_DataA;
1514
1516};
1517
1518
1524{
1525 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1E;
1526
1527 uint8_t m_Type;
1528 uint16_t m_T2;
1529 uint32_t m_Key;
1530 uint32_t m_Next;
1531
1532 // Versioning seems unsure here
1533 // At least it is in Kinoma (V_164)
1536
1537 uint32_t m_StrPtr;
1538 uint32_t m_Size;
1539
1540 std::string m_String;
1541
1543};
1544
1545
1550{
1551 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1F;
1552
1553 uint32_t m_Key;
1554 uint32_t m_Next;
1555 uint32_t m_Unknown2;
1556 uint32_t m_Unknown3;
1557 uint32_t m_Unknown4;
1558 uint16_t m_Unknown5;
1559 uint16_t m_Size;
1560
1564 std::vector<uint8_t> m_Substruct;
1565};
1566
1567
1579{
1580 static constexpr uint8_t BLOCK_TYPE_CODE = 0x20;
1581
1582 uint8_t m_Type;
1583 uint16_t m_R;
1584 uint32_t m_Key;
1585 uint32_t m_Next;
1586 std::array<uint32_t, 7> m_UnknownArray1;
1587
1589};
1590
1597{
1598 static constexpr uint8_t BLOCK_TYPE_CODE = 0x21;
1599
1600 uint8_t m_Type;
1601 uint16_t m_R;
1602 uint32_t m_Size;
1603 uint32_t m_Key;
1604
1610 std::vector<uint8_t> m_Data;
1611};
1612
1613
1618{
1619 static constexpr uint8_t BLOCK_TYPE_CODE = 0x22;
1620
1621 uint8_t m_Type;
1622 uint16_t m_T2;
1623 uint32_t m_Key;
1624
1626
1627 std::array<uint32_t, 8> m_UnknownArray;
1628};
1629
1630
1635{
1636 static constexpr uint8_t BLOCK_TYPE_CODE = 0x23;
1637
1638 uint8_t m_Type;
1640 uint32_t m_Key;
1641 uint32_t m_Next;
1642
1643 std::array<uint32_t, 2> m_Flags;
1644
1645 uint32_t m_Ptr1;
1646 uint32_t m_Ptr2;
1647 uint32_t m_Ptr3;
1648
1649 std::array<int32_t, 5> m_Coords;
1650
1651 std::array<uint32_t, 4> m_Unknown1;
1652
1654
1656};
1657
1658
1666{
1667 static constexpr uint8_t BLOCK_TYPE_CODE = 0x24;
1668
1669 uint8_t m_Type;
1671 uint32_t m_Key;
1672 uint32_t m_Next;
1673 uint32_t m_Parent;
1674 uint32_t m_Unknown1;
1675
1677
1678 std::array<int32_t, 4> m_Coords;
1679
1680 uint32_t m_Ptr2;
1681
1682 uint32_t m_Unknown3;
1683 uint32_t m_Unknown4;
1685 uint32_t m_Rotation;
1686};
1687
1688
1694{
1695 static constexpr uint8_t BLOCK_TYPE_CODE = 0x26;
1696
1697 uint8_t m_Type;
1698 uint16_t m_R;
1699 uint32_t m_Key;
1700 uint32_t m_MemberPtr;
1701
1703
1704 uint32_t m_GroupPtr;
1705 uint32_t m_ConstPtr;
1706
1708};
1709
1710
1720{
1721 static constexpr uint8_t BLOCK_TYPE_CODE = 0x27;
1722
1723 std::vector<uint32_t> m_Refs;
1724};
1725
1726
1737{
1738 static constexpr uint8_t BLOCK_TYPE_CODE = 0x28;
1739
1740 uint8_t m_Type;
1742 uint32_t m_Key;
1743 uint32_t m_Next;
1744 uint32_t m_Ptr1;
1745 uint32_t m_Unknown1;
1746
1749
1750 uint32_t m_Ptr2;
1751 uint32_t m_Ptr3;
1754 uint32_t m_Unknown4;
1755 uint32_t m_Unknown5;
1756
1758
1759 uint32_t m_Ptr6;
1760
1762
1763 std::array<int32_t, 4> m_Coords;
1764
1765 uint32_t GetTablePtr() const
1766 {
1767 return m_TablePtr.value_or( m_TablePtr_16x.value_or( 0 ) );
1768 }
1769};
1770
1771
1778{
1779 static constexpr uint8_t BLOCK_TYPE_CODE = 0x29;
1780
1781 uint8_t m_Type;
1782 uint16_t m_T;
1783 uint32_t m_Key;
1784
1785 // Points to something in the header
1786 uint32_t m_Ptr1;
1787 uint32_t m_Ptr2;
1788
1789 uint32_t m_Null; // Null value
1790
1791 uint32_t m_Ptr3;
1792
1793 int32_t m_Coord1;
1794 int32_t m_Coord2;
1795
1797
1798 uint32_t m_Unknown1;
1799
1800 // Pointer to a string, e.g., "2" in R0603
1801 uint32_t m_PtrX30;
1802
1803 uint32_t m_Unknown2;
1804 uint32_t m_Unknown3;
1805 uint32_t m_Unknown4;
1806};
1807
1808
1837
1838
1845{
1846 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2B;
1847
1848 uint32_t m_Key;
1849
1850 uint32_t m_FpStrRef;
1851 uint32_t m_Unknown1;
1852
1853 // Could these be signed?
1854 std::array<uint32_t, 4> m_Coords;
1855
1856 uint32_t m_Next;
1865
1868};
1869
1870
1928
1929
1938{
1939 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2D;
1940
1942 uint8_t m_Layer; // 0 = top (F_Cu), 1 = bottom (B_Cu)
1944
1945 uint32_t m_Key;
1946
1947 uint32_t m_Next;
1948
1950
1951 // Unsure what 16x means
1953
1954 uint16_t m_Unknown2;
1955 uint16_t m_Unknown3;
1956
1958
1959 uint32_t m_Flags;
1960
1961 uint32_t m_Rotation;
1962 int32_t m_CoordX;
1963 int32_t m_CoordY;
1964
1965 // Presumably equivalent to m_InstRef16x
1967
1970 uint32_t m_TextPtr; // Points to 0x30
1971
1973 uint32_t m_AreasPtr;
1976
1977 uint32_t GetInstRef() const
1978 {
1979 return m_InstRef.value_or( m_InstRef16x.value_or( 0 ) );
1980 }
1981};
1982
1983
1989{
1990 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2E;
1991
1992 uint8_t m_Type;
1993 uint16_t m_T2;
1994 uint32_t m_Key;
1995 uint32_t m_Next;
1997 uint32_t m_Unknown1;
1998 int32_t m_CoordX;
1999 int32_t m_CoordY;
2001 uint32_t m_Unknown2;
2002
2004};
2005
2006
2011{
2012 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2F;
2013
2014 uint8_t m_Type;
2015 uint16_t m_T2;
2016 uint32_t m_Key;
2017
2018 std::array<uint32_t, 6> m_UnknownArray;
2019};
2020
2021
2088
2089
2095{
2096 static constexpr uint8_t BLOCK_TYPE_CODE = 0x31;
2097
2109
2110 uint8_t m_T;
2112 uint32_t m_Key;
2114
2115 int32_t m_CoordsX;
2116 int32_t m_CoordsY;
2117
2118 uint16_t m_Unknown;
2119 uint16_t m_Len;
2120
2122
2123 std::string m_Value;
2124};
2125
2126
2133{
2134 static constexpr uint8_t BLOCK_TYPE_CODE = 0x32;
2135
2136 uint8_t m_Type;
2138 uint32_t m_Key;
2139 uint32_t m_Next;
2140 uint32_t m_NetPtr;
2141 uint32_t m_Flags;
2142
2144
2145 uint32_t m_NextInFp;
2146 uint32_t m_ParentFp;
2147 uint32_t m_Track;
2148 uint32_t m_PadPtr;
2149 uint32_t m_Ptr6;
2150 uint32_t m_Ratline;
2153
2155
2156 uint32_t m_NameText;
2157 uint32_t m_Ptr11;
2158
2159 std::array<int32_t, 4> m_Coords;
2160};
2161
2162
2169{
2170 static constexpr uint8_t BLOCK_TYPE_CODE = 0x33;
2171
2173 uint32_t m_Key;
2174 uint32_t m_Next;
2175 uint32_t m_NetPtr;
2176 uint32_t m_Unknown2;
2177
2179
2181
2183
2184 int32_t m_CoordsX;
2185 int32_t m_CoordsY;
2186
2188 uint32_t m_Padstack;
2191
2192 uint32_t m_Unknown4;
2193 uint32_t m_Unknown5;
2194
2195 std::array<int32_t, 4> m_BoundingBoxCoords;
2196};
2197
2198
2203{
2204 static constexpr uint8_t BLOCK_TYPE_CODE = 0x34;
2205
2206 uint8_t m_T;
2208 uint32_t m_Key;
2209 uint32_t m_Next;
2210 uint32_t m_Ptr1;
2211
2213
2214 uint32_t m_Flags;
2216 uint32_t m_Ptr3;
2217 uint32_t m_Unknown2;
2218};
2219
2220
2226{
2227 static constexpr uint8_t BLOCK_TYPE_CODE = 0x35;
2228
2229 uint8_t m_T2;
2230 uint16_t m_T3;
2231
2232 std::array<uint8_t, 120> m_Content;
2233};
2234
2235
2242{
2243 static constexpr uint8_t BLOCK_TYPE_CODE = 0x36;
2244
2245 uint16_t m_Code;
2246 uint32_t m_Key;
2247 uint32_t m_Next;
2248
2250
2251 uint32_t m_NumItems;
2252 uint32_t m_Count;
2253 uint32_t m_LastIdx;
2254 uint32_t m_Unknown2;
2255
2257
2266
2273
2274 struct X05
2275 {
2276 std::array<uint8_t, 28> m_Unknown;
2277
2278 // This is in Nvidia Jetson (17.4), not in EVK BaseBoard (17.2)
2280 };
2281
2282 struct X06
2283 {
2284 uint16_t m_N;
2285 uint8_t m_R;
2286 uint8_t m_S;
2287 uint32_t m_Unknown1;
2288
2290 };
2291
2293 {
2294 uint32_t m_A;
2295 uint32_t m_B;
2297 uint32_t m_CharWidth;
2298
2300
2302 uint32_t m_LineSpace;
2303 uint32_t m_Unknown3; // Always 0?
2304 uint32_t m_StrokeWidth; // Aka "photo width"
2305
2307 };
2308
2309 struct X0B
2310 {
2311 std::array<uint8_t, 1016> m_Unknown;
2312 };
2313
2314 struct X0C
2315 {
2316 std::array<uint8_t, 232> m_Unknown;
2317 };
2318
2319 struct X0D
2320 {
2321 std::array<uint8_t, 200> m_Unknown;
2322 };
2323
2324 struct X0F
2325 {
2326 uint32_t m_Key;
2327 std::array<uint32_t, 3> m_Ptrs;
2328 uint32_t m_Ptr2;
2329 };
2330
2331 struct X10
2332 {
2333 std::array<uint8_t, 108> m_Unknown;
2334
2335 // V18 has an extra uint32 "somewhere" in this block
2337 };
2338
2339 // So far only seen in a V175 file (Jetson)
2340 struct X12
2341 {
2342 // No point reading this before we can use it
2343 // std::array<uint8_t, 1052> m_Unknown;
2344 };
2345
2346 using SubstructVariant = std::variant<X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10, X12>;
2347
2348 std::vector<SubstructVariant> m_Items;
2349};
2350
2351
2358{
2359 static constexpr uint8_t BLOCK_TYPE_CODE = 0x37;
2360
2361 uint8_t m_T;
2362 uint16_t m_T2;
2363 uint32_t m_Key;
2364 uint32_t m_GroupPtr;
2365 uint32_t m_Next;
2366 uint32_t m_Capacity;
2367 uint32_t m_Count;
2368 uint32_t m_Unknown2;
2369
2371
2372 std::array<uint32_t, 100> m_Ptrs;
2373};
2374
2375
2396
2397
2402{
2403 static constexpr uint8_t BLOCK_TYPE_CODE = 0x39;
2404
2405 uint32_t m_Key;
2406 uint32_t m_Parent;
2407 uint32_t m_Head;
2408
2409 // Array of 22 uint16_t values
2410 std::array<uint16_t, 22> m_X;
2411};
2412
2413
2418{
2419 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3A;
2420
2422 uint32_t m_Key;
2423 uint32_t m_Next;
2424 uint32_t m_Unknown;
2425
2427};
2428
2429
2435{
2436 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3B;
2437
2438 uint8_t m_T;
2439 uint16_t m_SubType;
2440 uint32_t m_Len;
2441
2442 std::string m_Name;
2443 std::string m_Type;
2444
2445 uint32_t m_Unknown1;
2446 uint32_t m_Unknown2;
2447
2449
2450 std::string m_Value;
2451};
2452
2453
2459{
2460 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3C;
2461
2462 uint8_t m_T;
2463 uint16_t m_T2;
2464 uint32_t m_Key;
2465
2467
2469 std::vector<uint32_t> m_Entries;
2470};
2471
2472
2479template <typename T>
2480concept ALLEGRO_BLOCK_DATA = requires
2481{
2482 { T::BLOCK_TYPE_CODE }->std::convertible_to<uint8_t>;
2483}
2484|| std::is_same_v<T, BLK_0x15_16_17_SEGMENT>;
2485
2486
2487} // 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.
@ 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
Pointer to 0x11 PIN_NAME object.
COND_GE< FMT_VER::V_172, uint32_t > m_Unknown1
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_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_Key
Pointer to pin name string.
uint32_t m_PinNameStrPtr
Pointer to next 0x11 PIN_NAME object or 0x0F SLOT.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown2
uint32_t m_Next
Pointer to 0x08 PIN_NUMBER object.
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_Ratline
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_164, 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)
COND_GE< FMT_VER::V_164, uint16_t > m_Unknown2
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
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< FMT_VER::V_174, 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_174, 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
Ordered list of block keys.
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown
std::vector< uint32_t > m_Entries
static constexpr uint8_t BLOCK_TYPE_CODE
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_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.
uint32_t m_StrPtr
Seems to point to various things:
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
constexpr bool operator()(FMT_VER v) const
constexpr bool operator()(FMT_VER v) const
constexpr bool operator()(FMT_VER v) const