KiCad PCB EDA Suite
|
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <plugins/legacy/legacy_plugin.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 <string_utf8_map.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 LEGACY_PLUGIN, 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 More... | |
#define | LAYER_2 (1 << LAYER_N_2) |
bit mask for layer 2 More... | |
#define | LAYER_3 (1 << LAYER_N_3) |
bit mask for layer 3 More... | |
#define | LAYER_4 (1 << LAYER_N_4) |
bit mask for layer 4 More... | |
#define | LAYER_5 (1 << LAYER_N_5) |
bit mask for layer 5 More... | |
#define | LAYER_6 (1 << LAYER_N_6) |
bit mask for layer 6 More... | |
#define | LAYER_7 (1 << LAYER_N_7) |
bit mask for layer 7 More... | |
#define | LAYER_8 (1 << LAYER_N_8) |
bit mask for layer 8 More... | |
#define | LAYER_9 (1 << LAYER_N_9) |
bit mask for layer 9 More... | |
#define | LAYER_10 (1 << LAYER_N_10) |
bit mask for layer 10 More... | |
#define | LAYER_11 (1 << LAYER_N_11) |
bit mask for layer 11 More... | |
#define | LAYER_12 (1 << LAYER_N_12) |
bit mask for layer 12 More... | |
#define | LAYER_13 (1 << LAYER_N_13) |
bit mask for layer 13 More... | |
#define | LAYER_14 (1 << LAYER_N_14) |
bit mask for layer 14 More... | |
#define | LAYER_15 (1 << LAYER_N_15) |
bit mask for layer 15 More... | |
#define | LAYER_FRONT (1 << LAYER_N_FRONT) |
bit mask for component layer More... | |
#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. More... | |
#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. More... | |
#define | TESTSUBSTR(x) ( !strncasecmp( line, x, SZ( x ) ) ) |
C sub-string compare test for a specific length of characters. More... | |
#define | READLINE(rdr) rdr->ReadLine() |
Typedefs | |
typedef LEGACY_PLUGIN::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. More... | |
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()". More... | |
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". More... | |
Variables | |
static const char | delims [] = " \t\r\n" |
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK) |
Definition at line 157 of file legacy_plugin.cpp.
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT) |
Definition at line 158 of file legacy_plugin.cpp.
#define ADHESIVE_N_BACK 16 |
Definition at line 124 of file legacy_plugin.cpp.
#define ADHESIVE_N_FRONT 17 |
Definition at line 125 of file legacy_plugin.cpp.
#define ALL_CU_LAYERS 0x0000FFFF |
Definition at line 175 of file legacy_plugin.cpp.
#define ALL_NO_CU_LAYERS 0x1FFF0000 |
Definition at line 174 of file legacy_plugin.cpp.
#define ALL_TECH_LAYERS (FRONT_TECH_LAYERS | BACK_TECH_LAYERS) |
Definition at line 180 of file legacy_plugin.cpp.
#define ALL_USER_LAYERS (DRAW_LAYER | COMMENT_LAYER | ECO1_LAYER | ECO2_LAYER ) |
Definition at line 184 of file legacy_plugin.cpp.
#define BACK_LAYERS (LAYER_BACK | BACK_TECH_LAYERS) |
Definition at line 181 of file legacy_plugin.cpp.
#define BACK_TECH_LAYERS |
Definition at line 178 of file legacy_plugin.cpp.
#define COMMENT_LAYER (1 << COMMENT_N) |
Definition at line 166 of file legacy_plugin.cpp.
#define COMMENT_N 25 |
Definition at line 133 of file legacy_plugin.cpp.
#define DRAW_LAYER (1 << DRAW_N) |
Definition at line 165 of file legacy_plugin.cpp.
#define DRAW_N 24 |
Definition at line 132 of file legacy_plugin.cpp.
#define ECO1_LAYER (1 << ECO1_N) |
Definition at line 167 of file legacy_plugin.cpp.
#define ECO1_N 26 |
Definition at line 134 of file legacy_plugin.cpp.
#define ECO2_LAYER (1 << ECO2_N) |
Definition at line 168 of file legacy_plugin.cpp.
#define ECO2_N 27 |
Definition at line 135 of file legacy_plugin.cpp.
#define EDGE_LAYER (1 << EDGE_N) |
Definition at line 169 of file legacy_plugin.cpp.
#define EDGE_N 28 |
Definition at line 136 of file legacy_plugin.cpp.
#define FIRST_COPPER_LAYER 0 |
Definition at line 104 of file legacy_plugin.cpp.
#define FIRST_LAYER 0 |
Definition at line 103 of file legacy_plugin.cpp.
#define FIRST_NON_COPPER_LAYER 16 |
Definition at line 123 of file legacy_plugin.cpp.
#define FRONT_LAYERS (LAYER_FRONT | FRONT_TECH_LAYERS) |
Definition at line 182 of file legacy_plugin.cpp.
#define FRONT_TECH_LAYERS |
Definition at line 176 of file legacy_plugin.cpp.
#define LAST_COPPER_LAYER LAYER_N_FRONT |
Definition at line 121 of file legacy_plugin.cpp.
#define LAST_NON_COPPER_LAYER 28 |
Definition at line 137 of file legacy_plugin.cpp.
#define LAYER_10 (1 << LAYER_N_10) |
bit mask for layer 10
Definition at line 150 of file legacy_plugin.cpp.
#define LAYER_11 (1 << LAYER_N_11) |
bit mask for layer 11
Definition at line 151 of file legacy_plugin.cpp.
#define LAYER_12 (1 << LAYER_N_12) |
bit mask for layer 12
Definition at line 152 of file legacy_plugin.cpp.
#define LAYER_13 (1 << LAYER_N_13) |
bit mask for layer 13
Definition at line 153 of file legacy_plugin.cpp.
#define LAYER_14 (1 << LAYER_N_14) |
bit mask for layer 14
Definition at line 154 of file legacy_plugin.cpp.
#define LAYER_15 (1 << LAYER_N_15) |
bit mask for layer 15
Definition at line 155 of file legacy_plugin.cpp.
#define LAYER_2 (1 << LAYER_N_2) |
bit mask for layer 2
Definition at line 142 of file legacy_plugin.cpp.
#define LAYER_3 (1 << LAYER_N_3) |
bit mask for layer 3
Definition at line 143 of file legacy_plugin.cpp.
#define LAYER_4 (1 << LAYER_N_4) |
bit mask for layer 4
Definition at line 144 of file legacy_plugin.cpp.
#define LAYER_5 (1 << LAYER_N_5) |
bit mask for layer 5
Definition at line 145 of file legacy_plugin.cpp.
#define LAYER_6 (1 << LAYER_N_6) |
bit mask for layer 6
Definition at line 146 of file legacy_plugin.cpp.
#define LAYER_7 (1 << LAYER_N_7) |
bit mask for layer 7
Definition at line 147 of file legacy_plugin.cpp.
#define LAYER_8 (1 << LAYER_N_8) |
bit mask for layer 8
Definition at line 148 of file legacy_plugin.cpp.
#define LAYER_9 (1 << LAYER_N_9) |
bit mask for layer 9
Definition at line 149 of file legacy_plugin.cpp.
#define LAYER_BACK (1 << LAYER_N_BACK) |
bit mask for copper layer
Definition at line 141 of file legacy_plugin.cpp.
#define LAYER_FRONT (1 << LAYER_N_FRONT) |
bit mask for component layer
Definition at line 156 of file legacy_plugin.cpp.
#define LAYER_N_10 9 |
Definition at line 114 of file legacy_plugin.cpp.
#define LAYER_N_11 10 |
Definition at line 115 of file legacy_plugin.cpp.
#define LAYER_N_12 11 |
Definition at line 116 of file legacy_plugin.cpp.
#define LAYER_N_13 12 |
Definition at line 117 of file legacy_plugin.cpp.
#define LAYER_N_14 13 |
Definition at line 118 of file legacy_plugin.cpp.
#define LAYER_N_15 14 |
Definition at line 119 of file legacy_plugin.cpp.
#define LAYER_N_2 1 |
Definition at line 106 of file legacy_plugin.cpp.
#define LAYER_N_3 2 |
Definition at line 107 of file legacy_plugin.cpp.
#define LAYER_N_4 3 |
Definition at line 108 of file legacy_plugin.cpp.
#define LAYER_N_5 4 |
Definition at line 109 of file legacy_plugin.cpp.
#define LAYER_N_6 5 |
Definition at line 110 of file legacy_plugin.cpp.
#define LAYER_N_7 6 |
Definition at line 111 of file legacy_plugin.cpp.
#define LAYER_N_8 7 |
Definition at line 112 of file legacy_plugin.cpp.
#define LAYER_N_9 8 |
Definition at line 113 of file legacy_plugin.cpp.
#define LAYER_N_BACK 0 |
Definition at line 105 of file legacy_plugin.cpp.
#define LAYER_N_FRONT 15 |
Definition at line 120 of file legacy_plugin.cpp.
#define MASK | ( | x | ) | (1<<(x)) |
Definition at line 204 of file legacy_plugin.cpp.
#define NO_LAYERS 0x00000000 |
Definition at line 186 of file legacy_plugin.cpp.
#define PCB_LEGACY_INTERNAL_UNIT 10000 |
Definition at line 193 of file legacy_plugin.cpp.
#define PCB_LEGACY_TEXT_is_DIVERS 2 |
Definition at line 190 of file legacy_plugin.cpp.
#define PCB_LEGACY_TEXT_is_REFERENCE 0 |
Definition at line 188 of file legacy_plugin.cpp.
#define PCB_LEGACY_TEXT_is_VALUE 1 |
Definition at line 189 of file legacy_plugin.cpp.
#define READLINE | ( | rdr | ) | rdr->ReadLine() |
Definition at line 239 of file legacy_plugin.cpp.
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK) |
Definition at line 161 of file legacy_plugin.cpp.
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT) |
Definition at line 162 of file legacy_plugin.cpp.
#define SILKSCREEN_N_BACK 20 |
Definition at line 128 of file legacy_plugin.cpp.
#define SILKSCREEN_N_FRONT 21 |
Definition at line 129 of file legacy_plugin.cpp.
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK) |
Definition at line 163 of file legacy_plugin.cpp.
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT) |
Definition at line 164 of file legacy_plugin.cpp.
#define SOLDERMASK_N_BACK 22 |
Definition at line 130 of file legacy_plugin.cpp.
#define SOLDERMASK_N_FRONT 23 |
Definition at line 131 of file legacy_plugin.cpp.
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK) |
Definition at line 159 of file legacy_plugin.cpp.
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT) |
Definition at line 160 of file legacy_plugin.cpp.
#define SOLDERPASTE_N_BACK 18 |
Definition at line 126 of file legacy_plugin.cpp.
#define SOLDERPASTE_N_FRONT 19 |
Definition at line 127 of file legacy_plugin.cpp.
#define SZ | ( | x | ) | (sizeof(x)-1) |
Get the length of a string constant, at compile time.
Definition at line 196 of file legacy_plugin.cpp.
C string compare test for a specific length of characters.
Definition at line 232 of file legacy_plugin.cpp.
#define TESTSUBSTR | ( | x | ) | ( !strncasecmp( line, x, SZ( x ) ) ) |
C sub-string compare test for a specific length of characters.
Definition at line 235 of file legacy_plugin.cpp.
typedef LEGACY_PLUGIN::BIU BIU |
Definition at line 98 of file legacy_plugin.cpp.
typedef boost::ptr_map< std::string, FOOTPRINT > FOOTPRINT_MAP |
Definition at line 2944 of file legacy_plugin.cpp.
typedef unsigned LAYER_MSK |
Definition at line 140 of file legacy_plugin.cpp.
typedef unsigned LEG_MASK |
Definition at line 101 of file legacy_plugin.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 406 of file legacy_plugin.cpp.
References next().
Referenced by LEGACY_PLUGIN::loadFOOTPRINT(), LEGACY_PLUGIN::loadGENERAL(), LEGACY_PLUGIN::loadPAD(), LEGACY_PLUGIN::loadPCB_LINE(), and LEGACY_PLUGIN::loadSETUP().
|
static |
Definition at line 264 of file legacy_plugin.cpp.
References GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, and GR_TEXT_H_ALIGN_RIGHT.
Referenced by LEGACY_PLUGIN::loadMODULE_TEXT(), and LEGACY_PLUGIN::loadPCB_TEXT().
|
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 393 of file legacy_plugin.cpp.
References next().
Referenced by LEGACY_PLUGIN::loadDIMENSION(), LEGACY_PLUGIN::loadFOOTPRINT(), LEGACY_PLUGIN::loadFP_SHAPE(), LEGACY_PLUGIN::loadGENERAL(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), LEGACY_PLUGIN::loadPCB_LINE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), LEGACY_PLUGIN::loadSETUP(), LEGACY_PLUGIN::loadSHEET(), LEGACY_PLUGIN::loadTrackList(), and LEGACY_PLUGIN::loadZONE_CONTAINER().
|
inline |
Definition at line 304 of file legacy_plugin.cpp.
References LAYER_N_FRONT.
Referenced by LEGACY_PLUGIN::loadPCB_TEXT(), and LEGACY_PLUGIN::loadTrackList().
|
inlinestatic |
Definition at line 202 of file legacy_plugin.cpp.
References delims.
|
inline |
Count the number of set layers in the mask.
Definition at line 288 of file legacy_plugin.cpp.
Referenced by LEGACY_PLUGIN::loadGENERAL().
|
static |
Definition at line 275 of file legacy_plugin.cpp.
References GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, and GR_TEXT_V_ALIGN_TOP.
Referenced by LEGACY_PLUGIN::loadMODULE_TEXT(), and LEGACY_PLUGIN::loadPCB_TEXT().
|
static |
Definition at line 199 of file legacy_plugin.cpp.
Referenced by isSpace(), and LP_CACHE::ReadAndVerifyHeader().