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 )
if( tok != T_LEFT )
expecting( T_LEFT );
needSYMBOL();
needSYMBOLorNUMBER();
property.name = lexer->CurText();
needSYMBOL();
needSYMBOLorNUMBER();
property.value = lexer->CurText();
growth->push_back( property );
......@@ -1848,7 +1848,7 @@ void SPECCTRA_DB::doPLACE( PLACE* growth ) throw( IOError )
case T_pn:
if( growth->part_number.size() )
unexpected( tok );
needSYMBOL();
needSYMBOLorNUMBER();
growth->part_number = lexer->CurText();
needRIGHT();
break;
......@@ -2561,7 +2561,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError )
doTOPOLOGY( growth->topology );
break;
default: // handle all the circuit_descriptor here as strings
case T_circuit: // handle all the circuit_descriptor here as strings
{
std::string builder;
int bracketNesting = 1; // we already saw the opening T_LEFT
......@@ -2607,6 +2607,10 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IOError )
if( tok==T_EOF )
unexpected( T_EOF );
} // scope bracket
break;
default:
unexpected( lexer->CurText() );
} // switch
tok = nextTok();
......@@ -3486,6 +3490,7 @@ const char* OUTPUTFORMATTER::GetQuoteChar( const char* wrapee, const char* quote
{
static const char quoteThese[] = "\t ()"
"%" // 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,
......
......@@ -225,8 +225,8 @@ struct POINT
/**
* Function FixNegativeZero
* 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
* would say the value is zero.
* storage format. Basically turns off the sign bit if the mantissa and
* exponent say the value is otherwise zero.
*/
void FixNegativeZero()
{
......@@ -536,7 +536,7 @@ class RECTANGLE : public ELEM
std::string layer_id;
POINT point0;
POINT point0; ///< one of two opposite corners
POINT point1;
public:
......@@ -882,11 +882,12 @@ class WINDOW : public ELEM
friend class SPECCTRA_DB;
protected:
/* shape holds one of these
PATH* path; ///< used for both path and polygon
RECTANGLE* rectangle;
CIRCLE* circle;
QARC* qarc;
/* <shape_descriptor >::=
[<rectangle_descriptor> |
<circle_descriptor> |
<polygon_descriptor> |
<path_descriptor> |
<qarc_descriptor> ]
*/
ELEM* shape;
......@@ -2561,6 +2562,7 @@ public:
out->Print( 0, "\n" );
}
};
typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
class NET : public ELEM
......@@ -2677,6 +2679,7 @@ public:
out->Print( nestLevel, ")\n" );
}
};
typedef boost::ptr_vector<NET> NETS;
class TOPOLOGY : public ELEM
......@@ -2685,7 +2688,6 @@ class TOPOLOGY : public ELEM
FROMTOS fromtos;
typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
COMP_ORDERS comp_orders;
public:
......@@ -2739,35 +2741,45 @@ public:
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{
const int RIGHTMARGIN = 80;
const char* quote = out->GetQuoteChar( class_id.c_str() );
int perLine = out->Print( nestLevel, "(%s %s%s%s",
LEXER::GetTokenText( Type() ),
quote, class_id.c_str(), quote );
const int RIGHTMARGIN = 72;
for( STRINGS::iterator i=net_ids.begin(); i!=net_ids.end(); ++i )
{
const char* space = " ";
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
space = ""; // no space at first net_id of the line
}
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;
if( circuit.size() || layer_rules.size() || topology )
if( circuit.size() || rules || layer_rules.size() || topology )
{
out->Print( 0, "\n" );
newLine = true;
}
for( STRINGS::iterator i=circuit.begin(); i!=circuit.end(); ++i )
out->Print( nestLevel+1, "%s\n", i->c_str() );
if( circuit.size() )
{
out->Print( nestLevel+1, "(circuit\n" );
for( STRINGS::iterator i=circuit.begin(); i!=circuit.end(); ++i )
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 )
i->Format( out, nestLevel+1 );
......@@ -2778,16 +2790,14 @@ public:
out->Print( newLine ? nestLevel : 0, ")\n" );
}
};
typedef boost::ptr_vector<CLASS> CLASSLIST;
class NETWORK : public ELEM
{
friend class SPECCTRA_DB;
typedef boost::ptr_vector<NET> NETS;
NETS nets;
typedef boost::ptr_vector<CLASS> CLASSLIST;
CLASSLIST classes;
......@@ -3637,6 +3647,7 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
*/
int findLayerName( const std::string& aLayerName ) const;
/**
* Function nextTok
* returns the next token from the lexer.
......@@ -3843,12 +3854,6 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
nets.clear();
}
/**
* Function flipMODULEs
* flips the modules which are on the back side of the board to the front.
*/
void flipMODULEs( BOARD* aBoard );
//-----<FromSESSION>-----------------------------------------------------
/**
......@@ -4002,6 +4007,12 @@ public:
*/
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
* 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 )
static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
{
wxPoint ret( scale( aPoint.x, aResolution ),
-scale( aPoint.y, aResolution )); // negate y
-scale( aPoint.y, aResolution ) ); // negate y
return ret;
}
......@@ -347,15 +347,18 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
if( !session->route->library )
ThrowIOError( _("Session file is missing the \"library_out\" section") );
#if 1
// delete all the old tracks and vias
aBoard->m_Track->DeleteStructList();
aBoard->m_Track = NULL;
aBoard->m_NbSegmTrack = 0;
#endif
aBoard->DeleteMARKERs();
buildLayerMaps( aBoard );
#if 1
// Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
// each COMPONENT, reposition and re-orient each component and put on
// correct side of the board.
......@@ -413,6 +416,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
}
}
}
#endif
routeResolution = session->route->GetUnits();
......@@ -430,8 +434,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
EQUIPOT* equipot = aBoard->FindNet( netName );
if( equipot )
netCode = equipot->GetNet();
// else netCode remains 0
else // else netCode remains 0
{
// int breakhere = 1;
}
}
WIRES& wires = net->wires;
......@@ -442,19 +448,36 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
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() );
ThrowIOError(
_("Unsupported wire shape: \"%s\" for net: \"%s\""),
LEXER::GetTokenString(shape).GetData(),
netId.GetData()
);
*/
}
PATH* path = (PATH*) wire->shape;
for( unsigned pt=0; pt<path->points.size()-1; ++pt )
else
{
TRACK* track = makeTRACK( path, pt, netCode );
aBoard->Add( track );
PATH* path = (PATH*) wire->shape;
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 );
aBoard->Add( track );
}
}
}
......
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