1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,147 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the Kicad Tools Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | const char* add_net_c = "(add_net"; | |||
|
23 | const char* area_c = "(area"; | |||
|
24 | const char* at_c = "(at"; | |||
|
25 | const char* attr_c = "(attr"; | |||
|
26 | const char* center_c = "(center"; | |||
|
27 | const char* clearance_c = "(clearance"; | |||
|
28 | const char* code_c = "(code"; | |||
|
29 | const char* component_c = "(component"; | |||
|
30 | const char* components_c = "(components"; | |||
|
31 | const char* date_c = "(date"; | |||
|
32 | const char* design_c = "(design"; | |||
|
33 | const char* drawings_c = "(drawings"; | |||
|
34 | const char* drillshape_c = "(drillshape"; | |||
|
35 | const char* edge_width_c = "(edge_width"; | |||
|
36 | const char* effects_c = "(effects"; | |||
|
37 | const char* end_c = "(end"; | |||
|
38 | const char* excludeedgelayer_c = "(excludeedgelayer"; | |||
|
39 | const char* export_c = "(export"; | |||
|
40 | const char* field_c = "(field"; | |||
|
41 | const char* fields_c = "(fields"; | |||
|
42 | const char* font_c = "(font"; | |||
|
43 | const char* fp_circle_c = "(fp_circle"; | |||
|
44 | const char* fp_line_c = "(fp_line"; | |||
|
45 | const char* fp_text_c = "(fp_text"; | |||
|
46 | const char* general_c = "(general"; | |||
|
47 | const char* host_c = "(host"; | |||
|
48 | const char* hpglpendiameter_c = "(hpglpendiameter"; | |||
|
49 | const char* hpglpennumber_c = "(hpglpennumber"; | |||
|
50 | const char* hpglpenoverlay_c = "(hpglpenoverlay"; | |||
|
51 | const char* hpglpenspeed_c = "(hpglpenspeed"; | |||
|
52 | const char* last_trace_width_c = "(last_trace_width"; | |||
|
53 | const char* layers_c = "(layers"; | |||
|
54 | const char* layerselection_c = "(layerselection"; | |||
|
55 | const char* lib_c = "(lib"; | |||
|
56 | const char* libpart_c = "(libpart"; | |||
|
57 | const char* libparts_c = "(libparts"; | |||
|
58 | const char* libraries_c = "(libraries"; | |||
|
59 | const char* library_c = "(library"; | |||
|
60 | const char* libsource_c = "(libsource"; | |||
|
61 | const char* linewidth_c = "(linewidth"; | |||
|
62 | const char* links_c = "(links"; | |||
|
63 | const char* logical_c = "(logical"; | |||
|
64 | const char* mirror_c = "(mirror"; | |||
|
65 | const char* mod_edge_width_c = "(mod_edge_width"; | |||
|
66 | const char* mod_text_size_c = "(mod_text_size"; | |||
|
67 | const char* mode_c = "(mode"; | |||
|
68 | const char* model_c = "(model"; | |||
|
69 | const char* module_c = "(module"; | |||
|
70 | const char* modules_c = "(modules"; | |||
|
71 | const char* name_c = "(name"; | |||
|
72 | const char* names_c = "(names"; | |||
|
73 | const char* net_c = "(net"; | |||
|
74 | const char* net_class_c = "(net_class"; | |||
|
75 | const char* nets_c = "(nets"; | |||
|
76 | const char* no_connect_c = "(no_connect"; | |||
|
77 | const char* node_c = "(node"; | |||
|
78 | const char* num_c = "(num"; | |||
|
79 | const char* outputdirectory_c = "(outputdirectory"; | |||
|
80 | const char* outputformat_c = "(outputformat"; | |||
|
81 | const char* pad_c = "(pad"; | |||
|
82 | const char* pad_drill_c = "(pad_drill"; | |||
|
83 | const char* pad_size_c = "(pad_size"; | |||
|
84 | const char* pad_to_mask_clearance_c = "(pad_to_mask_clearance"; | |||
|
85 | const char* padsonsilk_c = "(padsonsilk"; | |||
|
86 | const char* page_c = "(page"; | |||
|
87 | const char* part_c = "(part"; | |||
|
88 | const char* path_c = "(path"; | |||
|
89 | const char* pcb_text_size_c = "(pcb_text_size"; | |||
|
90 | const char* pcb_text_width_c = "(pcb_text_width"; | |||
|
91 | const char* pcbplotparams_c = "(pcbplotparams"; | |||
|
92 | const char* pin_c = "(pin"; | |||
|
93 | const char* pins_c = "(pins"; | |||
|
94 | const char* plotframeref_c = "(plotframeref"; | |||
|
95 | const char* plotinvisibletext_c = "(plotinvisibletext"; | |||
|
96 | const char* plotothertext_c = "(plotothertext"; | |||
|
97 | const char* plotreference_c = "(plotreference"; | |||
|
98 | const char* plotvalue_c = "(plotvalue"; | |||
|
99 | const char* psa4output_c = "(psa4output"; | |||
|
100 | const char* psnegative_c = "(psnegative"; | |||
|
101 | const char* ref_c = "(ref"; | |||
|
102 | const char* rotate = "(rota"; | |||
|
103 | const char* scale_c = "(scale"; | |||
|
104 | const char* scaleselection_c = "(scaleselection"; | |||
|
105 | const char* segment_width_c = "(segment_width"; | |||
|
106 | const char* setup_c = "(setup"; | |||
|
107 | const char* sheetpath_c = "(sheetpath"; | |||
|
108 | const char* source_c = "(source"; | |||
|
109 | const char* start_c = "(start"; | |||
|
110 | const char* subtractmaskfromsilk_c = "(subtractmaskfromsilk"; | |||
|
111 | const char* tags_c = "(tags"; | |||
|
112 | const char* tedit_c = "(tedit"; | |||
|
113 | const char* thickness_c = "(thickness"; | |||
|
114 | const char* tool_c = "(tool"; | |||
|
115 | const char* trace_clearance_c = "(trace_clearance"; | |||
|
116 | const char* trace_min_c = "(trace_min"; | |||
|
117 | const char* trace_width_c = "(trace_width"; | |||
|
118 | const char* tracks_c = "(tracks"; | |||
|
119 | const char* tstamp_c = "(tstamp"; | |||
|
120 | const char* tstamps_c = "(tstamps"; | |||
|
121 | const char* type_c = "(type"; | |||
|
122 | const char* uri_c = "(uri"; | |||
|
123 | const char* useauxorigin_c = "(useauxorigin"; | |||
|
124 | const char* usegerberextensions_c = "(usegerberextensions"; | |||
|
125 | const char* uvia_dia_c = "(uvia_dia"; | |||
|
126 | const char* uvia_drill_c = "(uvia_drill"; | |||
|
127 | const char* uvia_min_drill_c = "(uvia_min_drill"; | |||
|
128 | const char* uvia_min_size_c = "(uvia_min_size"; | |||
|
129 | const char* uvia_size_c = "(uvia_size"; | |||
|
130 | const char* uvias_allowed_c = "(uvias_allowed"; | |||
|
131 | const char* value_c = "(value"; | |||
|
132 | const char* version_c = "(version"; | |||
|
133 | const char* via_dia_c = "(via_dia"; | |||
|
134 | const char* via_drill_c = "(via_drill"; | |||
|
135 | const char* via_min_drill_c = "(via_min_drill"; | |||
|
136 | const char* via_min_size_c = "(via_min_size"; | |||
|
137 | const char* via_size_c = "(via_size"; | |||
|
138 | const char* viasonmask_c = "(viasonmask"; | |||
|
139 | const char* visible_elements_c = "(visible_elements"; | |||
|
140 | const char* width_c = "(width"; | |||
|
141 | const char* xyz = "(x"; | |||
|
142 | const char* zone_45_only_c = "(zone_45_only"; | |||
|
143 | const char* zone_clearance_c = "(zone_clearance"; | |||
|
144 | const char* zones_c = "(zones"; | |||
|
145 | ||||
|
146 | ||||
|
147 |
@@ -0,0 +1,158 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the Kicad Tools Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | /* | |||
|
23 | * Have a look to LispLikeLexique.ods | |||
|
24 | */ | |||
|
25 | #ifndef LEXIQUE_H | |||
|
26 | #define LEXIQUE_H | |||
|
27 | ||||
|
28 | namespace QIlib{ | |||
|
29 | ||||
|
30 | namespace Lexique | |||
|
31 | { | |||
|
32 | extern "C" const char* add_net_c; | |||
|
33 | extern "C" const char* area_c; | |||
|
34 | extern "C" const char* at_c; | |||
|
35 | extern "C" const char* attr_c; | |||
|
36 | extern "C" const char* center_c; | |||
|
37 | extern "C" const char* clearance_c; | |||
|
38 | extern "C" const char* code_c; | |||
|
39 | extern "C" const char* component_c; | |||
|
40 | extern "C" const char* components_c; | |||
|
41 | extern "C" const char* date_c; | |||
|
42 | extern "C" const char* design_c; | |||
|
43 | extern "C" const char* drawings_c; | |||
|
44 | extern "C" const char* drillshape_c; | |||
|
45 | extern "C" const char* edge_width_c; | |||
|
46 | extern "C" const char* effects_c; | |||
|
47 | extern "C" const char* end_c; | |||
|
48 | extern "C" const char* excludeedgelayer_c; | |||
|
49 | extern "C" const char* export_c; | |||
|
50 | extern "C" const char* field_c; | |||
|
51 | extern "C" const char* fields_c; | |||
|
52 | extern "C" const char* font_c; | |||
|
53 | extern "C" const char* fp_circle_c; | |||
|
54 | extern "C" const char* fp_line_c; | |||
|
55 | extern "C" const char* fp_text_c; | |||
|
56 | extern "C" const char* general_c; | |||
|
57 | extern "C" const char* host_c; | |||
|
58 | extern "C" const char* hpglpendiameter_c; | |||
|
59 | extern "C" const char* hpglpennumber_c; | |||
|
60 | extern "C" const char* hpglpenoverlay_c; | |||
|
61 | extern "C" const char* hpglpenspeed_c; | |||
|
62 | extern "C" const char* last_trace_width_c; | |||
|
63 | extern "C" const char* layers_c; | |||
|
64 | extern "C" const char* layerselection_c; | |||
|
65 | extern "C" const char* lib_c; | |||
|
66 | extern "C" const char* libpart_c; | |||
|
67 | extern "C" const char* libparts_c; | |||
|
68 | extern "C" const char* libraries_c; | |||
|
69 | extern "C" const char* library_c; | |||
|
70 | extern "C" const char* libsource_c; | |||
|
71 | extern "C" const char* linewidth_c; | |||
|
72 | extern "C" const char* links_c; | |||
|
73 | extern "C" const char* logical_c; | |||
|
74 | extern "C" const char* mirror_c; | |||
|
75 | extern "C" const char* mod_edge_width_c; | |||
|
76 | extern "C" const char* mod_text_size_c; | |||
|
77 | extern "C" const char* mode_c; | |||
|
78 | extern "C" const char* model_c; | |||
|
79 | extern "C" const char* module_c; | |||
|
80 | extern "C" const char* modules_c; | |||
|
81 | extern "C" const char* name_c; | |||
|
82 | extern "C" const char* names_c; | |||
|
83 | extern "C" const char* net_c; | |||
|
84 | extern "C" const char* net_class_c; | |||
|
85 | extern "C" const char* nets_c; | |||
|
86 | extern "C" const char* no_connect_c; | |||
|
87 | extern "C" const char* node_c; | |||
|
88 | extern "C" const char* num_c; | |||
|
89 | extern "C" const char* outputdirectory_c; | |||
|
90 | extern "C" const char* outputformat_c; | |||
|
91 | extern "C" const char* pad_c; | |||
|
92 | extern "C" const char* pad_drill_c; | |||
|
93 | extern "C" const char* pad_size_c; | |||
|
94 | extern "C" const char* pad_to_mask_clearance_c; | |||
|
95 | extern "C" const char* padsonsilk_c; | |||
|
96 | extern "C" const char* page_c; | |||
|
97 | extern "C" const char* part_c; | |||
|
98 | extern "C" const char* path_c; | |||
|
99 | extern "C" const char* pcb_text_size_c; | |||
|
100 | extern "C" const char* pcb_text_width_c; | |||
|
101 | extern "C" const char* pcbplotparams_c; | |||
|
102 | extern "C" const char* pin_c; | |||
|
103 | extern "C" const char* pins_c; | |||
|
104 | extern "C" const char* plotframeref_c; | |||
|
105 | extern "C" const char* plotinvisibletext_c; | |||
|
106 | extern "C" const char* plotothertext_c; | |||
|
107 | extern "C" const char* plotreference_c; | |||
|
108 | extern "C" const char* plotvalue_c; | |||
|
109 | extern "C" const char* psa4output_c; | |||
|
110 | extern "C" const char* psnegative_c; | |||
|
111 | extern "C" const char* ref_c; | |||
|
112 | extern "C" const char* rotate; | |||
|
113 | extern "C" const char* scale_c; | |||
|
114 | extern "C" const char* scaleselection_c; | |||
|
115 | extern "C" const char* segment_width_c; | |||
|
116 | extern "C" const char* setup_c; | |||
|
117 | extern "C" const char* sheetpath_c; | |||
|
118 | extern "C" const char* source_c; | |||
|
119 | extern "C" const char* start_c; | |||
|
120 | extern "C" const char* subtractmaskfromsilk_c; | |||
|
121 | extern "C" const char* tags_c; | |||
|
122 | extern "C" const char* tedit_c; | |||
|
123 | extern "C" const char* thickness_c; | |||
|
124 | extern "C" const char* tool_c; | |||
|
125 | extern "C" const char* trace_clearance_c; | |||
|
126 | extern "C" const char* trace_min_c; | |||
|
127 | extern "C" const char* trace_width_c; | |||
|
128 | extern "C" const char* tracks_c; | |||
|
129 | extern "C" const char* tstamp_c; | |||
|
130 | extern "C" const char* tstamps_c; | |||
|
131 | extern "C" const char* type_c; | |||
|
132 | extern "C" const char* uri_c; | |||
|
133 | extern "C" const char* useauxorigin_c; | |||
|
134 | extern "C" const char* usegerberextensions_c; | |||
|
135 | extern "C" const char* uvia_dia_c; | |||
|
136 | extern "C" const char* uvia_drill_c; | |||
|
137 | extern "C" const char* uvia_min_drill_c; | |||
|
138 | extern "C" const char* uvia_min_size_c; | |||
|
139 | extern "C" const char* uvia_size_c; | |||
|
140 | extern "C" const char* uvias_allowed_c; | |||
|
141 | extern "C" const char* value_c; | |||
|
142 | extern "C" const char* version_c; | |||
|
143 | extern "C" const char* via_dia_c; | |||
|
144 | extern "C" const char* via_drill_c; | |||
|
145 | extern "C" const char* via_min_drill_c; | |||
|
146 | extern "C" const char* via_min_size_c; | |||
|
147 | extern "C" const char* via_size_c; | |||
|
148 | extern "C" const char* viasonmask_c; | |||
|
149 | extern "C" const char* visible_elements_c; | |||
|
150 | extern "C" const char* width_c; | |||
|
151 | extern "C" const char* xyz; | |||
|
152 | extern "C" const char* zone_45_only_c; | |||
|
153 | extern "C" const char* zone_clearance_c; | |||
|
154 | extern "C" const char* zones_c; | |||
|
155 | } | |||
|
156 | } | |||
|
157 | ||||
|
158 | #endif // LEXIQUE_H |
@@ -0,0 +1,39 | |||||
|
1 | #include "qicadpcb.h" | |||
|
2 | ||||
|
3 | ||||
|
4 | QIlib::QIcadPcb::QIcadPcb() | |||
|
5 | { | |||
|
6 | ||||
|
7 | } | |||
|
8 | ||||
|
9 | bool QIlib::QIcadPcb::parsePcb(const QString &pcb) | |||
|
10 | { | |||
|
11 | parse(pcb.toStdString().c_str()); | |||
|
12 | updateConcreteTree(); | |||
|
13 | return false; | |||
|
14 | } | |||
|
15 | ||||
|
16 | QString QIlib::QIcadPcb::toString() | |||
|
17 | { | |||
|
18 | ||||
|
19 | } | |||
|
20 | ||||
|
21 | QString QIlib::QIcadPcb::print() | |||
|
22 | { | |||
|
23 | return rootNode.print(); | |||
|
24 | } | |||
|
25 | ||||
|
26 | ||||
|
27 | void QIlib::QIcadPcb::updateConcreteTree() | |||
|
28 | { | |||
|
29 | // if(this->rootNode.nodes.count()) | |||
|
30 | // { | |||
|
31 | // if(this->rootNode.nodes.at(0)->name==QIlib::Lexique::root_c) | |||
|
32 | // { | |||
|
33 | // if(this->netlistRoot==NULL) | |||
|
34 | // { | |||
|
35 | // this->netlistRoot = new QIcadNetListRoot(this->rootNode.nodes.at(0)); | |||
|
36 | // } | |||
|
37 | // } | |||
|
38 | // } | |||
|
39 | } |
@@ -0,0 +1,56 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the Kicad Tools Software | |||
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #ifndef QICADPCB_H | |||
|
23 | #define QICADPCB_H | |||
|
24 | #include <QString> | |||
|
25 | #include <QStringList> | |||
|
26 | #include <QList> | |||
|
27 | #include <QFile> | |||
|
28 | #include <parsers/lispLike_driver.h> | |||
|
29 | #include <qicadlisplikelexique.h> | |||
|
30 | ||||
|
31 | namespace QIlib{ | |||
|
32 | ||||
|
33 | class QIcadPcbRoot : public QIcadAbstractNodeWrapper | |||
|
34 | { | |||
|
35 | public: | |||
|
36 | QIcadPcbRoot(QIlib::AbstractNode* node); | |||
|
37 | QIcadAbstractNodeWrapper version; | |||
|
38 | QIcadAbstractNodeWrapper host; | |||
|
39 | void setNode(QIlib::AbstractNode* node); | |||
|
40 | }; | |||
|
41 | ||||
|
42 | class QIcadPcb : private lispLike_Driver | |||
|
43 | { | |||
|
44 | public: | |||
|
45 | QIcadPcb(); | |||
|
46 | bool parsePcb(const QString& pcb); | |||
|
47 | QString toString(); | |||
|
48 | QString fileName; | |||
|
49 | QString print(); | |||
|
50 | private: | |||
|
51 | void updateConcreteTree(); | |||
|
52 | }; | |||
|
53 | ||||
|
54 | ||||
|
55 | } | |||
|
56 | #endif // QICADPCB_H |
@@ -38,7 +38,7 typedef QIlib::lispLike_Parser::token to | |||||
38 | return( token::VALUE ); |
|
38 | return( token::VALUE ); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | \([a-zA-Z0-9]+ { |
|
41 | \([a-zA-Z0-9\_]+ { | |
42 | yylval->sval = STOKEN( yytext ); |
|
42 | yylval->sval = STOKEN( yytext ); | |
43 | return( token::NODE ); |
|
43 | return( token::NODE ); | |
44 | } |
|
44 | } |
@@ -23,6 +23,54 | |||||
23 | #include "lispLike_driver.h" |
|
23 | #include "lispLike_driver.h" | |
24 | #include<assert.h> |
|
24 | #include<assert.h> | |
25 |
|
25 | |||
|
26 | ||||
|
27 | QIlib::QIcadAbstractNodeWrapper::QIcadAbstractNodeWrapper(AbstractNode *node) | |||
|
28 | { | |||
|
29 | this->p_node = node; | |||
|
30 | } | |||
|
31 | ||||
|
32 | QIlib::QIcadAbstractNodeWrapper::~QIcadAbstractNodeWrapper() | |||
|
33 | { | |||
|
34 | /*First delete all the childs*/ | |||
|
35 | for(int i=0;i<this->childs.count();i++) | |||
|
36 | { | |||
|
37 | if(this->childs.at(i)) | |||
|
38 | delete this->childs.at(i); | |||
|
39 | } | |||
|
40 | } | |||
|
41 | ||||
|
42 | QString QIlib::QIcadAbstractNodeWrapper::value() | |||
|
43 | { | |||
|
44 | if((p_node->Values.count()>0) && p_node) | |||
|
45 | return p_node->Values.at(0); | |||
|
46 | return QString(""); | |||
|
47 | } | |||
|
48 | ||||
|
49 | QString QIlib::QIcadAbstractNodeWrapper::value(int index) | |||
|
50 | { | |||
|
51 | if((p_node->Values.count()>index) && p_node) | |||
|
52 | return p_node->Values.at(index); | |||
|
53 | return QString(""); | |||
|
54 | } | |||
|
55 | ||||
|
56 | QString QIlib::QIcadAbstractNodeWrapper::catValues() | |||
|
57 | { | |||
|
58 | if(p_node) | |||
|
59 | { | |||
|
60 | QString result(""); | |||
|
61 | for(int i=0;i<p_node->Values.count();i++) | |||
|
62 | { | |||
|
63 | result.append(p_node->Values.at(i)); | |||
|
64 | } | |||
|
65 | return result; | |||
|
66 | } | |||
|
67 | } | |||
|
68 | ||||
|
69 | void QIlib::QIcadAbstractNodeWrapper::setNode(QIlib::AbstractNode *node) | |||
|
70 | { | |||
|
71 | this->p_node = node; | |||
|
72 | } | |||
|
73 | ||||
26 | QIlib::lispLike_Driver::lispLike_Driver() |
|
74 | QIlib::lispLike_Driver::lispLike_Driver() | |
27 | :parser( NULL ),scanner( NULL ) |
|
75 | :parser( NULL ),scanner( NULL ) | |
28 | { |
|
76 | { |
@@ -46,6 +46,22 public: | |||||
46 | QIlib::AbstractNode* parent; |
|
46 | QIlib::AbstractNode* parent; | |
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
|
49 | class QIcadAbstractNodeWrapper | |||
|
50 | { | |||
|
51 | public: | |||
|
52 | QIcadAbstractNodeWrapper(QIlib::AbstractNode* node); | |||
|
53 | QIcadAbstractNodeWrapper(){} | |||
|
54 | ~QIcadAbstractNodeWrapper(); | |||
|
55 | QString value(); | |||
|
56 | QString value(int index); | |||
|
57 | QString catValues(); | |||
|
58 | QList<QIcadAbstractNodeWrapper*> childs; | |||
|
59 | QIcadAbstractNodeWrapper* parent; | |||
|
60 | virtual void setNode(QIlib::AbstractNode* node); | |||
|
61 | ||||
|
62 | QIlib::AbstractNode* p_node; | |||
|
63 | }; | |||
|
64 | ||||
49 | class lispLike_Driver |
|
65 | class lispLike_Driver | |
50 | { |
|
66 | { | |
51 | public: |
|
67 | public: |
@@ -23,41 +23,6 | |||||
23 | #include <QRegularExpression> |
|
23 | #include <QRegularExpression> | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | const char* root_c ="(export"; |
|
|||
27 | const char* version_c ="(version"; |
|
|||
28 | const char* design_c ="(design"; |
|
|||
29 | const char* source_c ="(source"; |
|
|||
30 | const char* date_c ="(date"; |
|
|||
31 | const char* tool_c ="(tool"; |
|
|||
32 | const char* components_c ="(components"; |
|
|||
33 | const char* component_c ="(comp"; |
|
|||
34 | const char* ref_c ="(ref"; |
|
|||
35 | const char* value_c ="(value"; |
|
|||
36 | const char* libsource_c ="(libsource"; |
|
|||
37 | const char* lib_c ="(lib"; |
|
|||
38 | const char* part_c ="(part"; |
|
|||
39 | const char* sheetpath_c ="(sheetpath"; |
|
|||
40 | const char* names_c ="(names"; |
|
|||
41 | const char* tstamps_c ="(tstamps"; |
|
|||
42 | const char* tstamp_c ="(tstamp"; |
|
|||
43 | const char* libparts_c ="(libparts"; |
|
|||
44 | const char* libpart_c ="(libpart"; |
|
|||
45 | const char* fields_c ="(fields"; |
|
|||
46 | const char* field_c ="(field"; |
|
|||
47 | const char* name_c ="(name"; |
|
|||
48 | const char* pins_c ="(pins"; |
|
|||
49 | const char* pin_c ="(pin"; |
|
|||
50 | const char* num_c ="(num"; |
|
|||
51 | const char* type_c ="(type"; |
|
|||
52 | const char* libraries_c ="(libraries"; |
|
|||
53 | const char* library_c ="(library"; |
|
|||
54 | const char* logical_c ="(logical"; |
|
|||
55 | const char* uri_c ="(uri"; |
|
|||
56 | const char* nets_c ="(nets"; |
|
|||
57 | const char* net_c ="(net"; |
|
|||
58 | const char* code_c ="(code"; |
|
|||
59 | const char* node_c ="(node"; |
|
|||
60 |
|
||||
61 |
|
26 | |||
62 | QIlib::QIcadNetList::QIcadNetList() |
|
27 | QIlib::QIcadNetList::QIcadNetList() | |
63 | :netlistRoot(NULL) |
|
28 | :netlistRoot(NULL) | |
@@ -113,7 +78,7 void QIlib::QIcadNetList::updateConcrete | |||||
113 | { |
|
78 | { | |
114 | if(this->rootNode.nodes.count()) |
|
79 | if(this->rootNode.nodes.count()) | |
115 | { |
|
80 | { | |
116 |
if(this->rootNode.nodes.at(0)->name==QIlib::Lexique:: |
|
81 | if(this->rootNode.nodes.at(0)->name==QIlib::Lexique::export_c) | |
117 | { |
|
82 | { | |
118 | if(this->netlistRoot==NULL) |
|
83 | if(this->netlistRoot==NULL) | |
119 | { |
|
84 | { | |
@@ -125,52 +90,6 void QIlib::QIcadNetList::updateConcrete | |||||
125 |
|
90 | |||
126 |
|
91 | |||
127 |
|
92 | |||
128 | QIlib::QIcadAbstractNodeWrapper::QIcadAbstractNodeWrapper(AbstractNode *node) |
|
|||
129 | { |
|
|||
130 | this->p_node = node; |
|
|||
131 | } |
|
|||
132 |
|
||||
133 | QIlib::QIcadAbstractNodeWrapper::~QIcadAbstractNodeWrapper() |
|
|||
134 | { |
|
|||
135 | /*First delete all the childs*/ |
|
|||
136 | for(int i=0;i<this->childs.count();i++) |
|
|||
137 | { |
|
|||
138 | if(this->childs.at(i)) |
|
|||
139 | delete this->childs.at(i); |
|
|||
140 | } |
|
|||
141 | } |
|
|||
142 |
|
||||
143 | QString QIlib::QIcadAbstractNodeWrapper::value() |
|
|||
144 | { |
|
|||
145 | if((p_node->Values.count()>0) && p_node) |
|
|||
146 | return p_node->Values.at(0); |
|
|||
147 | return QString(""); |
|
|||
148 | } |
|
|||
149 |
|
||||
150 | QString QIlib::QIcadAbstractNodeWrapper::value(int index) |
|
|||
151 | { |
|
|||
152 | if((p_node->Values.count()>index) && p_node) |
|
|||
153 | return p_node->Values.at(index); |
|
|||
154 | return QString(""); |
|
|||
155 | } |
|
|||
156 |
|
||||
157 | QString QIlib::QIcadAbstractNodeWrapper::catValues() |
|
|||
158 | { |
|
|||
159 | if(p_node) |
|
|||
160 | { |
|
|||
161 | QString result(""); |
|
|||
162 | for(int i=0;i<p_node->Values.count();i++) |
|
|||
163 | { |
|
|||
164 | result.append(p_node->Values.at(i)); |
|
|||
165 | } |
|
|||
166 | return result; |
|
|||
167 | } |
|
|||
168 | } |
|
|||
169 |
|
||||
170 | void QIlib::QIcadAbstractNodeWrapper::setNode(QIlib::AbstractNode *node) |
|
|||
171 | { |
|
|||
172 | this->p_node = node; |
|
|||
173 | } |
|
|||
174 |
|
93 | |||
175 |
|
94 | |||
176 |
|
95 | |||
@@ -183,7 +102,7 QIlib::QIcadNetListRoot::QIcadNetListRoo | |||||
183 | void QIlib::QIcadNetListRoot::setNode(QIlib::AbstractNode *node) |
|
102 | void QIlib::QIcadNetListRoot::setNode(QIlib::AbstractNode *node) | |
184 | { |
|
103 | { | |
185 | this->p_node = node; |
|
104 | this->p_node = node; | |
186 |
if(node->name==QIlib::Lexique:: |
|
105 | if(node->name==QIlib::Lexique::export_c) | |
187 | { |
|
106 | { | |
188 | for(int i=0;i<node->nodes.count();i++) |
|
107 | for(int i=0;i<node->nodes.count();i++) | |
189 | { |
|
108 | { |
@@ -1,7 +1,3 | |||||
1 | #ifndef QICADNETLIST_H |
|
|||
2 | #define QICADNETLIST_H |
|
|||
3 | #include <QString> |
|
|||
4 | #include <QStringList> |
|
|||
5 |
|
|
1 | /*------------------------------------------------------------------------------ | |
6 | -- This file is a part of the Kicad Tools Software |
|
2 | -- This file is a part of the Kicad Tools Software | |
7 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
@@ -23,69 +19,18 | |||||
23 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
24 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
25 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
|
22 | #ifndef QICADNETLIST_H | |||
|
23 | #define QICADNETLIST_H | |||
|
24 | #include <QString> | |||
|
25 | #include <QStringList> | |||
26 | #include <QList> |
|
26 | #include <QList> | |
27 | #include <QFile> |
|
27 | #include <QFile> | |
28 | #include <parsers/lispLike_driver.h> |
|
28 | #include <parsers/lispLike_driver.h> | |
29 |
#include <qicad |
|
29 | #include <qicadlisplikelexique.h> | |
30 |
|
30 | |||
31 | namespace QIlib{ |
|
31 | namespace QIlib{ | |
32 |
|
32 | |||
33 | namespace Lexique |
|
|||
34 | { |
|
|||
35 | extern "C" const char* root_c ; |
|
|||
36 | extern "C" const char* version_c ; |
|
|||
37 | extern "C" const char* design_c ; |
|
|||
38 | extern "C" const char* source_c ; |
|
|||
39 | extern "C" const char* date_c ; |
|
|||
40 | extern "C" const char* tool_c ; |
|
|||
41 | extern "C" const char* components_c ; |
|
|||
42 | extern "C" const char* component_c ; |
|
|||
43 | extern "C" const char* ref_c ; |
|
|||
44 | extern "C" const char* value_c ; |
|
|||
45 | extern "C" const char* libsource_c ; |
|
|||
46 | extern "C" const char* lib_c ; |
|
|||
47 | extern "C" const char* part_c ; |
|
|||
48 | extern "C" const char* sheetpath_c ; |
|
|||
49 | extern "C" const char* names_c ; |
|
|||
50 | extern "C" const char* tstamps_c ; |
|
|||
51 | extern "C" const char* tstamp_c ; |
|
|||
52 | extern "C" const char* libparts_c ; |
|
|||
53 | extern "C" const char* libpart_c ; |
|
|||
54 | extern "C" const char* fields_c ; |
|
|||
55 | extern "C" const char* field_c ; |
|
|||
56 | extern "C" const char* name_c ; |
|
|||
57 | extern "C" const char* pins_c ; |
|
|||
58 | extern "C" const char* pin_c ; |
|
|||
59 | extern "C" const char* num_c ; |
|
|||
60 | extern "C" const char* type_c ; |
|
|||
61 | extern "C" const char* libraries_c ; |
|
|||
62 | extern "C" const char* library_c ; |
|
|||
63 | extern "C" const char* logical_c ; |
|
|||
64 | extern "C" const char* uri_c ; |
|
|||
65 | extern "C" const char* nets_c ; |
|
|||
66 | extern "C" const char* net_c ; |
|
|||
67 | extern "C" const char* code_c ; |
|
|||
68 | extern "C" const char* node_c ; |
|
|||
69 |
|
33 | |||
70 | } |
|
|||
71 |
|
||||
72 |
|
||||
73 |
|
||||
74 | class QIcadAbstractNodeWrapper |
|
|||
75 | { |
|
|||
76 | public: |
|
|||
77 | QIcadAbstractNodeWrapper(QIlib::AbstractNode* node); |
|
|||
78 | QIcadAbstractNodeWrapper(){} |
|
|||
79 | ~QIcadAbstractNodeWrapper(); |
|
|||
80 | QString value(); |
|
|||
81 | QString value(int index); |
|
|||
82 | QString catValues(); |
|
|||
83 | QList<QIcadAbstractNodeWrapper*> childs; |
|
|||
84 | QIcadAbstractNodeWrapper* parent; |
|
|||
85 | virtual void setNode(QIlib::AbstractNode* node); |
|
|||
86 |
|
||||
87 | QIlib::AbstractNode* p_node; |
|
|||
88 | }; |
|
|||
89 |
|
34 | |||
90 | class QIcadNetListDesign : public QIcadAbstractNodeWrapper |
|
35 | class QIcadNetListDesign : public QIcadAbstractNodeWrapper | |
91 | { |
|
36 | { | |
@@ -255,7 +200,7 class QIcadNetList : private lispLike_Dr | |||||
255 | public: |
|
200 | public: | |
256 | QIcadNetList(); |
|
201 | QIcadNetList(); | |
257 | bool parseNetList(const QString& netlist); |
|
202 | bool parseNetList(const QString& netlist); | |
258 | QString toString(); |
|
203 | // QString toString(); | |
259 | QString fileName; |
|
204 | QString fileName; | |
260 | QString print(); |
|
205 | QString print(); | |
261 | QIcadNetListRoot* netlistRoot; |
|
206 | QIcadNetListRoot* netlistRoot; |
@@ -35,7 +35,8 target.path = $$[QT_INSTALL_LIBS] | |||||
35 | qilibHeaders.path = $$[QT_INSTALL_HEADERS]/QIlib |
|
35 | qilibHeaders.path = $$[QT_INSTALL_HEADERS]/QIlib | |
36 | qilibHeaders.files = \ |
|
36 | qilibHeaders.files = \ | |
37 | qicadnetlist.h \ |
|
37 | qicadnetlist.h \ | |
38 |
qicad |
|
38 | qicadpcb.h \ | |
|
39 | qicadlisplikelexique.h | |||
39 |
|
40 | |||
40 | qilibParsersHeaders.path = $$[QT_INSTALL_HEADERS]/QIlib/parsers |
|
41 | qilibParsersHeaders.path = $$[QT_INSTALL_HEADERS]/QIlib/parsers | |
41 | qilibParsersHeaders.files = \ |
|
42 | qilibParsersHeaders.files = \ | |
@@ -49,16 +50,18 INCLUDEPATH += ./parsers | |||||
49 |
|
50 | |||
50 | SOURCES += \ |
|
51 | SOURCES += \ | |
51 | qicadnetlist.cpp \ |
|
52 | qicadnetlist.cpp \ | |
52 | qicadnet.cpp \ |
|
|||
53 | parsers/lispLike_driver.cpp \ |
|
53 | parsers/lispLike_driver.cpp \ | |
54 | parsers/lispLike_scanner.cpp |
|
54 | parsers/lispLike_scanner.cpp \ | |
|
55 | qicadpcb.cpp \ | |||
|
56 | qicadlisplikelexique.cpp | |||
55 |
|
57 | |||
56 |
|
58 | |||
57 | HEADERS += \ |
|
59 | HEADERS += \ | |
58 | qicadnetlist.h \ |
|
60 | qicadnetlist.h \ | |
59 | qicadnet.h \ |
|
|||
60 | parsers/lispLike_driver.h \ |
|
61 | parsers/lispLike_driver.h \ | |
61 | parsers/lispLike_scanner.h |
|
62 | parsers/lispLike_scanner.h \ | |
|
63 | qicadpcb.h \ | |||
|
64 | qicadlisplikelexique.h | |||
62 |
|
65 | |||
63 | OTHER_FILES += qilib.prf |
|
66 | OTHER_FILES += qilib.prf | |
64 |
|
67 |
@@ -23,6 +23,7 | |||||
23 | #include <QFile> |
|
23 | #include <QFile> | |
24 | #include <QApplication> |
|
24 | #include <QApplication> | |
25 | #include <qicadnetlist.h> |
|
25 | #include <qicadnetlist.h> | |
|
26 | #include <qicadpcb.h> | |||
26 | #include <QDebug> |
|
27 | #include <QDebug> | |
27 | #include <QTime> |
|
28 | #include <QTime> | |
28 | /* |
|
29 | /* | |
@@ -32,24 +33,45 | |||||
32 | int main(int argc, char *argv[]) |
|
33 | int main(int argc, char *argv[]) | |
33 | { |
|
34 | { | |
34 | QApplication ap(argc,argv); |
|
35 | QApplication ap(argc,argv); | |
35 | QIlib::QIcadNetList NetListdriver; |
|
|||
36 | if(argc>1) |
|
36 | if(argc>1) | |
37 | { |
|
37 | { | |
38 | if(QFile::exists(argv[1])) |
|
38 | if(QFile::exists(argv[1])) | |
39 | { |
|
39 | { | |
40 | QTime tm; |
|
40 | QTime tm; | |
41 | tm.start(); |
|
41 | if(ap.arguments().contains("--netList")) | |
42 | NetListdriver.parseNetList(argv[1]); |
|
|||
43 | qDebug()<<"File parsed in "<<tm.elapsed()<<"ms"; |
|
|||
44 | if(ap.arguments().contains("--print")) |
|
|||
45 | { |
|
42 | { | |
46 | std::cout<<NetListdriver.print().toStdString(); |
|
43 | QIlib::QIcadNetList NetListdriver; | |
|
44 | tm.start(); | |||
|
45 | NetListdriver.parseNetList(argv[1]); | |||
|
46 | qDebug()<<"File parsed in "<<tm.elapsed()<<"ms"; | |||
|
47 | if(ap.arguments().contains("--print")) | |||
|
48 | { | |||
|
49 | std::cout<<NetListdriver.print().toStdString(); | |||
|
50 | } | |||
|
51 | else | |||
|
52 | { | |||
|
53 | for(int i=0;i<NetListdriver.netlistRoot->nets.count();i++) | |||
|
54 | { | |||
|
55 | std::cout<<"Found net:"<<NetListdriver.netlistRoot->nets.at(i)->name.value().toStdString()<<" "<<NetListdriver.netlistRoot->nets.at(i)->code.value().toStdString()<<"\n"; | |||
|
56 | } | |||
|
57 | } | |||
47 | } |
|
58 | } | |
48 | else |
|
59 | else | |
49 | { |
|
60 | { | |
50 | for(int i=0;i<NetListdriver.netlistRoot->nets.count();i++) |
|
61 | QIlib::QIcadPcb pcbDriver; | |
|
62 | tm.start(); | |||
|
63 | pcbDriver.parsePcb(argv[1]); | |||
|
64 | qDebug()<<"File parsed in "<<tm.elapsed()<<"ms"; | |||
|
65 | if(ap.arguments().contains("--print")) | |||
51 | { |
|
66 | { | |
52 | std::cout<<"Found net:"<<NetListdriver.netlistRoot->nets.at(i)->name.value().toStdString()<<" "<<NetListdriver.netlistRoot->nets.at(i)->code.value().toStdString()<<"\n"; |
|
67 | std::cout<<pcbDriver.print().toStdString(); | |
|
68 | } | |||
|
69 | else | |||
|
70 | { | |||
|
71 | // for(int i=0;i<NetListdriver.netlistRoot->nets.count();i++) | |||
|
72 | // { | |||
|
73 | // std::cout<<"Found net:"<<NetListdriver.netlistRoot->nets.at(i)->name.value().toStdString()<<" "<<NetListdriver.netlistRoot->nets.at(i)->code.value().toStdString()<<"\n"; | |||
|
74 | // } | |||
53 | } |
|
75 | } | |
54 | } |
|
76 | } | |
55 | } |
|
77 | } |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now