mirror of
https://github.com/holub/mame
synced 2025-05-19 12:18:56 +03:00
More cppcheck fixes. (nw)
This commit is contained in:
parent
c933d239f5
commit
3c49610274
@ -100,7 +100,7 @@ private:
|
|||||||
class bjt_model_t : public param_model_t
|
class bjt_model_t : public param_model_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bjt_model_t(device_t &device, const pstring name, const pstring val)
|
bjt_model_t(device_t &device, const pstring &name, const pstring &val)
|
||||||
: param_model_t(device, name, val)
|
: param_model_t(device, name, val)
|
||||||
, m_IS(*this, "IS")
|
, m_IS(*this, "IS")
|
||||||
, m_BF(*this, "BF")
|
, m_BF(*this, "BF")
|
||||||
|
@ -77,7 +77,7 @@ namespace netlist
|
|||||||
class opamp_model_t : public param_model_t
|
class opamp_model_t : public param_model_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
opamp_model_t(device_t &device, const pstring name, const pstring val)
|
opamp_model_t(device_t &device, const pstring &name, const pstring &val)
|
||||||
: param_model_t(device, name, val)
|
: param_model_t(device, name, val)
|
||||||
, m_TYPE(*this, "TYPE")
|
, m_TYPE(*this, "TYPE")
|
||||||
, m_FPF(*this, "FPF")
|
, m_FPF(*this, "FPF")
|
||||||
|
@ -329,7 +329,7 @@ private:
|
|||||||
class diode_model_t : public param_model_t
|
class diode_model_t : public param_model_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
diode_model_t(device_t &device, const pstring name, const pstring val)
|
diode_model_t(device_t &device, const pstring &name, const pstring &val)
|
||||||
: param_model_t(device, name, val)
|
: param_model_t(device, name, val)
|
||||||
, m_IS(*this, "IS")
|
, m_IS(*this, "IS")
|
||||||
, m_N(*this, "N")
|
, m_N(*this, "N")
|
||||||
@ -356,7 +356,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class CLASS>
|
template <class CLASS>
|
||||||
NETLIB_NAME(D)(CLASS &owner, const pstring name, const pstring model)
|
NETLIB_NAME(D)(CLASS &owner, const pstring &name, const pstring &model)
|
||||||
: NETLIB_NAME(twoterm)(owner, name)
|
: NETLIB_NAME(twoterm)(owner, name)
|
||||||
, m_model(*this, "MODEL", model)
|
, m_model(*this, "MODEL", model)
|
||||||
, m_D(*this, "m_D")
|
, m_D(*this, "m_D")
|
||||||
|
@ -108,7 +108,7 @@ namespace netlist
|
|||||||
}
|
}
|
||||||
else if (m_ENABLET() && m_ENABLEP())
|
else if (m_ENABLET() && m_ENABLEP())
|
||||||
{
|
{
|
||||||
m_cnt++;
|
++m_cnt;
|
||||||
if (m_cnt > MAXCNT)
|
if (m_cnt > MAXCNT)
|
||||||
m_cnt = 0;
|
m_cnt = 0;
|
||||||
}
|
}
|
||||||
|
@ -133,14 +133,14 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
if (m_CD() && !m_last_CU && m_CU())
|
if (m_CD() && !m_last_CU && m_CU())
|
||||||
{
|
{
|
||||||
m_cnt++;
|
++m_cnt;
|
||||||
if (m_cnt > MAXCNT)
|
if (m_cnt > MAXCNT)
|
||||||
m_cnt = 0;
|
m_cnt = 0;
|
||||||
}
|
}
|
||||||
if (m_CU() && !m_last_CD && m_CD())
|
if (m_CU() && !m_last_CD && m_CD())
|
||||||
{
|
{
|
||||||
if (m_cnt > 0)
|
if (m_cnt > 0)
|
||||||
m_cnt--;
|
--m_cnt;
|
||||||
else
|
else
|
||||||
m_cnt = MAXCNT;
|
m_cnt = MAXCNT;
|
||||||
}
|
}
|
||||||
|
@ -112,14 +112,14 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
if (m_CD() && !m_last_CU && m_CU())
|
if (m_CD() && !m_last_CU && m_CU())
|
||||||
{
|
{
|
||||||
m_cnt++;
|
++m_cnt;
|
||||||
if (m_cnt > MAXCNT)
|
if (m_cnt > MAXCNT)
|
||||||
m_cnt = 0;
|
m_cnt = 0;
|
||||||
}
|
}
|
||||||
if (m_CU() && !m_last_CD && m_CD())
|
if (m_CU() && !m_last_CD && m_CD())
|
||||||
{
|
{
|
||||||
if (m_cnt > 0)
|
if (m_cnt > 0)
|
||||||
m_cnt--;
|
--m_cnt;
|
||||||
else
|
else
|
||||||
m_cnt = MAXCNT;
|
m_cnt = MAXCNT;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
if (m_cnt < MAXCNT - 1)
|
if (m_cnt < MAXCNT - 1)
|
||||||
{
|
{
|
||||||
m_cnt++;
|
++m_cnt;
|
||||||
update_outputs(m_cnt);
|
update_outputs(m_cnt);
|
||||||
}
|
}
|
||||||
else if (m_cnt == MAXCNT - 1)
|
else if (m_cnt == MAXCNT - 1)
|
||||||
|
@ -27,7 +27,7 @@ namespace netlist
|
|||||||
typedef T type;
|
typedef T type;
|
||||||
|
|
||||||
sbitset() : m_bs(0) { }
|
sbitset() : m_bs(0) { }
|
||||||
sbitset(T v) : m_bs(v) { }
|
/* explicit */ sbitset(T v) : m_bs(v) { }
|
||||||
|
|
||||||
sbitset &set() { *this = all_bits(); return *this; }
|
sbitset &set() { *this = all_bits(); return *this; }
|
||||||
sbitset &set(const std::size_t bit) { m_bs |= (static_cast<T>(1) << bit); return *this; }
|
sbitset &set(const std::size_t bit) { m_bs |= (static_cast<T>(1) << bit); return *this; }
|
||||||
@ -363,7 +363,7 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable, uint_least
|
|||||||
if (*m_initialized)
|
if (*m_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pstring ttline = truthtable[line];
|
pstring ttline(truthtable[line]);
|
||||||
line++;
|
line++;
|
||||||
ttline = truthtable[line];
|
ttline = truthtable[line];
|
||||||
line++;
|
line++;
|
||||||
|
@ -82,7 +82,7 @@ namespace factory {
|
|||||||
class list_t : public std::vector<std::unique_ptr<element_t>>
|
class list_t : public std::vector<std::unique_ptr<element_t>>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
list_t(setup_t &m_setup);
|
explicit list_t(setup_t &m_setup);
|
||||||
~list_t();
|
~list_t();
|
||||||
|
|
||||||
template<class device_class>
|
template<class device_class>
|
||||||
|
@ -107,7 +107,7 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
timed_queue(const std::size_t list_size)
|
explicit timed_queue(const std::size_t list_size)
|
||||||
: m_list(list_size)
|
: m_list(list_size)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -220,7 +220,7 @@ namespace netlist
|
|||||||
bool operator()(const T &a, const T &b) { return QueueOp::less(b,a); }
|
bool operator()(const T &a, const T &b) { return QueueOp::less(b,a); }
|
||||||
};
|
};
|
||||||
|
|
||||||
timed_queue(const std::size_t list_size)
|
explicit timed_queue(const std::size_t list_size)
|
||||||
: m_list(list_size)
|
: m_list(list_size)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
@ -24,7 +24,7 @@ void parser_t::verror(const pstring &msg, int line_num, const pstring &line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool parser_t::parse(const pstring nlname)
|
bool parser_t::parse(const pstring &nlname)
|
||||||
{
|
{
|
||||||
set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-");
|
set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-");
|
||||||
set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers
|
set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers
|
||||||
|
@ -19,7 +19,7 @@ namespace netlist
|
|||||||
parser_t(plib::putf8_reader &strm, setup_t &setup)
|
parser_t(plib::putf8_reader &strm, setup_t &setup)
|
||||||
: plib::ptokenizer(strm), m_setup(setup) {}
|
: plib::ptokenizer(strm), m_setup(setup) {}
|
||||||
|
|
||||||
bool parse(const pstring nlname = "");
|
bool parse(const pstring &nlname = "");
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void parse_netlist(const pstring &nlname);
|
void parse_netlist(const pstring &nlname);
|
||||||
|
@ -83,7 +83,7 @@ void setup_t::register_dev(const pstring &classname, const pstring &name)
|
|||||||
m_device_factory.push_back(std::pair<pstring, factory::element_t *>(build_fqn(name), f));
|
m_device_factory.push_back(std::pair<pstring, factory::element_t *>(build_fqn(name), f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setup_t::device_exists(const pstring name) const
|
bool setup_t::device_exists(const pstring &name) const
|
||||||
{
|
{
|
||||||
for (auto e : m_device_factory)
|
for (auto e : m_device_factory)
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ pstring setup_t::termtype_as_str(detail::core_terminal_t &in) const
|
|||||||
return pstring("Error");
|
return pstring("Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
pstring setup_t::get_initial_param_val(const pstring name, const pstring def)
|
pstring setup_t::get_initial_param_val(const pstring &name, const pstring &def)
|
||||||
{
|
{
|
||||||
auto i = m_param_values.find(name);
|
auto i = m_param_values.find(name);
|
||||||
if (i != m_param_values.end())
|
if (i != m_param_values.end())
|
||||||
@ -156,7 +156,7 @@ pstring setup_t::get_initial_param_val(const pstring name, const pstring def)
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
double setup_t::get_initial_param_val(const pstring name, const double def)
|
double setup_t::get_initial_param_val(const pstring &name, const double def)
|
||||||
{
|
{
|
||||||
auto i = m_param_values.find(name);
|
auto i = m_param_values.find(name);
|
||||||
if (i != m_param_values.end())
|
if (i != m_param_values.end())
|
||||||
@ -170,7 +170,7 @@ double setup_t::get_initial_param_val(const pstring name, const double def)
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setup_t::get_initial_param_val(const pstring name, const int def)
|
int setup_t::get_initial_param_val(const pstring &name, const int def)
|
||||||
{
|
{
|
||||||
auto i = m_param_values.find(name);
|
auto i = m_param_values.find(name);
|
||||||
if (i != m_param_values.end())
|
if (i != m_param_values.end())
|
||||||
@ -184,7 +184,7 @@ int setup_t::get_initial_param_val(const pstring name, const int def)
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_t::register_param(pstring name, param_t ¶m)
|
void setup_t::register_param(const pstring &name, param_t ¶m)
|
||||||
{
|
{
|
||||||
if (!m_params.insert({param.name(), param_ref_t(param.name(), param.device(), param)}).second)
|
if (!m_params.insert({param.name(), param_ref_t(param.name(), param.device(), param)}).second)
|
||||||
log().fatal(MF_1_ADDING_PARAMETER_1_TO_PARAMETER_LIST, name);
|
log().fatal(MF_1_ADDING_PARAMETER_1_TO_PARAMETER_LIST, name);
|
||||||
@ -222,7 +222,7 @@ void setup_t::register_link(const pstring &sin, const pstring &sout)
|
|||||||
register_link_fqn(build_fqn(sin), build_fqn(sout));
|
register_link_fqn(build_fqn(sin), build_fqn(sout));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_t::remove_connections(const pstring pin)
|
void setup_t::remove_connections(const pstring &pin)
|
||||||
{
|
{
|
||||||
pstring pinfn = build_fqn(pin);
|
pstring pinfn = build_fqn(pin);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@ -243,7 +243,7 @@ void setup_t::remove_connections(const pstring pin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setup_t::register_frontier(const pstring attach, const double r_IN, const double r_OUT)
|
void setup_t::register_frontier(const pstring &attach, const double r_IN, const double r_OUT)
|
||||||
{
|
{
|
||||||
pstring frontier_name = plib::pfmt("frontier_{1}")(m_frontier_cnt);
|
pstring frontier_name = plib::pfmt("frontier_{1}")(m_frontier_cnt);
|
||||||
m_frontier_cnt++;
|
m_frontier_cnt++;
|
||||||
@ -945,7 +945,7 @@ void setup_t::include(const pstring &netlist_name)
|
|||||||
log().fatal(MF_1_NOT_FOUND_IN_SOURCE_COLLECTION, netlist_name);
|
log().fatal(MF_1_NOT_FOUND_IN_SOURCE_COLLECTION, netlist_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring name)
|
std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring &name)
|
||||||
{
|
{
|
||||||
for (auto &source : m_sources)
|
for (auto &source : m_sources)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ namespace netlist
|
|||||||
|
|
||||||
struct param_ref_t
|
struct param_ref_t
|
||||||
{
|
{
|
||||||
param_ref_t(const pstring name, core_device_t &device, param_t ¶m)
|
param_ref_t(const pstring &name, core_device_t &device, param_t ¶m)
|
||||||
: m_name(name)
|
: m_name(name)
|
||||||
, m_device(device)
|
, m_device(device)
|
||||||
, m_param(param)
|
, m_param(param)
|
||||||
@ -211,10 +211,10 @@ namespace netlist
|
|||||||
|
|
||||||
pstring build_fqn(const pstring &obj_name) const;
|
pstring build_fqn(const pstring &obj_name) const;
|
||||||
|
|
||||||
void register_param(pstring name, param_t ¶m);
|
void register_param(const pstring &name, param_t ¶m);
|
||||||
pstring get_initial_param_val(const pstring name, const pstring def);
|
pstring get_initial_param_val(const pstring &name, const pstring &def);
|
||||||
double get_initial_param_val(const pstring name, const double def);
|
double get_initial_param_val(const pstring &name, const double def);
|
||||||
int get_initial_param_val(const pstring name, const int def);
|
int get_initial_param_val(const pstring &name, const int def);
|
||||||
|
|
||||||
void register_term(detail::core_terminal_t &obj);
|
void register_term(detail::core_terminal_t &obj);
|
||||||
|
|
||||||
@ -235,13 +235,13 @@ namespace netlist
|
|||||||
void register_param(const pstring ¶m, const pstring &value);
|
void register_param(const pstring ¶m, const pstring &value);
|
||||||
void register_param(const pstring ¶m, const double value);
|
void register_param(const pstring ¶m, const double value);
|
||||||
|
|
||||||
void register_frontier(const pstring attach, const double r_IN, const double r_OUT);
|
void register_frontier(const pstring &attach, const double r_IN, const double r_OUT);
|
||||||
|
|
||||||
void remove_connections(const pstring attach);
|
void remove_connections(const pstring &attach);
|
||||||
|
|
||||||
bool connect(detail::core_terminal_t &t1, detail::core_terminal_t &t2);
|
bool connect(detail::core_terminal_t &t1, detail::core_terminal_t &t2);
|
||||||
|
|
||||||
bool device_exists(const pstring name) const;
|
bool device_exists(const pstring &name) const;
|
||||||
|
|
||||||
param_t *find_param(const pstring ¶m_in, bool required = true) const;
|
param_t *find_param(const pstring ¶m_in, bool required = true) const;
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ namespace netlist
|
|||||||
|
|
||||||
void include(const pstring &netlist_name);
|
void include(const pstring &netlist_name);
|
||||||
|
|
||||||
std::unique_ptr<plib::pistream> get_data_stream(const pstring name);
|
std::unique_ptr<plib::pistream> get_data_stream(const pstring &name);
|
||||||
|
|
||||||
bool parse_stream(plib::putf8_reader &istrm, const pstring &name);
|
bool parse_stream(plib::putf8_reader &istrm, const pstring &name);
|
||||||
|
|
||||||
|
@ -48,9 +48,10 @@ size_t mempool::new_block()
|
|||||||
size_t mempool::mininfosize()
|
size_t mempool::mininfosize()
|
||||||
{
|
{
|
||||||
size_t sinfo = sizeof(mempool::info);
|
size_t sinfo = sizeof(mempool::info);
|
||||||
size_t ma = 8;
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
ma = 16;
|
size_t ma = 16;
|
||||||
|
#else
|
||||||
|
size_t ma = 8;
|
||||||
#endif
|
#endif
|
||||||
return ((std::max(m_min_align, sinfo) + ma - 1) / ma) * ma;
|
return ((std::max(m_min_align, sinfo) + ma - 1) / ma) * ma;
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ namespace plib {
|
|||||||
// Exceptions
|
// Exceptions
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
pexception::pexception(const pstring text)
|
pexception::pexception(const pstring &text)
|
||||||
|
: m_text(text)
|
||||||
{
|
{
|
||||||
m_text = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pexception::~pexception() noexcept
|
pexception::~pexception() noexcept
|
||||||
|
@ -20,7 +20,7 @@ namespace plib {
|
|||||||
class pexception : public std::exception
|
class pexception : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit pexception(const pstring text);
|
explicit pexception(const pstring &text);
|
||||||
pexception(const pexception &e) : std::exception(e), m_text(e.m_text) { }
|
pexception(const pexception &e) : std::exception(e), m_text(e.m_text) { }
|
||||||
|
|
||||||
virtual ~pexception() noexcept;
|
virtual ~pexception() noexcept;
|
||||||
|
@ -21,7 +21,7 @@ plog_dispatch_intf::~plog_dispatch_intf()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pfmt::pfmt(const pstring fmt)
|
pfmt::pfmt(const pstring &fmt)
|
||||||
: m_str(m_str_buf), m_allocated(0), m_arg(0)
|
: m_str(m_str_buf), m_allocated(0), m_arg(0)
|
||||||
{
|
{
|
||||||
std::size_t l = fmt.blen() + 1;
|
std::size_t l = fmt.blen() + 1;
|
||||||
|
@ -164,7 +164,7 @@ protected:
|
|||||||
class pfmt : public pformat_base<pfmt>
|
class pfmt : public pformat_base<pfmt>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit pfmt(const pstring fmt);
|
explicit pfmt(const pstring &fmt);
|
||||||
virtual ~pfmt();
|
virtual ~pfmt();
|
||||||
|
|
||||||
operator pstring() const { return pstring(m_str, pstring::UTF8); }
|
operator pstring() const { return pstring(m_str, pstring::UTF8); }
|
||||||
@ -194,42 +194,42 @@ public:
|
|||||||
|
|
||||||
/* runtime enable */
|
/* runtime enable */
|
||||||
template<bool enabled, typename... Args>
|
template<bool enabled, typename... Args>
|
||||||
void log(const pstring fmt, Args&&... args) const
|
void log(const pstring & fmt, Args&&... args) const
|
||||||
{
|
{
|
||||||
if (build_enabled && enabled && m_enabled) (*this)(fmt, std::forward<Args>(args)...);
|
if (build_enabled && enabled && m_enabled) (*this)(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator ()(const pstring fmt) const
|
void operator ()(const pstring &fmt) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(fmt);
|
if (build_enabled && m_enabled) vdowrite(fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1>
|
template<typename T1>
|
||||||
void operator ()(const pstring fmt, const T1 &v1) const
|
void operator ()(const pstring &fmt, const T1 &v1) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1));
|
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
void operator ()(const pstring fmt, const T1 &v1, const T2 &v2) const
|
void operator ()(const pstring &fmt, const T1 &v1, const T2 &v2) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2));
|
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3>
|
template<typename T1, typename T2, typename T3>
|
||||||
void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3) const
|
void operator ()(const pstring &fmt, const T1 &v1, const T2 &v2, const T3 &v3) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3));
|
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4>
|
template<typename T1, typename T2, typename T3, typename T4>
|
||||||
void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) const
|
void operator ()(const pstring &fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4));
|
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||||
void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) const
|
void operator ()(const pstring &fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) const
|
||||||
{
|
{
|
||||||
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)(v5));
|
if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)(v5));
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
namespace plib {
|
namespace plib {
|
||||||
|
|
||||||
void pfunction::compile(const std::vector<pstring> &inputs, const pstring expr)
|
void pfunction::compile(const std::vector<pstring> &inputs, const pstring &expr)
|
||||||
{
|
{
|
||||||
if (expr.startsWith("rpn:"))
|
if (expr.startsWith("rpn:"))
|
||||||
compile_postfix(inputs, expr.substr(4));
|
compile_postfix(inputs, expr.substr(4));
|
||||||
@ -23,14 +23,14 @@ void pfunction::compile(const std::vector<pstring> &inputs, const pstring expr)
|
|||||||
compile_infix(inputs, expr);
|
compile_infix(inputs, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pfunction::compile_postfix(const std::vector<pstring> &inputs, const pstring expr)
|
void pfunction::compile_postfix(const std::vector<pstring> &inputs, const pstring &expr)
|
||||||
{
|
{
|
||||||
std::vector<pstring> cmds(plib::psplit(expr, " "));
|
std::vector<pstring> cmds(plib::psplit(expr, " "));
|
||||||
compile_postfix(inputs, cmds, expr);
|
compile_postfix(inputs, cmds, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pfunction::compile_postfix(const std::vector<pstring> &inputs,
|
void pfunction::compile_postfix(const std::vector<pstring> &inputs,
|
||||||
const std::vector<pstring> &cmds, const pstring expr)
|
const std::vector<pstring> &cmds, const pstring &expr)
|
||||||
{
|
{
|
||||||
m_precompiled.clear();
|
m_precompiled.clear();
|
||||||
int stk = 0;
|
int stk = 0;
|
||||||
@ -107,7 +107,7 @@ static pstring pop_check(std::stack<pstring> &stk, const pstring &expr)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pfunction::compile_infix(const std::vector<pstring> &inputs, const pstring expr)
|
void pfunction::compile_infix(const std::vector<pstring> &inputs, const pstring &expr)
|
||||||
{
|
{
|
||||||
// Shunting-yard infix parsing
|
// Shunting-yard infix parsing
|
||||||
std::vector<pstring> sep = {"(", ")", ",", "*", "/", "+", "-", "^"};
|
std::vector<pstring> sep = {"(", ")", ",", "*", "/", "+", "-", "^"};
|
||||||
|
@ -52,20 +52,20 @@ namespace plib {
|
|||||||
* @param expr infix or postfix expression. default is infix, postrix
|
* @param expr infix or postfix expression. default is infix, postrix
|
||||||
* to be prefixed with rpn, e.g. "rpn:A B + 1.3 /"
|
* to be prefixed with rpn, e.g. "rpn:A B + 1.3 /"
|
||||||
*/
|
*/
|
||||||
void compile(const std::vector<pstring> &inputs, const pstring expr);
|
void compile(const std::vector<pstring> &inputs, const pstring &expr);
|
||||||
|
|
||||||
/*! Compile a rpn expression
|
/*! Compile a rpn expression
|
||||||
*
|
*
|
||||||
* @param inputs Vector of input variables, e.g. {"A","B"}
|
* @param inputs Vector of input variables, e.g. {"A","B"}
|
||||||
* @param expr Reverse polish notation expression, e.g. "A B + 1.3 /"
|
* @param expr Reverse polish notation expression, e.g. "A B + 1.3 /"
|
||||||
*/
|
*/
|
||||||
void compile_postfix(const std::vector<pstring> &inputs, const pstring expr);
|
void compile_postfix(const std::vector<pstring> &inputs, const pstring &expr);
|
||||||
/*! Compile an infix expression
|
/*! Compile an infix expression
|
||||||
*
|
*
|
||||||
* @param inputs Vector of input variables, e.g. {"A","B"}
|
* @param inputs Vector of input variables, e.g. {"A","B"}
|
||||||
* @param expr Infix expression, e.g. "(A+B)/1.3"
|
* @param expr Infix expression, e.g. "(A+B)/1.3"
|
||||||
*/
|
*/
|
||||||
void compile_infix(const std::vector<pstring> &inputs, const pstring expr);
|
void compile_infix(const std::vector<pstring> &inputs, const pstring &expr);
|
||||||
/*! Evaluate the expression
|
/*! Evaluate the expression
|
||||||
*
|
*
|
||||||
* @param values for input variables, e.g. {1.1, 2.2}
|
* @param values for input variables, e.g. {1.1, 2.2}
|
||||||
@ -76,7 +76,7 @@ namespace plib {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void compile_postfix(const std::vector<pstring> &inputs,
|
void compile_postfix(const std::vector<pstring> &inputs,
|
||||||
const std::vector<pstring> &cmds, const pstring expr);
|
const std::vector<pstring> &cmds, const pstring &expr);
|
||||||
|
|
||||||
std::vector<rpn_inst> m_precompiled; //!< precompiled expression
|
std::vector<rpn_inst> m_precompiled; //!< precompiled expression
|
||||||
};
|
};
|
||||||
|
@ -107,8 +107,8 @@ class option_str_limit : public option
|
|||||||
public:
|
public:
|
||||||
option_str_limit(options &parent, pstring ashort, pstring along, pstring defval, pstring limit, pstring help)
|
option_str_limit(options &parent, pstring ashort, pstring along, pstring defval, pstring limit, pstring help)
|
||||||
: option(parent, ashort, along, help, true), m_val(defval)
|
: option(parent, ashort, along, help, true), m_val(defval)
|
||||||
|
, m_limit(plib::psplit(limit, ":"))
|
||||||
{
|
{
|
||||||
m_limit = plib::psplit(limit, ":");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pstring operator ()() { return m_val; }
|
pstring operator ()() { return m_val; }
|
||||||
|
@ -80,7 +80,7 @@ void ptokenizer::require_token(const token_id_t &token_num)
|
|||||||
require_token(get_token(), token_num);
|
require_token(get_token(), token_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ptokenizer::require_token(const token_t tok, const token_id_t &token_num)
|
void ptokenizer::require_token(const token_t &tok, const token_id_t &token_num)
|
||||||
{
|
{
|
||||||
if (!tok.is(token_num))
|
if (!tok.is(token_num))
|
||||||
{
|
{
|
||||||
@ -385,7 +385,7 @@ ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name)
|
|||||||
pstring ppreprocessor::replace_macros(const pstring &line)
|
pstring ppreprocessor::replace_macros(const pstring &line)
|
||||||
{
|
{
|
||||||
std::vector<pstring> elems(psplit(line, m_expr_sep));
|
std::vector<pstring> elems(psplit(line, m_expr_sep));
|
||||||
pstringbuffer ret = "";
|
pstringbuffer ret("");
|
||||||
for (auto & elem : elems)
|
for (auto & elem : elems)
|
||||||
{
|
{
|
||||||
define_t *def = get_define(elem);
|
define_t *def = get_define(elem);
|
||||||
@ -399,7 +399,7 @@ pstring ppreprocessor::replace_macros(const pstring &line)
|
|||||||
|
|
||||||
static pstring catremainder(const std::vector<pstring> &elems, std::size_t start, pstring sep)
|
static pstring catremainder(const std::vector<pstring> &elems, std::size_t start, pstring sep)
|
||||||
{
|
{
|
||||||
pstringbuffer ret = "";
|
pstringbuffer ret("");
|
||||||
for (auto & elem : elems)
|
for (auto & elem : elems)
|
||||||
{
|
{
|
||||||
ret.cat(elem);
|
ret.cat(elem);
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
static const std::size_t npos = static_cast<std::size_t>(-1);
|
static const std::size_t npos = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
token_id_t() : m_id(npos) {}
|
token_id_t() : m_id(npos) {}
|
||||||
token_id_t(const std::size_t id) : m_id(id) {}
|
explicit token_id_t(const std::size_t id) : m_id(id) {}
|
||||||
std::size_t id() const { return m_id; }
|
std::size_t id() const { return m_id; }
|
||||||
private:
|
private:
|
||||||
std::size_t m_id;
|
std::size_t m_id;
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
struct token_t
|
struct token_t
|
||||||
{
|
{
|
||||||
token_t(token_type type)
|
explicit token_t(token_type type)
|
||||||
: m_type(type), m_id(), m_token("")
|
: m_type(type), m_id(), m_token("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
: m_type(type), m_id(), m_token(str)
|
: m_type(type), m_id(), m_token(str)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
token_t(const token_id_t id, const pstring &str)
|
token_t(const token_id_t &id, const pstring &str)
|
||||||
: m_type(TOKEN), m_id(id), m_token(str)
|
: m_type(TOKEN), m_id(id), m_token(str)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
long get_number_long();
|
long get_number_long();
|
||||||
|
|
||||||
void require_token(const token_id_t &token_num);
|
void require_token(const token_id_t &token_num);
|
||||||
void require_token(const token_t tok, const token_id_t &token_num);
|
void require_token(const token_t &tok, const token_id_t &token_num);
|
||||||
|
|
||||||
token_id_t register_token(pstring token)
|
token_id_t register_token(pstring token)
|
||||||
{
|
{
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
pstring m_replace;
|
pstring m_replace;
|
||||||
};
|
};
|
||||||
|
|
||||||
ppreprocessor(std::vector<define_t> *defines = nullptr);
|
explicit ppreprocessor(std::vector<define_t> *defines = nullptr);
|
||||||
virtual ~ppreprocessor() {}
|
virtual ~ppreprocessor() {}
|
||||||
|
|
||||||
void process(putf8_reader &istrm, putf8_writer &ostrm);
|
void process(putf8_reader &istrm, putf8_writer &ostrm);
|
||||||
|
@ -21,7 +21,7 @@ state_manager_t::~state_manager_t()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, const datatype_t dt, const std::size_t count, void *ptr)
|
void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, const datatype_t &dt, const std::size_t count, void *ptr)
|
||||||
{
|
{
|
||||||
auto p = plib::make_unique<entry_t>(stname, dt, owner, count, ptr);
|
auto p = plib::make_unique<entry_t>(stname, dt, owner, count, ptr);
|
||||||
m_save.push_back(std::move(p));
|
m_save.push_back(std::move(p));
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
{
|
{
|
||||||
using list_t = std::vector<std::unique_ptr<entry_t>>;
|
using list_t = std::vector<std::unique_ptr<entry_t>>;
|
||||||
|
|
||||||
entry_t(const pstring &stname, const datatype_t dt, const void *owner,
|
entry_t(const pstring &stname, const datatype_t &dt, const void *owner,
|
||||||
const std::size_t count, void *ptr)
|
const std::size_t count, void *ptr)
|
||||||
: m_name(stname), m_dt(dt), m_owner(owner), m_callback(nullptr), m_count(count), m_ptr(ptr) { }
|
: m_name(stname), m_dt(dt), m_owner(owner), m_callback(nullptr), m_count(count), m_ptr(ptr) { }
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
const entry_t::list_t &save_list() const { return m_save; }
|
const entry_t::list_t &save_list() const { return m_save; }
|
||||||
|
|
||||||
void save_state_ptr(const void *owner, const pstring &stname, const datatype_t dt, const std::size_t count, void *ptr);
|
void save_state_ptr(const void *owner, const pstring &stname, const datatype_t &dt, const std::size_t count, void *ptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ pifilestream::pifilestream(const pstring &fname)
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
pifilestream::pifilestream(void *file, const pstring name, const bool do_close)
|
pifilestream::pifilestream(void *file, const pstring &name, const bool do_close)
|
||||||
: pistream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
|
: pistream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
|
||||||
{
|
{
|
||||||
if (m_file == nullptr)
|
if (m_file == nullptr)
|
||||||
@ -155,7 +155,7 @@ pofilestream::pofilestream(const pstring &fname)
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
pofilestream::pofilestream(void *file, const pstring name, const bool do_close)
|
pofilestream::pofilestream(void *file, const pstring &name, const bool do_close)
|
||||||
: postream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
|
: postream(0), m_file(file), m_pos(0), m_actually_close(do_close), m_filename(name)
|
||||||
{
|
{
|
||||||
if (m_file == nullptr)
|
if (m_file == nullptr)
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
virtual ~pofilestream();
|
virtual ~pofilestream();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
pofilestream(void *file, const pstring name, const bool do_close);
|
pofilestream(void *file, const pstring &name, const bool do_close);
|
||||||
/* write n bytes to stream */
|
/* write n bytes to stream */
|
||||||
virtual void vwrite(const void *buf, const pos_type n) override;
|
virtual void vwrite(const void *buf, const pos_type n) override;
|
||||||
virtual void vseek(const pos_type n) override;
|
virtual void vseek(const pos_type n) override;
|
||||||
@ -224,7 +224,7 @@ public:
|
|||||||
virtual ~pifilestream();
|
virtual ~pifilestream();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
pifilestream(void *file, const pstring name, const bool do_close);
|
pifilestream(void *file, const pstring &name, const bool do_close);
|
||||||
|
|
||||||
/* read up to n bytes from stream */
|
/* read up to n bytes from stream */
|
||||||
virtual pos_type vread(void *buf, const pos_type n) override;
|
virtual pos_type vread(void *buf, const pos_type n) override;
|
||||||
@ -284,7 +284,7 @@ private:
|
|||||||
class pistringstream : public pimemstream
|
class pistringstream : public pimemstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pistringstream(const pstring &str) : pimemstream(str.c_str(), str.len()), m_str(str) { }
|
explicit pistringstream(const pstring &str) : pimemstream(str.c_str(), str.len()), m_str(str) { }
|
||||||
virtual ~pistringstream();
|
virtual ~pistringstream();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -389,14 +389,14 @@ public:
|
|||||||
m_strm.write(&val, sizeof(T));
|
m_strm.write(&val, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(const pstring s)
|
void write(const pstring &s)
|
||||||
{
|
{
|
||||||
write(s.blen());
|
write(s.blen());
|
||||||
m_strm.write(s.c_str(), s.blen());
|
m_strm.write(s.c_str(), s.blen());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void write(const std::vector<T> val)
|
void write(const std::vector<T> &val)
|
||||||
{
|
{
|
||||||
std::size_t sz = val.size();
|
std::size_t sz = val.size();
|
||||||
write(sz);
|
write(sz);
|
||||||
|
@ -104,7 +104,7 @@ void pstring_t<F>::pcopy(const mem_t *from, std::size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
const pstring_t<F> pstring_t<F>::substr(const iterator start, const iterator end) const
|
const pstring_t<F> pstring_t<F>::substr(const iterator &start, const iterator &end) const
|
||||||
{
|
{
|
||||||
pstring_t ret;
|
pstring_t ret;
|
||||||
//FIXME: throw ?
|
//FIXME: throw ?
|
||||||
@ -167,7 +167,7 @@ typename pstring_t<F>::iterator pstring_t<F>::find_last_not_of(const pstring_t &
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t search, iterator start) const
|
typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t &search, iterator start) const
|
||||||
{
|
{
|
||||||
for (; start != end(); ++start)
|
for (; start != end(); ++start)
|
||||||
{
|
{
|
||||||
@ -213,13 +213,13 @@ pstring_t<F> pstring_t<F>::replace(const pstring_t &search, const pstring_t &rep
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
const pstring_t<F> pstring_t<F>::ltrim(const pstring_t ws) const
|
const pstring_t<F> pstring_t<F>::ltrim(const pstring_t &ws) const
|
||||||
{
|
{
|
||||||
return substr(find_first_not_of(ws), end());
|
return substr(find_first_not_of(ws), end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
const pstring_t<F> pstring_t<F>::rtrim(const pstring_t ws) const
|
const pstring_t<F> pstring_t<F>::rtrim(const pstring_t &ws) const
|
||||||
{
|
{
|
||||||
auto f = find_last_not_of(ws);
|
auto f = find_last_not_of(ws);
|
||||||
if (f==end())
|
if (f==end())
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
struct pstr_t
|
struct pstr_t
|
||||||
{
|
{
|
||||||
pstr_t(const std::size_t alen) { init(alen); }
|
explicit pstr_t(const std::size_t alen) { init(alen); }
|
||||||
void init(const std::size_t alen)
|
void init(const std::size_t alen)
|
||||||
{
|
{
|
||||||
m_ref_count = 1;
|
m_ref_count = 1;
|
||||||
@ -141,13 +141,13 @@ public:
|
|||||||
pstring_t& operator+=(const code_t c) { mem_t buf[traits::MAXCODELEN+1] = { 0 }; traits::encode(c, buf); pcat(buf); return *this; }
|
pstring_t& operator+=(const code_t c) { mem_t buf[traits::MAXCODELEN+1] = { 0 }; traits::encode(c, buf); pcat(buf); return *this; }
|
||||||
friend pstring_t operator+(const pstring_t &lhs, const code_t rhs) { return pstring_t(lhs) += rhs; }
|
friend pstring_t operator+(const pstring_t &lhs, const code_t rhs) { return pstring_t(lhs) += rhs; }
|
||||||
|
|
||||||
iterator find(const pstring_t search, iterator start) const;
|
iterator find(const pstring_t &search, iterator start) const;
|
||||||
iterator find(const pstring_t search) const { return find(search, begin()); }
|
iterator find(const pstring_t &search) const { return find(search, begin()); }
|
||||||
iterator find(const code_t search, iterator start) const;
|
iterator find(const code_t search, iterator start) const;
|
||||||
iterator find(const code_t search) const { return find(search, begin()); }
|
iterator find(const code_t search) const { return find(search, begin()); }
|
||||||
|
|
||||||
const pstring_t substr(const iterator start, const iterator end) const ;
|
const pstring_t substr(const iterator &start, const iterator &end) const ;
|
||||||
const pstring_t substr(const iterator start) const { return substr(start, end()); }
|
const pstring_t substr(const iterator &start) const { return substr(start, end()); }
|
||||||
const pstring_t substr(size_type start) const { return (start >= len()) ? pstring_t("") : substr(begin() + start, end()); }
|
const pstring_t substr(size_type start) const { return (start >= len()) ? pstring_t("") : substr(begin() + start, end()); }
|
||||||
|
|
||||||
const pstring_t left(iterator leftof) const { return substr(begin(), leftof); }
|
const pstring_t left(iterator leftof) const { return substr(begin(), leftof); }
|
||||||
@ -156,9 +156,9 @@ public:
|
|||||||
iterator find_first_not_of(const pstring_t &no) const;
|
iterator find_first_not_of(const pstring_t &no) const;
|
||||||
iterator find_last_not_of(const pstring_t &no) const;
|
iterator find_last_not_of(const pstring_t &no) const;
|
||||||
|
|
||||||
const pstring_t ltrim(const pstring_t ws = pstring_t(" \t\n\r")) const;
|
const pstring_t ltrim(const pstring_t &ws = pstring_t(" \t\n\r")) const;
|
||||||
const pstring_t rtrim(const pstring_t ws = pstring_t(" \t\n\r")) const;
|
const pstring_t rtrim(const pstring_t &ws = pstring_t(" \t\n\r")) const;
|
||||||
const pstring_t trim(const pstring_t ws = pstring_t(" \t\n\r")) const { return this->ltrim(ws).rtrim(ws); }
|
const pstring_t trim(const pstring_t &ws = pstring_t(" \t\n\r")) const { return this->ltrim(ws).rtrim(ws); }
|
||||||
|
|
||||||
const pstring_t rpad(const pstring_t &ws, const size_type cnt) const;
|
const pstring_t rpad(const pstring_t &ws, const size_type cnt) const;
|
||||||
|
|
||||||
@ -339,8 +339,8 @@ public:
|
|||||||
~pstringbuffer();
|
~pstringbuffer();
|
||||||
|
|
||||||
// construction with copy
|
// construction with copy
|
||||||
pstringbuffer(const char *string) {init(); if (string != nullptr) pcopy(string); }
|
explicit pstringbuffer(const char *string) {init(); if (string != nullptr) pcopy(string); }
|
||||||
pstringbuffer(const pstring &string) {init(); pcopy(string); }
|
explicit pstringbuffer(const pstring &string) {init(); pcopy(string); }
|
||||||
pstringbuffer(const pstringbuffer &stringb) {init(); pcopy(stringb); }
|
pstringbuffer(const pstringbuffer &stringb) {init(); pcopy(stringb); }
|
||||||
pstringbuffer(pstringbuffer &&b) : m_ptr(b.m_ptr), m_size(b.m_size), m_len(b.m_len) { b.m_ptr = nullptr; b.m_size = 0; b.m_len = 0; }
|
pstringbuffer(pstringbuffer &&b) : m_ptr(b.m_ptr), m_size(b.m_size), m_len(b.m_len) { b.m_ptr = nullptr; b.m_size = 0; b.m_len = 0; }
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace plib
|
|||||||
template <class C>
|
template <class C>
|
||||||
struct indexed_compare
|
struct indexed_compare
|
||||||
{
|
{
|
||||||
indexed_compare(const C& target): m_target(target) {}
|
explicit indexed_compare(const C& target): m_target(target) {}
|
||||||
|
|
||||||
bool operator()(int a, int b) const { return m_target[a] < m_target[b]; }
|
bool operator()(int a, int b) const { return m_target[a] < m_target[b]; }
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private:
|
|||||||
void run();
|
void run();
|
||||||
void static_compile();
|
void static_compile();
|
||||||
|
|
||||||
void mac_out(const pstring s, const bool cont = true);
|
void mac_out(const pstring &s, const bool cont = true);
|
||||||
void cmac(const netlist::factory::element_t *e);
|
void cmac(const netlist::factory::element_t *e);
|
||||||
void mac(const netlist::factory::element_t *e);
|
void mac(const netlist::factory::element_t *e);
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ std::unique_ptr<plib::pistream> netlist_data_folder_t::stream(const pstring &fil
|
|||||||
auto strm = plib::make_unique_base<plib::pistream, plib::pifilestream>(name);
|
auto strm = plib::make_unique_base<plib::pistream, plib::pifilestream>(name);
|
||||||
return strm;
|
return strm;
|
||||||
}
|
}
|
||||||
catch (plib::pexception e)
|
catch (const plib::pexception &e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ void tool_app_t::static_compile()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tool_app_t::mac_out(const pstring s, const bool cont)
|
void tool_app_t::mac_out(const pstring &s, const bool cont)
|
||||||
{
|
{
|
||||||
static const unsigned RIGHT = 72;
|
static const unsigned RIGHT = 72;
|
||||||
if (cont)
|
if (cont)
|
||||||
|
@ -28,7 +28,7 @@ struct mat_cr_t
|
|||||||
std::size_t size;
|
std::size_t size;
|
||||||
std::size_t nz_num;
|
std::size_t nz_num;
|
||||||
|
|
||||||
mat_cr_t(const std::size_t n)
|
explicit mat_cr_t(const std::size_t n)
|
||||||
: size(n)
|
: size(n)
|
||||||
, nz_num(0)
|
, nz_num(0)
|
||||||
{
|
{
|
||||||
|
@ -404,7 +404,7 @@ void matrix_solver_t::step(const netlist_time &delta)
|
|||||||
|
|
||||||
void matrix_solver_t::solve_base()
|
void matrix_solver_t::solve_base()
|
||||||
{
|
{
|
||||||
m_stat_vsolver_calls++;
|
++m_stat_vsolver_calls;
|
||||||
if (has_dynamic_devices())
|
if (has_dynamic_devices())
|
||||||
{
|
{
|
||||||
unsigned this_resched;
|
unsigned this_resched;
|
||||||
|
@ -56,6 +56,7 @@ NETLIB_OBJECT(solver)
|
|||||||
, m_dynamic_min_ts(*this, "DYNAMIC_MIN_TIMESTEP", 1e-6) // nl_double timestep resolution
|
, m_dynamic_min_ts(*this, "DYNAMIC_MIN_TIMESTEP", 1e-6) // nl_double timestep resolution
|
||||||
|
|
||||||
, m_log_stats(*this, "LOG_STATS", 1) // nl_double timestep resolution
|
, m_log_stats(*this, "LOG_STATS", 1) // nl_double timestep resolution
|
||||||
|
, m_params()
|
||||||
{
|
{
|
||||||
// internal staff
|
// internal staff
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ struct lib_map_entry
|
|||||||
|
|
||||||
using lib_map_t = std::unordered_map<pstring, lib_map_entry>;
|
using lib_map_t = std::unordered_map<pstring, lib_map_entry>;
|
||||||
|
|
||||||
static lib_map_t read_lib_map(const pstring lm)
|
static lib_map_t read_lib_map(const pstring &lm)
|
||||||
{
|
{
|
||||||
plib::pistringstream istrm(lm);
|
plib::pistringstream istrm(lm);
|
||||||
plib::putf8_reader reader(istrm);
|
plib::putf8_reader reader(istrm);
|
||||||
@ -305,7 +305,7 @@ void nl_convert_spice_t::process_line(const pstring &line)
|
|||||||
/* check for fourth terminal ... should be numeric net
|
/* check for fourth terminal ... should be numeric net
|
||||||
* including "0" or start with "N" (ltspice)
|
* including "0" or start with "N" (ltspice)
|
||||||
*/
|
*/
|
||||||
ATTR_UNUSED long nval =tt[4].as_long(&cerr);
|
ATTR_UNUSED long nval(tt[4].as_long(&cerr));
|
||||||
pstring model;
|
pstring model;
|
||||||
pstring pins ="CBE";
|
pstring pins ="CBE";
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ private:
|
|||||||
struct net_t
|
struct net_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
net_t(const pstring &aname)
|
explicit net_t(const pstring &aname)
|
||||||
: m_name(aname), m_no_export(false) {}
|
: m_name(aname), m_no_export(false) {}
|
||||||
|
|
||||||
const pstring &name() { return m_name;}
|
const pstring &name() { return m_name;}
|
||||||
|
Loading…
Reference in New Issue
Block a user