@@ -1,133 +1,154 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | /*Mainly copied from http://research.engineering.wustl.edu/~beardj/FlexBisonC++.html*/ |
|
2 | 23 | #include "lispLike_driver.h" |
|
3 | 24 | #include<assert.h> |
|
4 | 25 | |
|
5 | 26 | QIlib::lispLike_Driver::lispLike_Driver() |
|
6 | 27 | :parser( NULL ),scanner( NULL ) |
|
7 | 28 | { |
|
8 | 29 | currentNode = &rootNode; |
|
9 | 30 | } |
|
10 | 31 | |
|
11 | 32 | QIlib::lispLike_Driver::~lispLike_Driver() |
|
12 | 33 | { |
|
13 | 34 | delete(scanner); |
|
14 | 35 | scanner = NULL; |
|
15 | 36 | delete(parser); |
|
16 | 37 | parser = NULL; |
|
17 | 38 | } |
|
18 | 39 | |
|
19 | 40 | bool QIlib::lispLike_Driver::parse(const char *filename) |
|
20 | 41 | { |
|
21 | 42 | if(filename!=NULL) |
|
22 | 43 | { |
|
23 | 44 | std::ifstream in_file( filename ); |
|
24 | 45 | if( ! in_file.good() ) return false; |
|
25 | 46 | |
|
26 | 47 | delete(scanner); |
|
27 | 48 | try |
|
28 | 49 | { |
|
29 | 50 | scanner = new QIlib::lispLike_Scanner( &in_file ); |
|
30 | 51 | } |
|
31 | 52 | catch( std::bad_alloc &ba ) |
|
32 | 53 | { |
|
33 | 54 | std::cerr << "Failed to allocate scanner: (" << |
|
34 | 55 | ba.what() << ")\n"; |
|
35 | 56 | return false; |
|
36 | 57 | } |
|
37 | 58 | |
|
38 | 59 | delete(parser); |
|
39 | 60 | try |
|
40 | 61 | { |
|
41 | 62 | parser = new QIlib::lispLike_Parser( (*scanner) /* scanner */, |
|
42 | 63 | (*this) /* driver */ ); |
|
43 | 64 | } |
|
44 | 65 | catch( std::bad_alloc &ba ) |
|
45 | 66 | { |
|
46 | 67 | std::cerr << "Failed to allocate parser: (" << |
|
47 | 68 | ba.what() << ")\n"; |
|
48 | 69 | return false; |
|
49 | 70 | } |
|
50 | 71 | const int accept( 0 ); |
|
51 | 72 | if( parser->parse() != accept ) |
|
52 | 73 | { |
|
53 | 74 | std::cerr << "Parse failed!!\n"; |
|
54 | 75 | return false; |
|
55 | 76 | } |
|
56 | 77 | return true; |
|
57 | 78 | } |
|
58 | 79 | return false; |
|
59 | 80 | } |
|
60 | 81 | |
|
61 | 82 | void QIlib::lispLike_Driver::add_node(const QString &node) |
|
62 | 83 | { |
|
63 | 84 | QIlib::AbstractNode* newNode = new QIlib::AbstractNode(node,currentNode); |
|
64 | 85 | currentNode = newNode; |
|
65 | 86 | } |
|
66 | 87 | |
|
67 | 88 | void QIlib::lispLike_Driver::add_node(const QString &node, const QString &value) |
|
68 | 89 | { |
|
69 | 90 | QIlib::AbstractNode* newNode = new QIlib::AbstractNode(node,value,currentNode); |
|
70 | 91 | currentNode = newNode; |
|
71 | 92 | } |
|
72 | 93 | |
|
73 | 94 | void QIlib::lispLike_Driver::add_value(const QString &value) |
|
74 | 95 | { |
|
75 | 96 | currentNode->Values.append(value); |
|
76 | 97 | } |
|
77 | 98 | |
|
78 | 99 | void QIlib::lispLike_Driver::close_node() |
|
79 | 100 | { |
|
80 | 101 | if(currentNode->parent) |
|
81 | 102 | currentNode = currentNode->parent; |
|
82 | 103 | } |
|
83 | 104 | |
|
84 | 105 | |
|
85 | 106 | |
|
86 | 107 | |
|
87 | 108 | |
|
88 | 109 | |
|
89 | 110 | |
|
90 | 111 | |
|
91 | 112 | |
|
92 | 113 | |
|
93 | 114 | QIlib::AbstractNode::AbstractNode(QIlib::AbstractNode *parent) |
|
94 | 115 | { |
|
95 | 116 | this->parent =parent; |
|
96 | 117 | if(parent) |
|
97 | 118 | parent->nodes.append(this); |
|
98 | 119 | } |
|
99 | 120 | |
|
100 | 121 | |
|
101 | 122 | QIlib::AbstractNode::AbstractNode(const QString &Name, QIlib::AbstractNode *parent) |
|
102 | 123 | :name(Name) |
|
103 | 124 | { |
|
104 | 125 | this->parent = parent; |
|
105 | 126 | if(parent) |
|
106 | 127 | parent->nodes.append(this); |
|
107 | 128 | } |
|
108 | 129 | |
|
109 | 130 | |
|
110 | 131 | QIlib::AbstractNode::AbstractNode(const QString &Name, const QString &Value, QIlib::AbstractNode *parent) |
|
111 | 132 | :name(Name) |
|
112 | 133 | { |
|
113 | 134 | this->parent = parent; |
|
114 | 135 | if(parent) |
|
115 | 136 | parent->nodes.append(this); |
|
116 | 137 | Values.append(Value); |
|
117 | 138 | } |
|
118 | 139 | |
|
119 | 140 | QString QIlib::AbstractNode::print() |
|
120 | 141 | { |
|
121 | 142 | QString result; |
|
122 | 143 | result.append(this->name+" "); |
|
123 | 144 | for(int i=0;i<this->nodes.count();i++) |
|
124 | 145 | { |
|
125 | 146 | result.append(this->nodes.at(i)->print()); |
|
126 | 147 | } |
|
127 | 148 | for(int i=0;i<this->Values.count();i++) |
|
128 | 149 | { |
|
129 | 150 | result.append(Values.at(i)+" "); |
|
130 | 151 | } |
|
131 | 152 | result.append(")"); |
|
132 | 153 | return result; |
|
133 | 154 | } |
@@ -1,49 +1,70 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #ifndef LISPLIKE_DRIVER_H |
|
2 | 23 | #define LISPLIKE_DRIVER_H |
|
3 | 24 | #include <string> |
|
4 | 25 | #include "lispLike_scanner.h" |
|
5 | 26 | #include <lispLike/lispLike.hpp> |
|
6 | 27 | #include <QString> |
|
7 | 28 | #include <QList> |
|
8 | 29 | #include <QStringList> |
|
9 | 30 | #include <iostream> |
|
10 | 31 | #include <cstdlib> |
|
11 | 32 | #include <fstream> |
|
12 | 33 | |
|
13 | 34 | namespace QIlib{ |
|
14 | 35 | |
|
15 | 36 | class AbstractNode |
|
16 | 37 | { |
|
17 | 38 | public: |
|
18 | 39 | AbstractNode( QIlib::AbstractNode* parent=NULL); |
|
19 | 40 | AbstractNode(const QString& Name, QIlib::AbstractNode* parent=NULL); |
|
20 | 41 | AbstractNode(const QString& Name,const QString& Value, QIlib::AbstractNode* parent=NULL); |
|
21 | 42 | QString print(); |
|
22 | 43 | QList<QIlib::AbstractNode*> nodes; |
|
23 | 44 | QString name; |
|
24 | 45 | QStringList Values; |
|
25 | 46 | QIlib::AbstractNode* parent; |
|
26 | 47 | }; |
|
27 | 48 | |
|
28 | 49 | class lispLike_Driver |
|
29 | 50 | { |
|
30 | 51 | public: |
|
31 | 52 | lispLike_Driver(); |
|
32 | 53 | |
|
33 | 54 | virtual ~lispLike_Driver(); |
|
34 | 55 | bool parse( const char *filename ); |
|
35 | 56 | void add_node( const QString &node ); |
|
36 | 57 | void add_node( const QString &node , const QString &value); |
|
37 | 58 | void add_value( const QString &value ); |
|
38 | 59 | void close_node(); |
|
39 | 60 | |
|
40 | 61 | |
|
41 | 62 | protected: |
|
42 | 63 | |
|
43 | 64 | QIlib::lispLike_Parser *parser; |
|
44 | 65 | QIlib::lispLike_Scanner *scanner; |
|
45 | 66 | QIlib::AbstractNode rootNode; |
|
46 | 67 | QIlib::AbstractNode* currentNode; |
|
47 | 68 | }; |
|
48 | 69 | } |
|
49 | 70 | #endif // LISPLIKE_DRIVER_H |
@@ -1,14 +1,35 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #include "lispLike_scanner.h" |
|
2 | 23 | |
|
3 | 24 | QIlib::lispLike_Scanner::lispLike_Scanner(std::istream *in) |
|
4 | 25 | : yyFlexLexer(in), yylval( NULL ) |
|
5 | 26 | { |
|
6 | 27 | |
|
7 | 28 | } |
|
8 | 29 | |
|
9 | 30 | |
|
10 | 31 | int QIlib::lispLike_Scanner::yylex(QIlib::lispLike_Parser::semantic_type *lval) |
|
11 | 32 | { |
|
12 | 33 | yylval = lval; |
|
13 | 34 | return( yylex() ); |
|
14 | 35 | } |
@@ -1,31 +1,52 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #ifndef LISPLIKE_SCANNER_H |
|
2 | 23 | #define LISPLIKE_SCANNER_H |
|
3 | 24 | #if ! defined(yyFlexLexerOnce) |
|
4 | 25 | #include <FlexLexer.h> |
|
5 | 26 | #endif |
|
6 | 27 | #include <iostream> |
|
7 | 28 | #include <cstdlib> |
|
8 | 29 | #include <fstream> |
|
9 | 30 | |
|
10 | 31 | #undef YY_DECL |
|
11 | 32 | #define YY_DECL int QIlib::lispLike_Scanner::yylex() |
|
12 | 33 | |
|
13 | 34 | #include <lispLike/lispLike.hpp> |
|
14 | 35 | |
|
15 | 36 | namespace QIlib{ |
|
16 | 37 | |
|
17 | 38 | class lispLike_Scanner : public yyFlexLexer |
|
18 | 39 | { |
|
19 | 40 | public: |
|
20 | 41 | lispLike_Scanner(std::istream *in); |
|
21 | 42 | int yylex(QIlib::lispLike_Parser::semantic_type *lval); |
|
22 | 43 | |
|
23 | 44 | private: |
|
24 | 45 | /* hide this one from public view */ |
|
25 | 46 | int yylex(); |
|
26 | 47 | /* yyval ptr */ |
|
27 | 48 | QIlib::lispLike_Parser::semantic_type *yylval; |
|
28 | 49 | }; |
|
29 | 50 | } |
|
30 | 51 | |
|
31 | 52 | #endif // LISPLIKE_SCANNER_H |
@@ -1,17 +1,38 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #include "qicadnet.h" |
|
2 | 23 | |
|
3 | 24 | QIlib::QIcadNet::QIcadNet() |
|
4 | 25 | { |
|
5 | 26 | } |
|
6 | 27 | |
|
7 | 28 | QIlib::QIcadNet::~QIcadNet() |
|
8 | 29 | { |
|
9 | 30 | |
|
10 | 31 | } |
|
11 | 32 | |
|
12 | 33 | |
|
13 | 34 | QIlib::QIcadNetNode::QIcadNetNode(QString ref, QString node) |
|
14 | 35 | { |
|
15 | 36 | this->p_ref = ref; |
|
16 | 37 | this->p_node = node; |
|
17 | 38 | } |
@@ -1,31 +1,52 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #ifndef QINET_H |
|
2 | 23 | #define QINET_H |
|
3 | 24 | #include <QString> |
|
4 | 25 | #include <QList> |
|
5 | 26 | |
|
6 | 27 | namespace QIlib{ |
|
7 | 28 | class QIcadNetNode |
|
8 | 29 | { |
|
9 | 30 | public: |
|
10 | 31 | QIcadNetNode(QString ref,QString node); |
|
11 | 32 | QString ref(){return this->p_ref;} |
|
12 | 33 | QString node(){return this->p_node;} |
|
13 | 34 | private: |
|
14 | 35 | QString p_ref; |
|
15 | 36 | QString p_node; |
|
16 | 37 | }; |
|
17 | 38 | |
|
18 | 39 | class QIcadNet |
|
19 | 40 | { |
|
20 | 41 | public: |
|
21 | 42 | QIcadNet(); |
|
22 | 43 | ~QIcadNet(); |
|
23 | 44 | int code(); |
|
24 | 45 | QString name(); |
|
25 | 46 | private: |
|
26 | 47 | int p_code; |
|
27 | 48 | QString p_name; |
|
28 | 49 | QList<QIcadNetNode*> p_nodes; |
|
29 | 50 | }; |
|
30 | 51 | } |
|
31 | 52 | #endif // QINET_H |
@@ -1,132 +1,200 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #include "qicadnetlist.h" |
|
2 | 23 | #include <QRegularExpression> |
|
3 | 24 | |
|
4 | 25 | |
|
5 | 26 | const char* root_c ="(export"; |
|
6 | 27 | const char* version_c ="(version"; |
|
7 | 28 | const char* design_c ="(design"; |
|
8 | 29 | const char* source_c ="(source"; |
|
9 | 30 | const char* date_c ="(date"; |
|
10 | 31 | const char* tool_c ="(tool"; |
|
11 | 32 | const char* components_c ="(components"; |
|
12 | 33 | const char* component_c ="(comp"; |
|
13 | 34 | const char* ref_c ="(ref"; |
|
14 | 35 | const char* value_c ="(value"; |
|
15 | 36 | const char* libsource_c ="(libsource"; |
|
16 | 37 | const char* lib_c ="(lib"; |
|
17 | 38 | const char* part_c ="(part"; |
|
18 | 39 | const char* sheetpath_c ="(sheetpath"; |
|
19 | 40 | const char* names_c ="(names"; |
|
20 | 41 | const char* tstamps_c ="(tstamps"; |
|
21 | 42 | const char* tstamp_c ="(tstamp"; |
|
22 | 43 | const char* libparts_c ="(libparts"; |
|
23 | 44 | const char* libpart_c ="(libpart"; |
|
24 | 45 | const char* fields_c ="(fields"; |
|
25 | 46 | const char* field_c ="(field"; |
|
26 | 47 | const char* name_c ="(name"; |
|
27 | 48 | const char* pins_c ="(pins"; |
|
28 | 49 | const char* pin_c ="(pin"; |
|
29 | 50 | const char* num_c ="(num"; |
|
30 | 51 | const char* type_c ="(type"; |
|
31 | 52 | const char* libraries_c ="(libraries"; |
|
32 | 53 | const char* library_c ="(library"; |
|
33 | 54 | const char* logical_c ="(logical"; |
|
34 | 55 | const char* uri_c ="(uri"; |
|
35 | 56 | const char* nets_c ="(nets"; |
|
36 | 57 | const char* net_c ="(net"; |
|
37 | 58 | const char* code_c ="(code"; |
|
38 | 59 | const char* node_c ="(node"; |
|
39 | 60 | |
|
40 | 61 | |
|
41 | 62 | QIlib::QIcadNetList::QIcadNetList() |
|
42 | 63 | { |
|
43 | 64 | |
|
44 | 65 | } |
|
45 | 66 | |
|
46 | 67 | |
|
47 | 68 | bool QIlib::QIcadNetList::parseNetList(const QString &netlist) |
|
48 | 69 | { |
|
49 | 70 | |
|
50 | 71 | parse(netlist.toStdString().c_str()); |
|
51 | 72 | updateConcreteTree(); |
|
52 | 73 | return false; |
|
53 | 74 | } |
|
54 | 75 | |
|
55 | 76 | QString QIlib::QIcadNetList::print() |
|
56 | 77 | { |
|
57 | 78 | return rootNode.print(); |
|
58 | 79 | } |
|
59 | 80 | |
|
60 | 81 | QIlib::AbstractNode *QIlib::QIcadNetList::getAbstractNode(const QString &node, int index) |
|
61 | 82 | { |
|
62 | 83 | return getAbstractNode(&rootNode,node,&index); |
|
63 | 84 | } |
|
64 | 85 | |
|
65 | 86 | QIlib::AbstractNode *QIlib::QIcadNetList::getAbstractNode(QIlib::AbstractNode *rootNode, const QString &node, int* index) |
|
66 | 87 | { |
|
67 | 88 | for(int i=0;i<rootNode->nodes.count();i++) |
|
68 | 89 | { |
|
69 | 90 | if(rootNode->nodes.at(i)->name==node) |
|
70 | 91 | { |
|
71 | 92 | if((*index)==0) |
|
72 | 93 | { |
|
73 | 94 | return rootNode->nodes.at(i); |
|
74 | 95 | } |
|
75 | 96 | (*index)-=1; |
|
76 | 97 | } |
|
77 | 98 | else |
|
78 | 99 | { |
|
79 | 100 | if(0<rootNode->nodes.at(i)->nodes.count()) |
|
80 | 101 | { |
|
81 | 102 | QIlib::AbstractNode *result=getAbstractNode(rootNode->nodes.at(i),node,index); |
|
82 | 103 | if(NULL!=result)return result; |
|
83 | 104 | } |
|
84 | 105 | } |
|
85 | 106 | } |
|
86 | 107 | return NULL; |
|
87 | 108 | } |
|
88 | 109 | |
|
89 | 110 | /* |
|
90 | 111 | QString version; |
|
91 | 112 | QIcadNetListDesign design; |
|
92 | 113 | QList<QIcadNetListComponent*> components; |
|
93 | 114 | QList<QIcadNetListLibPart*> libparts; |
|
94 | 115 | QIcadNetListLevel rootSheet; |
|
95 | 116 | */ |
|
96 | 117 | |
|
97 | 118 | #define setVal(dest,node,name,index) \ |
|
98 | 119 | (node) = getAbstractNode((name),(index));\ |
|
99 | 120 | if(((node)!=NULL)&&(0<(node)->Values.count())) \ |
|
100 | 121 | {\ |
|
101 | 122 | (dest) = (node)->Values.at(0); \ |
|
102 | 123 | } \ |
|
103 | 124 | |
|
104 | 125 | |
|
105 | 126 | void QIlib::QIcadNetList::updateConcreteTree() |
|
106 | 127 | { |
|
107 | 128 | QIlib::AbstractNode *node; |
|
108 | 129 | setVal(this->version,node,QIlib::Lexique::version_c,0); |
|
109 | 130 | setVal(this->design.date,node,QIlib::Lexique::date_c,0); |
|
110 | 131 | setVal(this->design.source,node,QIlib::Lexique::source_c,0); |
|
111 | 132 | setVal(this->design.tool,node,QIlib::Lexique::tool_c,0); |
|
112 | 133 | this->design.date.clear(); |
|
113 | 134 | } |
|
114 | 135 | |
|
115 | 136 | |
|
116 | 137 | |
|
117 | 138 | |
|
118 | 139 | |
|
119 | QIlib::QIcadAbstractNodeWrapper::QIcadAbstractNodeWrapper() | |
|
140 | QIlib::QIcadAbstractNodeWrapper::QIcadAbstractNodeWrapper(AbstractNode *node) | |
|
120 | 141 | { |
|
121 | ||
|
142 | this->p_node = node; | |
|
122 | 143 | } |
|
123 | 144 | |
|
124 | 145 | QIlib::QIcadAbstractNodeWrapper::~QIcadAbstractNodeWrapper() |
|
125 | 146 | { |
|
126 | 147 | /*First delete all the childs*/ |
|
127 | 148 | for(int i=0;i<this->childs.count();i++) |
|
128 | 149 | { |
|
129 | 150 | if(this->childs.at(i)) |
|
130 | 151 | delete this->childs.at(i); |
|
131 | 152 | } |
|
132 | 153 | } |
|
154 | ||
|
155 | QString QIlib::QIcadAbstractNodeWrapper::value() | |
|
156 | { | |
|
157 | if((p_node->Values.count()>0) && p_node) | |
|
158 | return p_node->Values.at(0); | |
|
159 | return QString(""); | |
|
160 | } | |
|
161 | ||
|
162 | QString QIlib::QIcadAbstractNodeWrapper::value(int index) | |
|
163 | { | |
|
164 | if((p_node->Values.count()>index) && p_node) | |
|
165 | return p_node->Values.at(index); | |
|
166 | return QString(""); | |
|
167 | } | |
|
168 | ||
|
169 | QString QIlib::QIcadAbstractNodeWrapper::catValues() | |
|
170 | { | |
|
171 | if(p_node) | |
|
172 | { | |
|
173 | QString result(""); | |
|
174 | for(int i=0;i<p_node->Values.count();i++) | |
|
175 | { | |
|
176 | result.append(p_node->Values.at(i)); | |
|
177 | } | |
|
178 | return result; | |
|
179 | } | |
|
180 | } | |
|
181 | ||
|
182 | void QIlib::QIcadAbstractNodeWrapper::setNode(QIlib::AbstractNode *node) | |
|
183 | { | |
|
184 | this->p_node = node; | |
|
185 | } | |
|
186 | ||
|
187 | ||
|
188 | ||
|
189 | QIlib::QIcadNetListRoot::QIcadNetListRoot(QIlib::AbstractNode *node) | |
|
190 | :QIcadAbstractNodeWrapper(node) | |
|
191 | { | |
|
192 | ||
|
193 | } | |
|
194 | ||
|
195 | ||
|
196 | QIlib::QIcadNetListComponent::QIcadNetListComponent(QIlib::AbstractNode *node) | |
|
197 | :QIcadAbstractNodeWrapper(node) | |
|
198 | { | |
|
199 | ||
|
200 | } |
@@ -1,144 +1,279 | |||
|
1 | 1 | #ifndef QICADNETLIST_H |
|
2 | 2 | #define QICADNETLIST_H |
|
3 | 3 | #include <QString> |
|
4 | 4 | #include <QStringList> |
|
5 | /*------------------------------------------------------------------------------ | |
|
6 | -- This file is a part of the Kicad Tools Software | |
|
7 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | |
|
8 | -- | |
|
9 | -- This program is free software; you can redistribute it and/or modify | |
|
10 | -- it under the terms of the GNU General Public License as published by | |
|
11 | -- the Free Software Foundation; either version 2 of the License, or | |
|
12 | -- (at your option) any later version. | |
|
13 | -- | |
|
14 | -- This program is distributed in the hope that it will be useful, | |
|
15 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
16 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
17 | -- GNU General Public License for more details. | |
|
18 | -- | |
|
19 | -- You should have received a copy of the GNU General Public License | |
|
20 | -- along with this program; if not, write to the Free Software | |
|
21 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
22 | -------------------------------------------------------------------------------*/ | |
|
23 | /*-- Author : Alexis Jeandet | |
|
24 | -- Mail : alexis.jeandet@member.fsf.org | |
|
25 | ----------------------------------------------------------------------------*/ | |
|
5 | 26 | #include <QList> |
|
6 | 27 | #include <QFile> |
|
7 | 28 | #include <parsers/lispLike_driver.h> |
|
8 | 29 | #include <qicadnet.h> |
|
9 | 30 | |
|
10 | 31 | namespace QIlib{ |
|
11 | 32 | |
|
12 | 33 | namespace Lexique |
|
13 | 34 | { |
|
14 | 35 | extern "C" const char* root_c ; |
|
15 | 36 | extern "C" const char* version_c ; |
|
16 | 37 | extern "C" const char* design_c ; |
|
17 | 38 | extern "C" const char* source_c ; |
|
18 | 39 | extern "C" const char* date_c ; |
|
19 | 40 | extern "C" const char* tool_c ; |
|
20 | 41 | extern "C" const char* components_c ; |
|
21 | 42 | extern "C" const char* component_c ; |
|
22 | 43 | extern "C" const char* ref_c ; |
|
23 | 44 | extern "C" const char* value_c ; |
|
24 | 45 | extern "C" const char* libsource_c ; |
|
25 | 46 | extern "C" const char* lib_c ; |
|
26 | 47 | extern "C" const char* part_c ; |
|
27 | 48 | extern "C" const char* sheetpath_c ; |
|
28 | 49 | extern "C" const char* names_c ; |
|
29 | 50 | extern "C" const char* tstamps_c ; |
|
30 | 51 | extern "C" const char* tstamp_c ; |
|
31 | 52 | extern "C" const char* libparts_c ; |
|
32 | 53 | extern "C" const char* libpart_c ; |
|
33 | 54 | extern "C" const char* fields_c ; |
|
34 | 55 | extern "C" const char* field_c ; |
|
35 | 56 | extern "C" const char* name_c ; |
|
36 | 57 | extern "C" const char* pins_c ; |
|
37 | 58 | extern "C" const char* pin_c ; |
|
38 | 59 | extern "C" const char* num_c ; |
|
39 | 60 | extern "C" const char* type_c ; |
|
40 | 61 | extern "C" const char* libraries_c ; |
|
41 | 62 | extern "C" const char* library_c ; |
|
42 | 63 | extern "C" const char* logical_c ; |
|
43 | 64 | extern "C" const char* uri_c ; |
|
44 | 65 | extern "C" const char* nets_c ; |
|
45 | 66 | extern "C" const char* net_c ; |
|
46 | 67 | extern "C" const char* code_c ; |
|
47 | 68 | extern "C" const char* node_c ; |
|
48 | 69 | |
|
49 | 70 | } |
|
50 | 71 | |
|
51 | 72 | class QIcadNetListLevel |
|
52 | 73 | { |
|
53 | 74 | public: |
|
54 | 75 | QIcadNetListLevel() {} |
|
55 | 76 | QList<QIcadNetListLevel*> sublevels; |
|
56 | 77 | QList<QIcadNet*> nets; |
|
57 | 78 | }; |
|
58 | 79 | |
|
59 | 80 | class QIcadNetListDesign |
|
60 | 81 | { |
|
61 | 82 | public: |
|
62 | 83 | QIcadNetListDesign(){} |
|
63 | 84 | QString source; |
|
64 | 85 | QString date; |
|
65 | 86 | QString tool; |
|
66 | 87 | }; |
|
67 | 88 | |
|
68 | 89 | class QIcadNetListComponent |
|
69 | 90 | { |
|
70 | 91 | public: |
|
71 | 92 | typedef struct libsource_t |
|
72 | 93 | { |
|
73 | 94 | QString lib; |
|
74 | 95 | QString part; |
|
75 | 96 | }libsource_t; |
|
76 | 97 | typedef struct sheetpath_t |
|
77 | 98 | { |
|
78 | 99 | QString names; |
|
79 | 100 | QString tstamp; |
|
80 | 101 | }sheetpath_t; |
|
81 | 102 | QIcadNetListComponent(){} |
|
82 | 103 | QString ref; |
|
83 | 104 | QString value; |
|
84 | 105 | QString tstamp; |
|
85 | 106 | libsource_t libsource; |
|
86 | 107 | sheetpath_t sheetpath; |
|
87 | 108 | }; |
|
88 | 109 | |
|
89 | 110 | class QIcadNetListLibPart |
|
90 | 111 | { |
|
91 | 112 | public: |
|
92 | 113 | typedef struct fields_t |
|
93 | 114 | { |
|
94 | 115 | QString ref; |
|
95 | 116 | QString value; |
|
96 | 117 | QString footprint; |
|
97 | 118 | QString datasheet; |
|
98 | 119 | }fields_t; |
|
99 | 120 | typedef struct pin_t |
|
100 | 121 | { |
|
101 | 122 | int num; |
|
102 | 123 | QString name; |
|
103 | 124 | QString type; |
|
104 | 125 | }pin_t; |
|
105 | 126 | QIcadNetListLibPart(); |
|
106 | 127 | QString lib; |
|
107 | 128 | QString part; |
|
108 | 129 | QStringList footprints; |
|
109 | 130 | fields_t fields; |
|
110 | 131 | QList<pin_t*> pins; |
|
111 | 132 | }; |
|
112 | 133 | |
|
113 | 134 | class QIcadAbstractNodeWrapper |
|
114 | 135 | { |
|
115 | 136 | public: |
|
116 | QIcadAbstractNodeWrapper(); | |
|
137 | QIcadAbstractNodeWrapper(QIlib::AbstractNode* node); | |
|
117 | 138 | ~QIcadAbstractNodeWrapper(); |
|
118 | 139 | QString value(); |
|
140 | QString value(int index); | |
|
141 | QString catValues(); | |
|
142 | void setNode(QIlib::AbstractNode* node); | |
|
119 | 143 | QList<QIcadAbstractNodeWrapper*> childs; |
|
120 | 144 | QIcadAbstractNodeWrapper* parent; |
|
145 | ||
|
121 | 146 | private: |
|
122 | QIlib::AbstractNode* node; | |
|
147 | QIlib::AbstractNode* p_node; | |
|
148 | }; | |
|
149 | ||
|
150 | class QIcadNetListRoot : public AbstractNode | |
|
151 | { | |
|
152 | public: | |
|
153 | QIcadNetListRoot(QIlib::AbstractNode* node); | |
|
154 | QIcadAbstractNodeWrapper source; | |
|
155 | QIcadAbstractNodeWrapper date; | |
|
156 | QIcadAbstractNodeWrapper tool; | |
|
157 | QList<QIcadNetListComponent*> components; | |
|
158 | QList<QIcadNetListLibPart*> libparts; | |
|
159 | QList<QIcadNetListLibrary*> libraries; | |
|
160 | }; | |
|
161 | ||
|
162 | ||
|
163 | /* | |
|
164 | * (comp (ref IC1) | |
|
165 | (value 24L-MOD-8) | |
|
166 | (libsource (lib guan) (part 24L-MOD-8)) | |
|
167 | (sheetpath (names /) (tstamps /)) | |
|
168 | (tstamp 52533BBE)) | |
|
169 | */ | |
|
170 | class QIcadNetListComponent:public QIcadAbstractNodeWrapper | |
|
171 | { | |
|
172 | public: | |
|
173 | QIcadNetListComponent(AbstractNode* node); | |
|
174 | QIcadAbstractNodeWrapper ref; | |
|
175 | QIcadAbstractNodeWrapper value; | |
|
176 | QIcadAbstractNodeWrapper libsource; | |
|
177 | QIcadAbstractNodeWrapper sheetpath; | |
|
178 | QIcadAbstractNodeWrapper tstamp; | |
|
179 | }; | |
|
180 | ||
|
181 | ||
|
182 | /* | |
|
183 | (libparts | |
|
184 | (libpart (lib guan) (part 24L-MOD-8) | |
|
185 | (fields | |
|
186 | (field (name Reference) IC) | |
|
187 | (field (name Value) 24L-MOD-8)) | |
|
188 | (pins | |
|
189 | (pin (num 1) (name GND) (type power_in)) | |
|
190 | (pin (num 2) (name VCC) (type power_in)) | |
|
191 | */ | |
|
192 | class QIcadNetListField : QIcadAbstractNodeWrapper | |
|
193 | { | |
|
194 | public: | |
|
195 | QIcadNetListField(AbstractNode* node); | |
|
196 | QIcadAbstractNodeWrapper name; | |
|
123 | 197 | }; |
|
124 | 198 | |
|
199 | ||
|
200 | class QIcadNetListLibPart : QIcadAbstractNodeWrapper | |
|
201 | { | |
|
202 | class QIcadNetListPin : QIcadAbstractNodeWrapper | |
|
203 | { | |
|
204 | public: | |
|
205 | QIcadNetListPin(AbstractNode* node); | |
|
206 | QIcadAbstractNodeWrapper type; | |
|
207 | QIcadAbstractNodeWrapper num; | |
|
208 | QIcadAbstractNodeWrapper name; | |
|
209 | }; | |
|
210 | public: | |
|
211 | QIcadNetListLibPart(AbstractNode* node); | |
|
212 | QList<QIcadNetListField*> fields; | |
|
213 | QList<QIcadNetListPin*> pins; | |
|
214 | }; | |
|
215 | ||
|
216 | /* | |
|
217 | (libraries | |
|
218 | (library (logical guan) | |
|
219 | (uri /home/guan/boards/guan.lib)) | |
|
220 | (library (logical device) | |
|
221 | (uri /usr/share/kicad/library/device.lib)) | |
|
222 | (library (logical conn) | |
|
223 | (uri /usr/share/kicad/library/conn.lib))) | |
|
224 | */ | |
|
225 | ||
|
226 | class QIcadNetListLibrary : QIcadAbstractNodeWrapper | |
|
227 | { | |
|
228 | public: | |
|
229 | QIcadNetListLibrary(AbstractNode* node); | |
|
230 | QIcadAbstractNodeWrapper uri; | |
|
231 | }; | |
|
232 | /* | |
|
233 | (nets | |
|
234 | (net (code 15) (name "") | |
|
235 | (node (ref C4) (pin 1)) | |
|
236 | (node (ref U2) (pin 4))) | |
|
237 | (net (code 16) (name GND) | |
|
238 | (node (ref D1) (pin 2)) | |
|
239 | (node (ref C1) (pin 2)) | |
|
240 | (node (ref IC1) (pin 1)) | |
|
241 | */ | |
|
242 | ||
|
243 | class QIcadNetListNet : QIcadAbstractNodeWrapper | |
|
244 | { | |
|
245 | class QIcadNetListNetNode: QIcadAbstractNodeWrapper | |
|
246 | { | |
|
247 | public: | |
|
248 | QIcadNetListNetNode(AbstractNode* node); | |
|
249 | QIcadAbstractNodeWrapper ref; | |
|
250 | QIcadAbstractNodeWrapper pin; | |
|
251 | }; | |
|
252 | public: | |
|
253 | QIcadNetListNet(AbstractNode* node); | |
|
254 | QList<QIcadNetListNetNode*> NetNodes; | |
|
255 | }; | |
|
256 | ||
|
257 | ||
|
258 | ||
|
125 | 259 | class QIcadNetList : private lispLike_Driver |
|
126 | 260 | { |
|
127 | 261 | public: |
|
128 | 262 | QIcadNetList(); |
|
129 | 263 | bool parseNetList(const QString& netlist); |
|
130 | 264 | QString toString(); |
|
131 | 265 | QString fileName; |
|
132 | 266 | QString version; |
|
133 | 267 | QIcadNetListDesign design; |
|
134 | 268 | QList<QIcadNetListComponent*> components; |
|
135 | 269 | QList<QIcadNetListLibPart*> libparts; |
|
136 | 270 | QIcadNetListLevel rootSheet; |
|
137 | 271 | QString print(); |
|
272 | QIcadAbstractNodeWrapper netlistRoot; | |
|
138 | 273 | private: |
|
139 | 274 | QIlib::AbstractNode* getAbstractNode(const QString& node,int index); |
|
140 | 275 | QIlib::AbstractNode* getAbstractNode(QIlib::AbstractNode* rootNode,const QString& node,int* index); |
|
141 | 276 | void updateConcreteTree(); |
|
142 | 277 | }; |
|
143 | 278 | } |
|
144 | 279 | #endif // QICADNETLIST_H |
@@ -1,27 +1,48 | |||
|
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 | ----------------------------------------------------------------------------*/ | |
|
1 | 22 | #include <QDir> |
|
2 | 23 | #include <QFile> |
|
3 | 24 | #include <QApplication> |
|
4 | 25 | #include <qicadnetlist.h> |
|
5 | 26 | #include <QDebug> |
|
6 | 27 | #include <QTime> |
|
7 | 28 | /* |
|
8 | 29 | #include <lispLike_driver.h> |
|
9 | 30 | */ |
|
10 | 31 | |
|
11 | 32 | int main(int argc, char *argv[]) |
|
12 | 33 | { |
|
13 | 34 | QApplication ap(argc,argv); |
|
14 | 35 | QIlib::QIcadNetList NetListdriver; |
|
15 | 36 | if(argc>1) |
|
16 | 37 | { |
|
17 | 38 | if(QFile::exists(argv[1])) |
|
18 | 39 | { |
|
19 | 40 | QTime tm; |
|
20 | 41 | tm.start(); |
|
21 | 42 | NetListdriver.parseNetList(argv[1]); |
|
22 | 43 | qDebug()<<"File parsed in "<<tm.elapsed()<<"ms"; |
|
23 | 44 | std::cout<<NetListdriver.print().toStdString(); |
|
24 | 45 | } |
|
25 | 46 | } |
|
26 | 47 | return 0; |
|
27 | 48 | } |
@@ -1,411 +1,411 | |||
|
1 | 1 | (export (version D) |
|
2 | 2 | (design |
|
3 | 3 | (source /home/guan/boards/boiler/boiler.sch) |
|
4 | 4 | (date "Sat 12 Oct 2013 10:55:49 PM EDT") |
|
5 | 5 | (tool "eeschema (2013-mar-13)-testing")) |
|
6 | 6 | (components |
|
7 | 7 | (comp (ref IC1) |
|
8 | 8 | (value 24L-MOD-8) |
|
9 | 9 | (libsource (lib guan) (part 24L-MOD-8)) |
|
10 | 10 | (sheetpath (names /) (tstamps /)) |
|
11 | 11 | (tstamp 52533BBE)) |
|
12 | 12 | (comp (ref IC2) |
|
13 | 13 | (value ATXMEGA8E5-A) |
|
14 | 14 | (libsource (lib guan) (part ATXMEGA8E5-A)) |
|
15 | 15 | (sheetpath (names /) (tstamps /)) |
|
16 | 16 | (tstamp 52545974)) |
|
17 | 17 | (comp (ref C2) |
|
18 | 18 | (value 0.1uF) |
|
19 | 19 | (libsource (lib device) (part C)) |
|
20 | 20 | (sheetpath (names /) (tstamps /)) |
|
21 | 21 | (tstamp 52546804)) |
|
22 | 22 | (comp (ref C3) |
|
23 | 23 | (value 0.1uF) |
|
24 | 24 | (libsource (lib device) (part C)) |
|
25 | 25 | (sheetpath (names /) (tstamps /)) |
|
26 | 26 | (tstamp 5254762B)) |
|
27 | 27 | (comp (ref C1) |
|
28 | 28 | (value 0.1uF) |
|
29 | 29 | (libsource (lib device) (part C)) |
|
30 | 30 | (sheetpath (names /) (tstamps /)) |
|
31 | 31 | (tstamp 5254849B)) |
|
32 | 32 | (comp (ref U1) |
|
33 | 33 | (value AQV252) |
|
34 | 34 | (libsource (lib guan) (part AQV252)) |
|
35 | 35 | (sheetpath (names /) (tstamps /)) |
|
36 | 36 | (tstamp 52552335)) |
|
37 | 37 | (comp (ref R3) |
|
38 | 38 | (value 33R) |
|
39 | 39 | (libsource (lib device) (part R)) |
|
40 | 40 | (sheetpath (names /) (tstamps /)) |
|
41 | 41 | (tstamp 52553078)) |
|
42 | 42 | (comp (ref P2) |
|
43 | 43 | (value CONN_2) |
|
44 | 44 | (libsource (lib conn) (part CONN_2)) |
|
45 | 45 | (sheetpath (names /) (tstamps /)) |
|
46 | 46 | (tstamp 52555ACB)) |
|
47 | 47 | (comp (ref P1) |
|
48 | 48 | (value CONN_3X2) |
|
49 | 49 | (libsource (lib conn) (part CONN_3X2)) |
|
50 | 50 | (sheetpath (names /) (tstamps /)) |
|
51 | 51 | (tstamp 52555B20)) |
|
52 | 52 | (comp (ref R1) |
|
53 | 53 | (value 1K) |
|
54 | 54 | (libsource (lib device) (part R)) |
|
55 | 55 | (sheetpath (names /) (tstamps /)) |
|
56 | 56 | (tstamp 52555B2F)) |
|
57 | 57 | (comp (ref R2) |
|
58 | 58 | (value 1K) |
|
59 | 59 | (libsource (lib device) (part R)) |
|
60 | 60 | (sheetpath (names /) (tstamps /)) |
|
61 | 61 | (tstamp 5255698D)) |
|
62 | 62 | (comp (ref D2) |
|
63 | 63 | (value LED) |
|
64 | 64 | (libsource (lib device) (part LED)) |
|
65 | 65 | (sheetpath (names /) (tstamps /)) |
|
66 | 66 | (tstamp 5255699C)) |
|
67 | 67 | (comp (ref D1) |
|
68 | 68 | (value LED) |
|
69 | 69 | (libsource (lib device) (part LED)) |
|
70 | 70 | (sheetpath (names /) (tstamps /)) |
|
71 | 71 | (tstamp 525569BA)) |
|
72 | 72 | (comp (ref U2) |
|
73 | 73 | (value MIC5205) |
|
74 | 74 | (libsource (lib guan) (part MIC5205)) |
|
75 | 75 | (sheetpath (names /) (tstamps /)) |
|
76 | 76 | (tstamp 525688C8)) |
|
77 | 77 | (comp (ref C4) |
|
78 | 78 | (value 470pF) |
|
79 | 79 | (libsource (lib device) (part C)) |
|
80 | 80 | (sheetpath (names /) (tstamps /)) |
|
81 | 81 | (tstamp 5256954D)) |
|
82 | 82 | (comp (ref C5) |
|
83 | 83 | (value 4.7uF) |
|
84 | 84 | (libsource (lib device) (part C)) |
|
85 | 85 | (sheetpath (names /) (tstamps /)) |
|
86 | 86 | (tstamp 5256962C)) |
|
87 | 87 | (comp (ref P3) |
|
88 | 88 | (value RASM722X) |
|
89 | 89 | (libsource (lib conn) (part CONN_2)) |
|
90 | 90 | (sheetpath (names /) (tstamps /)) |
|
91 | 91 | (tstamp 5256F96D)) |
|
92 | 92 | (comp (ref C6) |
|
93 | 93 | (value 4.7uF) |
|
94 | 94 | (libsource (lib device) (part C)) |
|
95 | 95 | (sheetpath (names /) (tstamps /)) |
|
96 | 96 | (tstamp 52574204)) |
|
97 | 97 | (comp (ref L1) |
|
98 | 98 | (value INDUCTOR) |
|
99 | 99 | (libsource (lib device) (part INDUCTOR)) |
|
100 | 100 | (sheetpath (names /) (tstamps /)) |
|
101 | 101 | (tstamp 52574F79)) |
|
102 | 102 | (comp (ref P4) |
|
103 | 103 | (value CONN_1) |
|
104 | 104 | (libsource (lib conn) (part CONN_1)) |
|
105 | 105 | (sheetpath (names /) (tstamps /)) |
|
106 | 106 | (tstamp 52587B8E)) |
|
107 | 107 | (comp (ref P5) |
|
108 | 108 | (value CONN_1) |
|
109 | 109 | (libsource (lib conn) (part CONN_1)) |
|
110 | 110 | (sheetpath (names /) (tstamps /)) |
|
111 | 111 | (tstamp 52587B9D)) |
|
112 | 112 | (comp (ref P6) |
|
113 | 113 | (value CONN_1) |
|
114 | 114 | (libsource (lib conn) (part CONN_1)) |
|
115 | 115 | (sheetpath (names /) (tstamps /)) |
|
116 | 116 | (tstamp 52587BAC)) |
|
117 | 117 | (comp (ref P7) |
|
118 | 118 | (value CONN_1) |
|
119 | 119 | (libsource (lib conn) (part CONN_1)) |
|
120 | 120 | (sheetpath (names /) (tstamps /)) |
|
121 | 121 | (tstamp 52587BBB))) |
|
122 | 122 | (libparts |
|
123 | 123 | (libpart (lib guan) (part 24L-MOD-8) |
|
124 | 124 | (fields |
|
125 | 125 | (field (name Reference) IC) |
|
126 | 126 | (field (name Value) 24L-MOD-8)) |
|
127 | 127 | (pins |
|
128 | 128 | (pin (num 1) (name GND) (type power_in)) |
|
129 | 129 | (pin (num 2) (name VCC) (type power_in)) |
|
130 | 130 | (pin (num 3) (name CE) (type input)) |
|
131 | 131 | (pin (num 4) (name CSN) (type input)) |
|
132 | 132 | (pin (num 5) (name SCK) (type input)) |
|
133 | 133 | (pin (num 6) (name MOSI) (type input)) |
|
134 | 134 | (pin (num 7) (name MISO) (type output)) |
|
135 | 135 | (pin (num 8) (name IRQ) (type output)))) |
|
136 | 136 | (libpart (lib guan) (part AQV252) |
|
137 | 137 | (fields |
|
138 | 138 | (field (name Reference) U) |
|
139 | 139 | (field (name Value) AQV252)) |
|
140 | 140 | (pins |
|
141 | 141 | (pin (num 1) (name ~) (type power_in)) |
|
142 | 142 | (pin (num 2) (name ~) (type power_in)) |
|
143 | 143 | (pin (num 3) (name ~) (type power_in)) |
|
144 | 144 | (pin (num 4) (name ~) (type power_in)) |
|
145 | 145 | (pin (num 5) (name ~) (type power_in)) |
|
146 | 146 | (pin (num 6) (name ~) (type power_in)))) |
|
147 | 147 | (libpart (lib guan) (part ATXMEGA8E5-A) |
|
148 | 148 | (fields |
|
149 | 149 | (field (name Reference) IC) |
|
150 | 150 | (field (name Value) ATXMEGA8E5-A)) |
|
151 | 151 | (pins |
|
152 | 152 | (pin (num 1) (name GND) (type power_in)) |
|
153 | 153 | (pin (num 2) (name PA4/ADC4/AC4) (type 3state)) |
|
154 | 154 | (pin (num 3) (name PA3/ADC3/DAC1/AC3) (type 3state)) |
|
155 | 155 | (pin (num 4) (name PA2/ADC2/DAC0/AC2) (type 3state)) |
|
156 | 156 | (pin (num 5) (name PA1/ADC1/AC1) (type 3state)) |
|
157 | 157 | (pin (num 6) (name PA0/ADC0/AC0/AREF) (type 3state)) |
|
158 | 158 | (pin (num 7) (name PDIDATA) (type power_in)) |
|
159 | 159 | (pin (num 8) (name RESET/PDICLK) (type power_in)) |
|
160 | 160 | (pin (num 9) (name PC7/OC4D/TXD0/MOSI) (type power_in)) |
|
161 | 161 | (pin (num 10) (name PC6/OC4C/RXD0/MISO) (type power_in)) |
|
162 | 162 | (pin (num 11) (name PC5/OC4B/OC5B/XCK0/SCK) (type power_in)) |
|
163 | 163 | (pin (num 12) (name PC4/OC4A/OC5A/SS) (type power_in)) |
|
164 | 164 | (pin (num 13) (name PC3/OC4D/TXD0) (type power_in)) |
|
165 | 165 | (pin (num 14) (name PC2/OC4C/RXD0) (type power_in)) |
|
166 | 166 | (pin (num 15) (name PC1/OC4B/XCK0/SCL) (type power_in)) |
|
167 | 167 | (pin (num 16) (name PC0/OC4A/SDA) (type power_in)) |
|
168 | 168 | (pin (num 17) (name VCC) (type power_in)) |
|
169 | 169 | (pin (num 18) (name GND) (type power_in)) |
|
170 | 170 | (pin (num 19) (name PR1/XTAL1/TOSC1) (type power_in)) |
|
171 | 171 | (pin (num 20) (name PR0/XTAL2/TOSC2) (type power_in)) |
|
172 | 172 | (pin (num 21) (name PD7/ADC15/TXD0) (type power_in)) |
|
173 | 173 | (pin (num 22) (name PD6/ADC14/RXD0) (type power_in)) |
|
174 | 174 | (pin (num 23) (name PD5/ADC13/OC5B/XCK0) (type power_in)) |
|
175 | 175 | (pin (num 24) (name PD4/ADC12/OC5A) (type power_in)) |
|
176 | 176 | (pin (num 25) (name PD3/ADC11/TXD0) (type power_in)) |
|
177 | 177 | (pin (num 26) (name PD2/ADC10/RXD0) (type power_in)) |
|
178 | 178 | (pin (num 27) (name PD1/ADC9/XCK0/SCL) (type power_in)) |
|
179 | 179 | (pin (num 28) (name PD0/ADC8/SDA/AREF) (type power_in)) |
|
180 | 180 | (pin (num 29) (name PA7/ADC7/AC7) (type power_in)) |
|
181 | 181 | (pin (num 30) (name PA6/ADC6/AC6) (type power_in)) |
|
182 | 182 | (pin (num 31) (name PA5/ADC5/AC5) (type 3state)) |
|
183 | 183 | (pin (num 32) (name AVCC) (type power_in)))) |
|
184 | 184 | (libpart (lib guan) (part MIC5205) |
|
185 | 185 | (fields |
|
186 | 186 | (field (name Reference) U) |
|
187 | 187 | (field (name Value) MIC5205)) |
|
188 | 188 | (pins |
|
189 | 189 | (pin (num 1) (name VIN) (type power_in)) |
|
190 | 190 | (pin (num 2) (name GND) (type power_in)) |
|
191 | 191 | (pin (num 3) (name EN) (type input)) |
|
192 | 192 | (pin (num 4) (name BYP) (type power_out)) |
|
193 | 193 | (pin (num 5) (name VOUT) (type power_out)))) |
|
194 | 194 | (libpart (lib device) (part C) |
|
195 | 195 | (description "Condensateur non polarise") |
|
196 | 196 | (footprints |
|
197 | 197 | (fp SM*) |
|
198 | 198 | (fp C?) |
|
199 | 199 | (fp C1-1)) |
|
200 | 200 | (fields |
|
201 | 201 | (field (name Reference) C) |
|
202 | 202 | (field (name Value) C)) |
|
203 | 203 | (pins |
|
204 | 204 | (pin (num 1) (name ~) (type passive)) |
|
205 | 205 | (pin (num 2) (name ~) (type passive)))) |
|
206 | 206 | (libpart (lib device) (part INDUCTOR) |
|
207 | 207 | (fields |
|
208 | 208 | (field (name Reference) L) |
|
209 | 209 | (field (name Value) INDUCTOR)) |
|
210 | 210 | (pins |
|
211 | 211 | (pin (num 1) (name 1) (type passive)) |
|
212 | 212 | (pin (num 2) (name 2) (type passive)))) |
|
213 | 213 | (libpart (lib device) (part LED) |
|
214 | 214 | (footprints |
|
215 | 215 | (fp LED-3MM) |
|
216 | 216 | (fp LED-5MM) |
|
217 | 217 | (fp LED-10MM) |
|
218 | 218 | (fp LED-0603) |
|
219 | 219 | (fp LED-0805) |
|
220 | 220 | (fp LED-1206) |
|
221 | 221 | (fp LEDV)) |
|
222 | 222 | (fields |
|
223 | 223 | (field (name Reference) D) |
|
224 | 224 | (field (name Value) LED)) |
|
225 | 225 | (pins |
|
226 | 226 | (pin (num 1) (name A) (type passive)) |
|
227 | 227 | (pin (num 2) (name K) (type passive)))) |
|
228 | 228 | (libpart (lib device) (part R) |
|
229 | 229 | (description Resistance) |
|
230 | 230 | (footprints |
|
231 | 231 | (fp R?) |
|
232 | 232 | (fp SM0603) |
|
233 | 233 | (fp SM0805) |
|
234 | 234 | (fp R?-*) |
|
235 | 235 | (fp SM1206)) |
|
236 | 236 | (fields |
|
237 | 237 | (field (name Reference) R) |
|
238 | 238 | (field (name Value) R)) |
|
239 | 239 | (pins |
|
240 | 240 | (pin (num 1) (name ~) (type passive)) |
|
241 | 241 | (pin (num 2) (name ~) (type passive)))) |
|
242 | 242 | (libpart (lib conn) (part CONN_1) |
|
243 | 243 | (description "1 pin") |
|
244 | 244 | (fields |
|
245 | 245 | (field (name Reference) P) |
|
246 | 246 | (field (name Value) CONN_1)) |
|
247 | 247 | (pins |
|
248 | 248 | (pin (num 1) (name 1) (type passive)))) |
|
249 | 249 | (libpart (lib conn) (part CONN_2) |
|
250 | 250 | (description "Symbole general de connecteur") |
|
251 | 251 | (fields |
|
252 | 252 | (field (name Reference) P) |
|
253 | 253 | (field (name Value) CONN_2)) |
|
254 | 254 | (pins |
|
255 | 255 | (pin (num 1) (name P1) (type passive)) |
|
256 | 256 | (pin (num 2) (name PM) (type passive)))) |
|
257 | 257 | (libpart (lib conn) (part CONN_3X2) |
|
258 | 258 | (description "Symbole general de connecteur") |
|
259 | 259 | (fields |
|
260 | 260 | (field (name Reference) P) |
|
261 | 261 | (field (name Value) CONN_3X2)) |
|
262 | 262 | (pins |
|
263 | 263 | (pin (num 1) (name 1) (type passive)) |
|
264 | 264 | (pin (num 2) (name 2) (type passive)) |
|
265 | 265 | (pin (num 3) (name 3) (type passive)) |
|
266 | 266 | (pin (num 4) (name 4) (type passive)) |
|
267 | 267 | (pin (num 5) (name 5) (type passive)) |
|
268 | 268 | (pin (num 6) (name 6) (type passive))))) |
|
269 | 269 | (libraries |
|
270 | 270 | (library (logical guan) |
|
271 | 271 | (uri /home/guan/boards/guan.lib)) |
|
272 | 272 | (library (logical device) |
|
273 | 273 | (uri /usr/share/kicad/library/device.lib)) |
|
274 | 274 | (library (logical conn) |
|
275 | 275 | (uri /usr/share/kicad/library/conn.lib))) |
|
276 | 276 | (nets |
|
277 | 277 | (net (code 1) (name "") |
|
278 | 278 | (node (ref P4) (pin 1))) |
|
279 | 279 | (net (code 2) (name "") |
|
280 | 280 | (node (ref P5) (pin 1))) |
|
281 | 281 | (net (code 3) (name "") |
|
282 | 282 | (node (ref P6) (pin 1))) |
|
283 | 283 | (net (code 4) (name "") |
|
284 | 284 | (node (ref P7) (pin 1))) |
|
285 | 285 | (net (code 5) (name /LED2) |
|
286 | 286 | (node (ref R2) (pin 2)) |
|
287 | 287 | (node (ref IC2) (pin 3))) |
|
288 | 288 | (net (code 6) (name /LED1) |
|
289 | 289 | (node (ref IC2) (pin 6)) |
|
290 | 290 | (node (ref R1) (pin 2))) |
|
291 | 291 | (net (code 7) (name "") |
|
292 | 292 | (node (ref IC2) (pin 21))) |
|
293 | 293 | (net (code 8) (name "") |
|
294 | 294 | (node (ref IC2) (pin 20))) |
|
295 | 295 | (net (code 9) (name "") |
|
296 | 296 | (node (ref IC2) (pin 23))) |
|
297 | 297 | (net (code 10) (name "") |
|
298 | 298 | (node (ref IC2) (pin 16))) |
|
299 | 299 | (net (code 11) (name "") |
|
300 | 300 | (node (ref P1) (pin 4))) |
|
301 | 301 | (net (code 12) (name "") |
|
302 | 302 | (node (ref P1) (pin 3))) |
|
303 | 303 | (net (code 13) (name /PDIDATA) |
|
304 | 304 | (node (ref IC2) (pin 7)) |
|
305 | 305 | (node (ref P1) (pin 1))) |
|
306 | 306 | (net (code 14) (name /PDICLK) |
|
307 | 307 | (node (ref IC2) (pin 8)) |
|
308 | 308 | (node (ref P1) (pin 5))) |
|
309 | 309 | (net (code 15) (name "") |
|
310 | 310 | (node (ref C4) (pin 1)) |
|
311 | 311 | (node (ref U2) (pin 4))) |
|
312 | 312 | (net (code 16) (name GND) |
|
313 | 313 | (node (ref D1) (pin 2)) |
|
314 | 314 | (node (ref C1) (pin 2)) |
|
315 | 315 | (node (ref IC1) (pin 1)) |
|
316 | 316 | (node (ref U1) (pin 2)) |
|
317 | 317 | (node (ref IC2) (pin 1)) |
|
318 | 318 | (node (ref C3) (pin 2)) |
|
319 | 319 | (node (ref P1) (pin 6)) |
|
320 | 320 | (node (ref IC2) (pin 18)) |
|
321 | 321 | (node (ref D2) (pin 2)) |
|
322 | 322 | (node (ref C2) (pin 1)) |
|
323 | 323 | (node (ref C4) (pin 2)) |
|
324 | 324 | (node (ref U2) (pin 2)) |
|
325 | 325 | (node (ref C5) (pin 2)) |
|
326 | 326 | (node (ref P3) (pin 2)) |
|
327 | 327 | (node (ref C6) (pin 1))) |
|
328 | 328 | (net (code 17) (name /VOUT) |
|
329 | 329 | (node (ref L1) (pin 1)) |
|
330 | 330 | (node (ref U2) (pin 5))) |
|
331 | 331 | (net (code 18) (name VCC) |
|
332 | 332 | (node (ref C3) (pin 1)) |
|
333 | 333 | (node (ref C2) (pin 2)) |
|
334 | 334 | (node (ref L1) (pin 2)) |
|
335 | 335 | (node (ref C1) (pin 1)) |
|
336 | 336 | (node (ref P1) (pin 2)) |
|
337 | 337 | (node (ref IC2) (pin 32)) |
|
338 | 338 | (node (ref C5) (pin 1)) |
|
339 | 339 | (node (ref IC1) (pin 2)) |
|
340 | 340 | (node (ref IC2) (pin 17))) |
|
341 | 341 | (net (code 19) (name /VIN) |
|
342 | 342 | (node (ref U2) (pin 1)) |
|
343 | 343 | (node (ref U2) (pin 3)) |
|
344 | 344 | (node (ref C6) (pin 2)) |
|
345 | 345 | (node (ref P3) (pin 1))) |
|
346 | 346 | (net (code 20) (name "") |
|
347 | 347 | (node (ref IC2) (pin 22))) |
|
348 | 348 | (net (code 21) (name "") |
|
349 | 349 | (node (ref IC2) (pin 19))) |
|
350 | 350 | (net (code 22) (name /RELAY) |
|
351 | 351 | (node (ref IC2) (pin 24)) |
|
352 | 352 | (node (ref R3) (pin 1))) |
|
353 | 353 | (net (code 23) (name /OUT1) |
|
354 | 354 | (node (ref P2) (pin 1)) |
|
355 | 355 | (node (ref U1) (pin 6))) |
|
356 | 356 | (net (code 24) (name /OUT2) |
|
357 | 357 | (node (ref P2) (pin 2)) |
|
358 | 358 | (node (ref U1) (pin 4))) |
|
359 | 359 | (net (code 25) (name /CSN) |
|
360 | 360 | (node (ref IC2) (pin 12)) |
|
361 | 361 | (node (ref IC1) (pin 4))) |
|
362 | 362 | (net (code 26) (name /IRQ) |
|
363 | 363 | (node (ref IC2) (pin 14)) |
|
364 | 364 | (node (ref IC1) (pin 8))) |
|
365 | 365 | (net (code 27) (name /MISO) |
|
366 | 366 | (node (ref IC2) (pin 10)) |
|
367 | 367 | (node (ref IC1) (pin 7))) |
|
368 | 368 | (net (code 28) (name /MOSI) |
|
369 | 369 | (node (ref IC1) (pin 6)) |
|
370 | 370 | (node (ref IC2) (pin 9))) |
|
371 | 371 | (net (code 29) (name /SCK) |
|
372 | 372 | (node (ref IC2) (pin 11)) |
|
373 | 373 | (node (ref IC1) (pin 5))) |
|
374 | 374 | (net (code 30) (name /CE) |
|
375 | 375 | (node (ref IC2) (pin 13)) |
|
376 | 376 | (node (ref IC1) (pin 3))) |
|
377 | 377 | (net (code 31) (name "") |
|
378 | 378 | (node (ref R3) (pin 2)) |
|
379 | 379 | (node (ref U1) (pin 1))) |
|
380 | 380 | (net (code 32) (name "") |
|
381 | 381 | (node (ref D1) (pin 1)) |
|
382 | 382 | (node (ref R2) (pin 1))) |
|
383 | 383 | (net (code 33) (name "") |
|
384 | 384 | (node (ref D2) (pin 1)) |
|
385 | 385 | (node (ref R1) (pin 1))) |
|
386 | 386 | (net (code 34) (name "") |
|
387 | 387 | (node (ref IC2) (pin 25))) |
|
388 | 388 | (net (code 35) (name "") |
|
389 | 389 | (node (ref IC2) (pin 26))) |
|
390 | 390 | (net (code 36) (name "") |
|
391 | 391 | (node (ref IC2) (pin 27))) |
|
392 | 392 | (net (code 37) (name "") |
|
393 | 393 | (node (ref IC2) (pin 28))) |
|
394 | 394 | (net (code 38) (name "") |
|
395 | 395 | (node (ref IC2) (pin 29))) |
|
396 | 396 | (net (code 39) (name "") |
|
397 | 397 | (node (ref IC2) (pin 15))) |
|
398 | 398 | (net (code 40) (name "") |
|
399 | 399 | (node (ref IC2) (pin 2))) |
|
400 | 400 | (net (code 41) (name "") |
|
401 | 401 | (node (ref IC2) (pin 4))) |
|
402 | 402 | (net (code 42) (name "") |
|
403 | 403 | (node (ref IC2) (pin 5))) |
|
404 | 404 | (net (code 43) (name "") |
|
405 | 405 | (node (ref IC2) (pin 30))) |
|
406 | 406 | (net (code 44) (name "") |
|
407 | 407 | (node (ref IC2) (pin 31))) |
|
408 | 408 | (net (code 45) (name "") |
|
409 | 409 | (node (ref U1) (pin 3))) |
|
410 | 410 | (net (code 46) (name "") |
|
411 | (node (ref U1) (pin 5))))) No newline at end of file | |
|
411 | (node (ref U1) (pin 5))))) |
General Comments 0
You need to be logged in to leave comments.
Login now