KiCad PCB EDA Suite
|
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <pcb_io/kicad_legacy/pcb_io_kicad_legacy.h>
#include <wx/ffile.h>
#include <wx/log.h>
#include <wx/string.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <wx/txtstrm.h>
#include <boost/ptr_container/ptr_map.hpp>
#include <string_utils.h>
#include <locale_io.h>
#include <macros.h>
#include <filter_reader.h>
#include <zones.h>
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <core/ignore.h>
#include <pad.h>
#include <pcb_track.h>
#include <pcb_text.h>
#include <zone.h>
#include <pcb_dimension.h>
#include <pcb_shape.h>
#include <pcb_target.h>
#include <pcb_plot_params.h>
#include <pcb_plot_params_parser.h>
#include <trigo.h>
#include <confirm.h>
#include <math/util.h>
#include <progress_reporter.h>
Go to the source code of this file.
Classes | |
struct | LP_CACHE |
The footprint portion of the PLUGIN API, and only for the PCB_IO_KICAD_LEGACY, so therefore is private to this implementation file, i.e. More... | |
Macros | |
#define | FIRST_LAYER 0 |
#define | FIRST_COPPER_LAYER 0 |
#define | LAYER_N_BACK 0 |
#define | LAYER_N_2 1 |
#define | LAYER_N_3 2 |
#define | LAYER_N_4 3 |
#define | LAYER_N_5 4 |
#define | LAYER_N_6 5 |
#define | LAYER_N_7 6 |
#define | LAYER_N_8 7 |
#define | LAYER_N_9 8 |
#define | LAYER_N_10 9 |
#define | LAYER_N_11 10 |
#define | LAYER_N_12 11 |
#define | LAYER_N_13 12 |
#define | LAYER_N_14 13 |
#define | LAYER_N_15 14 |
#define | LAYER_N_FRONT 15 |
#define | LAST_COPPER_LAYER LAYER_N_FRONT |
#define | FIRST_NON_COPPER_LAYER 16 |
#define | ADHESIVE_N_BACK 16 |
#define | ADHESIVE_N_FRONT 17 |
#define | SOLDERPASTE_N_BACK 18 |
#define | SOLDERPASTE_N_FRONT 19 |
#define | SILKSCREEN_N_BACK 20 |
#define | SILKSCREEN_N_FRONT 21 |
#define | SOLDERMASK_N_BACK 22 |
#define | SOLDERMASK_N_FRONT 23 |
#define | DRAW_N 24 |
#define | COMMENT_N 25 |
#define | ECO1_N 26 |
#define | ECO2_N 27 |
#define | EDGE_N 28 |
#define | LAST_NON_COPPER_LAYER 28 |
#define | LAYER_BACK (1 << LAYER_N_BACK) |
bit mask for copper layer | |
#define | LAYER_2 (1 << LAYER_N_2) |
bit mask for layer 2 | |
#define | LAYER_3 (1 << LAYER_N_3) |
bit mask for layer 3 | |
#define | LAYER_4 (1 << LAYER_N_4) |
bit mask for layer 4 | |
#define | LAYER_5 (1 << LAYER_N_5) |
bit mask for layer 5 | |
#define | LAYER_6 (1 << LAYER_N_6) |
bit mask for layer 6 | |
#define | LAYER_7 (1 << LAYER_N_7) |
bit mask for layer 7 | |
#define | LAYER_8 (1 << LAYER_N_8) |
bit mask for layer 8 | |
#define | LAYER_9 (1 << LAYER_N_9) |
bit mask for layer 9 | |
#define | LAYER_10 (1 << LAYER_N_10) |
bit mask for layer 10 | |
#define | LAYER_11 (1 << LAYER_N_11) |
bit mask for layer 11 | |
#define | LAYER_12 (1 << LAYER_N_12) |
bit mask for layer 12 | |
#define | LAYER_13 (1 << LAYER_N_13) |
bit mask for layer 13 | |
#define | LAYER_14 (1 << LAYER_N_14) |
bit mask for layer 14 | |
#define | LAYER_15 (1 << LAYER_N_15) |
bit mask for layer 15 | |
#define | LAYER_FRONT (1 << LAYER_N_FRONT) |
bit mask for component layer | |
#define | ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) |
#define | ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) |
#define | SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) |
#define | SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) |
#define | SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) |
#define | SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) |
#define | SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) |
#define | SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) |
#define | DRAW_LAYER (1 << DRAW_N) |
#define | COMMENT_LAYER (1 << COMMENT_N) |
#define | ECO1_LAYER (1 << ECO1_N) |
#define | ECO2_LAYER (1 << ECO2_N) |
#define | EDGE_LAYER (1 << EDGE_N) |
#define | ALL_NO_CU_LAYERS 0x1FFF0000 |
#define | ALL_CU_LAYERS 0x0000FFFF |
#define | FRONT_TECH_LAYERS |
#define | BACK_TECH_LAYERS |
#define | ALL_TECH_LAYERS (FRONT_TECH_LAYERS | BACK_TECH_LAYERS) |
#define | BACK_LAYERS (LAYER_BACK | BACK_TECH_LAYERS) |
#define | FRONT_LAYERS (LAYER_FRONT | FRONT_TECH_LAYERS) |
#define | ALL_USER_LAYERS (DRAW_LAYER | COMMENT_LAYER | ECO1_LAYER | ECO2_LAYER ) |
#define | NO_LAYERS 0x00000000 |
#define | PCB_LEGACY_TEXT_is_REFERENCE 0 |
#define | PCB_LEGACY_TEXT_is_VALUE 1 |
#define | PCB_LEGACY_TEXT_is_DIVERS 2 |
#define | PCB_LEGACY_INTERNAL_UNIT 10000 |
#define | SZ(x) (sizeof(x)-1) |
Get the length of a string constant, at compile time. | |
#define | MASK(x) (1<<(x)) |
#define | TESTLINE(x) ( !strncasecmp( line, x, SZ( x ) ) && isSpace( line[SZ( x )] ) ) |
C string compare test for a specific length of characters. | |
#define | TESTSUBSTR(x) ( !strncasecmp( line, x, SZ( x ) ) ) |
C sub-string compare test for a specific length of characters. | |
#define | READLINE(rdr) rdr->ReadLine() |
Typedefs | |
typedef PCB_IO_KICAD_LEGACY::BIU | BIU |
typedef unsigned | LEG_MASK |
typedef unsigned | LAYER_MSK |
typedef boost::ptr_map< std::string, FOOTPRINT > | FOOTPRINT_MAP |
Functions | |
static bool | isSpace (int c) |
static GR_TEXT_H_ALIGN_T | horizJustify (const char *horizontal) |
static GR_TEXT_V_ALIGN_T | vertJustify (const char *vertical) |
int | layerMaskCountSet (LEG_MASK aMask) |
Count the number of set layers in the mask. | |
bool | is_leg_copperlayer_valid (int aCu_Count, int aLegacyLayerNum) |
static int | intParse (const char *next, const char **out=nullptr) |
Parse an ASCII integer string with possible leading whitespace into an integer and updates the pointer at out if it is not NULL, just like "man strtol()". | |
static long | hexParse (const char *next, const char **out=nullptr) |
Parse an ASCII hex integer string with possible leading whitespace into a long integer and updates the pointer at out if it is not nullptr, just like "man strtol". | |
Variables | |
static const char | delims [] = " \t\r\n" |
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) |
Definition at line 156 of file pcb_io_kicad_legacy.cpp.
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) |
Definition at line 157 of file pcb_io_kicad_legacy.cpp.
#define ADHESIVE_N_BACK 16 |
Definition at line 123 of file pcb_io_kicad_legacy.cpp.
#define ADHESIVE_N_FRONT 17 |
Definition at line 124 of file pcb_io_kicad_legacy.cpp.
#define ALL_CU_LAYERS 0x0000FFFF |
Definition at line 174 of file pcb_io_kicad_legacy.cpp.
#define ALL_NO_CU_LAYERS 0x1FFF0000 |
Definition at line 173 of file pcb_io_kicad_legacy.cpp.
#define ALL_TECH_LAYERS (FRONT_TECH_LAYERS | BACK_TECH_LAYERS) |
Definition at line 179 of file pcb_io_kicad_legacy.cpp.
#define ALL_USER_LAYERS (DRAW_LAYER | COMMENT_LAYER | ECO1_LAYER | ECO2_LAYER ) |
Definition at line 183 of file pcb_io_kicad_legacy.cpp.
#define BACK_LAYERS (LAYER_BACK | BACK_TECH_LAYERS) |
Definition at line 180 of file pcb_io_kicad_legacy.cpp.
#define BACK_TECH_LAYERS |
Definition at line 177 of file pcb_io_kicad_legacy.cpp.
#define COMMENT_LAYER (1 << COMMENT_N) |
Definition at line 165 of file pcb_io_kicad_legacy.cpp.
#define COMMENT_N 25 |
Definition at line 132 of file pcb_io_kicad_legacy.cpp.
#define DRAW_LAYER (1 << DRAW_N) |
Definition at line 164 of file pcb_io_kicad_legacy.cpp.
#define DRAW_N 24 |
Definition at line 131 of file pcb_io_kicad_legacy.cpp.
#define ECO1_LAYER (1 << ECO1_N) |
Definition at line 166 of file pcb_io_kicad_legacy.cpp.
#define ECO1_N 26 |
Definition at line 133 of file pcb_io_kicad_legacy.cpp.
#define ECO2_LAYER (1 << ECO2_N) |
Definition at line 167 of file pcb_io_kicad_legacy.cpp.
#define ECO2_N 27 |
Definition at line 134 of file pcb_io_kicad_legacy.cpp.
#define EDGE_LAYER (1 << EDGE_N) |
Definition at line 168 of file pcb_io_kicad_legacy.cpp.
#define EDGE_N 28 |
Definition at line 135 of file pcb_io_kicad_legacy.cpp.
#define FIRST_COPPER_LAYER 0 |
Definition at line 103 of file pcb_io_kicad_legacy.cpp.
#define FIRST_LAYER 0 |
Definition at line 102 of file pcb_io_kicad_legacy.cpp.
#define FIRST_NON_COPPER_LAYER 16 |
Definition at line 122 of file pcb_io_kicad_legacy.cpp.
#define FRONT_LAYERS (LAYER_FRONT | FRONT_TECH_LAYERS) |
Definition at line 181 of file pcb_io_kicad_legacy.cpp.
#define FRONT_TECH_LAYERS |
Definition at line 175 of file pcb_io_kicad_legacy.cpp.
#define LAST_COPPER_LAYER LAYER_N_FRONT |
Definition at line 120 of file pcb_io_kicad_legacy.cpp.
#define LAST_NON_COPPER_LAYER 28 |
Definition at line 136 of file pcb_io_kicad_legacy.cpp.
#define LAYER_10 (1 << LAYER_N_10) |
bit mask for layer 10
Definition at line 149 of file pcb_io_kicad_legacy.cpp.
#define LAYER_11 (1 << LAYER_N_11) |
bit mask for layer 11
Definition at line 150 of file pcb_io_kicad_legacy.cpp.
#define LAYER_12 (1 << LAYER_N_12) |
bit mask for layer 12
Definition at line 151 of file pcb_io_kicad_legacy.cpp.
#define LAYER_13 (1 << LAYER_N_13) |
bit mask for layer 13
Definition at line 152 of file pcb_io_kicad_legacy.cpp.
#define LAYER_14 (1 << LAYER_N_14) |
bit mask for layer 14
Definition at line 153 of file pcb_io_kicad_legacy.cpp.
#define LAYER_15 (1 << LAYER_N_15) |
bit mask for layer 15
Definition at line 154 of file pcb_io_kicad_legacy.cpp.
#define LAYER_2 (1 << LAYER_N_2) |
bit mask for layer 2
Definition at line 141 of file pcb_io_kicad_legacy.cpp.
#define LAYER_3 (1 << LAYER_N_3) |
bit mask for layer 3
Definition at line 142 of file pcb_io_kicad_legacy.cpp.
#define LAYER_4 (1 << LAYER_N_4) |
bit mask for layer 4
Definition at line 143 of file pcb_io_kicad_legacy.cpp.
#define LAYER_5 (1 << LAYER_N_5) |
bit mask for layer 5
Definition at line 144 of file pcb_io_kicad_legacy.cpp.
#define LAYER_6 (1 << LAYER_N_6) |
bit mask for layer 6
Definition at line 145 of file pcb_io_kicad_legacy.cpp.
#define LAYER_7 (1 << LAYER_N_7) |
bit mask for layer 7
Definition at line 146 of file pcb_io_kicad_legacy.cpp.
#define LAYER_8 (1 << LAYER_N_8) |
bit mask for layer 8
Definition at line 147 of file pcb_io_kicad_legacy.cpp.
#define LAYER_9 (1 << LAYER_N_9) |
bit mask for layer 9
Definition at line 148 of file pcb_io_kicad_legacy.cpp.
#define LAYER_BACK (1 << LAYER_N_BACK) |
bit mask for copper layer
Definition at line 140 of file pcb_io_kicad_legacy.cpp.
#define LAYER_FRONT (1 << LAYER_N_FRONT) |
bit mask for component layer
Definition at line 155 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_10 9 |
Definition at line 113 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_11 10 |
Definition at line 114 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_12 11 |
Definition at line 115 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_13 12 |
Definition at line 116 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_14 13 |
Definition at line 117 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_15 14 |
Definition at line 118 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_2 1 |
Definition at line 105 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_3 2 |
Definition at line 106 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_4 3 |
Definition at line 107 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_5 4 |
Definition at line 108 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_6 5 |
Definition at line 109 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_7 6 |
Definition at line 110 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_8 7 |
Definition at line 111 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_9 8 |
Definition at line 112 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_BACK 0 |
Definition at line 104 of file pcb_io_kicad_legacy.cpp.
#define LAYER_N_FRONT 15 |
Definition at line 119 of file pcb_io_kicad_legacy.cpp.
#define MASK | ( | x | ) | (1<<(x)) |
Definition at line 203 of file pcb_io_kicad_legacy.cpp.
#define NO_LAYERS 0x00000000 |
Definition at line 185 of file pcb_io_kicad_legacy.cpp.
#define PCB_LEGACY_INTERNAL_UNIT 10000 |
Definition at line 192 of file pcb_io_kicad_legacy.cpp.
#define PCB_LEGACY_TEXT_is_DIVERS 2 |
Definition at line 189 of file pcb_io_kicad_legacy.cpp.
#define PCB_LEGACY_TEXT_is_REFERENCE 0 |
Definition at line 187 of file pcb_io_kicad_legacy.cpp.
#define PCB_LEGACY_TEXT_is_VALUE 1 |
Definition at line 188 of file pcb_io_kicad_legacy.cpp.
#define READLINE | ( | rdr | ) | rdr->ReadLine() |
Definition at line 238 of file pcb_io_kicad_legacy.cpp.
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) |
Definition at line 160 of file pcb_io_kicad_legacy.cpp.
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) |
Definition at line 161 of file pcb_io_kicad_legacy.cpp.
#define SILKSCREEN_N_BACK 20 |
Definition at line 127 of file pcb_io_kicad_legacy.cpp.
#define SILKSCREEN_N_FRONT 21 |
Definition at line 128 of file pcb_io_kicad_legacy.cpp.
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) |
Definition at line 162 of file pcb_io_kicad_legacy.cpp.
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) |
Definition at line 163 of file pcb_io_kicad_legacy.cpp.
#define SOLDERMASK_N_BACK 22 |
Definition at line 129 of file pcb_io_kicad_legacy.cpp.
#define SOLDERMASK_N_FRONT 23 |
Definition at line 130 of file pcb_io_kicad_legacy.cpp.
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) |
Definition at line 158 of file pcb_io_kicad_legacy.cpp.
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) |
Definition at line 159 of file pcb_io_kicad_legacy.cpp.
#define SOLDERPASTE_N_BACK 18 |
Definition at line 125 of file pcb_io_kicad_legacy.cpp.
#define SOLDERPASTE_N_FRONT 19 |
Definition at line 126 of file pcb_io_kicad_legacy.cpp.
#define SZ | ( | x | ) | (sizeof(x)-1) |
Get the length of a string constant, at compile time.
Definition at line 195 of file pcb_io_kicad_legacy.cpp.
C string compare test for a specific length of characters.
Definition at line 231 of file pcb_io_kicad_legacy.cpp.
#define TESTSUBSTR | ( | x | ) | ( !strncasecmp( line, x, SZ( x ) ) ) |
C sub-string compare test for a specific length of characters.
Definition at line 234 of file pcb_io_kicad_legacy.cpp.
typedef PCB_IO_KICAD_LEGACY::BIU BIU |
Definition at line 97 of file pcb_io_kicad_legacy.cpp.
typedef boost::ptr_map< std::string, FOOTPRINT > FOOTPRINT_MAP |
Definition at line 2953 of file pcb_io_kicad_legacy.cpp.
typedef unsigned LAYER_MSK |
Definition at line 139 of file pcb_io_kicad_legacy.cpp.
typedef unsigned LEG_MASK |
Definition at line 100 of file pcb_io_kicad_legacy.cpp.
|
inlinestatic |
Parse an ASCII hex integer string with possible leading whitespace into a long integer and updates the pointer at out if it is not nullptr, just like "man strtol".
I can use this without casting, and its name says what I am doing.
Definition at line 407 of file pcb_io_kicad_legacy.cpp.
References next().
Referenced by PCB_IO_KICAD_LEGACY::loadFOOTPRINT(), PCB_IO_KICAD_LEGACY::loadGENERAL(), PCB_IO_KICAD_LEGACY::loadPAD(), PCB_IO_KICAD_LEGACY::loadPCB_LINE(), and PCB_IO_KICAD_LEGACY::loadSETUP().
|
static |
Definition at line 263 of file pcb_io_kicad_legacy.cpp.
References GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, and GR_TEXT_H_ALIGN_RIGHT.
Referenced by PCB_IO_KICAD_LEGACY::loadMODULE_TEXT(), PCB_IO_KICAD_LEGACY::loadPCB_TEXT(), and SCH_FIELD::Rotate().
|
inlinestatic |
Parse an ASCII integer string with possible leading whitespace into an integer and updates the pointer at out if it is not NULL, just like "man strtol()".
I can use this without casting, and its name says what I am doing.
Definition at line 394 of file pcb_io_kicad_legacy.cpp.
References next().
Referenced by PCB_IO_KICAD_LEGACY::loadDIMENSION(), PCB_IO_KICAD_LEGACY::loadFOOTPRINT(), PCB_IO_KICAD_LEGACY::loadFP_SHAPE(), PCB_IO_KICAD_LEGACY::loadGENERAL(), PCB_IO_KICAD_LEGACY::loadMODULE_TEXT(), PCB_IO_KICAD_LEGACY::loadNETINFO_ITEM(), PCB_IO_KICAD_LEGACY::loadPAD(), PCB_IO_KICAD_LEGACY::loadPCB_LINE(), PCB_IO_KICAD_LEGACY::loadPCB_TARGET(), PCB_IO_KICAD_LEGACY::loadPCB_TEXT(), PCB_IO_KICAD_LEGACY::loadSETUP(), PCB_IO_KICAD_LEGACY::loadSHEET(), PCB_IO_KICAD_LEGACY::loadTrackList(), and PCB_IO_KICAD_LEGACY::loadZONE_CONTAINER().
|
inline |
Definition at line 305 of file pcb_io_kicad_legacy.cpp.
References LAYER_N_FRONT.
Referenced by PCB_IO_KICAD_LEGACY::loadPCB_TEXT(), and PCB_IO_KICAD_LEGACY::loadTrackList().
|
inlinestatic |
Definition at line 201 of file pcb_io_kicad_legacy.cpp.
References delims.
int layerMaskCountSet | ( | LEG_MASK | aMask | ) |
Count the number of set layers in the mask.
Definition at line 287 of file pcb_io_kicad_legacy.cpp.
Referenced by PCB_IO_KICAD_LEGACY::loadGENERAL().
|
static |
Definition at line 274 of file pcb_io_kicad_legacy.cpp.
References GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, and GR_TEXT_V_ALIGN_TOP.
Referenced by PCB_IO_KICAD_LEGACY::loadMODULE_TEXT(), and PCB_IO_KICAD_LEGACY::loadPCB_TEXT().
|
static |
Definition at line 198 of file pcb_io_kicad_legacy.cpp.
Referenced by isSpace(), and LP_CACHE::ReadAndVerifyHeader().