This commit is contained in:
arbee 2019-03-16 22:22:21 -04:00
commit 57d3501c82
3 changed files with 61 additions and 58 deletions

View File

@ -702,7 +702,7 @@ namespace netlist
template <typename T> template <typename T>
void process(const T mask, netlist_sig_t sig); void process(const T mask, netlist_sig_t sig);
}; };
} // detail } // namespace detail
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// analog_t // analog_t

View File

@ -288,11 +288,6 @@ void setup_t::register_term(detail::core_terminal_t &term)
log().debug("{1} {2}\n", termtype_as_str(term), term.name()); log().debug("{1} {2}\n", termtype_as_str(term), term.name());
} }
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);

View File

@ -23,15 +23,17 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
{ {
va_list ap; va_list ap;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
va_start(ap, cfmt_spec);
pstring fmt("%");
std::array<char, 2048> buf; std::array<char, 2048> buf;
std::size_t sl; std::size_t sl;
bool found_abs = false;
buf[0] = 0;
m_arg++; m_arg++;
do {
pstring fmt("%");
va_start(ap, cfmt_spec);
found_abs = false;
buf[0] = 0;
pstring search("{"); pstring search("{");
search += plib::to_string(m_arg); search += plib::to_string(m_arg);
sl = search.size(); sl = search.size();
@ -46,10 +48,13 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
sl = 2; sl = 2;
p = m_str.find("{}"); p = m_str.find("{}");
} }
else
// found absolute positional place holder
found_abs = true;
if (p == pstring::npos) if (p == pstring::npos)
{ {
sl=1; sl=2;
p = m_str.find("{"); p = m_str.find("{:");
if (p != pstring:: npos) if (p != pstring:: npos)
{ {
auto p1 = m_str.find("}", p); auto p1 = m_str.find("}", p);
@ -63,11 +68,13 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
} }
else else
{ {
// found absolute positional place holder
auto p1 = m_str.find("}", p); auto p1 = m_str.find("}", p);
if (p1 != pstring::npos) if (p1 != pstring::npos)
{ {
sl = p1 - p + 1; sl = p1 - p + 1;
fmt += ((m_arg>=10) ? m_str.substr(p+4, p1 - p - 4) : m_str.substr(p+3, p1 - p - 3)); fmt += ((m_arg>=10) ? m_str.substr(p+4, p1 - p - 4) : m_str.substr(p+3, p1 - p - 3));
found_abs = true;
} }
} }
pstring::value_type pend = fmt.at(fmt.size() - 1); pstring::value_type pend = fmt.at(fmt.size() - 1);
@ -89,6 +96,7 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
if (p != pstring::npos) if (p != pstring::npos)
m_str = m_str.substr(0, p) + pstring(buf.data()) + m_str.substr(p + sl); m_str = m_str.substr(0, p) + pstring(buf.data()) + m_str.substr(p + sl);
va_end(ap); va_end(ap);
} while (found_abs);
return *this; return *this;
} }