Commit d06366ef authored by dickelbeck's avatar dickelbeck

renamed PLANE, fixed Format()s

parent 01ab8ff4
...@@ -559,7 +559,6 @@ class PATH : public ELEM ...@@ -559,7 +559,6 @@ class PATH : public ELEM
double aperture_width; double aperture_width;
POINTS points; POINTS points;
DSN_T aperture_type; DSN_T aperture_type;
public: public:
...@@ -579,19 +578,32 @@ public: ...@@ -579,19 +578,32 @@ public:
{ {
const char* quote = out->GetQuoteChar( layer_id.c_str() ); const char* quote = out->GetQuoteChar( layer_id.c_str() );
out->Print( nestLevel, "(%s %s%s%s %.6g\n", LEXER::GetTokenText( Type() ), const int RIGHTMARGIN = 80;
quote, layer_id.c_str(), quote, int perLine = out->Print( nestLevel, "(%s %s%s%s %.6g",
aperture_width ); LEXER::GetTokenText( Type() ),
quote, layer_id.c_str(), quote,
aperture_width );
for( unsigned i=0; i<points.size(); ++i ) for( unsigned i=0; i<points.size(); ++i )
{ {
out->Print( nestLevel+1, "%.6g %.6g\n", points[i].x, points[i].y ); if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
else
perLine += out->Print( 0, " " );
perLine += out->Print( 0, "%.6g %.6g", points[i].x, points[i].y );
} }
if( aperture_type == T_square ) if( aperture_type == T_square )
{
out->Print( 0, "\n" );
out->Print( nestLevel+1, "(aperture_type square)\n" ); out->Print( nestLevel+1, "(aperture_type square)\n" );
}
out->Print( nestLevel, ")\n" ); out->Print( 0, ")\n" );
} }
}; };
typedef boost::ptr_vector<PATH> PATHS; typedef boost::ptr_vector<PATH> PATHS;
...@@ -835,6 +847,7 @@ public: ...@@ -835,6 +847,7 @@ public:
out->Print( nestLevel, ")\n" ); out->Print( nestLevel, ")\n" );
} }
}; };
typedef boost::ptr_vector<KEEPOUT> KEEPOUTS;
/** /**
...@@ -1129,15 +1142,20 @@ public: ...@@ -1129,15 +1142,20 @@ public:
}; };
class PLANE : public KEEPOUT /**
* Class COPPER_PLANE
* corresponds to a &lt;plane_descriptor&gt; in the specctra dsn spec.
*/
class COPPER_PLANE : public KEEPOUT
{ {
friend class SPECCTRA_DB; friend class SPECCTRA_DB;
public: public:
PLANE( ELEM* aParent ) : COPPER_PLANE( ELEM* aParent ) :
KEEPOUT( aParent, T_plane ) KEEPOUT( aParent, T_plane )
{} {}
}; };
typedef boost::ptr_vector<COPPER_PLANE> COPPER_PLANES;
/** /**
...@@ -1317,11 +1335,9 @@ class STRUCTURE : public ELEM_HOLDER ...@@ -1317,11 +1335,9 @@ class STRUCTURE : public ELEM_HOLDER
CONTROL* control; CONTROL* control;
RULE* rules; RULE* rules;
typedef boost::ptr_vector<KEEPOUT> KEEPOUTS;
KEEPOUTS keepouts; KEEPOUTS keepouts;
typedef boost::ptr_vector<PLANE> PLANES; COPPER_PLANES planes;
PLANES planes;
typedef boost::ptr_vector<REGION> REGIONS; typedef boost::ptr_vector<REGION> REGIONS;
REGIONS regions; REGIONS regions;
...@@ -1393,7 +1409,7 @@ public: ...@@ -1393,7 +1409,7 @@ public:
if( place_boundary ) if( place_boundary )
place_boundary->Format( out, nestLevel ); place_boundary->Format( out, nestLevel );
for( PLANES::iterator i=planes.begin(); i!=planes.end(); ++i ) for( COPPER_PLANES::iterator i=planes.begin(); i!=planes.end(); ++i )
i->Format( out, nestLevel ); i->Format( out, nestLevel );
for( REGIONS::iterator i=regions.begin(); i!=regions.end(); ++i ) for( REGIONS::iterator i=regions.begin(); i!=regions.end(); ++i )
...@@ -1470,7 +1486,7 @@ public: ...@@ -1470,7 +1486,7 @@ public:
PLACE( ELEM* aParent ) : PLACE( ELEM* aParent ) :
ELEM( T_place, aParent ) ELEM( T_place, aParent )
{ {
side = T_NONE; side = T_front;
isRotated = false; isRotated = false;
hasVertex = false; hasVertex = false;
...@@ -1703,6 +1719,8 @@ class IMAGE : public ELEM_HOLDER ...@@ -1703,6 +1719,8 @@ class IMAGE : public ELEM_HOLDER
RULE* rules; RULE* rules;
RULE* place_rules; RULE* place_rules;
KEEPOUTS keepouts;
public: public:
...@@ -1748,6 +1766,9 @@ public: ...@@ -1748,6 +1766,9 @@ public:
if( place_rules ) if( place_rules )
place_rules->Format( out, nestLevel+1 ); place_rules->Format( out, nestLevel+1 );
for( KEEPOUTS::iterator i=keepouts.begin(); i!=keepouts.end(); ++i )
i->Format( out, nestLevel+1 );
out->Print( nestLevel, ")\n" ); out->Print( nestLevel, ")\n" );
} }
...@@ -1866,8 +1887,8 @@ class LIBRARY : public ELEM ...@@ -1866,8 +1887,8 @@ class LIBRARY : public ELEM
public: public:
LIBRARY( ELEM* aParent ) : LIBRARY( ELEM* aParent, DSN_T aType = T_library ) :
ELEM( T_library, aParent ) ELEM( aType, aParent )
{ {
unit = 0; unit = 0;
} }
...@@ -1915,13 +1936,19 @@ public: ...@@ -1915,13 +1936,19 @@ public:
ELEM( T_pin, aParent ) ELEM( T_pin, aParent )
{ {
} }
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) /**
* Function FormatIt
* is like Format() but is not virual and returns the number of characters
* that were output.
*/
int FormatIt( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
// only print the newline if there is a nest level, and make // only print the newline if there is a nest level, and make
// the quotes unconditional on this one. // the quotes unconditional on this one.
const char* newline = nestLevel ? "\n" : ""; const char* newline = nestLevel ? "\n" : "";
out->Print( nestLevel, "\"%s\"-\"%s\"%s",
return out->Print( nestLevel, "\"%s\"-\"%s\"%s",
component_id.c_str(), pin_id.c_str(), newline ); component_id.c_str(), pin_id.c_str(), newline );
} }
}; };
...@@ -1960,7 +1987,7 @@ public: ...@@ -1960,7 +1987,7 @@ public:
out->Print( nestLevel, "(%s %s %s ", out->Print( nestLevel, "(%s %s %s ",
LEXER::GetTokenText( Type() ), fromText.c_str(), toText.c_str() ); LEXER::GetTokenText( Type() ), fromText.c_str(), toText.c_str() );
if( type != T_NONE ) if( fromto_type != T_NONE )
out->Print( 0, "(type %s)", LEXER::GetTokenText( fromto_type ) ); out->Print( 0, "(type %s)", LEXER::GetTokenText( fromto_type ) );
if( net_id.size() ) if( net_id.size() )
...@@ -1993,6 +2020,7 @@ public: ...@@ -1993,6 +2020,7 @@ public:
out->Print( 0, "\n" ); out->Print( 0, "\n" );
} }
}; };
typedef boost::ptr_vector<FROMTO> FROMTOS;
/** /**
...@@ -2048,7 +2076,7 @@ class NET : public ELEM ...@@ -2048,7 +2076,7 @@ class NET : public ELEM
LAYER_RULES layer_rules; LAYER_RULES layer_rules;
FROMTO* fromto; FROMTOS fromtos;
COMP_ORDER* comp_order; COMP_ORDER* comp_order;
...@@ -2065,14 +2093,12 @@ public: ...@@ -2065,14 +2093,12 @@ public:
supply = T_NONE; supply = T_NONE;
rules = 0; rules = 0;
fromto = 0;
comp_order = 0; comp_order = 0;
} }
~NET() ~NET()
{ {
delete rules; delete rules;
delete fromto;
delete comp_order; delete comp_order;
} }
...@@ -2090,11 +2116,24 @@ public: ...@@ -2090,11 +2116,24 @@ public:
out->Print( 0, "(net_number %d)", net_number ); out->Print( 0, "(net_number %d)", net_number );
out->Print( 0, "\n" ); out->Print( 0, "\n" );
const int RIGHTMARGIN = 80;
int perLine = out->Print( nestLevel+1, "(%s", LEXER::GetTokenText( pins_type ) );
out->Print( nestLevel+1, "(%s\n", LEXER::GetTokenText( pins_type ) );
for( PIN_REFS::iterator i=pins.begin(); i!=pins.end(); ++i ) for( PIN_REFS::iterator i=pins.begin(); i!=pins.end(); ++i )
i->Format( out, nestLevel+2 ); {
out->Print( nestLevel+1, ")\n" ); if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n");
perLine = out->Print( nestLevel+2, "%s", "" );
}
else
perLine += out->Print( 0, " " );
perLine += i->FormatIt( out, 0 );
}
out->Print( 0, ")\n" );
if( comp_order ) if( comp_order )
comp_order->Format( out, nestLevel+1 ); comp_order->Format( out, nestLevel+1 );
...@@ -2108,8 +2147,8 @@ public: ...@@ -2108,8 +2147,8 @@ public:
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 );
if( fromto ) for( FROMTOS::iterator i=fromtos.begin(); i!=fromtos.end(); ++i )
fromto->Format( out, nestLevel+1 ); i->Format( out, nestLevel+1 );
out->Print( nestLevel, ")\n" ); out->Print( nestLevel, ")\n" );
} }
...@@ -2120,7 +2159,6 @@ class TOPOLOGY : public ELEM ...@@ -2120,7 +2159,6 @@ class TOPOLOGY : public ELEM
{ {
friend class SPECCTRA_DB; friend class SPECCTRA_DB;
typedef boost::ptr_vector<FROMTO> FROMTOS;
FROMTOS fromtos; FROMTOS fromtos;
typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS; typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
...@@ -2372,6 +2410,7 @@ class WIRE_VIA : public ELEM ...@@ -2372,6 +2410,7 @@ class WIRE_VIA : public ELEM
std::string virtual_pin_name; std::string virtual_pin_name;
STRINGS contact_layers; STRINGS contact_layers;
bool supply; bool supply;
public: public:
WIRE_VIA( ELEM* aParent ) : WIRE_VIA( ELEM* aParent ) :
...@@ -2386,65 +2425,97 @@ public: ...@@ -2386,65 +2425,97 @@ public:
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
const char* quote = out->GetQuoteChar( padstack_id.c_str() ); const char* quote = out->GetQuoteChar( padstack_id.c_str() );
out->Print( nestLevel, "(%s %s%s%s", LEXER::GetTokenText( Type() ),
quote, padstack_id.c_str(), quote );
const int RIGHTMARGIN = 80; const int RIGHTMARGIN = 80;
int perLine=RIGHTMARGIN; int perLine = out->Print( nestLevel, "(%s %s%s%s",
LEXER::GetTokenText( Type() ),
quote, padstack_id.c_str(), quote );
for( POINTS::iterator i=vertexes.begin(); i!=vertexes.end(); ++i ) for( POINTS::iterator i=vertexes.begin(); i!=vertexes.end(); ++i )
{ {
if( perLine >= RIGHTMARGIN ) if( perLine > RIGHTMARGIN )
{ {
out->Print( 0, "\n" ); out->Print( 0, "\n" );
perLine = 0; perLine = out->Print( nestLevel+1, "%s", "" );
perLine += out->Print( nestLevel+1, "%.6g %.6g", i->x, i->y );
} }
else else
{ perLine += out->Print( 0, " " );
perLine += out->Print( 0, " %.6g %.6g", i->x, i->y );
} perLine += out->Print( 0, "%.6g %.6g", i->x, i->y );
} }
out->Print( 0, "\n" );
if( net_id.size() ) if( net_id.size() )
{ {
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
const char* quote = out->GetQuoteChar( net_id.c_str() ); const char* quote = out->GetQuoteChar( net_id.c_str() );
out->Print( nestLevel+1, "(net %s%s%s)\n", quote, net_id.c_str(), quote ); perLine += out->Print( 0, "(net %s%s%s)", quote, net_id.c_str(), quote );
} }
if( via_number != -1 ) if( via_number != -1 )
out->Print( nestLevel+1, "(via_number %d)\n", via_number ); {
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
perLine += out->Print( 0, "(via_number %d)", via_number );
}
if( type != T_NONE ) if( type != T_NONE )
out->Print( nestLevel+1, "(type %s)\n", LEXER::GetTokenText( type ) ); {
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
perLine += out->Print( 0, "(type %s)", LEXER::GetTokenText( type ) );
}
if( attr != T_NONE ) if( attr != T_NONE )
{ {
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
if( attr == T_virtual_pin ) if( attr == T_virtual_pin )
{ {
const char* quote = out->GetQuoteChar( virtual_pin_name.c_str() ); const char* quote = out->GetQuoteChar( virtual_pin_name.c_str() );
out->Print( nestLevel+1, "(attr virtual_pin %s%s%s)\n", perLine += out->Print( 0, "(attr virtual_pin %s%s%s)",
quote, virtual_pin_name.c_str(), quote ); quote, virtual_pin_name.c_str(), quote );
} }
else else
out->Print( nestLevel+1, "(attr %s)\n", LEXER::GetTokenText( attr ) ); perLine += out->Print( 0, "(attr %s)", LEXER::GetTokenText( attr ) );
}
if( supply )
{
if( perLine > RIGHTMARGIN )
{
out->Print( 0, "\n" );
perLine = out->Print( nestLevel+1, "%s", "" );
}
perLine += out->Print( 0, "(supply)" );
} }
if( contact_layers.size() ) if( contact_layers.size() )
{ {
out->Print( 0, "\n" );
out->Print( nestLevel+1, "(contact\n" ); out->Print( nestLevel+1, "(contact\n" );
for( STRINGS::iterator i=contact_layers.begin(); i!=contact_layers.end(); ++i ) for( STRINGS::iterator i=contact_layers.begin(); i!=contact_layers.end(); ++i )
{ {
const char* quote = out->GetQuoteChar( i->c_str() ); const char* quote = out->GetQuoteChar( i->c_str() );
out->Print( nestLevel+2, "%s%s%s\n", quote, i->c_str(), quote ); out->Print( nestLevel+2, "%s%s%s\n", quote, i->c_str(), quote );
} }
out->Print( nestLevel+1, ")\n" ); out->Print( nestLevel+1, "))\n" );
} }
else
if( supply ) out->Print( 0, ")\n" );
out->Print( nestLevel+1, "(supply)\n" );
out->Print( nestLevel, ")\n" );
} }
}; };
typedef boost::ptr_vector<WIRE_VIA> WIRE_VIAS; typedef boost::ptr_vector<WIRE_VIA> WIRE_VIAS;
...@@ -2700,7 +2771,7 @@ public: ...@@ -2700,7 +2771,7 @@ public:
else else
{ {
for( PIN_REFS::iterator i=pin_refs.begin(); i!=pin_refs.end(); ++i ) for( PIN_REFS::iterator i=pin_refs.begin(); i!=pin_refs.end(); ++i )
i->Format( out, nestLevel+1 ); i->FormatIt( out, nestLevel+1 );
} }
if( net_id.size() ) if( net_id.size() )
......
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