Replace "module" with "footprint" in PCB sexpr.

This commit is contained in:
Jeff Young 2020-11-15 12:20:59 +00:00
parent 8b9be2e129
commit 3f1a58bd06
6 changed files with 25 additions and 46 deletions

View File

@ -108,6 +108,7 @@ filled_areas_thickness
fillet
font
format
footprint
footprints
fp_arc
fp_circle

View File

@ -105,13 +105,14 @@ public:
case S_SEGMENT:
case S_ARC:
case S_CURVE:
case S_LAST: // Make CLang compiler happy
return false;
case S_LAST: // Sentinel
break;
}
return false; // Make compil happy
return false; // Make GCC compiler happy
}
void SetWidth( int aWidth ) { m_width = aWidth; }

View File

@ -67,7 +67,7 @@ public:
FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileName );
const WX_FILENAME& GetFileName() const { return m_filename; }
const FOOTPRINT* GetModule() const { return m_footprint.get(); }
const FOOTPRINT* GetFootprint() const { return m_footprint.get(); }
};
@ -173,7 +173,7 @@ void FP_CACHE::Save( FOOTPRINT* aFootprint )
for( FOOTPRINT_MAP::iterator it = m_footprints.begin(); it != m_footprints.end(); ++it )
{
if( aFootprint && aFootprint != it->second->GetModule() )
if( aFootprint && aFootprint != it->second->GetFootprint() )
continue;
WX_FILENAME fn = it->second->GetFileName();
@ -193,7 +193,7 @@ void FP_CACHE::Save( FOOTPRINT* aFootprint )
FILE_OUTPUTFORMATTER formatter( tempFileName );
m_owner->SetOutputFormatter( &formatter );
m_owner->Format( (BOARD_ITEM*) it->second->GetModule() );
m_owner->Format( (BOARD_ITEM*) it->second->GetFootprint() );
}
#ifdef USE_TMP_FILE
@ -972,10 +972,10 @@ void PCB_IO::format( FOOTPRINT* aFootprint, int aNestLevel ) const
}
if( m_ctl & CTL_OMIT_LIBNAME )
m_out->Print( aNestLevel, "(module %s",
m_out->Print( aNestLevel, "(footprint %s",
m_out->Quotes( aFootprint->GetFPID().GetLibItemNameAndRev() ).c_str() );
else
m_out->Print( aNestLevel, "(module %s",
m_out->Print( aNestLevel, "(footprint %s",
m_out->Quotes( aFootprint->GetFPID().Format() ).c_str() );
if( aFootprint->IsLocked() )
@ -2118,7 +2118,6 @@ void PCB_IO::init( const PROPERTIES* aProperties )
{
m_board = NULL;
m_reader = NULL;
m_loading_format_version = SEXPR_BOARD_FILE_VERSION;
m_props = aProperties;
}
@ -2188,7 +2187,7 @@ const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath,
if( it == footprints.end() )
return nullptr;
return it->second->GetModule();
return it->second->GetFootprint();
}

View File

@ -89,7 +89,8 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20200921 // Add orthogonal dimension
//#define SEXPR_BOARD_FILE_VERSION 20200922 // Add user name to layer definition.
//#define SEXPR_BOARD_FILE_VERSION 20201002 // Add groups in footprints (for footprint editor).
#define SEXPR_BOARD_FILE_VERSION 20201114 // Add first-class support for filled shapes.
//#define SEXPR_BOARD_FILE_VERSION 20201114 // Add first-class support for filled shapes.
#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint.
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
@ -175,10 +176,10 @@ public:
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
void FootprintLibCreate( const wxString& aLibraryPath,
const PROPERTIES* aProperties = NULL) override;
const PROPERTIES* aProperties = NULL) override;
bool FootprintLibDelete( const wxString& aLibraryPath,
const PROPERTIES* aProperties = NULL ) override;
const PROPERTIES* aProperties = NULL ) override;
bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
@ -200,6 +201,7 @@ public:
std::string GetStringOutput( bool doClear )
{
std::string ret = m_sf.GetString();
if( doClear )
m_sf.Clear();
@ -222,8 +224,6 @@ protected:
LINE_READER* m_reader; ///< no ownership here.
wxString m_filename; ///< for saves only, name is in m_reader for loads
int m_loading_format_version; ///< which #SEXPR_BOARD_FILE_VERSION should be Load()ed?
STRING_FORMATTER m_sf;
OUTPUTFORMATTER* m_out; ///< output any Format()s to this, no ownership
int m_ctl;

View File

@ -181,19 +181,6 @@ bool PCB_PARSER::parseBool()
}
int PCB_PARSER::parseVersion()
{
if( NextTok() != T_version )
Expecting( GetTokenText( T_version ) );
int pcb_version = parseInt( FromUTF8().mb_str( wxConvUTF8 ) );
NeedRIGHT();
return pcb_version;
}
wxString PCB_PARSER::GetRequiredVersion()
{
int year, month, day;
@ -509,8 +496,9 @@ BOARD_ITEM* PCB_PARSER::Parse()
item = (BOARD_ITEM*) parseBOARD();
break;
case T_module:
item = (BOARD_ITEM*) parseFOOTPRINT( initial_comments.release());
case T_module: // legacy token
case T_footprint:
item = (BOARD_ITEM*) parseFOOTPRINT( initial_comments.release() );
break;
default:
@ -614,7 +602,8 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
m_board->Add( parseDIMENSION(), ADD_MODE::APPEND );
break;
case T_module:
case T_module: // legacy token
case T_footprint:
m_board->Add( parseFOOTPRINT(), ADD_MODE::APPEND );
break;
@ -2812,7 +2801,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT( wxArrayString* aInitialComments )
FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments )
{
wxCHECK_MSG( CurTok() == T_module, NULL,
wxCHECK_MSG( CurTok() == T_module || CurTok() == T_footprint, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) );
wxString name;

View File

@ -57,7 +57,6 @@ class PCB_GROUP;
class PCB_TARGET;
class VIA;
class ZONE;
class PCB_MARKER;
class FP_3DMODEL;
struct LAYER;
@ -161,29 +160,25 @@ class PCB_PARSER : public PCB_LEXER
PCB_TEXT* parsePCB_TEXT();
DIMENSION_BASE* parseDIMENSION();
/**
* Function parseFOOTPRINT_unchecked
* Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
// Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = 0 );
FP_TEXT* parseFP_TEXT();
FP_SHAPE* parseFP_SHAPE();
PAD* parsePAD( FOOTPRINT* aParent = NULL );
// Parse only the (option ...) inside a pad description
bool parsePAD_option( PAD* aPad );
ARC* parseARC();
TRACK* parseTRACK();
VIA* parseVIA();
ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent );
PCB_TARGET* parsePCB_TARGET();
PCB_MARKER* parseMARKER( BOARD_ITEM_CONTAINER* aParent );
BOARD* parseBOARD();
void parseGROUP( BOARD_ITEM* aParent );
/**
* Function parseBOARD_unchecked
* Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
// Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
BOARD* parseBOARD_unchecked();
/**
@ -325,12 +320,6 @@ class PCB_PARSER : public PCB_LEXER
bool parseBool();
/**
* Parse a format version tag like (version 20160417) return the version.
* Expects to start on 'version', and eats the closing paren.
*/
int parseVersion();
/*
* @return if m_resetKIIDs, returns new KIID(), otehrwise returns CurStr() as KIID.
*/