2007-12-22 07:18:20 +00:00
|
|
|
|
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2007-12-22 07:18:20 +00:00
|
|
|
*
|
2011-01-19 20:46:07 +00:00
|
|
|
* Copyright (C) 2007-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2021-07-19 23:56:05 +00:00
|
|
|
* Copyright (C) 2007-2021 KiCad Developers, see change_log.txt for contributors.
|
2008-02-07 20:23:58 +00:00
|
|
|
*
|
2007-12-22 07:18:20 +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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-02-07 20:23:58 +00:00
|
|
|
*
|
2007-12-22 07:18:20 +00:00
|
|
|
* 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.
|
2008-02-07 20:23:58 +00:00
|
|
|
*
|
2007-12-22 07:18:20 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
2008-02-07 20:23:58 +00:00
|
|
|
* 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.,
|
2007-12-22 07:18:20 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
/*
|
|
|
|
* This source file implements export and import capabilities to the
|
|
|
|
* specctra dsn file format. The grammar for that file format is documented
|
|
|
|
* fairly well. There are classes for each major type of descriptor in the
|
|
|
|
* spec.
|
|
|
|
*
|
|
|
|
* Since there are so many classes in here, it may be helpful to generate
|
|
|
|
* the Doxygen directory:
|
|
|
|
*
|
|
|
|
* $ cd <kicadSourceRoot>
|
|
|
|
* $ doxygen
|
|
|
|
*
|
|
|
|
* Then you can view the html documentation in the <kicadSourceRoot>/doxygen
|
|
|
|
* directory. The main class in this file is SPECCTRA_DB and its main
|
|
|
|
* functions are LoadPCB(), LoadSESSION(), and ExportPCB().
|
|
|
|
*
|
|
|
|
* Wide use is made of boost::ptr_vector<> and std::vector<> template classes.
|
|
|
|
* If the contained object is small, then std::vector tends to be used.
|
|
|
|
* If the contained object is large, variable size, or would require writing
|
|
|
|
* an assignment operator() or copy constructor, then boost::ptr_vector
|
|
|
|
* cannot be beat.
|
|
|
|
*/
|
2008-01-03 22:24:17 +00:00
|
|
|
|
2007-12-23 06:10:51 +00:00
|
|
|
|
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstdio>
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <build_version.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2021-06-11 21:07:02 +00:00
|
|
|
#include <pcb_track.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2018-01-29 17:09:18 +00:00
|
|
|
#include "specctra.h"
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <macros.h>
|
2010-08-08 00:31:07 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
namespace DSN {
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
#define NESTWIDTH 2 ///< how many spaces per nestLevel
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
//-----<SPECCTRA_DB>-------------------------------------------------
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2009-12-11 04:55:24 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
const char* GetTokenText( T aTok )
|
2009-12-11 04:55:24 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
return SPECCTRA_LEXER::TokenName( aTok );
|
2009-12-11 04:55:24 +00:00
|
|
|
}
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-02-08 00:16:59 +00:00
|
|
|
void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
|
|
|
|
{
|
|
|
|
// specctra wants top physical layer first, then going down to the
|
|
|
|
// bottom most physical layer in physical sequence.
|
2014-06-24 16:17:18 +00:00
|
|
|
// Same as KiCad now except for B_Cu
|
|
|
|
unsigned layerCount = aBoard->GetCopperLayerCount();
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
m_layerIds.clear();
|
|
|
|
m_pcbLayer2kicad.resize( layerCount );
|
|
|
|
m_kicadLayer2pcb.resize( B_Cu + 1 );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
#if 0 // was:
|
2021-07-21 23:14:56 +00:00
|
|
|
for( int kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; kiNdx >= 0; --kiNdx, ++pcbNdx )
|
2008-02-08 00:16:59 +00:00
|
|
|
{
|
2021-07-21 23:14:56 +00:00
|
|
|
int kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? F_Cu : kiNdx;
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// establish bi-directional mapping between KiCad's BOARD layer and PCB layer
|
2008-02-08 00:16:59 +00:00
|
|
|
pcbLayer2kicad[pcbNdx] = kilayer;
|
|
|
|
kicadLayer2pcb[kilayer] = pcbNdx;
|
|
|
|
|
|
|
|
// save the specctra layer name in SPECCTRA_DB::layerIds for later.
|
2014-06-29 13:05:51 +00:00
|
|
|
layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( kilayer ) ) ) );
|
2008-02-08 00:16:59 +00:00
|
|
|
}
|
2014-06-24 16:17:18 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
// establish bi-directional mapping between KiCad's BOARD layer and PCB layer
|
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
for( unsigned i = 0; i < m_kicadLayer2pcb.size(); ++i )
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
if( i < layerCount-1 )
|
2020-11-14 21:21:54 +00:00
|
|
|
m_kicadLayer2pcb[i] = i;
|
2014-06-24 16:17:18 +00:00
|
|
|
else
|
2020-11-14 21:21:54 +00:00
|
|
|
m_kicadLayer2pcb[i] = layerCount - 1;
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
for( unsigned i = 0; i < m_pcbLayer2kicad.size(); ++i )
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID id = ( i < layerCount-1 ) ? ToLAYER_ID( i ) : B_Cu;
|
2015-06-18 13:29:26 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
m_pcbLayer2kicad[i] = id;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
// save the specctra layer name in SPECCTRA_DB::layerIds for later.
|
2020-11-14 21:21:54 +00:00
|
|
|
m_layerIds.push_back(TO_UTF8( aBoard->GetLayerName( id ) ) );
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2008-02-08 00:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-29 16:35:07 +00:00
|
|
|
int SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const
|
2008-02-08 00:16:59 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
for( int i = 0; i < int( m_layerIds.size() ); ++i )
|
2008-02-08 00:16:59 +00:00
|
|
|
{
|
2020-11-14 21:21:54 +00:00
|
|
|
if( 0 == aLayerName.compare( m_layerIds[i] ) )
|
2013-03-31 13:27:46 +00:00
|
|
|
return i;
|
2008-02-08 00:16:59 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2013-04-29 16:35:07 +00:00
|
|
|
return -1;
|
2008-02-08 00:16:59 +00:00
|
|
|
}
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::readCOMPnPIN( std::string* component_id, std::string* pin_id )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
static const char pin_def[] = "<pin_reference>::=<component_id>-<pin_id>";
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( (T) CurTok() ) )
|
|
|
|
Expecting( pin_def );
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
// case for: A12-14, i.e. no wrapping quotes. This should be a single
|
2008-02-07 20:23:58 +00:00
|
|
|
// token, so split it.
|
2011-01-19 20:46:07 +00:00
|
|
|
if( CurTok() != T_STRING )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
const char* toktext = CurText();
|
2008-01-18 22:41:16 +00:00
|
|
|
const char* dash = strchr( toktext, '-' );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
if( !dash )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( pin_def );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
while( toktext != dash )
|
|
|
|
*component_id += *toktext++;
|
|
|
|
|
|
|
|
++toktext; // skip the dash
|
|
|
|
|
|
|
|
while( *toktext )
|
|
|
|
*pin_id += *toktext++;
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
else // quoted string: "U12"-"14" or "U12"-14, 3 tokens in either case
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
*component_id = CurText();
|
2008-01-18 22:41:16 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
if( tok!=T_DASH )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( pin_def );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NextTok(); // accept anything after the dash.
|
|
|
|
*pin_id = CurText();
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::readTIME( time_t* time_stamp )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
struct tm mytime;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
static const char time_toks[] = "<month> <day> <hour> : <minute> : <second> <year>";
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
static const char* months[] = { // index 0 = Jan
|
2008-02-07 20:23:58 +00:00
|
|
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
2021-07-19 23:56:05 +00:00
|
|
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", nullptr
|
2008-01-23 22:38:16 +00:00
|
|
|
};
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL(); // month
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
const char* ptok = CurText();
|
2008-01-23 22:38:16 +00:00
|
|
|
|
2008-01-24 21:47:54 +00:00
|
|
|
mytime.tm_mon = 0; // remains if we don't find a month match.
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
for( int m = 0; months[m]; ++m )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
2016-08-16 08:27:09 +00:00
|
|
|
if( !strcasecmp( months[m], ptok ) )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
|
|
|
mytime.tm_mon = m;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok(); // day
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( time_toks );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
mytime.tm_mday = atoi( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok(); // hour
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( time_toks );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
mytime.tm_hour = atoi( CurText() );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
// : colon
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( *CurText() != ':' || strlen( CurText() )!=1 )
|
|
|
|
Expecting( time_toks );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok(); // minute
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( time_toks );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
mytime.tm_min = atoi( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
// : colon
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( *CurText() != ':' || strlen( CurText() )!=1 )
|
|
|
|
Expecting( time_toks );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok(); // second
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( time_toks );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
mytime.tm_sec = atoi( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok(); // year
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( time_toks );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
mytime.tm_year = atoi( CurText() ) - 1900;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
*time_stamp = mktime( &mytime );
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::LoadPCB( const wxString& aFilename )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
2016-06-01 12:22:05 +00:00
|
|
|
FILE_LINE_READER curr_reader( aFilename );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2016-06-01 12:22:05 +00:00
|
|
|
PushReader( &curr_reader );
|
2008-01-01 08:45:47 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_LEFT )
|
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_pcb )
|
|
|
|
Expecting( T_pcb );
|
2008-01-01 08:53:12 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
SetPCB( new PCB() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
doPCB( m_pcb );
|
2012-11-27 14:14:15 +00:00
|
|
|
PopReader();
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::LoadSESSION( const wxString& aFilename )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2016-06-01 12:22:05 +00:00
|
|
|
FILE_LINE_READER curr_reader( aFilename );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2016-06-01 12:22:05 +00:00
|
|
|
PushReader( &curr_reader );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_LEFT )
|
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_session )
|
|
|
|
Expecting( T_session );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
|
|
|
SetSESSION( new SESSION() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
doSESSION( m_session );
|
2010-10-05 07:15:29 +00:00
|
|
|
|
2012-11-27 14:14:15 +00:00
|
|
|
PopReader();
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPCB( PCB* growth )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
/* <design_descriptor >::=
|
|
|
|
(pcb <pcb_id >
|
|
|
|
[<parser_descriptor> ]
|
|
|
|
[<capacitance_resolution_descriptor> ]
|
|
|
|
[<conductance_resolution_descriptor> ]
|
|
|
|
[<current_resolution_descriptor> ]
|
|
|
|
[<inductance_resolution_descriptor> ]
|
|
|
|
[<resistance_resolution_descriptor> ]
|
|
|
|
[<resolution_descriptor> ]
|
|
|
|
[<time_resolution_descriptor> ]
|
|
|
|
[<voltage_resolution_descriptor> ]
|
|
|
|
[<unit_descriptor> ]
|
|
|
|
[<structure_descriptor> | <file_descriptor> ]
|
|
|
|
[<placement_descriptor> | <file_descriptor> ]
|
|
|
|
[<library_descriptor> | <file_descriptor> ]
|
|
|
|
[<floor_plan_descriptor> | <file_descriptor> ]
|
|
|
|
[<part_library_descriptor> | <file_descriptor> ]
|
|
|
|
[<network_descriptor> | <file_descriptor> ]
|
|
|
|
[<wiring_descriptor> ]
|
|
|
|
[<color_descriptor> ]
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->pcbname = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_parser:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->parser )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
growth->parser = new PARSER( growth );
|
|
|
|
doPARSER( growth->parser );
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_unit:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
2008-01-02 18:18:37 +00:00
|
|
|
doUNIT( growth->unit );
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_resolution:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->resolution )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->resolution = new UNIT_RES( growth, tok );
|
2008-01-02 18:18:37 +00:00
|
|
|
doRESOLUTION( growth->resolution );
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_structure:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->structure )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->structure = new STRUCTURE( growth );
|
|
|
|
doSTRUCTURE( growth->structure );
|
|
|
|
break;
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_placement:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->placement )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->placement = new PLACEMENT( growth );
|
|
|
|
doPLACEMENT( growth->placement );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_library:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->library )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->library = new LIBRARY( growth );
|
|
|
|
doLIBRARY( growth->library );
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
case T_network:
|
|
|
|
if( growth->network )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->network = new NETWORK( growth );
|
|
|
|
doNETWORK( growth->network );
|
|
|
|
break;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
case T_wiring:
|
|
|
|
if( growth->wiring )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->wiring = new WIRING( growth );
|
|
|
|
doWIRING( growth->wiring );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:53:12 +00:00
|
|
|
if( tok != T_EOF )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_EOF );
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPARSER( PARSER* growth )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-14 01:07:52 +00:00
|
|
|
std::string const1;
|
|
|
|
std::string const2;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
/* <parser_descriptor >::=
|
|
|
|
(parser
|
|
|
|
[(string_quote <quote_char >)]
|
|
|
|
(space_in_quoted_tokens [on | off])
|
|
|
|
[(host_cad <id >)]
|
|
|
|
[(host_version <id >)]
|
|
|
|
[{(constant <id > <id >)}]
|
|
|
|
[(write_resolution] {<character> <positive_integer >})]
|
|
|
|
[(routes_include {[testpoint | guides |
|
|
|
|
image_conductor]})]
|
|
|
|
[(wires_include testpoint)]
|
|
|
|
[(case_sensitive [on | off])]
|
|
|
|
[(via_rotate_first [on | off])]
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
2009-12-11 04:55:24 +00:00
|
|
|
case T_STRING_QUOTE:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok != T_QUOTE_DEF )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_QUOTE_DEF );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
SetStringDelimiter( (unsigned char) *CurText() );
|
|
|
|
growth->string_quote = *CurText();
|
2020-11-14 21:21:54 +00:00
|
|
|
m_quote_char = CurText();
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_space_in_quoted_tokens:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok!=T_on && tok!=T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
SetSpaceInQuotedTokens( tok==T_on );
|
2008-01-02 18:18:37 +00:00
|
|
|
growth->space_in_quoted_tokens = (tok==T_on);
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_host_cad:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->host_cad = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_host_version:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
growth->host_version = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_constant:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
const1 = CurText();
|
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
const2 = CurText();
|
|
|
|
NeedRIGHT();
|
2008-02-14 01:07:52 +00:00
|
|
|
growth->constants.push_back( const1 );
|
|
|
|
growth->constants.push_back( const2 );
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_write_resolution: // [(writee_resolution {<character> <positive_integer >})]
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
|
|
|
if( tok!=T_SYMBOL )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_SYMBOL );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok!=T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
// @todo
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
break;
|
2008-01-01 08:45:47 +00:00
|
|
|
|
|
|
|
case T_routes_include: // [(routes_include {[testpoint | guides | image_conductor]})]
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_testpoint:
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->routes_include_testpoint = true;
|
|
|
|
break;
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_guide:
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->routes_include_guides = true;
|
|
|
|
break;
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_image_conductor:
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->routes_include_image_conductor = true;
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "testpoint|guides|image_conductor" );
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
break;
|
2008-01-01 08:45:47 +00:00
|
|
|
|
|
|
|
case T_wires_include: // [(wires_include testpoint)]
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok != T_testpoint )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_testpoint );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->routes_include_testpoint = true;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
case T_case_sensitive:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok!=T_on && tok!=T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
growth->case_sensitive = (tok==T_on);
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_via_rotate_first: // [(via_rotate_first [on | off])]
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok!=T_on && tok!=T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->via_rotate_first = (tok==T_on);
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
2008-01-20 12:58:55 +00:00
|
|
|
|
|
|
|
case T_generated_by_freeroute:
|
|
|
|
growth->generated_by_freeroute = true;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-20 12:58:55 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doRESOLUTION( UNIT_RES* growth )
|
2008-01-01 08:45:47 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-01 08:45:47 +00:00
|
|
|
|
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_inch:
|
|
|
|
case T_mil:
|
|
|
|
case T_cm:
|
|
|
|
case T_mm:
|
|
|
|
case T_um:
|
2008-01-02 18:18:37 +00:00
|
|
|
growth->units = tok;
|
2008-01-01 08:45:47 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "inch|mil|cm|mm|um" );
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-01 08:45:47 +00:00
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_NUMBER );
|
2008-01-02 18:18:37 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->value = atoi( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-01 08:45:47 +00:00
|
|
|
}
|
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doUNIT( UNIT_RES* growth )
|
2008-01-02 18:18:37 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2007-12-22 07:18:20 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_inch:
|
|
|
|
case T_mil:
|
|
|
|
case T_cm:
|
|
|
|
case T_mm:
|
|
|
|
case T_um:
|
|
|
|
growth->units = tok;
|
|
|
|
break;
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "inch|mil|cm|mm|um" );
|
2008-01-02 18:18:37 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-02 18:18:37 +00:00
|
|
|
}
|
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSPECCTRA_LAYER_PAIR( SPECCTRA_LAYER_PAIR* growth )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->layer_id0 = CurText();
|
2008-01-06 01:24:36 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->layer_id1 = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->layer_weight = strtod( CurText(), 0 );
|
2008-01-06 01:24:36 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-16 00:04:48 +00:00
|
|
|
void SPECCTRA_DB::doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth )
|
2017-06-08 21:47:21 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_layer_pair )
|
|
|
|
Expecting( T_layer_pair );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2017-01-10 19:12:50 +00:00
|
|
|
SPECCTRA_LAYER_PAIR* layer_pair = new SPECCTRA_LAYER_PAIR( growth );
|
2008-01-06 01:24:36 +00:00
|
|
|
growth->layer_pairs.push_back( layer_pair );
|
2017-01-10 19:12:50 +00:00
|
|
|
doSPECCTRA_LAYER_PAIR( layer_pair );
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSTRUCTURE( STRUCTURE* growth )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unit:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
2008-01-03 06:33:28 +00:00
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_resolution:
|
2008-01-15 23:12:38 +00:00
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doRESOLUTION( growth->unit );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_layer_noise_weight:
|
2008-02-14 01:07:52 +00:00
|
|
|
if( growth->layer_noise_weight )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
growth->layer_noise_weight = new LAYER_NOISE_WEIGHT( growth );
|
|
|
|
doLAYER_NOISE_WEIGHT( growth->layer_noise_weight );
|
2008-02-07 20:23:58 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
case T_place_boundary:
|
2008-02-07 20:23:58 +00:00
|
|
|
L_place:
|
2008-01-03 06:33:28 +00:00
|
|
|
if( growth->place_boundary )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->place_boundary = new BOUNDARY( growth, T_place_boundary );
|
|
|
|
doBOUNDARY( growth->place_boundary );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
case T_boundary:
|
|
|
|
if( growth->boundary )
|
|
|
|
{
|
|
|
|
if( growth->place_boundary )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
goto L_place;
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->boundary = new BOUNDARY( growth );
|
|
|
|
doBOUNDARY( growth->boundary );
|
|
|
|
break;
|
2008-01-03 15:53:45 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
case T_plane:
|
2008-01-23 22:38:16 +00:00
|
|
|
COPPER_PLANE* plane;
|
|
|
|
plane = new COPPER_PLANE( growth );
|
2008-01-07 07:43:23 +00:00
|
|
|
growth->planes.push_back( plane );
|
|
|
|
doKEEPOUT( plane );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_region:
|
|
|
|
REGION* region;
|
|
|
|
region = new REGION( growth );
|
|
|
|
growth->regions.push_back( region );
|
|
|
|
doREGION( region );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
case T_snap_angle:
|
|
|
|
STRINGPROP* stringprop;
|
2008-02-07 20:23:58 +00:00
|
|
|
stringprop = new STRINGPROP( growth, T_snap_angle );
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->Append( stringprop );
|
2008-01-03 15:53:45 +00:00
|
|
|
doSTRINGPROP( stringprop );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_via:
|
2008-02-14 01:07:52 +00:00
|
|
|
if( growth->via )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
growth->via = new VIA( growth );
|
|
|
|
doVIA( growth->via );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
case T_control:
|
2008-02-14 01:07:52 +00:00
|
|
|
if( growth->control )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
growth->control = new CONTROL( growth );
|
|
|
|
doCONTROL( growth->control );
|
|
|
|
break;
|
2008-01-03 22:24:17 +00:00
|
|
|
|
|
|
|
case T_layer:
|
|
|
|
LAYER* layer;
|
|
|
|
layer = new LAYER( growth );
|
|
|
|
growth->layers.push_back( layer );
|
|
|
|
doLAYER( layer );
|
|
|
|
break;
|
2008-01-04 08:28:16 +00:00
|
|
|
|
|
|
|
case T_rule:
|
2008-02-14 01:07:52 +00:00
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
2008-01-04 08:28:16 +00:00
|
|
|
break;
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
case T_place_rule:
|
2008-02-14 01:07:52 +00:00
|
|
|
if( growth->place_rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->place_rules = new RULE( growth, T_place_rule );
|
|
|
|
doRULE( growth->place_rules );
|
2008-02-07 20:23:58 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
case T_keepout:
|
|
|
|
case T_place_keepout:
|
|
|
|
case T_via_keepout:
|
|
|
|
case T_wire_keepout:
|
|
|
|
case T_bend_keepout:
|
|
|
|
case T_elongate_keepout:
|
2008-01-06 01:24:36 +00:00
|
|
|
KEEPOUT* keepout;
|
|
|
|
keepout = new KEEPOUT( growth, tok );
|
|
|
|
growth->keepouts.push_back( keepout );
|
|
|
|
doKEEPOUT( keepout );
|
|
|
|
break;
|
2008-01-11 20:25:52 +00:00
|
|
|
|
|
|
|
case T_grid:
|
|
|
|
GRID* grid;
|
|
|
|
grid = new GRID( growth );
|
|
|
|
growth->grids.push_back( grid );
|
|
|
|
doGRID( grid );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSTRUCTURE_OUT( STRUCTURE_OUT* growth )
|
2009-07-13 22:59:56 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
<structure_out_descriptor >::=
|
|
|
|
(structure_out
|
|
|
|
{<layer_descriptor> }
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2009-07-13 22:59:56 +00:00
|
|
|
|
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2009-07-13 22:59:56 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2009-07-13 22:59:56 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_layer:
|
|
|
|
LAYER* layer;
|
|
|
|
layer = new LAYER( growth );
|
|
|
|
growth->layers.push_back( layer );
|
|
|
|
doLAYER( layer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2009-07-13 22:59:56 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2009-07-13 22:59:56 +00:00
|
|
|
}
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2009-07-13 22:59:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( IsSymbol(tok) )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->name = CurText();
|
|
|
|
tok = NextTok();
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
if( tok!=T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-06 01:24:36 +00:00
|
|
|
|
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok!=T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_sequence_number:
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->sequence_number = atoi( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_rule:
|
2008-01-11 20:25:52 +00:00
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_place_rule:
|
2008-01-11 20:25:52 +00:00
|
|
|
if( growth->place_rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->place_rules = new RULE( growth, T_place_rule );
|
|
|
|
doRULE( growth->place_rules );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_rect:
|
2008-01-30 19:16:46 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-30 19:16:46 +00:00
|
|
|
growth->shape = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( (RECTANGLE*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_circle:
|
2008-01-30 19:16:46 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-30 19:16:46 +00:00
|
|
|
growth->shape = new CIRCLE( growth );
|
|
|
|
doCIRCLE( (CIRCLE*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-02-01 01:09:39 +00:00
|
|
|
case T_polyline_path:
|
|
|
|
tok = T_path;
|
2020-04-24 23:44:09 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_path:
|
|
|
|
case T_polygon:
|
2008-01-30 19:16:46 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-30 19:16:46 +00:00
|
|
|
growth->shape = new PATH( growth, tok );
|
|
|
|
doPATH( (PATH*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_qarc:
|
2008-01-30 19:16:46 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-30 19:16:46 +00:00
|
|
|
growth->shape = new QARC( growth );
|
|
|
|
doQARC( (QARC*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_window:
|
|
|
|
WINDOW* window;
|
|
|
|
window = new WINDOW( growth );
|
|
|
|
growth->windows.push_back( window );
|
|
|
|
doWINDOW( window );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCONNECT( CONNECT* growth )
|
2012-01-16 21:43:07 +00:00
|
|
|
{
|
|
|
|
/* from page 143 of specctra spec:
|
|
|
|
|
|
|
|
(connect
|
|
|
|
{(terminal <object_type> [<pin_reference> ])}
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
|
|
|
T tok = NextTok();
|
|
|
|
|
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok!=T_LEFT )
|
|
|
|
Expecting( T_LEFT );
|
|
|
|
|
|
|
|
tok = NextTok();
|
|
|
|
|
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_terminal:
|
2021-07-19 23:56:05 +00:00
|
|
|
// since we do not use the terminal information, simply toss it.
|
2012-01-16 21:43:07 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
|
|
|
|
;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Unexpected( CurText() );
|
|
|
|
}
|
|
|
|
|
|
|
|
tok = NextTok();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doWINDOW( WINDOW* growth )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok!=T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_rect:
|
2008-01-29 16:45:14 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
growth->shape = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( (RECTANGLE*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_circle:
|
2008-01-29 16:45:14 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
growth->shape = new CIRCLE( growth );
|
|
|
|
doCIRCLE( (CIRCLE*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-02-01 01:09:39 +00:00
|
|
|
case T_polyline_path:
|
|
|
|
tok = T_path;
|
2020-04-24 23:44:09 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_path:
|
|
|
|
case T_polygon:
|
2008-01-29 16:45:14 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
growth->shape = new PATH( growth, tok );
|
|
|
|
doPATH( (PATH*) growth->shape );
|
2008-01-06 01:24:36 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
case T_qarc:
|
2008-01-29 16:45:14 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
growth->shape = new QARC( growth );
|
|
|
|
doQARC( (QARC*) growth->shape );
|
2008-01-05 17:24:56 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doBOUNDARY( BOUNDARY* growth )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( tok == T_rect )
|
|
|
|
{
|
2008-01-05 17:24:56 +00:00
|
|
|
if( growth->paths.size() )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( "rect when path already encountered" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->rectangle = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( growth->rectangle );
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
else if( tok == T_path )
|
|
|
|
{
|
2008-01-05 17:24:56 +00:00
|
|
|
if( growth->rectangle )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( "path when rect already encountered" );
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
for(;;)
|
|
|
|
{
|
|
|
|
if( tok != T_path )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_path );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
PATH* path = new PATH( growth, T_path );
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->paths.push_back( path );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
doPATH( path );
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-03 06:33:28 +00:00
|
|
|
if( tok == T_RIGHT )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting(T_LEFT);
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2021-07-19 23:56:05 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "rect|path" );
|
2021-07-19 23:56:05 +00:00
|
|
|
}
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPATH( PATH* growth )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2017-03-20 18:50:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2017-03-20 19:33:19 +00:00
|
|
|
if( !IsSymbol( tok ) && tok != T_NUMBER ) // a layer name can be like a number like +12
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "layer_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->layer_id = CurText();
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( "aperture_width" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
growth->aperture_width = strtod( CurText(), nullptr );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
|
|
|
POINT ptTemp;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if( tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
ptTemp.x = strtod( CurText(), nullptr );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
ptTemp.y = strtod( CurText(), nullptr );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
growth->points.push_back( ptTemp );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
} while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_aperture_type )
|
|
|
|
Expecting( T_aperture_type );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( tok!=T_round && tok!=T_square )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "round|square" );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
|
|
|
growth->aperture_type = tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doRECTANGLE( RECTANGLE* growth )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->layer_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
growth->point0.x = strtod( CurText(), nullptr );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
growth->point0.y = strtod( CurText(), nullptr );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
growth->point1.x = strtod( CurText(), nullptr );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
growth->point1.y = strtod( CurText(), nullptr );
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
2008-01-02 18:18:37 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCIRCLE( CIRCLE* growth )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2017-03-20 18:50:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->layer_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->diameter = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
if( tok == T_NUMBER )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex.x = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex.y = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2008-01-06 01:24:36 +00:00
|
|
|
if( tok != T_RIGHT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doQARC( QARC* growth )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->layer_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->aperture_width = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
for( int i = 0; i < 3; ++i )
|
2008-01-06 01:24:36 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex[i].x = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex[i].y = strtod( CurText(), 0 );
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-06 01:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSTRINGPROP( STRINGPROP* growth )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->value = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doTOKPROP( TOKPROP* growth )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
if( tok<0 )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-03 15:53:45 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->value = tok;
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doVIA( VIA* growth )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_spare )
|
|
|
|
Expecting( T_spare );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( T_SYMBOL );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->spares.push_back( CurText() );
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-19 20:46:07 +00:00
|
|
|
else if( IsSymbol( tok ) )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->padstacks.push_back( CurText() );
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
else
|
2021-07-19 23:56:05 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2021-07-19 23:56:05 +00:00
|
|
|
}
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCONTROL( CONTROL* growth )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
while( (tok = NextTok()) != T_RIGHT )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2008-01-03 22:24:17 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-03 22:24:17 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_via_at_smd:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
if( tok!=T_on && tok!=T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->via_at_smd = (tok==T_on);
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
case T_off_grid:
|
|
|
|
case T_route_to_fanout_only:
|
|
|
|
case T_force_to_terminal_point:
|
|
|
|
case T_same_net_checking:
|
|
|
|
case T_checking_trim_by_pin:
|
|
|
|
case T_noise_calculation:
|
|
|
|
case T_noise_accumulation:
|
|
|
|
case T_include_pins_in_crosstalk:
|
|
|
|
case T_bbv_ctr2ctr:
|
|
|
|
case T_average_pair_length:
|
|
|
|
case T_crosstalk_model:
|
|
|
|
case T_roundoff_rotation:
|
|
|
|
case T_microvia:
|
|
|
|
case T_reroute_order_viols:
|
|
|
|
TOKPROP* tokprop;
|
2017-06-08 21:47:21 +00:00
|
|
|
tokprop = new TOKPROP( growth, tok );
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->Append( tokprop );
|
|
|
|
doTOKPROP( tokprop );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-03 22:24:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPROPERTIES( PROPERTIES* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-15 23:12:38 +00:00
|
|
|
PROPERTY property; // construct it once here, append multiple times.
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
property.name = CurText();
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
property.value = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->push_back( property );
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doLAYER( LAYER* growth )
|
2008-01-03 22:24:17 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( T_SYMBOL );
|
2008-01-03 22:24:17 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->name = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-03 22:24:17 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-03 22:24:17 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
switch( tok )
|
2008-01-03 15:53:45 +00:00
|
|
|
{
|
2008-01-03 22:24:17 +00:00
|
|
|
case T_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "signal|power|mixed|jumper" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->layer_type = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok()!=T_RIGHT )
|
|
|
|
Expecting(T_RIGHT);
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_rule:
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
case T_property:
|
2008-01-15 23:12:38 +00:00
|
|
|
doPROPERTIES( &growth->properties );
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
case T_direction:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 15:53:45 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
2008-01-03 22:24:17 +00:00
|
|
|
case T_horizontal:
|
|
|
|
case T_vertical:
|
|
|
|
case T_orthogonal:
|
|
|
|
case T_positive_diagonal:
|
|
|
|
case T_negative_diagonal:
|
|
|
|
case T_diagonal:
|
|
|
|
case T_off:
|
|
|
|
growth->direction = tok;
|
2008-01-03 15:53:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
2008-01-23 22:38:16 +00:00
|
|
|
// the spec has an example show an abbreviation of the "horizontal" keyword. Ouch.
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !strcmp( "hori", CurText() ) )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
|
|
|
growth->direction = T_horizontal;
|
|
|
|
break;
|
|
|
|
}
|
2011-01-19 20:46:07 +00:00
|
|
|
else if( !strcmp( "vert", CurText() ) )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
|
|
|
growth->direction = T_vertical;
|
|
|
|
break;
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
Expecting( "horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
|
|
|
|
"diagonal|off" );
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( NextTok() != T_RIGHT )
|
|
|
|
Expecting( T_RIGHT );
|
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_cost:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_forbidden:
|
|
|
|
case T_high:
|
|
|
|
case T_medium:
|
|
|
|
case T_low:
|
|
|
|
case T_free:
|
|
|
|
growth->cost = tok;
|
|
|
|
break;
|
|
|
|
case T_NUMBER:
|
2008-02-07 20:23:58 +00:00
|
|
|
// store as negative so we can differentiate between
|
2011-01-19 20:46:07 +00:00
|
|
|
// T (positive) and T_NUMBER (negative)
|
|
|
|
growth->cost = -atoi( CurText() );
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "forbidden|high|medium|low|free|<positive_integer>|-1" );
|
2008-01-03 22:24:17 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_type )
|
|
|
|
Unexpected( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
if( tok!=T_length && tok!=T_way )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "length|way" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
growth->cost_type = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok()!=T_RIGHT )
|
2021-07-19 23:56:05 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-03 22:24:17 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_RIGHT )
|
|
|
|
Expecting( T_RIGHT );
|
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_use_net:
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-03 22:24:17 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_SYMBOL );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->use_net.push_back( CurText() );
|
2008-01-03 22:24:17 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 22:24:17 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-03 15:53:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doRULE( RULE* growth )
|
2008-01-04 08:28:16 +00:00
|
|
|
{
|
|
|
|
std::string builder;
|
|
|
|
int bracketNesting = 1; // we already saw the opening T_LEFT
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = T_NONE;
|
2008-01-04 08:28:16 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( bracketNesting != 0 && tok != T_EOF )
|
2008-01-04 08:28:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
if( tok==T_LEFT)
|
|
|
|
++bracketNesting;
|
|
|
|
else if( tok==T_RIGHT )
|
|
|
|
--bracketNesting;
|
|
|
|
|
2008-01-04 08:28:16 +00:00
|
|
|
if( bracketNesting >= 1 )
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
|
2008-01-04 08:28:16 +00:00
|
|
|
builder += ' ';
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_STRING )
|
2020-11-14 21:21:54 +00:00
|
|
|
builder += m_quote_char;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
builder += CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_STRING )
|
2020-11-14 21:21:54 +00:00
|
|
|
builder += m_quote_char;
|
2008-01-04 08:28:16 +00:00
|
|
|
}
|
2008-01-05 17:24:56 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
// When the nested rule is closed with a T_RIGHT and we are back down
|
2008-01-05 17:24:56 +00:00
|
|
|
// to bracketNesting == 1, (inside the <rule_descriptor> but outside
|
2008-01-14 22:50:08 +00:00
|
|
|
// the last rule). Then save the last rule and clear the string builder.
|
2008-01-04 08:28:16 +00:00
|
|
|
if( bracketNesting == 1 )
|
|
|
|
{
|
|
|
|
growth->rules.push_back( builder );
|
|
|
|
builder.clear();
|
|
|
|
}
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-05 17:24:56 +00:00
|
|
|
if( tok==T_EOF )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( T_EOF );
|
2008-01-04 08:28:16 +00:00
|
|
|
}
|
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
#if 0
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth, bool expect_object_type )
|
2008-01-14 22:50:08 +00:00
|
|
|
{
|
|
|
|
/* (place_rule [<structure_place_rule_object> ]
|
|
|
|
{[<spacing_descriptor> |
|
|
|
|
<permit_orient_descriptor> |
|
|
|
|
<permit_side_descriptor> |
|
|
|
|
<opposite_side_descriptor> ]}
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok == T_object_type )
|
2008-01-14 22:50:08 +00:00
|
|
|
{
|
|
|
|
if( !expect_object_type )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
/* [(object_type
|
|
|
|
[pcb |
|
|
|
|
image_set [large | small | discrete | capacitor | resistor]
|
|
|
|
[(image_type [smd | pin])]]
|
|
|
|
)]
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_pcb:
|
|
|
|
growth->object_type = tok;
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
case T_image_set:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_large:
|
|
|
|
case T_small:
|
|
|
|
case T_discrete:
|
|
|
|
case T_capacitor:
|
|
|
|
case T_resistor:
|
|
|
|
growth->object_type = tok;
|
|
|
|
break;
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( tok != T_image_type )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_image_type );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( tok!=T_smd && tok!=T_pin )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "smd|pin" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( tok != T_RIGHT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
/* {[<spacing_descriptor> |
|
|
|
|
<permit_orient_descriptor> |
|
2008-01-14 22:50:08 +00:00
|
|
|
<permit_side_descriptor> | <opposite_side_descriptor> ]}
|
|
|
|
*/
|
|
|
|
doRULE( growth );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doREGION( REGION* growth )
|
2008-01-07 07:43:23 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( IsSymbol( tok ) )
|
2008-01-07 07:43:23 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->region_id = CurText();
|
|
|
|
tok = NextTok();
|
2008-01-07 07:43:23 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
for(;;)
|
2008-01-07 07:43:23 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-07 07:43:23 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_rect:
|
2008-01-23 22:38:16 +00:00
|
|
|
if( growth->rectangle )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
growth->rectangle = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( growth->rectangle );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
case T_polygon:
|
2008-01-23 22:38:16 +00:00
|
|
|
if( growth->polygon )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
growth->polygon = new PATH( growth, T_polygon );
|
|
|
|
doPATH( growth->polygon );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
case T_region_net:
|
|
|
|
case T_region_class:
|
2008-01-11 20:25:52 +00:00
|
|
|
STRINGPROP* stringprop;
|
|
|
|
stringprop = new STRINGPROP( growth, tok );
|
|
|
|
growth->Append( stringprop );
|
|
|
|
doSTRINGPROP( stringprop );
|
2008-02-07 20:23:58 +00:00
|
|
|
break;
|
2008-01-07 07:43:23 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
case T_region_class_class:
|
|
|
|
CLASS_CLASS* class_class;
|
|
|
|
class_class = new CLASS_CLASS( growth, tok );
|
|
|
|
growth->Append( class_class );
|
2008-02-07 20:23:58 +00:00
|
|
|
doCLASS_CLASS( class_class );
|
2008-01-07 07:43:23 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
case T_rule:
|
2008-01-23 22:38:16 +00:00
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
2008-01-07 07:43:23 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-07 07:43:23 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-07 07:43:23 +00:00
|
|
|
}
|
2008-01-11 20:25:52 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
if( tok == T_RIGHT )
|
|
|
|
{
|
|
|
|
if( !growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_rule );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCLASS_CLASS( CLASS_CLASS* growth )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_classes:
|
|
|
|
if( growth->classes )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
growth->classes = new CLASSES( growth );
|
|
|
|
doCLASSES( growth->classes );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
case T_rule:
|
2008-01-14 22:50:08 +00:00
|
|
|
// only T_class_class takes a T_rule
|
2008-01-11 20:25:52 +00:00
|
|
|
if( growth->Type() == T_region_class_class )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
RULE* rule;
|
|
|
|
rule = new RULE( growth, T_rule );
|
2008-01-11 20:25:52 +00:00
|
|
|
growth->Append( rule );
|
2008-01-14 22:50:08 +00:00
|
|
|
doRULE( rule );
|
2008-01-11 20:25:52 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
case T_layer_rule:
|
2008-01-14 22:50:08 +00:00
|
|
|
// only T_class_class takes a T_layer_rule
|
2008-01-11 20:25:52 +00:00
|
|
|
if( growth->Type() == T_region_class_class )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
LAYER_RULE* layer_rule;
|
|
|
|
layer_rule = new LAYER_RULE( growth );
|
2008-01-11 20:25:52 +00:00
|
|
|
growth->Append( layer_rule );
|
2008-01-14 22:50:08 +00:00
|
|
|
doLAYER_RULE( layer_rule );
|
2008-01-11 20:25:52 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCLASSES( CLASSES* growth )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-11 20:25:52 +00:00
|
|
|
|
|
|
|
// require at least 2 class_ids
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( "class_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->class_ids.push_back( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
do
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( "class_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->class_ids.push_back( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
} while( ( tok = NextTok() ) != T_RIGHT );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doGRID( GRID* growth )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_via:
|
|
|
|
case T_wire:
|
|
|
|
case T_via_keepout:
|
|
|
|
case T_snap:
|
|
|
|
case T_place:
|
|
|
|
growth->grid_type = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->dimension = strtod( CurText(), 0 );
|
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_direction )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
|
|
|
if( growth->grid_type == T_place )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_x && tok != T_y )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
growth->direction = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_RIGHT )
|
|
|
|
Expecting(T_RIGHT);
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
else if( tok == T_offset )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
|
|
|
if( growth->grid_type == T_place )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->offset = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_RIGHT )
|
2021-07-19 23:56:05 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
else if( tok == T_image_type )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
|
|
|
if( growth->grid_type != T_place )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_smd && tok != T_pin )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
growth->image_type = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_RIGHT )
|
2021-07-19 23:56:05 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-11 20:25:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
2008-01-07 07:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doLAYER_RULE( LAYER_RULE* growth )
|
2008-01-14 22:50:08 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
do
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->layer_ids.push_back( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
} while( IsSymbol( tok = NextTok() ) );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_rule )
|
|
|
|
Expecting( T_rule );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
growth->rule = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rule );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPLACE( PLACE* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( "component_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->component_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
if( tok == T_NUMBER )
|
|
|
|
{
|
|
|
|
POINT point;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
point.x = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
point.y = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->SetVertex( point );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_front && tok != T_back )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "front|back" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->side = tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( "rotation" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
growth->SetRotation( strtod( CurText(), 0 ) );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2008-01-29 22:09:09 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_mirror:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->mirror = tok;
|
|
|
|
else
|
2021-07-19 23:56:05 +00:00
|
|
|
Expecting( "x|y|xy|off" );
|
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_status:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
if( tok==T_added || tok==T_deleted || tok==T_substituted )
|
|
|
|
growth->status = tok;
|
|
|
|
else
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting("added|deleted|substituted");
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_logical_part:
|
|
|
|
if( growth->logical_part.size() )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( "logical_part_id");
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->logical_part = CurText();
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_place_rule:
|
|
|
|
if( growth->place_rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->place_rules = new RULE( growth, T_place_rule );
|
|
|
|
doRULE( growth->place_rules );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_property:
|
|
|
|
if( growth->properties.size() )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
doPROPERTIES( &growth->properties );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_lock_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->lock_type = tok;
|
|
|
|
else
|
2021-07-19 23:56:05 +00:00
|
|
|
Expecting( "position|gate|subgate|pin" );
|
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_rule:
|
|
|
|
if( growth->rules || growth->region )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_region:
|
|
|
|
if( growth->rules || growth->region )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->region = new REGION( growth );
|
|
|
|
doREGION( growth->region );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_pn:
|
|
|
|
if( growth->part_number.size() )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
growth->part_number = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCOMPONENT( COMPONENT* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
|
|
|
Expecting( "image_id" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->image_id = CurText();
|
2008-01-15 23:12:38 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_place:
|
|
|
|
PLACE* place;
|
|
|
|
place = new PLACE( growth );
|
|
|
|
growth->places.push_back( place );
|
|
|
|
doPLACE( place );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
default:
|
2021-07-19 23:56:05 +00:00
|
|
|
Unexpected( tok );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2013-05-01 15:48:00 +00:00
|
|
|
if( tok == T_EOF )
|
|
|
|
Unexpected( T_EOF );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unit:
|
|
|
|
case T_resolution:
|
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok == T_resolution )
|
2013-05-01 15:48:00 +00:00
|
|
|
doRESOLUTION( growth->unit );
|
|
|
|
else
|
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
2008-01-15 23:12:38 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
case T_place_control:
|
|
|
|
NeedRIGHT();
|
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
if( tok != T_flip_style )
|
|
|
|
Expecting( T_flip_style );
|
2008-01-15 23:12:38 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok == T_mirror_first || tok == T_rotate_first )
|
2013-05-01 15:48:00 +00:00
|
|
|
growth->flip_style = tok;
|
|
|
|
else
|
|
|
|
Expecting( "mirror_first|rotate_first" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
NeedRIGHT();
|
|
|
|
NeedRIGHT();
|
|
|
|
break;
|
2008-01-15 23:12:38 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
case T_component:
|
|
|
|
COMPONENT* component;
|
|
|
|
component = new COMPONENT( growth );
|
|
|
|
growth->components.push_back( component );
|
|
|
|
doCOMPONENT( component );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2013-05-01 15:48:00 +00:00
|
|
|
default:
|
|
|
|
Unexpected( tok );
|
|
|
|
}
|
|
|
|
}
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* (padstack <padstack_id >
|
|
|
|
[<unit_descriptor> ]
|
|
|
|
{(shape <shape_descriptor>
|
|
|
|
[<reduced_shape_descriptor> ]
|
|
|
|
[(connect [on | off])]
|
|
|
|
[{<window_descriptor> }]
|
|
|
|
)}
|
|
|
|
[<attach_descriptor> ]
|
|
|
|
[{<pad_via_site_descriptor> }]
|
|
|
|
[(rotate [on | off])]
|
|
|
|
[(absolute [on | off])]
|
|
|
|
[(rule <clearance_descriptor> )])
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
// padstack_id may be a number
|
2021-07-19 23:56:05 +00:00
|
|
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "padstack_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->padstack_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unit:
|
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_rotate:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_on && tok != T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->rotate = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_absolute:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_on && tok != T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->absolute = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_shape:
|
|
|
|
SHAPE* shape;
|
|
|
|
shape = new SHAPE( growth );
|
|
|
|
growth->Append( shape );
|
|
|
|
doSHAPE( shape );
|
|
|
|
break;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
case T_attach:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_off && tok != T_on )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "off|on" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->attach = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_use_via )
|
|
|
|
Expecting( T_use_via );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->via_id = CurText();
|
2008-01-17 22:51:09 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
|
|
|
NeedRIGHT();
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
/*
|
|
|
|
case T_via_site: not supported
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
*/
|
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
case T_rule:
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSHAPE( SHAPE* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* (shape <shape_descriptor>
|
|
|
|
[<reduced_shape_descriptor> ]
|
|
|
|
[(connect [on | off])]
|
|
|
|
[{<window_descriptor> }])
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
2008-02-01 01:09:39 +00:00
|
|
|
case T_polyline_path:
|
|
|
|
tok = T_path;
|
2020-04-24 23:44:09 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
case T_rect:
|
|
|
|
case T_circle:
|
|
|
|
case T_path:
|
|
|
|
case T_polygon:
|
|
|
|
case T_qarc:
|
2008-02-07 20:23:58 +00:00
|
|
|
L_done_that:
|
2008-01-25 22:03:36 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
break;
|
2017-03-20 18:50:07 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
default:
|
|
|
|
// the example in the spec uses "circ" instead of "circle". Bad!
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !strcmp( "circ", CurText() ) )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
|
|
|
tok = T_circle;
|
|
|
|
goto L_done_that;
|
|
|
|
}
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_rect:
|
2008-01-25 22:03:36 +00:00
|
|
|
growth->shape = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( (RECTANGLE*) growth->shape );
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_circle:
|
2008-01-25 22:03:36 +00:00
|
|
|
growth->shape = new CIRCLE( growth );
|
|
|
|
doCIRCLE( (CIRCLE*)growth->shape );
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_path:
|
|
|
|
case T_polygon:
|
2008-01-25 22:03:36 +00:00
|
|
|
growth->shape = new PATH( growth, tok );
|
|
|
|
doPATH( (PATH*)growth->shape );
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_qarc:
|
2008-01-25 22:03:36 +00:00
|
|
|
growth->shape = new QARC( growth );
|
|
|
|
doQARC( (QARC*)growth->shape );
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_connect:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-15 23:12:38 +00:00
|
|
|
if( tok!=T_on && tok!=T_off )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "on|off" );
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->connect = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_window:
|
|
|
|
WINDOW* window;
|
|
|
|
window = new WINDOW( growth );
|
|
|
|
growth->windows.push_back( window );
|
|
|
|
doWINDOW( window );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doIMAGE( IMAGE* growth )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* <image_descriptor >::=
|
|
|
|
(image <image_id >
|
|
|
|
[(side [front | back | both])]
|
|
|
|
[<unit_descriptor> ]
|
|
|
|
[<outline_descriptor> ]
|
|
|
|
{(pin <padstack_id > [(rotate <rotation> )]
|
|
|
|
[<reference_descriptor> | <pin_array_descriptor> ]
|
|
|
|
[<user_property_descriptor> ])}
|
|
|
|
[{<conductor_shape_descriptor> }]
|
|
|
|
[{<conductor_via_descriptor> }]
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
[<place_rule_descriptor> ]
|
|
|
|
[{<keepout_descriptor> }]
|
|
|
|
[<image_property_descriptor> ]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
|
|
|
Expecting( "image_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->image_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unit:
|
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_side:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_front && tok != T_back && tok != T_both )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "front|back|both" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->side = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-16 23:08:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_outline:
|
|
|
|
SHAPE* outline;
|
|
|
|
outline = new SHAPE( growth, T_outline ); // use SHAPE for T_outline
|
|
|
|
growth->Append( outline );
|
|
|
|
doSHAPE( outline );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_pin:
|
|
|
|
PIN* pin;
|
|
|
|
pin = new PIN( growth );
|
|
|
|
growth->pins.push_back( pin );
|
|
|
|
doPIN( pin );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->rules = new RULE( growth, tok );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_place_rule:
|
|
|
|
if( growth->place_rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
growth->place_rules = new RULE( growth, tok );
|
|
|
|
doRULE( growth->place_rules );
|
|
|
|
break;
|
2008-01-23 22:38:16 +00:00
|
|
|
|
|
|
|
case T_keepout:
|
|
|
|
case T_place_keepout:
|
|
|
|
case T_via_keepout:
|
|
|
|
case T_wire_keepout:
|
|
|
|
case T_bend_keepout:
|
|
|
|
case T_elongate_keepout:
|
|
|
|
KEEPOUT* keepout;
|
|
|
|
keepout = new KEEPOUT( growth, tok );
|
|
|
|
growth->keepouts.push_back( keepout );
|
|
|
|
doKEEPOUT( keepout );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doPIN( PIN* growth )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* (pin <padstack_id > [(rotate <rotation> )]
|
|
|
|
[<reference_descriptor> | <pin_array_descriptor> ]
|
|
|
|
[<user_property_descriptor> ])
|
|
|
|
*/
|
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
// a padstack_id may be a number
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) && tok!=T_NUMBER )
|
|
|
|
Expecting( "padstack_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->padstack_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2008-02-14 01:07:52 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-02-14 01:07:52 +00:00
|
|
|
if( tok != T_rotate )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_rotate );
|
2008-01-16 23:08:22 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->SetRotation( strtod( CurText(), 0 ) );
|
|
|
|
NeedRIGHT();
|
2008-02-14 01:07:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
if( !IsSymbol( tok ) && tok != T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "pin_id" );
|
2008-01-16 23:08:22 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->pin_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex.x = strtod( CurText(), 0 );
|
2008-01-16 23:08:22 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->vertex.y = strtod( CurText(), 0 );
|
2008-02-14 01:07:52 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doLIBRARY( LIBRARY* growth )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* <library_descriptor >::=
|
|
|
|
(library
|
|
|
|
[<unit_descriptor> ]
|
|
|
|
{<image_descriptor> }
|
|
|
|
[{<jumper_descriptor> }]
|
|
|
|
{<padstack_descriptor> }
|
|
|
|
{<via_array_template_descriptor> }
|
|
|
|
[<directory_descriptor> ]
|
|
|
|
[<extra_image_directory_descriptor> ]
|
|
|
|
[{<family_family_descriptor> }]
|
|
|
|
[{<image_image_descriptor> }]
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unit:
|
2008-01-16 23:08:22 +00:00
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
case T_padstack:
|
|
|
|
PADSTACK* padstack;
|
2008-02-14 01:07:52 +00:00
|
|
|
padstack = new PADSTACK();
|
|
|
|
growth->AddPadstack( padstack );
|
2008-01-15 23:12:38 +00:00
|
|
|
doPADSTACK( padstack );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_image:
|
2008-01-16 23:08:22 +00:00
|
|
|
IMAGE* image;
|
|
|
|
image = new IMAGE( growth );
|
|
|
|
growth->images.push_back( image );
|
|
|
|
doIMAGE( image );
|
2008-01-15 23:12:38 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doNET( NET* growth )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok = NextTok();
|
2008-02-14 01:07:52 +00:00
|
|
|
PIN_REFS* pin_refs;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* <net_descriptor >::=
|
|
|
|
(net <net_id >
|
|
|
|
[(unassigned)]
|
|
|
|
[(net_number <integer >)]
|
|
|
|
[(pins {<pin_reference> }) | (order {<pin_reference> })]
|
|
|
|
[<component_order_descriptor> ]
|
|
|
|
[(type [fix | normal])]
|
|
|
|
[<user_property_descriptor> ]
|
|
|
|
[<circuit_descriptor> ]
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
[{<layer_rule_descriptor> }]
|
|
|
|
[<fromto_descriptor> ]
|
|
|
|
[(expose {<pin_reference> })]
|
|
|
|
[(noexpose {<pin_reference> })]
|
|
|
|
[(source {<pin_reference> })]
|
|
|
|
[(load {<pin_reference> })]
|
|
|
|
[(terminator {<pin_reference> })]
|
|
|
|
[(supply [power | ground])]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol( tok ) )
|
|
|
|
Expecting( "net_id" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_unassigned:
|
|
|
|
growth->unassigned = true;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-16 23:08:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_net_number:
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_number = atoi( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-16 23:08:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_pins:
|
|
|
|
case T_order:
|
|
|
|
growth->pins_type = tok;
|
2008-02-14 01:07:52 +00:00
|
|
|
pin_refs = &growth->pins;
|
|
|
|
goto L_pins;
|
|
|
|
|
|
|
|
case T_expose:
|
|
|
|
pin_refs = &growth->expose;
|
|
|
|
goto L_pins;
|
|
|
|
|
|
|
|
case T_noexpose:
|
|
|
|
pin_refs = &growth->noexpose;
|
|
|
|
goto L_pins;
|
|
|
|
|
|
|
|
case T_source:
|
|
|
|
pin_refs = &growth->source;
|
|
|
|
goto L_pins;
|
|
|
|
|
|
|
|
case T_load:
|
|
|
|
pin_refs = &growth->load;
|
|
|
|
goto L_pins;
|
|
|
|
|
|
|
|
case T_terminator:
|
|
|
|
pin_refs = &growth->terminator;
|
|
|
|
//goto L_pins;
|
|
|
|
|
|
|
|
L_pins:
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
|
|
|
PIN_REF empty( growth );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2008-02-07 20:23:58 +00:00
|
|
|
// copy the empty one, then fill its copy later thru pin_ref.
|
2008-02-14 01:07:52 +00:00
|
|
|
pin_refs->push_back( empty );
|
2008-01-18 22:41:16 +00:00
|
|
|
|
2008-02-14 01:07:52 +00:00
|
|
|
PIN_REF* pin_ref = &pin_refs->back();
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
break;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
case T_comp_order:
|
|
|
|
if( growth->comp_order )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->comp_order = new COMP_ORDER( growth );
|
|
|
|
doCOMP_ORDER( growth->comp_order );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
case T_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
if( tok!=T_fix && tok!=T_normal )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "fix|normal" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
growth->type = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-23 22:38:16 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
/* @todo
|
2008-01-23 22:38:16 +00:00
|
|
|
case T_circuit:
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
|
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_layer_rule:
|
|
|
|
LAYER_RULE* layer_rule;
|
|
|
|
layer_rule = new LAYER_RULE( growth );
|
|
|
|
growth->layer_rules.push_back( layer_rule );
|
|
|
|
doLAYER_RULE( layer_rule );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
case T_fromto:
|
|
|
|
FROMTO* fromto;
|
|
|
|
fromto = new FROMTO( growth );
|
|
|
|
growth->fromtos.push_back( fromto );
|
|
|
|
doFROMTO( fromto );
|
|
|
|
break;
|
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doTOPOLOGY( TOPOLOGY* growth )
|
2008-01-17 22:51:09 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-17 22:51:09 +00:00
|
|
|
|
|
|
|
/* <topology_descriptor >::=
|
|
|
|
(topology {[<fromto_descriptor> |
|
|
|
|
<component_order_descriptor> ]})
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-17 22:51:09 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_fromto:
|
|
|
|
FROMTO* fromto;
|
|
|
|
fromto = new FROMTO( growth );
|
|
|
|
growth->fromtos.push_back( fromto );
|
2008-01-18 22:41:16 +00:00
|
|
|
doFROMTO( fromto );
|
2008-01-17 22:51:09 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
case T_comp_order:
|
|
|
|
COMP_ORDER* comp_order;
|
|
|
|
comp_order = new COMP_ORDER( growth );
|
|
|
|
growth->comp_orders.push_back( comp_order );
|
2008-01-18 22:41:16 +00:00
|
|
|
doCOMP_ORDER( comp_order );
|
2008-01-17 22:51:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-17 22:51:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCLASS( CLASS* growth )
|
2008-01-17 22:51:09 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-17 22:51:09 +00:00
|
|
|
|
|
|
|
/* <class_descriptor >::=
|
|
|
|
(class
|
|
|
|
<class_id > {[{<net_id >} | {<composite_name_list> }]}
|
|
|
|
[<circuit_descriptor> ]
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
[{<layer_rule_descriptor> }]
|
|
|
|
[<topology_descriptor> ]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->class_id = CurText();
|
2008-01-17 22:51:09 +00:00
|
|
|
|
|
|
|
// do net_ids, do not support <composite_name_list>s at this time
|
2021-07-19 23:56:05 +00:00
|
|
|
while( IsSymbol( tok = NextTok() ) )
|
2008-01-17 22:51:09 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_ids.push_back( CurText() );
|
2008-01-17 22:51:09 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
case T_layer_rule:
|
|
|
|
LAYER_RULE* layer_rule;
|
|
|
|
layer_rule = new LAYER_RULE( growth );
|
|
|
|
growth->layer_rules.push_back( layer_rule );
|
|
|
|
doLAYER_RULE( layer_rule );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
case T_topology:
|
|
|
|
if( growth->topology )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
growth->topology = new TOPOLOGY( growth );
|
|
|
|
doTOPOLOGY( growth->topology );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-02-29 06:49:34 +00:00
|
|
|
case T_circuit: // handle all the circuit_descriptor here as strings
|
2021-07-19 23:56:05 +00:00
|
|
|
{
|
|
|
|
std::string builder;
|
|
|
|
int bracketNesting = 1; // we already saw the opening T_LEFT
|
|
|
|
tok = T_NONE;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( bracketNesting != 0 && tok != T_EOF )
|
|
|
|
{
|
|
|
|
tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_LEFT )
|
|
|
|
++bracketNesting;
|
|
|
|
else if( tok == T_RIGHT )
|
|
|
|
--bracketNesting;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( bracketNesting >= 1 )
|
|
|
|
{
|
|
|
|
T previousTok = (T) PrevTok();
|
2009-12-11 04:55:24 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
|
|
|
|
builder += ' ';
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_STRING )
|
|
|
|
builder += m_quote_char;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
builder += CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
if( tok == T_STRING )
|
|
|
|
builder += m_quote_char;
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
// When the nested rule is closed with a T_RIGHT and we are back down
|
|
|
|
// to bracketNesting == 0, then save the builder and break;
|
|
|
|
if( bracketNesting == 0 )
|
|
|
|
{
|
|
|
|
growth->circuit.push_back( builder );
|
|
|
|
break;
|
2008-01-17 22:51:09 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( tok == T_EOF )
|
|
|
|
Unexpected( T_EOF );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-02-29 06:49:34 +00:00
|
|
|
break;
|
2021-07-19 23:56:05 +00:00
|
|
|
} // scope bracket
|
2008-02-29 06:49:34 +00:00
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-17 22:51:09 +00:00
|
|
|
} // switch
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
} // while
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doNETWORK( NETWORK* growth )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
/* <network_descriptor >::=
|
|
|
|
(network
|
|
|
|
{<net_descriptor>}
|
|
|
|
[{<class_descriptor> }]
|
|
|
|
[{<class_class_descriptor> }]
|
|
|
|
[{<group_descriptor> }]
|
|
|
|
[{<group_set_descriptor> }]
|
|
|
|
[{<pair_descriptor> }]
|
|
|
|
[{<bundle_descriptor> }]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-16 23:08:22 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-16 23:08:22 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_net:
|
|
|
|
NET* net;
|
|
|
|
net = new NET( growth );
|
|
|
|
growth->nets.push_back( net );
|
|
|
|
doNET( net );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-17 22:51:09 +00:00
|
|
|
case T_class:
|
|
|
|
CLASS* myclass;
|
|
|
|
myclass = new CLASS( growth );
|
|
|
|
growth->classes.push_back( myclass );
|
|
|
|
doCLASS( myclass );
|
|
|
|
break;
|
2008-01-16 23:08:22 +00:00
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-16 23:08:22 +00:00
|
|
|
}
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doCOMP_ORDER( COMP_ORDER* growth )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
/* <component_order_descriptor >::=
|
|
|
|
(comp_order {<placement_id> })
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( IsSymbol( tok = NextTok() ) )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->placement_ids.push_back( CurText() );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
if( tok != T_RIGHT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_RIGHT );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doFROMTO( FROMTO* growth )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
/* <fromto_descriptor >::=
|
|
|
|
{(fromto
|
|
|
|
[<pin_reference> | <virtual_pin_descriptor> ] | <component_id >]
|
|
|
|
[<pin_reference> | <virtual_pin_descriptor> | <component_id >]
|
|
|
|
[(type [fix | normal | soft])]
|
|
|
|
[(net <net_id >)]
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
[<circuit_descriptor> ]
|
|
|
|
[{<layer_rule_descriptor> }]
|
|
|
|
)}
|
|
|
|
*/
|
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
// read the first two grammar items in as 2 single tokens, i.e. do not
|
|
|
|
// split apart the <pin_reference>s into 3 separate tokens. Do this by
|
|
|
|
// turning off the string delimiter in the lexer.
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-30 19:26:03 +00:00
|
|
|
char old = SetStringDelimiter( 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol(NextTok() ) )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
SetStringDelimiter( old );
|
|
|
|
Expecting( T_SYMBOL );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->fromText = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( !IsSymbol(NextTok() ) )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
SetStringDelimiter( old );
|
|
|
|
Expecting( T_SYMBOL );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->toText = CurText();
|
2008-01-18 22:41:16 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
SetStringDelimiter( old );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_fix && tok != T_normal && tok != T_soft )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "fix|normal|soft" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->fromto_type = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->rules = new RULE( growth, T_rule );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_layer_rule:
|
|
|
|
LAYER_RULE* layer_rule;
|
|
|
|
layer_rule = new LAYER_RULE( growth );
|
|
|
|
growth->layer_rules.push_back( layer_rule );
|
|
|
|
doLAYER_RULE( layer_rule );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_net:
|
|
|
|
if( growth->net_id.size() )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->net_id = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
// circuit descriptor not supported at this time
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doWIRE( WIRE* growth )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
/* <wire_shape_descriptor >::=
|
|
|
|
(wire
|
|
|
|
<shape_descriptor>
|
|
|
|
[(net <net_id >)]
|
|
|
|
[(turret <turret#> )]
|
|
|
|
[(type [fix | route | normal | protect])]
|
|
|
|
[(attr [test | fanout | bus | jumper])]
|
|
|
|
[(shield <net_id >)]
|
|
|
|
[{<window_descriptor> }]
|
|
|
|
[(connect
|
|
|
|
(terminal <object_type> [<pin_reference> ])
|
|
|
|
(terminal <object_type> [<pin_reference> ])
|
|
|
|
)]
|
|
|
|
[(supply)]
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-18 22:41:16 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_rect:
|
2008-01-31 01:30:52 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-31 01:30:52 +00:00
|
|
|
growth->shape = new RECTANGLE( growth );
|
|
|
|
doRECTANGLE( (RECTANGLE*) growth->shape );
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_circle:
|
2008-01-31 01:30:52 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-31 01:30:52 +00:00
|
|
|
growth->shape = new CIRCLE( growth );
|
|
|
|
doCIRCLE( (CIRCLE*) growth->shape );
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-01 01:09:39 +00:00
|
|
|
|
|
|
|
case T_polyline_path:
|
|
|
|
tok = T_path;
|
2020-04-24 23:44:09 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_path:
|
|
|
|
case T_polygon:
|
2008-01-31 01:30:52 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-31 01:30:52 +00:00
|
|
|
growth->shape = new PATH( growth, tok );
|
|
|
|
doPATH( (PATH*) growth->shape );
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_qarc:
|
2008-01-31 01:30:52 +00:00
|
|
|
if( growth->shape )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-31 01:30:52 +00:00
|
|
|
growth->shape = new QARC( growth );
|
|
|
|
doQARC( (QARC*) growth->shape );
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_net:
|
2017-03-20 18:50:07 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_id = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_turret:
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->turret = atoi( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "fix|route|normal|protect" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-02-01 01:09:39 +00:00
|
|
|
growth->wire_type = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_attr:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "test|fanout|bus|jumper" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->attr = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_shield:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->shield = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_window:
|
|
|
|
WINDOW* window;
|
|
|
|
window = new WINDOW( growth );
|
|
|
|
growth->windows.push_back( window );
|
|
|
|
doWINDOW( window );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_connect:
|
|
|
|
if( growth->connect )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
growth->connect = new CONNECT( growth );
|
|
|
|
doCONNECT( growth->connect );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_supply:
|
|
|
|
growth->supply = true;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-18 22:41:16 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doWIRE_VIA( WIRE_VIA* growth )
|
2008-01-19 06:56:48 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-19 06:56:48 +00:00
|
|
|
POINT point;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
/* <wire_via_descriptor >::=
|
|
|
|
(via
|
|
|
|
<padstack_id > {<vertex> }
|
|
|
|
[(net <net_id >)]
|
|
|
|
[(via_number <via#> )]
|
|
|
|
[(type [fix | route | normal | protect])]
|
|
|
|
[(attr [test | fanout | jumper |
|
|
|
|
virtual_pin <virtual_pin_name> ])]
|
|
|
|
[(contact {<layer_id >})]
|
|
|
|
[(supply)]
|
|
|
|
)
|
|
|
|
(virtual_pin
|
|
|
|
<virtual_pin_name> <vertex> (net <net_id >)
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->padstack_id = CurText();
|
2008-01-19 06:56:48 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) == T_NUMBER )
|
2008-01-19 06:56:48 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
point.x = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( "vertex.y" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
point.y = strtod( CurText(), 0 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
growth->vertexes.push_back( point );
|
|
|
|
}
|
|
|
|
|
|
|
|
while( tok != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_net:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->net_id = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
case T_via_number:
|
2011-01-19 20:46:07 +00:00
|
|
|
if( NextTok() != T_NUMBER )
|
|
|
|
Expecting( "<via#>" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->via_number = atoi( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
case T_type:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "fix|route|normal|protect" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-02-01 01:09:39 +00:00
|
|
|
growth->via_type = tok;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
case T_attr:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( "test|fanout|jumper|virtual_pin" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
growth->attr = tok;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
if( tok == T_virtual_pin )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->virtual_pin_name = CurText();
|
2008-01-19 06:56:48 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
case T_contact:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
2008-01-19 06:56:48 +00:00
|
|
|
tok = T_SYMBOL;
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
while( IsSymbol( tok ) )
|
2008-01-19 06:56:48 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->contact_layers.push_back( CurText() );
|
|
|
|
tok = NextTok();
|
2008-01-19 06:56:48 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
if( tok != T_RIGHT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_RIGHT );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
case T_supply:
|
|
|
|
growth->supply = true;
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-19 06:56:48 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-19 06:56:48 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-19 06:56:48 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2008-01-19 06:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doWIRING( WIRING* growth )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-18 22:41:16 +00:00
|
|
|
|
|
|
|
/* <wiring_descriptor >::=
|
|
|
|
(wiring
|
|
|
|
[<unit_descriptor> | <resolution_descriptor> | null]
|
|
|
|
{<wire_descriptor> }
|
|
|
|
[<test_points_descriptor> ]
|
|
|
|
{[<supply_pin_descriptor> ]}
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-18 22:41:16 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
2008-01-23 22:38:16 +00:00
|
|
|
case T_unit:
|
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doUNIT( growth->unit );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
case T_resolution:
|
|
|
|
if( growth->unit )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
growth->unit = new UNIT_RES( growth, tok );
|
|
|
|
doRESOLUTION( growth->unit );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
case T_wire:
|
|
|
|
WIRE* wire;
|
|
|
|
wire = new WIRE( growth );
|
|
|
|
growth->wires.push_back( wire );
|
|
|
|
doWIRE( wire );
|
|
|
|
break;
|
2008-01-19 06:56:48 +00:00
|
|
|
|
|
|
|
case T_via:
|
|
|
|
WIRE_VIA* wire_via;
|
|
|
|
wire_via = new WIRE_VIA( growth );
|
|
|
|
growth->wire_vias.push_back( wire_via );
|
|
|
|
doWIRE_VIA( wire_via );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-18 22:41:16 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-18 22:41:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doANCESTOR( ANCESTOR* growth )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-20 00:34:21 +00:00
|
|
|
|
|
|
|
/* <ancestor_file_descriptor >::=
|
|
|
|
(ancestor <file_path_name> (created_time <time_stamp> )
|
|
|
|
[(comment <comment_string> )])
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->filename = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_created_time:
|
|
|
|
readTIME( &growth->time_stamp );
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_comment:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->comment = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doHISTORY( HISTORY* growth )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-20 00:34:21 +00:00
|
|
|
|
|
|
|
/* <history_descriptor >::=
|
|
|
|
(history [{<ancestor_file_descriptor> }] <self_descriptor> )
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_ancestor:
|
|
|
|
ANCESTOR* ancestor;
|
|
|
|
ancestor = new ANCESTOR( growth );
|
|
|
|
growth->ancestors.push_back( ancestor );
|
|
|
|
doANCESTOR( ancestor );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_self:
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_created_time:
|
|
|
|
readTIME( &growth->time_stamp );
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_comment:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->comments.push_back( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSESSION( SESSION* growth )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-20 00:34:21 +00:00
|
|
|
|
|
|
|
/* <session_file_descriptor >::=
|
|
|
|
(session <session_id >
|
|
|
|
(base_design <path/filename >)
|
|
|
|
[<history_descriptor> ]
|
|
|
|
[<session_structure_descriptor> ]
|
|
|
|
[<placement_descriptor> ]
|
|
|
|
[<floor_plan_descriptor> ]
|
|
|
|
[<net_pin_changes_descriptor> ]
|
|
|
|
[<was_is_descriptor> ]
|
|
|
|
<swap_history_descriptor> ]
|
|
|
|
[<route_descriptor> ]
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->session_id = CurText();
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_base_design:
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->base_design = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-20 00:34:21 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_history:
|
|
|
|
if( growth->history )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
growth->history = new HISTORY( growth );
|
|
|
|
doHISTORY( growth->history );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_structure:
|
|
|
|
if( growth->structure )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
growth->structure = new STRUCTURE( growth );
|
|
|
|
doSTRUCTURE( growth->structure );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
case T_placement:
|
|
|
|
if( growth->placement )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
growth->placement = new PLACEMENT( growth );
|
|
|
|
doPLACEMENT( growth->placement );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
case T_was_is:
|
|
|
|
if( growth->was_is )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
growth->was_is = new WAS_IS( growth );
|
|
|
|
doWAS_IS( growth->was_is );
|
|
|
|
break;
|
2008-01-20 00:34:21 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
case T_routes:
|
2008-01-20 00:34:21 +00:00
|
|
|
if( growth->route )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
growth->route = new ROUTE( growth );
|
|
|
|
doROUTE( growth->route );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 12:58:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doWAS_IS( WAS_IS* growth )
|
2008-01-20 12:58:55 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-20 12:58:55 +00:00
|
|
|
PIN_PAIR empty( growth );
|
|
|
|
PIN_PAIR* pin_pair;
|
|
|
|
|
|
|
|
/* <was_is_descriptor >::=
|
|
|
|
(was_is {(pins <pin_reference> <pin_reference> )})
|
|
|
|
*/
|
|
|
|
|
|
|
|
// none of the pins is ok too
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 12:58:55 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_pins:
|
2008-02-07 20:23:58 +00:00
|
|
|
// copy the empty one, then fill its copy later thru pin_pair.
|
2008-01-20 12:58:55 +00:00
|
|
|
growth->pin_pairs.push_back( empty );
|
|
|
|
pin_pair= &growth->pin_pairs.back();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
|
2008-01-20 12:58:55 +00:00
|
|
|
readCOMPnPIN( &pin_pair->was.component_id, &pin_pair->was.pin_id );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
|
2008-01-20 12:58:55 +00:00
|
|
|
readCOMPnPIN( &pin_pair->is.component_id, &pin_pair->is.pin_id );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedRIGHT();
|
2008-01-20 12:58:55 +00:00
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 12:58:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doROUTE( ROUTE* growth )
|
2008-01-20 12:58:55 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-20 12:58:55 +00:00
|
|
|
|
|
|
|
/* <route_descriptor >::=
|
|
|
|
(routes
|
|
|
|
<resolution_descriptor>
|
|
|
|
<parser_descriptor>
|
|
|
|
<structure_out_descriptor>
|
|
|
|
<library_out_descriptor>
|
|
|
|
<network_out_descriptor>
|
|
|
|
<test_points_descriptor>
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-20 12:58:55 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_resolution:
|
|
|
|
if( growth->resolution )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
growth->resolution = new UNIT_RES( growth, tok );
|
|
|
|
doRESOLUTION( growth->resolution );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_parser:
|
|
|
|
if( growth->parser )
|
2012-01-16 21:43:07 +00:00
|
|
|
{
|
|
|
|
#if 0 // Electra 2.9.1 emits two (parser ) elements in a row.
|
|
|
|
// Work around their bug for now.
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2012-01-16 21:43:07 +00:00
|
|
|
#else
|
|
|
|
delete growth->parser;
|
|
|
|
#endif
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-20 12:58:55 +00:00
|
|
|
growth->parser = new PARSER( growth );
|
|
|
|
doPARSER( growth->parser );
|
|
|
|
break;
|
|
|
|
|
2009-07-13 22:59:56 +00:00
|
|
|
case T_structure_out:
|
|
|
|
if( growth->structure_out )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2009-07-13 22:59:56 +00:00
|
|
|
growth->structure_out = new STRUCTURE_OUT( growth );
|
|
|
|
doSTRUCTURE_OUT( growth->structure_out );
|
2008-01-20 12:58:55 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
case T_library_out:
|
2008-01-20 12:58:55 +00:00
|
|
|
if( growth->library )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-23 22:38:16 +00:00
|
|
|
growth->library = new LIBRARY( growth, tok );
|
2008-01-20 12:58:55 +00:00
|
|
|
doLIBRARY( growth->library );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
case T_network_out:
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
if( tok != T_net ) // it is class NET_OUT, but token T_net
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
NET_OUT* net_out;
|
|
|
|
net_out = new NET_OUT( growth );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
growth->net_outs.push_back( net_out );
|
|
|
|
doNET_OUT( net_out );
|
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-21 20:54:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doNET_OUT( NET_OUT* growth )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-21 20:54:19 +00:00
|
|
|
|
|
|
|
/* <net_out_descriptor >::=
|
|
|
|
(net <net_id >
|
|
|
|
[(net_number <integer >)]
|
|
|
|
[<rule_descriptor> ]
|
|
|
|
{[<wire_shape_descriptor> | <wire_guide_descriptor> |
|
|
|
|
<wire_via_descriptor> | <bond_shape_descriptor> ]}
|
|
|
|
{[<supply_pin_descriptor> ]}
|
|
|
|
)
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-03-02 07:22:20 +00:00
|
|
|
NeedSYMBOLorNUMBER();
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
|
|
|
if( tok != T_LEFT )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_LEFT );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
switch( tok )
|
|
|
|
{
|
|
|
|
case T_net_number:
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
if( tok!= T_NUMBER )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_NUMBER );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_number = atoi( CurText() );
|
|
|
|
NeedRIGHT();
|
2008-01-21 20:54:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case T_rule:
|
|
|
|
if( growth->rules )
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( tok );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
growth->rules = new RULE( growth, tok );
|
|
|
|
doRULE( growth->rules );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_wire:
|
|
|
|
WIRE* wire;
|
|
|
|
wire = new WIRE( growth );
|
|
|
|
growth->wires.push_back( wire );
|
|
|
|
doWIRE( wire );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_via:
|
|
|
|
WIRE_VIA* wire_via;
|
|
|
|
wire_via = new WIRE_VIA( growth );
|
|
|
|
growth->wire_vias.push_back( wire_via );
|
|
|
|
doWIRE_VIA( wire_via );
|
|
|
|
break;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
case T_supply_pin:
|
|
|
|
SUPPLY_PIN* supply_pin;
|
|
|
|
supply_pin = new SUPPLY_PIN( growth );
|
|
|
|
growth->supply_pins.push_back( supply_pin );
|
|
|
|
doSUPPLY_PIN( supply_pin );
|
2008-01-20 12:58:55 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-20 00:34:21 +00:00
|
|
|
default:
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void SPECCTRA_DB::doSUPPLY_PIN( SUPPLY_PIN* growth )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
T tok;
|
2008-01-21 20:54:19 +00:00
|
|
|
PIN_REF empty(growth);
|
|
|
|
|
|
|
|
/* <supply_pin_descriptor >::=
|
|
|
|
(supply_pin {<pin_reference> } [(net <net_id >)])
|
|
|
|
*/
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
NeedSYMBOL();
|
|
|
|
growth->net_id = CurText();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
while( ( tok = NextTok() ) != T_RIGHT )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
if( IsSymbol(tok) )
|
2008-01-21 20:54:19 +00:00
|
|
|
{
|
|
|
|
growth->pin_refs.push_back( empty );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
PIN_REF* pin_ref = &growth->pin_refs.back();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
|
|
|
|
}
|
|
|
|
else if( tok == T_LEFT )
|
|
|
|
{
|
2011-01-19 20:46:07 +00:00
|
|
|
tok = NextTok();
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
if( tok != T_net )
|
2011-01-19 20:46:07 +00:00
|
|
|
Expecting( T_net );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
growth->net_id = CurText();
|
|
|
|
NeedRIGHT();
|
2008-01-21 20:54:19 +00:00
|
|
|
}
|
|
|
|
else
|
2011-01-19 20:46:07 +00:00
|
|
|
Unexpected( CurText() );
|
2008-01-21 20:54:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
void SPECCTRA_DB::ExportPCB( const wxString& aFilename, bool aNameChange )
|
2007-12-22 07:18:20 +00:00
|
|
|
{
|
2020-11-14 21:21:54 +00:00
|
|
|
if( m_pcb )
|
2009-04-16 15:50:55 +00:00
|
|
|
{
|
2020-11-14 21:21:54 +00:00
|
|
|
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] );
|
2008-01-22 20:48:02 +00:00
|
|
|
|
|
|
|
if( aNameChange )
|
2020-11-14 21:21:54 +00:00
|
|
|
m_pcb->pcbname = TO_UTF8( aFilename );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
m_pcb->Format( &formatter, 0 );
|
2008-01-22 20:48:02 +00:00
|
|
|
}
|
2008-01-20 00:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
void SPECCTRA_DB::ExportSESSION( const wxString& aFilename )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2020-11-14 21:21:54 +00:00
|
|
|
if( m_session )
|
2008-01-20 00:34:21 +00:00
|
|
|
{
|
2020-11-14 21:21:54 +00:00
|
|
|
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] );
|
2010-08-08 00:31:07 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
m_session->Format( &formatter, 0 );
|
2010-08-08 00:31:07 +00:00
|
|
|
}
|
2008-01-02 18:18:37 +00:00
|
|
|
}
|
|
|
|
|
2007-12-23 06:10:51 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
PCB* SPECCTRA_DB::MakePCB()
|
2007-12-22 07:18:20 +00:00
|
|
|
{
|
2008-01-02 18:18:37 +00:00
|
|
|
PCB* pcb = new PCB();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-02 18:18:37 +00:00
|
|
|
pcb->parser = new PARSER( pcb );
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->resolution = new UNIT_RES( pcb, T_resolution );
|
|
|
|
pcb->unit = new UNIT_RES( pcb, T_unit );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->structure = new STRUCTURE( pcb );
|
2008-01-22 20:48:02 +00:00
|
|
|
pcb->structure->boundary = new BOUNDARY( pcb->structure );
|
2008-01-29 16:45:14 +00:00
|
|
|
pcb->structure->via = new VIA( pcb->structure );
|
|
|
|
pcb->structure->rules = new RULE( pcb->structure, T_rule );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->placement = new PLACEMENT( pcb );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->library = new LIBRARY( pcb );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->network = new NETWORK( pcb );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-21 22:16:45 +00:00
|
|
|
pcb->wiring = new WIRING( pcb );
|
2008-01-02 18:18:37 +00:00
|
|
|
|
|
|
|
return pcb;
|
2007-12-22 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
//-----<ELEM>---------------------------------------------------------------
|
|
|
|
|
2011-01-19 20:46:07 +00:00
|
|
|
ELEM::ELEM( T aType, ELEM* aParent ) :
|
2008-01-03 06:33:28 +00:00
|
|
|
type( aType ),
|
|
|
|
parent( aParent )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ELEM::~ELEM()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-12-11 04:55:24 +00:00
|
|
|
const char* ELEM::Name() const
|
|
|
|
{
|
|
|
|
return SPECCTRA_DB::TokenName( type );
|
|
|
|
}
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
UNIT_RES* ELEM::GetUnits() const
|
|
|
|
{
|
|
|
|
if( parent )
|
|
|
|
return parent->GetUnits();
|
|
|
|
|
|
|
|
return &UNIT_RES::Default;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void ELEM::Format( OUTPUTFORMATTER* out, int nestLevel )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2009-12-11 04:55:24 +00:00
|
|
|
out->Print( nestLevel, "(%s\n", Name() );
|
2008-01-11 20:25:52 +00:00
|
|
|
|
|
|
|
FormatContents( out, nestLevel+1 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
|
|
|
out->Print( nestLevel, ")\n" );
|
2008-01-11 20:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void ELEM_HOLDER::FormatContents( OUTPUTFORMATTER* out, int nestLevel )
|
2008-01-11 20:25:52 +00:00
|
|
|
{
|
2021-03-04 21:15:00 +00:00
|
|
|
for( int i = 0; i < Length(); ++i )
|
2008-01-11 20:25:52 +00:00
|
|
|
At(i)->Format( out, nestLevel );
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-04 21:15:00 +00:00
|
|
|
int ELEM_HOLDER::FindElem( T aType, int instanceNum )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
|
|
|
int repeats=0;
|
2021-03-04 21:15:00 +00:00
|
|
|
|
|
|
|
for( unsigned i = 0; i < kids.size(); ++i )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
|
|
|
if( kids[i].Type() == aType )
|
|
|
|
{
|
|
|
|
if( repeats == instanceNum )
|
|
|
|
return i;
|
2021-03-04 21:15:00 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
++repeats;
|
|
|
|
}
|
|
|
|
}
|
2021-03-04 21:15:00 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2008-02-14 01:07:52 +00:00
|
|
|
|
|
|
|
// a reasonably small memory price to pay for improved performance
|
2010-08-09 02:03:16 +00:00
|
|
|
STRING_FORMATTER ELEM::sf;
|
2008-02-14 01:07:52 +00:00
|
|
|
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
UNIT_RES UNIT_RES::Default( nullptr, T_resolution );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs )
|
|
|
|
{
|
|
|
|
if( !lhs->hash.size() )
|
|
|
|
lhs->hash = lhs->makeHash();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
if( !rhs->hash.size() )
|
|
|
|
rhs->hash = rhs->makeHash();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
int result = lhs->hash.compare( rhs->hash );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-10-30 18:53:39 +00:00
|
|
|
if( result )
|
|
|
|
return result;
|
|
|
|
|
|
|
|
// Via names hold the drill diameters, so we have to include those to discern
|
|
|
|
// between two vias with same copper size but with different drill sizes.
|
|
|
|
result = lhs->padstack_id.compare( rhs->padstack_id );
|
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int IMAGE::Compare( IMAGE* lhs, IMAGE* rhs )
|
|
|
|
{
|
|
|
|
if( !lhs->hash.size() )
|
|
|
|
lhs->hash = lhs->makeHash();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
if( !rhs->hash.size() )
|
|
|
|
rhs->hash = rhs->makeHash();
|
2008-01-03 06:33:28 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
int result = lhs->hash.compare( rhs->hash );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 16:45:14 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
/*
|
|
|
|
int COMPONENT::Compare( COMPONENT* lhs, COMPONENT* rhs )
|
|
|
|
{
|
|
|
|
if( !lhs->hash.size() )
|
|
|
|
lhs->hash = lhs->makeHash();
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
if( !rhs->hash.size() )
|
|
|
|
rhs->hash = rhs->makeHash();
|
|
|
|
|
|
|
|
int result = lhs->hash.compare( rhs->hash );
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2008-01-21 20:54:19 +00:00
|
|
|
PARSER::PARSER( ELEM* aParent ) :
|
|
|
|
ELEM( T_parser, aParent )
|
|
|
|
{
|
|
|
|
string_quote = '"';
|
|
|
|
space_in_quoted_tokens = false;
|
|
|
|
|
|
|
|
case_sensitive = false;
|
|
|
|
wires_include_testpoint = false;
|
|
|
|
routes_include_testpoint = false;
|
|
|
|
routes_include_guides = false;
|
|
|
|
routes_include_image_conductor = false;
|
|
|
|
via_rotate_first = true;
|
|
|
|
generated_by_freeroute = false;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
host_cad = "KiCad's Pcbnew";
|
2010-01-04 19:09:33 +00:00
|
|
|
wxString msg = GetBuildVersion();
|
2011-02-02 15:31:48 +00:00
|
|
|
host_version = TO_UTF8(msg);
|
2008-01-21 20:54:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void PARSER::FormatContents( OUTPUTFORMATTER* out, int nestLevel )
|
2008-01-03 06:33:28 +00:00
|
|
|
{
|
2008-01-14 22:50:08 +00:00
|
|
|
out->Print( nestLevel, "(string_quote %c)\n", string_quote );
|
|
|
|
out->Print( nestLevel, "(space_in_quoted_tokens %s)\n", space_in_quoted_tokens ? "on" : "off" );
|
2008-02-07 20:23:58 +00:00
|
|
|
out->Print( nestLevel, "(host_cad \"%s\")\n", host_cad.c_str() );
|
2008-01-14 22:50:08 +00:00
|
|
|
out->Print( nestLevel, "(host_version \"%s\")\n", host_version.c_str() );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
for( STRINGS::iterator i = constants.begin(); i != constants.end(); )
|
2008-02-14 01:07:52 +00:00
|
|
|
{
|
|
|
|
const std::string& s1 = *i++;
|
|
|
|
const std::string& s2 = *i++;
|
|
|
|
|
|
|
|
const char* q1 = out->GetQuoteChar( s1.c_str() );
|
|
|
|
const char* q2 = out->GetQuoteChar( s2.c_str() );
|
|
|
|
out->Print( nestLevel, "(constant %s%s%s %s%s%s)\n",
|
2021-07-19 23:56:05 +00:00
|
|
|
q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
|
2008-02-14 01:07:52 +00:00
|
|
|
}
|
2008-01-03 06:33:28 +00:00
|
|
|
|
|
|
|
if( routes_include_testpoint || routes_include_guides || routes_include_image_conductor )
|
2021-03-04 21:15:00 +00:00
|
|
|
{
|
2008-01-14 22:50:08 +00:00
|
|
|
out->Print( nestLevel, "(routes_include%s%s%s)\n",
|
2021-07-19 23:56:05 +00:00
|
|
|
routes_include_testpoint ? " testpoint" : "",
|
|
|
|
routes_include_guides ? " guides" : "",
|
|
|
|
routes_include_image_conductor ? " image_conductor" : "" );
|
2021-03-04 21:15:00 +00:00
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( wires_include_testpoint )
|
2008-01-14 22:50:08 +00:00
|
|
|
out->Print( nestLevel, "(wires_include testpoint)\n" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-03 06:33:28 +00:00
|
|
|
if( !via_rotate_first )
|
2008-01-14 22:50:08 +00:00
|
|
|
out->Print( nestLevel, "(via_rotate_first off)\n" );
|
2008-01-30 19:16:46 +00:00
|
|
|
|
2008-02-07 20:23:58 +00:00
|
|
|
if( case_sensitive )
|
2008-01-30 19:16:46 +00:00
|
|
|
out->Print( nestLevel, "(case_sensitive %s)\n", case_sensitive ? "on" : "off" );
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void PLACE::Format( OUTPUTFORMATTER* out, int nestLevel )
|
2008-01-14 22:50:08 +00:00
|
|
|
{
|
2008-01-15 23:12:38 +00:00
|
|
|
bool useMultiLine;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
const char* quote = out->GetQuoteChar( component_id.c_str() );
|
2008-01-14 22:50:08 +00:00
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
if( place_rules || properties.size() || rules || region )
|
2008-01-15 23:12:38 +00:00
|
|
|
{
|
|
|
|
useMultiLine = true;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel, "(%s %s%s%s\n", Name(), quote, component_id.c_str(), quote );
|
2008-01-15 23:12:38 +00:00
|
|
|
out->Print( nestLevel+1, "%s", "" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
useMultiLine = false;
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel, "(%s %s%s%s", Name(), quote, component_id.c_str(), quote );
|
2008-01-15 23:12:38 +00:00
|
|
|
}
|
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( hasVertex )
|
2008-01-23 22:38:16 +00:00
|
|
|
{
|
2021-03-04 22:39:09 +00:00
|
|
|
out->Print( 0, " %.6f %.6f", vertex.x, vertex.y );
|
2009-12-11 04:55:24 +00:00
|
|
|
out->Print( 0, " %s", GetTokenText( side ) );
|
2021-03-04 22:39:09 +00:00
|
|
|
out->Print( 0, " %.6f", rotation );
|
2008-01-23 22:38:16 +00:00
|
|
|
}
|
2008-01-29 22:09:09 +00:00
|
|
|
|
2008-01-30 19:16:46 +00:00
|
|
|
const char* space = " "; // one space, as c string.
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( mirror != T_NONE )
|
2008-01-30 19:16:46 +00:00
|
|
|
{
|
2009-12-11 04:55:24 +00:00
|
|
|
out->Print( 0, "%s(mirror %s)", space, GetTokenText( mirror ) );
|
2008-01-30 19:16:46 +00:00
|
|
|
space = "";
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( status != T_NONE )
|
2008-01-30 19:16:46 +00:00
|
|
|
{
|
2009-12-11 04:55:24 +00:00
|
|
|
out->Print( 0, "%s(status %s)", space, GetTokenText( status ) );
|
2008-01-30 19:16:46 +00:00
|
|
|
space = "";
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( logical_part.size() )
|
|
|
|
{
|
|
|
|
quote = out->GetQuoteChar( logical_part.c_str() );
|
2021-03-04 21:15:00 +00:00
|
|
|
out->Print( 0, "%s(logical_part %s%s%s)", space, quote, logical_part.c_str(), quote );
|
2008-01-30 19:16:46 +00:00
|
|
|
space = "";
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
|
|
|
|
2008-01-15 23:12:38 +00:00
|
|
|
if( useMultiLine )
|
2008-01-14 22:50:08 +00:00
|
|
|
{
|
|
|
|
out->Print( 0, "\n" );
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( place_rules )
|
|
|
|
{
|
|
|
|
place_rules->Format( out, nestLevel+1 );
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( properties.size() )
|
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel + 1, "(property \n" );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2021-03-04 21:15:00 +00:00
|
|
|
for( PROPERTIES::const_iterator i = properties.begin(); i != properties.end(); ++i )
|
2021-07-19 23:56:05 +00:00
|
|
|
i->Format( out, nestLevel + 2 );
|
2021-03-04 21:15:00 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel + 1, ")\n" );
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
2021-03-04 21:15:00 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( lock_type != T_NONE )
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel + 1, "(lock_type %s)\n", GetTokenText( lock_type ) );
|
2021-03-04 21:15:00 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( rules )
|
|
|
|
rules->Format( out, nestLevel+1 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( region )
|
|
|
|
region->Format( out, nestLevel+1 );
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-14 22:50:08 +00:00
|
|
|
if( part_number.size() )
|
|
|
|
{
|
2016-08-29 17:47:08 +00:00
|
|
|
quote = out->GetQuoteChar( part_number.c_str() );
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( nestLevel + 1, "(PN %s%s%s)\n", quote, part_number.c_str(), quote );
|
2008-01-14 22:50:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-01-29 22:09:09 +00:00
|
|
|
{
|
|
|
|
if( lock_type != T_NONE )
|
2008-01-30 19:16:46 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
out->Print( 0, "%s(lock_type %s)", space, GetTokenText( lock_type ) );
|
2008-01-30 19:16:46 +00:00
|
|
|
space = "";
|
|
|
|
}
|
2008-01-29 22:09:09 +00:00
|
|
|
|
|
|
|
if( part_number.size() )
|
|
|
|
{
|
2016-08-29 17:47:08 +00:00
|
|
|
quote = out->GetQuoteChar( part_number.c_str() );
|
2021-03-04 21:15:00 +00:00
|
|
|
out->Print( 0, "%s(PN %s%s%s)", space, quote, part_number.c_str(), quote );
|
2008-01-29 22:09:09 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-07 20:23:58 +00:00
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
out->Print( 0, ")\n" );
|
2008-01-03 06:33:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-23 06:10:51 +00:00
|
|
|
} // namespace DSN
|