Changed plist_t to be closer to vector. Commented out tons of inlines

without any impact on performance. (nw)
This commit is contained in:
couriersud 2015-05-26 16:05:53 +02:00
parent 0ef8344574
commit d9448c1e0d
31 changed files with 404 additions and 346 deletions

View File

@ -395,9 +395,9 @@ ATTR_HOT ATTR_ALIGN void netlist_mame_device_t::check_mame_abort_slice()
ATTR_COLD void netlist_mame_device_t::save_state()
{
for (pstate_entry_t * const *p = netlist().save_list().first(); p != NULL; p = netlist().save_list().next(p))
for (int i=0; i< netlist().save_list().size(); i++)
{
pstate_entry_t *s = *p;
pstate_entry_t *s = netlist().save_list()[i];
NL_VERBOSE_OUT(("saving state for %s\n", s->m_name.cstr()));
switch (s->m_dt)
{
@ -464,7 +464,7 @@ void netlist_mame_cpu_device_t::device_start()
state_add(STATE_GENPC, "curpc", m_genPC).noshow();
for (int i=0; i < netlist().m_nets.count(); i++)
for (int i=0; i < netlist().m_nets.size(); i++)
{
netlist_net_t *n = netlist().m_nets[i];
if (n->isFamily(netlist_object_t::LOGIC))
@ -559,10 +559,10 @@ void netlist_mame_sound_device_t::device_start()
// Configure outputs
plist_t<nld_sound_out *> outdevs = netlist().get_device_list<nld_sound_out>();
if (outdevs.count() == 0)
if (outdevs.size() == 0)
fatalerror("No output devices");
m_num_outputs = outdevs.count();
m_num_outputs = outdevs.size();
/* resort channels */
for (int i=0; i < MAX_OUT; i++) m_out[i] = NULL;
@ -572,7 +572,7 @@ void netlist_mame_sound_device_t::device_start()
netlist().log("Output %d on channel %d", i, chan);
if (chan < 0 || chan >= MAX_OUT || chan >= outdevs.count())
if (chan < 0 || chan >= MAX_OUT || chan >= outdevs.size())
fatalerror("illegal channel number");
m_out[chan] = outdevs[i];
m_out[chan]->m_sample = netlist_time::from_hz(clock());
@ -585,9 +585,9 @@ void netlist_mame_sound_device_t::device_start()
m_in = NULL;
plist_t<nld_sound_in *> indevs = netlist().get_device_list<nld_sound_in>();
if (indevs.count() > 1)
if (indevs.size() > 1)
fatalerror("A maximum of one input device is allowed!");
if (indevs.count() == 1)
if (indevs.size() == 1)
{
m_in = indevs[0];
m_num_inputs = m_in->resolve();

View File

@ -144,7 +144,6 @@ NETLIB_UPDATE_TERMINALS(QBJT_switch)
const int new_state = (m_RB.deltaV() * m > m_V ) ? 1 : 0;
if (m_state_on ^ new_state)
{
const nl_double gb = new_state ? m_gB : netlist().gmin();
const nl_double gc = new_state ? m_gC : netlist().gmin();
const nl_double v = new_state ? m_V * m : 0;

View File

@ -142,8 +142,8 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::add_term(int k,
template <int m_N, int _storage_N>
ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(netlist_analog_net_t::list_t &nets)
{
if (m_dim < nets.count())
netlist().error("Dimension %d less than %d", m_dim, nets.count());
if (m_dim < nets.size())
netlist().error("Dimension %d less than %" SIZETFMT, m_dim, nets.size());
for (int k = 0; k < N(); k++)
{
@ -212,7 +212,6 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(netlist_a
template <int m_N, int _storage_N>
ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE_A()
{
for (int k = 0; k < N(); k++)
{
for (int i=0; i < N(); i++)

View File

@ -166,7 +166,7 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non
s = s + nl_math::abs(this->m_A[k][i]);
akk = s / akk - 1.0;
//if ( akk > lambdaN)
// lambdaN = akk;
// lambdaN = akk;
if (akk < lambda1)
lambda1 = akk;
#endif

View File

@ -88,12 +88,12 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
m_nets.clear();
for (int k = 0; k < nets.count(); k++)
for (int k = 0; k < nets.size(); k++)
{
m_nets.add(nets[k]);
}
for (int k = 0; k < nets.count(); k++)
for (int k = 0; k < nets.size(); k++)
{
NL_VERBOSE_OUT(("setting up net\n"));
@ -101,7 +101,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
net->m_solver = this;
for (int i = 0; i < net->m_core_terms.count(); i++)
for (int i = 0; i < net->m_core_terms.size(); i++)
{
netlist_core_terminal_t *p = net->m_core_terms[i];
NL_VERBOSE_OUT(("%s %s %d\n", p->name().cstr(), net->name().cstr(), (int) net->isRailNet()));
@ -134,7 +134,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
case netlist_terminal_t::INPUT:
{
netlist_analog_output_t *net_proxy_output = NULL;
for (int i = 0; i < m_inps.count(); i++)
for (int i = 0; i < m_inps.size(); i++)
if (m_inps[i]->m_proxied_net == &p->net().as_analog())
{
net_proxy_output = m_inps[i];
@ -144,7 +144,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
if (net_proxy_output == NULL)
{
net_proxy_output = palloc(netlist_analog_output_t);
net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%" SIZETFMT, m_inps.size()));
m_inps.add(net_proxy_output);
net_proxy_output->m_proxied_net = &p->net().as_analog();
}
@ -159,7 +159,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
break;
}
}
NL_VERBOSE_OUT(("added net with %d populated connections\n", net->m_core_terms.count()));
NL_VERBOSE_OUT(("added net with %d populated connections\n", net->m_core_terms.size()));
}
}
@ -167,22 +167,22 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets
ATTR_HOT void netlist_matrix_solver_t::update_inputs()
{
// avoid recursive calls. Inputs are updated outside this call
for (netlist_analog_output_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p))
(*p)->set_Q((*p)->m_proxied_net->m_cur_Analog);
for (int i=0; i<m_inps.size(); i++)
m_inps[i]->set_Q(m_inps[i]->m_proxied_net->m_cur_Analog);
}
ATTR_HOT void netlist_matrix_solver_t::update_dynamic()
{
/* update all non-linear devices */
for (netlist_core_device_t * const *p = m_dynamic_devices.first(); p != NULL; p = m_dynamic_devices.next(p))
switch ((*p)->family())
for (int i=0; i < m_dynamic_devices.size(); i++)
switch (m_dynamic_devices[i]->family())
{
case netlist_device_t::DIODE:
static_cast<NETLIB_NAME(D) *>((*p))->update_terminals();
static_cast<NETLIB_NAME(D) *>(m_dynamic_devices[i])->update_terminals();
break;
default:
(*p)->update_terminals();
m_dynamic_devices[i]->update_terminals();
break;
}
}
@ -218,7 +218,7 @@ ATTR_COLD void netlist_matrix_solver_t::update_forced()
ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
{
const nl_double dd = delta.as_double();
for (int k=0; k < m_step_devices.count(); k++)
for (int k=0; k < m_step_devices.size(); k++)
m_step_devices[k]->step_time(dd);
}
@ -281,7 +281,7 @@ ATTR_HOT nl_double netlist_matrix_solver_t::solve()
ATTR_COLD int netlist_matrix_solver_t::get_net_idx(netlist_net_t *net)
{
for (int k = 0; k < m_nets.count(); k++)
for (int k = 0; k < m_nets.size(); k++)
if (m_nets[k] == net)
return k;
return -1;
@ -329,7 +329,7 @@ NETLIB_START(solver)
NETLIB_RESET(solver)
{
for (int i = 0; i < m_mat_solvers.count(); i++)
for (int i = 0; i < m_mat_solvers.size(); i++)
m_mat_solvers[i]->reset();
}
@ -341,20 +341,13 @@ NETLIB_UPDATE_PARAM(solver)
NETLIB_STOP(solver)
{
for (int i = 0; i < m_mat_solvers.count(); i++)
for (int i = 0; i < m_mat_solvers.size(); i++)
m_mat_solvers[i]->log_stats();
}
NETLIB_NAME(solver)::~NETLIB_NAME(solver)()
{
netlist_matrix_solver_t * const *e = m_mat_solvers.first();
while (e != NULL)
{
netlist_matrix_solver_t * const *en = m_mat_solvers.next(e);
pfree(*e);
e = en;
}
m_mat_solvers.clear_and_free();
}
NETLIB_UPDATE(solver)
@ -362,7 +355,7 @@ NETLIB_UPDATE(solver)
if (m_params.m_dynamic)
return;
const int t_cnt = m_mat_solvers.count();
const int t_cnt = m_mat_solvers.size();
#if HAS_OPENMP && USE_OPENMP
if (m_parallel.Value())
@ -471,13 +464,13 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
netlist().log("Scanning net groups ...");
// determine net groups
for (netlist_net_t * const *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
for (int i=0; i<netlist().m_nets.size(); i++)
{
SOLVER_VERBOSE_OUT(("processing %s\n", (*pn)->name().cstr()));
if (!(*pn)->isRailNet())
SOLVER_VERBOSE_OUT(("processing %s\n", netlist().m_nets[i]->name().cstr()));
if (!netlist().m_nets[i]->isRailNet())
{
SOLVER_VERBOSE_OUT((" ==> not a rail net\n"));
netlist_analog_net_t *n = &(*pn)->as_analog();
netlist_analog_net_t *n = &netlist().m_nets[i]->as_analog();
if (!n->already_processed(groups, cur_group))
{
cur_group++;
@ -487,11 +480,11 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
}
// setup the solvers
netlist().log("Found %d net groups in %d nets\n", cur_group + 1, netlist().m_nets.count());
netlist().log("Found %d net groups in %" SIZETFMT " nets\n", cur_group + 1, netlist().m_nets.size());
for (int i = 0; i <= cur_group; i++)
{
netlist_matrix_solver_t *ms;
int net_count = groups[i].count();
int net_count = groups[i].size();
switch (net_count)
{
@ -544,21 +537,21 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
break;
}
register_sub(pstring::sprintf("Solver_%d",m_mat_solvers.count()), *ms);
register_sub(pstring::sprintf("Solver_%" SIZETFMT,m_mat_solvers.size()), *ms);
ms->vsetup(groups[i]);
m_mat_solvers.add(ms);
netlist().log("Solver %s", ms->name().cstr());
netlist().log(" # %d ==> %d nets", i, groups[i].count()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
netlist().log(" # %d ==> %" SIZETFMT " nets", i, groups[i].size()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
netlist().log(" has %s elements", ms->is_dynamic() ? "dynamic" : "no dynamic");
netlist().log(" has %s elements", ms->is_timestep() ? "timestep" : "no timestep");
for (int j=0; j<groups[i].count(); j++)
for (int j=0; j<groups[i].size(); j++)
{
netlist().log("Net %d: %s", j, groups[i][j]->name().cstr());
netlist_net_t *n = groups[i][j];
for (int k = 0; k < n->m_core_terms.count(); k++)
for (int k = 0; k < n->m_core_terms.size(); k++)
{
const netlist_core_terminal_t *p = n->m_core_terms[k];
netlist().log(" %s", p->name().cstr());

View File

@ -62,14 +62,14 @@ class terms_t
ATTR_COLD void add(netlist_terminal_t *term, int net_other);
ATTR_HOT inline int count() { return m_term.count(); }
ATTR_HOT inline int count() { return m_term.size(); }
ATTR_HOT inline netlist_terminal_t **terms() { return m_term; }
ATTR_HOT inline int *net_other() { return m_net_other; }
ATTR_HOT inline nl_double *gt() { return m_gt; }
ATTR_HOT inline nl_double *go() { return m_go; }
ATTR_HOT inline nl_double *Idr() { return m_Idr; }
ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog; }
ATTR_HOT inline netlist_terminal_t **terms() { return m_term.data(); }
ATTR_HOT inline int *net_other() { return m_net_other.data(); }
ATTR_HOT inline nl_double *gt() { return m_gt.data(); }
ATTR_HOT inline nl_double *go() { return m_go.data(); }
ATTR_HOT inline nl_double *Idr() { return m_Idr.data(); }
ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog.data(); }
ATTR_COLD void set_pointers();
@ -106,8 +106,8 @@ public:
ATTR_HOT nl_double solve();
ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; }
ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; }
ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.size() > 0; }
ATTR_HOT inline bool is_timestep() { return m_step_devices.size() > 0; }
ATTR_HOT void update_forced();
ATTR_HOT inline void update_after(const netlist_time after)

View File

@ -108,7 +108,7 @@ NETLIB_START(9312)
register_input("D7", m_D[7]);
register_output("Y", m_Y);
register_output("YQ", m_YQ);
register_output("YQ", m_YQ);
m_last_chan = 0;
m_last_G = 0;

View File

@ -52,7 +52,7 @@ NETLIB_TRUTHTABLE(9312, 12, 2, 0);
NETLIB_DEVICE(9312,
public:
// C, B, A, G,D0,D1,D2,D3,D4,D5,D6,D7| Y,YQ
// C, B, A, G,D0,D1,D2,D3,D4,D5,D6,D7| Y,YQ
netlist_logic_input_t m_A;
netlist_logic_input_t m_B;
netlist_logic_input_t m_C;

View File

@ -80,7 +80,7 @@ NETLIB_START(extclock)
m_off = netlist_time::from_double(m_offset.Value());
int pati[256];
m_size = pat.count();
m_size = pat.size();
int total = 0;
for (int i=0; i<m_size; i++)
{

View File

@ -35,7 +35,7 @@
#define EXTCLOCK(_name, _freq, _pattern) \
NET_REGISTER_DEV(extclock, _name) \
PARAM(_name.FREQ, _freq) \
PARAM(_name.FREQ, _freq) \
PARAM(_name.PATTERN, _pattern)
#define GNDA() \
@ -52,13 +52,11 @@
#define RES_SWITCH(_name, _IN, _P1, _P2) \
NET_REGISTER_DEV(res_sw, _name) \
NET_C(_IN, _name.I) \
NET_C(_P1, _name.1) \
NET_C(_P2, _name.2) \
NET_C(_P1, _name.1) \
NET_C(_P2, _name.2)
/* Default device to hold netlist parameters */
#define PARAMETERS(_name) \
NET_REGISTER_DEV(netlistparams, _name) \
#define PARAMETERS(_name) \
NET_REGISTER_DEV(netlistparams, _name)
// -----------------------------------------------------------------------------
// mainclock
// -----------------------------------------------------------------------------

View File

@ -162,13 +162,13 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled
{
nl_util::pstring_list io = nl_util::split(ttline,"|");
// checks
nl_assert_always(io.count() == 3, "io.count mismatch");
nl_assert_always(io.size() == 3, "io.count mismatch");
nl_util::pstring_list inout = nl_util::split(io[0], ",");
nl_assert_always(inout.count() == m_num_bits, "number of bits not matching");
nl_assert_always(inout.size() == m_num_bits, "number of bits not matching");
nl_util::pstring_list out = nl_util::split(io[1], ",");
nl_assert_always(out.count() == m_NO, "output count not matching");
nl_assert_always(out.size() == m_NO, "output count not matching");
nl_util::pstring_list times = nl_util::split(io[2], ",");
nl_assert_always(times.count() == m_NO, "timing count not matching");
nl_assert_always(times.size() == m_NO, "timing count not matching");
UINT16 val = 0;
parray_t<UINT8> tindex(m_NO);
@ -233,5 +233,3 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled
*m_initialized = true;
}

View File

@ -38,9 +38,9 @@ struct truthtable_desc_t
truthtable_desc_t(int NO, int NI, int has_state, bool *initialized,
UINT32 *outs, UINT8 *timing, netlist_time *timing_nt)
: m_NO(NO), m_NI(NI), /*m_has_state(has_state),*/ m_initialized(initialized),
m_outs(outs), m_timing(timing), m_timing_nt(timing_nt),
m_num_bits(m_NI + has_state * (m_NI + m_NO)),
m_size(1 << (m_num_bits))
m_outs(outs), m_timing(timing), m_timing_nt(timing_nt),
m_num_bits(m_NI + has_state * (m_NI + m_NO)),
m_size(1 << (m_num_bits))
{
}
@ -99,11 +99,11 @@ public:
nl_util::pstring_list io = nl_util::split(ttline,"|");
// checks
nl_assert_always(io.count() == 2, "too many '|'");
nl_assert_always(io.size() == 2, "too many '|'");
nl_util::pstring_list inout = nl_util::split(io[0], ",");
nl_assert_always(inout.count() == m_num_bits, "bitcount wrong");
nl_assert_always(inout.size() == m_num_bits, "bitcount wrong");
nl_util::pstring_list out = nl_util::split(io[1], ",");
nl_assert_always(out.count() == m_NO, "output count wrong");
nl_assert_always(out.size() == m_NO, "output count wrong");
for (int i=0; i < m_NI; i++)
{
@ -163,7 +163,6 @@ public:
template<bool doOUT>
ATTR_HOT inline void process()
{
netlist_time mt = netlist_time::zero;
UINT32 state = 0;

View File

@ -144,7 +144,6 @@ ATTR_COLD netlist_object_t::netlist_object_t(const type_t atype, const family_t
ATTR_COLD netlist_object_t::~netlist_object_t()
{
}
ATTR_COLD void netlist_object_t::init_object(netlist_base_t &nl, const pstring &aname)
@ -198,7 +197,7 @@ netlist_base_t::netlist_base_t()
netlist_base_t::~netlist_base_t()
{
for (int i=0; i < m_nets.count(); i++)
for (int i=0; i < m_nets.size(); i++)
{
if (!m_nets[i]->isRailNet())
{
@ -249,9 +248,9 @@ ATTR_COLD void netlist_base_t::start()
m_use_deactivate = (m_params->m_use_deactivate.Value() ? true : false);
NL_VERBOSE_OUT(("Initializing devices ...\n"));
for (netlist_device_t * const * entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
for (int i = 0; i < m_devices.size(); i++)
{
netlist_device_t *dev = *entry;
netlist_device_t *dev = m_devices[i];
if (dev != m_solver && dev != m_params)
dev->start_dev();
}
@ -265,7 +264,7 @@ ATTR_COLD void netlist_base_t::stop()
NL_VERBOSE_OUT(("Stopping all devices ...\n"));
// Step all devices once !
for (int i = 0; i < m_devices.count(); i++)
for (int i = 0; i < m_devices.size(); i++)
{
m_devices[i]->stop_dev();
}
@ -273,7 +272,7 @@ ATTR_COLD void netlist_base_t::stop()
ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name)
{
for (int i = 0; i < m_nets.count(); i++)
for (int i = 0; i < m_nets.size(); i++)
{
if (m_nets[i]->name() == name)
return m_nets[i];
@ -283,7 +282,7 @@ ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name)
ATTR_COLD void netlist_base_t::rebuild_lists()
{
for (int i = 0; i < m_nets.count(); i++)
for (int i = 0; i < m_nets.size(); i++)
m_nets[i]->rebuild_list();
}
@ -298,24 +297,24 @@ ATTR_COLD void netlist_base_t::reset()
m_solver->do_reset();
// Reset all nets once !
for (int i = 0; i < m_nets.count(); i++)
for (int i = 0; i < m_nets.size(); i++)
m_nets[i]->do_reset();
// Reset all devices once !
for (int i = 0; i < m_devices.count(); i++)
for (int i = 0; i < m_devices.size(); i++)
{
m_devices[i]->do_reset();
}
// Step all devices once !
for (int i = 0; i < m_devices.count(); i++)
for (int i = 0; i < m_devices.size(); i++)
{
m_devices[i]->update_dev();
}
// FIXME: some const devices rely on this
/* make sure params are set now .. */
for (int i = 0; i < m_devices.count(); i++)
for (int i = 0; i < m_devices.size(); i++)
{
m_devices[i]->update_param();
}
@ -628,7 +627,7 @@ ATTR_HOT void netlist_net_t::inc_active(netlist_core_terminal_t &term)
}
}
//else if (netlist().use_deactivate())
// m_cur_Q = m_new_Q;
// m_cur_Q = m_new_Q;
}
}
@ -651,7 +650,7 @@ ATTR_COLD void netlist_net_t::rebuild_list()
/* rebuild m_list */
m_list_active.clear();
for (int i=0; i < m_core_terms.count(); i++)
for (int i=0; i < m_core_terms.size(); i++)
if (m_core_terms[i]->state() != netlist_logic_t::STATE_INP_PASSIVE)
m_list_active.add(*m_core_terms[i]);
}
@ -709,13 +708,13 @@ ATTR_COLD void netlist_net_t::reset()
/* rebuild m_list */
m_list_active.clear();
for (int i=0; i < m_core_terms.count(); i++)
for (int i=0; i < m_core_terms.size(); i++)
m_list_active.add(*m_core_terms[i]);
for (int i=0; i < m_core_terms.count(); i++)
for (int i=0; i < m_core_terms.size(); i++)
m_core_terms[i]->do_reset();
for (int i=0; i < m_core_terms.count(); i++)
for (int i=0; i < m_core_terms.size(); i++)
if (m_core_terms[i]->state() != netlist_logic_t::STATE_INP_PASSIVE)
m_active++;
}
@ -732,7 +731,7 @@ ATTR_COLD void netlist_net_t::register_con(netlist_core_terminal_t &terminal)
ATTR_COLD void netlist_net_t::move_connections(netlist_net_t *dest_net)
{
for (int i = 0; i < m_core_terms.count(); i++)
for (int i = 0; i < m_core_terms.size(); i++)
{
netlist_core_terminal_t *p = m_core_terms[i];
dest_net->register_con(*p);
@ -830,7 +829,7 @@ ATTR_COLD void netlist_analog_net_t::process_net(list_t *groups, int &cur_group)
/* add the net */
//SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, name().cstr()));
groups[cur_group].add(this);
for (int i = 0; i < m_core_terms.count(); i++)
for (int i = 0; i < m_core_terms.size(); i++)
{
netlist_core_terminal_t *p = m_core_terms[i];
//SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr()));

View File

@ -267,7 +267,7 @@ public:
nl_fatalerror(const char *format, va_list ap);
virtual ~nl_fatalerror() throw() {}
inline const pstring &text() { return m_text; }
/* inline */ const pstring &text() { return m_text; }
private:
pstring m_text;
};
@ -329,7 +329,7 @@ public:
netlist_logic_family_t() : m_logic_family(NULL) {}
ATTR_HOT inline const netlist_logic_family_desc_t *logic_family() const { return m_logic_family; }
ATTR_HOT /* inline */ const netlist_logic_family_desc_t *logic_family() const { return m_logic_family; }
ATTR_COLD void set_logic_family(const netlist_logic_family_desc_t *fam) { m_logic_family = fam; }
private:
@ -396,16 +396,16 @@ public:
PSTATE_INTERFACE_DECL()
ATTR_HOT inline type_t type() const { return m_objtype; }
ATTR_HOT inline family_t family() const { return m_family; }
ATTR_HOT /* inline */ type_t type() const { return m_objtype; }
ATTR_HOT /* inline */ family_t family() const { return m_family; }
ATTR_HOT inline bool isType(const type_t atype) const { return (m_objtype == atype); }
ATTR_HOT inline bool isFamily(const family_t afamily) const { return (m_family == afamily); }
ATTR_HOT /* inline */ bool isType(const type_t atype) const { return (m_objtype == atype); }
ATTR_HOT /* inline */ bool isFamily(const family_t afamily) const { return (m_family == afamily); }
ATTR_HOT inline netlist_base_t & netlist() { return *m_netlist; }
ATTR_HOT inline const netlist_base_t & netlist() const { return *m_netlist; }
ATTR_HOT /* inline */ netlist_base_t & netlist() { return *m_netlist; }
ATTR_HOT /* inline */ const netlist_base_t & netlist() const { return *m_netlist; }
ATTR_COLD void inline do_reset()
ATTR_COLD void /* inline */ do_reset()
{
reset();
}
@ -435,7 +435,7 @@ public:
ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
ATTR_HOT inline netlist_core_device_t &netdev() const { return *m_netdev; }
ATTR_HOT /* inline */ netlist_core_device_t &netdev() const { return *m_netdev; }
private:
netlist_core_device_t * m_netdev;
};
@ -468,22 +468,22 @@ public:
//ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
ATTR_COLD void set_net(netlist_net_t &anet);
ATTR_COLD inline void clear_net() { m_net = NULL; }
ATTR_HOT inline bool has_net() const { return (m_net != NULL); }
ATTR_COLD /* inline */ void clear_net() { m_net = NULL; }
ATTR_HOT /* inline */ bool has_net() const { return (m_net != NULL); }
ATTR_HOT inline const netlist_net_t & net() const { return *m_net;}
ATTR_HOT inline netlist_net_t & net() { return *m_net;}
ATTR_HOT /* inline */ const netlist_net_t & net() const { return *m_net;}
ATTR_HOT /* inline */ netlist_net_t & net() { return *m_net;}
ATTR_HOT inline bool is_state(const state_e astate) const { return (m_state == astate); }
ATTR_HOT inline state_e state() const { return m_state; }
ATTR_HOT inline void set_state(const state_e astate)
ATTR_HOT /* inline */ bool is_state(const state_e astate) const { return (m_state == astate); }
ATTR_HOT /* inline */ state_e state() const { return m_state; }
ATTR_HOT /* inline */ void set_state(const state_e astate)
{
nl_assert(astate != STATE_NONEX);
m_state = astate;
}
/* inline, only intended to be called from nl_base.c */
ATTR_HOT inline void update_dev(const UINT32 mask);
/* inline only intended to be called from nl_base.c */
ATTR_HOT /* inline */ void update_dev(const UINT32 mask);
protected:
/* ATTR_COLD */ virtual void save_register()
@ -513,21 +513,21 @@ public:
nl_double *m_go1; // conductance for Voltage from other term
nl_double *m_gt1; // conductance for total conductance
ATTR_HOT inline void set(const nl_double G)
ATTR_HOT /* inline */ void set(const nl_double G)
{
set_ptr(m_Idr1, 0);
set_ptr(m_go1, G);
set_ptr(m_gt1, G);
}
ATTR_HOT inline void set(const nl_double GO, const nl_double GT)
ATTR_HOT /* inline */ void set(const nl_double GO, const nl_double GT)
{
set_ptr(m_Idr1, 0);
set_ptr(m_go1, GO);
set_ptr(m_gt1, GT);
}
ATTR_HOT inline void set(const nl_double GO, const nl_double GT, const nl_double I)
ATTR_HOT /* inline */ void set(const nl_double GO, const nl_double GT, const nl_double I)
{
set_ptr(m_Idr1, I);
set_ptr(m_go1, GO);
@ -544,7 +544,7 @@ protected:
/* ATTR_COLD */ virtual void reset();
private:
ATTR_HOT inline void set_ptr(nl_double *ptr, const nl_double val)
ATTR_HOT /* inline */ void set_ptr(nl_double *ptr, const nl_double val)
{
if (ptr != NULL && *ptr != val)
{
@ -565,7 +565,7 @@ public:
ATTR_COLD netlist_logic_t(const type_t atype)
: netlist_core_terminal_t(atype, LOGIC), netlist_logic_family_t(),
m_proxy(NULL)
m_proxy(NULL)
{
}
@ -607,13 +607,13 @@ public:
set_state(STATE_INP_ACTIVE);
}
ATTR_HOT inline netlist_sig_t Q() const;
ATTR_HOT inline netlist_sig_t last_Q() const;
ATTR_HOT /* inline */ netlist_sig_t Q() const;
ATTR_HOT /* inline */ netlist_sig_t last_Q() const;
ATTR_HOT inline void inactivate();
ATTR_HOT inline void activate();
ATTR_HOT inline void activate_hl();
ATTR_HOT inline void activate_lh();
ATTR_HOT /* inline */ void inactivate();
ATTR_HOT /* inline */ void activate();
ATTR_HOT /* inline */ void activate_hl();
ATTR_HOT /* inline */ void activate_lh();
protected:
/* ATTR_COLD */ virtual void reset()
@ -637,7 +637,7 @@ public:
set_state(STATE_INP_ACTIVE);
}
ATTR_HOT inline nl_double Q_Analog() const;
ATTR_HOT /* inline */ nl_double Q_Analog() const;
protected:
/* ATTR_COLD */ virtual void reset()
@ -667,25 +667,25 @@ public:
ATTR_COLD void merge_net(netlist_net_t *othernet);
ATTR_COLD void register_railterminal(netlist_core_terminal_t &mr);
ATTR_HOT inline netlist_logic_net_t & as_logic();
ATTR_HOT inline const netlist_logic_net_t & as_logic() const;
ATTR_HOT /* inline */ netlist_logic_net_t & as_logic();
ATTR_HOT /* inline */ const netlist_logic_net_t & as_logic() const;
ATTR_HOT inline netlist_analog_net_t & as_analog();
ATTR_HOT inline const netlist_analog_net_t & as_analog() const;
ATTR_HOT /* inline */ netlist_analog_net_t & as_analog();
ATTR_HOT /* inline */ const netlist_analog_net_t & as_analog() const;
ATTR_HOT void update_devs();
ATTR_HOT inline const netlist_time &time() const { return m_time; }
ATTR_HOT inline void set_time(const netlist_time &ntime) { m_time = ntime; }
ATTR_HOT /* inline */ const netlist_time &time() const { return m_time; }
ATTR_HOT /* inline */ void set_time(const netlist_time &ntime) { m_time = ntime; }
ATTR_HOT inline bool isRailNet() const { return !(m_railterminal == NULL); }
ATTR_HOT inline netlist_core_terminal_t & railterminal() const { return *m_railterminal; }
ATTR_HOT /* inline */ bool isRailNet() const { return !(m_railterminal == NULL); }
ATTR_HOT /* inline */ netlist_core_terminal_t & railterminal() const { return *m_railterminal; }
ATTR_HOT inline void push_to_queue(const netlist_time &delay);
ATTR_HOT inline void reschedule_in_queue(const netlist_time &delay);
ATTR_HOT bool inline is_queued() const { return m_in_queue == 1; }
ATTR_HOT /* inline */ void push_to_queue(const netlist_time &delay);
ATTR_HOT /* inline */ void reschedule_in_queue(const netlist_time &delay);
ATTR_HOT bool /* inline */ is_queued() const { return m_in_queue == 1; }
ATTR_HOT inline int num_cons() const { return m_core_terms.count(); }
ATTR_HOT /* inline */ int num_cons() const { return m_core_terms.size(); }
ATTR_HOT void inc_active(netlist_core_terminal_t &term);
ATTR_HOT void dec_active(netlist_core_terminal_t &term);
@ -696,7 +696,7 @@ public:
plist_t<netlist_core_terminal_t *> m_core_terms; // save post-start m_list ...
ATTR_HOT inline void set_Q_time(const netlist_sig_t &newQ, const netlist_time &at)
ATTR_HOT /* inline */ void set_Q_time(const netlist_sig_t &newQ, const netlist_time &at)
{
if (newQ != m_new_Q)
{
@ -741,17 +741,17 @@ public:
ATTR_COLD netlist_logic_net_t();
/* ATTR_COLD */ virtual ~netlist_logic_net_t() { };
ATTR_HOT inline netlist_sig_t Q() const
ATTR_HOT /* inline */ netlist_sig_t Q() const
{
return m_cur_Q;
}
ATTR_HOT inline netlist_sig_t new_Q() const
ATTR_HOT /* inline */ netlist_sig_t new_Q() const
{
return m_new_Q;
}
ATTR_HOT inline void set_Q(const netlist_sig_t &newQ, const netlist_time &delay)
ATTR_HOT /* inline */ void set_Q(const netlist_sig_t &newQ, const netlist_time &delay)
{
if (newQ != m_new_Q)
{
@ -760,7 +760,7 @@ public:
}
}
ATTR_HOT inline void toggle_new_Q()
ATTR_HOT /* inline */ void toggle_new_Q()
{
m_new_Q ^= 1;
}
@ -774,7 +774,7 @@ public:
/* internal state support
* FIXME: get rid of this and implement export/import in MAME
*/
ATTR_COLD inline netlist_sig_t &Q_state_ptr()
ATTR_COLD /* inline */ netlist_sig_t &Q_state_ptr()
{
return m_cur_Q;
}
@ -801,17 +801,17 @@ public:
ATTR_COLD netlist_analog_net_t();
/* ATTR_COLD */ virtual ~netlist_analog_net_t() { };
ATTR_HOT inline nl_double Q_Analog() const
ATTR_HOT /* inline */ nl_double Q_Analog() const
{
return m_cur_Analog;
}
ATTR_COLD inline nl_double &Q_Analog_state_ptr()
ATTR_COLD /* inline */ nl_double &Q_Analog_state_ptr()
{
return m_cur_Analog;
}
ATTR_HOT inline netlist_matrix_solver_t *solver() { return m_solver; }
ATTR_HOT /* inline */ netlist_matrix_solver_t *solver() { return m_solver; }
ATTR_COLD bool already_processed(list_t *groups, int cur_group);
ATTR_COLD void process_net(list_t *groups, int &cur_group);
@ -851,7 +851,7 @@ public:
ATTR_COLD void initial(const netlist_sig_t val);
ATTR_HOT inline void set_Q(const netlist_sig_t newQ, const netlist_time &delay)
ATTR_HOT /* inline */ void set_Q(const netlist_sig_t newQ, const netlist_time &delay)
{
net().as_logic().set_Q(newQ, delay);
}
@ -875,7 +875,7 @@ public:
ATTR_COLD void initial(const nl_double val);
ATTR_HOT inline void set_Q(const nl_double newQ);
ATTR_HOT /* inline */ void set_Q(const nl_double newQ);
netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic
@ -902,7 +902,7 @@ public:
ATTR_COLD netlist_param_t(const param_type_t atype);
ATTR_HOT inline param_type_t param_type() const { return m_param_type; }
ATTR_HOT /* inline */ param_type_t param_type() const { return m_param_type; }
protected:
@ -918,9 +918,9 @@ class netlist_param_double_t : public netlist_param_t
public:
ATTR_COLD netlist_param_double_t();
ATTR_HOT inline void setTo(const nl_double param);
ATTR_COLD inline void initial(const nl_double val) { m_param = val; }
ATTR_HOT inline nl_double Value() const { return m_param; }
ATTR_HOT /* inline */ void setTo(const nl_double param);
ATTR_COLD /* inline */ void initial(const nl_double val) { m_param = val; }
ATTR_HOT /* inline */ nl_double Value() const { return m_param; }
protected:
/* ATTR_COLD */ virtual void save_register()
@ -939,10 +939,10 @@ class netlist_param_int_t : public netlist_param_t
public:
ATTR_COLD netlist_param_int_t();
ATTR_HOT inline void setTo(const int param);
ATTR_COLD inline void initial(const int val) { m_param = val; }
ATTR_HOT /* inline */ void setTo(const int param);
ATTR_COLD /* inline */ void initial(const int val) { m_param = val; }
ATTR_HOT inline int Value() const { return m_param; }
ATTR_HOT /* inline */ int Value() const { return m_param; }
protected:
/* ATTR_COLD */ virtual void save_register()
@ -968,10 +968,10 @@ class netlist_param_str_t : public netlist_param_t
public:
ATTR_COLD netlist_param_str_t();
ATTR_HOT inline void setTo(const pstring &param);
ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
ATTR_HOT /* inline */ void setTo(const pstring &param);
ATTR_COLD /* inline */ void initial(const pstring &val) { m_param = val; }
ATTR_HOT inline const pstring &Value() const { return m_param; }
ATTR_HOT /* inline */ const pstring &Value() const { return m_param; }
private:
pstring m_param;
@ -983,9 +983,9 @@ class netlist_param_model_t : public netlist_param_t
public:
ATTR_COLD netlist_param_model_t();
ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
ATTR_COLD /* inline */ void initial(const pstring &val) { m_param = val; }
ATTR_HOT inline const pstring &Value() const { return m_param; }
ATTR_HOT /* inline */ const pstring &Value() const { return m_param; }
/* these should be cached! */
ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const;
@ -1013,12 +1013,12 @@ public:
/* ATTR_COLD */ virtual void init(netlist_base_t &anetlist, const pstring &name);
ATTR_HOT virtual void update_param() {}
ATTR_HOT inline void update_dev()
ATTR_HOT /* inline */ void update_dev()
{
begin_timing(stat_total_time);
inc_stat(stat_update_count);
#if USE_PMFDELEGATES
#if NO_USE_PMFCONVERSION
#if NO_USE_PMFCONVERSION
(this->*static_update)();
#else
static_update(this);
@ -1033,22 +1033,22 @@ public:
ATTR_HOT netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp);
ATTR_HOT inline netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
ATTR_HOT /* inline */ netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
{
nl_assert(inp.state() != netlist_logic_t::STATE_INP_PASSIVE);
return inp.Q();
}
ATTR_HOT inline void OUTLOGIC(netlist_logic_output_t &out, const netlist_sig_t val, const netlist_time &delay)
ATTR_HOT /* inline */ void OUTLOGIC(netlist_logic_output_t &out, const netlist_sig_t val, const netlist_time &delay)
{
out.set_Q(val, delay);
}
ATTR_HOT inline nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
ATTR_HOT /* inline */ nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
ATTR_HOT inline nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
ATTR_HOT /* inline */ nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
ATTR_HOT /* inline */ void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
{
out.set_Q(val);
}
@ -1167,20 +1167,20 @@ public:
ATTR_COLD void start();
ATTR_COLD void stop();
ATTR_HOT inline const netlist_queue_t &queue() const { return m_queue; }
ATTR_HOT inline netlist_queue_t &queue() { return m_queue; }
ATTR_HOT inline const netlist_time &time() const { return m_time; }
ATTR_HOT inline NETLIB_NAME(solver) *solver() const { return m_solver; }
ATTR_HOT inline NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
ATTR_HOT /* inline */ const netlist_queue_t &queue() const { return m_queue; }
ATTR_HOT /* inline */ netlist_queue_t &queue() { return m_queue; }
ATTR_HOT /* inline */ const netlist_time &time() const { return m_time; }
ATTR_HOT /* inline */ NETLIB_NAME(solver) *solver() const { return m_solver; }
ATTR_HOT /* inline */ NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
ATTR_HOT nl_double gmin() const;
ATTR_HOT void push_to_queue(netlist_net_t &out, const netlist_time &attime);
ATTR_HOT void remove_from_queue(netlist_net_t &out);
ATTR_HOT void process_queue(const netlist_time &delta);
ATTR_HOT inline void abort_current_queue_slice() { m_stop = netlist_time::zero; }
ATTR_HOT /* inline */ void abort_current_queue_slice() { m_stop = netlist_time::zero; }
ATTR_HOT inline const bool &use_deactivate() const { return m_use_deactivate; }
ATTR_HOT /* inline */ const bool &use_deactivate() const { return m_use_deactivate; }
ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */
@ -1197,9 +1197,9 @@ public:
plist_t<_C *> get_device_list()
{
plist_t<_C *> tmp;
for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
for (int i = 0; i < m_devices.size(); i++)
{
_C *dev = dynamic_cast<_C *>(*entry);
_C *dev = dynamic_cast<_C *>(m_devices[i]);
if (dev != NULL)
tmp.add(dev);
}
@ -1209,9 +1209,9 @@ public:
template<class _C>
_C *get_first_device()
{
for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
for (int i = 0; i < m_devices.size(); i++)
{
_C *dev = dynamic_cast<_C *>(*entry);
_C *dev = dynamic_cast<_C *>(m_devices[i]);
if (dev != NULL)
return dev;
}
@ -1222,9 +1222,9 @@ public:
_C *get_single_device(const char *classname)
{
_C *ret = NULL;
for (netlist_device_t * const *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
for (int i = 0; i < m_devices.size(); i++)
{
_C *dev = dynamic_cast<_C *>(*entry);
_C *dev = dynamic_cast<_C *>(m_devices[i]);
if (dev != NULL)
{
if (ret != NULL)
@ -1283,7 +1283,7 @@ private:
};
// -----------------------------------------------------------------------------
// Inline implementations
// /* inline */ implementations
// -----------------------------------------------------------------------------
PSTATE_INTERFACE(netlist_object_t, m_netlist, name())

View File

@ -23,22 +23,22 @@
* To get a performance increase we need the GCC extension.
*
* Todo: This doesn't work with current (4.8+) mingw 32bit builds.
* Therefore disabled for now for i386 builds.
* Therefore disabled for now for i386 builds.
*
*/
#ifndef USE_PMFDELEGATES
#if defined(__clang__) || (defined(__GNUC__) && defined(__i386__))
#define USE_PMFDELEGATES (0)
#define NO_USE_PMFCONVERSION (1)
#define USE_PMFDELEGATES (0)
#define NO_USE_PMFCONVERSION (1)
#else
#if defined(__GNUC__)
#define USE_PMFDELEGATES (1)
#define NO_USE_PMFCONVERSION (0)
#define NO_USE_PMFCONVERSION (0)
#pragma GCC diagnostic ignored "-Wpmf-conversions"
#else
#define USE_PMFDELEGATES (0)
#define NO_USE_PMFCONVERSION (1)
#define NO_USE_PMFCONVERSION (1)
#endif
#endif
#endif

View File

@ -38,9 +38,9 @@ netlist_factory_t::netlist_factory_t()
netlist_factory_t::~netlist_factory_t()
{
for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
for (int i=0; i < m_list.size(); i++)
{
net_device_t_base_factory *p = *e;
net_device_t_base_factory *p = m_list[i];
pfree(p);
}
m_list.clear();
@ -48,9 +48,9 @@ netlist_factory_t::~netlist_factory_t()
netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname) const
{
for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
for (int i=0; i < m_list.size(); i++)
{
net_device_t_base_factory *p = *e;
net_device_t_base_factory *p = m_list[i];
if (p->classname() == classname)
{
netlist_device_t *ret = p->Create();
@ -69,9 +69,9 @@ netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, net
net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const
{
for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
for (int i=0; i < m_list.size(); i++)
{
net_device_t_base_factory *p = *e;
net_device_t_base_factory *p = m_list[i];
if (p->name() == name)
{
return p;

View File

@ -26,13 +26,13 @@ public:
class entry_t
{
public:
ATTR_HOT inline entry_t()
ATTR_HOT /* inline */ entry_t()
: m_object(), m_exec_time() {}
ATTR_HOT inline entry_t(const _Time &atime, const _Element &elem) : m_object(elem), m_exec_time(atime) {}
ATTR_HOT inline const _Time exec_time() const { return m_exec_time; }
ATTR_HOT inline const _Element object() const { return m_object; }
ATTR_HOT /* inline */ entry_t(const _Time &atime, const _Element &elem) : m_object(elem), m_exec_time(atime) {}
ATTR_HOT /* inline */ const _Time exec_time() const { return m_exec_time; }
ATTR_HOT /* inline */ const _Element object() const { return m_object; }
ATTR_HOT inline entry_t &operator=(const entry_t &right) {
ATTR_HOT /* inline */ entry_t &operator=(const entry_t &right) {
m_object = right.m_object;
m_exec_time = right.m_exec_time;
return *this;
@ -48,9 +48,9 @@ public:
clear();
}
ATTR_HOT inline int capacity() const { return _Size; }
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }
ATTR_HOT /* inline */ int capacity() const { return _Size; }
ATTR_HOT /* inline */ bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT /* inline */ bool is_not_empty() const { return (m_end > &m_list[0]); }
ATTR_HOT void push(const entry_t &e)
{
@ -66,17 +66,17 @@ public:
//nl_assert(m_end - m_list < _Size);
}
ATTR_HOT inline const entry_t *pop()
ATTR_HOT /* inline */ const entry_t *pop()
{
return --m_end;
}
ATTR_HOT inline const entry_t *peek() const
ATTR_HOT /* inline */ const entry_t *peek() const
{
return (m_end-1);
}
ATTR_HOT /*inline*/ void remove(const _Element &elem)
ATTR_HOT /* inline */ void remove(const _Element &elem)
{
entry_t * i = m_end - 1;
while (i > &m_list[0])
@ -102,9 +102,9 @@ public:
// save state support & mame disasm
ATTR_COLD inline const entry_t *listptr() const { return &m_list[0]; }
ATTR_HOT inline int count() const { return m_end - m_list; }
ATTR_HOT inline const entry_t & operator[](const int & index) const { return m_list[index]; }
ATTR_COLD /* inline */ const entry_t *listptr() const { return &m_list[0]; }
ATTR_HOT /* inline */ int count() const { return m_end - m_list; }
ATTR_HOT /* inline */ const entry_t & operator[](const int & index) const { return m_list[index]; }
#if (NL_KEEP_STATISTICS)
// profiling

View File

@ -238,7 +238,7 @@ void netlist_parser::device(const pstring &dev_type)
NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));
cnt = 0;
while (cnt < def_params.count())
while (cnt < def_params.size())
{
pstring paramfq = devname + "." + def_params[cnt];
@ -259,7 +259,7 @@ void netlist_parser::device(const pstring &dev_type)
token_t tok = get_token();
cnt = 0;
while (tok.is(m_tok_comma) && cnt < termlist.count())
while (tok.is(m_tok_comma) && cnt < termlist.size())
{
pstring output_name = get_identifier();
@ -268,8 +268,8 @@ void netlist_parser::device(const pstring &dev_type)
cnt++;
tok = get_token();
}
if (cnt != termlist.count())
m_setup.netlist().error("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), termlist.count(), cnt);
if (cnt != termlist.size())
m_setup.netlist().error("netlist: input count mismatch for %s - expected %" SIZETFMT " found %d\n", devname.cstr(), termlist.size(), cnt);
require_token(tok, m_tok_param_right);
}

View File

@ -129,6 +129,14 @@ private:
class netlist_sources_t
{
public:
netlist_sources_t() { }
~netlist_sources_t()
{
m_list.clear();
}
void add(netlist_source_t src)
{
m_list.add(src);
@ -136,7 +144,7 @@ public:
void parse(netlist_setup_t &setup, const pstring name)
{
for (int i=0; i < m_list.count(); i++)
for (int i=0; i < m_list.size(); i++)
{
if (m_list[i].parse(setup, name))
return;

View File

@ -107,7 +107,7 @@ netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const
template <class T>
static void remove_start_with(T &hm, pstring &sw)
{
for (int i = hm.count() - 1; i >= 0; i--)
for (int i = hm.size() - 1; i >= 0; i--)
{
pstring x = hm[i]->name();
if (sw.equals(x.substr(0, sw.len())))
@ -128,10 +128,10 @@ void netlist_setup_t::remove_dev(const pstring &name)
remove_start_with<tagmap_terminal_t>(m_terminals, temp);
remove_start_with<tagmap_param_t>(m_params, temp);
const link_t *p = m_links.first();
const link_t *p = m_links.data();
while (p != NULL)
{
const link_t *n = m_links.next(p);
const link_t *n = p+1;
if (temp.equals(p->e1.substr(0,temp.len())) || temp.equals(p->e2.substr(0,temp.len())))
m_links.remove(*p);
p = n;
@ -248,7 +248,7 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name
{
pstring search = (".model " + val + " ").ucase();
bool found = false;
for (int i=0; i < m_models.count(); i++)
for (int i=0; i < m_models.size(); i++)
{
if (m_models[i].ucase().startsWith(search))
{
@ -287,9 +287,9 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name
void netlist_setup_t::register_link_arr(const pstring &terms)
{
nl_util::pstring_list list = nl_util::split(terms,", ");
if (list.count() < 2)
if (list.size() < 2)
netlist().error("You must pass at least 2 terminals to NET_C");
for (int i = 1; i < list.count(); i++)
for (int i = 1; i < list.size(); i++)
{
register_link(list[0], list[i]);
}
@ -418,7 +418,7 @@ nld_base_proxy *netlist_setup_t::get_d_a_proxy(netlist_core_terminal_t &out)
#if 1
/* connect all existing terminals to new net */
for (int i = 0; i < out.net().m_core_terms.count(); i++)
for (int i = 0; i < out.net().m_core_terms.size(); i++)
{
netlist_core_terminal_t *p = out.net().m_core_terms[i];
p->clear_net(); // de-link from all nets ...
@ -577,7 +577,7 @@ bool netlist_setup_t::connect_input_input(netlist_core_terminal_t &t1, netlist_c
ret = connect(t2, t1.net().railterminal());
if (!ret)
{
for (int i=0; i<t1.net().m_core_terms.count(); i++)
for (int i=0; i<t1.net().m_core_terms.size(); i++)
{
if (t1.net().m_core_terms[i]->isType(netlist_core_terminal_t::TERMINAL)
/*|| t1.net().m_core_terms[i]->isType(netlist_core_terminal_t::OUTPUT)*/)
@ -595,7 +595,7 @@ bool netlist_setup_t::connect_input_input(netlist_core_terminal_t &t1, netlist_c
ret = connect(t1, t2.net().railterminal());
if (!ret)
{
for (int i=0; i<t2.net().m_core_terms.count(); i++)
for (int i=0; i<t2.net().m_core_terms.size(); i++)
{
if (t2.net().m_core_terms[i]->isType(netlist_core_terminal_t::TERMINAL)
/*|| t2.net().m_core_terms[i]->isType(netlist_core_terminal_t::OUTPUT)*/)
@ -672,10 +672,10 @@ void netlist_setup_t::resolve_inputs()
* after all other terminals were connected.
*/
int tries = 100;
while (m_links.count() > 0 && tries > 0) // FIXME: convert into constant
while (m_links.size() > 0 && tries > 0) // FIXME: convert into constant
{
int li = 0;
while (li < m_links.count())
while (li < m_links.size())
{
const pstring t1s = m_links[li].e1;
const pstring t2s = m_links[li].e2;
@ -695,7 +695,7 @@ void netlist_setup_t::resolve_inputs()
}
if (tries == 0)
{
for (int i = 0; i < m_links.count(); i++ )
for (int i = 0; i < m_links.size(); i++ )
netlist().warning("Error connecting %s to %s\n", m_links[i].e1.cstr(), m_links[i].e2.cstr());
netlist().error("Error connecting -- bailing out\n");
@ -707,19 +707,19 @@ void netlist_setup_t::resolve_inputs()
netlist_net_t::list_t todelete;
for (netlist_net_t *const *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
for (int i = 0; i<netlist().m_nets.size(); i++)
{
if ((*pn)->num_cons() == 0)
if (netlist().m_nets[i]->num_cons() == 0)
{
todelete.add(*pn);
todelete.add(netlist().m_nets[i]);
}
else
{
(*pn)->rebuild_list();
netlist().m_nets[i]->rebuild_list();
}
}
for (int i=0; i < todelete.count(); i++)
for (int i=0; i < todelete.size(); i++)
{
netlist().log("Deleting net %s ...", todelete[i]->name().cstr());
netlist().m_nets.remove(todelete[i]);
@ -730,7 +730,7 @@ void netlist_setup_t::resolve_inputs()
pstring errstr("");
netlist().log("looking for terminals not connected ...");
for (int i = 0; i < m_terminals.count(); i++)
for (int i = 0; i < m_terminals.size(); i++)
{
if (!m_terminals[i]->has_net())
errstr += pstring::sprintf("Found terminal %s without a net\n",
@ -745,7 +745,7 @@ void netlist_setup_t::resolve_inputs()
netlist().log("looking for two terms connected to rail nets ...\n");
// FIXME: doesn't find internal devices. This needs to be more clever
for (int i=0; i < netlist().m_devices.count(); i++)
for (int i=0; i < netlist().m_devices.size(); i++)
{
NETLIB_NAME(twoterm) *t = dynamic_cast<NETLIB_NAME(twoterm) *>(netlist().m_devices[i]);
if (t != NULL)
@ -777,7 +777,7 @@ void netlist_setup_t::start_devices()
{
NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
nl_util::pstring_list ll = nl_util::split(env, ":");
for (int i=0; i < ll.count(); i++)
for (int i=0; i < ll.size(); i++)
{
NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));

View File

@ -56,7 +56,7 @@ public:
while (i<str.len())
{
int p = -1;
for (int j=0; j < onstrl.count(); j++)
for (int j=0; j < onstrl.size(); j++)
{
if (std::strncmp(onstrl[j].cstr(), &(str.cstr()[i]), onstrl[j].len())==0)
{

View File

@ -33,13 +33,13 @@
/* not supported in GCC prior to 4.4.x */
/* ATTR_HOT and ATTR_COLD cause performance degration in 5.1 */
//#define ATTR_HOT
//#define ATTR_COLD
//#define ATTR_COLD
#define ATTR_HOT __attribute__((hot))
#define ATTR_COLD __attribute__((cold))
#define RESTRICT
#define EXPECTED(x) (x)
#define UNEXPECTED(x) (x)
#define EXPECTED(x) (x)
#define UNEXPECTED(x) (x)
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
#define ATTR_UNUSED __attribute__((__unused__))

View File

@ -22,7 +22,7 @@ class parray_t
{
public:
ATTR_COLD parray_t(int numElements)
ATTR_COLD parray_t(std::size_t numElements)
: m_list(0), m_capacity(0)
{
set_capacity(numElements);
@ -31,15 +31,15 @@ public:
ATTR_COLD parray_t(const parray_t &rhs)
: m_list(0), m_capacity(0)
{
set_capacity(rhs.capacity());
for (int i=0; i<m_capacity; i++)
set_capacity(rhs.size());
for (std::size_t i=0; i<m_capacity; i++)
m_list[i] = rhs[i];
}
ATTR_COLD parray_t &operator=(const parray_t &rhs)
{
set_capacity(rhs.capacity());
for (int i=0; i<m_capacity; i++)
set_capacity(rhs.size());
for (std::size_t i=0; i<m_capacity; i++)
m_list[i] = rhs[i];
return *this;
}
@ -51,23 +51,23 @@ public:
m_list = NULL;
}
ATTR_HOT inline operator _ListClass * () { return m_list; }
ATTR_HOT inline operator const _ListClass * () const { return m_list; }
ATTR_HOT /* inline */ operator _ListClass * () { return m_list; }
ATTR_HOT /* inline */ operator const _ListClass * () const { return m_list; }
/* using the [] operator will not allow gcc to vectorize code because
* basically a pointer is returned.
* array works around this.
*/
ATTR_HOT inline _ListClass *array() { return m_list; }
ATTR_HOT /* inline */ _ListClass *array() { return m_list; }
ATTR_HOT inline _ListClass& operator[](const int index) { return m_list[index]; }
ATTR_HOT inline const _ListClass& operator[](const int index) const { return m_list[index]; }
ATTR_HOT /* inline */ _ListClass& operator[](const std::size_t index) { return m_list[index]; }
ATTR_HOT /* inline */ const _ListClass& operator[](const std::size_t index) const { return m_list[index]; }
ATTR_HOT inline int capacity() const { return m_capacity; }
ATTR_HOT /* inline */ std::size_t size() const { return m_capacity; }
protected:
ATTR_COLD void set_capacity(const int new_capacity)
ATTR_COLD void set_capacity(const std::size_t new_capacity)
{
if (m_list != NULL)
pfree_array(m_list);
@ -79,26 +79,93 @@ protected:
}
private:
_ListClass * m_list;
int m_capacity;
};
// ----------------------------------------------------------------------------------------
// plinearlist_t: a simple list
// plist_t: a simple list
// ----------------------------------------------------------------------------------------
#if 0
#include <vector>
//#define plist_t std::vector
template <typename _ListClass>
class plist_t : public std::vector<_ListClass>
{
public:
plist_t() : std::vector<_ListClass>() {}
plist_t(const int numElements) : std::vector<_ListClass>(numElements) {}
template <class _ListClass>
/* inline */ void add(const _ListClass &elem) { this->push_back(elem); }
void clear_and_free()
{
for (_ListClass *i = this->data(); i < this->data() + this->size(); i++)
{
pfree(*i);
}
this->clear();
}
/* inline */ bool contains(const _ListClass &elem) const
{
for (const _ListClass *i = this->data(); i < this->data() + this->size(); i++)
{
if (*i == elem)
return true;
}
return false;
}
/* inline */ void remove(const _ListClass &elem)
{
for (int i = 0; i < this->size(); i++)
{
if (this->at(i) == elem)
{
this->erase(this->begin() + i);
return;
}
}
}
/* inline */ void remove_at(const int pos)
{
this->erase(this->begin() + pos);
}
/* inline */ int indexof(const _ListClass &elem) const
{
for (int i = 0; i < this->size(); i++)
{
if (this->at(i) == elem)
return i;
}
return -1;
}
ATTR_HOT /* inline */ void swap(const int pos1, const int pos2)
{
//nl_assert((pos1>=0) && (pos1<m_count));
//nl_assert((pos2>=0) && (pos2<m_count));
_ListClass tmp = (*this)[pos1];
(*this)[pos1] = (*this)[pos2];
(*this)[pos2] =tmp;
}
};
#else
template <typename _ListClass>
class plist_t
{
public:
ATTR_COLD plist_t(const int numElements = 0)
ATTR_COLD plist_t(const std::size_t numElements = 0)
{
m_capacity = numElements;
if (m_capacity == 0)
m_list = NULL;
else
m_list = palloc_array(_ListClass, m_capacity);
m_list = this->alloc(m_capacity);
m_count = 0;
}
@ -108,9 +175,9 @@ public:
if (m_capacity == 0)
m_list = NULL;
else
m_list = palloc_array(_ListClass, m_capacity);
m_list = this->alloc(m_capacity);
m_count = 0;
for (int i=0; i<rhs.count(); i++)
for (std::size_t i=0; i<rhs.size(); i++)
{
this->add(rhs[i]);
}
@ -119,7 +186,7 @@ public:
ATTR_COLD plist_t &operator=(const plist_t &rhs)
{
this->clear();
for (int i=0; i<rhs.count(); i++)
for (std::size_t i=0; i<rhs.size(); i++)
{
this->add(rhs[i]);
}
@ -130,27 +197,19 @@ public:
~plist_t()
{
if (m_list != NULL)
pfree_array(m_list);
this->dealloc(m_list, m_capacity);
m_list = NULL;
}
ATTR_HOT inline operator _ListClass * () { return m_list; }
ATTR_HOT inline operator const _ListClass * () const { return m_list; }
ATTR_HOT /* inline */ _ListClass *data() { return m_list; }
/* using the [] operator will not allow gcc to vectorize code because
* basically a pointer is returned.
* array works around this.
*/
ATTR_HOT /* inline */ _ListClass& operator[](std::size_t index) { return *(m_list + index); }
ATTR_HOT /* inline */ const _ListClass& operator[](std::size_t index) const { return *(m_list + index); }
ATTR_HOT inline _ListClass *array() { return m_list; }
ATTR_HOT inline _ListClass& operator[](const int index) { return m_list[index]; }
ATTR_HOT inline const _ListClass& operator[](const int index) const { return m_list[index]; }
ATTR_HOT inline void add(const _ListClass &elem)
ATTR_HOT /* inline */ void add(const _ListClass &elem)
{
if (m_count >= m_capacity){
int new_size = m_capacity * 2;
std::size_t new_size = m_capacity * 2;
if (new_size < 32)
new_size = 32;
set_capacity(new_size);
@ -159,9 +218,9 @@ public:
m_list[m_count++] = elem;
}
ATTR_HOT inline void remove(const _ListClass &elem)
ATTR_HOT /* inline */ void remove(const _ListClass &elem)
{
for (int i = 0; i < m_count; i++)
for (std::size_t i = 0; i < m_count; i++)
{
if (m_list[i] == elem)
{
@ -176,7 +235,7 @@ public:
}
}
ATTR_HOT inline void remove_at(const int pos)
ATTR_HOT /* inline */ void remove_at(const std::size_t pos)
{
//nl_assert((pos>=0) && (pos<m_count));
m_count--;
@ -186,7 +245,7 @@ public:
}
}
ATTR_HOT inline void swap(const int pos1, const int pos2)
ATTR_HOT /* inline */ void swap(const std::size_t pos1, const std::size_t pos2)
{
//nl_assert((pos1>=0) && (pos1<m_count));
//nl_assert((pos2>=0) && (pos2<m_count));
@ -195,7 +254,7 @@ public:
m_list[pos2] =tmp;
}
ATTR_HOT inline bool contains(const _ListClass &elem) const
ATTR_HOT /* inline */ bool contains(const _ListClass &elem) const
{
for (_ListClass *i = m_list; i < m_list + m_count; i++)
{
@ -205,9 +264,9 @@ public:
return false;
}
ATTR_HOT inline int indexof(const _ListClass &elem) const
ATTR_HOT /* inline */ int indexof(const _ListClass &elem) const
{
for (int i = 0; i < m_count; i++)
for (std::size_t i = 0; i < m_count; i++)
{
if (m_list[i] == elem)
return i;
@ -215,13 +274,10 @@ public:
return -1;
}
ATTR_HOT inline const _ListClass *first() const { return ((m_count > 0) ? &m_list[0] : NULL ); }
ATTR_HOT inline const _ListClass *next(const _ListClass *lc) const { return ((lc < last()) ? lc + 1 : NULL ); }
ATTR_HOT inline const _ListClass *last() const { return &m_list[m_count -1]; }
ATTR_HOT inline int count() const { return m_count; }
ATTR_HOT inline bool is_empty() const { return (m_count == 0); }
ATTR_HOT inline void clear() { m_count = 0; }
ATTR_HOT inline int capacity() const { return m_capacity; }
ATTR_HOT /* inline */ std::size_t size() const { return m_count; }
ATTR_HOT /* inline */ bool is_empty() const { return (m_count == 0); }
ATTR_HOT /* inline */ void clear() { m_count = 0; }
ATTR_HOT /* inline */ std::size_t capacity() const { return m_capacity; }
ATTR_COLD void clear_and_free()
{
@ -233,12 +289,12 @@ public:
}
private:
ATTR_COLD void set_capacity(const int new_capacity)
ATTR_COLD void set_capacity(const std::size_t new_capacity)
{
int cnt = count();
std::size_t cnt = size();
if (new_capacity > 0)
{
_ListClass *m_new = palloc_array(_ListClass, new_capacity);
_ListClass *m_new = this->alloc(new_capacity);
_ListClass *pd = m_new;
if (cnt > new_capacity)
@ -246,24 +302,35 @@ private:
for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++)
*pd = *ps;
if (m_list != NULL)
pfree_array(m_list);
this->dealloc(m_list, m_capacity);
m_list = m_new;
m_count = cnt;
}
else
{
if (m_list != NULL)
pfree_array(m_list);
this->dealloc(m_list, m_capacity);
m_list = NULL;
m_count = 0;
}
m_capacity = new_capacity;
}
int m_count;
_ListClass *alloc(const std::size_t n)
{
return palloc_array(_ListClass, n);
}
void dealloc(_ListClass *p, std::size_t n)
{
pfree_array(p);
}
std::size_t m_count;
_ListClass * m_list;
int m_capacity;
std::size_t m_capacity;
};
#endif
// ----------------------------------------------------------------------------------------
// pnamedlist_t: a simple list of elements which have a name() interface
@ -275,7 +342,7 @@ class pnamedlist_t : public plist_t<_ListClass>
public:
_ListClass find(const pstring &name) const
{
for (int i=0; i < this->count(); i++)
for (int i=0; i < this->size(); i++)
if (get_name((*this)[i]) == name)
return (*this)[i];
return _ListClass(NULL);
@ -337,27 +404,27 @@ public:
{
}
ATTR_HOT inline void push(const _StackClass &elem)
ATTR_HOT /* inline */ void push(const _StackClass &elem)
{
m_list.add(elem);
}
ATTR_HOT inline _StackClass peek() const
ATTR_HOT /* inline */ _StackClass peek() const
{
return m_list[m_list.count() - 1];
return m_list[m_list.size() - 1];
}
ATTR_HOT inline _StackClass pop()
ATTR_HOT /* inline */ _StackClass pop()
{
_StackClass ret = peek();
m_list.remove_at(m_list.count() - 1);
m_list.remove_at(m_list.size() - 1);
return ret;
}
ATTR_HOT inline int count() const { return m_list.count(); }
ATTR_HOT inline bool empty() const { return (m_list.count() == 0); }
ATTR_HOT inline void reset() { m_list.reset(); }
ATTR_HOT inline int capacity() const { return m_list.capacity(); }
ATTR_HOT /* inline */ int count() const { return m_list.size(); }
ATTR_HOT /* inline */ bool empty() const { return (m_list.size() == 0); }
ATTR_HOT /* inline */ void reset() { m_list.reset(); }
ATTR_HOT /* inline */ int capacity() const { return m_list.capacity(); }
private:
plist_t<_StackClass> m_list;
@ -382,7 +449,7 @@ public:
plinkedlist_t() : m_head(NULL) {}
ATTR_HOT inline void insert(const _ListClass &before, _ListClass &elem)
ATTR_HOT /* inline */ void insert(const _ListClass &before, _ListClass &elem)
{
if (m_head == &before)
{
@ -407,13 +474,13 @@ public:
}
}
ATTR_HOT inline void insert(_ListClass &elem)
ATTR_HOT /* inline */ void insert(_ListClass &elem)
{
elem.m_next = m_head;
m_head = &elem;
}
ATTR_HOT inline void add(_ListClass &elem)
ATTR_HOT /* inline */ void add(_ListClass &elem)
{
_ListClass **p = &m_head;
while (*p != NULL)
@ -424,7 +491,7 @@ public:
elem.m_next = NULL;
}
ATTR_HOT inline void remove(const _ListClass &elem)
ATTR_HOT /* inline */ void remove(const _ListClass &elem)
{
_ListClass **p = &m_head;
while (*p != &elem)
@ -436,11 +503,11 @@ public:
}
ATTR_HOT static inline _ListClass *next(const _ListClass &elem) { return elem.m_next; }
ATTR_HOT static inline _ListClass *next(const _ListClass *elem) { return elem->m_next; }
ATTR_HOT inline _ListClass *first() const { return m_head; }
ATTR_HOT inline void clear() { m_head = NULL; }
ATTR_HOT inline bool is_empty() const { return (m_head == NULL); }
ATTR_HOT static /* inline */ _ListClass *next(const _ListClass &elem) { return elem.m_next; }
ATTR_HOT static /* inline */ _ListClass *next(const _ListClass *elem) { return elem->m_next; }
ATTR_HOT /* inline */ _ListClass *first() const { return m_head; }
ATTR_HOT /* inline */ void clear() { m_head = NULL; }
ATTR_HOT /* inline */ bool is_empty() const { return (m_head == NULL); }
private:
_ListClass *m_head;

View File

@ -32,7 +32,6 @@ public:
virtual ~poption()
{
}
/* no_argument options will be called with "" argument */
@ -157,7 +156,7 @@ public:
{
pstring ret;
for (int i=0; i<m_opts.count(); i++ )
for (int i=0; i<m_opts.size(); i++ )
{
poption *opt = m_opts[i];
pstring line = "";
@ -182,7 +181,7 @@ private:
poption *getopt_short(pstring arg)
{
for (int i=0; i < m_opts.count(); i++)
for (int i=0; i < m_opts.size(); i++)
{
if (m_opts[i]->m_short == arg)
return m_opts[i];
@ -191,7 +190,7 @@ private:
}
poption *getopt_long(pstring arg)
{
for (int i=0; i < m_opts.count(); i++)
for (int i=0; i < m_opts.size(); i++)
{
if (m_opts[i]->m_long == arg)
return m_opts[i];

View File

@ -245,7 +245,7 @@ double ppreprocessor::expr(const nl_util::pstring_list &sexpr, int &start, int p
val = tok.as_double();
start++;
}
while (start < sexpr.count())
while (start < sexpr.size())
{
tok=sexpr[start];
if (tok == ")")
@ -278,7 +278,7 @@ double ppreprocessor::expr(const nl_util::pstring_list &sexpr, int &start, int p
ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name)
{
for (int i = 0; i<m_defines.count(); i++)
for (int i = 0; i<m_defines.size(); i++)
{
if (m_defines[i].m_name == name)
return &m_defines[i];
@ -290,7 +290,7 @@ pstring ppreprocessor::replace_macros(const pstring &line)
{
nl_util::pstring_list elems = nl_util::splitexpr(line, m_expr_sep);
pstringbuffer ret = "";
for (int i=0; i<elems.count(); i++)
for (int i=0; i<elems.size(); i++)
{
define_t *def = get_define(elems[i]);
if (def != NULL)
@ -310,7 +310,7 @@ pstring ppreprocessor::process(const pstring &contents)
int level = 0;
int i=0;
while (i<lines.count())
while (i<lines.size())
{
pstring line = lines[i];
pstring lt = line.replace("\t"," ").trim();
@ -342,7 +342,7 @@ pstring ppreprocessor::process(const pstring &contents)
}
else if (lti[0].equals("#define"))
{
if (lti.count() != 3)
if (lti.size() != 3)
error(pstring::sprintf("PREPRO: only simple defines allowed: %s", line.cstr()));
m_defines.add(define_t(lti[1], lti[2]));
}
@ -352,7 +352,7 @@ pstring ppreprocessor::process(const pstring &contents)
else
{
//if (ifflag == 0 && level > 0)
// fprintf(stderr, "conditional: %s\n", line.cstr());
// fprintf(stderr, "conditional: %s\n", line.cstr());
if (ifflag == 0)
{
ret.cat(line);

View File

@ -93,7 +93,7 @@ public:
token_id_t register_token(pstring token)
{
m_tokens.add(token);
return token_id_t(m_tokens.count() - 1);
return token_id_t(m_tokens.size() - 1);
}
void set_identifier_chars(pstring s) { m_identifier_chars = s; }

View File

@ -41,12 +41,12 @@ ATTR_COLD void pstate_manager_t::remove_save_items(const void *owner)
{
pstate_entry_t::list_t todelete;
for (int i=0; i < m_save.count(); i++)
for (int i=0; i < m_save.size(); i++)
{
if (m_save[i]->m_owner == owner)
todelete.add(m_save[i]);
}
for (int i=0; i < todelete.count(); i++)
for (int i=0; i < todelete.size(); i++)
{
m_save.remove(todelete[i]);
}
@ -55,14 +55,14 @@ ATTR_COLD void pstate_manager_t::remove_save_items(const void *owner)
ATTR_COLD void pstate_manager_t::pre_save()
{
for (int i=0; i < m_save.count(); i++)
for (int i=0; i < m_save.size(); i++)
if (m_save[i]->m_dt == DT_CUSTOM)
m_save[i]->m_callback->on_pre_save();
}
ATTR_COLD void pstate_manager_t::post_load()
{
for (int i=0; i < m_save.count(); i++)
for (int i=0; i < m_save.size(); i++)
if (m_save[i]->m_dt == DT_CUSTOM)
m_save[i]->m_callback->on_post_load();
}

View File

@ -26,7 +26,7 @@
template<typename C, std::size_t N> ATTR_COLD void obj::save(C (&state)[N], const pstring &stname) \
{ manager->save_state_ptr(module + "." + stname, nl_datatype<C>::type, this, sizeof(state[0]), N, &(state[0]), false); } \
template<typename C> ATTR_COLD void obj::save(C *state, const pstring &stname, const int count) \
{ manager->save_state_ptr(module + "." + stname, nl_datatype<C>::type, this, sizeof(C), count, state, false); }
{ manager->save_state_ptr(module + "." + stname, nl_datatype<C>::type, this, sizeof(C), count, state, false); }
enum pstate_data_type_e {
NOT_SUPPORTED,

View File

@ -245,7 +245,7 @@ pstring::str_t *pstring::salloc(int n)
{
int size = sizeof(str_t) + n + 1;
str_t *p = (str_t *) palloc_array(char, size);
// str_t *p = (str_t *) _mm_malloc(size, 8);
// str_t *p = (str_t *) _mm_malloc(size, 8);
p->init(n);
return p;
}
@ -358,4 +358,3 @@ void pstringbuffer::pcat(const pstring &s)
std::strncpy(m_ptr + m_len, s.cstr(), slen + 1);
m_len += slen;
}

View File

@ -132,9 +132,9 @@ protected:
}
void init(const int alen)
{
m_ref_count = 1;
m_len = alen;
m_str[0] = 0;
m_ref_count = 1;
m_len = alen;
m_str[0] = 0;
}
char *str() { return &m_str[0]; }
int len() { return m_len; }

View File

@ -210,7 +210,7 @@ public:
{
NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
nl_util::pstring_list ll = nl_util::split(m_logs, ":");
for (int i=0; i < ll.count(); i++)
for (int i=0; i < ll.size(); i++)
{
pstring name = "log_" + ll[i];
/*netlist_device_t *nc = */ m_setup->register_dev("nld_log", name);
@ -303,7 +303,7 @@ static void listdevices()
nt.setup().start_devices();
nt.setup().resolve_inputs();
for (int i=0; i < list.count(); i++)
for (int i=0; i < list.size(); i++)
{
pstring out = pstring::sprintf("%-20s %s(<id>", list[i]->classname().cstr(),
list[i]->name().cstr() );
@ -315,7 +315,7 @@ static void listdevices()
d->start_dev();
// get the list of terminals ...
for (int j=0; j < d->m_terminals.count(); j++)
for (int j=0; j < d->m_terminals.size(); j++)
{
pstring inp = d->m_terminals[j];
if (inp.startsWith(d->name() + "."))
@ -369,7 +369,7 @@ public:
pstring line = "";
for (int i=0; i < spnl.count(); i++)
for (int i=0; i < spnl.size(); i++)
{
// Basic preprocessing
pstring inl = spnl[i].trim().ucase();
@ -493,16 +493,16 @@ protected:
void dump_nl()
{
for (int i=0; i<alias.count(); i++)
for (int i=0; i<alias.size(); i++)
{
sp_net_t *net = nets.find(alias[i]);
// use the first terminal ...
printf("ALIAS(%s, %s)\n", alias[i].cstr(), net->terminals()[0].cstr());
// if the aliased net only has this one terminal connected ==> don't dump
if (net->terminals().count() == 1)
if (net->terminals().size() == 1)
net->set_no_export();
}
for (int i=0; i<devs.count(); i++)
for (int i=0; i<devs.size(); i++)
{
if (devs[i]->has_value())
printf("%s(%s, %s)\n", devs[i]->type().cstr(),
@ -515,14 +515,14 @@ protected:
devs[i]->name().cstr());
}
// print nets
for (int i=0; i<nets.count(); i++)
for (int i=0; i<nets.size(); i++)
{
sp_net_t * net = nets[i];
if (!net->is_no_export())
{
//printf("Net %s\n", net->name().cstr());
printf("NET_C(%s", net->terminals()[0].cstr() );
for (int j=1; j<net->terminals().count(); j++)
for (int j=1; j<net->terminals().size(); j++)
{
printf(", %s", net->terminals()[j].cstr() );
}
@ -552,7 +552,7 @@ protected:
if (tt[0].equals(".SUBCKT"))
{
printf("NETLIST_START(%s)\n", tt[1].cstr());
for (int i=2; i<tt.count(); i++)
for (int i=2; i<tt.size(); i++)
alias.add(tt[i]);
}
else if (tt[0].equals(".ENDS"))
@ -571,7 +571,7 @@ protected:
*/
// FIXME: we need a is_long method ..
ATTR_UNUSED int nval =tt[4].as_long(&cerr);
if ((!cerr || tt[4].startsWith("N")) && tt.count() > 5)
if ((!cerr || tt[4].startsWith("N")) && tt.size() > 5)
devs.add(palloc(sp_dev_t, "QBJT", tt[0], tt[5]), false);
else
devs.add(palloc(sp_dev_t, "QBJT", tt[0], tt[4]), false);
@ -614,9 +614,9 @@ protected:
{
// FIXME: specific code for KICAD exports
// last element is component type
pstring tname = "TTL_" + tt[tt.count()-1] + "_DIP";
pstring tname = "TTL_" + tt[tt.size()-1] + "_DIP";
devs.add(palloc(sp_dev_t, tname, tt[0]), false);
for (int i=1; i < tt.count() - 1; i++)
for (int i=1; i < tt.size() - 1; i++)
{
pstring term = pstring::sprintf("%s.%d", tt[0].cstr(), i);
add_term(tt[i], term);