summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/prg/nltool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/prg/nltool.cpp')
-rw-r--r--src/lib/netlist/prg/nltool.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index fbfa3a50c5c..086fe517a2f 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -181,7 +181,7 @@ protected:
void vlog(const plib::plog_level &l, const pstring &ls) const override
{
- pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.cstr());
+ pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.c_str());
pout("{}", err);
if (l == plib::plog_level::FATAL)
throw netlist::nl_exception(err);
@@ -199,7 +199,7 @@ void usage(tool_options_t &opts)
{
pout("{}\n", opts.help(
"nltool serves as the Swiss Army knife to run, test and convert netlists.",
- "nltool [options]").cstr());
+ "nltool [options]").c_str());
}
struct input_t
@@ -214,7 +214,7 @@ struct input_t
{
char buf[400];
double t;
- int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value);
+ int e = sscanf(line.c_str(), "%lf,%[^,],%lf", &t, buf, &m_value);
if ( e!= 3)
throw netlist::nl_exception(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
m_time = netlist::netlist_time::from_double(t);
@@ -346,7 +346,7 @@ static void listdevices(tool_options_t &opts)
if (opts.opt_quiet())
nt.log().warning.set_enabled(false);
- netlist::factory_list_t &list = nt.setup().factory();
+ netlist::factory::list_t &list = nt.setup().factory();
nt.setup().register_source(plib::make_unique_base<netlist::source_t,
netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy));
@@ -363,6 +363,7 @@ static void listdevices(tool_options_t &opts)
pstring out = plib::pfmt("{1} {2}(<id>")(f->classname(),"-20")(f->name());
std::vector<pstring> terms;
+ f->macro_actions(nt.setup().netlist(), f->name() + "_lc");
auto d = f->Create(nt.setup().netlist(), f->name() + "_lc");
// get the list of terminals ...
@@ -381,10 +382,12 @@ static void listdevices(tool_options_t &opts)
if (t.first.startsWith(d->name()))
{
pstring tn(t.first.substr(d->name().len()+1));
+ //printf("\t%s %s %s\n", t.first.c_str(), t.second.c_str(), tn.c_str());
if (tn.find(".") == tn.end())
{
terms.push_back(tn);
pstring resolved = nt.setup().resolve_alias(t.first);
+ //printf("\t%s %s %s\n", t.first.c_str(), t.second.c_str(), resolved.c_str());
if (resolved != t.first)
{
auto found = std::find(terms.begin(), terms.end(), resolved.substr(d->name().len()+1));
@@ -395,27 +398,22 @@ static void listdevices(tool_options_t &opts)
}
}
- if (f->param_desc().startsWith("+"))
+ out += "," + f->param_desc();
+ for (auto p : plib::pstring_vector_t(f->param_desc(),",") )
{
- out += "," + f->param_desc().substr(1);
- terms.clear();
- }
- else if (f->param_desc() == "-")
- {
- /* no params at all */
- }
- else
- {
- out += "," + f->param_desc();
+ if (p.startsWith("+"))
+ {
+ plib::container::remove(terms, p.substr(1));
+ }
}
out += ")";
- printf("%s\n", out.cstr());
+ printf("%s\n", out.c_str());
if (terms.size() > 0)
{
pstring t = "";
for (auto & j : terms)
t += "," + j;
- printf("Terminals: %s\n", t.substr(1).cstr());
+ printf("\tTerminals: %s\n", t.substr(1).c_str());
}
devs.push_back(std::move(d));
}
@@ -514,11 +512,11 @@ int main(int argc, char *argv[])
result = c.result();
}
/* present result */
- pout_strm.write(result.cstr());
+ pout_strm.write(result.c_str());
}
else
{
- perr("Unknown command {}\n", cmd.cstr());
+ perr("Unknown command {}\n", cmd.c_str());
usage(opts);
return 1;
}