Partial support of newer Bookshelf formats

This commit is contained in:
Gabriel Gouvine 2019-09-06 17:59:38 +02:00 committed by Jean-Paul Chaput
parent f1644fc229
commit a90b5ed890
3 changed files with 16 additions and 7 deletions

View File

@ -83,7 +83,8 @@ namespace Bookshelf {
if ( _orientation == Orientation::FS ) o << " FS";
if ( _orientation == Orientation::FW ) o << " FW";
}
if ( flags & Fixed ) o << " /FIXED";
if ( (flags & Fixed) && (flags & NoImage) ) o << " /FIXED_NI";
else if ( flags & Fixed ) o << " /FIXED";
o << std::endl;
}
}
@ -101,8 +102,12 @@ namespace Bookshelf {
if ( node->_symmetry & Symmetry::Y ) o << " Y";
if ( node->_symmetry & Symmetry::R90 ) o << " R90";
}
if ( node->_flags & Node::Terminal ) o << " terminal";
if ( node->_flags & Node::Fixed ) o << " /FIXED";
if ( (node->_flags & Node::Terminal) && (node->_flags & Node::NoImage) ) o << " terminal_NI";
else if ( node->_flags & Node::Terminal ) o << " terminal";
if ( (node->_flags & Node::Fixed) && (node->_flags & Node::NoImage) ) o << " /FIXED_NI";
else if ( node->_flags & Node::Fixed ) o << " /FIXED";
return o;
}

View File

@ -193,7 +193,7 @@ namespace Bookshelf {
{
//std::cerr << "_buffer: " << _buffer << endl;
bool terminal = false;
bool flags = false;
unsigned int symmetry = 0;
bool symmetryTokens = false;
double width = 0.0;
@ -212,7 +212,8 @@ namespace Bookshelf {
if ( _keywordCompare("R90",_tokens[itoken]) == 0 ) { symmetry |= Symmetry::R90; continue; }
symmetryTokens = false;
}
if ( _keywordCompare("terminal",_tokens[itoken]) == 0 ) { terminal = true; continue; }
if ( _keywordCompare("terminal",_tokens[itoken]) == 0 ) { flags = Node::Terminal; continue; }
if ( _keywordCompare("terminal_NI",_tokens[itoken]) == 0 ) { flags = Node::Terminal | Node::NoImage; continue; }
if ( _keywordCompare(":" ,_tokens[itoken]) == 0 ) { symmetryTokens = true; continue; }
//std::cerr << " <X Y>" << std::endl;
@ -224,7 +225,7 @@ namespace Bookshelf {
height = toDouble ( _tokens[itoken] );
}
_circuit->addNode ( new Node(_tokens[0],width,height,symmetry,terminal) );
_circuit->addNode ( new Node(_tokens[0],width,height,symmetry,flags) );
// std::cerr << "name:" << _tokens[0]
// << " " << width
@ -547,6 +548,7 @@ namespace Bookshelf {
if ( orientationToken ) {
if (itoken+1 < _tokens.size()) {
if ( _keywordCompare("/FIXED",_tokens[itoken+1]) == 0 ) flags |= Node::Fixed;
if ( _keywordCompare("/FIXED_NI",_tokens[itoken+1]) == 0 ) flags |= Node::Fixed | Node::NoImage;
}
if ( _keywordCompare("N" ,_tokens[itoken]) == 0 ) { orientation |= Orientation::N; continue; }

View File

@ -42,7 +42,7 @@ namespace Bookshelf {
class Node {
public:
enum Flag { NoFlags=0x0000, Terminal=0x0001, Fixed=0x0002 };
enum Flag { NoFlags=0x0000, Terminal=0x0001, Fixed=0x0002, NoImage=0x0004 };
public:
inline Node ( const std::string& name
, double width =0.0
@ -51,6 +51,7 @@ namespace Bookshelf {
, unsigned int flags =NoFlags );
inline bool isTerminal () const;
inline bool isFixed () const;
inline bool isNoImage () const;
inline const std::string& getName () const;
inline double getWidth () const;
inline double getHeight () const;
@ -109,6 +110,7 @@ namespace Bookshelf {
inline bool Node::isTerminal () const { return _flags&Terminal; }
inline bool Node::isFixed () const { return _flags&Fixed; }
inline bool Node::isNoImage () const { return _flags&NoImage; }
inline const std::string& Node::getName () const { return _name; }
inline double Node::getWidth () const { return _width; }
inline double Node::getHeight () const { return _height; }