diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-26 15:11:47 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-26 15:11:47 (GMT) |
commit | 0a22a276cfff2155cbaf4939d75c257dfdb46932 (patch) | |
tree | efd057b2bfee89557636819433bc7ecf932153cd /src/uscxml/debug | |
parent | f3e7f0bb9866edb30682b1e1b72db7c4f6946378 (diff) | |
download | uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.zip uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.tar.gz uscxml-0a22a276cfff2155cbaf4939d75c257dfdb46932.tar.bz2 |
Identify InterpreterIssues at runtime
Diffstat (limited to 'src/uscxml/debug')
-rw-r--r-- | src/uscxml/debug/InterpreterIssue.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/uscxml/debug/InterpreterIssue.cpp b/src/uscxml/debug/InterpreterIssue.cpp index 60f8f1b..fedb40f 100644 --- a/src/uscxml/debug/InterpreterIssue.cpp +++ b/src/uscxml/debug/InterpreterIssue.cpp @@ -407,7 +407,19 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in for (int i = 0; i < invokes.size(); i++) { Element<std::string> invoke = Element<std::string>(invokes[i]); if (HAS_ATTR(invoke, "type") && !_factory->hasInvoker(ATTR(invoke, "type"))) { - issues.push_back(InterpreterIssue("Invoke with unknown type '" + ATTR(invoke, "type") + "'", invoke, InterpreterIssue::USCXML_ISSUE_FATAL)); + // unknown at factory - adhoc extension? + if (HAS_ATTR(invoke, "id") && interpreter->_invokers.find(ATTR(invoke, "id")) != interpreter->_invokers.end()) + continue; // not an issue + + IssueSeverity severity; + if (HAS_ATTR(invoke, "idlocation")) { + // we might still resolve at runtime + severity = InterpreterIssue::USCXML_ISSUE_WARNING; + } else { + // fatality! + severity = InterpreterIssue::USCXML_ISSUE_FATAL; + } + issues.push_back(InterpreterIssue("Invoke with unknown type '" + ATTR(invoke, "type") + "'", invoke, severity)); continue; } } @@ -418,6 +430,9 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in for (int i = 0; i < sends.size(); i++) { Element<std::string> send = Element<std::string>(sends[i]); if (HAS_ATTR(send, "type") && !_factory->hasIOProcessor(ATTR(send, "type"))) { + if (interpreter->_ioProcessors.find(ATTR(send, "type")) != interpreter->_ioProcessors.end()) + continue; // not an issue, available ad-hoc + issues.push_back(InterpreterIssue("Send to unknown IO Processor '" + ATTR(send, "type") + "'", send, InterpreterIssue::USCXML_ISSUE_FATAL)); continue; } @@ -470,16 +485,18 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in } - // check that the datamodel is known - if (HAS_ATTR(_scxml, "datamodel")) { - if (!_factory->hasDataModel(ATTR(_scxml, "datamodel"))) { - issues.push_back(InterpreterIssue("SCXML document requires unknown datamodel '" + ATTR(_scxml, "datamodel") + "'", _scxml, InterpreterIssue::USCXML_ISSUE_FATAL)); - - // we cannot even check the rest as we require a datamodel - return issues; + // check that the datamodel is known if not already instantiated + if (!interpreter->_dataModel) { + if (HAS_ATTR(_scxml, "datamodel")) { + if (!_factory->hasDataModel(ATTR(_scxml, "datamodel"))) { + issues.push_back(InterpreterIssue("SCXML document requires unknown datamodel '" + ATTR(_scxml, "datamodel") + "'", _scxml, InterpreterIssue::USCXML_ISSUE_FATAL)); + + // we cannot even check the rest as we require a datamodel + return issues; + } } } - + bool instantiatedDataModel = false; // instantiate datamodel if not explicitly set if (!_dataModel) { |