summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2020-02-17 22:43:24 +0100
committerGravatarGravatar couriersud <couriersud@gmx.org>2020-02-17 22:43:49 +0100
commit92143473341076743ff900a185df3ba8431ecbf0 (patch) (github)
treec60f67f4ded9690d6e533fcfd6e14696c1cf7022
parent3f52d5be2263e757e31abde677494ab1a9876da5 (diff)
downloadmame-92143473341076743ff900a185df3ba8431ecbf0.tar.bz2
mame-92143473341076743ff900a185df3ba8431ecbf0.zip
netlist: fix log file option in nltool. (nw)
-rwxr-xr-x[-rw-r--r--]src/lib/netlist/nl_setup.cpp33
-rw-r--r--src/lib/netlist/nl_setup.h2
-rwxr-xr-xsrc/lib/netlist/plib/palloc.h32
-rw-r--r--src/lib/netlist/prg/nltool.cpp12
4 files changed, 35 insertions, 44 deletions
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 727b37c54c6..9973e6da93d 100644..100755
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -893,7 +893,7 @@ void setup_t::resolve_inputs()
// after all other terminals were connected.
unsigned tries = m_netlist_params->m_max_link_loops();
- while (!m_links.empty() > 0 && tries > 0)
+ while (!m_links.empty() && tries > 0)
{
for (auto li = m_links.begin(); li != m_links.end(); )
@@ -967,22 +967,16 @@ void setup_t::resolve_inputs()
}
-void setup_t::register_dynamic_log_devices()
+void setup_t::register_dynamic_log_devices(const std::vector<pstring> &loglist)
{
- pstring env = plib::util::environment("NL_LOGS", "");
-
- if (env != "")
+ log().debug("Creating dynamic logs ...");
+ for (const pstring &ll : loglist)
{
- log().debug("Creating dynamic logs ...");
- std::vector<pstring> loglist(plib::psplit(env, ":"));
- for (const pstring &ll : loglist)
- {
- pstring name = "log_" + ll;
- auto nc = factory().factory_by_name("LOG")->Create(m_nlstate.pool(), m_nlstate, name);
- register_link(name + ".I", ll);
- log().debug(" dynamic link {1}: <{2}>\n",ll, name);
- m_nlstate.register_device(nc->name(), std::move(nc));
- }
+ pstring name = "log_" + ll;
+ auto nc = factory().factory_by_name("LOG")->Create(m_nlstate.pool(), m_nlstate, name);
+ register_link(name + ".I", ll);
+ log().debug(" dynamic link {1}: <{2}>\n",ll, name);
+ m_nlstate.register_device(nc->name(), std::move(nc));
}
}
@@ -1207,7 +1201,14 @@ void setup_t::delete_empty_nets()
void setup_t::prepare_to_run()
{
- register_dynamic_log_devices();
+ pstring envlog = plib::util::environment("NL_LOGS", "");
+
+ if (envlog != "")
+ {
+ std::vector<pstring> loglist(plib::psplit(envlog, ":"));
+ register_dynamic_log_devices(loglist);
+ }
+
// make sure the solver and parameters are started first!
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 946f271fafa..d5e6249d3aa 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -398,7 +398,7 @@ namespace netlist
// get family
const logic_family_desc_t *family_from_model(const pstring &model);
- void register_dynamic_log_devices();
+ void register_dynamic_log_devices(const std::vector<pstring> &loglist);
void resolve_inputs();
plib::psource_t::stream_ptr get_data_stream(const pstring &name);
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index c7a9f19c1c4..8ffab1dbd1e 100755
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -287,22 +287,22 @@ namespace plib {
if (m_stat_max_alloc() < m_stat_cur_alloc())
m_stat_max_alloc() = m_stat_cur_alloc();
- #if (PUSE_ALIGNED_ALLOCATION)
- #if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
- return _aligned_malloc(size, alignment);
- #elif defined(__APPLE__)
- void* p;
- if (::posix_memalign(&p, alignment, size) != 0) {
- p = nullptr;
- }
- return p;
- #else
- return aligned_alloc(alignment, size);
- #endif
- #else
- unused_var(alignment);
- return ::operator new(size);
- #endif
+ #if (PUSE_ALIGNED_ALLOCATION)
+ #if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)
+ return _aligned_malloc(size, alignment);
+ #elif defined(__APPLE__)
+ void* p;
+ if (::posix_memalign(&p, alignment, size) != 0) {
+ p = nullptr;
+ }
+ return p;
+ #else
+ return aligned_alloc(alignment, size);
+ #endif
+ #else
+ unused_var(alignment);
+ return ::operator new(size);
+ #endif
}
static inline void deallocate( void *ptr, size_t size ) noexcept
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index af1e212439e..09863e1bfbd 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -241,22 +241,12 @@ public:
setup().register_source(plib::make_unique<netlist::source_file_t>(filename));
setup().include(name);
- create_dynamic_logs(logs);
+ setup().register_dynamic_log_devices(logs);
// start devices
setup().prepare_to_run();
}
- void create_dynamic_logs(const std::vector<pstring> &logs)
- {
- log().debug("Creating dynamic logs ...\n");
- for (auto & log : logs)
- {
- pstring name = "log_" + log;
- setup().register_link(name + ".I", log);
- }
- }
-
std::vector<char> save_state()
{
run_state_manager().pre_save();