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 // Chain terminator: a chain ends when a block's next key equals this value.
286 // It is normally not the key of any block.
287 uint32_t m_Tail;
288
289 // Key of the first block in the chain, or 0 if the chain is empty.
290 uint32_t m_Head;
291 };
292
293 uint32_t m_Magic;
294
295 uint32_t m_Unknown1a; // 0x03
296 uint32_t m_FileRole; // 0x01 (.brd) or 0x02 (.dra) (?)
297 uint32_t m_Unknown1b; // 0x03
298 uint32_t m_WriterProgram; // 0x09 (Allegro) or 0x130000 (DB Doctor) (?)
299
301
302 uint32_t m_UnknownMagic; // This is always 0x000a0d0a?
303 uint32_t m_UnknownFlags; // This looks like flags: 0x01000000, 0x0400000, 0x06000000
304
305 // In this block of 7 uint32s, it seems they have very different meanings pre and post v18
306
307 // Pre v18, these are all unknown
308 // - 3 and 4 are the same.
309 // - 5 and 6 arer of a similar size
311
312 // V18
313 COND_GE<FMT_VER::V_180, uint32_t> m_Unknown2a_V18; // Looks like an 'end pointer' like 0x27_end
320
321 // V18 inserts 9 words between the fields above and the linked lists. They are not
322 // list descriptors, and their meaning has not been determined.
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 LINKED_LIST m_LL_0x35; // 0x35 file records.
345 LINKED_LIST m_LL_0x36; // Definition tables
348 LINKED_LIST m_LL_0x0A_2; // A second DRC element list
349
350 // Only V18 onwards has this one. It holds field objects, which earlier versions
351 // keep in m_LL_0x03_0x30 instead.
353
355
357
358 // Fixed length string field
359 std::array<char, 60> m_AllegroVersion;
360
361 uint32_t m_Unknown4;
362
363 uint32_t m_MaxKey;
364
367
369 // 3 empty bytes here?
370
371 uint32_t m_Unknown6;
373
374 // The end of the 0x27 object(?)
375 // In V18, this is relocated to m_0x27_End_V18
377
378 uint32_t m_Unknown8;
379
381
382 std::array<uint32_t, 50> m_Unknown9;
383
384 uint32_t m_Unknown10a; // Often 0x000500FF
385 uint32_t m_Unknown10b; // Similar to 0xFFA60000
386 uint32_t m_Unknown10c; // Usually 0x01
387
388 // E.g. 1000 for mils
390
397 std::array<LAYER_MAP_ENTRY, 25> m_LayerMap;
398
399 uint32_t GetStringsCount() const
400 {
401 if( m_StringCount_V18.has_value() )
402 return m_StringCount_V18.value();
403
404 return m_StringCount_preV18.value();
405 }
406
407 uint32_t Get_0x27_End() const
408 {
409 if( m_0x27_End_V18.has_value() )
410 return m_0x27_End_V18.value();
411
412 return m_0x27_End_preV18.value();
413 }
414};
415
416
418{
444
451 {
452 // BOARD_GEOMETRY
453 // BGEOM_PASTEMASK_BOTTOM = 0x??
454 // BGEOM_PASTEMASK_TOP = 0x??
475
476 // COMPONENT_VALUE / DEVICE_TYPE / USER_PART_NUMBER
477 // REF_DES / TOLERANCE
484
485 // ANALYSIS
492
493 // DRAWING_FORMAT
499
500 // PACKAGE_GEOMETRY
518
519 // MANUFACTURING
534
535 // CONSTRAINTS_REGION
536 CREG_ALL = 0xFD,
537
538 // PACKAGE_KEEPIN / ROUTE_KEEPIN
540
541 // PACKAGE_KEEPOUT / ROUTE_KEEPOUT / VIA_KEEPOUT
545 };
546
547 uint8_t m_Class;
548 uint8_t m_Subclass;
549
550 bool operator==( const LAYER_INFO& ) const = default;
551};
552
553
560{
561 static constexpr uint8_t BLOCK_TYPE_CODE = 0x01;
562
564 uint8_t m_SubType;
565 uint32_t m_Key;
566 uint32_t m_Next;
567 uint32_t m_Parent;
568 uint32_t m_Unknown1;
569
571
572 uint32_t m_Width;
573
574 int32_t m_StartX;
575 int32_t m_StartY;
576 int32_t m_EndX;
577 int32_t m_EndY;
578
579 double m_CenterX; // Center
580 double m_CenterY;
581 double m_Radius;
582
583 std::array<int32_t, 4> m_BoundingBoxCoords;
584};
585
586
592{
593 static constexpr uint8_t BLOCK_TYPE_CODE = 0x03;
594
595 struct SUB_0x6C
596 {
597 uint32_t m_NumEntries;
598 std::vector<uint32_t> m_Entries;
599 };
600
602 {
603 uint16_t m_X0;
604 uint16_t m_X1;
605 std::vector<uint32_t> m_Entries;
606 };
607
608 struct SUB_0xF6
609 {
610 std::array<uint32_t, 20> m_Entries;
611 };
612
613 uint16_t m_Hdr1;
614
615 uint32_t m_Key;
616 uint32_t m_Next;
617
618
620
621 uint8_t m_SubType;
622 uint8_t m_Hdr2;
623 uint16_t m_Size;
624
626
627 std::variant<uint32_t, std::array<uint32_t, 2>, std::string, SUB_0x6C, SUB_0x70_0x74, SUB_0xF6> m_Substruct;
628};
629
647
648
655{
656 static constexpr uint8_t BLOCK_TYPE_CODE = 0x04;
657
658 uint8_t m_Type;
659 uint16_t m_R;
660 uint32_t m_Key;
661 uint32_t m_Next;
662 uint32_t m_Net;
663 uint32_t m_ConnItem;
664
666};
667
668
699
700
706{
707 static constexpr uint8_t BLOCK_TYPE_CODE = 0x06;
708
709 uint32_t m_Key;
710
711 // Pointer to the next BLK_0x06_COMPONENT
712 uint32_t m_Next;
713 // Pointer to COMP_DEVICE_TYPE string
715 // Pointer to SYM_NAME string
716 uint32_t m_SymbolName;
717 // Points to 0x07, first instance
719 // Points to 0x0F, function slot
721 // Points to 0x08, pin number
723
724 // Points to 0x03, first 'field'
725 uint32_t m_Fields;
726
728};
729
730
758
759
766{
767 static constexpr uint8_t BLOCK_TYPE_CODE = 0x08;
768
769 uint8_t m_Type;
770 uint16_t m_R;
771 uint32_t m_Key;
772
775
776 uint32_t m_Next;
777
779
781 uint32_t m_PinNamePtr;
782
784
785 uint32_t m_Ptr4;
786
787 uint32_t GetStrPtr() const
788 {
789 return m_StrPtr.value_or( m_StrPtr16x.value_or( 0 ) );
790 }
791};
792
793
799{
800 static constexpr uint8_t BLOCK_TYPE_CODE = 0x09;
801
802 uint32_t m_Key;
803
804 std::array<uint32_t, 4> m_UnknownArray;
805
807
810 uint32_t m_Unknown2;
813
815};
816
817
822{
823 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0A;
824
825 uint8_t m_T;
827 uint32_t m_Key;
828 uint32_t m_Next;
829 uint32_t m_Unknown1;
830
832
833 std::array<int32_t, 4> m_Coords;
834 std::array<uint32_t, 4> m_Unknown4;
835 std::array<uint32_t, 5> m_Unknown5;
836
838};
839
840
846{
847 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0C;
848
850 {
851 // These are in the same order as the pad shapes, at least for the 'simple' shapes
852 CIRCLE = 0x02,
853 OCTAGON = 0x03,
854 CROSS = 0x04,
855 SQUARE = 0x05,
856 RECTANGLE = 0x06,
857 DIAMOND = 0x07,
858 PENTAGON = 0x0a,
859 OBLONG_X = 0x0b,
860 OBLONG_Y = 0x0c,
861 HEXAGON_X = 0x0f,
862 HEXAGON_Y = 0x10,
863 TRIANGLE = 0x12,
864 };
865
866 uint8_t m_T;
868 uint32_t m_Key;
869 uint32_t m_Next;
870
871 uint32_t m_Unknown1;
872 uint32_t m_Unknown2;
873
877
881
882 uint32_t m_Unknown4;
883
885
886 std::array<int32_t, 2> m_Coords;
887 std::array<int32_t, 2> m_Size;
888
889 uint32_t m_GroupPtr;
890 uint32_t m_Unknown6;
891 uint32_t m_Unknown7;
892
894
895 uint32_t GetShape() const
896 {
897 return m_Shape16x.value_or( m_Shape.value_or( 0 ) );
898 }
899};
900
901
908{
909 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0D;
910
911 uint32_t m_Key;
912 uint32_t m_NameStrId;
913 uint32_t m_Next;
914
916
917 int32_t m_CoordsX;
918 int32_t m_CoordsY;
919
920 uint32_t m_PadStack;
921 uint32_t m_Unknown2;
922
924
925 uint32_t m_Flags;
926 uint32_t m_Rotation;
927};
928
929
934{
935 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0E;
936
937 uint8_t m_T;
939 uint32_t m_Key;
940 uint32_t m_Next;
941 uint32_t m_FpPtr;
942
943 uint32_t m_Unknown1;
944 uint32_t m_Unknown2;
945 uint32_t m_Unknown3;
946
949
950 std::array<int32_t, 4> m_Coords;
951
952 std::array<uint32_t, 3> m_UnknownArr;
954 uint32_t m_Rotation;
955};
956
957
964{
965 static constexpr uint8_t BLOCK_TYPE_CODE = 0x0F;
966
967 uint32_t m_Key;
968
969 uint32_t m_SlotName;
970
972
973 std::array<char, 32> m_CompDeviceType;
974
976
978
979 uint32_t m_Ptr0x06;
980 uint32_t m_Ptr0x11;
981
982 uint32_t m_Unknown2;
983
984 std::string GetCompDeviceTypeStr() const
985 {
986 // The string is stored as a fixed-length array, but is null-terminated
987 return std::string( m_CompDeviceType.data(), strnlen( m_CompDeviceType.data(), m_CompDeviceType.size() ) );
988 }
989};
990
991
998{
999 static constexpr uint8_t BLOCK_TYPE_CODE = 0x10;
1000
1001 uint32_t m_Key;
1002
1004
1006
1008
1009 uint32_t m_PtrX12;
1010 uint32_t m_Unknown3;
1012 uint32_t m_Slots; // 0x0F?
1013 uint32_t m_Fields; // Presumably a pointer to a string
1014};
1015
1016
1022{
1023 static constexpr uint8_t BLOCK_TYPE_CODE = 0x11;
1024
1025 uint8_t m_Type;
1026 uint16_t m_R;
1027 uint32_t m_Key;
1031 uint32_t m_Next;
1034 uint32_t m_Unknown1;
1035
1037};
1038
1039
1045{
1046 static constexpr uint8_t BLOCK_TYPE_CODE = 0x12;
1047
1048 uint8_t m_Type;
1049 uint16_t m_R;
1050 uint32_t m_Key;
1051 uint32_t m_Ptr1;
1052 uint32_t m_Ptr2;
1053 uint32_t m_Ptr3;
1054 uint32_t m_Unknown1;
1055
1058};
1059
1060
1067{
1068 static constexpr uint8_t BLOCK_TYPE_CODE = 0x14;
1069
1070 uint8_t m_Type;
1072 uint32_t m_Key;
1073 uint32_t m_Next;
1074 uint32_t m_Parent;
1075 uint32_t m_Flags;
1076
1078
1080 uint32_t m_Ptr0x03;
1081 uint32_t m_Ptr0x26;
1082};
1083
1084
1093{
1094 // Segments can be one of 3 codes, so we don't have a BLOCK_TYPE_CODE constant
1095 // for this struct.
1096
1097 uint32_t m_Key;
1098 uint32_t m_Next;
1099 uint32_t m_Parent;
1100 uint32_t m_Flags;
1101
1103
1104 uint32_t m_Width;
1105
1106 int32_t m_StartX;
1107 int32_t m_StartY;
1108 int32_t m_EndX;
1109 int32_t m_EndY;
1110};
1111
1117{
1118 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1A;
1119
1120 uint8_t m_Type;
1121 uint16_t m_T2;
1122 uint32_t m_Key;
1123
1124 std::array<uint32_t, 20> m_UnknownArray;
1125};
1126
1133{
1134 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1B;
1135
1136 uint32_t m_Key;
1137 uint32_t m_Next;
1138 uint32_t m_NetName;
1139
1140 uint32_t m_Unknown1;
1141
1143
1144 uint32_t m_Type;
1145
1147 uint32_t m_Ratline;
1149 uint32_t m_FieldsPtr;
1151 uint32_t m_ModelPtr;
1155};
1156
1157
1171
1172
1178{
1202
1203 uint8_t m_Type;
1207
1209
1210 // Pad size
1211 int32_t m_W;
1212 int32_t m_H;
1213
1214 // In rounded rectangles, this is the corner radius.
1215 // In chamfered rectangles, this is the chamfer size.
1217
1218 // This is the pad component offset
1219 int32_t m_OffsetX;
1220 int32_t m_OffsetY;
1221
1228 uint32_t m_ShapePtr;
1229
1230 // In versions < 17.2, seems to be not present in the last entry.
1231 std::optional<uint32_t> m_Z2;
1232};
1233
1234
1243{
1244 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1C;
1245
1247 {
1252 {
1254 // NPTHs seem to have this instead of 0x01
1255 // SMDs seems to have this or 0x01, no clear pattern identified
1257 };
1258
1259 uint32_t m_DrillSize;
1263 // Not sure these are in the right place but they're in here somewhere (usually zero)
1266
1267 // Drill char presumably somewhere in here - can cross-match with 0x0C PIN_DEF to find
1269 // Mask or enum of pad flags, including plating
1270 uint8_t m_Flags;
1271 // An ASCII char, or 0x00
1273 uint8_t m_D;
1274
1275 // Probably some kind of type:
1276 // 0x0000 for through-hole
1277 // 0x0002 for SMD
1278 // 0x0400 for slots
1279 uint16_t m_Unknown_1;
1280
1281 uint16_t m_ArrayNX;
1282 uint16_t m_ArrayNY;
1283
1285 // Also unsure if these are in the right place (all usually 0?)
1288
1291 uint32_t m_Unknown_2;
1292 uint32_t m_SlotX;
1293 uint32_t m_SlotY;
1294 uint32_t m_Unknown_3;
1295
1297 };
1298
1300 {
1305 {
1306 // Some through-holes have this, some don't
1309 };
1310
1311 // Presumably the same as the one in the v16x header
1313 uint32_t m_Unknown1; // 0?
1314 uint32_t m_Unknown2; // 0?
1315
1317
1318 // Not sure if this is really a substruct
1319 uint8_t m_A; // Only lower 4 bits (top 4 are type)
1320 uint8_t m_B;
1322 uint8_t m_Flags;
1323 uint8_t m_D;
1324
1325 uint32_t m_unknown3; // 1?
1326 uint32_t m_Unknown4; // 0?
1327
1328 uint16_t m_ArrayNX;
1329 uint16_t m_ArrayNY;
1331 uint16_t m_Unknown5; // 0?
1332
1333 // Again, these are tentatively placed, they're always zero so far,
1334 // so it's hard to say where they go.
1335 // Assuming they follow the v16x layout and come after the layer count
1338 uint32_t m_Unknown6a;
1339 uint32_t m_Unknown6b;
1340
1341 uint32_t m_DrillSize;
1344 uint32_t m_SlotX;
1345 uint32_t m_SlotY;
1346 uint32_t m_ToleranceTravelPos; // "TOLERANCE_TRAVEL" in BeagleBone_Black drill table
1348
1352 uint32_t m_DrillChars; // Presumably 4 drill chars
1353
1354 // Probably holds secondary drill parameters and other new V17.2 features
1355 std::array<uint32_t, 21> m_UnknownArr3;
1356
1357 // To check - this could be another component?
1359 };
1360
1362
1366 uint8_t m_N;
1368 uint32_t m_Key;
1369 uint32_t m_Next;
1370
1371 // The name of the padstack
1372 uint32_t m_PadStr;
1373
1374 // The header fields are very different between v16x and v17.x+
1375 using HEADER = std::variant<HEADER_v16x, HEADER_v17x>;
1377
1400 {
1401 // V<172 verified slots
1406
1407 // V>=172 verified slots
1412 };
1413
1419 {
1420 // First slot: Antipad
1422 // Thermal relief shape
1424 // Pad shape
1425 PAD = 2,
1426 // Unsure what this layer component slot is
1427 // But I suspect it's keepout, as that was added in V172.
1429 };
1430
1443 std::vector<PADSTACK_COMPONENT> m_Components;
1444
1450
1457 std::vector<uint32_t> m_UnknownArrN;
1458
1459
1460 // Dispatch common properties to the header variant.
1461 // Each method uses a local Visitor struct so that adding a new HEADER alternative
1462 // produces a compile error rather than a silent runtime fallback.
1463 uint32_t GetDrillSize() const
1464 {
1465 struct Visitor
1466 {
1467 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_DrillSize; }
1468 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_DrillSize; }
1469 };
1470 return std::visit( Visitor{}, m_Header );
1471 }
1472
1473 uint32_t GetLayerCount() const
1474 {
1475 struct Visitor
1476 {
1477 uint32_t operator()( const HEADER_v16x& h ) const { return h.m_LayerCount; }
1478 uint32_t operator()( const HEADER_v17x& h ) const { return h.m_LayerCount; }
1479 };
1480 return std::visit( Visitor{}, m_Header );
1481 }
1482
1483 bool IsPlated() const
1484 {
1485 struct Visitor
1486 {
1487 bool operator()( const HEADER_v16x& h ) const
1488 {
1489 return ( h.m_Flags & HEADER_v16x::PAD_FLAGS::FLAG_PLATED ) != 0;
1490 }
1491 bool operator()( const HEADER_v17x& h ) const
1492 {
1493 return ( h.m_Flags & HEADER_v17x::PAD_FLAGS::FLAG_PLATED ) != 0;
1494 }
1495 };
1496 return std::visit( Visitor{}, m_Header );
1497 }
1498};
1499
1500
1505{
1506 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1D;
1507
1508 uint32_t m_Key;
1509 uint32_t m_Next;
1510 uint32_t m_NameStrKey;
1511 uint32_t m_FieldPtr;
1512 uint16_t m_SizeA;
1513 uint16_t m_SizeB;
1514
1520 std::vector<std::array<uint8_t, 56>> m_DataB;
1525 std::vector<std::array<uint8_t, 256>> m_DataA;
1526
1528};
1529
1530
1536{
1537 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1E;
1538
1539 uint8_t m_Type;
1540 uint16_t m_T2;
1541 uint32_t m_Key;
1542 uint32_t m_Next;
1543
1544 // Present in V_161, 16.2 (TWR-MCF51JG LAY-26493) and Kinoma (V_164); no 16.0 sample yet
1547
1548 uint32_t m_StrPtr;
1549 uint32_t m_Size;
1550
1551 std::string m_String;
1552
1554};
1555
1556
1561{
1562 static constexpr uint8_t BLOCK_TYPE_CODE = 0x1F;
1563
1564 uint32_t m_Key;
1565 uint32_t m_Next;
1566 uint32_t m_Unknown2;
1567 uint32_t m_Unknown3;
1568 uint32_t m_Unknown4;
1569 uint16_t m_Unknown5;
1570 uint16_t m_Size;
1571
1575 std::vector<uint8_t> m_Substruct;
1576};
1577
1578
1590{
1591 static constexpr uint8_t BLOCK_TYPE_CODE = 0x20;
1592
1593 uint8_t m_Type;
1594 uint16_t m_R;
1595 uint32_t m_Key;
1596 uint32_t m_Next;
1597 std::array<uint32_t, 7> m_UnknownArray1;
1598
1600};
1601
1608{
1609 static constexpr uint8_t BLOCK_TYPE_CODE = 0x21;
1610
1611 uint8_t m_Type;
1612 uint16_t m_R;
1613 uint32_t m_Size;
1614 uint32_t m_Key;
1615
1621 std::vector<uint8_t> m_Data;
1622};
1623
1624
1629{
1630 static constexpr uint8_t BLOCK_TYPE_CODE = 0x22;
1631
1632 uint8_t m_Type;
1633 uint16_t m_T2;
1634 uint32_t m_Key;
1635
1637
1638 std::array<uint32_t, 8> m_UnknownArray;
1639};
1640
1641
1646{
1647 static constexpr uint8_t BLOCK_TYPE_CODE = 0x23;
1648
1649 uint8_t m_Type;
1651 uint32_t m_Key;
1652 uint32_t m_Next;
1653
1654 std::array<uint32_t, 2> m_Flags;
1655
1656 uint32_t m_Ptr1;
1657 uint32_t m_Ptr2;
1658 uint32_t m_Ptr3;
1659
1660 std::array<int32_t, 5> m_Coords;
1661
1662 std::array<uint32_t, 4> m_Unknown1;
1663
1665
1667};
1668
1669
1677{
1678 static constexpr uint8_t BLOCK_TYPE_CODE = 0x24;
1679
1680 uint8_t m_Type;
1682 uint32_t m_Key;
1683 uint32_t m_Next;
1684 uint32_t m_Parent;
1685 uint32_t m_Unknown1;
1686
1688
1689 std::array<int32_t, 4> m_Coords;
1690
1691 uint32_t m_Ptr2;
1692
1693 uint32_t m_Unknown3;
1694 uint32_t m_Unknown4;
1696 uint32_t m_Rotation;
1697};
1698
1699
1705{
1706 static constexpr uint8_t BLOCK_TYPE_CODE = 0x26;
1707
1708 uint8_t m_Type;
1709 uint16_t m_R;
1710 uint32_t m_Key;
1711 uint32_t m_MemberPtr;
1712
1714
1715 uint32_t m_GroupPtr;
1716 uint32_t m_ConstPtr;
1717
1719};
1720
1721
1731{
1732 static constexpr uint8_t BLOCK_TYPE_CODE = 0x27;
1733
1734 std::vector<uint32_t> m_Refs;
1735};
1736
1737
1748{
1749 static constexpr uint8_t BLOCK_TYPE_CODE = 0x28;
1750
1751 uint8_t m_Type;
1753 uint32_t m_Key;
1754 uint32_t m_Next;
1755 uint32_t m_Ptr1;
1756 uint32_t m_Unknown1;
1757
1760
1761 uint32_t m_Ptr2;
1762 uint32_t m_Ptr3;
1765 uint32_t m_Unknown4;
1766 uint32_t m_Unknown5;
1767
1769
1770 uint32_t m_Ptr6;
1771
1773
1774 std::array<int32_t, 4> m_Coords;
1775
1776 uint32_t GetTablePtr() const
1777 {
1778 return m_TablePtr.value_or( m_TablePtr_16x.value_or( 0 ) );
1779 }
1780};
1781
1782
1789{
1790 static constexpr uint8_t BLOCK_TYPE_CODE = 0x29;
1791
1792 uint8_t m_Type;
1793 uint16_t m_T;
1794 uint32_t m_Key;
1795
1796 // Points to something in the header
1797 uint32_t m_Ptr1;
1798 uint32_t m_Ptr2;
1799
1800 uint32_t m_Null; // Null value
1801
1802 uint32_t m_Ptr3;
1803
1804 int32_t m_Coord1;
1805 int32_t m_Coord2;
1806
1808
1809 uint32_t m_Unknown1;
1810
1811 // Pointer to a string, e.g., "2" in R0603
1812 uint32_t m_PtrX30;
1813
1814 uint32_t m_Unknown2;
1815 uint32_t m_Unknown3;
1816 uint32_t m_Unknown4;
1817};
1818
1819
1849
1850
1858{
1859 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2B;
1860
1861 uint32_t m_Key;
1862
1863 uint32_t m_FpStrRef;
1864 uint32_t m_Unknown1;
1865
1866 // Could these be signed?
1867 std::array<uint32_t, 4> m_Coords;
1868
1869 uint32_t m_Next;
1874
1876 uint32_t m_FieldsPtr;
1877
1881
1884};
1885
1886
1944
1945
1954{
1955 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2D;
1956
1958 uint8_t m_Layer; // 0 = top (F_Cu), 1 = bottom (B_Cu)
1960
1961 uint32_t m_Key;
1962
1963 uint32_t m_Next;
1964
1966
1967 // Unsure what 16x means
1969
1970 uint16_t m_Unknown2;
1971 uint16_t m_Unknown3;
1972
1974
1975 uint32_t m_Flags;
1976
1977 uint32_t m_Rotation;
1978 int32_t m_CoordX;
1979 int32_t m_CoordY;
1980
1981 // Presumably equivalent to m_InstRef16x
1983
1986 uint32_t m_TextPtr; // Points to 0x30
1987
1989 uint32_t m_AreasPtr;
1992
1993 uint32_t GetInstRef() const
1994 {
1995 return m_InstRef.value_or( m_InstRef16x.value_or( 0 ) );
1996 }
1997};
1998
1999
2005{
2006 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2E;
2007
2008 uint8_t m_Type;
2009 uint16_t m_T2;
2010 uint32_t m_Key;
2011 uint32_t m_Next;
2013 uint32_t m_Unknown1;
2014 int32_t m_CoordX;
2015 int32_t m_CoordY;
2017 uint32_t m_Unknown2;
2018
2020};
2021
2022
2027{
2028 static constexpr uint8_t BLOCK_TYPE_CODE = 0x2F;
2029
2030 uint8_t m_Type;
2031 uint16_t m_T2;
2032 uint32_t m_Key;
2033
2034 std::array<uint32_t, 6> m_UnknownArray;
2035};
2036
2037
2108
2109
2115{
2116 static constexpr uint8_t BLOCK_TYPE_CODE = 0x31;
2117
2129
2130 uint8_t m_T;
2132 uint32_t m_Key;
2134
2135 int32_t m_CoordsX;
2136 int32_t m_CoordsY;
2137
2138 uint16_t m_Unknown;
2139 uint16_t m_Len;
2140
2142
2143 std::string m_Value;
2144};
2145
2146
2153{
2154 static constexpr uint8_t BLOCK_TYPE_CODE = 0x32;
2155
2156 uint8_t m_Type;
2158 uint32_t m_Key;
2159 uint32_t m_Next;
2160 uint32_t m_NetPtr;
2161 uint32_t m_Flags;
2162
2164
2165 uint32_t m_NextInFp;
2166 uint32_t m_ParentFp;
2167 uint32_t m_Track;
2168 uint32_t m_PadPtr;
2169 uint32_t m_Ptr6;
2170 uint32_t m_Ratline;
2173
2175
2176 uint32_t m_NameText;
2177 uint32_t m_Ptr11;
2178
2179 std::array<int32_t, 4> m_Coords;
2180};
2181
2182
2189{
2190 static constexpr uint8_t BLOCK_TYPE_CODE = 0x33;
2191
2193 uint32_t m_Key;
2194 uint32_t m_Next;
2195 uint32_t m_NetPtr;
2196 uint32_t m_Unknown2;
2197
2199
2201
2203
2204 int32_t m_CoordsX;
2205 int32_t m_CoordsY;
2206
2208 uint32_t m_Padstack;
2211
2212 uint32_t m_Unknown4;
2213 uint32_t m_Unknown5;
2214
2215 std::array<int32_t, 4> m_BoundingBoxCoords;
2216};
2217
2218
2223{
2224 static constexpr uint8_t BLOCK_TYPE_CODE = 0x34;
2225
2226 uint8_t m_T;
2228 uint32_t m_Key;
2229 uint32_t m_Next;
2230 uint32_t m_Ptr1;
2231
2233
2234 uint32_t m_Flags;
2236 uint32_t m_Ptr3;
2237 uint32_t m_Unknown2;
2238};
2239
2240
2245{
2246 static constexpr uint8_t BLOCK_TYPE_CODE = 0x35;
2247
2248 uint8_t m_T2;
2249 uint16_t m_T3; // Always 0x01 so far
2250
2251 uint32_t m_Next;
2252
2253 uint32_t m_Unknown1; // 0x7fffffff usually
2254
2255 std::array<char, 20> m_LogFile; // Usually "terminator.log"
2256
2257 uint32_t m_Unknown2; // 0x01010101 usually
2258
2259 std::array<char, 20> m_UnusedFile; // Always 0x00
2260 std::array<char, 20> m_EclReportFile; // "eclrpt.txt"
2261 std::array<char, 20> m_EclLogFile; // "eclrep.log"
2262
2263 uint32_t m_Unknown3;
2264
2265 std::array<char, 8> m_Version; // Always '1.0'
2266
2267 uint32_t m_Unknown4;
2268 uint32_t m_Unknown5;
2269 uint32_t m_Unknown6;
2270
2272 uint32_t m_Key;
2273};
2274
2275
2282{
2283 static constexpr uint8_t BLOCK_TYPE_CODE = 0x36;
2284
2285 uint16_t m_Code;
2286 uint32_t m_Key;
2287 uint32_t m_Next;
2288
2290
2291 uint32_t m_NumItems;
2292 uint32_t m_Count;
2293 uint32_t m_LastIdx;
2294 uint32_t m_Unknown2;
2295
2297
2306
2313
2314 struct X05
2315 {
2316 std::array<uint8_t, 28> m_Unknown;
2317
2318 // The trailing word first appears in 17.5. On 17.4 the record is 28 bytes, and
2319 // reading a phantom word here overruns every slot and desyncs the object stream.
2321 };
2322
2323 struct X06
2324 {
2325 uint16_t m_N;
2326 uint8_t m_R;
2327 uint8_t m_S;
2328 uint32_t m_Unknown1;
2329
2331 };
2332
2349
2350 struct X0B
2351 {
2352 std::array<uint8_t, 1016> m_Unknown;
2353 };
2354
2355 struct X0C
2356 {
2357 std::array<uint8_t, 232> m_Unknown;
2358 };
2359
2360 struct X0D
2361 {
2362 std::array<uint8_t, 200> m_Unknown;
2363 };
2364
2365 struct X0F
2366 {
2367 uint32_t m_Key;
2368 std::array<uint32_t, 3> m_Ptrs;
2369 uint32_t m_Ptr2;
2370 };
2371
2372 struct X10
2373 {
2374 std::array<uint8_t, 108> m_Unknown;
2375
2376 // V18 has an extra uint32 "somewhere" in this block
2378 };
2379
2380 // So far only seen in a V175 file (Jetson)
2381 struct X12
2382 {
2383 // No point reading this before we can use it
2384 // std::array<uint8_t, 1052> m_Unknown;
2385 };
2386
2387 using SubstructVariant = std::variant<X02, X03, X05, X06, FontDef_X08, X0B, X0C, X0D, X0F, X10, X12>;
2388
2389 std::vector<SubstructVariant> m_Items;
2390};
2391
2392
2401{
2402 static constexpr uint8_t BLOCK_TYPE_CODE = 0x37;
2403
2404 uint8_t m_T;
2405 uint16_t m_T2;
2406 uint32_t m_Key;
2407 uint32_t m_GroupPtr;
2408 uint32_t m_Next;
2409 uint32_t m_Capacity;
2410 uint32_t m_Count;
2411 uint32_t m_Unknown2;
2412
2414
2415 std::vector<uint32_t> m_Ptrs;
2416};
2417
2418
2439
2440
2445{
2446 static constexpr uint8_t BLOCK_TYPE_CODE = 0x39;
2447
2448 uint32_t m_Key;
2449 uint32_t m_Parent;
2450 uint32_t m_Head;
2451
2452 // Array of 22 uint16_t values
2453 std::array<uint16_t, 22> m_X;
2454};
2455
2456
2461{
2462 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3A;
2463
2465 uint32_t m_Key;
2466 uint32_t m_Next;
2467 uint32_t m_Unknown;
2468
2470};
2471
2472
2478{
2479 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3B;
2480
2481 uint8_t m_T;
2482 uint16_t m_SubType;
2483 uint32_t m_Len;
2484
2485 std::string m_Name;
2486 std::string m_Type;
2487
2488 uint32_t m_Unknown1;
2489 uint32_t m_Unknown2;
2490
2492
2493 std::string m_Value;
2494};
2495
2496
2502{
2503 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3E;
2504
2505 uint32_t m_Key;
2506 std::array<uint32_t, 9> m_Unknown;
2507};
2508
2509
2511{
2512 static constexpr uint8_t BLOCK_TYPE_CODE = 0x3C;
2513
2514 uint8_t m_T;
2515 uint16_t m_T2;
2516 uint32_t m_Key;
2517
2519
2521 std::vector<uint32_t> m_Entries;
2522};
2523
2524
2531template <typename T>
2532concept ALLEGRO_BLOCK_DATA = requires
2533{
2534 { T::BLOCK_TYPE_CODE }->std::convertible_to<uint8_t>;
2535}
2536|| std::is_same_v<T, BLK_0x15_16_17_SEGMENT>;
2537
2538
2539} // 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
@ CLIP_N
Next CLIP_n value.
@ MODEL_3D_FILE
3D model file name, size, mtime and display colour
@ PHYS_CONSTRAINT_SET
Physical Constraint Set assignment.
@ CLIP_DRAWING
Items pasted from a clipboard, holds CLIP_<n> or FALSE.
@ 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
COND_GE< FMT_VER::V_181, uint32_t > m_Ptr0x3E_V181
Zero or key of a 0x3E block.
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).
std::array< char, 8 > m_Version
static constexpr uint8_t BLOCK_TYPE_CODE
std::array< char, 20 > m_EclLogFile
uint32_t m_Key
Key of this record.
std::array< char, 20 > m_LogFile
std::array< char, 20 > m_UnusedFile
std::array< char, 20 > m_EclReportFile
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
std::vector< uint32_t > m_Ptrs
static constexpr uint8_t BLOCK_TYPE_CODE
COND_GE< FMT_VER::V_174, uint32_t > m_Unknown3
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, uint32_t > m_Unknown2g_V18
COND_LT< FMT_VER::V_180, std::array< uint32_t, 7 > > m_Unknown2_preV18
COND_GE< FMT_VER::V_180, std::array< uint32_t, 9 > > m_Unknown5_V18
std::array< char, 60 > m_AllegroVersion
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_0x03_2
COND_GE< FMT_VER::V_180, uint32_t > m_0x27_End_V18
uint32_t Get_0x27_End() const
COND_LT< FMT_VER::V_180, std::array< uint32_t, 17 > > m_Unknown5_preV18
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, std::array< uint32_t, 9 > > m_Unknown2h_V18
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, 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