summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pparser.cpp
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-02-04 00:27:23 +0100
committer couriersud <couriersud@gmx.org>2019-02-04 00:27:23 +0100
commitc87a487d6de35479210d36dcf53d2c96a478601a (patch)
treeedfe287e40924ec564646547d5897dbac2d3f01c /src/lib/netlist/plib/pparser.cpp
parent9b2c04fc9f7870ca6bf6c941d8bb68a2e2d6a408 (diff)
netlist: Refactoring and some functionality enhancements. (nw)
- Removed dead code. - nltool now adds a define NLTOOL_VERSION. This can be tested in netlists. It is used in kidniki to ensure I stop committing debug parameters. - Optimized the proposal for no-deactivate hints. - Documented in breakout that hints were manually optimized. - Minor optimizations in the order of 2% enhancement.
Diffstat (limited to 'src/lib/netlist/plib/pparser.cpp')
-rw-r--r--src/lib/netlist/plib/pparser.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp
index 48e29570b4c..d666ad11054 100644
--- a/src/lib/netlist/plib/pparser.cpp
+++ b/src/lib/netlist/plib/pparser.cpp
@@ -268,7 +268,7 @@ void ptokenizer::error(const pstring &errs)
// A simple preprocessor
// ----------------------------------------------------------------------------------------
-ppreprocessor::ppreprocessor(std::vector<define_t> *defines)
+ppreprocessor::ppreprocessor(defines_map_type *defines)
: pistream()
, m_ifflag(0)
, m_level(0)
@@ -292,12 +292,7 @@ ppreprocessor::ppreprocessor(std::vector<define_t> *defines)
m_defines.insert({"__PLIB_PREPROCESSOR__", define_t("__PLIB_PREPROCESSOR__", "1")});
if (defines != nullptr)
- {
- for (auto & p : *defines)
- {
- m_defines.insert({p.m_name, p});
- }
- }
+ m_defines = *defines;
}
void ppreprocessor::error(const pstring &err)
@@ -524,7 +519,10 @@ pstring ppreprocessor::process_line(pstring line)
}
}
else
- error(pfmt("unknown directive on line {1}: {2}")(m_lineno)(line));
+ {
+ if (m_ifflag == 0)
+ error(pfmt("unknown directive on line {1}: {2}")(m_lineno)(replace_macros(line)));
+ }
}
else
{