diff options
author | 2019-10-18 17:57:55 +0200 | |
---|---|---|
committer | 2019-10-18 17:57:55 +0200 | |
commit | b09fa00cca1a9baa0327a33d865fc970f77d4db0 (patch) | |
tree | 47dd943368aa43a0c0cf4256f88e590960c1e99f /src/lib/netlist/plib/pfmtlog.h | |
parent | ad27643c07d54fc2cc3e56327fe07335e7763d52 (diff) |
Netlist: code maintenance and improvements. [Couriersud]
- Added support for line markers to the preprocessor and parser.
- Added support for include processing to the preprocessor.
- Moved sources base type to plib to be used for preprocessor includes.
This enables to include e.g. from rom memory regions.
- Renamed some defines
Diffstat (limited to 'src/lib/netlist/plib/pfmtlog.h')
-rw-r--r-- | src/lib/netlist/plib/pfmtlog.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index 531b76fafe7..7bf10173857 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -227,7 +227,7 @@ protected: pstring::size_type p; pstring::size_type sl; char32_t pend; - pstring::size_type width; + int width; }; rtype setfmt(std::stringstream &strm, char32_t cfmt_spec); @@ -248,10 +248,14 @@ protected: strm << std::forward<T>(val); const pstring ps(strm.str()); pstring pad(""); - if (ret.width > ps.length()) - pad = pstring(ret.width - ps.length(), ' '); - - m_str = m_str.substr(0, ret.p) + pad + ps + m_str.substr(ret.p + ret.sl); + std::size_t aw(std::abs(ret.width)); + if (aw > ps.length()) + pad = pstring(aw - ps.length(), ' '); + + if (ret.width > 0) + m_str = m_str.substr(0, ret.p) + pad + ps + m_str.substr(ret.p + ret.sl); + else + m_str = m_str.substr(0, ret.p) + ps + pad + m_str.substr(ret.p + ret.sl); } } while (ret.ret == 1); |