summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/ppreprocessor.cpp
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-05-06 22:43:32 +0200
committer couriersud <couriersud@gmx.org>2020-05-06 22:43:32 +0200
commit53ac38cf359dddc0937cc534e5150db60c0a110f (patch)
treecaa1c5ac7a5a95f2964e9234858e0e36d0566d12 /src/lib/netlist/plib/ppreprocessor.cpp
parent2dbdd730b1a789c62178ded66c173181592f51c7 (diff)
netlist: add elif processing to preprocessor. [Couriersud]
Diffstat (limited to 'src/lib/netlist/plib/ppreprocessor.cpp')
-rw-r--r--src/lib/netlist/plib/ppreprocessor.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp
index 089188f3106..d6126b68fea 100644
--- a/src/lib/netlist/plib/ppreprocessor.cpp
+++ b/src/lib/netlist/plib/ppreprocessor.cpp
@@ -484,6 +484,18 @@ namespace plib {
{
m_if_flag ^= (1 << m_if_level);
}
+ else if (lti[0] == "#elif")
+ {
+ m_if_flag ^= (1 << m_if_level);
+ lt = replace_macros(lt);
+ auto t(simple_iter<ppreprocessor>(this, tokenize(lt.substr(5), m_expr_sep, true, true)));
+ auto val = static_cast<int>(prepro_expr(t, 255));
+ t.skip_ws();
+ if (!t.eod())
+ error("found unprocessed content at end of line");
+ if (val == 0)
+ m_if_flag |= (1 << m_if_level);
+ }
else if (lti[0] == "#endif")
{
m_if_flag &= ~(1 << m_if_level);