NETLIST_EXPORTER_PSPICE adjusts paths for .include directives

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:09 +02:00
parent 75b0e3e0a2
commit 402a438339
3 changed files with 26 additions and 8 deletions

View File

@ -28,6 +28,7 @@
#include <confirm.h>
#include <map>
#include <search_stack.h>
#include <schframe.h>
#include <netlist.h>
@ -79,8 +80,25 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* formatter, int aCtl )
if( text.GetChar( 0 ) == '.' )
{
wxLogDebug( "Directive found: '%s'\n", (const char *) text.c_str() );
directives.push_back( text );
wxStringTokenizer tokenizer( text, "\r\n" );
while( tokenizer.HasMoreTokens() )
{
wxString directive( tokenizer.GetNextToken() );
wxLogDebug( "Directive found: '%s'\n", (const char *) directive.c_str() );
// Fix paths for .include directives
if( m_paths && directive.StartsWith( ".inc" ) )
{
wxString file( directive.AfterFirst( ' ' ) );
wxString path( m_paths->FindValidPath( file ) );
directives.push_back( wxString( ".include " ) + path );
}
else
{
directives.push_back( directive );
}
}
}
}
}

View File

@ -29,6 +29,8 @@
#include "netlist_exporter.h"
#include <map>
class SEARCH_STACK;
/**
* Class NETLIST_EXPORTER_PSPICE
* generates a PSPICE compatible netlist
@ -36,8 +38,8 @@
class NETLIST_EXPORTER_PSPICE : public NETLIST_EXPORTER
{
public:
NETLIST_EXPORTER_PSPICE( NETLIST_OBJECT_LIST* aMasterList, PART_LIBS* aLibs ) :
NETLIST_EXPORTER( aMasterList, aLibs )
NETLIST_EXPORTER_PSPICE( NETLIST_OBJECT_LIST* aMasterList, PART_LIBS* aLibs, SEARCH_STACK* aPaths = NULL ) :
NETLIST_EXPORTER( aMasterList, aLibs ), m_paths( aPaths )
{
}
@ -62,12 +64,10 @@ public:
return m_probes;
}
private:
NetIndexMap m_netMap;
ProbeList m_probes;
SEARCH_STACK* m_paths;
};
#endif

View File

@ -132,7 +132,7 @@ void SIM_PLOT_FRAME::StartSimulation()
m_simulator->Init();
NETLIST_OBJECT_LIST* net_atoms = m_schematicFrame->BuildNetListBase();
m_exporter = new NETLIST_EXPORTER_PSPICE ( net_atoms, Prj().SchLibs() );
m_exporter = new NETLIST_EXPORTER_PSPICE( net_atoms, Prj().SchLibs(), Prj().SchSearchS() );
STRING_FORMATTER formatter;
m_exporter->Format( &formatter, GNL_ALL );