27 static const unsigned initial_size = 1024;
39 (ferror(
inFile)) { perror(
"read error"); exit(1); }
if (!offset)
40 strcpy(
line,
".end\n");
break; }
42 unsigned len = offset + strlen(
line + offset);
44 if (
line[len-1] ==
'\n') {
46 if (
line[len-2] ==
'\\') len -= 2;
else break;
51 char *new_line =
new char[
lineSize << 1];
52 for (
unsigned i = 0; i <
lineSize; ++i)
53 new_line[i] =
line[i];
69 else fprintf(stderr,
"Parse printError: ");
71 va_start(args, format);
72 vfprintf(stderr, format, args);
87 int site_no, pin_no, element_no;
103 if (token[0] ==
'(') {
104 if (token ==
"(xdl_resource_report") {
112 if (token ==
"(tiles") {
117 if (token ==
"(tile") {
118 for(
int i=0; i<5; ++i)
120 site_no = atoi(strTmp.c_str());
121 for(
int i=0; i<site_no; ++i)
127 if (token ==
"(primitive_defs") {
132 if (token ==
"(primitive_def") {
135 pin_no = atoi (strTmp.c_str());
137 element_no=atoi(strTmp.c_str());
141 for(
int i=0; i<pin_no; ++i){
147 typeTmp.resize(typeTmp.length() - 1);
149 pp->addPrimitivePin(newPrimitivePin);
152 for(
int i=0; i<element_no; ++i){
157 pin_no = atoi(strTmp.c_str());
162 for(
int i=0; i<pin_no; ++i){
167 typeTmp.resize(typeTmp.length() - 1);
169 ep->addPrimitivePin(newPrimitivePin);
175 if (strTmp ==
"(cfg"){
178 if(confTmp[confTmp.size()-1]==
')'){
179 confTmp.resize(confTmp.length() - 1);
180 ep->addConfig(confTmp);
183 ep->addConfig(confTmp);
191 while(strTmp[0]!=
')'){
197 PrimitivePin2.resize(PrimitivePin2.length() - 1);
199 swap(element1,element2);
200 swap(PrimitivePin1,PrimitivePin2);
206 newConn->addConnectionPin(pin1);
207 newConn->addConnectionPin(pin2);
208 ep->addConnection(newConn);
217 if ((token ==
"(end") || (token ==
"(summary")){
219 for(
int i=0; i<3; ++i){
228 if (token[0] !=
'\n' && token[0] !=
'#' && token[0] !=
')')
printError(
"`.' expected.\n");
static PrimitiveSetSharedPtr newPrimitiveSetPtr(const string &inName)
Create and return a new PrimitiveSet object.
Header for primitive parser.
Header for the RcFactory class.
void readCurrentLine()
Reads the current line.
boost::shared_ptr< Primitive > PrimitiveSharedPtr
Shared pointer encapsulation of a Primitive.
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer encapsulation of a element.
void printError(const char *format,...)
Print printError.
Physical design connection-pin pair, suitable for specifying a net endpoint.
static const char delimiters[]
boost::shared_ptr< PrimitiveSet > PrimitiveSetSharedPtr
Shared pointer encapsulation of a PrimitiveSet.
static ElementSharedPtr newElementPtr(const string &inName)
Create and return a new Element object.
static ConnectionPin newConnectionPin(string inElementName, const string &inPinName)
Construct an ConnectionPin and return a constant reference.
boost::shared_ptr< Connection > ConnectionSharedPtr
Shared pointer encapsulation of a componenet.
static ConnectionSharedPtr newConnectionPtr(const string &inName)
Create and return a new Element object.
PrimitiveSetSharedPtr ParsePrimitiveFile(const char *inFileName)
parse an XDLRC file
boost::shared_ptr< PrimitivePin > PrimitivePinSharedPtr
Shared pointer encapsulation of a componenet.
static PrimitivePinSharedPtr newPrimitivePinPtr(string inElementName, string inPinName, const PinType inType)
Create and return a new PrimitivePin shared pointer.
static PrimitiveSharedPtr newPrimitivePtr(const string &inName)
Create and return a new Element object.