-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (54 loc) · 1.41 KB
/
main.cpp
File metadata and controls
62 lines (54 loc) · 1.41 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
60
61
62
#include <stdio.h>
#include <stdlib.h>
#include <wx/wx.h>
#include "ibis2spice_gui.h"
#include "ibis2spice.h"
void test()
{
const char *ibs_file[] = {
};
static char buf[1024 * 1024 * 16];
for (std::uint32_t i = 0; i < sizeof(ibs_file) / sizeof(ibs_file[0]); i++)
{
std::string subckt;
ibis2spice ibs;
{
FILE *fp = fopen(ibs_file[i], "rb");
if (fp)
{
std::int32_t rlen = fread(buf, 1, sizeof(buf), fp);
buf[rlen] = 0;
fclose(fp);
}
else
{
continue;
}
}
ibs.load(buf);
std::vector<std::string> model_names = ibs.get_model_names();
std::vector<std::string> component_names = ibs.get_component_names();
for (auto& model_name: model_names)
{
subckt += ibs.gen_spice_model_by_model(component_names[0], model_name, "typ");
}
FILE *fp = fopen("test.lib", "wb");
if (fp)
{
fwrite(subckt.c_str(), 1, subckt.length(), fp);
fclose(fp);
}
printf("%s", subckt.c_str());
}
}
class ibis2spice_app: public wxApp
{
public:
virtual bool OnInit()
{
ibis2spice_gui *frame = new ibis2spice_gui();
frame->Show(true);
return true;
}
};
wxIMPLEMENT_APP(ibis2spice_app);