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) throw ( IO_ERROR, boost::bad_pointer )
 Function LoadPCB is a recursive descent parser for a SPECCTRA DSN "design" file. More...
 
void LoadSESSION (const wxString &aFilename) throw ( IO_ERROR, boost::bad_pointer )
 Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file. More...
 
void ExportPCB (wxString aFilename, bool aNameChange=false) throw ( IO_ERROR )
 Function ExportPCB writes the internal PCB instance out as a SPECTRA DSN format file. More...
 
void FromBOARD (BOARD *aBoard) throw ( IO_ERROR, boost::bad_ptr_container_operation )
 Function FromBOARD adds the entire BOARD to the PCB but does not write it out. More...
 
void FromSESSION (BOARD *aBoard) throw ( IO_ERROR )
 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 () throw ( IO_ERROR )
 Function NextTok returns the next token found in the input file or T_EOF when reaching the end of file. More...
 
DSN::T NeedSYMBOL () throw ( IO_ERROR )
 Function NeedSYMBOL calls NextTok() and then verifies that the token read in satisfies bool IsSymbol(). More...
 
DSN::T NeedSYMBOLorNUMBER () throw ( IO_ERROR )
 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) throw ( IO_ERROR )
 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 () throw ( IO_ERROR )
 Function ReadCommentLines checks the next sequence of tokens and reads them into a wxArrayString if they are comments. More...
 
void Expecting (int aTok) throw ( IO_ERROR )
 Function Expecting throws an IO_ERROR exception with an input file specific error message. More...
 
void Expecting (const char *aTokenList) throw ( IO_ERROR )
 Function Expecting throws an IO_ERROR exception with an input file specific error message. More...
 
void Unexpected (int aTok) throw ( IO_ERROR )
 Function Unexpected throws an IO_ERROR exception with an input file specific error message. More...
 
void Unexpected (const char *aToken) throw ( IO_ERROR )
 Function Unexpected throws an IO_ERROR exception with an input file specific error message. More...
 
void Duplicate (int aTok) throw ( IO_ERROR )
 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 () throw ( IO_ERROR )
 Function NeedLEFT calls NextTok() and then verifies that the token read in is a DSN_LEFT. More...
 
void NeedRIGHT () throw ( IO_ERROR )
 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 () throw ( IO_ERROR )
 
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) throw ( IO_ERROR )
 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) throw ( IO_ERROR )
 Function readTIME reads a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : second year". More...
 
void doPCB (PCB *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doPARSER (PARSER *growth) throw ( IO_ERROR )
 
void doRESOLUTION (UNIT_RES *growth) throw ( IO_ERROR )
 
void doUNIT (UNIT_RES *growth) throw ( IO_ERROR )
 
void doSTRUCTURE (STRUCTURE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doSTRUCTURE_OUT (STRUCTURE_OUT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doLAYER_NOISE_WEIGHT (LAYER_NOISE_WEIGHT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doSPECCTRA_LAYER_PAIR (SPECCTRA_LAYER_PAIR *growth) throw ( IO_ERROR )
 
void doBOUNDARY (BOUNDARY *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doRECTANGLE (RECTANGLE *growth) throw ( IO_ERROR )
 
void doPATH (PATH *growth) throw ( IO_ERROR )
 
void doSTRINGPROP (STRINGPROP *growth) throw ( IO_ERROR )
 
void doTOKPROP (TOKPROP *growth) throw ( IO_ERROR )
 
void doVIA (VIA *growth) throw ( IO_ERROR )
 
void doCONTROL (CONTROL *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doLAYER (LAYER *growth) throw ( IO_ERROR )
 
void doRULE (RULE *growth) throw ( IO_ERROR )
 
void doKEEPOUT (KEEPOUT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doCIRCLE (CIRCLE *growth) throw ( IO_ERROR )
 
void doQARC (QARC *growth) throw ( IO_ERROR )
 
void doWINDOW (WINDOW *growth) throw ( IO_ERROR )
 
void doCONNECT (CONNECT *growth) throw ( IO_ERROR )
 
void doREGION (REGION *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doCLASS_CLASS (CLASS_CLASS *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doLAYER_RULE (LAYER_RULE *growth) throw ( IO_ERROR )
 
void doCLASSES (CLASSES *growth) throw ( IO_ERROR )
 
void doGRID (GRID *growth) throw ( IO_ERROR )
 
void doPLACE (PLACE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doCOMPONENT (COMPONENT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doPLACEMENT (PLACEMENT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doPROPERTIES (PROPERTIES *growth) throw ( IO_ERROR )
 
void doPADSTACK (PADSTACK *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doSHAPE (SHAPE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doIMAGE (IMAGE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doLIBRARY (LIBRARY *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doPIN (PIN *growth) throw ( IO_ERROR )
 
void doNET (NET *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doNETWORK (NETWORK *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doCLASS (CLASS *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doTOPOLOGY (TOPOLOGY *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doFROMTO (FROMTO *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doCOMP_ORDER (COMP_ORDER *growth) throw ( IO_ERROR )
 
void doWIRE (WIRE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doWIRE_VIA (WIRE_VIA *growth) throw ( IO_ERROR )
 
void doWIRING (WIRING *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doSESSION (SESSION *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doANCESTOR (ANCESTOR *growth) throw ( IO_ERROR )
 
void doHISTORY (HISTORY *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doROUTE (ROUTE *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doWAS_IS (WAS_IS *growth) throw ( IO_ERROR )
 
void doNET_OUT (NET_OUT *growth) throw ( IO_ERROR, boost::bad_pointer )
 
void doSUPPLY_PIN (SUPPLY_PIN *growth) throw ( IO_ERROR )
 
void fillBOUNDARY (BOARD *aBoard, BOUNDARY *aBoundary) throw ( IO_ERROR, boost::bad_pointer )
 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) throw ( IO_ERROR )
 Function makeTRACK creates a TRACK form the PATH and BOARD info. More...
 
::VIAmakeVIA (PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault) throw ( IO_ERROR )
 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< 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 3604 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 3843 of file specctra.h.

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

3843  :
3844  SPECCTRA_LEXER( 0 ) // LINE_READER* == NULL, no DSNLEXER::PushReader()
3845  {
3846  // The LINE_READER will be pushed from an automatic instantiation,
3847  // we don't own it:
3848  wxASSERT( !iOwnReaders );
3849 
3850  pcb = 0;
3851  session = 0;
3852  quote_char += '"';
3853  modulesAreFlipped = false;
3854 
3855  SetSpecctraMode( true );
3856 
3857  // Avoid not initialized members:
3858  routeResolution = NULL;
3859  sessionBoard = NULL;
3860  m_top_via_layer = 0;
3861  m_bot_via_layer = 0;
3862  }
SPECCTRA_LEXER(const std::string &aSExpression, const wxString &aSource=wxEmptyString)
Constructor ( const std::string&, const wxString& )
std::string quote_char
Definition: specctra.h:3613
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:3641
SESSION * session
Definition: specctra.h:3611
bool modulesAreFlipped
Definition: specctra.h:3615
BOARD * sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3631
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3628
virtual DSN::SPECCTRA_DB::~SPECCTRA_DB ( )
inlinevirtual

Definition at line 3864 of file specctra.h.

References deleteNETs(), pcb, and session.

3865  {
3866  delete pcb;
3867  delete session;
3868 
3869  deleteNETs();
3870  }
void deleteNETs()
Function deleteNETs deletes all the NETs that may be in here.
Definition: specctra.h:3807
SESSION * session
Definition: specctra.h:3611

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().

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  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.
const wxString GetLayerName(LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
#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
std::vector< LAYER_ID > pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3625
std::vector< int > kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
Definition: specctra.h:3622
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
#define FIRST_LAYER
LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:766
STRINGS layerIds
indexed by PCB layer number
Definition: specctra.h:3619
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
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 PCB_IO::Load(), DSNLEXER::NextTok(), SYMBOL_LIB_TABLE::Parse(), and FP_LIB_TABLE::Parse().

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 PCB_IO::Load(), DSNLEXER::NextTok(), SYMBOL_LIB_TABLE::Parse(), FP_LIB_TABLE::Parse(), and KICAD_NETLIST_PARSER::parseComponent().

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 PCB_IO::Load(), DSNLEXER::NextTok(), SYMBOL_LIB_TABLE::Parse(), FP_LIB_TABLE::Parse(), and KICAD_NETLIST_PARSER::parseComponent().

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 PCB_IO::Load(), DSNLEXER::NextTok(), SYMBOL_LIB_TABLE::Parse(), FP_LIB_TABLE::Parse(), and KICAD_NETLIST_PARSER::parseComponent().

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.

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

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

Definition at line 539 of file specctra_lexer.h.

References DSNLEXER::CurTok().

540  {
541  return (DSN::T) DSNLEXER::CurTok();
542  }
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 3807 of file specctra.h.

Referenced by ~SPECCTRA_DB().

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

Definition at line 3035 of file specctra.cpp.

References DSN::T_comment, DSN::T_created_time, DSN::T_LEFT, and DSN::T_RIGHT.

3036 {
3037  T tok;
3038 
3039  /* <ancestor_file_descriptor >::=
3040  (ancestor <file_path_name> (created_time <time_stamp> )
3041  [(comment <comment_string> )])
3042  */
3043 
3044  NeedSYMBOL();
3045  growth->filename = CurText();
3046 
3047  while( (tok = NextTok()) != T_RIGHT )
3048  {
3049  if( tok != T_LEFT )
3050  Expecting( T_LEFT );
3051 
3052  tok = NextTok();
3053  switch( tok )
3054  {
3055  case T_created_time:
3056  readTIME( &growth->time_stamp );
3057  NeedRIGHT();
3058  break;
3059 
3060  case T_comment:
3061  NeedSYMBOL();
3062  growth->comment = CurText();
3063  NeedRIGHT();
3064  break;
3065 
3066  default:
3067  Unexpected( CurText() );
3068  }
3069  }
3070 }
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:370
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:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 963 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_path, DSN::T_rect, and DSN::T_RIGHT.

964 {
965  T tok = NextTok();
966 
967  if( tok != T_LEFT )
968  Expecting( T_LEFT );
969 
970  tok = NextTok();
971  if( tok == T_rect )
972  {
973  if( growth->paths.size() )
974  Unexpected( "rect when path already encountered" );
975 
976  growth->rectangle = new RECTANGLE( growth );
977  doRECTANGLE( growth->rectangle );
978  NeedRIGHT();
979  }
980  else if( tok == T_path )
981  {
982  if( growth->rectangle )
983  Unexpected( "path when rect already encountered" );
984 
985  for(;;)
986  {
987  if( tok != T_path )
988  Expecting( T_path );
989 
990  PATH* path = new PATH( growth, T_path ) ;
991  growth->paths.push_back( path );
992 
993  doPATH( path );
994 
995  tok = NextTok();
996  if( tok == T_RIGHT )
997  break;
998 
999  if( tok != T_LEFT )
1000  Expecting(T_LEFT);
1001 
1002  tok = NextTok();
1003  }
1004  }
1005  else
1006  Expecting( "rect|path" );
1007 }
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:370
void doPATH(PATH *growth)
Definition: specctra.cpp:1010
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1058
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
void DSN::SPECCTRA_DB::doCIRCLE ( CIRCLE growth)
throw (IO_ERROR
)
private

Definition at line 1083 of file specctra.cpp.

References DSN::T_NUMBER, and DSN::T_RIGHT.

1084 {
1085  T tok;
1086 
1088  growth->layer_id = CurText();
1089 
1090  if( NextTok() != T_NUMBER )
1091  Expecting( T_NUMBER );
1092  growth->diameter = strtod( CurText(), 0 );
1093 
1094  tok = NextTok();
1095  if( tok == T_NUMBER )
1096  {
1097  growth->vertex.x = strtod( CurText(), 0 );
1098 
1099  if( NextTok() != T_NUMBER )
1100  Expecting( T_NUMBER );
1101  growth->vertex.y = strtod( CurText(), 0 );
1102 
1103  tok = NextTok();
1104  }
1105 
1106  if( tok != T_RIGHT )
1107  Expecting( T_RIGHT );
1108 }
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:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2495 of file specctra.cpp.

References 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, and DSN::T_topology.

2496 {
2497  T tok;
2498 
2499  /* <class_descriptor >::=
2500  (class
2501  <class_id > {[{<net_id >} | {<composite_name_list> }]}
2502  [<circuit_descriptor> ]
2503  [<rule_descriptor> ]
2504  [{<layer_rule_descriptor> }]
2505  [<topology_descriptor> ]
2506  )
2507  */
2508 
2509  NeedSYMBOL();
2510 
2511  growth->class_id = CurText();
2512 
2513  // do net_ids, do not support <composite_name_list>s at this time
2514  while( IsSymbol(tok = NextTok()) )
2515  {
2516  growth->net_ids.push_back( CurText() );
2517  }
2518 
2519 
2520  while( tok != T_RIGHT )
2521  {
2522  if( tok != T_LEFT )
2523  Expecting( T_LEFT );
2524 
2525  tok = NextTok();
2526  switch( tok )
2527  {
2528  case T_rule:
2529  if( growth->rules )
2530  Unexpected( tok );
2531  growth->rules = new RULE( growth, T_rule );
2532  doRULE( growth->rules );
2533  break;
2534 
2535  case T_layer_rule:
2536  LAYER_RULE* layer_rule;
2537  layer_rule = new LAYER_RULE( growth );
2538  growth->layer_rules.push_back( layer_rule );
2539  doLAYER_RULE( layer_rule );
2540  break;
2541 
2542  case T_topology:
2543  if( growth->topology )
2544  Unexpected( tok );
2545  growth->topology = new TOPOLOGY( growth );
2546  doTOPOLOGY( growth->topology );
2547  break;
2548 
2549  case T_circuit: // handle all the circuit_descriptor here as strings
2550  {
2551  std::string builder;
2552  int bracketNesting = 1; // we already saw the opening T_LEFT
2553  tok = T_NONE;
2554 
2555  while( bracketNesting!=0 && tok!=T_EOF )
2556  {
2557  tok = NextTok();
2558 
2559  if( tok==T_LEFT)
2560  ++bracketNesting;
2561 
2562  else if( tok==T_RIGHT )
2563  --bracketNesting;
2564 
2565  if( bracketNesting >= 1 )
2566  {
2567  T previousTok = (T) PrevTok();
2568 
2569  if( previousTok!=T_LEFT && previousTok!=T_circuit && tok!=T_RIGHT )
2570  builder += ' ';
2571 
2572  if( tok==T_STRING )
2573  builder += quote_char;
2574 
2575  builder += CurText();
2576 
2577  if( tok==T_STRING )
2578  builder += quote_char;
2579  }
2580 
2581  // When the nested rule is closed with a T_RIGHT and we are back down
2582  // to bracketNesting == 0, then save the builder and break;
2583  if( bracketNesting == 0 )
2584  {
2585  growth->circuit.push_back( builder );
2586  break;
2587  }
2588  }
2589 
2590  if( tok==T_EOF )
2591  Unexpected( T_EOF );
2592  } // scope bracket
2593  break;
2594 
2595  default:
2596  Unexpected( CurText() );
2597  } // switch
2598 
2599  tok = NextTok();
2600 
2601  } // while
2602 }
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:370
std::string quote_char
Definition: specctra.h:3613
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:2457
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:1711
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1578 of file specctra.cpp.

References DSN::T_classes, DSN::T_layer_rule, DSN::T_LEFT, DSN::T_region_class_class, DSN::T_RIGHT, and DSN::T_rule.

1579 {
1580  T tok = NextTok();
1581 
1582  if( tok != T_LEFT )
1583  Expecting( T_LEFT );
1584 
1585  while( (tok = NextTok()) != T_RIGHT )
1586  {
1587  switch( tok )
1588  {
1589  case T_classes:
1590  if( growth->classes )
1591  Unexpected( tok );
1592  growth->classes = new CLASSES( growth );
1593  doCLASSES( growth->classes );
1594  break;
1595 
1596  case T_rule:
1597  // only T_class_class takes a T_rule
1598  if( growth->Type() == T_region_class_class )
1599  Unexpected( tok );
1600  RULE* rule;
1601  rule = new RULE( growth, T_rule );
1602  growth->Append( rule );
1603  doRULE( rule );
1604  break;
1605 
1606  case T_layer_rule:
1607  // only T_class_class takes a T_layer_rule
1608  if( growth->Type() == T_region_class_class )
1609  Unexpected( tok );
1610  LAYER_RULE* layer_rule;
1611  layer_rule = new LAYER_RULE( growth );
1612  growth->Append( layer_rule );
1613  doLAYER_RULE( layer_rule );
1614  break;
1615 
1616  default:
1617  Unexpected( tok );
1618  }
1619  }
1620 }
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
void doCLASSES(CLASSES *growth)
Definition: specctra.cpp:1623
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:1711
void DSN::SPECCTRA_DB::doCLASSES ( CLASSES growth)
throw (IO_ERROR
)
private

Definition at line 1623 of file specctra.cpp.

References DSN::T_RIGHT.

1624 {
1625  T tok = NextTok();
1626 
1627  // require at least 2 class_ids
1628 
1629  if( !IsSymbol( tok ) )
1630  Expecting( "class_id" );
1631 
1632  growth->class_ids.push_back( CurText() );
1633 
1634  do
1635  {
1636  tok = NextTok();
1637  if( !IsSymbol( tok ) )
1638  Expecting( "class_id" );
1639 
1640  growth->class_ids.push_back( CurText() );
1641 
1642  } while( (tok = NextTok()) != T_RIGHT );
1643 }
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:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw (IO_ERROR
)
private

Definition at line 2650 of file specctra.cpp.

References DSN::T_RIGHT.

2651 {
2652  T tok;
2653 
2654  /* <component_order_descriptor >::=
2655  (comp_order {<placement_id> })
2656  */
2657 
2658  while( IsSymbol(tok = NextTok()) )
2659  {
2660  growth->placement_ids.push_back( CurText() );
2661  }
2662 
2663  if( tok != T_RIGHT )
2664  Expecting( T_RIGHT );
2665 }
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:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1851 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_NUMBER, DSN::T_place, and DSN::T_RIGHT.

1852 {
1853  T tok = NextTok();
1854 
1855  if( !IsSymbol( tok ) && tok != T_NUMBER )
1856  Expecting( "image_id" );
1857  growth->image_id = CurText();
1858 
1859  while( (tok = NextTok()) != T_RIGHT )
1860  {
1861  if( tok != T_LEFT )
1862  Expecting( T_LEFT );
1863 
1864  tok = NextTok();
1865  switch( tok )
1866  {
1867  case T_place:
1868  PLACE* place;
1869  place = new PLACE( growth );
1870  growth->places.push_back( place );
1871  doPLACE( place );
1872  break;
1873 
1874  default:
1875  Unexpected(tok);
1876  }
1877  }
1878 }
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:370
void doPLACE(PLACE *growth)
Definition: specctra.cpp:1736
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw (IO_ERROR
)
private

Definition at line 876 of file specctra.cpp.

References DSN::T_EOF, DSN::T_LEFT, DSN::T_RIGHT, and DSN::T_terminal.

877 {
878  /* from page 143 of specctra spec:
879 
880  (connect
881  {(terminal <object_type> [<pin_reference> ])}
882  )
883  */
884 
885  T tok = NextTok();
886 
887  while( tok != T_RIGHT )
888  {
889  if( tok!=T_LEFT )
890  Expecting( T_LEFT );
891 
892  tok = NextTok();
893 
894  switch( tok )
895  {
896  case T_terminal:
897  // since we do not use the terminal information, simlpy toss it.
898  while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
899  ;
900  break;
901 
902  default:
903  Unexpected( CurText() );
904  }
905 
906  tok = NextTok();
907  }
908 }
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:370
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1185 of file specctra.cpp.

References 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, and DSN::T_via_at_smd.

1186 {
1187  T tok;
1188 
1189  while( (tok = NextTok()) != T_RIGHT )
1190  {
1191  if( tok != T_LEFT )
1192  Expecting( T_LEFT );
1193 
1194  tok = NextTok();
1195  switch( tok )
1196  {
1197  case T_via_at_smd:
1198  tok = NextTok();
1199  if( tok!=T_on && tok!=T_off )
1200  Expecting( "on|off" );
1201  growth->via_at_smd = (tok==T_on);
1202  NeedRIGHT();
1203  break;
1204 
1205  case T_off_grid:
1208  case T_same_net_checking:
1210  case T_noise_calculation:
1211  case T_noise_accumulation:
1213  case T_bbv_ctr2ctr:
1214  case T_average_pair_length:
1215  case T_crosstalk_model:
1216  case T_roundoff_rotation:
1217  case T_microvia:
1218  case T_reroute_order_viols:
1219  TOKPROP* tokprop;
1220  tokprop = new TOKPROP( growth, tok ) ;
1221  growth->Append( tokprop );
1222  doTOKPROP( tokprop );
1223  break;
1224 
1225  default:
1226  Unexpected( CurText() );
1227  }
1228  }
1229 }
T
enum T contains all this lexer's tokens.
void doTOKPROP(TOKPROP *growth)
Definition: specctra.cpp:1143
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:370
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2668 of file specctra.cpp.

References 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, and DSN::T_type.

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

Definition at line 1646 of file specctra.cpp.

References 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, and DSN::T_y.

1647 {
1648  T tok = NextTok();
1649 
1650  switch( tok )
1651  {
1652  case T_via:
1653  case T_wire:
1654  case T_via_keepout:
1655  case T_snap:
1656  case T_place:
1657  growth->grid_type = tok;
1658  if( NextTok() != T_NUMBER )
1659  Expecting( T_NUMBER );
1660  growth->dimension = strtod( CurText(), 0 );
1661  tok = NextTok();
1662  if( tok == T_LEFT )
1663  {
1664  while( (tok=NextTok()) != T_RIGHT )
1665  {
1666  if( tok==T_direction )
1667  {
1668  if( growth->grid_type == T_place )
1669  Unexpected( tok );
1670  tok = NextTok();
1671  if( tok!=T_x && tok!=T_y )
1672  Unexpected( CurText() );
1673  growth->direction = tok;
1674  if( NextTok() != T_RIGHT )
1675  Expecting(T_RIGHT);
1676  }
1677  else if( tok==T_offset )
1678  {
1679  if( growth->grid_type == T_place )
1680  Unexpected( tok );
1681 
1682  if( NextTok() != T_NUMBER )
1683  Expecting( T_NUMBER );
1684 
1685  growth->offset = strtod( CurText(), 0 );
1686 
1687  if( NextTok() != T_RIGHT )
1688  Expecting(T_RIGHT);
1689  }
1690  else if( tok==T_image_type )
1691  {
1692  if( growth->grid_type != T_place )
1693  Unexpected( tok );
1694  tok = NextTok();
1695  if( tok!=T_smd && tok!=T_pin )
1696  Unexpected( CurText() );
1697  growth->image_type = tok;
1698  if( NextTok() != T_RIGHT )
1699  Expecting(T_RIGHT);
1700  }
1701  }
1702  }
1703  break;
1704 
1705  default:
1706  Unexpected( tok );
1707  }
1708 }
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:370
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 3073 of file specctra.cpp.

References DSN::T_ancestor, DSN::T_comment, DSN::T_created_time, DSN::T_LEFT, DSN::T_RIGHT, and DSN::T_self.

3074 {
3075  T tok;
3076 
3077  /* <history_descriptor >::=
3078  (history [{<ancestor_file_descriptor> }] <self_descriptor> )
3079  */
3080 
3081  while( (tok = NextTok()) != T_RIGHT )
3082  {
3083  if( tok != T_LEFT )
3084  Expecting( T_LEFT );
3085 
3086  tok = NextTok();
3087  switch( tok )
3088  {
3089  case T_ancestor:
3090  ANCESTOR* ancestor;
3091  ancestor = new ANCESTOR( growth );
3092  growth->ancestors.push_back( ancestor );
3093  doANCESTOR( ancestor );
3094  break;
3095 
3096  case T_self:
3097  while( (tok = NextTok()) != T_RIGHT )
3098  {
3099  if( tok != T_LEFT )
3100  Expecting( T_LEFT );
3101 
3102  tok = NextTok();
3103  switch( tok )
3104  {
3105  case T_created_time:
3106  readTIME( &growth->time_stamp );
3107  NeedRIGHT();
3108  break;
3109 
3110  case T_comment:
3111  NeedSYMBOL();
3112  growth->comments.push_back( CurText() );
3113  NeedRIGHT();
3114  break;
3115 
3116  default:
3117  Unexpected( CurText() );
3118  }
3119  }
3120  break;
3121 
3122  default:
3123  Unexpected( CurText() );
3124  }
3125  }
3126 }
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:370
void doANCESTOR(ANCESTOR *growth)
Definition: specctra.cpp:3035
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:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2120 of file specctra.cpp.

References 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, and DSN::T_wire_keepout.

2121 {
2122  T tok = NextTok();
2123 
2124  /* <image_descriptor >::=
2125  (image <image_id >
2126  [(side [front | back | both])]
2127  [<unit_descriptor> ]
2128  [<outline_descriptor> ]
2129  {(pin <padstack_id > [(rotate <rotation> )]
2130  [<reference_descriptor> | <pin_array_descriptor> ]
2131  [<user_property_descriptor> ])}
2132  [{<conductor_shape_descriptor> }]
2133  [{<conductor_via_descriptor> }]
2134  [<rule_descriptor> ]
2135  [<place_rule_descriptor> ]
2136  [{<keepout_descriptor> }]
2137  [<image_property_descriptor> ]
2138  )
2139  */
2140 
2141  if( !IsSymbol( tok ) && tok != T_NUMBER )
2142  Expecting( "image_id" );
2143 
2144  growth->image_id = CurText();
2145 
2146  while( (tok = NextTok()) != T_RIGHT )
2147  {
2148  if( tok != T_LEFT )
2149  Expecting( T_LEFT );
2150 
2151  tok = NextTok();
2152  switch( tok )
2153  {
2154  case T_unit:
2155  if( growth->unit )
2156  Unexpected( tok );
2157  growth->unit = new UNIT_RES( growth, tok );
2158  doUNIT( growth->unit );
2159  break;
2160 
2161  case T_side:
2162  tok = NextTok();
2163  if( tok!=T_front && tok!=T_back && tok!=T_both )
2164  Expecting( "front|back|both" );
2165  growth->side = tok;
2166  NeedRIGHT();
2167  break;
2168 
2169  case T_outline:
2170  SHAPE* outline;
2171  outline = new SHAPE( growth, T_outline ); // use SHAPE for T_outline
2172  growth->Append( outline );
2173  doSHAPE( outline );
2174  break;
2175 
2176  case T_pin:
2177  PIN* pin;
2178  pin = new PIN( growth );
2179  growth->pins.push_back( pin );
2180  doPIN( pin );
2181  break;
2182 
2183  case T_rule:
2184  if( growth->rules )
2185  Unexpected( tok );
2186  growth->rules = new RULE( growth, tok );
2187  doRULE( growth->rules );
2188  break;
2189 
2190  case T_place_rule:
2191  if( growth->place_rules )
2192  Unexpected( tok );
2193  growth->place_rules = new RULE( growth, tok );
2194  doRULE( growth->place_rules );
2195  break;
2196 
2197  case T_keepout:
2198  case T_place_keepout:
2199  case T_via_keepout:
2200  case T_wire_keepout:
2201  case T_bend_keepout:
2202  case T_elongate_keepout:
2203  KEEPOUT* keepout;
2204  keepout = new KEEPOUT( growth, tok );
2205  growth->keepouts.push_back( keepout );
2206  doKEEPOUT( keepout );
2207  break;
2208 
2209  default:
2210  Unexpected( CurText() );
2211  }
2212  }
2213 }
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
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:354
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:2216
void doSHAPE(SHAPE *growth)
Definition: specctra.cpp:2036
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 787 of file specctra.cpp.

References 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, and DSN::T_window.

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  case T_path:
846  case T_polygon:
847  if( growth->shape )
848  Unexpected( tok );
849  growth->shape = new PATH( growth, tok );
850  doPATH( (PATH*) growth->shape );
851  break;
852 
853  case T_qarc:
854  if( growth->shape )
855  Unexpected( tok );
856  growth->shape = new QARC( growth );
857  doQARC( (QARC*) growth->shape );
858  break;
859 
860  case T_window:
861  WINDOW* window;
862  window = new WINDOW( growth );
863  growth->windows.push_back( window );
864  doWINDOW( window );
865  break;
866 
867  default:
868  Unexpected( CurText() );
869  }
870 
871  tok = NextTok();
872  }
873 }
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:370
void doWINDOW(WINDOW *growth)
Definition: specctra.cpp:911
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void doPATH(PATH *growth)
Definition: specctra.cpp:1010
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1058
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1083
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:402
void doQARC(QARC *growth)
Definition: specctra.cpp:1111
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)
throw (IO_ERROR
)
private

Definition at line 1255 of file specctra.cpp.

References 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, and DSN::T_way.

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

Definition at line 590 of file specctra.cpp.

References DSN::T_layer_pair, DSN::T_LEFT, and DSN::T_RIGHT.

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:354
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)
throw (IO_ERROR
)
private

Definition at line 1711 of file specctra.cpp.

References DSN::T_LEFT, and DSN::T_rule.

1712 {
1713  T tok;
1714 
1715  NeedSYMBOL();
1716 
1717  do
1718  {
1719  growth->layer_ids.push_back( CurText() );
1720 
1721  } while( IsSymbol(tok = NextTok()) );
1722 
1723  if( tok != T_LEFT )
1724  Expecting( T_LEFT );
1725 
1726  if( NextTok() != T_rule )
1727  Expecting( T_rule );
1728 
1729  growth->rule = new RULE( growth, T_rule );
1730  doRULE( growth->rule );
1731 
1732  NeedRIGHT();
1733 }
T
enum T contains all this lexer's tokens.
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2263 of file specctra.cpp.

References DSN::T_image, DSN::T_LEFT, DSN::T_padstack, DSN::T_RIGHT, and DSN::T_unit.

2264 {
2265  T tok;
2266 
2267  /* <library_descriptor >::=
2268  (library
2269  [<unit_descriptor> ]
2270  {<image_descriptor> }
2271  [{<jumper_descriptor> }]
2272  {<padstack_descriptor> }
2273  {<via_array_template_descriptor> }
2274  [<directory_descriptor> ]
2275  [<extra_image_directory_descriptor> ]
2276  [{<family_family_descriptor> }]
2277  [{<image_image_descriptor> }]
2278  )
2279  */
2280 
2281  while( (tok = NextTok()) != T_RIGHT )
2282  {
2283  if( tok != T_LEFT )
2284  Expecting( T_LEFT );
2285 
2286  tok = NextTok();
2287  switch( tok )
2288  {
2289  case T_unit:
2290  if( growth->unit )
2291  Unexpected( tok );
2292  growth->unit = new UNIT_RES( growth, tok );
2293  doUNIT( growth->unit );
2294  break;
2295 
2296  case T_padstack:
2297  PADSTACK* padstack;
2298  padstack = new PADSTACK();
2299  growth->AddPadstack( padstack );
2300  doPADSTACK( padstack );
2301  break;
2302 
2303  case T_image:
2304  IMAGE* image;
2305  image = new IMAGE( growth );
2306  growth->images.push_back( image );
2307  doIMAGE( image );
2308  break;
2309 
2310  default:
2311  Unexpected( CurText() );
2312  }
2313  }
2314 }
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:370
void doIMAGE(IMAGE *growth)
Definition: specctra.cpp:2120
void doPADSTACK(PADSTACK *growth)
Definition: specctra.cpp:1936
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2317 of file specctra.cpp.

References DSN::PIN_REF::component_id, empty(), DSN::PIN_REF::pin_id, 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, and DSN::T_unassigned.

2318 {
2319  T tok = NextTok();
2320  PIN_REFS* pin_refs;
2321 
2322  /* <net_descriptor >::=
2323  (net <net_id >
2324  [(unassigned)]
2325  [(net_number <integer >)]
2326  [(pins {<pin_reference> }) | (order {<pin_reference> })]
2327  [<component_order_descriptor> ]
2328  [(type [fix | normal])]
2329  [<user_property_descriptor> ]
2330  [<circuit_descriptor> ]
2331  [<rule_descriptor> ]
2332  [{<layer_rule_descriptor> }]
2333  [<fromto_descriptor> ]
2334  [(expose {<pin_reference> })]
2335  [(noexpose {<pin_reference> })]
2336  [(source {<pin_reference> })]
2337  [(load {<pin_reference> })]
2338  [(terminator {<pin_reference> })]
2339  [(supply [power | ground])]
2340  )
2341  */
2342 
2343  if( !IsSymbol( tok ) )
2344  Expecting( "net_id" );
2345 
2346  growth->net_id = CurText();
2347 
2348  while( (tok = NextTok()) != T_RIGHT )
2349  {
2350  if( tok != T_LEFT )
2351  Expecting( T_LEFT );
2352 
2353  tok = NextTok();
2354  switch( tok )
2355  {
2356  case T_unassigned:
2357  growth->unassigned = true;
2358  NeedRIGHT();
2359  break;
2360 
2361  case T_net_number:
2362  if( NextTok() != T_NUMBER )
2363  Expecting( T_NUMBER );
2364  growth->net_number = atoi( CurText() );
2365  NeedRIGHT();
2366  break;
2367 
2368  case T_pins:
2369  case T_order:
2370  growth->pins_type = tok;
2371  pin_refs = &growth->pins;
2372  goto L_pins;
2373 
2374  case T_expose:
2375  pin_refs = &growth->expose;
2376  goto L_pins;
2377 
2378  case T_noexpose:
2379  pin_refs = &growth->noexpose;
2380  goto L_pins;
2381 
2382  case T_source:
2383  pin_refs = &growth->source;
2384  goto L_pins;
2385 
2386  case T_load:
2387  pin_refs = &growth->load;
2388  goto L_pins;
2389 
2390  case T_terminator:
2391  pin_refs = &growth->terminator;
2392  //goto L_pins;
2393 
2394 L_pins:
2395  {
2396  PIN_REF empty( growth );
2397  while( (tok = NextTok()) != T_RIGHT )
2398  {
2399  // copy the empty one, then fill its copy later thru pin_ref.
2400  pin_refs->push_back( empty );
2401 
2402  PIN_REF* pin_ref = &pin_refs->back();
2403 
2404  readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
2405  }
2406  }
2407  break;
2408 
2409  case T_comp_order:
2410  if( growth->comp_order )
2411  Unexpected( tok );
2412  growth->comp_order = new COMP_ORDER( growth );
2413  doCOMP_ORDER( growth->comp_order );
2414  break;
2415 
2416  case T_type:
2417  tok = NextTok();
2418  if( tok!=T_fix && tok!=T_normal )
2419  Expecting( "fix|normal" );
2420  growth->type = tok;
2421  NeedRIGHT();
2422  break;
2423 
2424 /* @todo
2425  case T_circuit:
2426  break;
2427 */
2428 
2429  case T_rule:
2430  if( growth->rules )
2431  Unexpected( tok );
2432  growth->rules = new RULE( growth, T_rule );
2433  doRULE( growth->rules );
2434  break;
2435 
2436  case T_layer_rule:
2437  LAYER_RULE* layer_rule;
2438  layer_rule = new LAYER_RULE( growth );
2439  growth->layer_rules.push_back( layer_rule );
2440  doLAYER_RULE( layer_rule );
2441  break;
2442 
2443  case T_fromto:
2444  FROMTO* fromto;
2445  fromto = new FROMTO( growth );
2446  growth->fromtos.push_back( fromto );
2447  doFROMTO( fromto );
2448  break;
2449 
2450  default:
2451  Unexpected( CurText() );
2452  }
2453  }
2454 }
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
void doCOMP_ORDER(COMP_ORDER *growth)
Definition: specctra.cpp:2650
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:2456
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:1711
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:402
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:2668
void DSN::SPECCTRA_DB::doNET_OUT ( NET_OUT growth)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 3330 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_net_number, DSN::T_NUMBER, DSN::T_RIGHT, DSN::T_rule, DSN::T_supply_pin, DSN::T_via, and DSN::T_wire.

3331 {
3332  T tok;
3333 
3334  /* <net_out_descriptor >::=
3335  (net <net_id >
3336  [(net_number <integer >)]
3337  [<rule_descriptor> ]
3338  {[<wire_shape_descriptor> | <wire_guide_descriptor> |
3339  <wire_via_descriptor> | <bond_shape_descriptor> ]}
3340  {[<supply_pin_descriptor> ]}
3341  )
3342  */
3343 
3345  growth->net_id = CurText();
3346 
3347  while( (tok = NextTok()) != T_RIGHT )
3348  {
3349  if( tok != T_LEFT )
3350  Expecting( T_LEFT );
3351 
3352  tok = NextTok();
3353  switch( tok )
3354  {
3355  case T_net_number:
3356  tok = NextTok();
3357  if( tok!= T_NUMBER )
3358  Expecting( T_NUMBER );
3359  growth->net_number = atoi( CurText() );
3360  NeedRIGHT();
3361  break;
3362 
3363  case T_rule:
3364  if( growth->rules )
3365  Unexpected( tok );
3366  growth->rules = new RULE( growth, tok );
3367  doRULE( growth->rules );
3368  break;
3369 
3370  case T_wire:
3371  WIRE* wire;
3372  wire = new WIRE( growth );
3373  growth->wires.push_back( wire );
3374  doWIRE( wire );
3375  break;
3376 
3377  case T_via:
3378  WIRE_VIA* wire_via;
3379  wire_via = new WIRE_VIA( growth );
3380  growth->wire_vias.push_back( wire_via );
3381  doWIRE_VIA( wire_via );
3382  break;
3383 
3384  case T_supply_pin:
3385  SUPPLY_PIN* supply_pin;
3386  supply_pin = new SUPPLY_PIN( growth );
3387  growth->supply_pins.push_back( supply_pin );
3388  doSUPPLY_PIN( supply_pin );
3389  break;
3390 
3391  default:
3392  Unexpected( CurText() );
3393  }
3394  }
3395 }
void doWIRE(WIRE *growth)
Definition: specctra.cpp:2754
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
void doSUPPLY_PIN(SUPPLY_PIN *growth)
Definition: specctra.cpp:3398
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
void doWIRE_VIA(WIRE_VIA *growth)
Definition: specctra.cpp:2875
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2605 of file specctra.cpp.

References DSN::T_class, DSN::T_LEFT, DSN::T_net, and DSN::T_RIGHT.

2606 {
2607  T tok;
2608 
2609  /* <network_descriptor >::=
2610  (network
2611  {<net_descriptor>}
2612  [{<class_descriptor> }]
2613  [{<class_class_descriptor> }]
2614  [{<group_descriptor> }]
2615  [{<group_set_descriptor> }]
2616  [{<pair_descriptor> }]
2617  [{<bundle_descriptor> }]
2618  )
2619  */
2620 
2621  while( (tok = NextTok()) != T_RIGHT )
2622  {
2623  if( tok != T_LEFT )
2624  Expecting( T_LEFT );
2625 
2626  tok = NextTok();
2627  switch( tok )
2628  {
2629  case T_net:
2630  NET* net;
2631  net = new NET( growth );
2632  growth->nets.push_back( net );
2633  doNET( net );
2634  break;
2635 
2636  case T_class:
2637  CLASS* myclass;
2638  myclass = new CLASS( growth );
2639  growth->classes.push_back( myclass );
2640  doCLASS( myclass );
2641  break;
2642 
2643  default:
2644  Unexpected( CurText() );
2645  }
2646  }
2647 }
T
enum T contains all this lexer's tokens.
void doNET(NET *growth)
Definition: specctra.cpp:2317
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:370
void doCLASS(CLASS *growth)
Definition: specctra.cpp:2495
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1936 of file specctra.cpp.

References 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, and DSN::T_use_via.

1937 {
1938  T tok = NextTok();
1939 
1940  /* (padstack <padstack_id >
1941  [<unit_descriptor> ]
1942  {(shape <shape_descriptor>
1943  [<reduced_shape_descriptor> ]
1944  [(connect [on | off])]
1945  [{<window_descriptor> }]
1946  )}
1947  [<attach_descriptor> ]
1948  [{<pad_via_site_descriptor> }]
1949  [(rotate [on | off])]
1950  [(absolute [on | off])]
1951  [(rule <clearance_descriptor> )])
1952  */
1953 
1954  // padstack_id may be a number
1955  if( !IsSymbol( tok ) && tok!=T_NUMBER )
1956  Expecting( "padstack_id" );
1957 
1958  growth->padstack_id = CurText();
1959 
1960  while( (tok = NextTok()) != T_RIGHT )
1961  {
1962  if( tok != T_LEFT )
1963  Expecting( T_LEFT );
1964 
1965  tok = NextTok();
1966  switch( tok )
1967  {
1968  case T_unit:
1969  if( growth->unit )
1970  Unexpected( tok );
1971  growth->unit = new UNIT_RES( growth, tok );
1972  doUNIT( growth->unit );
1973  break;
1974 
1975  case T_rotate:
1976  tok = NextTok();
1977  if( tok!=T_on && tok!=T_off )
1978  Expecting( "on|off" );
1979  growth->rotate = tok;
1980  NeedRIGHT();
1981  break;
1982 
1983  case T_absolute:
1984  tok = NextTok();
1985  if( tok!=T_on && tok!=T_off )
1986  Expecting( "on|off" );
1987  growth->absolute = tok;
1988  NeedRIGHT();
1989  break;
1990 
1991  case T_shape:
1992  SHAPE* shape;
1993  shape = new SHAPE( growth );
1994  growth->Append( shape );
1995  doSHAPE( shape );
1996  break;
1997 
1998  case T_attach:
1999  tok = NextTok();
2000  if( tok!=T_off && tok!=T_on )
2001  Expecting( "off|on" );
2002  growth->attach = tok;
2003  tok = NextTok();
2004  if( tok == T_LEFT )
2005  {
2006  if( NextTok() != T_use_via )
2007  Expecting( T_use_via );
2008 
2009  NeedSYMBOL();
2010  growth->via_id = CurText();
2011 
2012  NeedRIGHT();
2013  NeedRIGHT();
2014  }
2015  break;
2016 
2017  /*
2018  case T_via_site: not supported
2019  break;
2020  */
2021 
2022  case T_rule:
2023  if( growth->rules )
2024  Unexpected( tok );
2025  growth->rules = new RULE( growth, T_rule );
2026  doRULE( growth->rules );
2027  break;
2028 
2029  default:
2030  Unexpected( CurText() );
2031  }
2032  }
2033 }
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
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:354
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:2036
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:402
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)
throw (IO_ERROR
)
private

Definition at line 387 of file specctra.cpp.

References 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, and DSN::T_write_resolution.

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:370
std::string quote_char
Definition: specctra.h:3613
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:354
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:402
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)
throw (IO_ERROR
)
private

Definition at line 1010 of file specctra.cpp.

References 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.

1011 {
1012  T tok = NextTok();
1013 
1014  if( !IsSymbol( tok ) && tok != T_NUMBER ) // a layer name can be like a number like +12
1015  Expecting( "layer_id" );
1016 
1017  growth->layer_id = CurText();
1018 
1019  if( NextTok() != T_NUMBER )
1020  Expecting( "aperture_width" );
1021 
1022  growth->aperture_width = strtod( CurText(), NULL );
1023 
1024  POINT ptTemp;
1025 
1026  tok = NextTok();
1027 
1028  do
1029  {
1030  if( tok != T_NUMBER )
1031  Expecting( T_NUMBER );
1032  ptTemp.x = strtod( CurText(), NULL );
1033 
1034  if( NextTok() != T_NUMBER )
1035  Expecting( T_NUMBER );
1036  ptTemp.y = strtod( CurText(), NULL );
1037 
1038  growth->points.push_back( ptTemp );
1039 
1040  } while( (tok = NextTok())!=T_RIGHT && tok!=T_LEFT );
1041 
1042  if( tok == T_LEFT )
1043  {
1044  if( NextTok() != T_aperture_type )
1046 
1047  tok = NextTok();
1048  if( tok!=T_round && tok!=T_square )
1049  Expecting( "round|square" );
1050 
1051  growth->aperture_type = tok;
1052 
1053  NeedRIGHT();
1054  }
1055 }
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:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 282 of file specctra.cpp.

References 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, and DSN::T_wiring.

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:370
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doWIRING(WIRING *growth)
Definition: specctra.cpp:2979
void doLIBRARY(LIBRARY *growth)
Definition: specctra.cpp:2263
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:1881
void doNETWORK(NETWORK *growth)
Definition: specctra.cpp:2605
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)
throw (IO_ERROR
)
private

Definition at line 2216 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_NUMBER, DSN::T_RIGHT, and DSN::T_rotate.

2217 {
2218  T tok = NextTok();
2219 
2220  /* (pin <padstack_id > [(rotate <rotation> )]
2221  [<reference_descriptor> | <pin_array_descriptor> ]
2222  [<user_property_descriptor> ])
2223  */
2224 
2225  // a padstack_id may be a number
2226  if( !IsSymbol( tok ) && tok!=T_NUMBER )
2227  Expecting( "padstack_id" );
2228 
2229  growth->padstack_id = CurText();
2230 
2231  while( (tok = NextTok()) != T_RIGHT )
2232  {
2233  if( tok == T_LEFT )
2234  {
2235  tok = NextTok();
2236  if( tok != T_rotate )
2237  Expecting( T_rotate );
2238 
2239  if( NextTok() != T_NUMBER )
2240  Expecting( T_NUMBER );
2241  growth->SetRotation( strtod( CurText(), 0 ) );
2242  NeedRIGHT();
2243  }
2244  else
2245  {
2246  if( !IsSymbol(tok) && tok!=T_NUMBER )
2247  Expecting( "pin_id" );
2248 
2249  growth->pin_id = CurText();
2250 
2251  if( NextTok() != T_NUMBER )
2252  Expecting( T_NUMBER );
2253  growth->vertex.x = strtod( CurText(), 0 );
2254 
2255  if( NextTok() != T_NUMBER )
2256  Expecting( T_NUMBER );
2257  growth->vertex.y = strtod( CurText(), 0 );
2258  }
2259  }
2260 }
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:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1736 of file specctra.cpp.

References 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, DSN::POINT::x, and DSN::POINT::y.

1737 {
1738  T tok = NextTok();
1739 
1740  if( !IsSymbol( tok ) )
1741  Expecting( "component_id" );
1742 
1743  growth->component_id = CurText();
1744 
1745  tok = NextTok();
1746  if( tok == T_NUMBER )
1747  {
1748  POINT point;
1749 
1750  point.x = strtod( CurText(), 0 );
1751 
1752  if( NextTok() != T_NUMBER )
1753  Expecting( T_NUMBER );
1754  point.y = strtod( CurText(), 0 );
1755 
1756  growth->SetVertex( point );
1757 
1758  tok = NextTok();
1759  if( tok!=T_front && tok!=T_back )
1760  Expecting( "front|back" );
1761  growth->side = tok;
1762 
1763  if( NextTok() != T_NUMBER )
1764  Expecting( "rotation" );
1765  growth->SetRotation( strtod( CurText(), 0) );
1766  }
1767 
1768  while( (tok = NextTok()) != T_RIGHT )
1769  {
1770  if( tok != T_LEFT )
1771  Expecting( T_LEFT );
1772 
1773  tok = NextTok();
1774  switch( tok )
1775  {
1776  case T_mirror:
1777  tok = NextTok();
1778  if( tok==T_x || tok==T_y || tok==T_xy || tok==T_off )
1779  growth->mirror = tok;
1780  else
1781  Expecting("x|y|xy|off");
1782  break;
1783 
1784  case T_status:
1785  tok = NextTok();
1786  if( tok==T_added || tok==T_deleted || tok==T_substituted )
1787  growth->status = tok;
1788  else
1789  Expecting("added|deleted|substituted");
1790  break;
1791 
1792  case T_logical_part:
1793  if( growth->logical_part.size() )
1794  Unexpected( tok );
1795  tok = NextTok();
1796  if( !IsSymbol( tok ) )
1797  Expecting( "logical_part_id");
1798  growth->logical_part = CurText();
1799  break;
1800 
1801  case T_place_rule:
1802  if( growth->place_rules )
1803  Unexpected( tok );
1804  growth->place_rules = new RULE( growth, T_place_rule );
1805  doRULE( growth->place_rules );
1806  break;
1807 
1808  case T_property:
1809  if( growth->properties.size() )
1810  Unexpected( tok );
1811  doPROPERTIES( &growth->properties );
1812  break;
1813 
1814  case T_lock_type:
1815  tok = NextTok();
1816  if( tok==T_position || tok==T_gate || tok==T_subgate || tok==T_pin )
1817  growth->lock_type = tok;
1818  else
1819  Expecting("position|gate|subgate|pin");
1820  break;
1821 
1822  case T_rule:
1823  if( growth->rules || growth->region )
1824  Unexpected( tok );
1825  growth->rules = new RULE( growth, T_rule );
1826  doRULE( growth->rules );
1827  break;
1828 
1829  case T_region:
1830  if( growth->rules || growth->region )
1831  Unexpected( tok );
1832  growth->region = new REGION( growth );
1833  doREGION( growth->region );
1834  break;
1835 
1836  case T_pn:
1837  if( growth->part_number.size() )
1838  Unexpected( tok );
1840  growth->part_number = CurText();
1841  NeedRIGHT();
1842  break;
1843 
1844  default:
1845  Unexpected( tok );
1846  }
1847  }
1848 }
T
enum T contains all this lexer's tokens.
void doPROPERTIES(PROPERTIES *growth)
Definition: specctra.cpp:1232
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:370
void doREGION(REGION *growth)
Definition: specctra.cpp:1509
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1881 of file specctra.cpp.

References 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, and DSN::T_unit.

1882 {
1883  T tok;
1884 
1885  while( (tok = NextTok()) != T_RIGHT )
1886  {
1887  if( tok == T_EOF )
1888  Unexpected( T_EOF );
1889 
1890  if( tok != T_LEFT )
1891  Expecting( T_LEFT );
1892 
1893  tok = NextTok();
1894 
1895  switch( tok )
1896  {
1897  case T_unit:
1898  case T_resolution:
1899  growth->unit = new UNIT_RES( growth, tok );
1900  if( tok==T_resolution )
1901  doRESOLUTION( growth->unit );
1902  else
1903  doUNIT( growth->unit );
1904  break;
1905 
1906  case T_place_control:
1907  NeedRIGHT();
1908  tok = NextTok();
1909  if( tok != T_flip_style )
1911 
1912  tok = NextTok();
1913  if( tok==T_mirror_first || tok==T_rotate_first )
1914  growth->flip_style = tok;
1915  else
1916  Expecting( "mirror_first|rotate_first" );
1917 
1918  NeedRIGHT();
1919  NeedRIGHT();
1920  break;
1921 
1922  case T_component:
1923  COMPONENT* component;
1924  component = new COMPONENT( growth );
1925  growth->components.push_back( component );
1926  doCOMPONENT( component );
1927  break;
1928 
1929  default:
1930  Unexpected( tok );
1931  }
1932  }
1933 }
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:370
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doCOMPONENT(COMPONENT *growth)
Definition: specctra.cpp:1851
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
void DSN::SPECCTRA_DB::doPROPERTIES ( PROPERTIES growth)
throw (IO_ERROR
)
private

Definition at line 1232 of file specctra.cpp.

References DSN::T_LEFT, and DSN::T_RIGHT.

1233 {
1234  T tok;
1235  PROPERTY property; // construct it once here, append multiple times.
1236 
1237  while( (tok = NextTok()) != T_RIGHT )
1238  {
1239  if( tok != T_LEFT )
1240  Expecting( T_LEFT );
1241 
1243  property.name = CurText();
1244 
1246  property.value = CurText();
1247 
1248  growth->push_back( property );
1249 
1250  NeedRIGHT();
1251  }
1252 }
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:354
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:402
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)
throw (IO_ERROR
)
private

Definition at line 1111 of file specctra.cpp.

References DSN::T_NUMBER.

1112 {
1113  NeedSYMBOL();
1114  growth->layer_id = CurText();
1115 
1116  if( NextTok() != T_NUMBER )
1117  Expecting( T_NUMBER );
1118  growth->aperture_width = strtod( CurText(), 0 );
1119 
1120  for( int i=0; i<3; ++i )
1121  {
1122  if( NextTok() != T_NUMBER )
1123  Expecting( T_NUMBER );
1124  growth->vertex[i].x = strtod( CurText(), 0 );
1125 
1126  if( NextTok() != T_NUMBER )
1127  Expecting( T_NUMBER );
1128  growth->vertex[i].y = strtod( CurText(), 0 );
1129  }
1130 
1131  NeedRIGHT();
1132 }
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw (IO_ERROR
)
private

Definition at line 1058 of file specctra.cpp.

References DSN::T_NUMBER.

1059 {
1060  NeedSYMBOL();
1061  growth->layer_id = CurText();
1062 
1063  if( NextTok() != T_NUMBER )
1064  Expecting( T_NUMBER );
1065  growth->point0.x = strtod( CurText(), NULL );
1066 
1067  if( NextTok() != T_NUMBER )
1068  Expecting( T_NUMBER );
1069  growth->point0.y = strtod( CurText(), NULL );
1070 
1071  if( NextTok() != T_NUMBER )
1072  Expecting( T_NUMBER );
1073  growth->point1.x = strtod( CurText(), NULL );
1074 
1075  if( NextTok() != T_NUMBER )
1076  Expecting( T_NUMBER );
1077  growth->point1.y = strtod( CurText(), NULL );
1078 
1079  NeedRIGHT();
1080 }
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 1509 of file specctra.cpp.

References 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, and DSN::T_rule.

1510 {
1511  T tok = NextTok();
1512 
1513  if( IsSymbol(tok) )
1514  {
1515  growth->region_id = CurText();
1516  tok = NextTok();
1517  }
1518 
1519  for(;;)
1520  {
1521  if( tok != T_LEFT )
1522  Expecting( T_LEFT );
1523 
1524  tok = NextTok();
1525  switch( tok )
1526  {
1527  case T_rect:
1528  if( growth->rectangle )
1529  Unexpected( tok );
1530  growth->rectangle = new RECTANGLE( growth );
1531  doRECTANGLE( growth->rectangle );
1532  break;
1533 
1534  case T_polygon:
1535  if( growth->polygon )
1536  Unexpected( tok );
1537  growth->polygon = new PATH( growth, T_polygon );
1538  doPATH( growth->polygon );
1539  break;
1540 
1541  case T_region_net:
1542  case T_region_class:
1543  STRINGPROP* stringprop;
1544  stringprop = new STRINGPROP( growth, tok );
1545  growth->Append( stringprop );
1546  doSTRINGPROP( stringprop );
1547  break;
1548 
1549  case T_region_class_class:
1550  CLASS_CLASS* class_class;
1551  class_class = new CLASS_CLASS( growth, tok );
1552  growth->Append( class_class );
1553  doCLASS_CLASS( class_class );
1554  break;
1555 
1556  case T_rule:
1557  if( growth->rules )
1558  Unexpected( tok );
1559  growth->rules = new RULE( growth, T_rule );
1560  doRULE( growth->rules );
1561  break;
1562 
1563  default:
1564  Unexpected( CurText() );
1565  }
1566 
1567  tok = NextTok();
1568  if( tok == T_RIGHT )
1569  {
1570  if( !growth->rules )
1571  Expecting( T_rule );
1572  break;
1573  }
1574  }
1575 }
void doCLASS_CLASS(CLASS_CLASS *growth)
Definition: specctra.cpp:1578
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:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void doPATH(PATH *growth)
Definition: specctra.cpp:1010
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1058
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:1135
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)
throw (IO_ERROR
)
private

Definition at line 526 of file specctra.cpp.

References DSN::T_cm, DSN::T_inch, DSN::T_mil, DSN::T_mm, DSN::T_NUMBER, and DSN::T_um.

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:354
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 3247 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_library_out, DSN::T_net, DSN::T_network_out, DSN::T_parser, DSN::T_resolution, DSN::T_RIGHT, and DSN::T_structure_out.

3248 {
3249  T tok;
3250 
3251  /* <route_descriptor >::=
3252  (routes
3253  <resolution_descriptor>
3254  <parser_descriptor>
3255  <structure_out_descriptor>
3256  <library_out_descriptor>
3257  <network_out_descriptor>
3258  <test_points_descriptor>
3259  )
3260  */
3261 
3262  while( (tok = NextTok()) != T_RIGHT )
3263  {
3264  if( tok != T_LEFT )
3265  Expecting( T_LEFT );
3266 
3267  tok = NextTok();
3268  switch( tok )
3269  {
3270  case T_resolution:
3271  if( growth->resolution )
3272  Unexpected( tok );
3273  growth->resolution = new UNIT_RES( growth, tok );
3274  doRESOLUTION( growth->resolution );
3275  break;
3276 
3277  case T_parser:
3278  if( growth->parser )
3279  {
3280 #if 0 // Electra 2.9.1 emits two (parser ) elements in a row.
3281  // Work around their bug for now.
3282  Unexpected( tok );
3283 #else
3284  delete growth->parser;
3285 #endif
3286  }
3287  growth->parser = new PARSER( growth );
3288  doPARSER( growth->parser );
3289  break;
3290 
3291  case T_structure_out:
3292  if( growth->structure_out )
3293  Unexpected( tok );
3294  growth->structure_out = new STRUCTURE_OUT( growth );
3295  doSTRUCTURE_OUT( growth->structure_out );
3296  break;
3297 
3298  case T_library_out:
3299  if( growth->library )
3300  Unexpected( tok );
3301  growth->library = new LIBRARY( growth, tok );
3302  doLIBRARY( growth->library );
3303  break;
3304 
3305  case T_network_out:
3306  while( (tok = NextTok()) != T_RIGHT )
3307  {
3308  if( tok != T_LEFT )
3309  Expecting( T_LEFT );
3310 
3311  tok = NextTok();
3312  if( tok != T_net ) // it is class NET_OUT, but token T_net
3313  Unexpected( CurText() );
3314 
3315  NET_OUT* net_out;
3316  net_out = new NET_OUT( growth );
3317 
3318  growth->net_outs.push_back( net_out );
3319  doNET_OUT( net_out );
3320  }
3321  break;
3322 
3323  default:
3324  Unexpected( CurText() );
3325  }
3326  }
3327 }
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:370
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doLIBRARY(LIBRARY *growth)
Definition: specctra.cpp:2263
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:3330
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)
throw (IO_ERROR
)
private

Definition at line 1377 of file specctra.cpp.

References DSN::T_EOF, DSN::T_LEFT, DSN::T_NONE, DSN::T_RIGHT, and DSN::T_STRING.

1378 {
1379  std::string builder;
1380  int bracketNesting = 1; // we already saw the opening T_LEFT
1381  T tok = T_NONE;
1382 
1383  while( bracketNesting!=0 && tok!=T_EOF )
1384  {
1385  tok = NextTok();
1386 
1387  if( tok==T_LEFT)
1388  ++bracketNesting;
1389 
1390  else if( tok==T_RIGHT )
1391  --bracketNesting;
1392 
1393  if( bracketNesting >= 1 )
1394  {
1395  if( PrevTok()!=T_LEFT && tok!=T_RIGHT && (tok!=T_LEFT || bracketNesting>2) )
1396  builder += ' ';
1397 
1398  if( tok==T_STRING )
1399  builder += quote_char;
1400 
1401  builder += CurText();
1402 
1403  if( tok==T_STRING )
1404  builder += quote_char;
1405  }
1406 
1407  // When the nested rule is closed with a T_RIGHT and we are back down
1408  // to bracketNesting == 1, (inside the <rule_descriptor> but outside
1409  // the last rule). Then save the last rule and clear the string builder.
1410  if( bracketNesting == 1 )
1411  {
1412  growth->rules.push_back( builder );
1413  builder.clear();
1414  }
1415  }
1416 
1417  if( tok==T_EOF )
1418  Unexpected( T_EOF );
1419 }
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:370
std::string quote_char
Definition: specctra.h:3613
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 3129 of file specctra.cpp.

References DSN::T_base_design, DSN::T_history, DSN::T_LEFT, DSN::T_placement, DSN::T_RIGHT, DSN::T_routes, DSN::T_structure, and DSN::T_was_is.

3130 {
3131  T tok;
3132 
3133  /* <session_file_descriptor >::=
3134  (session <session_id >
3135  (base_design <path/filename >)
3136  [<history_descriptor> ]
3137  [<session_structure_descriptor> ]
3138  [<placement_descriptor> ]
3139  [<floor_plan_descriptor> ]
3140  [<net_pin_changes_descriptor> ]
3141  [<was_is_descriptor> ]
3142  <swap_history_descriptor> ]
3143  [<route_descriptor> ]
3144  )
3145  */
3146 
3147  NeedSYMBOL();
3148  growth->session_id = CurText();
3149 
3150  while( (tok = NextTok()) != T_RIGHT )
3151  {
3152  if( tok != T_LEFT )
3153  Expecting( T_LEFT );
3154 
3155  tok = NextTok();
3156  switch( tok )
3157  {
3158  case T_base_design:
3159  NeedSYMBOL();
3160  growth->base_design = CurText();
3161  NeedRIGHT();
3162  break;
3163 
3164  case T_history:
3165  if( growth->history )
3166  Unexpected( tok );
3167  growth->history = new HISTORY( growth );
3168  doHISTORY( growth->history );
3169  break;
3170 
3171  case T_structure:
3172  if( growth->structure )
3173  Unexpected( tok );
3174  growth->structure = new STRUCTURE( growth );
3175  doSTRUCTURE( growth->structure );
3176  break;
3177 
3178  case T_placement:
3179  if( growth->placement )
3180  Unexpected( tok );
3181  growth->placement = new PLACEMENT( growth );
3182  doPLACEMENT( growth->placement );
3183  break;
3184 
3185  case T_was_is:
3186  if( growth->was_is )
3187  Unexpected( tok );
3188  growth->was_is = new WAS_IS( growth );
3189  doWAS_IS( growth->was_is );
3190  break;
3191 
3192  case T_routes:
3193  if( growth->route )
3194  Unexpected( tok );
3195  growth->route = new ROUTE( growth );
3196  doROUTE( growth->route );
3197  break;
3198 
3199  default:
3200  Unexpected( CurText() );
3201  }
3202  }
3203 }
T
enum T contains all this lexer's tokens.
void doROUTE(ROUTE *growth)
Definition: specctra.cpp:3247
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:370
void doHISTORY(HISTORY *growth)
Definition: specctra.cpp:3073
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:1881
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:402
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:3206
void DSN::SPECCTRA_DB::doSHAPE ( SHAPE growth)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2036 of file specctra.cpp.

References 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, and DSN::T_window.

2037 {
2038  T tok;
2039 
2040  /* (shape <shape_descriptor>
2041  [<reduced_shape_descriptor> ]
2042  [(connect [on | off])]
2043  [{<window_descriptor> }])
2044  */
2045 
2046  while( (tok = NextTok()) != T_RIGHT )
2047  {
2048  if( tok != T_LEFT )
2049  Expecting( T_LEFT );
2050 
2051  tok = NextTok();
2052  switch( tok )
2053  {
2054  case T_polyline_path:
2055  tok = T_path;
2056  case T_rect:
2057  case T_circle:
2058  case T_path:
2059  case T_polygon:
2060  case T_qarc:
2061 L_done_that:
2062  if( growth->shape )
2063  Unexpected( tok );
2064  break;
2065 
2066  default:
2067  // the example in the spec uses "circ" instead of "circle". Bad!
2068  if( !strcmp( "circ", CurText() ) )
2069  {
2070  tok = T_circle;
2071  goto L_done_that;
2072  }
2073  }
2074 
2075  switch( tok )
2076  {
2077  case T_rect:
2078  growth->shape = new RECTANGLE( growth );
2079  doRECTANGLE( (RECTANGLE*) growth->shape );
2080  break;
2081 
2082  case T_circle:
2083  growth->shape = new CIRCLE( growth );
2084  doCIRCLE( (CIRCLE*)growth->shape );
2085  break;
2086 
2087  case T_path:
2088  case T_polygon:
2089  growth->shape = new PATH( growth, tok );
2090  doPATH( (PATH*)growth->shape );
2091  break;
2092 
2093  case T_qarc:
2094  growth->shape = new QARC( growth );
2095  doQARC( (QARC*)growth->shape );
2096  break;
2097 
2098  case T_connect:
2099  tok = NextTok();
2100  if( tok!=T_on && tok!=T_off )
2101  Expecting( "on|off" );
2102  growth->connect = tok;
2103  NeedRIGHT();
2104  break;
2105 
2106  case T_window:
2107  WINDOW* window;
2108  window = new WINDOW( growth );
2109  growth->windows.push_back( window );
2110  doWINDOW( window );
2111  break;
2112 
2113  default:
2114  Unexpected( CurText() );
2115  }
2116  }
2117 }
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:370
void doWINDOW(WINDOW *growth)
Definition: specctra.cpp:911
void doPATH(PATH *growth)
Definition: specctra.cpp:1010
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1058
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1083
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:402
void doQARC(QARC *growth)
Definition: specctra.cpp:1111
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)
throw (IO_ERROR
)
private

Definition at line 574 of file specctra.cpp.

References DSN::T_NUMBER.

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:354
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:402
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)
throw (IO_ERROR
)
private

Definition at line 1135 of file specctra.cpp.

1136 {
1137  NeedSYMBOL();
1138  growth->value = CurText();
1139  NeedRIGHT();
1140 }
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 610 of file specctra.cpp.

References 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, and DSN::T_wire_keepout.

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:1646
void doCONTROL(CONTROL *growth)
Definition: specctra.cpp:1185
T
enum T contains all this lexer's tokens.
void doLAYER(LAYER *growth)
Definition: specctra.cpp:1255
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:370
void doVIA(VIA *growth)
Definition: specctra.cpp:1156
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doREGION(REGION *growth)
Definition: specctra.cpp:1509
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:1135
Class LAYER holds information pertinent to a layer of a BOARD.
Definition: class_board.h:82
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:963
void DSN::SPECCTRA_DB::doSTRUCTURE_OUT ( STRUCTURE_OUT growth)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 744 of file specctra.cpp.

References DSN::T_layer, DSN::T_LEFT, DSN::T_RIGHT, and DSN::T_rule.

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 }
T
enum T contains all this lexer's tokens.
void doLAYER(LAYER *growth)
Definition: specctra.cpp:1255
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:370
void doRULE(RULE *growth)
Definition: specctra.cpp:1377
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:82
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)
throw (IO_ERROR
)
private

Definition at line 3398 of file specctra.cpp.

References DSN::PIN_REF::component_id, empty(), DSN::PIN_REF::pin_id, DSN::T_LEFT, DSN::T_net, and DSN::T_RIGHT.

3399 {
3400  T tok;
3401  PIN_REF empty(growth);
3402 
3403  /* <supply_pin_descriptor >::=
3404  (supply_pin {<pin_reference> } [(net <net_id >)])
3405  */
3406 
3407  NeedSYMBOL();
3408  growth->net_id = CurText();
3409 
3410  while( (tok = NextTok()) != T_RIGHT )
3411  {
3412  if( IsSymbol(tok) )
3413  {
3414  growth->pin_refs.push_back( empty );
3415 
3416  PIN_REF* pin_ref = &growth->pin_refs.back();
3417 
3418  readCOMPnPIN( &pin_ref->component_id, &pin_ref->pin_id );
3419  }
3420  else if( tok == T_LEFT )
3421  {
3422  tok = NextTok();
3423  if( tok != T_net )
3424  Expecting( T_net );
3425  growth->net_id = CurText();
3426  NeedRIGHT();
3427  }
3428  else
3429  Unexpected( CurText() );
3430  }
3431 }
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:370
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
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)
throw (IO_ERROR
)
private

Definition at line 1143 of file specctra.cpp.

1144 {
1145  T tok = NextTok();
1146 
1147  if( tok<0 )
1148  Unexpected( CurText() );
1149 
1150  growth->value = tok;
1151 
1152  NeedRIGHT();
1153 }
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:370
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:402
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)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2457 of file specctra.cpp.

References DSN::T_comp_order, DSN::T_fromto, DSN::T_LEFT, and DSN::T_RIGHT.

2458 {
2459  T tok;
2460 
2461  /* <topology_descriptor >::=
2462  (topology {[<fromto_descriptor> |
2463  <component_order_descriptor> ]})
2464  */
2465 
2466  while( (tok = NextTok()) != T_RIGHT )
2467  {
2468  if( tok != T_LEFT )
2469  Expecting( T_LEFT );
2470 
2471  tok = NextTok();
2472  switch( tok )
2473  {
2474  case T_fromto:
2475  FROMTO* fromto;
2476  fromto = new FROMTO( growth );
2477  growth->fromtos.push_back( fromto );
2478  doFROMTO( fromto );
2479  break;
2480 
2481  case T_comp_order:
2482  COMP_ORDER* comp_order;
2483  comp_order = new COMP_ORDER( growth );
2484  growth->comp_orders.push_back( comp_order );
2485  doCOMP_ORDER( comp_order );
2486  break;
2487 
2488  default:
2489  Unexpected( CurText() );
2490  }
2491  }
2492 }
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:370
void doCOMP_ORDER(COMP_ORDER *growth)
Definition: specctra.cpp:2650
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:2668
void DSN::SPECCTRA_DB::doUNIT ( UNIT_RES growth)
throw (IO_ERROR
)
private

Definition at line 553 of file specctra.cpp.

References DSN::T_cm, DSN::T_inch, DSN::T_mil, DSN::T_mm, and DSN::T_um.

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:354
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:402
void DSN::SPECCTRA_DB::doVIA ( VIA growth)
throw (IO_ERROR
)
private

Definition at line 1156 of file specctra.cpp.

References DSN::T_LEFT, DSN::T_RIGHT, DSN::T_spare, and DSN::T_SYMBOL.

1157 {
1158  T tok;
1159 
1160  while( (tok = NextTok()) != T_RIGHT )
1161  {
1162  if( tok == T_LEFT )
1163  {
1164  if( NextTok() != T_spare )
1165  Expecting( T_spare );
1166 
1167  while( (tok = NextTok()) != T_RIGHT )
1168  {
1169  if( !IsSymbol( tok ) )
1170  Expecting( T_SYMBOL );
1171 
1172  growth->spares.push_back( CurText() );
1173  }
1174  }
1175  else if( IsSymbol( tok ) )
1176  {
1177  growth->padstacks.push_back( CurText() );
1178  }
1179  else
1180  Unexpected( CurText() );
1181  }
1182 }
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:370
static bool IsSymbol(int aTok)
Function IsSymbol tests a token to see if it is a symbol.
Definition: dsnlexer.cpp:345
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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)
throw (IO_ERROR
)
private

Definition at line 3206 of file specctra.cpp.

References DSN::PIN_REF::component_id, empty(), DSN::PIN_PAIR::is, DSN::PIN_REF::pin_id, DSN::T_LEFT, DSN::T_pins, DSN::T_RIGHT, and DSN::PIN_PAIR::was.

3207 {
3208  T tok;
3209  PIN_PAIR empty( growth );
3210  PIN_PAIR* pin_pair;
3211 
3212  /* <was_is_descriptor >::=
3213  (was_is {(pins <pin_reference> <pin_reference> )})
3214  */
3215 
3216  // none of the pins is ok too
3217  while( (tok = NextTok()) != T_RIGHT )
3218  {
3219 
3220  if( tok != T_LEFT )
3221  Expecting( T_LEFT );
3222 
3223  tok = NextTok();
3224  switch( tok )
3225  {
3226  case T_pins:
3227  // copy the empty one, then fill its copy later thru pin_pair.
3228  growth->pin_pairs.push_back( empty );
3229  pin_pair= &growth->pin_pairs.back();
3230 
3231  NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
3232  readCOMPnPIN( &pin_pair->was.component_id, &pin_pair->was.pin_id );
3233 
3234  NeedSYMBOL(); // readCOMPnPIN() expects 1st token to have been read
3235  readCOMPnPIN( &pin_pair->is.component_id, &pin_pair->is.pin_id );
3236 
3237  NeedRIGHT();
3238  break;
3239 
3240  default:
3241  Unexpected( CurText() );
3242  }
3243  }
3244 }
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:370
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
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:402
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doWINDOW ( WINDOW growth)
throw (IO_ERROR
)
private

Definition at line 911 of file specctra.cpp.

References DSN::T_circle, DSN::T_LEFT, DSN::T_path, DSN::T_polygon, DSN::T_polyline_path, DSN::T_qarc, DSN::T_rect, and DSN::T_RIGHT.

912 {
913  T tok = NextTok();
914 
915  while( tok != T_RIGHT )
916  {
917  if( tok!=T_LEFT )
918  Expecting( T_LEFT );
919 
920  tok = NextTok();
921  switch( tok )
922  {
923  case T_rect:
924  if( growth->shape )
925  Unexpected( tok );
926  growth->shape = new RECTANGLE( growth );
927  doRECTANGLE( (RECTANGLE*) growth->shape );
928  break;
929 
930  case T_circle:
931  if( growth->shape )
932  Unexpected( tok );
933  growth->shape = new CIRCLE( growth );
934  doCIRCLE( (CIRCLE*) growth->shape );
935  break;
936 
937  case T_polyline_path:
938  tok = T_path;
939  case T_path:
940  case T_polygon:
941  if( growth->shape )
942  Unexpected( tok );
943  growth->shape = new PATH( growth, tok );
944  doPATH( (PATH*) growth->shape );
945  break;
946 
947  case T_qarc:
948  if( growth->shape )
949  Unexpected( tok );
950  growth->shape = new QARC( growth );
951  doQARC( (QARC*) growth->shape );
952  break;
953 
954  default:
955  Unexpected( CurText() );
956  }
957 
958  tok = NextTok();
959  }
960 }
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:370
void doPATH(PATH *growth)
Definition: specctra.cpp:1010
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1058
void Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:354
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1083
DSN::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
void doQARC(QARC *growth)
Definition: specctra.cpp:1111
const char * CurText()
Function CurText returns a pointer to the current token's text.
Definition: dsnlexer.h:479
void DSN::SPECCTRA_DB::doWIRE ( WIRE growth)
throw ( IO_ERROR,
boost::bad_pointer
)
private

Definition at line 2754 of file specctra.cpp.

References DSN::T_attr, DSN::T_bus, DSN::T_circle, DSN::T_connect, DSN::T_fanout, DSN::T_fix, DSN::T_jumper, DSN::T_LEFT, DSN::T_net, DSN::T_normal, DSN::T_NUMBER, DSN::T_path, DSN::T_polygon, DSN::T_polyline_path, DSN::T_protect, DSN::T_qarc, DSN::T_rect, DSN::T_RIGHT, DSN::T_route, DSN::T_shield, DSN::T_supply, DSN::T_test, DSN::T_turret, DSN::T_type, and DSN::T_window.

2755 {
2756  T tok;
2757 
2758  /* <wire_shape_descriptor >::=
2759  (wire
2760  <shape_descriptor>
2761  [(net <net_id >)]
2762  [(turret <turret#> )]
2763  [(type [fix | route | normal | protect])]
2764  [(attr [test | fanout | bus | jumper])]
2765  [(shield <net_id >)]
2766  [{<window_descriptor> }]
2767  [(connect
2768  (terminal <object_type> [<pin_reference> ])
2769  (terminal <object_type> [<pin_reference> ])
2770  )]
2771  [(supply)]
2772  )
2773  */
2774 
2775  while( (tok = NextTok()) != T_RIGHT )
2776  {
2777  if( tok != T_LEFT )
2778  Expecting( T_LEFT );
2779 
2780  tok = NextTok();
2781  switch( tok )
2782  {
2783  case T_rect:
2784  if( growth->shape )
2785  Unexpected( tok );
2786  growth->shape = new RECTANGLE( growth );
2787  doRECTANGLE( (RECTANGLE*) growth->shape );
2788  break;
2789 
2790  case T_circle:
2791  if( growth->shape )
2792  Unexpected( tok );
2793  growth->shape = new CIRCLE( growth );
2794  doCIRCLE( (CIRCLE*) growth->shape );
2795  break;
2796 
2797  case T_polyline_path:
2798  tok = T_path;
2799  case T_path:
2800  case T_polygon:
2801  if( growth->shape )
2802  Unexpected( tok );
2803  growth->shape = new PATH( growth, tok );
2804  doPATH( (PATH*) growth->shape );
2805  break;
2806 
2807  case T_qarc:
2808  if( growth->shape )
2809  Unexpected( tok );
2810  growth->shape = new QARC( growth );
2811  doQARC( (QARC*) growth->shape );
2812  break;
2813 
2814  case T_net:
2816  growth->net_id = CurText();
2817  NeedRIGHT();
2818  break;
2819 
2820  case T_turret:
2821  if( NextTok() != T_NUMBER )
2822  Expecting( T_NUMBER );
2823  growth->turret = atoi( CurText() );
2824  NeedRIGHT();
2825  break;
2826 
2827  case T_type:
2828  tok = NextTok();
2829  if( tok!=T_fix && tok!=T_route && tok!=T_normal && tok!=T_protect )
2830  Expecting( "fix|route|normal|protect" );
2831  growth->wire_type = tok;
2832  NeedRIGHT();
2833  break;
2834 
2835  case T_attr:
2836  tok = NextTok();
2837  if( tok!=T_test && tok!=T_fanout && tok!=T_bus && tok!=T_jumper )
2838  Expecting( "test|fanout|bus|jumper" );
2839  growth->attr = tok;
2840  NeedRIGHT();
2841  break;
2842