forked from SiddhantRanade/pspice-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.cpp
More file actions
39 lines (30 loc) · 1.39 KB
/
parser.cpp
File metadata and controls
39 lines (30 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "lib/header.h"
#define descr "EESchema Schematic File Version 2 date %s\nLIBS:power\nLIBS:device\nLIBS:transistors\nLIBS:conn\nLIBS:linear\nLIBS:regul\nLIBS:74xx\nLIBS:cmos4000\nLIBS:adc-dac\nLIBS:memory\nLIBS:xilinx\nLIBS:special\nLIBS:microcontrollers\nLIBS:dsp\nLIBS:microchip\nLIBS:analog_switches\nLIBS:motorola\nLIBS:texas\nLIBS:intel\nLIBS:audio\nLIBS:interface\nLIBS:digital-audio\nLIBS:philips\nLIBS:display\nLIBS:cypress\nLIBS:siliconi\nLIBS:opto\nLIBS:atmel\nLIBS:contrib\nLIBS:valves\nEELAYER 25 0\nEELAYER END\n$Descr A4 11700 8267\nencoding utf-8\nSheet 1 1\nTitle \"\"\nDate \"%s\"\nRev \"\"\nComp \"\"\nComment1 \"\"\nComment2 \"\"\nComment3 \"\"\nComment4 \"\"\n$EndDescr\n"
ofstream fsch;
ofstream flib;
int main(int argc, char* argv[]){
ifstream file(argv[1]);
string fname=string(argv[2])+string(".sch");
string flname=string(argv[2])+string("-cache.lib");
fsch.open(fname.c_str());
flib.open(flname.c_str());
cout<<fname<<endl<<flname<<endl;
string textline;
skipTo(file, "@status");
getline(file, textline);
//cout<<textline<<endl;
string date=readDate(textline);
const char* dte= date.c_str();
printf(descr,dte,dte);
skipTo(file, "@conn");
vector<Wire> wires;
parseWire(file, wires);
for(int i=0; i<wires.size(); i++){
wires[i].print(fsch);
}
vector<Connector> conns;
parseConn(file, conns);
for(int i=0; i<conns.size(); i++){
conns[i].print(fsch);
}
}