diff options
Diffstat (limited to 'src/lib/netlist/prg/nltool.cpp')
-rw-r--r-- | src/lib/netlist/prg/nltool.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index ed96b517192..302f1d12184 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -9,6 +9,7 @@ ****************************************************************************/ #include <cstdio> +#include <cstdlib> #ifdef PSTANDALONE #if (PSTANDALONE) @@ -16,7 +17,7 @@ #endif #endif -#include <plib/poptions.h> +#include "plib/poptions.h" #include "plib/pstring.h" #include "plib/plists.h" #include "plib/ptypes.h" @@ -112,11 +113,11 @@ public: { log().debug("Creating dynamic logs ...\n"); plib::pstring_vector_t ll(m_opts ? m_opts->opt_logs() : "" , ":"); - for (unsigned i=0; i < ll.size(); i++) + for (auto & log : ll) { - pstring name = "log_" + ll[i]; + pstring name = "log_" + log; /*netlist_device_t *nc = */ m_setup->register_dev("LOG", name); - m_setup->register_link(name + ".I", ll[i]); + m_setup->register_link(name + ".I", log); } } @@ -161,7 +162,7 @@ struct input_t int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value); if ( e!= 3) throw netlist::fatalerror_e(plib::pfmt("error {1} scanning line {2}\n")(e)(line)); - m_time = netlist::netlist_time::from_double(t); + m_time = netlist::netlist_time(t); m_param = netlist->setup().find_param(buf, true); } @@ -233,16 +234,16 @@ static void run(tool_options_t &opts) t = plib::ticks(); unsigned pos = 0; - netlist::netlist_time nlt = netlist::netlist_time::zero; + netlist::netlist_time nlt = netlist::netlist_time::zero(); - while (pos < inps->size() && (*inps)[pos].m_time < netlist::netlist_time::from_double(ttr)) + while (pos < inps->size() && (*inps)[pos].m_time < netlist::netlist_time(ttr)) { nt.process_queue((*inps)[pos].m_time - nlt); (*inps)[pos].setparam(); nlt = (*inps)[pos].m_time; pos++; } - nt.process_queue(netlist::netlist_time::from_double(ttr) - nlt); + nt.process_queue(netlist::netlist_time(ttr) - nlt); nt.stop(); pfree(inps); @@ -284,18 +285,16 @@ static void listdevices() nt.setup().start_devices(); nt.setup().resolve_inputs(); - for (unsigned i=0; i < list.size(); i++) + for (auto & f : list) { - auto &f = list[i]; pstring out = plib::pfmt("{1} {2}(<id>")(f->classname(),"-20")(f->name()); pstring terms(""); - auto d = f->Create(nt.setup().netlist(), plib::pfmt("dummy{1}")(i)); + auto d = f->Create(nt.setup().netlist(), "dummy"); // get the list of terminals ... - for (unsigned j=0; j < d->m_terminals.size(); j++) + for (auto & inp : d->m_terminals) { - pstring inp = d->m_terminals[j]; if (inp.startsWith(d->name() + ".")) inp = inp.substr(d->name().len() + 1); terms += "," + inp; |