summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhant Ranade2015-10-14 13:13:46 +0530
committerSiddhant Ranade2015-10-14 13:13:46 +0530
commitc7899295229437b4fec523157ea6e8f9c4e8d68b (patch)
treed3fa83873d4e638a0dcf543b4f6644aa8c495445
parent870400289effc021c83632d3df8b0a367ad1583a (diff)
downloadPspice-Kicad-Converter-c7899295229437b4fec523157ea6e8f9c4e8d68b.tar.gz
Pspice-Kicad-Converter-c7899295229437b4fec523157ea6e8f9c4e8d68b.tar.bz2
Pspice-Kicad-Converter-c7899295229437b4fec523157ea6e8f9c4e8d68b.zip
Removed date shell commands.
-rw-r--r--lib/misc.cpp52
-rw-r--r--lib/misc.h4
-rw-r--r--libParser.cpp9
-rw-r--r--parser.cpp19
4 files changed, 5 insertions, 79 deletions
diff --git a/lib/misc.cpp b/lib/misc.cpp
index bbe8a18..a5921bf 100644
--- a/lib/misc.cpp
+++ b/lib/misc.cpp
@@ -24,33 +24,6 @@ string exec(const char* cmd) { //Function to execute a shell command.
return result;
}
-string readDate(string line){
- int n=line.find(';');
- string datetemp=line.substr(n+1, 10);
- string cmd;
- cmd="date --date=\'@"+datetemp+"\' +\"%A %d %B %Y %I:%M:%S %p %Z\"";
- string ret=exec(cmd.c_str());
- ret=ret.substr(0, ret.length()-1); //ignore the last character, which is \n
- return ret;
-}
-
-string readDate(){
- string cmd="date +\"%A %d %B %Y %I:%M:%S %p %Z\"";
- string ret=exec(cmd.c_str());
- ret=ret.substr(0, ret.length()-1); //ignore the last character, which is \n
- return ret;
-}
-
-string readShortDate(string line){
- int n=line.find(';');
- string datetemp=line.substr(n+1, 10);
- string cmd;
- cmd="date --date=\'@"+datetemp+"\' +\"%d %b %Y\"";
- string ret=exec(cmd.c_str());
- ret=ret.substr(0, ret.length()-1); //ignore the last character, which is \n
- return ret;
-}
-
string skipTo(istream& input, string s){ /*Find the line containing the
first occurence (after the current position) of string s in istream& in and read it and then return it*/
string tmp="";
@@ -66,31 +39,6 @@ first occurence (after the current position) of string s in istream& in and read
return tmp;
}
-string findLibrary(string &s){ //Returns the filename of the Pspice library that contains the description of the component whose name is the string s
- string cmd="grep -w ^\"*symbol "+s+"\" lib/Library/*";
- string ret=exec(cmd.c_str());
- ///cout<<"***"<<ret<<"***"<<endl; ///DEBUG
- if(ret==""){
- cmd="grep -i -w ^\"*symbol "+s+"\" lib/Library/*";
- ret=exec(cmd.c_str());
- ///cout<<"***"<<ret<<endl; ///DEBUG
- }
-
- int a=ret.find(' ');
- string name=ret.substr(a, ret.npos);
- stringstream ss; ss.str(name); ss>>s;
-
- for(int i=0; i<REMOVEDCOMPONENTS.size(); i++){ //Don't let these components be created.
- if(s==REMOVEDCOMPONENTS[i]) return "";
- }
-
- int n=ret.find(':');
- ret=ret.substr(0, n); //return the name of the first found library
- ///cerr<<ret<<endl; ///DEBUG
- if(ret=="lib/Library/marker.slb") return ""; //Don't want any markers to appear in the KiCad schematic.
- return ret;
-}
-
string itos(int n){
stringstream ss;
ss<<n;
diff --git a/lib/misc.h b/lib/misc.h
index 650523d..1fed1e6 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -14,10 +14,6 @@ See LICENSE.txt
//#include "component.h"
//#include "component_instance.h"
-string findLibrary(string& s);
-string readDate(string);
-string readDate();
-string readShortDate(string);
string skipTo(istream&, string);
string exec(const char*);
string itos(int);
diff --git a/libParser.cpp b/libParser.cpp
index 017ad61..01f1cfb 100644
--- a/libParser.cpp
+++ b/libParser.cpp
@@ -8,7 +8,7 @@ See LICENSE.txt
#include "lib/header.h"
-string libDescr="EESchema-LIBRARY Version 2.3 Date: %s\n#encoding utf-8\n";
+string libDescr="EESchema-LIBRARY Version 2.3 Date: \n#encoding utf-8\n";
ofstream flib;
@@ -36,14 +36,9 @@ int main(int argc, char* argv[]){
cerr<<"Library file name: "<<flname<<endl;
- //Get the current date
- string date = readDate();
-
//Write .lib header:
- d=libDescr.find("%s");
- string libDescription=libDescr.replace(d, 2, date);
- flib<<libDescription;
+ flib<<libDescr;
string line=skipTo(file, "*symbol");
while(line!="ERROR"){
diff --git a/parser.cpp b/parser.cpp
index f849822..9ca99cc 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -8,8 +8,8 @@ See LICENSE.txt
#include "lib/header.h"
-string 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\nLIBS:%name\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";
-string proDescr="update=%s\nlast_client=eeschema\n[eeschema]\nversion=1\nLibDir=\nNetFmt=1\nHPGLSpd=20\nHPGLDm=15\nHPGLNum=1\noffX_A4=0\noffY_A4=0\noffX_A3=0\noffY_A3=0\noffX_A2=0\noffY_A2=0\noffX_A1=0\noffY_A1=0\noffX_A0=0\noffY_A0=0\noffX_A=0\noffY_A=0\noffX_B=0\noffY_B=0\noffX_C=0\noffY_C=0\noffX_D=0\noffY_D=0\noffX_E=0\noffY_E=0\nRptD_X=0\nRptD_Y=100\nRptLab=1\nLabSize=60\n[eeschema/libraries]\nLibName1=power\nLibName2=device\nLibName3=transistors\nLibName4=conn\nLibName5=linear\nLibName6=regul\nLibName7=74xx\nLibName8=cmos4000\nLibName9=adc-dac\nLibName10=memory\nLibName11=xilinx\nLibName12=special\nLibName13=microcontrollers\nLibName14=dsp\nLibName15=microchip\nLibName16=analog_switches\nLibName17=motorola\nLibName18=texas\nLibName19=intel\nLibName20=audio\nLibName21=interface\nLibName22=digital-audio\nLibName23=philips\nLibName24=display\nLibName25=cypress\nLibName26=siliconi\nLibName27=opto\nLibName28=atmel\nLibName29=contrib\nLibName30=valves";
+string descr="EESchema Schematic File Version 2 date \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 \"\"\nRev \"\"\nComp \"\"\nComment1 \"\"\nComment2 \"\"\nComment3 \"\"\nComment4 \"\"\n$EndDescr\n";
+string proDescr="update= \nlast_client=eeschema\n[eeschema]\nversion=1\nLibDir=\nNetFmt=1\nHPGLSpd=20\nHPGLDm=15\nHPGLNum=1\noffX_A4=0\noffY_A4=0\noffX_A3=0\noffY_A3=0\noffX_A2=0\noffY_A2=0\noffX_A1=0\noffY_A1=0\noffX_A0=0\noffY_A0=0\noffX_A=0\noffY_A=0\noffX_B=0\noffY_B=0\noffX_C=0\noffY_C=0\noffX_D=0\noffY_D=0\noffX_E=0\noffY_E=0\nRptD_X=0\nRptD_Y=100\nRptLab=1\nLabSize=60\n[eeschema/libraries]\nLibName1=power\nLibName2=device\nLibName3=transistors\nLibName4=conn\nLibName5=linear\nLibName6=regul\nLibName7=74xx\nLibName8=cmos4000\nLibName9=adc-dac\nLibName10=memory\nLibName11=xilinx\nLibName12=special\nLibName13=microcontrollers\nLibName14=dsp\nLibName15=microchip\nLibName16=analog_switches\nLibName17=motorola\nLibName18=texas\nLibName19=intel\nLibName20=audio\nLibName21=interface\nLibName22=digital-audio\nLibName23=philips\nLibName24=display\nLibName25=cypress\nLibName26=siliconi\nLibName27=opto\nLibName28=atmel\nLibName29=contrib\nLibName30=valves";
ofstream fsch;
const int MULT=10; //Pspice coordinates are too small. They need to be scaled up 10 times to be usable in kicad.
@@ -43,9 +43,6 @@ int main(int argc, char* argv[]){
skipTo(file, "@status");
getline(file, textline);
///cerr<<textline<<endl;
- //Get the date from the Pspice schematic
- string date=readDate(textline);
- string shortDate=readShortDate(textline);
//Write the .proj file:
ofstream fproj(fprojname.c_str());
@@ -54,21 +51,11 @@ int main(int argc, char* argv[]){
//Write the .pro file:
ofstream fpro(fproname.c_str());
- int d=proDescr.find("%s");
- proDescr=proDescr.replace(d, 2, date);
fpro<<proDescr<<endl;
fpro.close();
//Write schematic file header:
- d=descr.find("%s");
- string description=descr.replace(d, 2, date);
- d=descr.find("%s");
- description=descr.replace(d, 2, shortDate);
-
- d=descr.find("%name");
- description=descr.replace(d, 5, string(argv[2])+string("-cache"));
-
- fsch<<description;
+ fsch<<descr;
//Ports
skipTo(file, "@ports");