2020-09-08 19:51:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-01-31 20:47:36 +00:00
|
|
|
* Copyright (C) 2020-2021 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
2023-03-05 13:56:18 +00:00
|
|
|
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-09-08 19:51:22 +00:00
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cadstar_sch_archive_parser.cpp
|
|
|
|
* @brief Reads in a CADSTAR Schematic Archive (*.csa) file
|
|
|
|
*/
|
|
|
|
|
2022-09-17 01:07:36 +00:00
|
|
|
#include <base_units.h>
|
2020-10-24 14:45:37 +00:00
|
|
|
#include <macros.h>
|
2020-09-08 19:51:22 +00:00
|
|
|
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
|
2021-09-09 21:15:38 +00:00
|
|
|
#include <progress_reporter.h>
|
2021-06-02 23:18:48 +00:00
|
|
|
#include <wx/translation.h>
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::Parse()
|
|
|
|
{
|
2021-09-09 21:15:38 +00:00
|
|
|
if( m_progressReporter )
|
|
|
|
m_progressReporter->BeginPhase( 0 ); // Read file
|
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
m_rootNode = LoadArchiveFile( Filename, wxT( "CADSTARSCM" ), m_progressReporter );
|
2021-09-09 21:15:38 +00:00
|
|
|
|
|
|
|
if( m_progressReporter )
|
|
|
|
{
|
|
|
|
m_progressReporter->BeginPhase( 1 ); // Parse File
|
|
|
|
|
|
|
|
std::vector<wxString> subNodeChildrenToCount = { wxT( "LIBRARY" ), wxT( "PARTS" ),
|
|
|
|
wxT( "SCHEMATIC" ) };
|
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
long numOfSteps = GetNumberOfStepsForReporting( m_rootNode, subNodeChildrenToCount );
|
2021-09-09 21:15:38 +00:00
|
|
|
m_progressReporter->SetMaxProgress( numOfSteps );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_context.CheckPointCallback = [&](){ checkPoint(); };
|
2020-09-08 19:51:22 +00:00
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
XNODE* cNode = m_rootNode->GetChildren();
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
if( !cNode )
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "HEADER" ), wxT( "CADSTARSCM" ) );
|
|
|
|
|
2020-09-08 19:51:22 +00:00
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "HEADER" ) )
|
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Header.Parse( cNode, &m_context );
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
switch( Header.Resolution )
|
|
|
|
{
|
|
|
|
case RESOLUTION::HUNDREDTH_MICRON:
|
2021-02-18 18:02:49 +00:00
|
|
|
KiCadUnitDivider = (long) 1e5 / (long) SCH_IU_PER_MM;
|
2020-09-08 19:51:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxASSERT_MSG( true, wxT( "Unknown File Resolution" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "ASSIGNMENTS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Assignments.Parse( cNode, &m_context );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-08 19:51:22 +00:00
|
|
|
else if( cNode->GetName() == wxT( "LIBRARY" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Library.Parse( cNode, &m_context );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-08 19:51:22 +00:00
|
|
|
else if( cNode->GetName() == wxT( "DEFAULTS" ) )
|
|
|
|
{
|
|
|
|
// No design information here (no need to parse)
|
|
|
|
// Only contains CADSTAR configuration data such as default shapes, text and units
|
|
|
|
// In future some of this could be converted to KiCad but limited value
|
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "PARTS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Parts.Parse( cNode, &m_context );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "SHEETS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Sheets.Parse( cNode, &m_context );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "SCHEMATIC" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Schematic.Parse( cNode, &m_context );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-08 19:51:22 +00:00
|
|
|
else if( cNode->GetName() == wxT( "DISPLAY" ) )
|
|
|
|
{
|
2021-01-27 00:09:58 +00:00
|
|
|
// For now only interested in Attribute visibilities, in order to set field visibilities
|
2021-02-02 13:39:40 +00:00
|
|
|
// in the imported design
|
2021-01-27 00:09:58 +00:00
|
|
|
XNODE* subNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; subNode; subNode = subNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( subNode->GetName() == wxT( "ATTRCOLORS" ) )
|
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
AttrColors.Parse( subNode, &m_context );
|
2021-01-27 00:09:58 +00:00
|
|
|
}
|
2021-02-02 13:39:40 +00:00
|
|
|
else if( subNode->GetName() == wxT( "SCMITEMCOLORS" ) )
|
|
|
|
{
|
|
|
|
XNODE* sub2Node = subNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; sub2Node; sub2Node = sub2Node->GetNext() )
|
|
|
|
{
|
|
|
|
if( sub2Node->GetName() == wxT( "SYMCOL" ) )
|
|
|
|
{
|
|
|
|
XNODE* sub3Node = sub2Node->GetChildren();
|
|
|
|
|
|
|
|
for( ; sub3Node; sub3Node = sub3Node->GetNext() )
|
|
|
|
{
|
|
|
|
if( sub3Node->GetName() == wxT( "PARTNAMECOL" ) )
|
2021-02-13 20:00:17 +00:00
|
|
|
SymbolPartNameColor.Parse( sub3Node, &m_context );
|
2021-02-02 13:39:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-27 00:09:58 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// No design information here
|
|
|
|
// Contains CADSTAR Display settings such as layer/element colours and visibility.
|
|
|
|
// In the future these settings could be converted to KiCad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-08 19:51:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "[root]" ) );
|
|
|
|
}
|
2021-09-09 21:15:38 +00:00
|
|
|
|
|
|
|
checkPoint();
|
2020-09-08 19:51:22 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
delete m_rootNode;
|
|
|
|
m_rootNode = nullptr;
|
2020-09-08 19:51:22 +00:00
|
|
|
}
|
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE_TYPE CADSTAR_SCH_ARCHIVE_PARSER::ParseTermShapeType(
|
|
|
|
const wxString& aShapeStr )
|
|
|
|
{
|
|
|
|
if( aShapeStr == wxT( "ANNULUS" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::ANNULUS;
|
|
|
|
else if( aShapeStr == wxT( "BOX" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::BOX;
|
|
|
|
else if( aShapeStr == wxT( "BULLET" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::BULLET;
|
|
|
|
else if( aShapeStr == wxT( "ROUND" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::CIRCLE;
|
|
|
|
else if( aShapeStr == wxT( "CROSS" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::CROSS;
|
|
|
|
else if( aShapeStr == wxT( "DIAMOND" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::DIAMOND;
|
|
|
|
else if( aShapeStr == wxT( "FINGER" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::FINGER;
|
|
|
|
else if( aShapeStr == wxT( "OCTAGON" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::OCTAGON;
|
|
|
|
else if( aShapeStr == wxT( "PLUS" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::PLUS;
|
|
|
|
else if( aShapeStr == wxT( "POINTER" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::POINTER;
|
|
|
|
else if( aShapeStr == wxT( "RECTANGLE" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::RECTANGLE;
|
|
|
|
else if( aShapeStr == wxT( "ROUNDED" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::ROUNDED_RECT;
|
|
|
|
else if( aShapeStr == wxT( "SQUARE" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::SQUARE;
|
|
|
|
else if( aShapeStr == wxT( "STAR" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::STAR;
|
|
|
|
else if( aShapeStr == wxT( "TRIANGLE" ) )
|
|
|
|
return TERMINAL_SHAPE_TYPE::TRIANGLE;
|
|
|
|
else
|
|
|
|
return TERMINAL_SHAPE_TYPE::UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::IsTermShape( XNODE* aNode )
|
|
|
|
{
|
|
|
|
return ParseTermShapeType( aNode->GetName() ) != TERMINAL_SHAPE_TYPE::UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( IsTermShape( aNode ), );
|
|
|
|
|
|
|
|
ShapeType = ParseTermShapeType( aNode->GetName() );
|
|
|
|
Size = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
|
|
|
|
switch( ShapeType )
|
|
|
|
{
|
|
|
|
case TERMINAL_SHAPE_TYPE::ANNULUS:
|
|
|
|
case TERMINAL_SHAPE_TYPE::BOX:
|
|
|
|
case TERMINAL_SHAPE_TYPE::CROSS:
|
|
|
|
case TERMINAL_SHAPE_TYPE::PLUS:
|
|
|
|
case TERMINAL_SHAPE_TYPE::STAR:
|
|
|
|
InternalFeature = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TERMINAL_SHAPE_TYPE::ROUNDED_RECT:
|
|
|
|
InternalFeature = GetXmlAttributeIDLong( aNode, 3 );
|
2020-09-19 22:05:02 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
case TERMINAL_SHAPE_TYPE::BULLET:
|
|
|
|
case TERMINAL_SHAPE_TYPE::FINGER:
|
|
|
|
case TERMINAL_SHAPE_TYPE::POINTER:
|
|
|
|
case TERMINAL_SHAPE_TYPE::RECTANGLE:
|
|
|
|
case TERMINAL_SHAPE_TYPE::TRIANGLE:
|
2021-02-08 08:06:41 +00:00
|
|
|
RightLength = GetXmlAttributeIDLong( aNode, 2, false ); // Optional
|
2020-09-19 22:05:02 +00:00
|
|
|
LeftLength = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TERMINAL_SHAPE_TYPE::CIRCLE:
|
|
|
|
case TERMINAL_SHAPE_TYPE::DIAMOND:
|
|
|
|
case TERMINAL_SHAPE_TYPE::OCTAGON:
|
|
|
|
case TERMINAL_SHAPE_TYPE::SQUARE:
|
2020-09-26 18:23:13 +00:00
|
|
|
//don't do anything
|
2020-09-19 22:05:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TERMINAL_SHAPE_TYPE::UNDEFINED:
|
|
|
|
wxASSERT_MSG( false, "Unknown terminal shape type" );
|
2020-09-13 21:42:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aNode->GetChildren() )
|
|
|
|
{
|
|
|
|
if( aNode->GetChildren()->GetName() == wxT( "ORIENT" ) )
|
|
|
|
{
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( aNode->GetChildren(), 0 );
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
CheckNoNextNodes( aNode->GetChildren() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "TERMINALCODE" ), );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
wxString location = wxString::Format( "TERMINALCODE -> %s", Name );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( TERMINAL_SHAPE::IsTermShape( cNode ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "FILLED" ) )
|
|
|
|
Filled = true;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::CODEDEFS_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "CODEDEFS" ), );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString nodeName = cNode->GetName();
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) ) // in CADSTAR_ARCHIVE_PARSER::CODEDEFS
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "TERMINALCODE" ) )
|
|
|
|
{
|
|
|
|
TERMINALCODE termcode;
|
2020-12-10 16:13:35 +00:00
|
|
|
termcode.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
TerminalCodes.insert( std::make_pair( termcode.ID, termcode ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "ASSIGNMENTS" ), );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool settingsParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "CODEDEFS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Codedefs.Parse( cNode, aContext );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "SETTINGS" ) )
|
|
|
|
{
|
|
|
|
settingsParsed = true;
|
2020-12-10 16:13:35 +00:00
|
|
|
Settings.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "GRIDS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Grids.Parse( cNode, aContext );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "NETCLASSEDITATTRIBSETTINGS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
NetclassEditAttributeSettings = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "SPCCLASSEDITATTRIBSETTINGS" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
SpacingclassEditAttributeSettings = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !settingsParsed )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "SETTINGS" ), wxT( "ASSIGNMENTS" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "TERMINAL" ), );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-09-27 21:09:16 +00:00
|
|
|
wxString location = wxString::Format( "TERMINAL %ld", ID );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), location );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "ORIENT" ) )
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "PT" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Position.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "PINLABELLOC" )
|
2020-09-19 22:05:02 +00:00
|
|
|
|| aNode->GetName() == wxT( "PINNUMNAMELOC" ), );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
TextCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
continue;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE )
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SYMDEF" ), );
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
continue;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "TERMINAL" ) )
|
|
|
|
{
|
|
|
|
TERMINAL term;
|
2020-12-10 16:13:35 +00:00
|
|
|
term.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Terminals.insert( std::make_pair( term.ID, term ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PINLABELLOC" ) )
|
|
|
|
{
|
|
|
|
PIN_NUM_LABEL_LOC loc;
|
2020-12-10 16:13:35 +00:00
|
|
|
loc.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
PinLabelLocations.insert( std::make_pair( loc.TerminalID, loc ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PINNUMNAMELOC" ) )
|
|
|
|
{
|
|
|
|
PIN_NUM_LABEL_LOC loc;
|
2020-12-10 16:13:35 +00:00
|
|
|
loc.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
PinNumberLocations.insert( std::make_pair( loc.TerminalID, loc ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
if( !Stub && ( Origin.x == UNDEFINED_VALUE || Origin.y == UNDEFINED_VALUE ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "LIBRARY" ), );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SYMDEF" ) )
|
|
|
|
{
|
|
|
|
SYMDEF_SCM symdef;
|
2020-12-10 16:13:35 +00:00
|
|
|
symdef.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
SymbolDefinitions.insert( std::make_pair( symdef.ID, symdef ) );
|
|
|
|
}
|
2023-03-05 13:56:18 +00:00
|
|
|
else if( cNodeName == wxT( "HIERARCHY" ) )
|
|
|
|
{
|
|
|
|
// Ignore for now
|
|
|
|
//
|
|
|
|
// This node doesn't have any equivalent in KiCad so for now we ignore it. In
|
|
|
|
// future, we could parse it in detail, to obtain the tree-structure of
|
|
|
|
// symbols in a cadstar library
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
2021-09-09 21:15:38 +00:00
|
|
|
|
|
|
|
aContext->CheckPointCallback();
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SHEETS" ), );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "SHEET" ) )
|
|
|
|
{
|
|
|
|
LAYER_ID id = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
SHEET_NAME name = GetXmlAttributeIDString( cNode, 1 );
|
2020-09-19 22:05:02 +00:00
|
|
|
SheetNames.insert( std::make_pair( id, name ) );
|
|
|
|
SheetOrder.push_back( id );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "COMP" ), );
|
|
|
|
|
|
|
|
Designator = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "READONLY" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
ReadOnly = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "ATTRLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
AttrLoc.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasLocation = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-11-15 14:42:01 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "PARTREF" ), );
|
|
|
|
|
|
|
|
RefID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "READONLY" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
ReadOnly = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNode->GetName() == wxT( "ATTRLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
AttrLoc.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasLocation = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-11-15 14:42:01 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-11-15 14:42:01 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "TERMATTR" ), /* void */ );
|
|
|
|
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
2023-03-26 14:54:21 +00:00
|
|
|
if( cNode->GetName() == wxT( "ATTR" ) )
|
2020-11-15 14:42:01 +00:00
|
|
|
{
|
2023-03-26 14:54:21 +00:00
|
|
|
ATTRIBUTE_VALUE val;
|
|
|
|
val.Parse( cNode, aContext );
|
|
|
|
Attributes.push_back( val );
|
2020-11-15 14:42:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SYMPINNAME" ) || aNode->GetName() == wxT( "SYMPINLABEL" ), );
|
|
|
|
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
NameOrLabel = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "ATTRLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
AttrLoc.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasLocation = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-11-15 14:42:01 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-26 13:27:03 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "PINNUM" ), );
|
|
|
|
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
PinNum = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "ATTRLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
AttrLoc.Parse( cNode, aContext );
|
2020-09-26 13:27:03 +00:00
|
|
|
HasLocation = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-11-15 14:42:01 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-26 13:27:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOLVARIANT::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SYMBOLVARIANT" ), );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SIGNALREF" ) )
|
|
|
|
{
|
|
|
|
Type = TYPE::SIGNALREF;
|
|
|
|
CheckNoNextNodes( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GLOBALSIGNAL" ) )
|
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
Type = TYPE::GLOBALSIGNAL;
|
2020-09-13 21:42:17 +00:00
|
|
|
Reference = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
2021-02-17 16:57:26 +00:00
|
|
|
else if( cNodeName == wxT( "TESTPOINT" ) )
|
|
|
|
{
|
|
|
|
Type = TYPE::TESTPOINT;
|
|
|
|
CheckNoNextNodes( cNode );
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SIGNALREFERENCELINK" ), );
|
|
|
|
|
|
|
|
TextCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
continue;
|
|
|
|
else if( cNode->GetName() == wxT( "SIGREFTEXT" ) )
|
|
|
|
Text = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE )
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SYMBOL" ), );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
SymdefID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool originParsed = false;
|
|
|
|
wxString location = wxString::Format( "SYMBOL -> %s", ID );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !originParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Origin.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
originParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMP" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ComponentRef.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
IsComponent = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PARTREF" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
PartRef.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasPartRef = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PARTNAMENOTVISIBLE" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
PartNameVisible = false;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "VSYMMASTER" ) )
|
|
|
|
{
|
2020-11-21 12:55:58 +00:00
|
|
|
VariantParentSymbolID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
VariantID = GetXmlAttributeIDString( cNode, 1 );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "SIGNALREFERENCELINK" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
SigRefLink.Parse( cNode, aContext );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "ORIENT" ) )
|
|
|
|
{
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "MIRROR" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
Mirror = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
Fixed = true;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-11-23 20:54:34 +00:00
|
|
|
else if( cNodeName == wxT( "SCALE" ) )
|
|
|
|
{
|
|
|
|
ScaleRatioNumerator = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
ScaleRatioDenominator = GetXmlAttributeIDLong( cNode, 1 );
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "READABILITY" ) )
|
|
|
|
{
|
|
|
|
Readability = ParseReadability( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GATE" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
GateID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "SYMBOLVARIANT" ) )
|
|
|
|
{
|
|
|
|
IsSymbolVariant = true;
|
2020-12-10 16:13:35 +00:00
|
|
|
SymbolVariant.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
2020-11-15 14:42:01 +00:00
|
|
|
else if( cNodeName == wxT( "TERMATTR" ) )
|
|
|
|
{
|
|
|
|
TERMATTR termattr;
|
2020-12-10 16:13:35 +00:00
|
|
|
termattr.Parse( cNode, aContext );
|
2020-11-15 14:42:01 +00:00
|
|
|
TerminalAttributes.insert( std::make_pair( termattr.TerminalID, termattr ) );
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "SYMPINLABEL" ) )
|
|
|
|
{
|
|
|
|
SYMPINNAME_LABEL sympinname;
|
2020-12-10 16:13:35 +00:00
|
|
|
sympinname.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
PinLabels.insert( std::make_pair( sympinname.TerminalID, sympinname ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SYMPINNAME" ) )
|
|
|
|
{
|
|
|
|
SYMPINNAME_LABEL sympinname;
|
2020-12-10 16:13:35 +00:00
|
|
|
sympinname.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
PinNames.insert( std::make_pair( sympinname.TerminalID, sympinname ) );
|
|
|
|
}
|
2020-09-26 13:27:03 +00:00
|
|
|
else if( cNodeName == wxT( "PINNUM" ) )
|
|
|
|
{
|
|
|
|
PIN_NUM pinNum;
|
2020-12-10 16:13:35 +00:00
|
|
|
pinNum.Parse( cNode, aContext );
|
2020-09-26 13:27:03 +00:00
|
|
|
PinNumbers.insert( std::make_pair( pinNum.TerminalID, pinNum ) );
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attrVal;
|
2020-12-10 16:13:35 +00:00
|
|
|
attrVal.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !originParsed )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SIGLOC" ), );
|
|
|
|
|
|
|
|
TextCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
continue;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
2023-02-19 03:40:07 +00:00
|
|
|
if( Position.x == UNDEFINED_VALUE || Position.y == UNDEFINED_VALUE )
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "BUS" ), );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BUSNAME" ) )
|
|
|
|
{
|
|
|
|
Name = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
|
|
|
|
XNODE* subNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
if( subNode )
|
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
if( subNode->GetName() == wxT( "SIGLOC" ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
BusLabel.Parse( subNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasBusLabel = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( subNode->GetName(), cNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "BLOCK" ), );
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "CLONE" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
Type = TYPE::CLONE;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "PARENT" ) )
|
|
|
|
{
|
|
|
|
Type = TYPE::PARENT;
|
|
|
|
AssocLayerID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "CHILD" ) )
|
|
|
|
{
|
|
|
|
Type = TYPE::CHILD;
|
|
|
|
AssocLayerID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BLOCKNAME" ) )
|
|
|
|
{
|
|
|
|
Name = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
XNODE* subNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
if( subNode )
|
|
|
|
{
|
|
|
|
if( subNode->GetName() == wxT( "ATTRLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
BlockLabel.Parse( subNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasBlockLabel = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( subNode->GetName(), cNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TERMINAL" ) )
|
|
|
|
{
|
|
|
|
TERMINAL term;
|
2020-12-10 16:13:35 +00:00
|
|
|
term.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Terminals.insert( std::make_pair( term.ID, term ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIGURE" ) )
|
|
|
|
{
|
|
|
|
FIGURE figure;
|
2020-12-10 16:13:35 +00:00
|
|
|
figure.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Figures.insert( std::make_pair( figure.ID, figure ) );
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "TERM" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
SymbolID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 2 );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SIGLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
NetLabel.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasNetLabel = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "BUSTERM" ) );
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
BusID = GetXmlAttributeIDString( aNode, 1 );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool firstPointParsed = false;
|
2020-09-13 21:42:17 +00:00
|
|
|
bool secondPointParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SIGLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
NetLabel.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasNetLabel = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
if( !firstPointParsed )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
FirstPoint.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
firstPointParsed = true;
|
|
|
|
}
|
|
|
|
else if( !secondPointParsed )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
SecondPoint.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
secondPointParsed = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-19 22:05:02 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !firstPointParsed || !secondPointParsed )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "BLOCKTERM" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
BlockID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
TerminalID = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SIGLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
NetLabel.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
HasNetLabel = true;
|
|
|
|
}
|
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 3 );
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
continue;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "PATH" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Path = ParseAllChildPoints( cNode, aContext, true );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "CONLINECODE" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
ConnectionLineCode = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "CONN" ) );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
if( cNodeName == wxT( "JPT" ) )
|
|
|
|
{
|
|
|
|
JUNCTION_SCH jpt;
|
2020-12-10 16:13:35 +00:00
|
|
|
jpt.Parse( cNode, aContext );
|
2020-09-23 20:39:11 +00:00
|
|
|
Junctions.insert( std::make_pair( jpt.ID, jpt ) );
|
|
|
|
}
|
2020-12-10 16:13:35 +00:00
|
|
|
else if( ParseSubNode( cNode, aContext ) )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TERM" ) )
|
|
|
|
{
|
|
|
|
SYM_TERM pin;
|
2020-12-10 16:13:35 +00:00
|
|
|
pin.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Terminals.insert( std::make_pair( pin.ID, pin ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BUSTERM" ) )
|
|
|
|
{
|
|
|
|
BUS_TERM bt;
|
2020-12-10 16:13:35 +00:00
|
|
|
bt.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
BusTerminals.insert( std::make_pair( bt.ID, bt ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BLOCKTERM" ) )
|
|
|
|
{
|
|
|
|
BLOCK_TERM bt;
|
2020-12-10 16:13:35 +00:00
|
|
|
bt.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
BlockTerminals.insert( std::make_pair( bt.ID, bt ) );
|
|
|
|
}
|
2020-09-26 13:27:03 +00:00
|
|
|
else if( cNodeName == wxT( "DANGLER" ) )
|
|
|
|
{
|
|
|
|
DANGLER dang;
|
2020-12-10 16:13:35 +00:00
|
|
|
dang.Parse( cNode, aContext );
|
2020-09-26 13:27:03 +00:00
|
|
|
Danglers.insert( std::make_pair( dang.ID, dang ) );
|
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else if( cNodeName == wxT( "CONN" ) )
|
|
|
|
{
|
|
|
|
CONNECTION_SCH conn;
|
2020-12-10 16:13:35 +00:00
|
|
|
conn.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Connections.push_back( conn );
|
|
|
|
}
|
|
|
|
else
|
2020-09-19 22:05:02 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "NET" ) );
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-13 20:00:17 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::CADSTAR_SCHEMATIC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK( aNode->GetName() == wxT( "SCHEMATIC" ), );
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-09-13 21:42:17 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "GROUP" ) )
|
|
|
|
{
|
|
|
|
GROUP group;
|
2020-12-10 16:13:35 +00:00
|
|
|
group.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Groups.insert( std::make_pair( group.ID, group ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "REUSEBLOCK" ) )
|
|
|
|
{
|
|
|
|
REUSEBLOCK reuseblock;
|
2020-12-10 16:13:35 +00:00
|
|
|
reuseblock.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
ReuseBlocks.insert( std::make_pair( reuseblock.ID, reuseblock ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIGURE" ) )
|
|
|
|
{
|
|
|
|
FIGURE figure;
|
2020-12-10 16:13:35 +00:00
|
|
|
figure.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Figures.insert( std::make_pair( figure.ID, figure ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SYMBOL" ) )
|
|
|
|
{
|
|
|
|
SYMBOL sym;
|
2020-12-10 16:13:35 +00:00
|
|
|
sym.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Symbols.insert( std::make_pair( sym.ID, sym ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BUS" ) )
|
|
|
|
{
|
|
|
|
BUS bus;
|
2020-12-10 16:13:35 +00:00
|
|
|
bus.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Buses.insert( std::make_pair( bus.ID, bus ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BLOCK" ) )
|
|
|
|
{
|
|
|
|
BLOCK block;
|
2020-12-10 16:13:35 +00:00
|
|
|
block.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Blocks.insert( std::make_pair( block.ID, block ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "NET" ) )
|
|
|
|
{
|
|
|
|
NET_SCH net;
|
2020-12-10 16:13:35 +00:00
|
|
|
net.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Nets.insert( std::make_pair( net.ID, net ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TEXT" ) )
|
|
|
|
{
|
|
|
|
TEXT txt;
|
2020-12-10 16:13:35 +00:00
|
|
|
txt.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
Texts.insert( std::make_pair( txt.ID, txt ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DOCSYMBOL" ) )
|
|
|
|
{
|
|
|
|
DOCUMENTATION_SYMBOL docsym;
|
2020-12-10 16:13:35 +00:00
|
|
|
docsym.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
DocumentationSymbols.insert( std::make_pair( docsym.ID, docsym ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "VHIERARCHY" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
VariantHierarchy.Parse( cNode, aContext );
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
2021-09-09 21:15:38 +00:00
|
|
|
|
|
|
|
aContext->CheckPointCallback();
|
2020-09-13 21:42:17 +00:00
|
|
|
}
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
2020-09-23 20:39:11 +00:00
|
|
|
|
2020-09-26 13:27:03 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-23 20:39:11 +00:00
|
|
|
{
|
2020-12-29 19:38:16 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-09-23 20:39:11 +00:00
|
|
|
|
|
|
|
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
2020-12-29 19:38:16 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "SIGLOC" ) )
|
|
|
|
{
|
|
|
|
NetLabel.Parse( cNode, aContext );
|
|
|
|
HasNetLabel = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
2021-01-27 00:09:58 +00:00
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
}
|
2020-09-26 13:27:03 +00:00
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::DANGLER::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-26 13:27:03 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "DANGLER" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool positionParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SIGLOC" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
NetLabel.Parse( cNode, aContext );
|
2020-09-26 13:27:03 +00:00
|
|
|
HasNetLabel = true;
|
|
|
|
}
|
|
|
|
else if( !positionParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Position.Parse( cNode, aContext );
|
2020-09-26 13:27:03 +00:00
|
|
|
positionParsed = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|