29#include <wx/tokenzr.h>
34 wxString& aSignal )
const
36 static wxString BRANCH( wxS(
"#branch" ) );
38 static wxRegEx internalDevParameter( wxS(
"^@(\\w*[\\.\\w+]*)\\[(\\w*)\\]$" ), wxRE_ADVANCED );
40 wxString vector( aVector );
42 if( !internalDevParameter.Matches( vector ) )
44 if( vector.EndsWith( BRANCH ) )
46 aSignal = wxT(
"I(" ) + vector.Left( vector.Length() - BRANCH.Length() ) + wxT(
")" );
51 aSignal = wxT(
"V(" ) + vector + wxT(
")" );
57 wxString paramType = internalDevParameter.GetMatch( vector, 2 );
59 if( paramType.Lower()[0] ==
'i' )
63 aSignal = paramType + wxT(
"(" );
64 aSignal += internalDevParameter.GetMatch( vector, 1 ).Upper() + wxT(
")" );
99 wxString cmd = aCmd.Lower().Trim();
101 if( cmd.StartsWith( wxT(
".ac" ) ) )
103 else if( cmd.StartsWith( wxT(
".dc" ) ) )
105 else if( cmd.StartsWith( wxT(
".tran" ) ) )
107 else if( cmd == wxT(
".op" ) )
109 else if( cmd.StartsWith( wxT(
".disto" ) ) )
111 else if( cmd.StartsWith( wxT(
".noise" ) ) )
113 else if( cmd.StartsWith( wxT(
".pz" ) ) )
115 else if( cmd.StartsWith( wxT(
".sens" ) ) )
117 else if( cmd.StartsWith( wxT(
".tf" ) ) )
127 if( !aCmd.Lower().StartsWith(
".dc" ) )
130 wxString cmd = aCmd.Mid( 3 ).Trim().Trim(
false );
132 wxStringTokenizer tokens( cmd );
134 size_t num = tokens.CountTokens();
136 if( num != 4 && num != 8 )
139 aSource1->
m_source = tokens.GetNextToken();
146 aSource2->
m_source = tokens.GetNextToken();
157 unsigned aNetlistOptions )
const
void ReadDirectives(unsigned aNetlistOptions)
virtual void WriteDirectives(OUTPUTFORMATTER &candidate, unsigned aNetlistOptions) const
const std::vector< wxString > & GetDirectives()
SIM_TRACE_TYPE VectorToSignal(const std::string &aVector, wxString &aSignal) const
Return name of Spice dataset for a specific trace.
SIM_TYPE GetSimType()
Return simulation type basing on the simulation command directives.
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.
bool ParseDCCommand(const wxString &aCmd, SPICE_DC_PARAMS *aSource1, SPICE_DC_PARAMS *aSource2)
Parse a two-source .dc command directive into its symbols.
void WriteDirectives(OUTPUTFORMATTER &aFormatter, unsigned aNetlistOptions) const override
wxString GetSimCommandOverride() const
Return the simulation command directive if stored separately (not as a sheet directive).
wxString GetSchTextSimCommand()
Return simulation command directives placed in schematic sheets (if any).
static bool IsSimCommand(const wxString &aCmd)
Determine if a directive is a simulation command.
wxString GetSimCommand()
Return the command directive that is in use (either from the sheet or from m_simCommand)
Helper class to recognize Spice formatted values.
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
SIM_TYPE
< Possible simulation types