KiCad PCB EDA Suite
DSN::SPECCTRA_DB Class Reference

Class SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file. More...

#include <specctra.h>

Inheritance diagram for DSN::SPECCTRA_DB:
SPECCTRA_LEXER DSNLEXER

Public Member Functions

 SPECCTRA_DB ()
 
virtual ~SPECCTRA_DB ()
 
void SetPCB (PCB *aPcb)
 Function SetPCB deletes any existing PCB and replaces it with the given one. More...
 
PCBGetPCB ()
 
void SetSESSION (SESSION *aSession)
 Function SetSESSION deletes any existing SESSION and replaces it with the given one. More...
 
SESSIONGetSESSION ()
 
void LoadPCB (const wxString &aFilename)
 Function LoadPCB is a recursive descent parser for a SPECCTRA DSN "design" file. More...
 
void LoadSESSION (const wxString &aFilename)
 Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file. More...
 
void ExportPCB (wxString aFilename, bool aNameChange=false)
 Function ExportPCB writes the internal PCB instance out as a SPECTRA DSN format file. More...
 
void FromBOARD (BOARD *aBoard)
 Function FromBOARD adds the entire BOARD to the PCB but does not write it out. More...
 
void FromSESSION (BOARD *aBoard)
 Function FromSESSION adds the entire SESSION info to a BOARD but does not write it out. More...
 
void ExportSESSION (wxString aFilename)
 Function ExportSESSION writes the internal SESSION instance out as a SPECTRA DSN format file. More...
 
void FlipMODULEs (BOARD *aBoard)
 Function FlipMODULEs flips the modules which are on the back side of the board to the front. More...
 
void RevertMODULEs (BOARD *aBoard)
 Function RevertMODULEs flips the modules which were on the back side of the board back to the back. More...
 
DSN::T NextTok ()
 Function NextTok returns the next token found in the input file or T_EOF when reaching the end of file. More...
 
DSN::T NeedSYMBOL ()
 Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(). More...
 
DSN::T NeedSYMBOLorNUMBER ()
 Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool IsSymbol() or tok==T_NUMBER. More...
 
DSN::T CurTok ()
 Function CurTok returns whatever NextTok() returned the last time it was called. More...
 
DSN::T PrevTok ()
 Function PrevTok returns whatever NextTok() returned the 2nd to last time it was called. More...
 
bool SyncLineReaderWith (DSNLEXER &aLexer)
 Useable only for DSN lexers which share the same LINE_READER Synchronizes the pointers handling the data read by the LINE_READER Allows 2 DNSLEXER to share the same current line, when switching from a DNSLEXER to an other DNSLEXER. More...
 
void SetSpecctraMode (bool aMode)
 Function SetSpecctraMode changes the behavior of this lexer into or out of "specctra mode". More...
 
void PushReader (LINE_READER *aLineReader)
 Function PushReader manages a stack of LINE_READERs in order to handle nested file inclusion. More...
 
LINE_READERPopReader ()
 Function PopReader deletes the top most LINE_READER from an internal stack of LINE_READERs and in the case of FILE_LINE_READER this means the associated FILE is closed. More...
 
int NeedNUMBER (const char *aExpectation)
 Function NeedNUMBER calls NextTok() and then verifies that the token read is type DSN_NUMBER. More...
 
char SetStringDelimiter (char aStringDelimiter)
 Function SetStringDelimiter changes the string delimiter from the default " to some other character and returns the old value. More...
 
bool SetSpaceInQuotedTokens (bool val)
 Function SetSpaceInQuotedTokens changes the setting controlling whether a space in a quoted string is a terminator. More...
 
bool SetCommentsAreTokens (bool val)
 Function SetCommentsAreTokens changes the handling of comments. More...
 
wxArrayString * ReadCommentLines ()
 Function ReadCommentLines checks the next sequence of tokens and reads them into a wxArrayString if they are comments. More...
 
void Expecting (int aTok)
 Function Expecting throws an IO_ERROR exception with an input file specific error message. More...
 
void Expecting (const char *aTokenList)
 Function Expecting throws an IO_ERROR exception with an input file specific error message. More...
 
void Unexpected (int aTok)
 Function Unexpected throws an IO_ERROR exception with an input file specific error message. More...
 
void Unexpected (const char *aToken)
 Function Unexpected throws an IO_ERROR exception with an input file specific error message. More...
 
void Duplicate (int aTok)
 Function Duplicate throws an IO_ERROR exception with a message saying specifically that aTok is a duplicate of one already seen in current context. More...
 
void NeedLEFT ()
 Function NeedLEFT calls NextTok() and then verifies that the token read in is a DSN_LEFT. More...
 
void NeedRIGHT ()
 Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT. More...
 
const char * GetTokenText (int aTok)
 Function GetTokenText returns the C string representation of a DSN_T value. More...
 
wxString GetTokenString (int aTok)
 Function GetTokenString returns a quote wrapped wxString representation of a token value. More...
 
const char * CurText ()
 Function CurText returns a pointer to the current token's text. More...
 
const std::string & CurStr ()
 Function CurStr returns a reference to current token in std::string form. More...
 
wxString FromUTF8 ()
 Function FromUTF8 returns the current token text as a wxString, assuming that the input byte stream is UTF8 encoded. More...
 
int CurLineNumber ()
 Function CurLineNumber returns the current line number within my LINE_READER. More...
 
const char * CurLine ()
 Function CurLine returns the current line of text, from which the CurText() would return its token. More...
 
const wxString & CurSource ()
 Function CurFilename returns the current LINE_READER source. More...
 
int CurOffset ()
 Function CurOffset returns the byte offset within the current line, using a 1 based index. More...
 

Static Public Member Functions

static PCBMakePCB ()
 Function MakePCB makes a PCB with all the default ELEMs and parts on the heap. More...
 
static const char * TokenName (DSN::T aTok)
 Function TokenName returns the name of the token in ASCII form. More...
 
static bool IsSymbol (int aTok)
 Function IsSymbol tests a token to see if it is a symbol. More...
 
static const char * Syntax (int aTok)
 

Protected Types

typedef std::vector< LINE_READER * > READER_STACK
 

Protected Member Functions

void init ()
 
int readLine ()
 
int findToken (const std::string &aToken)
 Function findToken takes aToken string and looks up the string in the keywords table. More...
 
bool isStringTerminator (char cc)
 

Protected Attributes

bool iOwnReaders
 on readerStack, should I delete them? More...
 
const char * start
 
const char * next
 
const char * limit
 
char dummy [1]
 when there is no reader. More...
 
READER_STACK readerStack
 all the LINE_READERs by pointer. More...
 
LINE_READERreader
 no ownership. ownership is via readerStack, maybe, if iOwnReaders More...
 
bool specctraMode
 if true, then: 1) stringDelimiter can be changed 2) Kicad quoting protocol is not in effect 3) space_in_quoted_tokens is functional else not. More...
 
char stringDelimiter
 
bool space_in_quoted_tokens
 blank spaces within quoted strings More...
 
bool commentsAreTokens
 true if should return comments as tokens More...
 
int prevTok
 curTok from previous NextTok() call. More...
 
int curOffset
 offset within current line of the current token More...
 
int curTok
 the current token obtained on last NextTok() More...
 
std::string curText
 the text of the current token More...
 
KEYWORD_MAP keyword_hash
 fast, specialized "C string" hashtable More...
 

Private Member Functions

void buildLayerMaps (BOARD *aBoard)
 Function buildLayerMaps creates a few data translation structures for layer name and number mapping between the DSN::PCB structure and the KiCad BOARD structure. More...
 
int findLayerName (const std::string &aLayerName) const
 Function findLayerName returns the PCB layer index for a given layer name, within the specctra session file. More...
 
void readCOMPnPIN (std::string *component_id, std::string *pid_id)
 Function readCOMPnPIN reads a <pin_reference> and splits it into the two parts which are on either side of the hyphen. More...
 
void readTIME (time_t *time_stamp)
 Function readTIME reads a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : second year". More...
 
void doPCB (PCB *growth)
 
void doPARSER (PARSER *growth)
 
void doRESOLUTION (UNIT_RES *growth)
 
void doUNIT (UNIT_RES *growth)
 
void doSTRUCTURE (STRUCTURE *growth)
 
void doSTRUCTURE_OUT (STRUCTURE_OUT *growth)
 
void doLAYER_NOISE_WEIGHT (LAYER_NOISE_WEIGHT *growth)
 
void doSPECCTRA_LAYER_PAIR (SPECCTRA_LAYER_PAIR *growth)
 
void doBOUNDARY (BOUNDARY *growth)
 
void doRECTANGLE (RECTANGLE *growth)
 
void doPATH (PATH *growth)
 
void doSTRINGPROP (STRINGPROP *growth)
 
void doTOKPROP (TOKPROP *growth)
 
void doVIA (VIA *growth)
 
void doCONTROL (CONTROL *growth)
 
void doLAYER (LAYER *growth)
 
void doRULE (RULE *growth)
 
void doKEEPOUT (KEEPOUT *growth)
 
void doCIRCLE (CIRCLE *growth)
 
void doQARC (QARC *growth)
 
void doWINDOW (WINDOW *growth)
 
void doCONNECT (CONNECT *growth)
 
void doREGION (REGION *growth)
 
void doCLASS_CLASS (CLASS_CLASS *growth)
 
void doLAYER_RULE (LAYER_RULE *growth)
 
void doCLASSES (CLASSES *growth)
 
void doGRID (GRID *growth)
 
void doPLACE (PLACE *growth)
 
void doCOMPONENT (COMPONENT *growth)
 
void doPLACEMENT (PLACEMENT *growth)
 
void doPROPERTIES (PROPERTIES *growth)
 
void doPADSTACK (PADSTACK *growth)
 
void doSHAPE (SHAPE *growth)
 
void doIMAGE (IMAGE *growth)
 
void doLIBRARY (LIBRARY *growth)
 
void doPIN (PIN *growth)
 
void doNET (NET *growth)
 
void doNETWORK (NETWORK *growth)
 
void doCLASS (CLASS *growth)
 
void doTOPOLOGY (TOPOLOGY *growth)
 
void doFROMTO (FROMTO *growth)
 
void doCOMP_ORDER (COMP_ORDER *growth)
 
void doWIRE (WIRE *growth)
 
void doWIRE_VIA (WIRE_VIA *growth)
 
void doWIRING (WIRING *growth)
 
void doSESSION (SESSION *growth)
 
void doANCESTOR (ANCESTOR *growth)
 
void doHISTORY (HISTORY *growth)
 
void doROUTE (ROUTE *growth)
 
void doWAS_IS (WAS_IS *growth)
 
void doNET_OUT (NET_OUT *growth)
 
void doSUPPLY_PIN (SUPPLY_PIN *growth)
 
void fillBOUNDARY (BOARD *aBoard, BOUNDARY *aBoundary)
 Function fillBOUNDARY makes the board perimeter for the DSN file by filling the BOUNDARY element in the specctra element tree. More...
 
IMAGEmakeIMAGE (BOARD *aBoard, MODULE *aModule)
 Function makeIMAGE allocates an IMAGE on the heap and creates all the PINs according to the D_PADs in the MODULE. More...
 
PADSTACKmakePADSTACK (BOARD *aBoard, D_PAD *aPad)
 Function makePADSTACK creates a PADSTACK which matches the given pad. More...
 
PADSTACKmakeVia (int aCopperDiameter, int aDrillDiameter, int aTopLayer, int aBotLayer)
 Function makeVia makes a round through hole PADSTACK using the given KiCad diameter in deci-mils. More...
 
PADSTACKmakeVia (const ::VIA *aVia)
 Function makeVia makes any kind of PADSTACK using the given KiCad VIA. More...
 
void deleteNETs ()
 Function deleteNETs deletes all the NETs that may be in here. More...
 
void exportNETCLASS (std::shared_ptr< NETCLASS > aNetClass, BOARD *aBoard)
 Function exportNETCLASS exports aNetClass to the DSN file. More...
 
TRACKmakeTRACK (PATH *aPath, int aPointIndex, int aNetcode)
 Function makeTRACK creates a TRACK form the PATH and BOARD info. More...
 
::VIAmakeVIA (PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault)
 Function makeVIA instantiates a KiCad VIA on the heap and initializes it with internal values consistent with the given PADSTACK, POINT, and netcode. More...
 

Private Attributes

PCBpcb
 
SESSIONsession
 
wxString filename
 
std::string quote_char
 
bool modulesAreFlipped
 
STRING_FORMATTER sf
 
STRINGS layerIds
 indexed by PCB layer number More...
 
std::vector< int > kicadLayer2pcb
 maps BOARD layer number to PCB layer numbers More...
 
std::vector< PCB_LAYER_IDpcbLayer2kicad
 maps PCB layer number to BOARD layer numbers More...
 
UNIT_RESrouteResolution
 used during FromSESSION() only, memory for it is not owned here. More...
 
BOARDsessionBoard
 a copy to avoid passing as an argument, memory for it is not owned here. More...
 
PADSTACKSET padstackset
 
std::vector< NET * > nets
 we don't want ownership here permanently, so we don't use boost::ptr_vector More...
 
int m_top_via_layer
 specctra cu layers, 0 based index: More...
 
int m_bot_via_layer
 

Static Private Attributes

static const KEYWORD keywords []
 specctra DSN keywords More...
 
static const unsigned keywordCount
 
static const KICAD_T scanPADs [] = { PCB_PAD_T, EOT }
 

Detailed Description

Class SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file.

Is essentially a SPECCTRA_PARSER class.

Definition at line 3607 of file specctra.h.

Member Typedef Documentation

typedef std::vector<LINE_READER*> DSNLEXER::READER_STACK
protectedinherited

Definition at line 89 of file dsnlexer.h.

Constructor & Destructor Documentation

DSN::SPECCTRA_DB::SPECCTRA_DB ( )
inline

Definition at line 3845 of file specctra.h.

References DSNLEXER::iOwnReaders, and DSNLEXER::SetSpecctraMode().

3845  :
3846  SPECCTRA_LEXER( 0 ) // LINE_READER* == NULL, no DSNLEXER::PushReader()
3847  {
3848  // The LINE_READER will be pushed from an automatic instantiation,
3849  // we don't own it:
3850  wxASSERT( !iOwnReaders );
3851 
3852  pcb = 0;
3853  session = 0;
3854  quote_char += '"';
3855  modulesAreFlipped = false;
3856 
3857  SetSpecctraMode( true );
3858 
3859  // Avoid not initialized members:
3860  routeResolution = NULL;
3861  sessionBoard = NULL;
3862  m_top_via_layer = 0;
3863  m_bot_via_layer = 0;
3864  }
SPECCTRA_LEXER(const std::string &aSExpression, const wxString &aSource=wxEmptyString)
Constructor ( const std::string&, const wxString& )
std::string quote_char
Definition: specctra.h:3616
void SetSpecctraMode(bool aMode)
Function SetSpecctraMode changes the behavior of this lexer into or out of "specctra mode"...
Definition: dsnlexer.cpp:153
bool iOwnReaders
on readerStack, should I delete them?
Definition: dsnlexer.h:83
int m_top_via_layer
specctra cu layers, 0 based index:
Definition: specctra.h:3644
SESSION * session
Definition: specctra.h:3614
bool modulesAreFlipped
Definition: specctra.h:3618
BOARD * sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3634
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3631
virtual DSN::SPECCTRA_DB::~SPECCTRA_DB ( )
inlinevirtual

Definition at line 3866 of file specctra.h.

References deleteNETs(), pcb, and session.

3867  {
3868  delete pcb;
3869  delete session;
3870 
3871  deleteNETs();
3872  }
void deleteNETs()
Function deleteNETs deletes all the NETs that may be in here.
Definition: specctra.h:3810
SESSION * session
Definition: specctra.h:3614

Member Function Documentation

void DSN::SPECCTRA_DB::buildLayerMaps ( BOARD aBoard)
private

Function buildLayerMaps creates a few data translation structures for layer name and number mapping between the DSN::PCB structure and the KiCad BOARD structure.

Parameters
aBoardThe BOARD to create the maps for.

Definition at line 74 of file specctra.cpp.

References B_Cu, F_Cu, FIRST_LAYER, BOARD::GetCopperLayerCount(), BOARD::GetLayerName(), kicadLayer2pcb, layerIds, pcbLayer2kicad, TO_UTF8, and ToLAYER_ID().

Referenced by FromBOARD(), and FromSESSION().

75 {
76  // specctra wants top physical layer first, then going down to the
77  // bottom most physical layer in physical sequence.
78  // Same as KiCad now except for B_Cu
79  unsigned layerCount = aBoard->GetCopperLayerCount();
80 
81  layerIds.clear();
82  pcbLayer2kicad.resize( layerCount );
83  kicadLayer2pcb.resize( B_Cu + 1 );
84 
85 #if 0 // was:
86  for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER;
87  kiNdx >= 0; --kiNdx, ++pcbNdx )
88  {
89  LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? F_Cu : kiNdx;
90 
91  // establish bi-directional mapping between KiCad's BOARD layer and PCB layer
92  pcbLayer2kicad[pcbNdx] = kilayer;
93  kicadLayer2pcb[kilayer] = pcbNdx;
94 
95  // save the specctra layer name in SPECCTRA_DB::layerIds for later.
96  layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( kilayer ) ) ) );
97  }
98 #else
99 
100  // establish bi-directional mapping between KiCad's BOARD layer and PCB layer
101 
102  for( unsigned i = 0; i < kicadLayer2pcb.size(); ++i )
103  {
104  if( i < layerCount-1 )
105  kicadLayer2pcb[i] = i;
106  else
107  kicadLayer2pcb[i] = layerCount - 1;
108  }
109 
110  for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i )
111  {
112  PCB_LAYER_ID id = ( i < layerCount-1 ) ? ToLAYER_ID( i ) : B_Cu;
113 
114  pcbLayer2kicad[i] = id;
115 
116  // save the specctra layer name in SPECCTRA_DB::layerIds for later.
117  layerIds.push_back( TO_UTF8( aBoard->GetLayerName( id ) ) );
118  }
119 
120 #endif
121 }
int GetCopperLayerCount() const
Function GetCopperLayerCount.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
PCB_LAYER_ID
A quick note on layer IDs:
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
std::vector< int > kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
Definition: specctra.h:3625
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
#define FIRST_LAYER
STRINGS layerIds
indexed by PCB layer number
Definition: specctra.h:3622
std::vector< PCB_LAYER_ID > pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3628
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:774
const char* DSNLEXER::CurLine ( )
inlineinherited

Function CurLine returns the current line of text, from which the CurText() would return its token.

Definition at line 517 of file dsnlexer.h.

Referenced by DSNLEXER::Duplicate(), DSNLEXER::Expecting(), CLIPBOARD_IO::Load(), PCB_IO::Load(), DSNLEXER::NeedNUMBER(), DSNLEXER::NextTok(), and DSNLEXER::Unexpected().

518  {
519  return (const char*)(*reader);
520  }
int DSNLEXER::CurLineNumber ( )
inlineinherited

Function CurLineNumber returns the current line number within my LINE_READER.

Definition at line 507 of file dsnlexer.h.

References LINE_READER::LineNumber().

Referenced by DSNLEXER::Duplicate(), DSNLEXER::Expecting(), CLIPBOARD_IO::Load(), PCB_IO::Load(), DSNLEXER::NeedNUMBER(), DSNLEXER::NextTok(), FP_LIB_TABLE::Parse(), SYMBOL_LIB_TABLE::Parse(), KICAD_NETLIST_PARSER::parseComponent(), and DSNLEXER::Unexpected().

508  {
509  return reader->LineNumber();
510  }
virtual unsigned LineNumber() const
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: richio.h:159
LINE_READER * reader
no ownership. ownership is via readerStack, maybe, if iOwnReaders
Definition: dsnlexer.h:92
int DSNLEXER::CurOffset ( )
inlineinherited

Function CurOffset returns the byte offset within the current line, using a 1 based index.

Returns
int - a one based index into the current line.

Definition at line 538 of file dsnlexer.h.

Referenced by DSNLEXER::Duplicate(), DSNLEXER::Expecting(), CLIPBOARD_IO::Load(), PCB_IO::Load(), DSNLEXER::NeedNUMBER(), DSNLEXER::NextTok(), KICAD_NETLIST_PARSER::parseComponent(), and DSNLEXER::Unexpected().

539  {
540  return curOffset + 1;
541  }
int curOffset
offset within current line of the current token
Definition: dsnlexer.h:106
const wxString& DSNLEXER::CurSource ( )
inlineinherited

Function CurFilename returns the current LINE_READER source.

Returns
const wxString& - the source of the lines of text, e.g. a filename or "clipboard".

Definition at line 528 of file dsnlexer.h.

References LINE_READER::GetSource().

Referenced by DSNLEXER::Duplicate(), DSNLEXER::Expecting(), CLIPBOARD_IO::Load(), PCB_IO::Load(), DSNLEXER::NeedNUMBER(), DSNLEXER::NextTok(), KICAD_NETLIST_PARSER::parseComponent(), and DSNLEXER::Unexpected().

529  {
530  return reader->GetSource();
531  }
LINE_READER * reader
no ownership. ownership is via readerStack, maybe, if iOwnReaders
Definition: dsnlexer.h:92
virtual const wxString & GetSource() const
Function GetSource returns the name of the source of the lines in an abstract sense.
Definition: richio.h:130
const std::string& DSNLEXER::CurStr ( )
inlineinherited

Function CurStr returns a reference to current token in std::string form.

Definition at line 488 of file dsnlexer.h.

References DSNLEXER::curText.

Referenced by PCB_PLOT_PARAMS_PARSER::Parse(), and PAGE_LAYOUT_READER_PARSER::readPngdata().

489  {
490  return curText;
491  }
std::string curText
the text of the current token
Definition: dsnlexer.h:109
const char* DSNLEXER::CurText ( )
inlineinherited

Function CurText returns a pointer to the current token's text.

Definition at line 479 of file dsnlexer.h.

Referenced by doANCESTOR(), doCIRCLE(), doCLASS(), doCLASSES(), doCOMP_ORDER(), doCOMPONENT(), doCONNECT(), doCONTROL(), doFROMTO(), doGRID(), doHISTORY(), doIMAGE(), doKEEPOUT(), doLAYER(), doLAYER_RULE(), doLIBRARY(), doNET(), doNET_OUT(), doNETWORK(), doPADSTACK(), doPARSER(), doPATH(), doPCB(), doPIN(), doPLACE(), doPROPERTIES(), doQARC(), doRECTANGLE(), doREGION(), doRESOLUTION(), doROUTE(), doRULE(), doSESSION(), doSHAPE(), doSPECCTRA_LAYER_PAIR(), doSTRINGPROP(), doSTRUCTURE(), doSTRUCTURE_OUT(), doSUPPLY_PIN(), doTOKPROP(), doTOPOLOGY(), doVIA(), doWAS_IS(), doWINDOW(), doWIRE(), doWIRE_VIA(), doWIRING(), PCAD2KICAD::LoadInputFile(), PCB_PLOT_PARAMS_PARSER::Parse(), PAGE_LAYOUT_READER_PARSER::Parse(), TEMPLATE_FIELDNAME::Parse(), TEMPLATES::Parse(), PAGE_LAYOUT_READER_PARSER::parseBitmap(), KICAD_NETLIST_PARSER::parseComponent(), PAGE_LAYOUT_READER_PARSER::parseCoordinate(), PCB_PLOT_PARAMS_PARSER::parseDouble(), PAGE_LAYOUT_READER_PARSER::parseDouble(), PAGE_LAYOUT_READER_PARSER::parseGraphic(), PCB_PARSER::parseHex(), PCB_PLOT_PARAMS_PARSER::parseInt(), PAGE_LAYOUT_READER_PARSER::parseInt(), PCB_PARSER::parseInt(), KICAD_NETLIST_PARSER::parseLibPartList(), KICAD_NETLIST_PARSER::parseNet(), BOM_CFG_READER_PARSER::parsePlugin(), PAGE_LAYOUT_READER_PARSER::parsePolygon(), PAGE_LAYOUT_READER_PARSER::parsePolyOutline(), PAGE_LAYOUT_READER_PARSER::parseSetup(), PAGE_LAYOUT_READER_PARSER::parseText(), readCOMPnPIN(), PAGE_LAYOUT_READER_PARSER::readOption(), PAGE_LAYOUT_READER_PARSER::readPngdata(), readTIME(), scanAtom(), and scanList().

480  {
481  return curText.c_str();
482  }
std::string curText
the text of the current token
Definition: dsnlexer.h:109
DSN::T SPECCTRA_LEXER::CurTok ( )
inlineinherited

Function CurTok returns whatever NextTok() returned the last time it was called.

Definition at line 538 of file specctra_lexer.h.

References DSNLEXER::CurTok().

Referenced by readCOMPnPIN().

539  {
540  return (DSN::T) DSNLEXER::CurTok();
541  }
T
enum T contains all this lexer's tokens.
int CurTok()
Function CurTok returns whatever NextTok() returned the last time it was called.
Definition: dsnlexer.h:320
void DSN::SPECCTRA_DB::deleteNETs ( )
inlineprivate

Function deleteNETs deletes all the NETs that may be in here.

Definition at line 3810 of file specctra.h.

Referenced by FromBOARD(), and ~SPECCTRA_DB().

3811  {
3812  for( unsigned n=0; n<nets.size(); ++n )
3813  delete nets[n];
3814 
3815  nets.clear();
3816  }
std::vector< NET * > nets
we don't want ownership here permanently, so we don't use boost::ptr_vector
Definition: specctra.h:3641
void DSN::SPECCTRA_DB::doANCESTOR ( ANCESTOR growth)
private

Definition at line 3039 of file specctra.cpp.

References DSN::ANCESTOR::comment, DSNLEXER::CurText(), DSNLEXER::Expecting(), DSN::ANCESTOR::filename, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), readTIME(), DSN::T_comment, DSN::T_created_time, DSN::T_LEFT, DSN::T_RIGHT, DSN::ANCESTOR::time_stamp, and DSNLEXER::Unexpected().

Referenced by doHISTORY().

3040 {
3041  T tok;
3042 
3043  /* <ancestor_file_descriptor >::=
3044  (ancestor <file_path_name> (created_time <time_stamp> )
3045  [(comment <comment_string> )])
3046  */
3047 
3048  NeedSYMBOL();
3049  growth->filename = CurText();
3050 
3051  while( (tok = NextTok()) != T_RIGHT )
3052  {
3053  if( tok != T_LEFT )
3054  Expecting( T_LEFT );
3055 
3056  tok = NextTok();
3057  switch( tok )
3058  {
3059  case T_created_time:
3060  readTIME( &growth->time_stamp );
3061  NeedRIGHT();
3062  break;
3063 
3064  case T_comment:
3065  NeedSYMBOL();
3066  growth->comment = CurText();
3067  NeedRIGHT();
3068  break;
3069 
3070  default:
3071  Unexpected( CurText() );
3072  }
3073  }
3074 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void readTIME(time_t *time_stamp)
Function readTIME reads a which consists of 8 lexer tokens: "month date hour : minute : ...
Definition: specctra.cpp:177
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doBOUNDARY ( BOUNDARY growth)
private

Definition at line 965 of file specctra.cpp.

References doPATH(), doRECTANGLE(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::BOUNDARY::paths, DSN::BOUNDARY::rectangle, DSN::T_LEFT, DSN::T_path, DSN::T_rect, DSN::T_RIGHT, and DSNLEXER::Unexpected().

Referenced by doSTRUCTURE().

966 {
967  T tok = NextTok();
968 
969  if( tok != T_LEFT )
970  Expecting( T_LEFT );
971 
972  tok = NextTok();
973  if( tok == T_rect )
974  {
975  if( growth->paths.size() )
976  Unexpected( "rect when path already encountered" );
977 
978  growth->rectangle = new RECTANGLE( growth );
979  doRECTANGLE( growth->rectangle );
980  NeedRIGHT();
981  }
982  else if( tok == T_path )
983  {
984  if( growth->rectangle )
985  Unexpected( "path when rect already encountered" );
986 
987  for(;;)
988  {
989  if( tok != T_path )
990  Expecting( T_path );
991 
992  PATH* path = new PATH( growth, T_path );
993  growth->paths.push_back( path );
994 
995  doPATH( path );
996 
997  tok = NextTok();
998  if( tok == T_RIGHT )
999  break;
1000 
1001  if( tok != T_LEFT )
1002  Expecting(T_LEFT);
1003 
1004  tok = NextTok();
1005  }
1006  }
1007  else
1008  Expecting( "rect|path" );
1009 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doPATH(PATH *growth)
Definition: specctra.cpp:1012
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1060
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
void DSN::SPECCTRA_DB::doCIRCLE ( CIRCLE growth)
private

Definition at line 1085 of file specctra.cpp.

References DSNLEXER::CurText(), DSN::CIRCLE::diameter, DSNLEXER::Expecting(), DSN::CIRCLE::layer_id, SPECCTRA_LEXER::NeedSYMBOLorNUMBER(), SPECCTRA_LEXER::NextTok(), DSN::T_NUMBER, DSN::T_RIGHT, DSN::CIRCLE::vertex, DSN::POINT::x, and DSN::POINT::y.

Referenced by doKEEPOUT(), doSHAPE(), doWINDOW(), and doWIRE().

1086 {
1087  T tok;
1088 
1090  growth->layer_id = CurText();
1091 
1092  if( NextTok() != T_NUMBER )
1093  Expecting( T_NUMBER );
1094  growth->diameter = strtod( CurText(), 0 );
1095 
1096  tok = NextTok();
1097  if( tok == T_NUMBER )
1098  {
1099  growth->vertex.x = strtod( CurText(), 0 );
1100 
1101  if( NextTok() != T_NUMBER )
1102  Expecting( T_NUMBER );
1103  growth->vertex.y = strtod( CurText(), 0 );
1104 
1105  tok = NextTok();
1106  }
1107 
1108  if( tok != T_RIGHT )
1109  Expecting( T_RIGHT );
1110 }
T
enum T contains all this lexer's tokens.
DSN::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCLASS ( CLASS growth)
private

Definition at line 2498 of file specctra.cpp.

References DSN::CLASS::circuit, DSN::CLASS::class_id, DSNLEXER::CurText(), doLAYER_RULE(), doRULE(), doTOPOLOGY(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::CLASS::layer_rules, SPECCTRA_LEXER::NeedSYMBOL(), DSN::CLASS::net_ids, SPECCTRA_LEXER::NextTok(), SPECCTRA_LEXER::PrevTok(), quote_char, DSN::CLASS::rules, DSN::T_circuit, DSN::T_EOF, DSN::T_layer_rule, DSN::T_LEFT, DSN::T_NONE, DSN::T_RIGHT, DSN::T_rule, DSN::T_STRING, DSN::T_topology, DSN::CLASS::topology, and DSNLEXER::Unexpected().

Referenced by doNETWORK().

2499 {
2500  T tok;
2501 
2502  /* <class_descriptor >::=
2503  (class
2504  <class_id > {[{<net_id >} | {<composite_name_list> }]}
2505  [<circuit_descriptor> ]
2506  [<rule_descriptor> ]
2507  [{<layer_rule_descriptor> }]
2508  [<topology_descriptor> ]
2509  )
2510  */
2511 
2512  NeedSYMBOL();
2513 
2514  growth->class_id = CurText();
2515 
2516  // do net_ids, do not support <composite_name_list>s at this time
2517  while( IsSymbol(tok = NextTok()) )
2518  {
2519  growth->net_ids.push_back( CurText() );
2520  }
2521 
2522 
2523  while( tok != T_RIGHT )
2524  {
2525  if( tok != T_LEFT )
2526  Expecting( T_LEFT );
2527 
2528  tok = NextTok();
2529  switch( tok )
2530  {
2531  case T_rule:
2532  if( growth->rules )
2533  Unexpected( tok );
2534  growth->rules = new RULE( growth, T_rule );
2535  doRULE( growth->rules );
2536  break;
2537 
2538  case T_layer_rule:
2539  LAYER_RULE* layer_rule;
2540  layer_rule = new LAYER_RULE( growth );
2541  growth->layer_rules.push_back( layer_rule );
2542  doLAYER_RULE( layer_rule );
2543  break;
2544 
2545  case T_topology:
2546  if( growth->topology )
2547  Unexpected( tok );
2548  growth->topology = new TOPOLOGY( growth );
2549  doTOPOLOGY( growth->topology );
2550  break;
2551 
2552  case T_circuit: // handle all the circuit_descriptor here as strings
2553  {
2554  std::string builder;
2555  int bracketNesting = 1; // we already saw the opening T_LEFT
2556  tok = T_NONE;
2557 
2558  while( bracketNesting!=0 && tok!=T_EOF )
2559  {
2560  tok = NextTok();
2561 
2562  if( tok==T_LEFT)
2563  ++bracketNesting;
2564 
2565  else if( tok==T_RIGHT )
2566  --bracketNesting;
2567 
2568  if( bracketNesting >= 1 )
2569  {
2570  T previousTok = (T) PrevTok();
2571 
2572  if( previousTok!=T_LEFT && previousTok!=T_circuit && tok!=T_RIGHT )
2573  builder += ' ';
2574 
2575  if( tok==T_STRING )
2576  builder += quote_char;
2577 
2578  builder += CurText();
2579 
2580  if( tok==T_STRING )
2581  builder += quote_char;
2582  }
2583 
2584  // When the nested rule is closed with a T_RIGHT and we are back down
2585  // to bracketNesting == 0, then save the builder and break;
2586  if( bracketNesting == 0 )
2587  {
2588  growth->circuit.push_back( builder );
2589  break;
2590  }
2591  }
2592 
2593  if( tok==T_EOF )
2594  Unexpected( T_EOF );
2595  } // scope bracket
2596  break;
2597 
2598  default:
2599  Unexpected( CurText() );
2600  } // switch
2601 
2602  tok = NextTok();
2603 
2604  } // while
2605 }
DSN::T PrevTok()
Function PrevTok returns whatever NextTok() returned the 2nd to last time it was called.
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
std::string quote_char
Definition: specctra.h:3616
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doTOPOLOGY(TOPOLOGY *growth)
Definition: specctra.cpp:2460
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void doLAYER_RULE(LAYER_RULE *growth)
Definition: specctra.cpp:1713
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCLASS_CLASS ( CLASS_CLASS growth)
private

Definition at line 1580 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), DSN::CLASS_CLASS::classes, doCLASSES(), doLAYER_RULE(), doRULE(), DSNLEXER::Expecting(), SPECCTRA_LEXER::NextTok(), DSN::T_classes, DSN::T_layer_rule, DSN::T_LEFT, DSN::T_region_class_class, DSN::T_RIGHT, DSN::T_rule, DSN::ELEM::Type(), and DSNLEXER::Unexpected().

Referenced by doREGION().

1581 {
1582  T tok = NextTok();
1583 
1584  if( tok != T_LEFT )
1585  Expecting( T_LEFT );
1586 
1587  while( (tok = NextTok()) != T_RIGHT )
1588  {
1589  switch( tok )
1590  {
1591  case T_classes:
1592  if( growth->classes )
1593  Unexpected( tok );
1594  growth->classes = new CLASSES( growth );
1595  doCLASSES( growth->classes );
1596  break;
1597 
1598  case T_rule:
1599  // only T_class_class takes a T_rule
1600  if( growth->Type() == T_region_class_class )
1601  Unexpected( tok );
1602  RULE* rule;
1603  rule = new RULE( growth, T_rule );
1604  growth->Append( rule );
1605  doRULE( rule );
1606  break;
1607 
1608  case T_layer_rule:
1609  // only T_class_class takes a T_layer_rule
1610  if( growth->Type() == T_region_class_class )
1611  Unexpected( tok );
1612  LAYER_RULE* layer_rule;
1613  layer_rule = new LAYER_RULE( growth );
1614  growth->Append( layer_rule );
1615  doLAYER_RULE( layer_rule );
1616  break;
1617 
1618  default:
1619  Unexpected( tok );
1620  }
1621  }
1622 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doCLASSES(CLASSES *growth)
Definition: specctra.cpp:1625
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doLAYER_RULE(LAYER_RULE *growth)
Definition: specctra.cpp:1713
void DSN::SPECCTRA_DB::doCLASSES ( CLASSES growth)
private

Definition at line 1625 of file specctra.cpp.

References DSN::CLASSES::class_ids, DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), SPECCTRA_LEXER::NextTok(), and DSN::T_RIGHT.

Referenced by doCLASS_CLASS().

1626 {
1627  T tok = NextTok();
1628 
1629  // require at least 2 class_ids
1630 
1631  if( !IsSymbol( tok ) )
1632  Expecting( "class_id" );
1633 
1634  growth->class_ids.push_back( CurText() );
1635 
1636  do
1637  {
1638  tok = NextTok();
1639  if( !IsSymbol( tok ) )
1640  Expecting( "class_id" );
1641 
1642  growth->class_ids.push_back( CurText() );
1643 
1644  } while( (tok = NextTok()) != T_RIGHT );
1645 }
T
enum T contains all this lexer's tokens.
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCOMP_ORDER ( COMP_ORDER growth)
private

Definition at line 2653 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), SPECCTRA_LEXER::NextTok(), DSN::COMP_ORDER::placement_ids, and DSN::T_RIGHT.

Referenced by doNET(), and doTOPOLOGY().

2654 {
2655  T tok;
2656 
2657  /* <component_order_descriptor >::=
2658  (comp_order {<placement_id> })
2659  */
2660 
2661  while( IsSymbol(tok = NextTok()) )
2662  {
2663  growth->placement_ids.push_back( CurText() );
2664  }
2665 
2666  if( tok != T_RIGHT )
2667  Expecting( T_RIGHT );
2668 }
T
enum T contains all this lexer's tokens.
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCOMPONENT ( COMPONENT growth)
private

Definition at line 1853 of file specctra.cpp.

References DSNLEXER::CurText(), doPLACE(), DSNLEXER::Expecting(), DSN::COMPONENT::image_id, DSNLEXER::IsSymbol(), SPECCTRA_LEXER::NextTok(), DSN::COMPONENT::places, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_place, DSN::T_RIGHT, and DSNLEXER::Unexpected().

Referenced by doPLACEMENT().

1854 {
1855  T tok = NextTok();
1856 
1857  if( !IsSymbol( tok ) && tok != T_NUMBER )
1858  Expecting( "image_id" );
1859  growth->image_id = CurText();
1860 
1861  while( (tok = NextTok()) != T_RIGHT )
1862  {
1863  if( tok != T_LEFT )
1864  Expecting( T_LEFT );
1865 
1866  tok = NextTok();
1867  switch( tok )
1868  {
1869  case T_place:
1870  PLACE* place;
1871  place = new PLACE( growth );
1872  growth->places.push_back( place );
1873  doPLACE( place );
1874  break;
1875 
1876  default:
1877  Unexpected(tok);
1878  }
1879  }
1880 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doPLACE(PLACE *growth)
Definition: specctra.cpp:1738
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCONNECT ( CONNECT growth)
private

Definition at line 877 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), SPECCTRA_LEXER::NextTok(), DSN::T_EOF, DSN::T_LEFT, DSN::T_RIGHT, DSN::T_terminal, and DSNLEXER::Unexpected().

Referenced by doWIRE().

878 {
879  /* from page 143 of specctra spec:
880 
881  (connect
882  {(terminal <object_type> [<pin_reference> ])}
883  )
884  */
885 
886  T tok = NextTok();
887 
888  while( tok != T_RIGHT )
889  {
890  if( tok!=T_LEFT )
891  Expecting( T_LEFT );
892 
893  tok = NextTok();
894 
895  switch( tok )
896  {
897  case T_terminal:
898  // since we do not use the terminal information, simlpy toss it.
899  while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
900  ;
901  break;
902 
903  default:
904  Unexpected( CurText() );
905  }
906 
907  tok = NextTok();
908  }
909 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doCONTROL ( CONTROL growth)
private

Definition at line 1187 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), DSNLEXER::CurText(), doTOKPROP(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::T_average_pair_length, DSN::T_bbv_ctr2ctr, DSN::T_checking_trim_by_pin, DSN::T_crosstalk_model, DSN::T_force_to_terminal_point, DSN::T_include_pins_in_crosstalk, DSN::T_LEFT, DSN::T_microvia, DSN::T_noise_accumulation, DSN::T_noise_calculation, DSN::T_off, DSN::T_off_grid, DSN::T_on, DSN::T_reroute_order_viols, DSN::T_RIGHT, DSN::T_roundoff_rotation, DSN::T_route_to_fanout_only, DSN::T_same_net_checking, DSN::T_via_at_smd, DSNLEXER::Unexpected(), and DSN::CONTROL::via_at_smd.

Referenced by doSTRUCTURE().

1188 {
1189  T tok;
1190 
1191  while( (tok = NextTok()) != T_RIGHT )
1192  {
1193  if( tok != T_LEFT )
1194  Expecting( T_LEFT );
1195 
1196  tok = NextTok();
1197  switch( tok )
1198  {
1199  case T_via_at_smd:
1200  tok = NextTok();
1201  if( tok!=T_on && tok!=T_off )
1202  Expecting( "on|off" );
1203  growth->via_at_smd = (tok==T_on);
1204  NeedRIGHT();
1205  break;
1206 
1207  case T_off_grid:
1210  case T_same_net_checking:
1212  case T_noise_calculation:
1213  case T_noise_accumulation:
1215  case T_bbv_ctr2ctr:
1216  case T_average_pair_length:
1217  case T_crosstalk_model:
1218  case T_roundoff_rotation:
1219  case T_microvia:
1220  case T_reroute_order_viols:
1221  TOKPROP* tokprop;
1222  tokprop = new TOKPROP( growth, tok );
1223  growth->Append( tokprop );
1224  doTOKPROP( tokprop );
1225  break;
1226 
1227  default:
1228  Unexpected( CurText() );
1229  }
1230  }
1231 }
T
enum T contains all this lexer's tokens.
void doTOKPROP(TOKPROP *growth)
Definition: specctra.cpp:1145
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doFROMTO ( FROMTO growth)
private

Definition at line 2671 of file specctra.cpp.

References DSNLEXER::CurText(), doLAYER_RULE(), doRULE(), DSNLEXER::Expecting(), DSN::FROMTO::fromText, DSN::FROMTO::fromto_type, DSNLEXER::IsSymbol(), DSN::FROMTO::layer_rules, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), DSN::FROMTO::net_id, SPECCTRA_LEXER::NextTok(), DSN::FROMTO::rules, DSNLEXER::SetStringDelimiter(), DSN::T_fix, DSN::T_layer_rule, DSN::T_LEFT, DSN::T_net, DSN::T_normal, DSN::T_RIGHT, DSN::T_rule, DSN::T_soft, DSN::T_SYMBOL, DSN::T_type, DSN::FROMTO::toText, and DSNLEXER::Unexpected().

Referenced by doNET(), and doTOPOLOGY().

2672 {
2673  T tok;
2674 
2675  /* <fromto_descriptor >::=
2676  {(fromto
2677  [<pin_reference> | <virtual_pin_descriptor> ] | <component_id >]
2678  [<pin_reference> | <virtual_pin_descriptor> | <component_id >]
2679  [(type [fix | normal | soft])]
2680  [(net <net_id >)]
2681  [<rule_descriptor> ]
2682  [<circuit_descriptor> ]
2683  [{<layer_rule_descriptor> }]
2684  )}
2685  */
2686 
2687 
2688  // read the first two grammar items in as 2 single tokens, i.e. do not
2689  // split apart the <pin_reference>s into 3 separate tokens. Do this by
2690  // turning off the string delimiter in the lexer.
2691 
2692  char old = SetStringDelimiter( 0 );
2693 
2694  if( !IsSymbol(NextTok() ) )
2695  {
2696  SetStringDelimiter( old );
2697  Expecting( T_SYMBOL );
2698  }
2699  growth->fromText = CurText();
2700 
2701  if( !IsSymbol(NextTok() ) )
2702  {
2703  SetStringDelimiter( old );
2704  Expecting( T_SYMBOL );
2705  }
2706  growth->toText = CurText();
2707 
2708  SetStringDelimiter( old );
2709 
2710  while( (tok = NextTok()) != T_RIGHT )
2711  {
2712  if( tok != T_LEFT )
2713  Expecting( T_LEFT );
2714 
2715  tok = NextTok();
2716  switch( tok )
2717  {
2718  case T_type:
2719  tok = NextTok();
2720  if( tok!=T_fix && tok!=T_normal && tok!=T_soft )
2721  Expecting( "fix|normal|soft" );
2722  growth->fromto_type = tok;
2723  NeedRIGHT();
2724  break;
2725 
2726  case T_rule:
2727  if( growth->rules )
2728  Unexpected( tok );
2729  growth->rules = new RULE( growth, T_rule );
2730  doRULE( growth->rules );
2731  break;
2732 
2733  case T_layer_rule:
2734  LAYER_RULE* layer_rule;
2735  layer_rule = new LAYER_RULE( growth );
2736  growth->layer_rules.push_back( layer_rule );
2737  doLAYER_RULE( layer_rule );
2738  break;
2739 
2740  case T_net:
2741  if( growth->net_id.size() )
2742  Unexpected( tok );
2743  NeedSYMBOL();
2744  growth->net_id = CurText();
2745  NeedRIGHT();
2746  break;
2747 
2748  // circuit descriptor not supported at this time
2749 
2750  default:
2751  Unexpected( CurText() );
2752  }
2753  }
2754 }
char SetStringDelimiter(char aStringDelimiter)
Function SetStringDelimiter changes the string delimiter from the default " to some other character a...
Definition: dsnlexer.h:344
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void doLAYER_RULE(LAYER_RULE *growth)
Definition: specctra.cpp:1713
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doGRID ( GRID growth)
private

Definition at line 1648 of file specctra.cpp.

References DSNLEXER::CurText(), DSN::GRID::dimension, DSN::GRID::direction, DSNLEXER::Expecting(), DSN::GRID::grid_type, DSN::GRID::image_type, SPECCTRA_LEXER::NextTok(), DSN::GRID::offset, DSN::T_direction, DSN::T_image_type, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_offset, DSN::T_pin, DSN::T_place, DSN::T_RIGHT, DSN::T_smd, DSN::T_snap, DSN::T_via, DSN::T_via_keepout, DSN::T_wire, DSN::T_x, DSN::T_y, and DSNLEXER::Unexpected().

Referenced by doSTRUCTURE().

1649 {
1650  T tok = NextTok();
1651 
1652  switch( tok )
1653  {
1654  case T_via:
1655  case T_wire:
1656  case T_via_keepout:
1657  case T_snap:
1658  case T_place:
1659  growth->grid_type = tok;
1660  if( NextTok() != T_NUMBER )
1661  Expecting( T_NUMBER );
1662  growth->dimension = strtod( CurText(), 0 );
1663  tok = NextTok();
1664  if( tok == T_LEFT )
1665  {
1666  while( (tok=NextTok()) != T_RIGHT )
1667  {
1668  if( tok==T_direction )
1669  {
1670  if( growth->grid_type == T_place )
1671  Unexpected( tok );
1672  tok = NextTok();
1673  if( tok!=T_x && tok!=T_y )
1674  Unexpected( CurText() );
1675  growth->direction = tok;
1676  if( NextTok() != T_RIGHT )
1677  Expecting(T_RIGHT);
1678  }
1679  else if( tok==T_offset )
1680  {
1681  if( growth->grid_type == T_place )
1682  Unexpected( tok );
1683 
1684  if( NextTok() != T_NUMBER )
1685  Expecting( T_NUMBER );
1686 
1687  growth->offset = strtod( CurText(), 0 );
1688 
1689  if( NextTok() != T_RIGHT )
1690  Expecting(T_RIGHT);
1691  }
1692  else if( tok==T_image_type )
1693  {
1694  if( growth->grid_type != T_place )
1695  Unexpected( tok );
1696  tok = NextTok();
1697  if( tok!=T_smd && tok!=T_pin )
1698  Unexpected( CurText() );
1699  growth->image_type = tok;
1700  if( NextTok() != T_RIGHT )
1701  Expecting(T_RIGHT);
1702  }
1703  }
1704  }
1705  break;
1706 
1707  default:
1708  Unexpected( tok );
1709  }
1710 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doHISTORY ( HISTORY growth)
private

Definition at line 3077 of file specctra.cpp.

References DSN::HISTORY::ancestors, DSN::HISTORY::comments, DSNLEXER::CurText(), doANCESTOR(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), readTIME(), DSN::T_ancestor, DSN::T_comment, DSN::T_created_time, DSN::T_LEFT, DSN::T_RIGHT, DSN::T_self, DSN::HISTORY::time_stamp, and DSNLEXER::Unexpected().

Referenced by doSESSION().

3078 {
3079  T tok;
3080 
3081  /* <history_descriptor >::=
3082  (history [{<ancestor_file_descriptor> }] <self_descriptor> )
3083  */
3084 
3085  while( (tok = NextTok()) != T_RIGHT )
3086  {
3087  if( tok != T_LEFT )
3088  Expecting( T_LEFT );
3089 
3090  tok = NextTok();
3091  switch( tok )
3092  {
3093  case T_ancestor:
3094  ANCESTOR* ancestor;
3095  ancestor = new ANCESTOR( growth );
3096  growth->ancestors.push_back( ancestor );
3097  doANCESTOR( ancestor );
3098  break;
3099 
3100  case T_self:
3101  while( (tok = NextTok()) != T_RIGHT )
3102  {
3103  if( tok != T_LEFT )
3104  Expecting( T_LEFT );
3105 
3106  tok = NextTok();
3107  switch( tok )
3108  {
3109  case T_created_time:
3110  readTIME( &growth->time_stamp );
3111  NeedRIGHT();
3112  break;
3113 
3114  case T_comment:
3115  NeedSYMBOL();
3116  growth->comments.push_back( CurText() );
3117  NeedRIGHT();
3118  break;
3119 
3120  default:
3121  Unexpected( CurText() );
3122  }
3123  }
3124  break;
3125 
3126  default:
3127  Unexpected( CurText() );
3128  }
3129  }
3130 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doANCESTOR(ANCESTOR *growth)
Definition: specctra.cpp:3039
void readTIME(time_t *time_stamp)
Function readTIME reads a which consists of 8 lexer tokens: "month date hour : minute : ...
Definition: specctra.cpp:177
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doIMAGE ( IMAGE growth)
private

Definition at line 2123 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), DSNLEXER::CurText(), doKEEPOUT(), doPIN(), doRULE(), doSHAPE(), doUNIT(), DSNLEXER::Expecting(), DSN::IMAGE::image_id, DSNLEXER::IsSymbol(), DSN::IMAGE::keepouts, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::IMAGE::pins, DSN::IMAGE::place_rules, DSN::IMAGE::rules, DSN::IMAGE::side, DSN::T_back, DSN::T_bend_keepout, DSN::T_both, DSN::T_elongate_keepout, DSN::T_front, DSN::T_keepout, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_outline, DSN::T_pin, DSN::T_place_keepout, DSN::T_place_rule, DSN::T_RIGHT, DSN::T_rule, DSN::T_side, DSN::T_unit, DSN::T_via_keepout, DSN::T_wire_keepout, DSNLEXER::Unexpected(), and DSN::IMAGE::unit.

Referenced by doLIBRARY().

2124 {
2125  T tok = NextTok();
2126 
2127  /* <image_descriptor >::=
2128  (image <image_id >
2129  [(side [front | back | both])]
2130  [<unit_descriptor> ]
2131  [<outline_descriptor> ]
2132  {(pin <padstack_id > [(rotate <rotation> )]
2133  [<reference_descriptor> | <pin_array_descriptor> ]
2134  [<user_property_descriptor> ])}
2135  [{<conductor_shape_descriptor> }]
2136  [{<conductor_via_descriptor> }]
2137  [<rule_descriptor> ]
2138  [<place_rule_descriptor> ]
2139  [{<keepout_descriptor> }]
2140  [<image_property_descriptor> ]
2141  )
2142  */
2143 
2144  if( !IsSymbol( tok ) && tok != T_NUMBER )
2145  Expecting( "image_id" );
2146 
2147  growth->image_id = CurText();
2148 
2149  while( (tok = NextTok()) != T_RIGHT )
2150  {
2151  if( tok != T_LEFT )
2152  Expecting( T_LEFT );
2153 
2154  tok = NextTok();
2155  switch( tok )
2156  {
2157  case T_unit:
2158  if( growth->unit )
2159  Unexpected( tok );
2160  growth->unit = new UNIT_RES( growth, tok );
2161  doUNIT( growth->unit );
2162  break;
2163 
2164  case T_side:
2165  tok = NextTok();
2166  if( tok!=T_front && tok!=T_back && tok!=T_both )
2167  Expecting( "front|back|both" );
2168  growth->side = tok;
2169  NeedRIGHT();
2170  break;
2171 
2172  case T_outline:
2173  SHAPE* outline;
2174  outline = new SHAPE( growth, T_outline ); // use SHAPE for T_outline
2175  growth->Append( outline );
2176  doSHAPE( outline );
2177  break;
2178 
2179  case T_pin:
2180  PIN* pin;
2181  pin = new PIN( growth );
2182  growth->pins.push_back( pin );
2183  doPIN( pin );
2184  break;
2185 
2186  case T_rule:
2187  if( growth->rules )
2188  Unexpected( tok );
2189  growth->rules = new RULE( growth, tok );
2190  doRULE( growth->rules );
2191  break;
2192 
2193  case T_place_rule:
2194  if( growth->place_rules )
2195  Unexpected( tok );
2196  growth->place_rules = new RULE( growth, tok );
2197  doRULE( growth->place_rules );
2198  break;
2199 
2200  case T_keepout:
2201  case T_place_keepout:
2202  case T_via_keepout:
2203  case T_wire_keepout:
2204  case T_bend_keepout:
2205  case T_elongate_keepout:
2206  KEEPOUT* keepout;
2207  keepout = new KEEPOUT( growth, tok );
2208  growth->keepouts.push_back( keepout );
2209  doKEEPOUT( keepout );
2210  break;
2211 
2212  default:
2213  Unexpected( CurText() );
2214  }
2215  }
2216 }
void doKEEPOUT(KEEPOUT *growth)
Definition: specctra.cpp:787
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
Class SHAPE.
Definition: shape.h:57
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doPIN(PIN *growth)
Definition: specctra.cpp:2219
void doSHAPE(SHAPE *growth)
Definition: specctra.cpp:2038
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doKEEPOUT ( KEEPOUT growth)
private

Definition at line 787 of file specctra.cpp.

References DSNLEXER::CurText(), doCIRCLE(), doPATH(), doQARC(), doRECTANGLE(), doRULE(), doWINDOW(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::KEEPOUT::name, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::KEEPOUT::place_rules, DSN::KEEPOUT::rules, DSN::KEEPOUT::sequence_number, DSN::KEEPOUT::shape, DSN::T_circle, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_path, DSN::T_place_rule, DSN::T_polygon, DSN::T_polyline_path, DSN::T_qarc, DSN::T_rect, DSN::T_RIGHT, DSN::T_rule, DSN::T_sequence_number, DSN::T_window, DSNLEXER::Unexpected(), and DSN::KEEPOUT::windows.

Referenced by doIMAGE(), and doSTRUCTURE().

788 {
789  T tok = NextTok();
790 
791  if( IsSymbol(tok) )
792  {
793  growth->name = CurText();
794  tok = NextTok();
795  }
796 
797  if( tok!=T_LEFT )
798  Expecting( T_LEFT );
799 
800  while( tok != T_RIGHT )
801  {
802  if( tok!=T_LEFT )
803  Expecting( T_LEFT );
804 
805  tok = NextTok();
806  switch( tok )
807  {
808  case T_sequence_number:
809  if( NextTok() != T_NUMBER )
810  Expecting( T_NUMBER );
811  growth->sequence_number = atoi( CurText() );
812  NeedRIGHT();
813  break;
814 
815  case T_rule:
816  if( growth->rules )
817  Unexpected( tok );
818  growth->rules = new RULE( growth, T_rule );
819  doRULE( growth->rules );
820  break;
821 
822  case T_place_rule:
823  if( growth->place_rules )
824  Unexpected( tok );
825  growth->place_rules = new RULE( growth, T_place_rule );
826  doRULE( growth->place_rules );
827  break;
828 
829  case T_rect:
830  if( growth->shape )
831  Unexpected( tok );
832  growth->shape = new RECTANGLE( growth );
833  doRECTANGLE( (RECTANGLE*) growth->shape );
834  break;
835 
836  case T_circle:
837  if( growth->shape )
838  Unexpected( tok );
839  growth->shape = new CIRCLE( growth );
840  doCIRCLE( (CIRCLE*) growth->shape );
841  break;
842 
843  case T_polyline_path:
844  tok = T_path;
845  // Fall through
846  case T_path:
847  case T_polygon:
848  if( growth->shape )
849  Unexpected( tok );
850  growth->shape = new PATH( growth, tok );
851  doPATH( (PATH*) growth->shape );
852  break;
853 
854  case T_qarc:
855  if( growth->shape )
856  Unexpected( tok );
857  growth->shape = new QARC( growth );
858  doQARC( (QARC*) growth->shape );
859  break;
860 
861  case T_window:
862  WINDOW* window;
863  window = new WINDOW( growth );
864  growth->windows.push_back( window );
865  doWINDOW( window );
866  break;
867 
868  default:
869  Unexpected( CurText() );
870  }
871 
872  tok = NextTok();
873  }
874 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doWINDOW(WINDOW *growth)
Definition: specctra.cpp:912
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void doPATH(PATH *growth)
Definition: specctra.cpp:1012
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1060
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1085
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
void doQARC(QARC *growth)
Definition: specctra.cpp:1113
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doLAYER ( LAYER growth)
private

Definition at line 1257 of file specctra.cpp.

References DSN::LAYER::cost, DSN::LAYER::cost_type, DSNLEXER::CurText(), DSN::LAYER::direction, doPROPERTIES(), doRULE(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::LAYER::layer_type, DSN::LAYER::name, SPECCTRA_LEXER::NextTok(), DSN::LAYER::properties, DSN::LAYER::rules, DSN::T_cost, DSN::T_diagonal, DSN::T_direction, DSN::T_forbidden, DSN::T_free, DSN::T_high, DSN::T_horizontal, DSN::T_jumper, DSN::T_LEFT, DSN::T_length, DSN::T_low, DSN::T_medium, DSN::T_mixed, DSN::T_negative_diagonal, DSN::T_NUMBER, DSN::T_off, DSN::T_orthogonal, DSN::T_positive_diagonal, DSN::T_power, DSN::T_property, DSN::T_RIGHT, DSN::T_rule, DSN::T_signal, DSN::T_SYMBOL, DSN::T_type, DSN::T_use_net, DSN::T_vertical, DSN::T_way, DSNLEXER::Unexpected(), and DSN::LAYER::use_net.

Referenced by doSTRUCTURE(), and doSTRUCTURE_OUT().

1258 {
1259  T tok = NextTok();
1260 
1261  if( !IsSymbol(tok) )
1263 
1264  growth->name = CurText();
1265 
1266  while( (tok = NextTok()) != T_RIGHT )
1267  {
1268  if( tok != T_LEFT )
1269  Expecting( T_LEFT );
1270 
1271  tok = NextTok();
1272  switch( tok )
1273  {
1274  case T_type:
1275  tok = NextTok();
1276  if( tok!=T_signal && tok!=T_power && tok!=T_mixed && tok!=T_jumper )
1277  Expecting( "signal|power|mixed|jumper" );
1278  growth->layer_type = tok;
1279  if( NextTok()!=T_RIGHT )
1280  Expecting(T_RIGHT);
1281  break;
1282 
1283  case T_rule:
1284  growth->rules = new RULE( growth, T_rule );
1285  doRULE( growth->rules );
1286  break;
1287 
1288  case T_property:
1289  doPROPERTIES( &growth->properties );
1290  break;
1291 
1292  case T_direction:
1293  tok = NextTok();
1294  switch( tok )
1295  {
1296  case T_horizontal:
1297  case T_vertical:
1298  case T_orthogonal:
1299  case T_positive_diagonal:
1300  case T_negative_diagonal:
1301  case T_diagonal:
1302  case T_off:
1303  growth->direction = tok;
1304  break;
1305  default:
1306  // the spec has an example show an abbreviation of the "horizontal" keyword. Ouch.
1307  if( !strcmp( "hori", CurText() ) )
1308  {
1309  growth->direction = T_horizontal;
1310  break;
1311  }
1312  else if( !strcmp( "vert", CurText() ) )
1313  {
1314  growth->direction = T_vertical;
1315  break;
1316  }
1317  Expecting( "horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|diagonal|off" );
1318  }
1319  if( NextTok()!=T_RIGHT )
1320  Expecting(T_RIGHT);
1321  break;
1322 
1323  case T_cost:
1324  tok = NextTok();
1325  switch( tok )
1326  {
1327  case T_forbidden:
1328  case T_high:
1329  case T_medium:
1330  case T_low:
1331  case T_free:
1332  growth->cost = tok;
1333  break;
1334  case T_NUMBER:
1335  // store as negative so we can differentiate between
1336  // T (positive) and T_NUMBER (negative)
1337  growth->cost = -atoi( CurText() );
1338  break;
1339  default:
1340  Expecting( "forbidden|high|medium|low|free|<positive_integer>|-1" );
1341  }
1342  tok = NextTok();
1343  if( tok == T_LEFT )
1344  {
1345  if( NextTok() != T_type )
1346  Unexpected( CurText() );
1347 
1348  tok = NextTok();
1349  if( tok!=T_length && tok!=T_way )
1350  Expecting( "length|way" );
1351 
1352  growth->cost_type = tok;
1353  if( NextTok()!=T_RIGHT )
1354  Expecting(T_RIGHT);
1355 
1356  tok = NextTok();
1357  }
1358  if( tok!=T_RIGHT )
1359  Expecting(T_RIGHT);
1360  break;
1361 
1362  case T_use_net:
1363  while( (tok = NextTok()) != T_RIGHT )
1364  {
1365  if( !IsSymbol(tok) )
1366  Expecting( T_SYMBOL );
1367 
1368  growth->use_net.push_back( CurText() );
1369  }
1370  break;
1371 
1372  default:
1373  Unexpected( CurText() );
1374  }
1375  }
1376 }
T
enum T contains all this lexer's tokens.
void doPROPERTIES(PROPERTIES *growth)
Definition: specctra.cpp:1234
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doLAYER_NOISE_WEIGHT ( LAYER_NOISE_WEIGHT growth)
private

Definition at line 590 of file specctra.cpp.

References doSPECCTRA_LAYER_PAIR(), DSNLEXER::Expecting(), DSN::LAYER_NOISE_WEIGHT::layer_pairs, SPECCTRA_LEXER::NextTok(), DSN::T_layer_pair, DSN::T_LEFT, and DSN::T_RIGHT.

Referenced by doSTRUCTURE().

592 {
593  T tok;
594 
595  while( (tok = NextTok()) != T_RIGHT )
596  {
597  if( tok != T_LEFT )
598  Expecting( T_LEFT );
599 
600  if( NextTok() != T_layer_pair )
602 
603  SPECCTRA_LAYER_PAIR* layer_pair = new SPECCTRA_LAYER_PAIR( growth );
604  growth->layer_pairs.push_back( layer_pair );
605  doSPECCTRA_LAYER_PAIR( layer_pair );
606  }
607 }
T
enum T contains all this lexer's tokens.
void doSPECCTRA_LAYER_PAIR(SPECCTRA_LAYER_PAIR *growth)
Definition: specctra.cpp:574
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void DSN::SPECCTRA_DB::doLAYER_RULE ( LAYER_RULE growth)
private

Definition at line 1713 of file specctra.cpp.

References DSNLEXER::CurText(), doRULE(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::LAYER_RULE::layer_ids, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::LAYER_RULE::rule, DSN::T_LEFT, and DSN::T_rule.

Referenced by doCLASS(), doCLASS_CLASS(), doFROMTO(), and doNET().

1714 {
1715  T tok;
1716 
1717  NeedSYMBOL();
1718 
1719  do
1720  {
1721  growth->layer_ids.push_back( CurText() );
1722 
1723  } while( IsSymbol(tok = NextTok()) );
1724 
1725  if( tok != T_LEFT )
1726  Expecting( T_LEFT );
1727 
1728  if( NextTok() != T_rule )
1729  Expecting( T_rule );
1730 
1731  growth->rule = new RULE( growth, T_rule );
1732  doRULE( growth->rule );
1733 
1734  NeedRIGHT();
1735 }
T
enum T contains all this lexer's tokens.
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doLIBRARY ( LIBRARY growth)
private

Definition at line 2266 of file specctra.cpp.

References DSN::LIBRARY::AddPadstack(), DSNLEXER::CurText(), doIMAGE(), doPADSTACK(), doUNIT(), DSNLEXER::Expecting(), DSN::LIBRARY::images, SPECCTRA_LEXER::NextTok(), DSN::T_image, DSN::T_LEFT, DSN::T_padstack, DSN::T_RIGHT, DSN::T_unit, DSNLEXER::Unexpected(), and DSN::LIBRARY::unit.

Referenced by doPCB(), and doROUTE().

2267 {
2268  T tok;
2269 
2270  /* <library_descriptor >::=
2271  (library
2272  [<unit_descriptor> ]
2273  {<image_descriptor> }
2274  [{<jumper_descriptor> }]
2275  {<padstack_descriptor> }
2276  {<via_array_template_descriptor> }
2277  [<directory_descriptor> ]
2278  [<extra_image_directory_descriptor> ]
2279  [{<family_family_descriptor> }]
2280  [{<image_image_descriptor> }]
2281  )
2282  */
2283 
2284  while( (tok = NextTok()) != T_RIGHT )
2285  {
2286  if( tok != T_LEFT )
2287  Expecting( T_LEFT );
2288 
2289  tok = NextTok();
2290  switch( tok )
2291  {
2292  case T_unit:
2293  if( growth->unit )
2294  Unexpected( tok );
2295  growth->unit = new UNIT_RES( growth, tok );
2296  doUNIT( growth->unit );
2297  break;
2298 
2299  case T_padstack:
2300  PADSTACK* padstack;
2301  padstack = new PADSTACK();
2302  growth->AddPadstack( padstack );
2303  doPADSTACK( padstack );
2304  break;
2305 
2306  case T_image:
2307  IMAGE* image;
2308  image = new IMAGE( growth );
2309  growth->images.push_back( image );
2310  doIMAGE( image );
2311  break;
2312 
2313  default:
2314  Unexpected( CurText() );
2315  }
2316  }
2317 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doIMAGE(IMAGE *growth)
Definition: specctra.cpp:2123
void doPADSTACK(PADSTACK *growth)
Definition: specctra.cpp:1938
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doNET ( NET growth)
private

Definition at line 2320 of file specctra.cpp.

References DSN::NET::comp_order, DSN::PIN_REF::component_id, DSNLEXER::CurText(), doCOMP_ORDER(), doFROMTO(), doLAYER_RULE(), doRULE(), empty(), DSNLEXER::Expecting(), DSN::NET::expose, DSN::NET::fromtos, DSNLEXER::IsSymbol(), DSN::NET::layer_rules, DSN::NET::load, DSNLEXER::NeedRIGHT(), DSN::NET::net_id, DSN::NET::net_number, SPECCTRA_LEXER::NextTok(), DSN::NET::noexpose, DSN::PIN_REF::pin_id, DSN::NET::pins, DSN::NET::pins_type, readCOMPnPIN(), DSN::NET::rules, DSN::NET::source, DSN::T_comp_order, DSN::T_expose, DSN::T_fix, DSN::T_fromto, DSN::T_layer_rule, DSN::T_LEFT, DSN::T_load, DSN::T_net_number, DSN::T_noexpose, DSN::T_normal, DSN::T_NUMBER, DSN::T_order, DSN::T_pins, DSN::T_RIGHT, DSN::T_rule, DSN::T_source, DSN::T_terminator, DSN::T_type, DSN::T_unassigned, DSN::NET::terminator, DSN::NET::type, DSN::NET::unassigned, and DSNLEXER::Unexpected().

Referenced by doNETWORK().

2321 {
2322  T tok = NextTok();
2323  PIN_REFS* pin_refs;
2324 
2325  /* <net_descriptor >::=
2326  (net <net_id >
2327  [(unassigned)]
2328  [(net_number <integer >)]
2329  [(pins {<pin_reference> }) | (order {<pin_reference> })]
2330  [<component_order_descriptor> ]
2331  [(type [fix | normal])]
2332  [<user_property_descriptor> ]
2333  [<circuit_descriptor> ]
2334  [<rule_descriptor> ]
2335  [{<layer_rule_descriptor> }]
2336  [<fromto_descriptor> ]
2337  [(expose {<pin_reference> })]
2338  [(noexpose {<pin_reference> })]
2339  [(source {<pin_reference> })]
2340  [(load {<pin_reference> })]
2341  [(terminator {<pin_reference> })]
2342  [(supply [power | ground])]
2343  )
2344  */
2345 
2346  if( !IsSymbol( tok ) )
2347  Expecting( "net_id" );
2348 
2349  growth->net_id = CurText();
2350 
2351  while( (tok = NextTok()) != T_RIGHT )
2352  {
2353  if( tok != T_LEFT )
2354  Expecting( T_LEFT );
2355 
2356  tok = NextTok();
2357  switch( tok )
2358  {
2359  case T_unassigned:
2360  growth->unassigned = true;
2361  NeedRIGHT();
2362  break;
2363 
2364  case T_net_number:
2365  if( NextTok() != T_NUMBER )
2366  Expecting( T_NUMBER );
2367  growth->net_number = atoi( CurText() );
2368  NeedRIGHT();
2369  break;
2370 
2371  case T_pins:
2372  case T_order:
2373  growth->pins_type = tok;
2374  pin_refs = &growth->pins;
2375  goto L_pins;
2376 
2377  case T_expose:
2378  pin_refs = &growth->expose;
2379  goto L_pins;
2380 
2381  case T_noexpose:
2382  pin_refs = &growth->noexpose;
2383  goto L_pins;
2384 
2385  case T_source:
2386  pin_refs = &growth->source;
2387  goto L_pins;
2388 
2389  case T_load:
2390  pin_refs = &growth->load;
2391  goto L_pins;
2392 
2393  case T_terminator:
2394  pin_refs = &growth->terminator;
2395  //goto L_pins;
2396 
2397 L_pins:
2398  {
2399  PIN_REF empty( growth );
2400  while( (tok = NextTok()) != T_RIGHT )
2401  {
2402  // copy the empty one, then fill its copy later thru pin_ref.
2403  pin_refs->push_back( empty );
2404 
2405  PIN_REF* pin_ref = &pin_refs->back();
2406 
2407  readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
2408  }
2409  }
2410  break;
2411 
2412  case T_comp_order:
2413  if( growth->comp_order )
2414  Unexpected( tok );
2415  growth->comp_order = new COMP_ORDER( growth );
2416  doCOMP_ORDER( growth->comp_order );
2417  break;
2418 
2419  case T_type:
2420  tok = NextTok();
2421  if( tok!=T_fix && tok!=T_normal )
2422  Expecting( "fix|normal" );
2423  growth->type = tok;
2424  NeedRIGHT();
2425  break;
2426 
2427 /* @todo
2428  case T_circuit:
2429  break;
2430 */
2431 
2432  case T_rule:
2433  if( growth->rules )
2434  Unexpected( tok );
2435  growth->rules = new RULE( growth, T_rule );
2436  doRULE( growth->rules );
2437  break;
2438 
2439  case T_layer_rule:
2440  LAYER_RULE* layer_rule;
2441  layer_rule = new LAYER_RULE( growth );
2442  growth->layer_rules.push_back( layer_rule );
2443  doLAYER_RULE( layer_rule );
2444  break;
2445 
2446  case T_fromto:
2447  FROMTO* fromto;
2448  fromto = new FROMTO( growth );
2449  growth->fromtos.push_back( fromto );
2450  doFROMTO( fromto );
2451  break;
2452 
2453  default:
2454  Unexpected( CurText() );
2455  }
2456  }
2457 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
void doCOMP_ORDER(COMP_ORDER *growth)
Definition: specctra.cpp:2653
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
std::vector< PIN_REF > PIN_REFS
Definition: specctra.h:2459
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Function readCOMPnPIN reads a and splits it into the two parts which are on either si...
Definition: specctra.cpp:134
void doLAYER_RULE(LAYER_RULE *growth)
Definition: specctra.cpp:1713
static bool empty(const wxTextEntryBase *aCtrl)
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doFROMTO(FROMTO *growth)
Definition: specctra.cpp:2671
void DSN::SPECCTRA_DB::doNET_OUT ( NET_OUT growth)
private

Definition at line 3334 of file specctra.cpp.

References DSNLEXER::CurText(), doRULE(), doSUPPLY_PIN(), doWIRE(), doWIRE_VIA(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOLorNUMBER(), DSN::NET_OUT::net_id, DSN::NET_OUT::net_number, SPECCTRA_LEXER::NextTok(), DSN::NET_OUT::rules, DSN::NET_OUT::supply_pins, DSN::T_LEFT, DSN::T_net_number, DSN::T_NUMBER, DSN::T_RIGHT, DSN::T_rule, DSN::T_supply_pin, DSN::T_via, DSN::T_wire, DSNLEXER::Unexpected(), DSN::NET_OUT::wire_vias, and DSN::NET_OUT::wires.

Referenced by doROUTE().

3335 {
3336  T tok;
3337 
3338  /* <net_out_descriptor >::=
3339  (net <net_id >
3340  [(net_number <integer >)]
3341  [<rule_descriptor> ]
3342  {[<wire_shape_descriptor> | <wire_guide_descriptor> |
3343  <wire_via_descriptor> | <bond_shape_descriptor> ]}
3344  {[<supply_pin_descriptor> ]}
3345  )
3346  */
3347 
3349  growth->net_id = CurText();
3350 
3351  while( (tok = NextTok()) != T_RIGHT )
3352  {
3353  if( tok != T_LEFT )
3354  Expecting( T_LEFT );
3355 
3356  tok = NextTok();
3357  switch( tok )
3358  {
3359  case T_net_number:
3360  tok = NextTok();
3361  if( tok!= T_NUMBER )
3362  Expecting( T_NUMBER );
3363  growth->net_number = atoi( CurText() );
3364  NeedRIGHT();
3365  break;
3366 
3367  case T_rule:
3368  if( growth->rules )
3369  Unexpected( tok );
3370  growth->rules = new RULE( growth, tok );
3371  doRULE( growth->rules );
3372  break;
3373 
3374  case T_wire:
3375  WIRE* wire;
3376  wire = new WIRE( growth );
3377  growth->wires.push_back( wire );
3378  doWIRE( wire );
3379  break;
3380 
3381  case T_via:
3382  WIRE_VIA* wire_via;
3383  wire_via = new WIRE_VIA( growth );
3384  growth->wire_vias.push_back( wire_via );
3385  doWIRE_VIA( wire_via );
3386  break;
3387 
3388  case T_supply_pin:
3389  SUPPLY_PIN* supply_pin;
3390  supply_pin = new SUPPLY_PIN( growth );
3391  growth->supply_pins.push_back( supply_pin );
3392  doSUPPLY_PIN( supply_pin );
3393  break;
3394 
3395  default:
3396  Unexpected( CurText() );
3397  }
3398  }
3399 }
void doWIRE(WIRE *growth)
Definition: specctra.cpp:2757
T
enum T contains all this lexer's tokens.
DSN::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
void doSUPPLY_PIN(SUPPLY_PIN *growth)
Definition: specctra.cpp:3402
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doWIRE_VIA(WIRE_VIA *growth)
Definition: specctra.cpp:2879
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doNETWORK ( NETWORK growth)
private

Definition at line 2608 of file specctra.cpp.

References DSN::NETWORK::classes, DSNLEXER::CurText(), doCLASS(), doNET(), DSNLEXER::Expecting(), NET, DSN::NETWORK::nets, SPECCTRA_LEXER::NextTok(), DSN::T_class, DSN::T_LEFT, DSN::T_net, DSN::T_RIGHT, and DSNLEXER::Unexpected().

Referenced by doPCB().

2609 {
2610  T tok;
2611 
2612  /* <network_descriptor >::=
2613  (network
2614  {<net_descriptor>}
2615  [{<class_descriptor> }]
2616  [{<class_class_descriptor> }]
2617  [{<group_descriptor> }]
2618  [{<group_set_descriptor> }]
2619  [{<pair_descriptor> }]
2620  [{<bundle_descriptor> }]
2621  )
2622  */
2623 
2624  while( (tok = NextTok()) != T_RIGHT )
2625  {
2626  if( tok != T_LEFT )
2627  Expecting( T_LEFT );
2628 
2629  tok = NextTok();
2630  switch( tok )
2631  {
2632  case T_net:
2633  NET* net;
2634  net = new NET( growth );
2635  growth->nets.push_back( net );
2636  doNET( net );
2637  break;
2638 
2639  case T_class:
2640  CLASS* myclass;
2641  myclass = new CLASS( growth );
2642  growth->classes.push_back( myclass );
2643  doCLASS( myclass );
2644  break;
2645 
2646  default:
2647  Unexpected( CurText() );
2648  }
2649  }
2650 }
T
enum T contains all this lexer's tokens.
void doNET(NET *growth)
Definition: specctra.cpp:2320
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doCLASS(CLASS *growth)
Definition: specctra.cpp:2498
Definition: hash_eda.h:43
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doPADSTACK ( PADSTACK growth)
private

Definition at line 1938 of file specctra.cpp.

References DSN::PADSTACK::absolute, DSN::ELEM_HOLDER::Append(), DSN::PADSTACK::attach, DSNLEXER::CurText(), doRULE(), doSHAPE(), doUNIT(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::PADSTACK::padstack_id, DSN::PADSTACK::rotate, DSN::PADSTACK::rules, DSN::T_absolute, DSN::T_attach, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_off, DSN::T_on, DSN::T_RIGHT, DSN::T_rotate, DSN::T_rule, DSN::T_shape, DSN::T_unit, DSN::T_use_via, DSNLEXER::Unexpected(), DSN::PADSTACK::unit, and DSN::PADSTACK::via_id.

Referenced by doLIBRARY().

1939 {
1940  T tok = NextTok();
1941 
1942  /* (padstack <padstack_id >
1943  [<unit_descriptor> ]
1944  {(shape <shape_descriptor>
1945  [<reduced_shape_descriptor> ]
1946  [(connect [on | off])]
1947  [{<window_descriptor> }]
1948  )}
1949  [<attach_descriptor> ]
1950  [{<pad_via_site_descriptor> }]
1951  [(rotate [on | off])]
1952  [(absolute [on | off])]
1953  [(rule <clearance_descriptor> )])
1954  */
1955 
1956  // padstack_id may be a number
1957  if( !IsSymbol( tok ) && tok!=T_NUMBER )
1958  Expecting( "padstack_id" );
1959 
1960  growth->padstack_id = CurText();
1961 
1962  while( (tok = NextTok()) != T_RIGHT )
1963  {
1964  if( tok != T_LEFT )
1965  Expecting( T_LEFT );
1966 
1967  tok = NextTok();
1968  switch( tok )
1969  {
1970  case T_unit:
1971  if( growth->unit )
1972  Unexpected( tok );
1973  growth->unit = new UNIT_RES( growth, tok );
1974  doUNIT( growth->unit );
1975  break;
1976 
1977  case T_rotate:
1978  tok = NextTok();
1979  if( tok!=T_on && tok!=T_off )
1980  Expecting( "on|off" );
1981  growth->rotate = tok;
1982  NeedRIGHT();
1983  break;
1984 
1985  case T_absolute:
1986  tok = NextTok();
1987  if( tok!=T_on && tok!=T_off )
1988  Expecting( "on|off" );
1989  growth->absolute = tok;
1990  NeedRIGHT();
1991  break;
1992 
1993  case T_shape:
1994  SHAPE* shape;
1995  shape = new SHAPE( growth );
1996  growth->Append( shape );
1997  doSHAPE( shape );
1998  break;
1999 
2000  case T_attach:
2001  tok = NextTok();
2002  if( tok!=T_off && tok!=T_on )
2003  Expecting( "off|on" );
2004  growth->attach = tok;
2005  tok = NextTok();
2006  if( tok == T_LEFT )
2007  {
2008  if( NextTok() != T_use_via )
2009  Expecting( T_use_via );
2010 
2011  NeedSYMBOL();
2012  growth->via_id = CurText();
2013 
2014  NeedRIGHT();
2015  NeedRIGHT();
2016  }
2017  break;
2018 
2019  /*
2020  case T_via_site: not supported
2021  break;
2022  */
2023 
2024  case T_rule:
2025  if( growth->rules )
2026  Unexpected( tok );
2027  growth->rules = new RULE( growth, T_rule );
2028  doRULE( growth->rules );
2029  break;
2030 
2031  default:
2032  Unexpected( CurText() );
2033  }
2034  }
2035 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
Class SHAPE.
Definition: shape.h:57
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doSHAPE(SHAPE *growth)
Definition: specctra.cpp:2038
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doPARSER ( PARSER growth)
private

Definition at line 387 of file specctra.cpp.

References DSN::PARSER::case_sensitive, DSN::PARSER::constants, DSNLEXER::CurText(), DSNLEXER::Expecting(), DSN::PARSER::generated_by_freeroute, DSN::PARSER::host_cad, DSN::PARSER::host_version, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NeedSYMBOLorNUMBER(), SPECCTRA_LEXER::NextTok(), quote_char, DSN::PARSER::routes_include_guides, DSN::PARSER::routes_include_image_conductor, DSN::PARSER::routes_include_testpoint, DSNLEXER::SetSpaceInQuotedTokens(), DSNLEXER::SetStringDelimiter(), DSN::PARSER::space_in_quoted_tokens, DSN::PARSER::string_quote, DSN::T_case_sensitive, DSN::T_constant, DSN::T_generated_by_freeroute, DSN::T_guide, DSN::T_host_cad, DSN::T_host_version, DSN::T_image_conductor, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_off, DSN::T_on, DSN::T_QUOTE_DEF, DSN::T_RIGHT, DSN::T_routes_include, DSN::T_space_in_quoted_tokens, DSN::T_STRING_QUOTE, DSN::T_SYMBOL, DSN::T_testpoint, DSN::T_via_rotate_first, DSN::T_wires_include, DSN::T_write_resolution, DSNLEXER::Unexpected(), and DSN::PARSER::via_rotate_first.

Referenced by doPCB(), and doROUTE().

388 {
389  T tok;
390  std::string const1;
391  std::string const2;
392 
393  /* <parser_descriptor >::=
394  (parser
395  [(string_quote <quote_char >)]
396  (space_in_quoted_tokens [on | off])
397  [(host_cad <id >)]
398  [(host_version <id >)]
399  [{(constant <id > <id >)}]
400  [(write_resolution] {<character> <positive_integer >})]
401  [(routes_include {[testpoint | guides |
402  image_conductor]})]
403  [(wires_include testpoint)]
404  [(case_sensitive [on | off])]
405  [(via_rotate_first [on | off])]
406  )
407  */
408 
409  while( (tok = NextTok()) != T_RIGHT )
410  {
411  if( tok != T_LEFT )
412  Expecting( T_LEFT );
413 
414  tok = NextTok();
415  switch( tok )
416  {
417  case T_STRING_QUOTE:
418  tok = NextTok();
419  if( tok != T_QUOTE_DEF )
421  SetStringDelimiter( (unsigned char) *CurText() );
422  growth->string_quote = *CurText();
423  quote_char = CurText();
424  NeedRIGHT();
425  break;
426 
428  tok = NextTok();
429  if( tok!=T_on && tok!=T_off )
430  Expecting( "on|off" );
432  growth->space_in_quoted_tokens = (tok==T_on);
433  NeedRIGHT();
434  break;
435 
436  case T_host_cad:
437  NeedSYMBOL();
438  growth->host_cad = CurText();
439  NeedRIGHT();
440  break;
441 
442  case T_host_version:
444  growth->host_version = CurText();
445  NeedRIGHT();
446  break;
447 
448  case T_constant:
450  const1 = CurText();
452  const2 = CurText();
453  NeedRIGHT();
454  growth->constants.push_back( const1 );
455  growth->constants.push_back( const2 );
456  break;
457 
458  case T_write_resolution: // [(writee_resolution {<character> <positive_integer >})]
459  while( (tok = NextTok()) != T_RIGHT )
460  {
461  if( tok!=T_SYMBOL )
462  Expecting( T_SYMBOL );
463  tok = NextTok();
464  if( tok!=T_NUMBER )
465  Expecting( T_NUMBER );
466  // @todo
467  }
468  break;
469 
470  case T_routes_include: // [(routes_include {[testpoint | guides | image_conductor]})]
471  while( (tok = NextTok()) != T_RIGHT )
472  {
473  switch( tok )
474  {
475  case T_testpoint:
476  growth->routes_include_testpoint = true;
477  break;
478  case T_guide:
479  growth->routes_include_guides = true;
480  break;
481  case T_image_conductor:
482  growth->routes_include_image_conductor = true;
483  break;
484  default:
485  Expecting( "testpoint|guides|image_conductor" );
486  }
487  }
488  break;
489 
490  case T_wires_include: // [(wires_include testpoint)]
491  tok = NextTok();
492  if( tok != T_testpoint )
494  growth->routes_include_testpoint = true;
495  NeedRIGHT();
496  break;
497 
498  case T_case_sensitive:
499  tok = NextTok();
500  if( tok!=T_on && tok!=T_off )
501  Expecting( "on|off" );
502  growth->case_sensitive = (tok==T_on);
503  NeedRIGHT();
504  break;
505 
506  case T_via_rotate_first: // [(via_rotate_first [on | off])]
507  tok = NextTok();
508  if( tok!=T_on && tok!=T_off )
509  Expecting( "on|off" );
510  growth->via_rotate_first = (tok==T_on);
511  NeedRIGHT();
512  break;
513 
515  growth->generated_by_freeroute = true;
516  NeedRIGHT();
517  break;
518 
519  default:
520  Unexpected( CurText() );
521  }
522  }
523 }
char SetStringDelimiter(char aStringDelimiter)
Function SetStringDelimiter changes the string delimiter from the default " to some other character a...
Definition: dsnlexer.h:344
T
enum T contains all this lexer's tokens.
DSN::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
std::string quote_char
Definition: specctra.h:3616
bool SetSpaceInQuotedTokens(bool val)
Function SetSpaceInQuotedTokens changes the setting controlling whether a space in a quoted string is...
Definition: dsnlexer.h:358
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doPATH ( PATH growth)
private

Definition at line 1012 of file specctra.cpp.

References DSN::PATH::aperture_type, DSN::PATH::aperture_width, DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::PATH::layer_id, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::PATH::points, DSN::T_aperture_type, DSN::T_LEFT, DSN::T_NUMBER, DSN::T_RIGHT, DSN::T_round, DSN::T_square, DSN::POINT::x, and DSN::POINT::y.

Referenced by doBOUNDARY(), doKEEPOUT(), doREGION(), doSHAPE(), doWINDOW(), and doWIRE().

1013 {
1014  T tok = NextTok();
1015 
1016  if( !IsSymbol( tok ) && tok != T_NUMBER ) // a layer name can be like a number like +12
1017  Expecting( "layer_id" );
1018 
1019  growth->layer_id = CurText();
1020 
1021  if( NextTok() != T_NUMBER )
1022  Expecting( "aperture_width" );
1023 
1024  growth->aperture_width = strtod( CurText(), NULL );
1025 
1026  POINT ptTemp;
1027 
1028  tok = NextTok();
1029 
1030  do
1031  {
1032  if( tok != T_NUMBER )
1033  Expecting( T_NUMBER );
1034  ptTemp.x = strtod( CurText(), NULL );
1035 
1036  if( NextTok() != T_NUMBER )
1037  Expecting( T_NUMBER );
1038  ptTemp.y = strtod( CurText(), NULL );
1039 
1040  growth->points.push_back( ptTemp );
1041 
1042  } while( (tok = NextTok())!=T_RIGHT && tok!=T_LEFT );
1043 
1044  if( tok == T_LEFT )
1045  {
1046  if( NextTok() != T_aperture_type )
1048 
1049  tok = NextTok();
1050  if( tok!=T_round && tok!=T_square )
1051  Expecting( "round|square" );
1052 
1053  growth->aperture_type = tok;
1054 
1055  NeedRIGHT();
1056  }
1057 }
T
enum T contains all this lexer's tokens.
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doPCB ( PCB growth)
private

Definition at line 282 of file specctra.cpp.

References DSNLEXER::CurText(), doLIBRARY(), doNETWORK(), doPARSER(), doPLACEMENT(), doRESOLUTION(), doSTRUCTURE(), doUNIT(), doWIRING(), DSNLEXER::Expecting(), DSN::PCB::library, SPECCTRA_LEXER::NeedSYMBOL(), DSN::PCB::network, SPECCTRA_LEXER::NextTok(), DSN::PCB::parser, DSN::PCB::pcbname, DSN::PCB::placement, DSN::PCB::resolution, DSN::PCB::structure, DSN::T_EOF, DSN::T_LEFT, DSN::T_library, DSN::T_network, DSN::T_parser, DSN::T_placement, DSN::T_resolution, DSN::T_RIGHT, DSN::T_structure, DSN::T_unit, DSN::T_wiring, DSNLEXER::Unexpected(), DSN::PCB::unit, and DSN::PCB::wiring.

Referenced by LoadPCB().

283 {
284  T tok;
285 
286  /* <design_descriptor >::=
287  (pcb <pcb_id >
288  [<parser_descriptor> ]
289  [<capacitance_resolution_descriptor> ]
290  [<conductance_resolution_descriptor> ]
291  [<current_resolution_descriptor> ]
292  [<inductance_resolution_descriptor> ]
293  [<resistance_resolution_descriptor> ]
294  [<resolution_descriptor> ]
295  [<time_resolution_descriptor> ]
296  [<voltage_resolution_descriptor> ]
297  [<unit_descriptor> ]
298  [<structure_descriptor> | <file_descriptor> ]
299  [<placement_descriptor> | <file_descriptor> ]
300  [<library_descriptor> | <file_descriptor> ]
301  [<floor_plan_descriptor> | <file_descriptor> ]
302  [<part_library_descriptor> | <file_descriptor> ]
303  [<network_descriptor> | <file_descriptor> ]
304  [<wiring_descriptor> ]
305  [<color_descriptor> ]
306  )
307  */
308 
309  NeedSYMBOL();
310  growth->pcbname = CurText();
311 
312  while( (tok = NextTok()) != T_RIGHT )
313  {
314  if( tok != T_LEFT )
315  Expecting( T_LEFT );
316 
317  tok = NextTok();
318  switch( tok )
319  {
320  case T_parser:
321  if( growth->parser )
322  Unexpected( tok );
323  growth->parser = new PARSER( growth );
324  doPARSER( growth->parser );
325  break;
326 
327  case T_unit:
328  if( growth->unit )
329  Unexpected( tok );
330  growth->unit = new UNIT_RES( growth, tok );
331  doUNIT( growth->unit );
332  break;
333 
334  case T_resolution:
335  if( growth->resolution )
336  Unexpected( tok );
337  growth->resolution = new UNIT_RES( growth, tok );
338  doRESOLUTION( growth->resolution );
339  break;
340 
341  case T_structure:
342  if( growth->structure )
343  Unexpected( tok );
344  growth->structure = new STRUCTURE( growth );
345  doSTRUCTURE( growth->structure );
346  break;
347 
348  case T_placement:
349  if( growth->placement )
350  Unexpected( tok );
351  growth->placement = new PLACEMENT( growth );
352  doPLACEMENT( growth->placement );
353  break;
354 
355  case T_library:
356  if( growth->library )
357  Unexpected( tok );
358  growth->library = new LIBRARY( growth );
359  doLIBRARY( growth->library );
360  break;
361 
362  case T_network:
363  if( growth->network )
364  Unexpected( tok );
365  growth->network = new NETWORK( growth );
366  doNETWORK( growth->network );
367  break;
368 
369  case T_wiring:
370  if( growth->wiring )
371  Unexpected( tok );
372  growth->wiring = new WIRING( growth );
373  doWIRING( growth->wiring );
374  break;
375 
376  default:
377  Unexpected( CurText() );
378  }
379  }
380 
381  tok = NextTok();
382  if( tok != T_EOF )
383  Expecting( T_EOF );
384 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doWIRING(WIRING *growth)
Definition: specctra.cpp:2983
void doLIBRARY(LIBRARY *growth)
Definition: specctra.cpp:2266
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doSTRUCTURE(STRUCTURE *growth)
Definition: specctra.cpp:610
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void doPLACEMENT(PLACEMENT *growth)
Definition: specctra.cpp:1883
void doNETWORK(NETWORK *growth)
Definition: specctra.cpp:2608
void doPARSER(PARSER *growth)
Definition: specctra.cpp:387
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doPIN ( PIN growth)
private

Definition at line 2219 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::PIN::padstack_id, DSN::PIN::pin_id, DSN::PIN::SetRotation(), DSN::T_LEFT, DSN::T_NUMBER, DSN::T_RIGHT, DSN::T_rotate, DSN::PIN::vertex, DSN::POINT::x, and DSN::POINT::y.

Referenced by doIMAGE().

2220 {
2221  T tok = NextTok();
2222 
2223  /* (pin <padstack_id > [(rotate <rotation> )]
2224  [<reference_descriptor> | <pin_array_descriptor> ]
2225  [<user_property_descriptor> ])
2226  */
2227 
2228  // a padstack_id may be a number
2229  if( !IsSymbol( tok ) && tok!=T_NUMBER )
2230  Expecting( "padstack_id" );
2231 
2232  growth->padstack_id = CurText();
2233 
2234  while( (tok = NextTok()) != T_RIGHT )
2235  {
2236  if( tok == T_LEFT )
2237  {
2238  tok = NextTok();
2239  if( tok != T_rotate )
2240  Expecting( T_rotate );
2241 
2242  if( NextTok() != T_NUMBER )
2243  Expecting( T_NUMBER );
2244  growth->SetRotation( strtod( CurText(), 0 ) );
2245  NeedRIGHT();
2246  }
2247  else
2248  {
2249  if( !IsSymbol(tok) && tok!=T_NUMBER )
2250  Expecting( "pin_id" );
2251 
2252  growth->pin_id = CurText();
2253 
2254  if( NextTok() != T_NUMBER )
2255  Expecting( T_NUMBER );
2256  growth->vertex.x = strtod( CurText(), 0 );
2257 
2258  if( NextTok() != T_NUMBER )
2259  Expecting( T_NUMBER );
2260  growth->vertex.y = strtod( CurText(), 0 );
2261  }
2262  }
2263 }
T
enum T contains all this lexer's tokens.
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doPLACE ( PLACE growth)
private

Definition at line 1738 of file specctra.cpp.

References DSN::PLACE::component_id, DSNLEXER::CurText(), doPROPERTIES(), doREGION(), doRULE(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSN::PLACE::lock_type, DSN::PLACE::logical_part, DSN::PLACE::mirror, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOLorNUMBER(), SPECCTRA_LEXER::NextTok(), DSN::PLACE::part_number, DSN::PLACE::place_rules, DSN::PLACE::properties, DSN::PLACE::region, DSN::PLACE::rules, DSN::PLACE::SetRotation(), DSN::PLACE::SetVertex(), DSN::PLACE::side, DSN::PLACE::status, DSN::T_added, DSN::T_back, DSN::T_deleted, DSN::T_front, DSN::T_gate, DSN::T_LEFT, DSN::T_lock_type, DSN::T_logical_part, DSN::T_mirror, DSN::T_NUMBER, DSN::T_off, DSN::T_pin, DSN::T_place_rule, DSN::T_pn, DSN::T_position, DSN::T_property, DSN::T_region, DSN::T_RIGHT, DSN::T_rule, DSN::T_status, DSN::T_subgate, DSN::T_substituted, DSN::T_x, DSN::T_xy, DSN::T_y, DSNLEXER::Unexpected(), DSN::POINT::x, and DSN::POINT::y.

Referenced by doCOMPONENT().

1739 {
1740  T tok = NextTok();
1741 
1742  if( !IsSymbol( tok ) )
1743  Expecting( "component_id" );
1744 
1745  growth->component_id = CurText();
1746 
1747  tok = NextTok();
1748  if( tok == T_NUMBER )
1749  {
1750  POINT point;
1751 
1752  point.x = strtod( CurText(), 0 );
1753 
1754  if( NextTok() != T_NUMBER )
1755  Expecting( T_NUMBER );
1756  point.y = strtod( CurText(), 0 );
1757 
1758  growth->SetVertex( point );
1759 
1760  tok = NextTok();
1761  if( tok!=T_front && tok!=T_back )
1762  Expecting( "front|back" );
1763  growth->side = tok;
1764 
1765  if( NextTok() != T_NUMBER )
1766  Expecting( "rotation" );
1767  growth->SetRotation( strtod( CurText(), 0) );
1768  }
1769 
1770  while( (tok = NextTok()) != T_RIGHT )
1771  {
1772  if( tok != T_LEFT )
1773  Expecting( T_LEFT );
1774 
1775  tok = NextTok();
1776  switch( tok )
1777  {
1778  case T_mirror:
1779  tok = NextTok();
1780  if( tok==T_x || tok==T_y || tok==T_xy || tok==T_off )
1781  growth->mirror = tok;
1782  else
1783  Expecting("x|y|xy|off");
1784  break;
1785 
1786  case T_status:
1787  tok = NextTok();
1788  if( tok==T_added || tok==T_deleted || tok==T_substituted )
1789  growth->status = tok;
1790  else
1791  Expecting("added|deleted|substituted");
1792  break;
1793 
1794  case T_logical_part:
1795  if( growth->logical_part.size() )
1796  Unexpected( tok );
1797  tok = NextTok();
1798  if( !IsSymbol( tok ) )
1799  Expecting( "logical_part_id");
1800  growth->logical_part = CurText();
1801  break;
1802 
1803  case T_place_rule:
1804  if( growth->place_rules )
1805  Unexpected( tok );
1806  growth->place_rules = new RULE( growth, T_place_rule );
1807  doRULE( growth->place_rules );
1808  break;
1809 
1810  case T_property:
1811  if( growth->properties.size() )
1812  Unexpected( tok );
1813  doPROPERTIES( &growth->properties );
1814  break;
1815 
1816  case T_lock_type:
1817  tok = NextTok();
1818  if( tok==T_position || tok==T_gate || tok==T_subgate || tok==T_pin )
1819  growth->lock_type = tok;
1820  else
1821  Expecting("position|gate|subgate|pin");
1822  break;
1823 
1824  case T_rule:
1825  if( growth->rules || growth->region )
1826  Unexpected( tok );
1827  growth->rules = new RULE( growth, T_rule );
1828  doRULE( growth->rules );
1829  break;
1830 
1831  case T_region:
1832  if( growth->rules || growth->region )
1833  Unexpected( tok );
1834  growth->region = new REGION( growth );
1835  doREGION( growth->region );
1836  break;
1837 
1838  case T_pn:
1839  if( growth->part_number.size() )
1840  Unexpected( tok );
1842  growth->part_number = CurText();
1843  NeedRIGHT();
1844  break;
1845 
1846  default:
1847  Unexpected( tok );
1848  }
1849  }
1850 }
T
enum T contains all this lexer's tokens.
void doPROPERTIES(PROPERTIES *growth)
Definition: specctra.cpp:1234
DSN::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doREGION(REGION *growth)
Definition: specctra.cpp:1511
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doPLACEMENT ( PLACEMENT growth)
private

Definition at line 1883 of file specctra.cpp.

References DSN::PLACEMENT::components, doCOMPONENT(), doRESOLUTION(), doUNIT(), DSNLEXER::Expecting(), DSN::PLACEMENT::flip_style, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::T_component, DSN::T_EOF, DSN::T_flip_style, DSN::T_LEFT, DSN::T_mirror_first, DSN::T_place_control, DSN::T_resolution, DSN::T_RIGHT, DSN::T_rotate_first, DSN::T_unit, DSNLEXER::Unexpected(), and DSN::PLACEMENT::unit.

Referenced by doPCB(), and doSESSION().

1884 {
1885  T tok;
1886 
1887  while( (tok = NextTok()) != T_RIGHT )
1888  {
1889  if( tok == T_EOF )
1890  Unexpected( T_EOF );
1891 
1892  if( tok != T_LEFT )
1893  Expecting( T_LEFT );
1894 
1895  tok = NextTok();
1896 
1897  switch( tok )
1898  {
1899  case T_unit:
1900  case T_resolution:
1901  growth->unit = new UNIT_RES( growth, tok );
1902  if( tok==T_resolution )
1903  doRESOLUTION( growth->unit );
1904  else
1905  doUNIT( growth->unit );
1906  break;
1907 
1908  case T_place_control:
1909  NeedRIGHT();
1910  tok = NextTok();
1911  if( tok != T_flip_style )
1913 
1914  tok = NextTok();
1915  if( tok==T_mirror_first || tok==T_rotate_first )
1916  growth->flip_style = tok;
1917  else
1918  Expecting( "mirror_first|rotate_first" );
1919 
1920  NeedRIGHT();
1921  NeedRIGHT();
1922  break;
1923 
1924  case T_component:
1925  COMPONENT* component;
1926  component = new COMPONENT( growth );
1927  growth->components.push_back( component );
1928  doCOMPONENT( component );
1929  break;
1930 
1931  default:
1932  Unexpected( tok );
1933  }
1934  }
1935 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doCOMPONENT(COMPONENT *growth)
Definition: specctra.cpp:1853
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doPROPERTIES ( PROPERTIES growth)
private

Definition at line 1234 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOLorNUMBER(), SPECCTRA_LEXER::NextTok(), DSN::T_LEFT, and DSN::T_RIGHT.

Referenced by doLAYER(), and doPLACE().

1235 {
1236  T tok;
1237  PROPERTY property; // construct it once here, append multiple times.
1238 
1239  while( (tok = NextTok()) != T_RIGHT )
1240  {
1241  if( tok != T_LEFT )
1242  Expecting( T_LEFT );
1243 
1245  property.name = CurText();
1246 
1248  property.value = CurText();
1249 
1250  growth->push_back( property );
1251 
1252  NeedRIGHT();
1253  }
1254 }
T
enum T contains all this lexer's tokens.
DSN::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doQARC ( QARC growth)
private

Definition at line 1113 of file specctra.cpp.

References DSN::QARC::aperture_width, DSNLEXER::CurText(), DSNLEXER::Expecting(), DSN::QARC::layer_id, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::T_NUMBER, DSN::QARC::vertex, DSN::POINT::x, and DSN::POINT::y.

Referenced by doKEEPOUT(), doSHAPE(), doWINDOW(), and doWIRE().

1114 {
1115  NeedSYMBOL();
1116  growth->layer_id = CurText();
1117 
1118  if( NextTok() != T_NUMBER )
1119  Expecting( T_NUMBER );
1120  growth->aperture_width = strtod( CurText(), 0 );
1121 
1122  for( int i=0; i<3; ++i )
1123  {
1124  if( NextTok() != T_NUMBER )
1125  Expecting( T_NUMBER );
1126  growth->vertex[i].x = strtod( CurText(), 0 );
1127 
1128  if( NextTok() != T_NUMBER )
1129  Expecting( T_NUMBER );
1130  growth->vertex[i].y = strtod( CurText(), 0 );
1131  }
1132 
1133  NeedRIGHT();
1134 }
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doRECTANGLE ( RECTANGLE growth)
private

Definition at line 1060 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSN::RECTANGLE::layer_id, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::RECTANGLE::point0, DSN::RECTANGLE::point1, DSN::T_NUMBER, DSN::POINT::x, and DSN::POINT::y.

Referenced by doBOUNDARY(), doKEEPOUT(), doREGION(), doSHAPE(), doWINDOW(), and doWIRE().

1061 {
1062  NeedSYMBOL();
1063  growth->layer_id = CurText();
1064 
1065  if( NextTok() != T_NUMBER )
1066  Expecting( T_NUMBER );
1067  growth->point0.x = strtod( CurText(), NULL );
1068 
1069  if( NextTok() != T_NUMBER )
1070  Expecting( T_NUMBER );
1071  growth->point0.y = strtod( CurText(), NULL );
1072 
1073  if( NextTok() != T_NUMBER )
1074  Expecting( T_NUMBER );
1075  growth->point1.x = strtod( CurText(), NULL );
1076 
1077  if( NextTok() != T_NUMBER )
1078  Expecting( T_NUMBER );
1079  growth->point1.y = strtod( CurText(), NULL );
1080 
1081  NeedRIGHT();
1082 }
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doREGION ( REGION growth)
private

Definition at line 1511 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), DSNLEXER::CurText(), doCLASS_CLASS(), doPATH(), doRECTANGLE(), doRULE(), doSTRINGPROP(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), SPECCTRA_LEXER::NextTok(), DSN::REGION::polygon, DSN::REGION::rectangle, DSN::REGION::region_id, DSN::REGION::rules, DSN::T_LEFT, DSN::T_polygon, DSN::T_rect, DSN::T_region_class, DSN::T_region_class_class, DSN::T_region_net, DSN::T_RIGHT, DSN::T_rule, and DSNLEXER::Unexpected().

Referenced by doPLACE(), and doSTRUCTURE().

1512 {
1513  T tok = NextTok();
1514 
1515  if( IsSymbol(tok) )
1516  {
1517  growth->region_id = CurText();
1518  tok = NextTok();
1519  }
1520 
1521  for(;;)
1522  {
1523  if( tok != T_LEFT )
1524  Expecting( T_LEFT );
1525 
1526  tok = NextTok();
1527  switch( tok )
1528  {
1529  case T_rect:
1530  if( growth->rectangle )
1531  Unexpected( tok );
1532  growth->rectangle = new RECTANGLE( growth );
1533  doRECTANGLE( growth->rectangle );
1534  break;
1535 
1536  case T_polygon:
1537  if( growth->polygon )
1538  Unexpected( tok );
1539  growth->polygon = new PATH( growth, T_polygon );
1540  doPATH( growth->polygon );
1541  break;
1542 
1543  case T_region_net:
1544  case T_region_class:
1545  STRINGPROP* stringprop;
1546  stringprop = new STRINGPROP( growth, tok );
1547  growth->Append( stringprop );
1548  doSTRINGPROP( stringprop );
1549  break;
1550 
1551  case T_region_class_class:
1552  CLASS_CLASS* class_class;
1553  class_class = new CLASS_CLASS( growth, tok );
1554  growth->Append( class_class );
1555  doCLASS_CLASS( class_class );
1556  break;
1557 
1558  case T_rule:
1559  if( growth->rules )
1560  Unexpected( tok );
1561  growth->rules = new RULE( growth, T_rule );
1562  doRULE( growth->rules );
1563  break;
1564 
1565  default:
1566  Unexpected( CurText() );
1567  }
1568 
1569  tok = NextTok();
1570  if( tok == T_RIGHT )
1571  {
1572  if( !growth->rules )
1573  Expecting( T_rule );
1574  break;
1575  }
1576  }
1577 }
void doCLASS_CLASS(CLASS_CLASS *growth)
Definition: specctra.cpp:1580
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void doPATH(PATH *growth)
Definition: specctra.cpp:1012
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1060
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doSTRINGPROP(STRINGPROP *growth)
Definition: specctra.cpp:1137
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doRESOLUTION ( UNIT_RES growth)
private

Definition at line 526 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::T_cm, DSN::T_inch, DSN::T_mil, DSN::T_mm, DSN::T_NUMBER, DSN::T_um, DSN::UNIT_RES::units, and DSN::UNIT_RES::value.

Referenced by doPCB(), doPLACEMENT(), doROUTE(), doSTRUCTURE(), and doWIRING().

527 {
528  T tok = NextTok();
529 
530  switch( tok )
531  {
532  case T_inch:
533  case T_mil:
534  case T_cm:
535  case T_mm:
536  case T_um:
537  growth->units = tok;
538  break;
539  default:
540  Expecting( "inch|mil|cm|mm|um" );
541  }
542 
543  tok = NextTok();
544  if( tok != T_NUMBER )
545  Expecting( T_NUMBER );
546 
547  growth->value = atoi( CurText() );
548 
549  NeedRIGHT();
550 }
T
enum T contains all this lexer's tokens.
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doROUTE ( ROUTE growth)
private

Definition at line 3251 of file specctra.cpp.

References DSNLEXER::CurText(), doLIBRARY(), doNET_OUT(), doPARSER(), doRESOLUTION(), doSTRUCTURE_OUT(), DSNLEXER::Expecting(), DSN::ROUTE::library, DSN::ROUTE::net_outs, SPECCTRA_LEXER::NextTok(), DSN::ROUTE::parser, DSN::ROUTE::resolution, DSN::ROUTE::structure_out, DSN::T_LEFT, DSN::T_library_out, DSN::T_net, DSN::T_network_out, DSN::T_parser, DSN::T_resolution, DSN::T_RIGHT, DSN::T_structure_out, and DSNLEXER::Unexpected().

Referenced by doSESSION().

3252 {
3253  T tok;
3254 
3255  /* <route_descriptor >::=
3256  (routes
3257  <resolution_descriptor>
3258  <parser_descriptor>
3259  <structure_out_descriptor>
3260  <library_out_descriptor>
3261  <network_out_descriptor>
3262  <test_points_descriptor>
3263  )
3264  */
3265 
3266  while( (tok = NextTok()) != T_RIGHT )
3267  {
3268  if( tok != T_LEFT )
3269  Expecting( T_LEFT );
3270 
3271  tok = NextTok();
3272  switch( tok )
3273  {
3274  case T_resolution:
3275  if( growth->resolution )
3276  Unexpected( tok );
3277  growth->resolution = new UNIT_RES( growth, tok );
3278  doRESOLUTION( growth->resolution );
3279  break;
3280 
3281  case T_parser:
3282  if( growth->parser )
3283  {
3284 #if 0 // Electra 2.9.1 emits two (parser ) elements in a row.
3285  // Work around their bug for now.
3286  Unexpected( tok );
3287 #else
3288  delete growth->parser;
3289 #endif
3290  }
3291  growth->parser = new PARSER( growth );
3292  doPARSER( growth->parser );
3293  break;
3294 
3295  case T_structure_out:
3296  if( growth->structure_out )
3297  Unexpected( tok );
3298  growth->structure_out = new STRUCTURE_OUT( growth );
3299  doSTRUCTURE_OUT( growth->structure_out );
3300  break;
3301 
3302  case T_library_out:
3303  if( growth->library )
3304  Unexpected( tok );
3305  growth->library = new LIBRARY( growth, tok );
3306  doLIBRARY( growth->library );
3307  break;
3308 
3309  case T_network_out:
3310  while( (tok = NextTok()) != T_RIGHT )
3311  {
3312  if( tok != T_LEFT )
3313  Expecting( T_LEFT );
3314 
3315  tok = NextTok();
3316  if( tok != T_net ) // it is class NET_OUT, but token T_net
3317  Unexpected( CurText() );
3318 
3319  NET_OUT* net_out;
3320  net_out = new NET_OUT( growth );
3321 
3322  growth->net_outs.push_back( net_out );
3323  doNET_OUT( net_out );
3324  }
3325  break;
3326 
3327  default:
3328  Unexpected( CurText() );
3329  }
3330  }
3331 }
T
enum T contains all this lexer's tokens.
void doSTRUCTURE_OUT(STRUCTURE_OUT *growth)
Definition: specctra.cpp:744
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doLIBRARY(LIBRARY *growth)
Definition: specctra.cpp:2266
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doNET_OUT(NET_OUT *growth)
Definition: specctra.cpp:3334
void doPARSER(PARSER *growth)
Definition: specctra.cpp:387
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doRULE ( RULE growth)
private

Definition at line 1379 of file specctra.cpp.

References DSNLEXER::CurText(), SPECCTRA_LEXER::NextTok(), SPECCTRA_LEXER::PrevTok(), quote_char, DSN::RULE::rules, DSN::T_EOF, DSN::T_LEFT, DSN::T_NONE, DSN::T_RIGHT, DSN::T_STRING, and DSNLEXER::Unexpected().

Referenced by doCLASS(), doCLASS_CLASS(), doFROMTO(), doIMAGE(), doKEEPOUT(), doLAYER(), doLAYER_RULE(), doNET(), doNET_OUT(), doPADSTACK(), doPLACE(), doREGION(), doSTRUCTURE(), and doSTRUCTURE_OUT().

1380 {
1381  std::string builder;
1382  int bracketNesting = 1; // we already saw the opening T_LEFT
1383  T tok = T_NONE;
1384 
1385  while( bracketNesting!=0 && tok!=T_EOF )
1386  {
1387  tok = NextTok();
1388 
1389  if( tok==T_LEFT)
1390  ++bracketNesting;
1391 
1392  else if( tok==T_RIGHT )
1393  --bracketNesting;
1394 
1395  if( bracketNesting >= 1 )
1396  {
1397  if( PrevTok()!=T_LEFT && tok!=T_RIGHT && (tok!=T_LEFT || bracketNesting>2) )
1398  builder += ' ';
1399 
1400  if( tok==T_STRING )
1401  builder += quote_char;
1402 
1403  builder += CurText();
1404 
1405  if( tok==T_STRING )
1406  builder += quote_char;
1407  }
1408 
1409  // When the nested rule is closed with a T_RIGHT and we are back down
1410  // to bracketNesting == 1, (inside the <rule_descriptor> but outside
1411  // the last rule). Then save the last rule and clear the string builder.
1412  if( bracketNesting == 1 )
1413  {
1414  growth->rules.push_back( builder );
1415  builder.clear();
1416  }
1417  }
1418 
1419  if( tok==T_EOF )
1420  Unexpected( T_EOF );
1421 }
DSN::T PrevTok()
Function PrevTok returns whatever NextTok() returned the 2nd to last time it was called.
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
std::string quote_char
Definition: specctra.h:3616
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doSESSION ( SESSION growth)
private

Definition at line 3133 of file specctra.cpp.

References DSN::SESSION::base_design, DSNLEXER::CurText(), doHISTORY(), doPLACEMENT(), doROUTE(), doSTRUCTURE(), doWAS_IS(), DSNLEXER::Expecting(), DSN::SESSION::history, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::SESSION::placement, DSN::SESSION::route, DSN::SESSION::session_id, DSN::SESSION::structure, DSN::T_base_design, DSN::T_history, DSN::T_LEFT, DSN::T_placement, DSN::T_RIGHT, DSN::T_routes, DSN::T_structure, DSN::T_was_is, DSNLEXER::Unexpected(), and DSN::SESSION::was_is.

Referenced by LoadSESSION().

3134 {
3135  T tok;
3136 
3137  /* <session_file_descriptor >::=
3138  (session <session_id >
3139  (base_design <path/filename >)
3140  [<history_descriptor> ]
3141  [<session_structure_descriptor> ]
3142  [<placement_descriptor> ]
3143  [<floor_plan_descriptor> ]
3144  [<net_pin_changes_descriptor> ]
3145  [<was_is_descriptor> ]
3146  <swap_history_descriptor> ]
3147  [<route_descriptor> ]
3148  )
3149  */
3150 
3151  NeedSYMBOL();
3152  growth->session_id = CurText();
3153 
3154  while( (tok = NextTok()) != T_RIGHT )
3155  {
3156  if( tok != T_LEFT )
3157  Expecting( T_LEFT );
3158 
3159  tok = NextTok();
3160  switch( tok )
3161  {
3162  case T_base_design:
3163  NeedSYMBOL();
3164  growth->base_design = CurText();
3165  NeedRIGHT();
3166  break;
3167 
3168  case T_history:
3169  if( growth->history )
3170  Unexpected( tok );
3171  growth->history = new HISTORY( growth );
3172  doHISTORY( growth->history );
3173  break;
3174 
3175  case T_structure:
3176  if( growth->structure )
3177  Unexpected( tok );
3178  growth->structure = new STRUCTURE( growth );
3179  doSTRUCTURE( growth->structure );
3180  break;
3181 
3182  case T_placement:
3183  if( growth->placement )
3184  Unexpected( tok );
3185  growth->placement = new PLACEMENT( growth );
3186  doPLACEMENT( growth->placement );
3187  break;
3188 
3189  case T_was_is:
3190  if( growth->was_is )
3191  Unexpected( tok );
3192  growth->was_is = new WAS_IS( growth );
3193  doWAS_IS( growth->was_is );
3194  break;
3195 
3196  case T_routes:
3197  if( growth->route )
3198  Unexpected( tok );
3199  growth->route = new ROUTE( growth );
3200  doROUTE( growth->route );
3201  break;
3202 
3203  default:
3204  Unexpected( CurText() );
3205  }
3206  }
3207 }
T
enum T contains all this lexer's tokens.
void doROUTE(ROUTE *growth)
Definition: specctra.cpp:3251
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doHISTORY(HISTORY *growth)
Definition: specctra.cpp:3077
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doSTRUCTURE(STRUCTURE *growth)
Definition: specctra.cpp:610
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void doPLACEMENT(PLACEMENT *growth)
Definition: specctra.cpp:1883
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doWAS_IS(WAS_IS *growth)
Definition: specctra.cpp:3210
void DSN::SPECCTRA_DB::doSHAPE ( SHAPE growth)
private

Definition at line 2038 of file specctra.cpp.

References DSN::SHAPE::connect, DSNLEXER::CurText(), doCIRCLE(), doPATH(), doQARC(), doRECTANGLE(), doWINDOW(), DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::WINDOW::shape, DSN::T_circle, DSN::T_connect, DSN::T_LEFT, DSN::T_off, DSN::T_on, DSN::T_path, DSN::T_polygon, DSN::T_polyline_path, DSN::T_qarc, DSN::T_rect, DSN::T_RIGHT, DSN::T_window, DSNLEXER::Unexpected(), and DSN::SHAPE::windows.

Referenced by doIMAGE(), and doPADSTACK().

2039 {
2040  T tok;
2041 
2042  /* (shape <shape_descriptor>
2043  [<reduced_shape_descriptor> ]
2044  [(connect [on | off])]
2045  [{<window_descriptor> }])
2046  */
2047 
2048  while( (tok = NextTok()) != T_RIGHT )
2049  {
2050  if( tok != T_LEFT )
2051  Expecting( T_LEFT );
2052 
2053  tok = NextTok();
2054  switch( tok )
2055  {
2056  case T_polyline_path:
2057  tok = T_path;
2058  // Fall through
2059  case T_rect:
2060  case T_circle:
2061  case T_path:
2062  case T_polygon:
2063  case T_qarc:
2064 L_done_that:
2065  if( growth->shape )
2066  Unexpected( tok );
2067  break;
2068 
2069  default:
2070  // the example in the spec uses "circ" instead of "circle". Bad!
2071  if( !strcmp( "circ", CurText() ) )
2072  {
2073  tok = T_circle;
2074  goto L_done_that;
2075  }
2076  }
2077 
2078  switch( tok )
2079  {
2080  case T_rect:
2081  growth->shape = new RECTANGLE( growth );
2082  doRECTANGLE( (RECTANGLE*) growth->shape );
2083  break;
2084 
2085  case T_circle:
2086  growth->shape = new CIRCLE( growth );
2087  doCIRCLE( (CIRCLE*)growth->shape );
2088  break;
2089 
2090  case T_path:
2091  case T_polygon:
2092  growth->shape = new PATH( growth, tok );
2093  doPATH( (PATH*)growth->shape );
2094  break;
2095 
2096  case T_qarc:
2097  growth->shape = new QARC( growth );
2098  doQARC( (QARC*)growth->shape );
2099  break;
2100 
2101  case T_connect:
2102  tok = NextTok();
2103  if( tok!=T_on && tok!=T_off )
2104  Expecting( "on|off" );
2105  growth->connect = tok;
2106  NeedRIGHT();
2107  break;
2108 
2109  case T_window:
2110  WINDOW* window;
2111  window = new WINDOW( growth );
2112  growth->windows.push_back( window );
2113  doWINDOW( window );
2114  break;
2115 
2116  default:
2117  Unexpected( CurText() );
2118  }
2119  }
2120 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doWINDOW(WINDOW *growth)
Definition: specctra.cpp:912
void doPATH(PATH *growth)
Definition: specctra.cpp:1012
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1060
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1085
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
void doQARC(QARC *growth)
Definition: specctra.cpp:1113
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doSPECCTRA_LAYER_PAIR ( SPECCTRA_LAYER_PAIR growth)
private

Definition at line 574 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSN::SPECCTRA_LAYER_PAIR::layer_id0, DSN::SPECCTRA_LAYER_PAIR::layer_id1, DSN::SPECCTRA_LAYER_PAIR::layer_weight, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), and DSN::T_NUMBER.

Referenced by doLAYER_NOISE_WEIGHT().

575 {
576  NeedSYMBOL();
577  growth->layer_id0 = CurText();
578 
579  NeedSYMBOL();
580  growth->layer_id1 = CurText();
581 
582  if( NextTok() != T_NUMBER )
583  Expecting( T_NUMBER );
584  growth->layer_weight = strtod( CurText(), 0 );
585 
586  NeedRIGHT();
587 }
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doSTRINGPROP ( STRINGPROP growth)
private

Definition at line 1137 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), and DSN::STRINGPROP::value.

Referenced by doREGION(), and doSTRUCTURE().

1138 {
1139  NeedSYMBOL();
1140  growth->value = CurText();
1141  NeedRIGHT();
1142 }
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doSTRUCTURE ( STRUCTURE growth)
private

Definition at line 610 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), DSN::STRUCTURE::boundary, DSN::STRUCTURE::control, DSNLEXER::CurText(), doBOUNDARY(), doCONTROL(), doGRID(), doKEEPOUT(), doLAYER(), doLAYER_NOISE_WEIGHT(), doREGION(), doRESOLUTION(), doRULE(), doSTRINGPROP(), doUNIT(), doVIA(), DSNLEXER::Expecting(), DSN::STRUCTURE::grids, DSN::STRUCTURE::keepouts, LAYER, DSN::STRUCTURE::layer_noise_weight, DSN::STRUCTURE::layers, SPECCTRA_LEXER::NextTok(), DSN::STRUCTURE::place_boundary, DSN::STRUCTURE::place_rules, DSN::STRUCTURE::planes, DSN::STRUCTURE::regions, DSN::STRUCTURE::rules, DSN::T_bend_keepout, DSN::T_boundary, DSN::T_control, DSN::T_elongate_keepout, DSN::T_grid, DSN::T_keepout, DSN::T_layer, DSN::T_layer_noise_weight, DSN::T_LEFT, DSN::T_place_boundary, DSN::T_place_keepout, DSN::T_place_rule, DSN::T_plane, DSN::T_region, DSN::T_resolution, DSN::T_RIGHT, DSN::T_rule, DSN::T_snap_angle, DSN::T_unit, DSN::T_via, DSN::T_via_keepout, DSN::T_wire_keepout, DSNLEXER::Unexpected(), DSN::STRUCTURE::unit, VIA, and DSN::STRUCTURE::via.

Referenced by doPCB(), and doSESSION().

611 {
612  T tok;
613 
614  while( (tok = NextTok()) != T_RIGHT )
615  {
616  if( tok != T_LEFT )
617  Expecting( T_LEFT );
618 
619  tok = NextTok();
620  switch( tok )
621  {
622  case T_unit:
623  if( growth->unit )
624  Unexpected( tok );
625  growth->unit = new UNIT_RES( growth, tok );
626  doUNIT( growth->unit );
627  break;
628 
629  case T_resolution:
630  if( growth->unit )
631  Unexpected( tok );
632  growth->unit = new UNIT_RES( growth, tok );
633  doRESOLUTION( growth->unit );
634  break;
635 
637  if( growth->layer_noise_weight )
638  Unexpected( tok );
639  growth->layer_noise_weight = new LAYER_NOISE_WEIGHT( growth );
640  doLAYER_NOISE_WEIGHT( growth->layer_noise_weight );
641  break;
642 
643  case T_place_boundary:
644 L_place:
645  if( growth->place_boundary )
646  Unexpected( tok );
647  growth->place_boundary = new BOUNDARY( growth, T_place_boundary );
648  doBOUNDARY( growth->place_boundary );
649  break;
650 
651  case T_boundary:
652  if( growth->boundary )
653  {
654  if( growth->place_boundary )
655  Unexpected( tok );
656  goto L_place;
657  }
658  growth->boundary = new BOUNDARY( growth );
659  doBOUNDARY( growth->boundary );
660  break;
661 
662  case T_plane:
663  COPPER_PLANE* plane;
664  plane = new COPPER_PLANE( growth );
665  growth->planes.push_back( plane );
666  doKEEPOUT( plane );
667  break;
668 
669  case T_region:
670  REGION* region;
671  region = new REGION( growth );
672  growth->regions.push_back( region );
673  doREGION( region );
674  break;
675 
676  case T_snap_angle:
677  STRINGPROP* stringprop;
678  stringprop = new STRINGPROP( growth, T_snap_angle );
679  growth->Append( stringprop );
680  doSTRINGPROP( stringprop );
681  break;
682 
683  case T_via:
684  if( growth->via )
685  Unexpected( tok );
686  growth->via = new VIA( growth );
687  doVIA( growth->via );
688  break;
689 
690  case T_control:
691  if( growth->control )
692  Unexpected( tok );
693  growth->control = new CONTROL( growth );
694  doCONTROL( growth->control );
695  break;
696 
697  case T_layer:
698  LAYER* layer;
699  layer = new LAYER( growth );
700  growth->layers.push_back( layer );
701  doLAYER( layer );
702  break;
703 
704  case T_rule:
705  if( growth->rules )
706  Unexpected( tok );
707  growth->rules = new RULE( growth, T_rule );
708  doRULE( growth->rules );
709  break;
710 
711  case T_place_rule:
712  if( growth->place_rules )
713  Unexpected( tok );
714  growth->place_rules = new RULE( growth, T_place_rule );
715  doRULE( growth->place_rules );
716  break;
717 
718  case T_keepout:
719  case T_place_keepout:
720  case T_via_keepout:
721  case T_wire_keepout:
722  case T_bend_keepout:
723  case T_elongate_keepout:
724  KEEPOUT* keepout;
725  keepout = new KEEPOUT( growth, tok );
726  growth->keepouts.push_back( keepout );
727  doKEEPOUT( keepout );
728  break;
729 
730  case T_grid:
731  GRID* grid;
732  grid = new GRID( growth );
733  growth->grids.push_back( grid );
734  doGRID( grid );
735  break;
736 
737  default:
738  Unexpected( CurText() );
739  }
740  }
741 }
void doLAYER_NOISE_WEIGHT(LAYER_NOISE_WEIGHT *growth)
Definition: specctra.cpp:590
void doKEEPOUT(KEEPOUT *growth)
Definition: specctra.cpp:787
void doGRID(GRID *growth)
Definition: specctra.cpp:1648
Definition: hash_eda.h:42
void doCONTROL(CONTROL *growth)
Definition: specctra.cpp:1187
T
enum T contains all this lexer's tokens.
void doLAYER(LAYER *growth)
Definition: specctra.cpp:1257
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doVIA(VIA *growth)
Definition: specctra.cpp:1158
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doREGION(REGION *growth)
Definition: specctra.cpp:1511
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doSTRINGPROP(STRINGPROP *growth)
Definition: specctra.cpp:1137
Class LAYER holds information pertinent to a layer of a BOARD.
Definition: class_board.h:85
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void doBOUNDARY(BOUNDARY *growth)
Definition: specctra.cpp:965
void DSN::SPECCTRA_DB::doSTRUCTURE_OUT ( STRUCTURE_OUT growth)
private

Definition at line 744 of file specctra.cpp.

References DSNLEXER::CurText(), doLAYER(), doRULE(), DSNLEXER::Expecting(), LAYER, DSN::STRUCTURE_OUT::layers, SPECCTRA_LEXER::NextTok(), DSN::STRUCTURE_OUT::rules, DSN::T_layer, DSN::T_LEFT, DSN::T_RIGHT, DSN::T_rule, and DSNLEXER::Unexpected().

Referenced by doROUTE().

745 {
746  /*
747  <structure_out_descriptor >::=
748  (structure_out
749  {<layer_descriptor> }
750  [<rule_descriptor> ]
751  )
752  */
753 
754  T tok = NextTok();
755 
756  while( tok != T_RIGHT )
757  {
758  if( tok != T_LEFT )
759  Expecting( T_LEFT );
760 
761  tok = NextTok();
762  switch( tok )
763  {
764  case T_layer:
765  LAYER* layer;
766  layer = new LAYER( growth );
767  growth->layers.push_back( layer );
768  doLAYER( layer );
769  break;
770 
771  case T_rule:
772  if( growth->rules )
773  Unexpected( tok );
774  growth->rules = new RULE( growth, T_rule );
775  doRULE( growth->rules );
776  break;
777 
778  default:
779  Unexpected( CurText() );
780  }
781 
782  tok = NextTok();
783  }
784 }
Definition: hash_eda.h:42
T
enum T contains all this lexer's tokens.
void doLAYER(LAYER *growth)
Definition: specctra.cpp:1257
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
Class LAYER holds information pertinent to a layer of a BOARD.
Definition: class_board.h:85
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doSUPPLY_PIN ( SUPPLY_PIN growth)
private

Definition at line 3402 of file specctra.cpp.

References DSN::PIN_REF::component_id, DSNLEXER::CurText(), empty(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), DSN::SUPPLY_PIN::net_id, SPECCTRA_LEXER::NextTok(), DSN::PIN_REF::pin_id, DSN::SUPPLY_PIN::pin_refs, readCOMPnPIN(), DSN::T_LEFT, DSN::T_net, DSN::T_RIGHT, and DSNLEXER::Unexpected().

Referenced by doNET_OUT().

3403 {
3404  T tok;
3405  PIN_REF empty(growth);
3406 
3407  /* <supply_pin_descriptor >::=
3408  (supply_pin {<pin_reference> } [(net <net_id >)])
3409  */
3410 
3411  NeedSYMBOL();
3412  growth->net_id = CurText();
3413 
3414  while( (tok = NextTok()) != T_RIGHT )
3415  {
3416  if( IsSymbol(tok) )
3417  {
3418  growth->pin_refs.push_back( empty );
3419 
3420  PIN_REF* pin_ref = &growth->pin_refs.back();
3421 
3422  readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
3423  }
3424  else if( tok == T_LEFT )
3425  {
3426  tok = NextTok();
3427  if( tok != T_net )
3428  Expecting( T_net );
3429  growth->net_id = CurText();
3430  NeedRIGHT();
3431  }
3432  else
3433  Unexpected( CurText() );
3434  }
3435 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Function readCOMPnPIN reads a and splits it into the two parts which are on either si...
Definition: specctra.cpp:134
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
static bool empty(const wxTextEntryBase *aCtrl)
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doTOKPROP ( TOKPROP growth)
private

Definition at line 1145 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSNLEXER::Unexpected(), and DSN::TOKPROP::value.

Referenced by doCONTROL().

1146 {
1147  T tok = NextTok();
1148 
1149  if( tok<0 )
1150  Unexpected( CurText() );
1151 
1152  growth->value = tok;
1153 
1154  NeedRIGHT();
1155 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doTOPOLOGY ( TOPOLOGY growth)
private

Definition at line 2460 of file specctra.cpp.

References DSN::TOPOLOGY::comp_orders, DSNLEXER::CurText(), doCOMP_ORDER(), doFROMTO(), DSNLEXER::Expecting(), DSN::TOPOLOGY::fromtos, SPECCTRA_LEXER::NextTok(), DSN::T_comp_order, DSN::T_fromto, DSN::T_LEFT, DSN::T_RIGHT, and DSNLEXER::Unexpected().

Referenced by doCLASS().

2461 {
2462  T tok;
2463 
2464  /* <topology_descriptor >::=
2465  (topology {[<fromto_descriptor> |
2466  <component_order_descriptor> ]})
2467  */
2468 
2469  while( (tok = NextTok()) != T_RIGHT )
2470  {
2471  if( tok != T_LEFT )
2472  Expecting( T_LEFT );
2473 
2474  tok = NextTok();
2475  switch( tok )
2476  {
2477  case T_fromto:
2478  FROMTO* fromto;
2479  fromto = new FROMTO( growth );
2480  growth->fromtos.push_back( fromto );
2481  doFROMTO( fromto );
2482  break;
2483 
2484  case T_comp_order:
2485  COMP_ORDER* comp_order;
2486  comp_order = new COMP_ORDER( growth );
2487  growth->comp_orders.push_back( comp_order );
2488  doCOMP_ORDER( comp_order );
2489  break;
2490 
2491  default:
2492  Unexpected( CurText() );
2493  }
2494  }
2495 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void doCOMP_ORDER(COMP_ORDER *growth)
Definition: specctra.cpp:2653
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void doFROMTO(FROMTO *growth)
Definition: specctra.cpp:2671
void DSN::SPECCTRA_DB::doUNIT ( UNIT_RES growth)
private

Definition at line 553 of file specctra.cpp.

References DSNLEXER::Expecting(), DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NextTok(), DSN::T_cm, DSN::T_inch, DSN::T_mil, DSN::T_mm, DSN::T_um, and DSN::UNIT_RES::units.

Referenced by doIMAGE(), doLIBRARY(), doPADSTACK(), doPCB(), doPLACEMENT(), doSTRUCTURE(), and doWIRING().

554 {
555  T tok = NextTok();
556 
557  switch( tok )
558  {
559  case T_inch:
560  case T_mil:
561  case T_cm:
562  case T_mm:
563  case T_um:
564  growth->units = tok;
565  break;
566  default:
567  Expecting( "inch|mil|cm|mm|um" );
568  }
569 
570  NeedRIGHT();
571 }
T
enum T contains all this lexer's tokens.
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
void DSN::SPECCTRA_DB::doVIA ( VIA growth)
private

Definition at line 1158 of file specctra.cpp.

References DSNLEXER::CurText(), DSNLEXER::Expecting(), DSNLEXER::IsSymbol(), SPECCTRA_LEXER::NextTok(), DSN::VIA::padstacks, DSN::VIA::spares, DSN::T_LEFT, DSN::T_RIGHT, DSN::T_spare, DSN::T_SYMBOL, and DSNLEXER::Unexpected().

Referenced by doSTRUCTURE().

1159 {
1160  T tok;
1161 
1162  while( (tok = NextTok()) != T_RIGHT )
1163  {
1164  if( tok == T_LEFT )
1165  {
1166  if( NextTok() != T_spare )
1167  Expecting( T_spare );
1168 
1169  while( (tok = NextTok()) != T_RIGHT )
1170  {
1171  if( !IsSymbol( tok ) )
1172  Expecting( T_SYMBOL );
1173 
1174  growth->spares.push_back( CurText() );
1175  }
1176  }
1177  else if( IsSymbol( tok ) )
1178  {
1179  growth->padstacks.push_back( CurText() );
1180  }
1181  else
1182  Unexpected( CurText() );
1183  }
1184 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:344
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doWAS_IS ( WAS_IS growth)
private

Definition at line 3210 of file specctra.cpp.

References DSN::PIN_REF::component_id, DSNLEXER::CurText(), empty(), DSNLEXER::Expecting(), DSN::PIN_PAIR::is, DSNLEXER::NeedRIGHT(), SPECCTRA_LEXER::NeedSYMBOL(), SPECCTRA_LEXER::NextTok(), DSN::PIN_REF::pin_id, DSN::WAS_IS::pin_pairs, readCOMPnPIN(), DSN::T_LEFT, DSN::T_pins, DSN::T_RIGHT, DSNLEXER::Unexpected(), and DSN::PIN_PAIR::was.

Referenced by doSESSION().

3211 {
3212  T tok;
3213  PIN_PAIR empty( growth );
3214  PIN_PAIR* pin_pair;
3215 
3216  /* <was_is_descriptor >::=
3217  (was_is {(pins <pin_reference> <pin_reference> )})
3218  */
3219 
3220  // none of the pins is ok too
3221  while( (tok = NextTok()) != T_RIGHT )
3222  {
3223 
3224  if( tok != T_LEFT )
3225  Expecting( T_LEFT );
3226 
3227  tok = NextTok();
3228  switch( tok )
3229  {
3230  case T_pins:
3231  // copy the empty one, then fill its copy later thru pin_pair.
3232  growth->pin_pairs.push_back( empty );
3233  pin_pair= &growth->pin_pairs.back();
3234 
3235  NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
3236  readCOMPnPIN( &pin_pair->was.component_id, &pin_pair->was.pin_id );
3237 
3238  NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
3239  readCOMPnPIN( &pin_pair->is.component_id, &pin_pair->is.pin_id );
3240 
3241  NeedRIGHT();
3242  break;
3243 
3244  default:
3245  Unexpected( CurText() );
3246  }
3247  }
3248 }
T
enum T contains all this lexer's tokens.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Function readCOMPnPIN reads a and splits it into the two parts which are on either si...
Definition: specctra.cpp:134
DSN::T NeedSYMBOL()
Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(...
static bool empty(const wxTextEntryBase *aCtrl)