Removed hard limit for ngspice netlist

This commit is contained in:
Maciej Suminski 2016-08-11 14:42:17 +02:00
parent 0a6390701d
commit 957c6ec417
1 changed files with 9 additions and 11 deletions

View File

@ -217,26 +217,24 @@ vector<double> NGSPICE::GetPhasePlot( const string& aName, int aMaxLen )
bool NGSPICE::LoadNetlist( const string& aNetlist ) bool NGSPICE::LoadNetlist( const string& aNetlist )
{ {
// TODO remove the hard limit vector<char*> lines;
char* lines[16384];
stringstream ss( aNetlist ); stringstream ss( aNetlist );
int n = 0;
while( !ss.eof() && n < 16384 ) while( !ss.eof() )
{ {
char line[1024]; char line[1024];
ss.getline( line, sizeof(line) ); ss.getline( line, sizeof( line ) );
lines[n++] = strdup(line); lines.push_back( strdup( line ) );
} }
lines[n] = NULL;
lines.push_back( nullptr );
setlocale( LC_ALL, "C" ); setlocale( LC_ALL, "C" );
m_ngSpice_Circ( lines ); m_ngSpice_Circ( lines.data() );
setlocale( LC_ALL, "" ); setlocale( LC_ALL, "" );
for(int i = 0; i < n; i++) for( auto line : lines )
delete lines[i]; delete line;
return true; return true;
} }