diff options
Diffstat (limited to 'src/lib/netlist/nl_setup.cpp')
| -rw-r--r-- | src/lib/netlist/nl_setup.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 99fb8962546..afa4545e3b7 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -223,8 +223,8 @@ void setup_t::register_and_set_param(pstring name, param_t ¶m) static_cast<param_str_t &>(param).initial(val); } break; - default: - log().fatal("Parameter is not supported {1} : {2}\n", name, val); + //default: + // log().fatal("Parameter is not supported {1} : {2}\n", name, val); } } if (!m_params.insert({param.name(), param_ref_t(param.name(), param.device(), param)}).second) @@ -1002,6 +1002,23 @@ void setup_t::include(const pstring &netlist_name) log().fatal("unable to find {1} in source collection", netlist_name); } +bool setup_t::parse_stream(plib::pistream &istrm, const pstring &name) +{ + plib::pomemstream ostrm; + + plib::pimemstream istrm2(plib::ppreprocessor(&m_defines).process(istrm, ostrm)); + return parser_t(istrm2, *this).parse(name); +} + +void setup_t::register_define(pstring defstr) +{ + auto p = defstr.find("="); + if (p>0) + register_define(defstr.left(p), defstr.substr(p+1)); + else + register_define(defstr, "1"); +} + // ---------------------------------------------------------------------------------------- // base sources // ---------------------------------------------------------------------------------------- @@ -1009,28 +1026,19 @@ void setup_t::include(const pstring &netlist_name) bool source_string_t::parse(setup_t &setup, const pstring &name) { plib::pimemstream istrm(m_str.cstr(), m_str.len()); - plib::pomemstream ostrm; - - plib::pimemstream istrm2(plib::ppreprocessor().process(istrm, ostrm)); - return parser_t(istrm2, setup).parse(name); + return setup.parse_stream(istrm, name); } bool source_mem_t::parse(setup_t &setup, const pstring &name) { plib::pimemstream istrm(m_str.cstr(), m_str.len()); - plib::pomemstream ostrm; - - plib::pimemstream istrm2(plib::ppreprocessor().process(istrm, ostrm)); - return parser_t(istrm2, setup).parse(name); + return setup.parse_stream(istrm, name); } bool source_file_t::parse(setup_t &setup, const pstring &name) { plib::pifilestream istrm(m_filename); - plib::pomemstream ostrm; - - plib::pimemstream istrm2(plib::ppreprocessor().process(istrm, ostrm)); - return parser_t(istrm2, setup).parse(name); + return setup.parse_stream(istrm, name); } } |
