diff options
author | 2019-01-06 20:04:39 +0100 | |
---|---|---|
committer | 2019-01-06 20:04:39 +0100 | |
commit | 3c6d9ac9a02d721a3245c1725b29dd6c10ce3ea7 (patch) | |
tree | ca5c36f2dda58b039a9399215bf59fea5047c5d2 /src/lib/netlist/plib/pparser.cpp | |
parent | fc59d08474bd285c17829b6b984213ee89832f12 (diff) |
Code maintenance and fix for "pure virtual call" error. (nw)
Diffstat (limited to 'src/lib/netlist/plib/pparser.cpp')
-rw-r--r-- | src/lib/netlist/plib/pparser.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp index 1a4db5b816c..298fa589fba 100644 --- a/src/lib/netlist/plib/pparser.cpp +++ b/src/lib/netlist/plib/pparser.cpp @@ -375,10 +375,7 @@ double ppreprocessor::expr(const std::vector<pstring> &sexpr, std::size_t &start ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name) { auto idx = m_defines.find(name); - if (idx != m_defines.end()) - return &idx->second; - else - return nullptr; + return (idx != m_defines.end()) ? &idx->second : nullptr; } pstring ppreprocessor::replace_macros(const pstring &line) @@ -388,10 +385,7 @@ pstring ppreprocessor::replace_macros(const pstring &line) for (auto & elem : elems) { define_t *def = get_define(elem); - if (def != nullptr) - ret += def->m_replace; - else - ret += elem; + ret += (def != nullptr) ? def->m_replace : elem; } return ret; } @@ -409,11 +403,8 @@ static pstring catremainder(const std::vector<pstring> &elems, std::size_t start pstring ppreprocessor::process_line(const pstring &line) { - //pstring lt = plib::trim(plib::replace_all(line, pstring("\t"), pstring(" "))); - pstring a = plib::replace_all(line, pstring("\t"), pstring(" ")); - pstring lt = plib::trim(a); + pstring lt = plib::trim(plib::replace_all(line, pstring("\t"), pstring(" "))); pstring ret; - m_lineno++; // FIXME ... revise and extend macro handling if (plib::startsWith(lt, "#")) { @@ -477,9 +468,7 @@ pstring ppreprocessor::process_line(const pstring &line) { lt = replace_macros(lt); if (m_ifflag == 0) - { ret += lt; - } } return ret; } @@ -490,6 +479,7 @@ void ppreprocessor::process(putf8_reader &istrm, putf8_writer &ostrm) pstring line; while (istrm.readline(line)) { + m_lineno++; line = process_line(line); ostrm.writeline(line); } |