Commit 8ef96230 authored by dickelbeck's avatar dickelbeck

more amazing free specctra software

parent 316d7b73
...@@ -1251,10 +1251,10 @@ void SPECCTRA_DB::doPROPERTIES( PROPERTIES* growth ) throw( IOError ) ...@@ -1251,10 +1251,10 @@ void SPECCTRA_DB::doPROPERTIES( PROPERTIES* growth ) throw( IOError )
if( tok != T_LEFT ) if( tok != T_LEFT )
expecting( T_LEFT ); expecting( T_LEFT );
needSYMBOL(); needSYMBOLorNUMBER();
property.name = lexer->CurText(); property.name = lexer->CurText();
needSYMBOL(); needSYMBOLorNUMBER();
property.value = lexer->CurText(); property.value = lexer->CurText();
growth->push_back( property ); growth->push_back( property );
...@@ -1848,7 +1848,7 @@ void SPECCTRA_DB::doPLACE( PLACE* growth ) throw( IOError ) ...@@ -1848,7 +1848,7 @@ void SPECCTRA_DB::doPLACE( PLACE* growth ) throw( IOError )
case T_pn: case T_pn:
if( growth->part_number.size() ) if( growth->part_number.size() )
unexpected( tok ); unexpected( tok );
needSYMBOL(); needSYMBOLorNUMBER();
growth->part_number = lexer->CurText(); growth->part_number = lexer->CurText();
needRIGHT(); needRIGHT();
break; break;
...@@ -2561,7 +2561,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError ) ...@@ -2561,7 +2561,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError )
doTOPOLOGY( growth->topology ); doTOPOLOGY( growth->topology );
break; break;
default: // handle all the circuit_descriptor here as strings case T_circuit: // handle all the circuit_descriptor here as strings
{ {
std::string builder; std::string builder;
int bracketNesting = 1; // we already saw the opening T_LEFT int bracketNesting = 1; // we already saw the opening T_LEFT
...@@ -2607,6 +2607,10 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError ) ...@@ -2607,6 +2607,10 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError )
if( tok==T_EOF ) if( tok==T_EOF )
unexpected( T_EOF ); unexpected( T_EOF );
} // scope bracket } // scope bracket
break;
default:
unexpected( lexer->CurText() );
} // switch } // switch
tok = nextTok(); tok = nextTok();
...@@ -3486,6 +3490,7 @@ const char* OUTPUTFORMATTER::GetQuoteChar( const char* wrapee, const char* quote ...@@ -3486,6 +3490,7 @@ const char* OUTPUTFORMATTER::GetQuoteChar( const char* wrapee, const char* quote
{ {
static const char quoteThese[] = "\t ()" static const char quoteThese[] = "\t ()"
"%" // per Alfons of freerouting.net, he does not like this unquoted as of 1-Feb-2008 "%" // per Alfons of freerouting.net, he does not like this unquoted as of 1-Feb-2008
"{}" // guessing that these are problems too
; ;
// if the string to be wrapped (wrapee) has a delimiter in it, // if the string to be wrapped (wrapee) has a delimiter in it,
......
...@@ -225,8 +225,8 @@ struct POINT ...@@ -225,8 +225,8 @@ struct POINT
/** /**
* Function FixNegativeZero * Function FixNegativeZero
* will change negative zero to positive zero in the IEEE floating point * will change negative zero to positive zero in the IEEE floating point
* storage format. Basically turns off the sign bit if the mantiss and exponent * storage format. Basically turns off the sign bit if the mantissa and
* would say the value is zero. * exponent say the value is otherwise zero.
*/ */
void FixNegativeZero() void FixNegativeZero()
{ {
...@@ -536,7 +536,7 @@ class RECTANGLE : public ELEM ...@@ -536,7 +536,7 @@ class RECTANGLE : public ELEM
std::string layer_id; std::string layer_id;
POINT point0; POINT point0; ///< one of two opposite corners
POINT point1; POINT point1;
public: public:
...@@ -882,11 +882,12 @@ class WINDOW : public ELEM ...@@ -882,11 +882,12 @@ class WINDOW : public ELEM
friend class SPECCTRA_DB; friend class SPECCTRA_DB;
protected: protected:
/* shape holds one of these /* <shape_descriptor >::=
PATH* path; ///< used for both path and polygon [<rectangle_descriptor> |
RECTANGLE* rectangle; <circle_descriptor> |
CIRCLE* circle; <polygon_descriptor> |
QARC* qarc; <path_descriptor> |
<qarc_descriptor> ]
*/ */
ELEM* shape; ELEM* shape;
...@@ -2561,6 +2562,7 @@ public: ...@@ -2561,6 +2562,7 @@ public:
out->Print( 0, "\n" ); out->Print( 0, "\n" );
} }
}; };
typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
class NET : public ELEM class NET : public ELEM
...@@ -2677,6 +2679,7 @@ public: ...@@ -2677,6 +2679,7 @@ public:
out->Print( nestLevel, ")\n" ); out->Print( nestLevel, ")\n" );
} }
}; };
typedef boost::ptr_vector<NET> NETS;
class TOPOLOGY : public ELEM class TOPOLOGY : public ELEM
...@@ -2685,7 +2688,6 @@ class TOPOLOGY : public ELEM ...@@ -2685,7 +2688,6 @@ class TOPOLOGY : public ELEM
FROMTOS fromtos; FROMTOS fromtos;
typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
COMP_ORDERS comp_orders; COMP_ORDERS comp_orders;
public: public:
...@@ -2739,35 +2741,45 @@ public: ...@@ -2739,35 +2741,45 @@ public:
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
const int RIGHTMARGIN = 80;
const char* quote = out->GetQuoteChar( class_id.c_str() ); const char* quote = out->GetQuoteChar( class_id.c_str() );
int perLine = out->Print( nestLevel, "(%s %s%s%s", int perLine = out->Print( nestLevel, "(%s %s%s%s",
LEXER::GetTokenText( Type() ), LEXER::GetTokenText( Type() ),
quote, class_id.c_str(), quote ); quote, class_id.c_str(), quote );
const int RIGHTMARGIN = 72;
for( STRINGS::iterator i=net_ids.begin(); i!=net_ids.end(); ++i ) for( STRINGS::iterator i=net_ids.begin(); i!=net_ids.end(); ++i )
{ {
const char* space = " ";
if( perLine > RIGHTMARGIN ) if( perLine > RIGHTMARGIN )
{ {
out->Print( 0, "\n" ); out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" ); perLine = out->Print( nestLevel+1, "%s", "" );
space = ""; // no space at first net_id of the line
} }
quote = out->GetQuoteChar( i->c_str() ); quote = out->GetQuoteChar( i->c_str() );
perLine += out->Print( 0, " %s%s%s", quote, i->c_str(), quote ); perLine += out->Print( 0, "%s%s%s%s", space, quote, i->c_str(), quote );
} }
bool newLine = false; bool newLine = false;
if( circuit.size() || layer_rules.size() || topology ) if( circuit.size() || rules || layer_rules.size() || topology )
{ {
out->Print( 0, "\n" ); out->Print( 0, "\n" );
newLine = true; newLine = true;
} }
if( circuit.size() )
{
out->Print( nestLevel+1, "(circuit\n" );
for( STRINGS::iterator i=circuit.begin(); i!=circuit.end(); ++i ) for( STRINGS::iterator i=circuit.begin(); i!=circuit.end(); ++i )
out->Print( nestLevel+1, "%s\n", i->c_str() ); out->Print( nestLevel+2, "%s\n", i->c_str() );
out->Print( nestLevel+1, ")\n" );
}
if( rules )
rules->Format( out, nestLevel+1 );
for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i ) for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i )
i->Format( out, nestLevel+1 ); i->Format( out, nestLevel+1 );
...@@ -2778,16 +2790,14 @@ public: ...@@ -2778,16 +2790,14 @@ public:
out->Print( newLine ? nestLevel : 0, ")\n" ); out->Print( newLine ? nestLevel : 0, ")\n" );
} }
}; };
typedef boost::ptr_vector<CLASS> CLASSLIST;
class NETWORK : public ELEM class NETWORK : public ELEM
{ {
friend class SPECCTRA_DB; friend class SPECCTRA_DB;
typedef boost::ptr_vector<NET> NETS;
NETS nets; NETS nets;
typedef boost::ptr_vector<CLASS> CLASSLIST;
CLASSLIST classes; CLASSLIST classes;
...@@ -3637,6 +3647,7 @@ class SPECCTRA_DB : public OUTPUTFORMATTER ...@@ -3637,6 +3647,7 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
*/ */
int findLayerName( const std::string& aLayerName ) const; int findLayerName( const std::string& aLayerName ) const;
/** /**
* Function nextTok * Function nextTok
* returns the next token from the lexer. * returns the next token from the lexer.
...@@ -3843,12 +3854,6 @@ class SPECCTRA_DB : public OUTPUTFORMATTER ...@@ -3843,12 +3854,6 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
nets.clear(); nets.clear();
} }
/**
* Function flipMODULEs
* flips the modules which are on the back side of the board to the front.
*/
void flipMODULEs( BOARD* aBoard );
//-----<FromSESSION>----------------------------------------------------- //-----<FromSESSION>-----------------------------------------------------
/** /**
...@@ -4002,6 +4007,12 @@ public: ...@@ -4002,6 +4007,12 @@ public:
*/ */
void ExportSESSION( wxString aFilename ); void ExportSESSION( wxString aFilename );
/**
* Function FlipMODULEs
* flips the modules which are on the back side of the board to the front.
*/
void FlipMODULEs( BOARD* aBoard );
/** /**
* Function RevertMODULEs * Function RevertMODULEs
* flips the modules which were on the back side of the board back to the back. * flips the modules which were on the back side of the board back to the back.
......
This diff is collapsed.
...@@ -167,7 +167,7 @@ static int scale( double distance, UNIT_RES* aResolution ) ...@@ -167,7 +167,7 @@ static int scale( double distance, UNIT_RES* aResolution )
static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
{ {
wxPoint ret( scale( aPoint.x, aResolution ), wxPoint ret( scale( aPoint.x, aResolution ),
-scale( aPoint.y, aResolution )); // negate y -scale( aPoint.y, aResolution ) ); // negate y
return ret; return ret;
} }
...@@ -347,15 +347,18 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -347,15 +347,18 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
if( !session->route->library ) if( !session->route->library )
ThrowIOError( _("Session file is missing the \"library_out\" section") ); ThrowIOError( _("Session file is missing the \"library_out\" section") );
#if 1
// delete all the old tracks and vias // delete all the old tracks and vias
aBoard->m_Track->DeleteStructList(); aBoard->m_Track->DeleteStructList();
aBoard->m_Track = NULL; aBoard->m_Track = NULL;
aBoard->m_NbSegmTrack = 0; aBoard->m_NbSegmTrack = 0;
#endif
aBoard->DeleteMARKERs(); aBoard->DeleteMARKERs();
buildLayerMaps( aBoard ); buildLayerMaps( aBoard );
#if 1
// Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
// each COMPONENT, reposition and re-orient each component and put on // each COMPONENT, reposition and re-orient each component and put on
// correct side of the board. // correct side of the board.
...@@ -413,6 +416,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -413,6 +416,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
} }
} }
} }
#endif
routeResolution = session->route->GetUnits(); routeResolution = session->route->GetUnits();
...@@ -430,8 +434,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -430,8 +434,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
EQUIPOT* equipot = aBoard->FindNet( netName ); EQUIPOT* equipot = aBoard->FindNet( netName );
if( equipot ) if( equipot )
netCode = equipot->GetNet(); netCode = equipot->GetNet();
else // else netCode remains 0
// else netCode remains 0 {
// int breakhere = 1;
}
} }
WIRES& wires = net->wires; WIRES& wires = net->wires;
...@@ -442,21 +448,38 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -442,21 +448,38 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
if( shape != T_path ) if( shape != T_path )
{ {
/* shape == T_polygon is expected from freerouter if you have
a zone on a non "power" type layer, i.e. a T_signal layer
and the design does a round trip back in as session here.
We kept our own zones in the BOARD, so ignore this so called
'wire'.
wxString netId = CONV_FROM_UTF8( wire->net_id.c_str() ); wxString netId = CONV_FROM_UTF8( wire->net_id.c_str() );
ThrowIOError( ThrowIOError(
_("Unsupported wire shape: \"%s\" for net: \"%s\""), _("Unsupported wire shape: \"%s\" for net: \"%s\""),
LEXER::GetTokenString(shape).GetData(), LEXER::GetTokenString(shape).GetData(),
netId.GetData() netId.GetData()
); );
*/
} }
else
{
PATH* path = (PATH*) wire->shape; PATH* path = (PATH*) wire->shape;
for( unsigned pt=0; pt<path->points.size()-1; ++pt ) for( unsigned pt=0; pt<path->points.size()-1; ++pt )
{ {
/* a debugging aid, may come in handy
if( path->points[pt].x == 547800
&& path->points[pt].y == -380250 )
{
int breakhere = 1;
}
*/
TRACK* track = makeTRACK( path, pt, netCode ); TRACK* track = makeTRACK( path, pt, netCode );
aBoard->Add( track ); aBoard->Add( track );
} }
} }
}
WIRE_VIAS& wire_vias = net->wire_vias; WIRE_VIAS& wire_vias = net->wire_vias;
LIBRARY& library = *session->route->library; LIBRARY& library = *session->route->library;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment