##// END OF EJS Templates
Netlist parsing and loading ok, get in memory abstract syntax tree and concrete...
jeandet -
r2:096591f9de09 default
parent child
Show More
This diff has been collapsed as it changes many lines, (544 lines changed) Show them Hide them
@@ -60,6 +60,7 const char* node_c ="(no
60 60
61 61
62 62 QIlib::QIcadNetList::QIcadNetList()
63 :netlistRoot(NULL)
63 64 {
64 65
65 66 }
@@ -107,36 +108,23 QIlib::AbstractNode *QIlib::QIcadNetList
107 108 return NULL;
108 109 }
109 110
110 /*
111 QString version;
112 QIcadNetListDesign design;
113 QList<QIcadNetListComponent*> components;
114 QList<QIcadNetListLibPart*> libparts;
115 QIcadNetListLevel rootSheet;
116 */
117
118 #define setVal(dest,node,name,index) \
119 (node) = getAbstractNode((name),(index));\
120 if(((node)!=NULL)&&(0<(node)->Values.count())) \
121 {\
122 (dest) = (node)->Values.at(0); \
123 } \
124
125 111
126 112 void QIlib::QIcadNetList::updateConcreteTree()
127 113 {
128 QIlib::AbstractNode *node;
129 setVal(this->version,node,QIlib::Lexique::version_c,0);
130 setVal(this->design.date,node,QIlib::Lexique::date_c,0);
131 setVal(this->design.source,node,QIlib::Lexique::source_c,0);
132 setVal(this->design.tool,node,QIlib::Lexique::tool_c,0);
133 this->design.date.clear();
114 if(this->rootNode.nodes.count())
115 {
116 if(this->rootNode.nodes.at(0)->name==QIlib::Lexique::root_c)
117 {
118 if(this->netlistRoot==NULL)
119 {
120 this->netlistRoot = new QIcadNetListRoot(this->rootNode.nodes.at(0));
121 }
122 }
123 }
134 124 }
135 125
136 126
137 127
138
139
140 128 QIlib::QIcadAbstractNodeWrapper::QIcadAbstractNodeWrapper(AbstractNode *node)
141 129 {
142 130 this->p_node = node;
@@ -189,12 +177,522 void QIlib::QIcadAbstractNodeWrapper::se
189 177 QIlib::QIcadNetListRoot::QIcadNetListRoot(QIlib::AbstractNode *node)
190 178 :QIcadAbstractNodeWrapper(node)
191 179 {
180 this->setNode(node);
181 }
192 182
183 void QIlib::QIcadNetListRoot::setNode(QIlib::AbstractNode *node)
184 {
185 this->p_node = node;
186 if(node->name==QIlib::Lexique::root_c)
187 {
188 for(int i=0;i<node->nodes.count();i++)
189 {
190 if(node->nodes.at(i)->name==QIlib::Lexique::design_c)
191 {
192 this->design.setNode(node->nodes.at(i));
193 }
194 if(node->nodes.at(i)->name==QIlib::Lexique::components_c)
195 {
196 this->setComponents(node->nodes.at(i));
197 }
198 if(node->nodes.at(i)->name==QIlib::Lexique::libparts_c)
199 {
200 this->setLibParts(node->nodes.at(i));
201 }
202 if(node->nodes.at(i)->name==QIlib::Lexique::libraries_c)
203 {
204 this->setLibraries(node->nodes.at(i));
205 }
206 if(node->nodes.at(i)->name==QIlib::Lexique::nets_c)
207 {
208 this->setNets(node->nodes.at(i));
209 }
210 }
211 }
212 }
213
214 void QIlib::QIcadNetListRoot::setComponents(QIlib::AbstractNode *node)
215 {
216 while(components.count())
217 {
218 QIcadNetListComponent* component;
219 component = components.last();
220 components.removeLast();
221 delete component;
222 }
223 apendComponents(node);
224 }
225
226 void QIlib::QIcadNetListRoot::apendComponents(QIlib::AbstractNode *node)
227 {
228 if(node->name==QIlib::Lexique::components_c)
229 {
230 for(int i=0;i<node->nodes.count();i++)
231 {
232 if(node->nodes.at(i)->name==QIlib::Lexique::component_c)
233 {
234 this->components.append(new QIcadNetListComponent(node->nodes.at(i)));
235 }
236 }
237 }
238 }
239
240 void QIlib::QIcadNetListRoot::setLibParts(QIlib::AbstractNode *node)
241 {
242 while(libparts.count())
243 {
244 QIcadNetListLibPart* libpart;
245 libpart = libparts.last();
246 libparts.removeLast();
247 delete libpart;
248 }
249 apendLibParts(node);
250 }
251
252 void QIlib::QIcadNetListRoot::apendLibParts(QIlib::AbstractNode *node)
253 {
254 if(node->name==QIlib::Lexique::libparts_c)
255 {
256 for(int i=0;i<node->nodes.count();i++)
257 {
258 if(node->nodes.at(i)->name==QIlib::Lexique::libpart_c)
259 {
260 this->libparts.append(new QIcadNetListLibPart(node->nodes.at(i)));
261 }
262 }
263 }
264 }
265
266 void QIlib::QIcadNetListRoot::setLibraries(QIlib::AbstractNode *node)
267 {
268 while(libraries.count())
269 {
270 QIcadNetListLibrary* lib;
271 lib = libraries.last();
272 libraries.removeLast();
273 delete lib;
274 }
275 apendLibraries(node);
276 }
277
278 void QIlib::QIcadNetListRoot::apendLibraries(QIlib::AbstractNode *node)
279 {
280 if(node->name==QIlib::Lexique::libraries_c)
281 {
282 for(int i=0;i<node->nodes.count();i++)
283 {
284 if(node->nodes.at(i)->name==QIlib::Lexique::library_c)
285 {
286 this->libraries.append(new QIcadNetListLibrary(node->nodes.at(i)));
287 }
288 }
289 }
290 }
291
292 void QIlib::QIcadNetListRoot::setNets(QIlib::AbstractNode *node)
293 {
294 while(nets.count())
295 {
296 QIcadNetListNet* net;
297 net = nets.last();
298 nets.removeLast();
299 delete net;
300 }
301 apendNets(node);
302 }
303
304 void QIlib::QIcadNetListRoot::apendNets(QIlib::AbstractNode *node)
305 {
306 if(node->name==QIlib::Lexique::nets_c)
307 {
308 for(int i=0;i<node->nodes.count();i++)
309 {
310 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
311 {
312 this->nets.append(new QIcadNetListNet(node->nodes.at(i)));
313 }
314 }
315 }
193 316 }
194 317
195 318
196 319 QIlib::QIcadNetListComponent::QIcadNetListComponent(QIlib::AbstractNode *node)
197 320 :QIcadAbstractNodeWrapper(node)
198 321 {
322 setNode(node);
323 }
199 324
325 void QIlib::QIcadNetListComponent::setNode(QIlib::AbstractNode *node)
326 {
327 if(node->name==QIlib::Lexique::component_c)
328 {
329 for(int i=0;i<node->nodes.count();i++)
330 {
331 if(node->nodes.at(i)->name==QIlib::Lexique::ref_c)
332 {
333 this->ref.setNode(node->nodes.at(i));
334 }
335 if(node->nodes.at(i)->name==QIlib::Lexique::value_c)
336 {
337 this->value.setNode(node->nodes.at(i));
338 }
339 if(node->nodes.at(i)->name==QIlib::Lexique::libsource_c)
340 {
341 this->libsource.setNode(node->nodes.at(i));
342 }
343 if(node->nodes.at(i)->name==QIlib::Lexique::sheetpath_c)
344 {
345 this->sheetpath.setNode(node->nodes.at(i));
346 }
347 if(node->nodes.at(i)->name==QIlib::Lexique::tstamp_c)
348 {
349 this->tstamp.setNode(node->nodes.at(i));
350 }
351 }
352 }
200 353 }
354
355
356 QIlib::QIcadNetListDesign::QIcadNetListDesign(QIlib::AbstractNode *node)
357 :QIcadAbstractNodeWrapper(node)
358 {
359 this->setNode(node);
360 }
361
362 void QIlib::QIcadNetListDesign::setNode(QIlib::AbstractNode *node)
363 {
364 if(node->name==QIlib::Lexique::design_c)
365 {
366 this->p_node = node;
367 for(int i=0;i<node->nodes.count();i++)
368 {
369 if(node->nodes.at(i)->name==QIlib::Lexique::source_c)
370 {
371 this->source.setNode(node->nodes.at(i));
372 }
373 if(node->nodes.at(i)->name==QIlib::Lexique::date_c)
374 {
375 this->date.setNode(node->nodes.at(i));
376 }
377 if(node->nodes.at(i)->name==QIlib::Lexique::tool_c)
378 {
379 this->tool.setNode(node->nodes.at(i));
380 }
381 }
382 }
383 }
384
385 QIlib::QIcadNetListLibPart::QIcadNetListLibPart(QIlib::AbstractNode *node)
386 {
387 setNode(node);
388 }
389 /*
390 (libparts
391 (libpart (lib guan) (part 24L-MOD-8)
392 (fields
393 (field (name Reference) IC)
394 (field (name Value) 24L-MOD-8))
395 (pins
396 (pin (num 1) (name GND) (type power_in))
397 (pin (num 2) (name VCC) (type power_in))
398 */
399 void QIlib::QIcadNetListLibPart::setNode(QIlib::AbstractNode *node)
400 {
401 if(node->name==QIlib::Lexique::libpart_c)
402 {
403 this->p_node = node;
404 for(int i=0;i<node->nodes.count();i++)
405 {
406 if(node->nodes.at(i)->name==QIlib::Lexique::lib_c)
407 {
408 this->lib.setNode(node->nodes.at(i));
409 }
410 if(node->nodes.at(i)->name==QIlib::Lexique::part_c)
411 {
412 this->part.setNode(node->nodes.at(i));
413 }
414 if(node->nodes.at(i)->name==QIlib::Lexique::fields_c)
415 {
416 setFields(node->nodes.at(i));
417 }
418 if(node->nodes.at(i)->name==QIlib::Lexique::pins_c)
419 {
420 setPins(node->nodes.at(i));
421 }
422 }
423 }
424 }
425
426 void QIlib::QIcadNetListLibPart::setFields(QIlib::AbstractNode *node)
427 {
428 while(fields.count())
429 {
430 QIcadNetListField* field;
431 field = fields.last();
432 fields.removeLast();
433 delete field;
434 }
435 apendFields(node);
436 }
437
438 void QIlib::QIcadNetListLibPart::apendFields(QIlib::AbstractNode *node)
439 {
440 if(node->name==QIlib::Lexique::fields_c)
441 {
442 for(int i=0;i<node->nodes.count();i++)
443 {
444 if(node->nodes.at(i)->name==QIlib::Lexique::field_c)
445 {
446 this->fields.append(new QIcadNetListField(node->nodes.at(i)));
447 }
448 }
449 }
450 }
451
452 void QIlib::QIcadNetListLibPart::setPins(QIlib::AbstractNode *node)
453 {
454 while(pins.count())
455 {
456 QIcadNetListPin* pin;
457 pin = pins.last();
458 pins.removeLast();
459 delete pin;
460 }
461 apendPins(node);
462 }
463
464 void QIlib::QIcadNetListLibPart::apendPins(QIlib::AbstractNode *node)
465 {
466 if(node->name==QIlib::Lexique::pins_c)
467 {
468 for(int i=0;i<node->nodes.count();i++)
469 {
470 if(node->nodes.at(i)->name==QIlib::Lexique::pin_c)
471 {
472 this->pins.append(new QIcadNetListPin(node->nodes.at(i)));
473 }
474 }
475 }
476 }
477
478
479 QIlib::QIcadNetListLibrary::QIcadNetListLibrary(QIlib::AbstractNode *node)
480 {
481 setNode(node);
482 }
483
484 void QIlib::QIcadNetListLibrary::setNode(QIlib::AbstractNode *node)
485 {
486 /*
487 (library (logical guan)
488 (uri /home/guan/boards/guan.lib))
489 */
490 if(node->name==QIlib::Lexique::library_c)
491 {
492 this->p_node = node;
493 for(int i=0;i<node->nodes.count();i++)
494 {
495 if(node->nodes.at(i)->name==QIlib::Lexique::logical_c)
496 {
497 this->logical.setNode(node->nodes.at(i));
498 }
499 if(node->nodes.at(i)->name==QIlib::Lexique::uri_c)
500 {
501 this->uri.setNode(node->nodes.at(i));
502 }
503 }
504 }
505 }
506
507
508
509 QIlib::QIcadNetListField::QIcadNetListField(QIlib::AbstractNode *node)
510 {
511 setNode(node);
512 }
513
514 void QIlib::QIcadNetListField::setNode(QIlib::AbstractNode *node)
515 {
516 if(node->name==QIlib::Lexique::field_c)
517 {
518 this->p_node = node;
519 for(int i=0;i<node->nodes.count();i++)
520 {
521 if(node->nodes.at(i)->name==QIlib::Lexique::name_c)
522 {
523 this->name.setNode(node->nodes.at(i));
524 }
525 }
526 }
527 }
528
529
530 QIlib::QIcadNetListLibPart::QIcadNetListPin::QIcadNetListPin(QIlib::AbstractNode *node)
531 {
532 setNode(node);
533 }
534
535 void QIlib::QIcadNetListLibPart::QIcadNetListPin::setNode(QIlib::AbstractNode *node)
536 {
537 //(pin (num 1) (name GND) (type power_in))
538 if(node->name==QIlib::Lexique::pin_c)
539 {
540 this->p_node = node;
541 for(int i=0;i<node->nodes.count();i++)
542 {
543 if(node->nodes.at(i)->name==QIlib::Lexique::name_c)
544 {
545 this->name.setNode(node->nodes.at(i));
546 }
547 if(node->nodes.at(i)->name==QIlib::Lexique::num_c)
548 {
549 this->num.setNode(node->nodes.at(i));
550 }
551 if(node->nodes.at(i)->name==QIlib::Lexique::type_c)
552 {
553 this->type.setNode(node->nodes.at(i));
554 }
555 }
556 }
557 }
558
559 QIlib::QIcadNetListComponent::QIcadNetListLibSource::QIcadNetListLibSource(QIlib::AbstractNode *node)
560 {
561 setNode(node);
562 }
563
564 void QIlib::QIcadNetListComponent::QIcadNetListLibSource::setNode(QIlib::AbstractNode *node)
565 {
566 //(libsource (lib guan) (part 24L-MOD-8))
567 if(node->name==QIlib::Lexique::libsource_c)
568 {
569 this->p_node = node;
570 for(int i=0;i<node->nodes.count();i++)
571 {
572 if(node->nodes.at(i)->name==QIlib::Lexique::lib_c)
573 {
574 this->lib.setNode(node->nodes.at(i));
575 }
576 if(node->nodes.at(i)->name==QIlib::Lexique::part_c)
577 {
578 this->part.setNode(node->nodes.at(i));
579 }
580 }
581 }
582 }
583
584 QIlib::QIcadNetListComponent::QIcadNetListSheetPath::QIcadNetListSheetPath(QIlib::AbstractNode *node)
585 {
586 setNode(node);
587 }
588
589 void QIlib::QIcadNetListComponent::QIcadNetListSheetPath::setNode(QIlib::AbstractNode *node)
590 {
591 //(sheetpath (names /) (tstamps /))
592 if(node->name==QIlib::Lexique::sheetpath_c)
593 {
594 this->p_node = node;
595 for(int i=0;i<node->nodes.count();i++)
596 {
597 if(node->nodes.at(i)->name==QIlib::Lexique::names_c)
598 {
599 this->names.setNode(node->nodes.at(i));
600 }
601 if(node->nodes.at(i)->name==QIlib::Lexique::tstamps_c)
602 {
603 this->tstamps.setNode(node->nodes.at(i));
604 }
605 }
606 }
607 }
608
609 QIlib::QIcadNetListNet::QIcadNetListNet(QIlib::AbstractNode *node)
610 {
611 setNode(node);
612 }
613
614 void QIlib::QIcadNetListNet::setNode(QIlib::AbstractNode *node)
615 {
616 /*
617 (nets
618 (net (code 15) (name "")
619 (node (ref C4) (pin 1))
620 (node (ref U2) (pin 4)))
621 (net (code 16) (name GND)
622 (node (ref D1) (pin 2))
623 (node (ref C1) (pin 2))
624 (node (ref IC1) (pin 1))
625 */
626 if(node->name==QIlib::Lexique::net_c)
627 {
628 this->p_node = node;
629 while(NetNodes.count())
630 {
631 QIcadNetListNetNode* net;
632 net = NetNodes.last();
633 NetNodes.removeLast();
634 delete net;
635 }
636 for(int i=0;i<node->nodes.count();i++)
637 {
638 if(node->nodes.at(i)->name==QIlib::Lexique::name_c)
639 {
640 this->name.setNode(node->nodes.at(i));
641 }
642 if(node->nodes.at(i)->name==QIlib::Lexique::code_c)
643 {
644 this->code.setNode(node->nodes.at(i));
645 }
646 if(node->nodes.at(i)->name==QIlib::Lexique::node_c)
647 {
648 NetNodes.append(new QIcadNetListNetNode(node->nodes.at(i)));
649 }
650 }
651 }
652 }
653
654 QIlib::QIcadNetListNet::QIcadNetListNetNode::QIcadNetListNetNode(QIlib::AbstractNode *node)
655 {
656 setNode(node);
657 }
658
659 void QIlib::QIcadNetListNet::QIcadNetListNetNode::setNode(QIlib::AbstractNode *node)
660 {
661 //(node (ref D1) (pin 2))
662 if(node->name==QIlib::Lexique::node_c)
663 {
664 this->p_node = node;
665 for(int i=0;i<node->nodes.count();i++)
666 {
667 if(node->nodes.at(i)->name==QIlib::Lexique::ref_c)
668 {
669 this->ref.setNode(node->nodes.at(i));
670 }
671 if(node->nodes.at(i)->name==QIlib::Lexique::pin_c)
672 {
673 this->pin.setNode(node->nodes.at(i));
674 }
675 }
676 }
677 }
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
@@ -69,97 +69,37 extern "C" const char* node_c ;
69 69
70 70 }
71 71
72 class QIcadNetListLevel
73 {
74 public:
75 QIcadNetListLevel() {}
76 QList<QIcadNetListLevel*> sublevels;
77 QList<QIcadNet*> nets;
78 };
79 72
80 class QIcadNetListDesign
81 {
82 public:
83 QIcadNetListDesign(){}
84 QString source;
85 QString date;
86 QString tool;
87 };
88
89 class QIcadNetListComponent
90 {
91 public:
92 typedef struct libsource_t
93 {
94 QString lib;
95 QString part;
96 }libsource_t;
97 typedef struct sheetpath_t
98 {
99 QString names;
100 QString tstamp;
101 }sheetpath_t;
102 QIcadNetListComponent(){}
103 QString ref;
104 QString value;
105 QString tstamp;
106 libsource_t libsource;
107 sheetpath_t sheetpath;
108 };
109
110 class QIcadNetListLibPart
111 {
112 public:
113 typedef struct fields_t
114 {
115 QString ref;
116 QString value;
117 QString footprint;
118 QString datasheet;
119 }fields_t;
120 typedef struct pin_t
121 {
122 int num;
123 QString name;
124 QString type;
125 }pin_t;
126 QIcadNetListLibPart();
127 QString lib;
128 QString part;
129 QStringList footprints;
130 fields_t fields;
131 QList<pin_t*> pins;
132 };
133 73
134 74 class QIcadAbstractNodeWrapper
135 75 {
136 76 public:
137 77 QIcadAbstractNodeWrapper(QIlib::AbstractNode* node);
78 QIcadAbstractNodeWrapper(){}
138 79 ~QIcadAbstractNodeWrapper();
139 80 QString value();
140 81 QString value(int index);
141 82 QString catValues();
142 void setNode(QIlib::AbstractNode* node);
143 83 QList<QIcadAbstractNodeWrapper*> childs;
144 84 QIcadAbstractNodeWrapper* parent;
85 virtual void setNode(QIlib::AbstractNode* node);
145 86
146 private:
147 87 QIlib::AbstractNode* p_node;
148 88 };
149 89
150 class QIcadNetListRoot : public AbstractNode
90 class QIcadNetListDesign : public QIcadAbstractNodeWrapper
151 91 {
152 92 public:
153 QIcadNetListRoot(QIlib::AbstractNode* node);
93 QIcadNetListDesign(QIlib::AbstractNode* node);
94 QIcadNetListDesign(){}
154 95 QIcadAbstractNodeWrapper source;
155 96 QIcadAbstractNodeWrapper date;
156 97 QIcadAbstractNodeWrapper tool;
157 QList<QIcadNetListComponent*> components;
158 QList<QIcadNetListLibPart*> libparts;
159 QList<QIcadNetListLibrary*> libraries;
98 void setNode(QIlib::AbstractNode* node);
160 99 };
161 100
162 101
102
163 103 /*
164 104 * (comp (ref IC1)
165 105 (value 24L-MOD-8)
@@ -169,13 +109,32 public:
169 109 */
170 110 class QIcadNetListComponent:public QIcadAbstractNodeWrapper
171 111 {
112 class QIcadNetListLibSource : QIcadAbstractNodeWrapper
113 {
114 public:
115 QIcadNetListLibSource(AbstractNode* node);
116 QIcadNetListLibSource(){}
117 QIcadAbstractNodeWrapper lib;
118 QIcadAbstractNodeWrapper part;
119 void setNode(AbstractNode* node);
120 };
121 class QIcadNetListSheetPath : QIcadAbstractNodeWrapper
122 {
123 public:
124 QIcadNetListSheetPath(AbstractNode* node);
125 QIcadNetListSheetPath(){}
126 QIcadAbstractNodeWrapper names;
127 QIcadAbstractNodeWrapper tstamps;
128 void setNode(AbstractNode* node);
129 };
172 130 public:
173 131 QIcadNetListComponent(AbstractNode* node);
174 132 QIcadAbstractNodeWrapper ref;
175 133 QIcadAbstractNodeWrapper value;
176 QIcadAbstractNodeWrapper libsource;
177 QIcadAbstractNodeWrapper sheetpath;
134 QIcadNetListLibSource libsource;
135 QIcadNetListSheetPath sheetpath;
178 136 QIcadAbstractNodeWrapper tstamp;
137 void setNode(QIlib::AbstractNode* node);
179 138 };
180 139
181 140
@@ -194,6 +153,7 class QIcadNetListField : QIcadAbstractN
194 153 public:
195 154 QIcadNetListField(AbstractNode* node);
196 155 QIcadAbstractNodeWrapper name;
156 void setNode(AbstractNode* node);
197 157 };
198 158
199 159
@@ -206,11 +166,19 class QIcadNetListLibPart : QIcadAbstrac
206 166 QIcadAbstractNodeWrapper type;
207 167 QIcadAbstractNodeWrapper num;
208 168 QIcadAbstractNodeWrapper name;
169 void setNode(AbstractNode* node);
209 170 };
210 171 public:
211 172 QIcadNetListLibPart(AbstractNode* node);
173 QIcadAbstractNodeWrapper lib;
174 QIcadAbstractNodeWrapper part;
212 175 QList<QIcadNetListField*> fields;
213 176 QList<QIcadNetListPin*> pins;
177 void setNode(AbstractNode* node);
178 void setFields(QIlib::AbstractNode* node);
179 void apendFields(QIlib::AbstractNode* node);
180 void setPins(QIlib::AbstractNode* node);
181 void apendPins(QIlib::AbstractNode* node);
214 182 };
215 183
216 184 /*
@@ -228,6 +196,8 class QIcadNetListLibrary : QIcadAbstra
228 196 public:
229 197 QIcadNetListLibrary(AbstractNode* node);
230 198 QIcadAbstractNodeWrapper uri;
199 QIcadAbstractNodeWrapper logical;
200 void setNode(AbstractNode* node);
231 201 };
232 202 /*
233 203 (nets
@@ -248,12 +218,36 class QIcadNetListNet : QIcadAbstractNod
248 218 QIcadNetListNetNode(AbstractNode* node);
249 219 QIcadAbstractNodeWrapper ref;
250 220 QIcadAbstractNodeWrapper pin;
221 void setNode(AbstractNode* node);
251 222 };
252 223 public:
253 224 QIcadNetListNet(AbstractNode* node);
254 225 QList<QIcadNetListNetNode*> NetNodes;
226 QIcadAbstractNodeWrapper code;
227 QIcadAbstractNodeWrapper name;
228 void setNode(AbstractNode* node);
229
255 230 };
256 231
232 class QIcadNetListRoot : public QIcadAbstractNodeWrapper
233 {
234 public:
235 QIcadNetListRoot(QIlib::AbstractNode* node);
236 QIcadNetListDesign design;
237 QList<QIcadNetListComponent*> components;
238 QList<QIcadNetListLibPart*> libparts;
239 QList<QIcadNetListLibrary*> libraries;
240 QList<QIcadNetListNet*> nets;
241 void setNode(QIlib::AbstractNode* node);
242 void setComponents(QIlib::AbstractNode* node);
243 void apendComponents(QIlib::AbstractNode* node);
244 void setLibParts(QIlib::AbstractNode* node);
245 void apendLibParts(QIlib::AbstractNode* node);
246 void setLibraries(QIlib::AbstractNode* node);
247 void apendLibraries(QIlib::AbstractNode* node);
248 void setNets(QIlib::AbstractNode* node);
249 void apendNets(QIlib::AbstractNode* node);
250 };
257 251
258 252
259 253 class QIcadNetList : private lispLike_Driver
@@ -263,13 +257,8 public:
263 257 bool parseNetList(const QString& netlist);
264 258 QString toString();
265 259 QString fileName;
266 QString version;
267 QIcadNetListDesign design;
268 QList<QIcadNetListComponent*> components;
269 QList<QIcadNetListLibPart*> libparts;
270 QIcadNetListLevel rootSheet;
271 260 QString print();
272 QIcadAbstractNodeWrapper netlistRoot;
261 QIcadNetListRoot* netlistRoot;
273 262 private:
274 263 QIlib::AbstractNode* getAbstractNode(const QString& node,int index);
275 264 QIlib::AbstractNode* getAbstractNode(QIlib::AbstractNode* rootNode,const QString& node,int* index);
@@ -41,8 +41,19 int main(int argc, char *argv[])
41 41 tm.start();
42 42 NetListdriver.parseNetList(argv[1]);
43 43 qDebug()<<"File parsed in "<<tm.elapsed()<<"ms";
44 std::cout<<NetListdriver.print().toStdString();
44 if(ap.arguments().contains("--print"))
45 {
46 std::cout<<NetListdriver.print().toStdString();
47 }
48 else
49 {
50 for(int i=0;i<NetListdriver.netlistRoot->nets.count();i++)
51 {
52 std::cout<<"Found net:"<<NetListdriver.netlistRoot->nets.at(i)->name.value().toStdString()<<" "<<NetListdriver.netlistRoot->nets.at(i)->code.value().toStdString()<<"\n";
53 }
54 }
45 55 }
56
46 57 }
47 58 return 0;
48 59 }
General Comments 0
You need to be logged in to leave comments. Login now