prcsimrbase.cpp
来自「gspiceui电子CAD仿真程序.用于电路参数模拟仿真」· C++ 代码 · 共 139 行
CPP
139 行
//*****************************************************************************// PrcSimrBase.cpp *// ----------------- *// Started : 25/04/2004 *// Last Update : 08/06/2005 *// Copyright : (C) 2004 by M.S.Waters *// Email : M.Waters@bom.gov.au *//*****************************************************************************//*****************************************************************************// *// This program is free software; you can redistribute it and/or modify *// it under the terms of the GNU General Public License as published by *// the Free Software Foundation; either version 2 of the License, or *// (at your option) any later version. *// *//*****************************************************************************#include "PrcSimrBase.hpp"//*****************************************************************************// Constructor.PrcSimrBase::PrcSimrBase( void ) : PrcBase( wxPROCESS_REDIRECT ){}//*****************************************************************************// Destructor.PrcSimrBase::~PrcSimrBase( ){}//*****************************************************************************// Set the simulation results file name.//// Argument List:// rosFName - A string containing the full path and file name//// Return Values:// TRUE - Success// FALSE - Failurebool PrcSimrBase::bSetResultsFile( const wxString & rosFName ){ wxFileName oFName; oFName = rosFName; if( oFName.GetPath( ).IsEmpty( ) ) oFName.SetPath( wxT(".") ); if( ! oFName.IsOk( ) ) return( FALSE ); m_oFnmResults = oFName; return( TRUE );}//*****************************************************************************// Save the console output to file.//// Arguments:// rosFName - The save file name//// Return Values:// TRUE - Success// FALSE - Failurebool PrcSimrBase::bSaveOutput( const wxString & rosFName ){ wxFileName ofn1; wxString os1, os2; wxChar oc1; size_t szt1; // Check the validity of the save file name if( rosFName.IsEmpty( ) ) return( FALSE ); ofn1 = rosFName; if( ! ofn1.IsOk( ) ) return( FALSE ); // Open the file wxTextFile oFileCct( ofn1.GetFullPath( ) ); if( oFileCct.Exists( ) ) { if( ! oFileCct.Open( ) ) return( FALSE ); } else { if( ! oFileCct.Create( ) ) return( FALSE ); } // Clear the file if it contains lines for( szt1=oFileCct.GetLineCount( ); szt1>0; szt1-- ) oFileCct.RemoveLine( 0 );#if wxCHECK_VERSION(2,5,4) wxMicroSleep( 100 );#else wxUsleep( 100 );#endif // Save the simulator output to file while( bIsExec( ) || IsInputAvailable( ) || IsErrorAvailable( ) ) { while( IsInputAvailable( ) ) { // Input characters from stdout oc1 = GetInputStream( )->GetC( ); if( oc1 == wxT('\n') ) { oFileCct.AddLine( os1 ); os1 = wxT(""); continue; } if( oc1==wxT('\t') || (oc1>31 && oc1!=127) ) os1 << oc1; } while( IsErrorAvailable( ) ) { // Input characters from stderr oc1 = GetErrorStream( )->GetC( ); if( oc1 == wxT('\n') ) { oFileCct.AddLine( os2 ); os2 = wxT(""); continue; } if( oc1==wxT('\t') || (oc1>31 && oc1!=127) ) os2 << oc1; } if( !IsInputAvailable( ) && !IsErrorAvailable( ) ) wxYield( ); // Release the processor for other tasks } if( os1.Length( ) > 0 ) oFileCct.AddLine( os1 ); if( os2.Length( ) > 0 ) oFileCct.AddLine( os2 ); oFileCct.AddLine( wxT("") ); oFileCct.Write( ); // Save the changes to disk oFileCct.Close( ); // Close the results file return( TRUE );}//*****************************************************************************
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?