Ibis: Show the parser log if the parser fails
This commit is contained in:
parent
259e41be2d
commit
6510afe699
|
@ -72,6 +72,8 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_global_edit_text_and_graphics.cpp
|
||||
dialogs/dialog_global_edit_text_and_graphics_base.cpp
|
||||
dialogs/dialog_global_sym_lib_table_config.cpp
|
||||
dialogs/dialog_ibis_parser_reporter.cpp
|
||||
dialogs/dialog_ibis_parser_reporter_base.cpp
|
||||
dialogs/dialog_image_properties.cpp
|
||||
dialogs/dialog_image_properties_base.cpp
|
||||
dialogs/dialog_junction_props.cpp
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <dialog_ibis_parser_reporter.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include "widgets/wx_html_report_panel.h"
|
||||
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER::DIALOG_IBIS_PARSER_REPORTER( wxWindow* aParent ) :
|
||||
DIALOG_IBIS_PARSER_REPORTER_BASE( aParent ), m_frame( aParent )
|
||||
{
|
||||
m_messagePanel->SetLabel( _( "Ibis parser log" ) );
|
||||
m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
|
||||
m_messagePanel->SetLazyUpdate( true );
|
||||
m_messagePanel->GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Close" ) } } );
|
||||
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_IBIS_PARSER_REPORTER::TransferDataToWindow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER::~DIALOG_IBIS_PARSER_REPORTER()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _DIALOG_IBIS_PARSER_REPORTER_H_
|
||||
#define _DIALOG_IBIS_PARSER_REPORTER_H_
|
||||
|
||||
#include <dialog_ibis_parser_reporter_base.h>
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
|
||||
class DIALOG_IBIS_PARSER_REPORTER : public DIALOG_IBIS_PARSER_REPORTER_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_IBIS_PARSER_REPORTER( wxWindow* aParent );
|
||||
~DIALOG_IBIS_PARSER_REPORTER();
|
||||
|
||||
private:
|
||||
void updateData();
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
void OnCloseClick( wxCommandEvent& event ) override { Close(); };
|
||||
|
||||
wxWindow* m_frame;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,52 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/wx_html_report_panel.h"
|
||||
|
||||
#include "dialog_ibis_parser_reporter_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER_BASE::DIALOG_IBIS_PARSER_REPORTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bLowerSizer;
|
||||
bLowerSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
bLowerSizer->SetMinSize( wxSize( 600,260 ) );
|
||||
m_messagePanel = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
bLowerSizer->Add( m_messagePanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bLowerSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IBIS_PARSER_REPORTER_BASE::OnCloseClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER_BASE::~DIALOG_IBIS_PARSER_REPORTER_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IBIS_PARSER_REPORTER_BASE::OnCloseClick ), NULL, this );
|
||||
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="16" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_ibis_parser_reporter_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_ibis_parser_reporter_base</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="name">DIALOG_IBIS_PARSER_REPORTER_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Ibis parser</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size">600,260</property>
|
||||
<property name="name">bLowerSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_messagePanel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">public</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">WX_HTML_REPORT_PANEL; widgets/wx_html_report_panel.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">0</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnOKButtonClick">OnCloseClick</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,52 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class WX_HTML_REPORT_PANEL;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_IBIS_PARSER_REPORTER_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_IBIS_PARSER_REPORTER_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnCloseClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
WX_HTML_REPORT_PANEL* m_messagePanel;
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Ibis parser"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
~DIALOG_IBIS_PARSER_REPORTER_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialog_ibis_parser_reporter.h>
|
||||
#include <dialog_sim_model.h>
|
||||
#include <sim/sim_property.h>
|
||||
#include <sim/sim_library_kibis.h>
|
||||
|
@ -622,7 +623,32 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aLibraryPath, bool aForce
|
|||
if( !aForceReload && libraries.size() >= 1 && libraries.begin()->first == aLibraryPath )
|
||||
return;
|
||||
|
||||
m_libraryModelsMgr.SetLibrary( std::string( aLibraryPath.ToUTF8() ) );
|
||||
|
||||
DIALOG_IBIS_PARSER_REPORTER dlg( this );
|
||||
dlg.m_messagePanel->Clear();
|
||||
|
||||
bool tryingToLoadIbis = false;
|
||||
|
||||
if( aLibraryPath.EndsWith( ".ibs" ) )
|
||||
tryingToLoadIbis = true;
|
||||
|
||||
try
|
||||
{
|
||||
m_libraryModelsMgr.SetLibrary( std::string( aLibraryPath.ToUTF8() ),
|
||||
&( dlg.m_messagePanel->Reporter() ) );
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
if( tryingToLoadIbis )
|
||||
{
|
||||
dlg.m_messagePanel->Flush();
|
||||
dlg.ShowQuasiModal();
|
||||
}
|
||||
else
|
||||
DisplayErrorMessage( this, e.What() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include <wx/string.h>
|
||||
#include <reporter.h>
|
||||
#include "widgets/wx_html_report_panel.h"
|
||||
//#include "common.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
@ -48,19 +49,7 @@
|
|||
#include <cstring>
|
||||
|
||||
|
||||
class IBIS_REPORTER
|
||||
{
|
||||
public:
|
||||
/** @brief Print a message
|
||||
*
|
||||
* In the future, this function could do more than just printing a message.
|
||||
* All KIBIS messages are concentrated at a single point in the code.
|
||||
*
|
||||
* @param aMsg Message
|
||||
* @param aSeverity Message sevirity
|
||||
*/
|
||||
void Report( std::string aMsg, SEVERITY aSeverity ) { std::cout << aMsg << std::endl; };
|
||||
};
|
||||
#define IBIS_REPORTER REPORTER
|
||||
|
||||
class IBIS_ANY
|
||||
{
|
||||
|
@ -78,9 +67,7 @@ public:
|
|||
void Report( std::string aMsg, SEVERITY aSeverity = RPT_SEVERITY_INFO )
|
||||
{
|
||||
if( m_reporter )
|
||||
{
|
||||
m_reporter->Report( aMsg, aSeverity );
|
||||
}
|
||||
};
|
||||
protected:
|
||||
/** @brief Convert a double to string using scientific notation
|
||||
|
|
|
@ -85,10 +85,12 @@ IBIS_CORNER ReverseLogic( IBIS_CORNER aIn )
|
|||
return out;
|
||||
}
|
||||
|
||||
KIBIS::KIBIS( std::string aFileName ) : KIBIS_ANY( this ), m_file( this )
|
||||
KIBIS::KIBIS( std::string aFileName, IBIS_REPORTER* aReporter ) :
|
||||
KIBIS_ANY( this ),
|
||||
m_file( this ),
|
||||
m_reporter( aReporter )
|
||||
{
|
||||
IBIS_REPORTER reporter;
|
||||
IbisParser parser( &reporter );
|
||||
IbisParser parser( m_reporter );
|
||||
bool status = true;
|
||||
|
||||
parser.m_parrot = false;
|
||||
|
|
|
@ -218,7 +218,9 @@ public:
|
|||
{
|
||||
m_valid = false;
|
||||
}; // Constructor for unitialized KIBIS members
|
||||
KIBIS( std::string aFileName );
|
||||
KIBIS( std::string aFileName, IBIS_REPORTER* aReporter = nullptr );
|
||||
|
||||
IBIS_REPORTER* m_reporter;
|
||||
std::vector<KIBIS_COMPONENT> m_components;
|
||||
std::vector<KIBIS_MODEL> m_models;
|
||||
KIBIS_FILE m_file;
|
||||
|
|
|
@ -44,20 +44,22 @@ void SIM_LIB_MGR::Clear()
|
|||
}
|
||||
|
||||
|
||||
SIM_LIBRARY& SIM_LIB_MGR::CreateLibrary( const std::string& aLibraryPath )
|
||||
SIM_LIBRARY& SIM_LIB_MGR::CreateLibrary( const std::string& aLibraryPath, REPORTER* aReporter )
|
||||
{
|
||||
std::string absolutePath = std::string( m_project.AbsolutePath( aLibraryPath ).ToUTF8() );
|
||||
|
||||
auto it = m_libraries.try_emplace( aLibraryPath, SIM_LIBRARY::Create( absolutePath ) ).first;
|
||||
auto it =
|
||||
m_libraries.try_emplace( aLibraryPath, SIM_LIBRARY::Create( absolutePath, aReporter ) )
|
||||
.first;
|
||||
return *it->second;
|
||||
}
|
||||
|
||||
SIM_LIBRARY& SIM_LIB_MGR::SetLibrary( const std::string& aLibraryPath )
|
||||
SIM_LIBRARY& SIM_LIB_MGR::SetLibrary( const std::string& aLibraryPath, REPORTER* aReporter )
|
||||
{
|
||||
std::string absolutePath = std::string( m_project.AbsolutePath( aLibraryPath ).ToUTF8() );
|
||||
|
||||
// May throw an exception.
|
||||
std::unique_ptr<SIM_LIBRARY> library = SIM_LIBRARY::Create( absolutePath );
|
||||
std::unique_ptr<SIM_LIBRARY> library = SIM_LIBRARY::Create( absolutePath, aReporter );
|
||||
|
||||
Clear();
|
||||
m_libraries[aLibraryPath] = std::move( library );
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
|
||||
void Clear();
|
||||
|
||||
SIM_LIBRARY& CreateLibrary( const std::string& aLibraryPath );
|
||||
SIM_LIBRARY& SetLibrary( const std::string& aLibraryPath );
|
||||
SIM_LIBRARY& CreateLibrary( const std::string& aLibraryPath, REPORTER* aReporter = nullptr );
|
||||
SIM_LIBRARY& SetLibrary( const std::string& aLibraryPath, REPORTER* aReporter = nullptr );
|
||||
|
||||
SIM_MODEL& CreateModel( SIM_MODEL::TYPE aType, int aSymbolPinCount );
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <sim/sim_library_spice.h>
|
||||
|
||||
|
||||
std::unique_ptr<SIM_LIBRARY> SIM_LIBRARY::Create( std::string aFilePath )
|
||||
std::unique_ptr<SIM_LIBRARY> SIM_LIBRARY::Create( std::string aFilePath, REPORTER* aReporter )
|
||||
{
|
||||
std::unique_ptr<SIM_LIBRARY> library;
|
||||
wxString wxaFilePath( aFilePath );
|
||||
|
@ -37,6 +37,7 @@ std::unique_ptr<SIM_LIBRARY> SIM_LIBRARY::Create( std::string aFilePath )
|
|||
else
|
||||
library = std::make_unique<SIM_LIBRARY_SPICE>();
|
||||
|
||||
library->m_reporter = aReporter;
|
||||
library->ReadFile( aFilePath );
|
||||
return library;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define SIM_LIBRARY_H
|
||||
|
||||
#include <sim/sim_model.h>
|
||||
#include <reporter.h>
|
||||
|
||||
|
||||
class SIM_LIBRARY
|
||||
|
@ -48,9 +49,11 @@ public:
|
|||
* object of an appropriate subclass.
|
||||
*
|
||||
* @param aFilePath Path to the file.
|
||||
* @param aReporter The reporter the library reports to
|
||||
* @return The library loaded in a newly constructed object.
|
||||
*/
|
||||
static std::unique_ptr<SIM_LIBRARY> Create( std::string aFilePath );
|
||||
static std::unique_ptr<SIM_LIBRARY> Create( std::string aFilePath,
|
||||
REPORTER* aReporter = nullptr );
|
||||
|
||||
/**
|
||||
* Read library from a source file. Must be in the format appropriate to the subclass, e.g.
|
||||
|
@ -80,6 +83,8 @@ protected:
|
|||
std::vector<std::unique_ptr<SIM_MODEL>> m_models;
|
||||
|
||||
std::string m_filePath;
|
||||
|
||||
REPORTER* m_reporter = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
void SIM_LIBRARY_KIBIS::ReadFile( const std::string& aFilePath )
|
||||
{
|
||||
SIM_LIBRARY::ReadFile( aFilePath );
|
||||
m_kibis = KIBIS( aFilePath );
|
||||
m_kibis = KIBIS( aFilePath, m_reporter );
|
||||
|
||||
if( !m_kibis.m_valid )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue