-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (49 loc) · 1.42 KB
/
main.cpp
File metadata and controls
59 lines (49 loc) · 1.42 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <QFile>
#include <QFileInfo>
#include <unistd.h>
#include "VCDParser.h"
int main(int argc, char *argv[])
{
#ifdef TEST_MODE
QString in_file = "";
QString out_file = "/media/arails/arails/sim_data/Plugins/SPICEplugin/rsrc/out.h5";
#else
if (argc < 3)
{
std::cout << ".===================================== \n"
<< "| Analograils Copyright 2005-2011\n"
<< "| Failure to receive input stream. \n"
<< ".====================================="
<< std::endl;
exit(0);
}
/* argv[1] the input file path
argv[2] the output file path*/
QString in_file (argv[1]);
QString out_file(argv[2]);
int cnt = 0;
while (!QFile::exists(in_file))
{
sleep(1);
if ( ++cnt == 30) // 5 seconds
{
std::cout << ".=====================================\n"
<< "| Analograils Copyright 2005-2011 \n"
<< "| Time-out error \n"
<< ".====================================="
<< std::endl;
exit(0);
}
}
#endif
/* acquire the stream */
QFile * in_stream = new QFile(in_file);
in_stream->open(QIODevice::ReadOnly);
/* give it to an msim parser */
VCDParser p(in_stream);
p.execute(out_file);
exit(0);
}