Schematic netlist exporter header housekeeping.
This commit is contained in:
parent
6b1658a098
commit
664b0c597a
|
@ -2,8 +2,8 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see changelog.txt for contributors.
|
||||
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,27 +33,19 @@
|
|||
#include <schematic.h>
|
||||
|
||||
/**
|
||||
* UNIQUE_STRINGS
|
||||
* tracks unique wxStrings and is useful in telling if a string
|
||||
* has been seen before.
|
||||
* Track unique wxStrings and is useful in telling if a string has been seen before.
|
||||
*/
|
||||
class UNIQUE_STRINGS
|
||||
{
|
||||
std::set<wxString> m_set; ///< set of wxStrings already found
|
||||
|
||||
typedef std::set<wxString>::iterator us_iterator;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Function Clear
|
||||
* erases the record.
|
||||
* Erase the record.
|
||||
*/
|
||||
void Clear() { m_set.clear(); }
|
||||
|
||||
/**
|
||||
* Function Lookup
|
||||
* returns true if \a aString already exists in the set, otherwise returns
|
||||
* false and adds \a aString to the set for next time.
|
||||
* @return true if \a aString already exists in the set, otherwise return false and
|
||||
* add \a aString to the set for next time.
|
||||
*/
|
||||
bool Lookup( const wxString& aString )
|
||||
{
|
||||
|
@ -61,11 +53,14 @@ public:
|
|||
|
||||
return !pair.second;
|
||||
}
|
||||
|
||||
std::set<wxString> m_set; ///< set of wxStrings already found
|
||||
|
||||
typedef std::set<wxString>::iterator us_iterator;
|
||||
};
|
||||
|
||||
/**
|
||||
* Struct LIB_PART_LESS_THAN
|
||||
* is used by std:set<LIB_PART*> instantiation which uses LIB_PART name as its key.
|
||||
* Used by std:set<LIB_PART*> instantiation which uses #LIB_PART name as its key.
|
||||
*/
|
||||
struct LIB_PART_LESS_THAN
|
||||
{
|
||||
|
@ -77,6 +72,7 @@ struct LIB_PART_LESS_THAN
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
struct PIN_INFO
|
||||
{
|
||||
PIN_INFO( const wxString& aPinNumber, const wxString& aNetName ) :
|
||||
|
@ -88,9 +84,9 @@ struct PIN_INFO
|
|||
wxString netName;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* NETLIST_EXPORTER_BASE
|
||||
* is a abstract class used for the netlist exporters that eeschema supports.
|
||||
* An abstract class used for the netlist exporters that Eeschema supports.
|
||||
*/
|
||||
class NETLIST_EXPORTER_BASE
|
||||
{
|
||||
|
@ -114,18 +110,19 @@ protected:
|
|||
SCH_SHEET_PATH m_savedCurrentSheet;
|
||||
|
||||
/**
|
||||
* Function findNextSymbolAndCreatePinList
|
||||
* finds a symbol from the DrawList and builds its pin list in m_sortedSymbolPinList. This
|
||||
* list is sorted by pin num. The symbol is the next actual symbol after aSymbol.
|
||||
* Find a symbol from the DrawList and builds its pin list in m_sortedSymbolPinList.
|
||||
*
|
||||
* This list is sorted by pin number. The symbol is the next actual symbol after \a aSymbol.
|
||||
* Power symbols and virtual symbols that have their reference designators starting with
|
||||
* '#' are skipped.
|
||||
*/
|
||||
void CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
/**
|
||||
* Checks if the given symbol should be processed for netlisting.
|
||||
* Prevents processing multi-unit symbols more than once, etc.
|
||||
* Check if the given symbol should be processed for netlisting.
|
||||
*
|
||||
* Prevent processing multi-unit symbols more than once, etc.
|
||||
*
|
||||
* @param aItem is a symbol to check
|
||||
* @param aSheetPath is the sheet to check the symbol for
|
||||
* @return the symbol if it should be processed, or nullptr
|
||||
|
@ -133,8 +130,8 @@ protected:
|
|||
SCH_COMPONENT* findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
/**
|
||||
* Function eraseDuplicatePins
|
||||
* erase duplicate Pins from m_sortedSymbolPinList (i.e. set pointer in this list to NULL).
|
||||
* Erase duplicate pins from m_sortedSymbolPinList (i.e. set pointer in this list to NULL).
|
||||
*
|
||||
* (This is a list of pins found in the whole schematic, for a single symbol.) These
|
||||
* duplicate pins were put in list because some pins (power pins...) are found more than
|
||||
* once when in "multiple parts per package" symbols. For instance, a 74ls00 has 4 parts,
|
||||
|
@ -145,9 +142,8 @@ protected:
|
|||
void eraseDuplicatePins();
|
||||
|
||||
/**
|
||||
* Function findAllUnitsOfSymbol
|
||||
* is used for "multiple parts per package" symbols.
|
||||
* <p>
|
||||
* Find all units for symbols with multiple parts per package.
|
||||
*
|
||||
* Search the entire design for all units of \a aSymbol based on matching reference
|
||||
* designator, and for each unit, add all its pins to the temporary sorted pin list,
|
||||
* m_sortedSymbolPinList.
|
||||
|
@ -155,11 +151,8 @@ protected:
|
|||
void findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol, LIB_PART* aPart,
|
||||
SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aMasterList we take ownership of this here.
|
||||
* @param aLibTable is the symbol library table of the project.
|
||||
*/
|
||||
|
@ -176,8 +169,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function WriteNetlist
|
||||
* writes to specified output file
|
||||
* Write to specified output file.
|
||||
*/
|
||||
virtual bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
|
||||
{
|
||||
|
@ -185,9 +177,9 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function MakeCommandLine
|
||||
* builds up a string that describes a command line for executing a child process. The
|
||||
* input and output file names along with any options to the executable are all possibly
|
||||
* Build up a string that describes a command line for executing a child process.
|
||||
*
|
||||
* The input and output file names along with any options to the executable are all possibly
|
||||
* in the returned string.
|
||||
*
|
||||
* @param aFormatString holds:
|
||||
|
@ -214,7 +206,8 @@ public:
|
|||
* </ul>
|
||||
*/
|
||||
static wxString MakeCommandLine( const wxString& aFormatString, const wxString& aNetlistFile,
|
||||
const wxString& aFinalFile, const wxString& aProjectDirectory );
|
||||
const wxString& aFinalFile,
|
||||
const wxString& aProjectDirectory );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2017 KiCad Developers
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -30,23 +30,10 @@
|
|||
|
||||
|
||||
/**
|
||||
* NETLIST_EXPORTER_CADSTAR
|
||||
* generates a netlist compatible with CADSTAR
|
||||
* Generate a netlist compatible with CADSTAR.
|
||||
*/
|
||||
class NETLIST_EXPORTER_CADSTAR : public NETLIST_EXPORTER_BASE
|
||||
{
|
||||
/**
|
||||
* Function writeListOfNetsCADSTAR
|
||||
* writes a net list (ranked by Netcode), and pins connected to it.
|
||||
* <p>
|
||||
* Format:
|
||||
* - ADD_TER RR2 6 \"$42\"
|
||||
* - B U1 100
|
||||
* - 6 CA
|
||||
* </p>
|
||||
*/
|
||||
bool writeListOfNets( FILE* f );
|
||||
|
||||
public:
|
||||
NETLIST_EXPORTER_CADSTAR( SCHEMATIC* aSchematic ) :
|
||||
NETLIST_EXPORTER_BASE( aSchematic )
|
||||
|
@ -54,10 +41,20 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function WriteList
|
||||
* writes to specified output file
|
||||
* Write to specified output file.
|
||||
*/
|
||||
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Write a net list (ranked by Netcode), and pins connected to it.
|
||||
*
|
||||
* Format:
|
||||
* - ADD_TER RR2 6 \"$42\"
|
||||
* - B U1 100
|
||||
* - 6 CA
|
||||
*/
|
||||
bool writeListOfNets( FILE* f );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2017 KiCad Developers
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -29,8 +29,7 @@
|
|||
#include "netlist_exporter_base.h"
|
||||
|
||||
/**
|
||||
* NETLIST_EXPORTER_ORCADPCB2
|
||||
* generates a netlist compatible with OrCAD
|
||||
* Generate a netlist compatible with OrCAD.
|
||||
*/
|
||||
class NETLIST_EXPORTER_ORCADPCB2 : public NETLIST_EXPORTER_BASE
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2020 KiCad Developers
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -61,12 +61,6 @@ enum GNL_T
|
|||
*/
|
||||
class NETLIST_EXPORTER_XML : public NETLIST_EXPORTER_BASE
|
||||
{
|
||||
private:
|
||||
std::set<wxString> m_libraries; // Set of library nicknames.
|
||||
|
||||
protected:
|
||||
bool m_resolveTextVars; // Export textVar references resolved
|
||||
|
||||
public:
|
||||
NETLIST_EXPORTER_XML( SCHEMATIC* aSchematic ) :
|
||||
NETLIST_EXPORTER_BASE( aSchematic ),
|
||||
|
@ -100,42 +94,47 @@ protected:
|
|||
* Build the entire document tree for the generic export. This is factored
|
||||
* out here so we can write the tree in either S-expression file format
|
||||
* or in XML if we put the tree built here into a wxXmlDocument.
|
||||
* @param aCtl - a bitset or-ed together from GNL_ENUM values
|
||||
* @return XNODE* - the root nodes
|
||||
* @param aCtl a bitset or-ed together from GNL_ENUM values
|
||||
* @return the root nodes
|
||||
*/
|
||||
XNODE* makeRoot( unsigned aCtl = GNL_ALL );
|
||||
|
||||
/**
|
||||
* @return XNODE* - returns a sub-tree holding all the schematic components.
|
||||
* @return a sub-tree holding all the schematic components.
|
||||
*/
|
||||
XNODE* makeSymbols( unsigned aCtl );
|
||||
|
||||
/**
|
||||
* Fills out a project "design" header into an XML node.
|
||||
* @return XNODE* - the design header
|
||||
* Fill out a project "design" header into an XML node.
|
||||
* @return the design header
|
||||
*/
|
||||
XNODE* makeDesignHeader();
|
||||
|
||||
/**
|
||||
* Fill out an XML node with the unique library parts and returns it.
|
||||
* @return XNODE* - the library parts nodes
|
||||
* @return the library parts nodes
|
||||
*/
|
||||
XNODE* makeLibParts();
|
||||
|
||||
/**
|
||||
* Fill out an XML node with a list of nets and returns it.
|
||||
* @return XNODE* - the list of nets nodes
|
||||
* @return the list of nets nodes
|
||||
*/
|
||||
XNODE* makeListOfNets( unsigned aCtl );
|
||||
|
||||
/**
|
||||
* Fill out an XML node with a list of used libraries and returns it.
|
||||
* Must have called makeGenericLibParts() before this function.
|
||||
* @return XNODE* - the library nodes
|
||||
* @return the library nodes
|
||||
*/
|
||||
XNODE* makeLibraries();
|
||||
|
||||
void addSymbolFields( XNODE* aNode, SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheet );
|
||||
|
||||
bool m_resolveTextVars; // Export textVar references resolved
|
||||
|
||||
private:
|
||||
std::set<wxString> m_libraries; // Set of library nicknames.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue