diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | src/qscxmlcpp/qscxmlcpp.cpp | 39 | ||||
-rw-r--r-- | src/qscxmllib/scxmlcppdumper.cpp | 25 | ||||
-rw-r--r-- | src/qscxmllib/scxmlparser.cpp | 75 | ||||
-rw-r--r-- | src/qscxmllib/scxmlparser.h | 39 | ||||
-rw-r--r-- | tests/3rdparty/scion.h | 278 | ||||
-rw-r--r-- | tests/scion/scion.pro | 106 | ||||
-rw-r--r-- | tests/scion/tst_scion.cpp | 3 | ||||
-rw-r--r-- | tests/testCpp/out.cpp | 22 | ||||
-rw-r--r-- | tests/testCpp/out.h | 5 |
10 files changed, 227 insertions, 368 deletions
@@ -17,5 +17,6 @@ qrc_*.cpp tst_scion .qmake.cache *.pch -compiled_tests.h +tests/scion/compiled_tests.h tests/scion/scxml +tests/scion/scion.h diff --git a/src/qscxmlcpp/qscxmlcpp.cpp b/src/qscxmlcpp/qscxmlcpp.cpp index 9e275e0..2a01e49 100644 --- a/src/qscxmlcpp/qscxmlcpp.cpp +++ b/src/qscxmlcpp/qscxmlcpp.cpp @@ -23,8 +23,6 @@ #include <QFile> #include <QFileInfo> -#include <iostream> - int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -33,6 +31,9 @@ int main(int argc, char *argv[]) usage += QStringLiteral(" [-classname <stateMachineClassName>] [-name-qobjects] <input.scxml>\n\n"); usage += QStringLiteral("compiles the given input.scxml file to a header and cpp file\n"); + QTextStream errs(stderr, QIODevice::WriteOnly); + QTextStream outs(stderr, QIODevice::WriteOnly); + Scxml::CppDumpOptions options; QString scxmlFileName; QString outFileName; @@ -57,18 +58,18 @@ int main(int argc, char *argv[]) } else if (scxmlFileName.isEmpty()) { scxmlFileName = arg; } else { - std::cerr << "Unexpected argument:" << arg.toStdString() - << usage.toStdString() << std::endl; + errs << QStringLiteral("Unexpected argument: %1").arg(arg) << endl; + errs << usage; exit(-1); } } if (scxmlFileName.isEmpty()) { - std::cerr << "No input filename given:" << usage.toStdString() << std::endl; + errs << QStringLiteral("Error: no input files.") << endl; exit(-2); } QFile file(scxmlFileName); if (!file.open(QFile::ReadOnly)) { - std::cerr << "Error: could not open input file " << scxmlFileName.toStdString(); + errs << QStringLiteral("Error: cannot open input file %1").arg(scxmlFileName); exit(-3); } if (outFileName.isEmpty()) @@ -81,27 +82,39 @@ int main(int argc, char *argv[]) QXmlStreamReader reader(&file); Scxml::ScxmlParser parser(&reader, Scxml::ScxmlParser::loaderForDir(QFileInfo(file.fileName()).absolutePath())); + parser.setFileName(file.fileName()); parser.parse(); + if (!parser.errors().isEmpty()) { + foreach (const Scxml::ErrorMessage &error, parser.errors()) { + errs << error.fileName + << QLatin1Char(':') + << error.line + << QLatin1Char(':') + << error.column + << QStringLiteral(": ") + << error.severityString() + << QStringLiteral(": ") + << error.msg + << endl; + } + } if (auto doc = parser.scxmlDocument()) { QFile outH(outHFileName); if (!outH.open(QFile::WriteOnly)) { - std::cerr << "Error: cannot open " << outH.fileName().toStdString() - << ": " << outH.errorString().toStdString() << usage.toStdString() << std::endl; + errs << QStringLiteral("Error: cannot open '%1': %2").arg(outH.fileName(), outH.errorString()) << endl; exit(-4); } QFile outCpp(outCppFileName); if (!outCpp.open(QFile::WriteOnly)) { - std::cerr << "Error: cannot open " << outCpp.fileName().toStdString() - << ": " << outCpp.errorString().toStdString() - << usage.toStdString() << std::endl; + errs << QStringLiteral("Error: cannot open '%1': %2").arg(outCpp.fileName(), outCpp.errorString()) << endl; exit(-5); } QTextStream h(&outH); QTextStream c(&outCpp); - Scxml::CppDumper dumper(h, c, outH.fileName(), options); + Scxml::CppDumper dumper(h, c, QFileInfo(outH).fileName(), options); dumper.dump(doc); outH.close(); outCpp.close(); @@ -109,6 +122,6 @@ int main(int argc, char *argv[]) return 0; } else { a.exit(); - return -1; + return -6; } } diff --git a/src/qscxmllib/scxmlcppdumper.cpp b/src/qscxmllib/scxmlcppdumper.cpp index ddca5d3..e66ecbf 100644 --- a/src/qscxmllib/scxmlcppdumper.cpp +++ b/src/qscxmllib/scxmlcppdumper.cpp @@ -608,7 +608,14 @@ private: if (!name.isEmpty()) return name; - name = CppDumper::mangleId(state->id); + QString id = state->id; + if (State *s = state->asState()) { + if (s->type == State::Initial) { + id = s->parent->asState()->id + QStringLiteral("_initial"); + } + } + + name = CppDumper::mangleId(id); m_mangledNames.insert(state, name); return name; } @@ -665,11 +672,13 @@ private: || event.startsWith(QStringLiteral("qevent."))) { continue; } + if (event.contains(QLatin1Char('*'))) + continue; - clazz.publicSlotDeclarations << QStringLiteral("void event_") + event.replace(QLatin1Char('.'), QLatin1Char('_')) + QStringLiteral("();"); + clazz.publicSlotDeclarations << QStringLiteral("void event_") + CppDumper::mangleId(event) + QStringLiteral("();"); clazz.publicSlotDefinitions << QStringLiteral("void ") + m_mainClassName + QStringLiteral("::event_") - + event.replace(QLatin1Char('.'), QLatin1Char('_')) + + CppDumper::mangleId(event) + QStringLiteral("()\n{ submitEvent(") + qba(event) + QStringLiteral("); }"); } @@ -700,9 +709,13 @@ void CppDumper::dump(DocumentModel::ScxmlDocument *doc) DumperVisitor(clazz, mainClassName, options).process(doc); // Generate the .h file: + const QString headerGuard = headerName.toUpper().replace(QLatin1Char('.'), QLatin1Char('_')); + h << QStringLiteral("#ifndef ") << headerGuard << endl + << QStringLiteral("#define ") << headerGuard << endl + << endl; h << l(headerStart); if (!options.namespaceName.isEmpty()) - h << l("namespace ") << options.namespaceName << l(" {") << endl; + h << l("namespace ") << options.namespaceName << l(" {") << endl << endl; h << l("class ") << mainClassName << l(" : public Scxml::StateTable\n{") << endl; h << QLatin1String(" Q_OBJECT\n\n"); h << QLatin1String("public:\n"); @@ -723,7 +736,9 @@ void CppDumper::dump(DocumentModel::ScxmlDocument *doc) << l("};") << endl; if (!options.namespaceName.isEmpty()) - h << l("} // namespace ") << options.namespaceName << endl; + h << endl << l("} // namespace ") << options.namespaceName << endl; + h << endl + << QStringLiteral("#endif // ") << headerGuard << endl; // Generate the .cpp file: cpp << l("#include \"") << headerName << l("\"") << endl diff --git a/src/qscxmllib/scxmlparser.cpp b/src/qscxmllib/scxmlparser.cpp index f3f1f02..f97ca4a 100644 --- a/src/qscxmllib/scxmlparser.cpp +++ b/src/qscxmllib/scxmlparser.cpp @@ -738,6 +738,16 @@ ScxmlParser::ScxmlParser(QXmlStreamReader *reader, LoaderFunction loader) , m_state(StartingParsing) { } +QString ScxmlParser::fileName() const +{ + return m_fileName; +} + +void ScxmlParser::setFileName(const QString &fileName) +{ + m_fileName = fileName; +} + DocumentModel::AbstractState *ScxmlParser::currentParent() const { DocumentModel::AbstractState *parent = m_currentParent->asAbstractState(); @@ -767,7 +777,7 @@ void ScxmlParser::parse() case QXmlStreamReader::EndDocument: // The reader reports the end of the document. if (!m_stack.isEmpty() || m_state != FinishedParsing) { - addError("document finished without a proper scxml item"); + addError(QStringLiteral("document finished without a proper scxml item")); m_state = ParsingError; } break; @@ -816,11 +826,11 @@ void ScxmlParser::parse() } if (!checkAttributes(attributes, "version|initial,datamodel,binding,name")) return; if (m_reader->namespaceUri() != QLatin1String("http://www.w3.org/2005/07/scxml")) { - addError("default namespace must be set with xmlns=\"http://www.w3.org/2005/07/scxml\" in the scxml tag"); + addError(QStringLiteral("default namespace must be set with xmlns=\"http://www.w3.org/2005/07/scxml\" in the scxml tag")); return; } if (attributes.value(QLatin1String("version")) != QLatin1String("1.0")) { - addError("unsupported scxml version, expected 1.0 in scxml tag"); + addError(QStringLiteral("unsupported scxml version, expected 1.0 in scxml tag")); return; } ParserState pNew = ParserState(ParserState::Scxml); @@ -934,7 +944,7 @@ void ScxmlParser::parse() } // intentional fall-through default: - addError("unexpected container state for onentry"); + addError(QStringLiteral("unexpected container state for onentry")); m_state = ParsingError; break; } @@ -952,7 +962,7 @@ void ScxmlParser::parse() } // intentional fall-through default: - addError("unexpected container state for onexit"); + addError(QStringLiteral("unexpected container state for onexit")); m_state = ParsingError; break; } @@ -1013,7 +1023,7 @@ void ScxmlParser::parse() data->src = attributes.value(QLatin1String("src")).toString(); data->expr = attributes.value(QLatin1String("expr")).toString(); if (!data->src.isEmpty()) { - addError("the source attribute in a data tag is unsupported"); // FIXME: use a loader like in <script> + addError(QStringLiteral("the source attribute in a data tag is unsupported")); // FIXME: use a loader like in <script> } if (DocumentModel::Scxml *scxml = m_currentParent->asScxml()) { scxml->dataElements.append(data); @@ -1166,10 +1176,10 @@ void ScxmlParser::parse() pNew.instructionContainer = &invoke->finalize; m_stack.append(pNew); } else { - qCWarning(scxmlParserLog) << "unexpected element " << elName; + addError(QStringLiteral("unexpected element %1").arg(elName.toString())); } if (m_stack.size()>1 && !m_stack.at(m_stack.size()-2).validChild(m_stack.last().kind)) { - addError("invalid child"); + addError(QStringLiteral("invalid child")); m_state = ParsingError; } break; @@ -1207,16 +1217,16 @@ void ScxmlParser::parse() if (!p.chars.trimmed().isEmpty()) { scriptI->content = p.chars.trimmed(); if (!scriptI->src.isEmpty()) - addError("both scr and source content given to script, will ignore external content"); + addError(QStringLiteral("both scr and source content given to script, will ignore external content")); } else if (!scriptI->src.isEmpty()) { if (!m_loader) { - addError("cannot parse a document with external dependencies without a loader"); + addError(QStringLiteral("cannot parse a document with external dependencies without a loader")); m_state = ParsingError; } else { bool ok; QByteArray data = m_loader(scriptI->src, ok, this); if (!ok) { - addError("failed to load external dependency"); + addError(QStringLiteral("failed to load external dependency")); m_state = ParsingError; } else { scriptI->content = QString::fromUtf8(data); @@ -1234,7 +1244,7 @@ void ScxmlParser::parse() case ParserState::Invoke: { DocumentModel::InstructionSequence *instructions = m_stack.last().instructionContainer; if (!instructions) { - addError("got executable content within an element that did not set instructionContainer"); + addError(QStringLiteral("got executable content within an element that did not set instructionContainer")); m_state = ParsingError; return; } @@ -1274,17 +1284,17 @@ void ScxmlParser::parse() Q_UNREACHABLE(); } if (!data->src.isEmpty() && !data->expr.isEmpty()) { - addError("data element with both 'src' and 'expr' attributes"); + addError(QStringLiteral("data element with both 'src' and 'expr' attributes")); m_state = ParsingError; return; } if (!p.chars.trimmed().isEmpty()) { if (!data->src.isEmpty()) { - addError("data element with both 'src' attribute and CDATA"); + addError(QStringLiteral("data element with both 'src' attribute and CDATA")); m_state = ParsingError; return; } else if (!data->expr.isEmpty()) { - addError("data element with both 'expr' attribute and CDATA"); + addError(QStringLiteral("data element with both 'expr' attribute and CDATA")); m_state = ParsingError; return; } else { @@ -1321,7 +1331,7 @@ void ScxmlParser::parse() } if (m_reader->hasError() && m_reader->error() != QXmlStreamReader::PrematureEndOfDocumentError) { - addError("Error parsing scxml file"); + addError(QStringLiteral("Error parsing scxml file")); addError(m_reader->errorString()); m_state = ParsingError; } @@ -1357,32 +1367,23 @@ StateTable *ScxmlParser::table() void ScxmlParser::addError(const QString &msg, ErrorMessage::Severity severity) { - m_errors.append(ErrorMessage(severity, msg, QStringLiteral("%1:%2 %3").arg(m_reader->lineNumber()) - .arg(m_reader->columnNumber()) - .arg((m_reader->error() != QXmlStreamReader::NoError) ? m_reader->errorString() : QString()))); - switch (severity){ - case ErrorMessage::Debug: - qCDebug(scxmlLog) << m_errors.last().msg << m_errors.last().parserState; - break; - case ErrorMessage::Info: - qCWarning(scxmlLog) << m_errors.last().msg << m_errors.last().parserState; - break; - case ErrorMessage::Error: - qCWarning(scxmlLog) << m_errors.last().msg << m_errors.last().parserState; - break; - } + m_errors.append(ErrorMessage(m_fileName, + m_reader->lineNumber(), + m_reader->columnNumber(), + severity, + msg)); if (severity == ErrorMessage::Error) m_state = ParsingError; } -void ScxmlParser::addError(const char *msg, ErrorMessage::Severity severity) -{ - addError(QString::fromLatin1(msg), severity); -} - void ScxmlParser::addError(const DocumentModel::XmlLocation &location, const QString &msg) { - qCWarning(scxmlLog) << QStringLiteral("%1:%2 %3").arg(location.line).arg(location.column).arg(msg); + m_errors.append(ErrorMessage(m_fileName, + location.line, + location.column, + ErrorMessage::Error, + msg)); + m_state = ParsingError; } bool ScxmlParser::maybeId(const QXmlStreamAttributes &attributes, QString *id) @@ -1408,7 +1409,7 @@ bool ScxmlParser::checkAttributes(const QXmlStreamAttributes &attributes, const requiredNames = attrSplit.value(0).split(QLatin1Char(','), QString::SkipEmptyParts); optionalNames = attrSplit.value(1).split(QLatin1Char(','), QString::SkipEmptyParts); if (attrSplit.size() > 2) { - addError("Internal error, invalid attribStr in checkAttributes"); + addError(QStringLiteral("Internal error, invalid attribStr in checkAttributes")); m_state = ParsingError; } foreach (const QString &rName, requiredNames) diff --git a/src/qscxmllib/scxmlparser.h b/src/qscxmllib/scxmlparser.h index 3914dc3..2feb459 100644 --- a/src/qscxmllib/scxmlparser.h +++ b/src/qscxmllib/scxmlparser.h @@ -540,21 +540,33 @@ struct ErrorMessage Info, Error }; - Severity severity; + + QString fileName; + int line = 0; + int column = 0; + Severity severity = Debug; QString msg; - QString parserState; - ErrorMessage(Severity severity = Severity::Error, - const QString &msg = QStringLiteral("UnknownError"), - const QString &parserState = QString()) - : severity(severity), msg(msg), parserState(parserState){ } - QString severityString() const { + ErrorMessage(const QString &fileName, + int line, + int column, + Severity severity, + const QString &msg) + : fileName(fileName) + , line(line) + , column(column) + , severity(severity) + , msg(msg) + {} + + QString severityString() const + { switch (severity) { case Debug: - return QStringLiteral("Debug: "); + return QStringLiteral("debug"); case Info: - return QStringLiteral("Info: "); + return QStringLiteral("info"); case Error: - return QStringLiteral("Error: "); + return QStringLiteral("error"); } return QStringLiteral("Severity%1: ").arg(severity); } @@ -578,12 +590,13 @@ public: }; ScxmlParser(QXmlStreamReader *xmlReader, LoaderFunction loader = Q_NULLPTR); + QString fileName() const; + void setFileName(const QString &fileName); void parse(); DocumentModel::XmlLocation xmlLocation() const; DocumentModel::ScxmlDocument *scxmlDocument(); StateTable *table(); void addError(const QString &msg, ErrorMessage::Severity severity = ErrorMessage::Error); - void addError(const char *msg, ErrorMessage::Severity severity = ErrorMessage::Error); void addError(const DocumentModel::XmlLocation &location, const QString &msg); std::function<bool(const QString &)> errorDumper() { return [this](const QString &msg) -> bool { this->addError(msg); return true; }; @@ -592,12 +605,14 @@ public: State state() const { return m_state; } QList<ErrorMessage> errors() const { return m_errors; } -private: +private: // helper methods bool maybeId(const QXmlStreamAttributes &attributes, QString *id); bool checkAttributes(const QXmlStreamAttributes &attributes, const char *attribStr); bool checkAttributes(const QXmlStreamAttributes &attributes, QStringList requiredNames, QStringList optionalNames); +private: // fields + QString m_fileName; QSet<QString> m_allIds; DocumentModel::AbstractState *currentParent() const; diff --git a/tests/3rdparty/scion.h b/tests/3rdparty/scion.h deleted file mode 100644 index 6077dcd..0000000 --- a/tests/3rdparty/scion.h +++ /dev/null @@ -1,278 +0,0 @@ -const char *testBases[] = { - "scion-tests/scxml-test-framework/test/actionSend/send1", - "scion-tests/scxml-test-framework/test/actionSend/send2", - "scion-tests/scxml-test-framework/test/actionSend/send3", - "scion-tests/scxml-test-framework/test/actionSend/send4", - "scion-tests/scxml-test-framework/test/actionSend/send5", - "scion-tests/scxml-test-framework/test/actionSend/send6", - "scion-tests/scxml-test-framework/test/actionSend/send7", - "scion-tests/scxml-test-framework/test/actionSend/send8", - "scion-tests/scxml-test-framework/test/assign-current-small-step/test0", - "scion-tests/scxml-test-framework/test/assign-current-small-step/test1", - "scion-tests/scxml-test-framework/test/assign-current-small-step/test2", - "scion-tests/scxml-test-framework/test/assign-current-small-step/test3", - "scion-tests/scxml-test-framework/test/assign-current-small-step/test4", - "scion-tests/scxml-test-framework/test/atom3-basic-tests/m0", - "scion-tests/scxml-test-framework/test/atom3-basic-tests/m1", - "scion-tests/scxml-test-framework/test/atom3-basic-tests/m2", - "scion-tests/scxml-test-framework/test/atom3-basic-tests/m3", - "scion-tests/scxml-test-framework/test/basic/basic0", - "scion-tests/scxml-test-framework/test/basic/basic1", - "scion-tests/scxml-test-framework/test/basic/basic2", - "scion-tests/scxml-test-framework/test/cond-js/test0", - "scion-tests/scxml-test-framework/test/cond-js/test1", - "scion-tests/scxml-test-framework/test/cond-js/test2", - "scion-tests/scxml-test-framework/test/cond-js/TestConditionalTransition", - "scion-tests/scxml-test-framework/test/default-initial-state/initial1", - "scion-tests/scxml-test-framework/test/default-initial-state/initial2", - "scion-tests/scxml-test-framework/test/delayedSend/send1", - "scion-tests/scxml-test-framework/test/delayedSend/send2", - "scion-tests/scxml-test-framework/test/delayedSend/send3", - "scion-tests/scxml-test-framework/test/documentOrder/documentOrder0", - "scion-tests/scxml-test-framework/test/foreach/test1", - "scion-tests/scxml-test-framework/test/hierarchy/hier0", - "scion-tests/scxml-test-framework/test/hierarchy/hier1", - "scion-tests/scxml-test-framework/test/hierarchy/hier2", - "scion-tests/scxml-test-framework/test/hierarchy+documentOrder/test0", - "scion-tests/scxml-test-framework/test/hierarchy+documentOrder/test1", - "scion-tests/scxml-test-framework/test/history/history0", - "scion-tests/scxml-test-framework/test/history/history1", - "scion-tests/scxml-test-framework/test/history/history2", - "scion-tests/scxml-test-framework/test/history/history3", - "scion-tests/scxml-test-framework/test/history/history4", - "scion-tests/scxml-test-framework/test/history/history5", - "scion-tests/scxml-test-framework/test/history/history6", - "scion-tests/scxml-test-framework/test/if-else/test0", - "scion-tests/scxml-test-framework/test/in/TestInPredicate", - "scion-tests/scxml-test-framework/test/internal-transitions/test0", - "scion-tests/scxml-test-framework/test/internal-transitions/test1", - "scion-tests/scxml-test-framework/test/more-parallel/test0", - "scion-tests/scxml-test-framework/test/more-parallel/test1", - "scion-tests/scxml-test-framework/test/more-parallel/test10", - "scion-tests/scxml-test-framework/test/more-parallel/test2", - "scion-tests/scxml-test-framework/test/more-parallel/test3", - "scion-tests/scxml-test-framework/test/more-parallel/test4", - "scion-tests/scxml-test-framework/test/more-parallel/test5", - "scion-tests/scxml-test-framework/test/more-parallel/test6", - "scion-tests/scxml-test-framework/test/more-parallel/test7", - "scion-tests/scxml-test-framework/test/more-parallel/test8", - "scion-tests/scxml-test-framework/test/more-parallel/test9", - "scion-tests/scxml-test-framework/test/multiple-events-per-transition/test1", - "scion-tests/scxml-test-framework/test/parallel/test0", - "scion-tests/scxml-test-framework/test/parallel/test1", - "scion-tests/scxml-test-framework/test/parallel/test2", - "scion-tests/scxml-test-framework/test/parallel/test3", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test0", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test1", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test10", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test11", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test12", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test13", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test14", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test15", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test16", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test17", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test18", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test19", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test2", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test20", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test21", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test22", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test23", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test24", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test25", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test26", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test27", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test28", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test29", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test3", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test30", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test31", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test4", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test5", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test6", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test7", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test8", - "scion-tests/scxml-test-framework/test/parallel+interrupt/test9", - "scion-tests/scxml-test-framework/test/script/test0", - "scion-tests/scxml-test-framework/test/script/test1", - "scion-tests/scxml-test-framework/test/script/test2", - "scion-tests/scxml-test-framework/test/script-src/test0", - "scion-tests/scxml-test-framework/test/script-src/test1", - "scion-tests/scxml-test-framework/test/script-src/test2", - "scion-tests/scxml-test-framework/test/script-src/test3", - "scion-tests/scxml-test-framework/test/scxml-prefix-event-name-matching/star0", - "scion-tests/scxml-test-framework/test/scxml-prefix-event-name-matching/test0", - "scion-tests/scxml-test-framework/test/scxml-prefix-event-name-matching/test1", - "scion-tests/scxml-test-framework/test/send-data/send1", - "scion-tests/scxml-test-framework/test/send-internal/test0", - "scion-tests/scxml-test-framework/test/targetless-transition/test0", - "scion-tests/scxml-test-framework/test/targetless-transition/test1", - "scion-tests/scxml-test-framework/test/targetless-transition/test2", - "scion-tests/scxml-test-framework/test/targetless-transition/test3", - "scion-tests/scxml-test-framework/test/w3c-ecma/modified_test456.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test144.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test147.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test148.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test149.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test150.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test151.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test152.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test153.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test155.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test156.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test158.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test159.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test172.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test173.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test174.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test175.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test176.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test178.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test179.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test183.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test185.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test186.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test187.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test194.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test198.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test199.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test200.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test201.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test205.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test207.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test208.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test210.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test215.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test216.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test220.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test223.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test224.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test225.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test226.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test228.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test229.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test230.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test232.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test233.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test234.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test235.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test236.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test237.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test239.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test240.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test241.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test242.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test243.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test244.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test245.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test247.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test250.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test252.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test253.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test276.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test278.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test279.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test280.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test286.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test287.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test294.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test298.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test301.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test302.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test303.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test304.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test307.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test309.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test310.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test311.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test312.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test313.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test314.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test318.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test319.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test321.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test322.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test323.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test324.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test325.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test326.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test329.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test330.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test331.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test332.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test333.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test335.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test336.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test337.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test338.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test339.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test342.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test343.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test344.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test346.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test355.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test364.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test372.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test375.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test376.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test377.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test378.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test387.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test388.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test396.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test399.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test401.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test402.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test403a.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test403b.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test403c.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test404.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test405.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test406.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test407.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test409.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test411.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test412.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test413.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test416.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test417.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test419.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test421.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test422.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test423.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test436.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test441a.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test441b.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test444.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test445.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test448.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test449.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test451.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test453.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test456.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test487.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test488.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test503.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test504.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test505.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test506.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test521.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test525.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test527.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test528.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test529.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test530.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test533.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test550.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test551.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test552.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test554.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test557.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test558.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test560.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test562.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test569.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test570.txml", - "scion-tests/scxml-test-framework/test/w3c-ecma/test576.txml" -}; diff --git a/tests/scion/scion.pro b/tests/scion/scion.pro index 0f9782c..f9159da 100644 --- a/tests/scion/scion.pro +++ b/tests/scion/scion.pro @@ -15,11 +15,8 @@ RESOURCES = ../3rdparty/scion.qrc SOURCES += \ tst_scion.cpp -HEADERS += \ - $$PWD/../3rdparty/scion.h - defineReplace(nameTheNamespace) { - sn=$$relative_path($$absolute_path($$dirname(1), $$OUT_PWD),$$MYSCXMLS_DIR) + sn=$$relative_path($$absolute_path($$dirname(1), $$OUT_PWD),$$SCXMLS_DIR) sn~=s/\\.txml$// sn~=s/[^a-zA-Z_0-9]/_/ return ($$sn) @@ -35,29 +32,108 @@ defineReplace(nameTheClass) { myscxml.commands = $$[QT_HOST_BINS]/qscxmlcpp -name-qobjects -oh scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h -ocpp ${QMAKE_FILE_OUT} -namespace ${QMAKE_FUNC_nameTheNamespace} -classname ${QMAKE_FUNC_nameTheClass} ${QMAKE_FILE_IN} myscxml.depends += $$[QT_HOST_BINS]/qscxmlcpp myscxml.output = scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp -myscxml.input = MYSCXMLS +myscxml.input = SCXMLS myscxml.variable_out = SOURCES QMAKE_EXTRA_COMPILERS += myscxml -MYSCXMLS_DIR += $$absolute_path($$PWD/../3rdparty/scion-tests/scxml-test-framework/test) -MYSCXMLS = $$files($$MYSCXMLS_DIR/*.scxml, true) +myscxml_hdr.input = SCXMLS +myscxml_hdr.variable_out = SCXML_HEADERS +myscxml_hdr.commands = $$escape_expand(\\n) +myscxml_hdr.depends = scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp +myscxml_hdr.output = scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h +QMAKE_EXTRA_COMPILERS += myscxml_hdr + +qtPrepareTool(QMAKE_MOC, moc) +#scxml_moc_source.CONFIG = no_link +scxml_moc_source.dependency_type = TYPE_C +scxml_moc_source.commands = $$QMAKE_MOC ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} +scxml_moc_source.output = scxml/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)} +scxml_moc_source.input = SCXML_HEADERS +#scxml_moc_source.depends += $$WIN_INCLUDETEMP +scxml_moc_source.variable_out = SOURCES +silent:scxml_moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$scxml_moc_source.commands +QMAKE_EXTRA_COMPILERS += scxml_moc_source + +SCXMLS_DIR += $$absolute_path($$PWD/../3rdparty/scion-tests/scxml-test-framework/test) +ALLSCXMLS = $$files($$SCXMLS_DIR/*.scxml, true) + +# <invoke> +BLACKLISTED = \ + test187.txml.scxml \ + test207.txml.scxml \ + test215.txml.scxml \ + test216.txml.scxml \ + test220.txml.scxml \ + test223.txml.scxml \ + test224.txml.scxml \ + test225.txml.scxml \ + test226.txml.scxml \ + test228.txml.scxml \ + test229.txml.scxml \ + test230.txml.scxml \ + test232.txml.scxml \ + test233.txml.scxml \ + test234.txml.scxml \ + test235.txml.scxml \ + test236.txml.scxml \ + test237.txml.scxml \ + test238.txml.scxml \ + test239.txml.scxml \ + test240.txml.scxml \ + test241.txml.scxml \ + test242.txml.scxml \ + test243.txml.scxml \ + test244.txml.scxml \ + test245.txml.scxml \ + test247.txml.scxml \ + test250.txml.scxml \ + test252.txml.scxml \ + test253.txml.scxml \ + test276.txml.scxml \ + test338.txml.scxml \ + test422.txml.scxml \ + test530.txml.scxml \ + test554.txml.scxml + +# other +BLACKLISTED += \ + test301.txml.scxml \ + test441a.txml.scxml \ + test441b.txml.scxml \ + test552.txml.scxml \ + test557.txml.scxml \ + test558.txml.scxml -for (f,MYSCXMLS) { +for (f,ALLSCXMLS) { cn = $$basename(f) - cn ~= s/\\.scxml$// - cn ~=s/\\.txml$// - sn = $$relative_path($$dirname(f), $$MYSCXMLS_DIR) - sn ~=s/[^a-zA-Z_0-9]/_/ + if (!contains(BLACKLISTED, $$cn)) { + SCXMLS += $$f + + cn ~= s/\\.scxml$// + hn = $$cn + cn ~=s/\\.txml$// + sn = $$relative_path($$dirname(f), $$SCXMLS_DIR) + sn ~=s/[^a-zA-Z_0-9]/_/ - inc_list += "$${LITERAL_HASH}include \"scxml/$${sn}_$${cn}.h\"" - func_list += "[]()->Scxml::StateTable{return new $${sn}::$${cn}();}," + inc_list += "$${LITERAL_HASH}include \"scxml/$${sn}_$${hn}.h\"" + func_list += " []()->Scxml::StateTable*{return new $${sn}::$${cn};}," + + tn = $$relative_path($$f,$$absolute_path($$SCXMLS_DIR/../../..)) + tn ~= s/\\.scxml$// + testBases += " \"$$tn\"," + } } file_cont= \ $$inc_list \ "std::function<Scxml::StateTable *()> creators[] = {" \ $$func_list \ "};" -write_file("compiled_tests.h", file_cont)|error("Aborting.") +write_file("scxml/compiled_tests.h", file_cont)|error("Aborting.") +testBases_cont = \ + "const char *testBases[] = {" \ + $$testBases \ + "};" +write_file("scxml/scion.h", testBases_cont)|error("Aborting.") load(qt_tool) load(qscxmlcpp) diff --git a/tests/scion/tst_scion.cpp b/tests/scion/tst_scion.cpp index 868ff48..c21ab97 100644 --- a/tests/scion/tst_scion.cpp +++ b/tests/scion/tst_scion.cpp @@ -21,7 +21,8 @@ #include <QScxmlLib/scxmlparser.h> -#include "../3rdparty/scion.h" +#include "scxml/scion.h" +//#include "scxml/compiled_tests.h" enum { SpyWaitTime = 8000 }; diff --git a/tests/testCpp/out.cpp b/tests/testCpp/out.cpp index fdbd26f..63b396b 100644 --- a/tests/testCpp/out.cpp +++ b/tests/testCpp/out.cpp @@ -1,15 +1,15 @@ #include "out.h" struct StateMachine::Data { - Data(Scxml::StateTable *table) + Data(Scxml::StateTable &table) : table(table) - , state_s__1(table) + , state_s__1(&table) , transition_s__1_0(&state_s__1, QList<QByteArray>() << QByteArray::fromRawData("E19", 3)) , transition_s__1_1(&state_s__1, QList<QByteArray>() << QByteArray::fromRawData("E47", 3)) , transition_s__1_2(&state_s__1, QList<QByteArray>() << QByteArray::fromRawData("E37", 3)) , transition_s__1_3(&state_s__1, QList<QByteArray>() << QByteArray::fromRawData("E93", 3)) , transition_s__1_4(&state_s__1, QList<QByteArray>() << QByteArray::fromRawData("E17", 3)) - , state_s__2(table) + , state_s__2(&table) , state_s__2__1(&state_s__2) , state_s__2__1__1(&state_s__2__1) , transition_s__2__1__1_0(&state_s__2__1__1, QList<QByteArray>() << QByteArray::fromRawData("E89", 3)) @@ -64,7 +64,8 @@ struct StateMachine::Data { {} bool init() { - table->setInitialState(&state_s__1); + table.setInitialState(&state_s__1); + state_s__1.setObjectName(QStringLiteral("s_1")); state_s__1.addTransition(&transition_s__1_0); transition_s__1_0.setTargetStates(QList<QAbstractState *>() << &state_s__1); state_s__1.addTransition(&transition_s__1_1); @@ -75,8 +76,11 @@ struct StateMachine::Data { transition_s__1_3.setTargetStates(QList<QAbstractState *>() << &state_s__1); state_s__1.addTransition(&transition_s__1_4); transition_s__1_4.setTargetStates(QList<QAbstractState *>() << &state_s__1); + state_s__2.setObjectName(QStringLiteral("s_2")); state_s__2.setInitialState(&state_s__2__1); + state_s__2__1.setObjectName(QStringLiteral("s_2_1")); state_s__2__1.setInitialState(&state_s__2__1__1); + state_s__2__1__1.setObjectName(QStringLiteral("s_2_1_1")); state_s__2__1__1.addTransition(&transition_s__2__1__1_0); transition_s__2__1__1_0.setTargetStates(QList<QAbstractState *>() << &state_s__2); state_s__2__1__1.addTransition(&transition_s__2__1__1_1); @@ -85,9 +89,13 @@ struct StateMachine::Data { transition_s__2__1__1_2.setTargetStates(QList<QAbstractState *>() << &state_s__2__1); state_s__2__1__1.addTransition(&transition_s__2__1__1_3); transition_s__2__1__1_3.setTargetStates(QList<QAbstractState *>() << &state_s__2); + state_s__2__1__2.setObjectName(QStringLiteral("s_2_1_2")); state_s__2__1__2.setInitialState(&state_s__2__1__2__1); + state_s__2__1__2__1.setObjectName(QStringLiteral("s_2_1_2_1")); state_s__2__1__2__1.setInitialState(&state_s__2__1__2__1__1); + state_s__2__1__2__1__1.setObjectName(QStringLiteral("s_2_1_2_1_1")); state_s__2__1__2__1__1.setInitialState(&state_s__2__1__2__1__1__1); + state_s__2__1__2__1__1__1.setObjectName(QStringLiteral("s_2_1_2_1_1_1")); state_s__2__1__2__1__1__1.addTransition(&transition_s__2__1__2__1__1__1_0); transition_s__2__1__2__1__1__1_0.setTargetStates(QList<QAbstractState *>() << &state_s__2__1__1); state_s__2__1__2__1__1__1.addTransition(&transition_s__2__1__2__1__1__1_1); @@ -98,6 +106,7 @@ struct StateMachine::Data { transition_s__2__1__2__1__1__1_3.setTargetStates(QList<QAbstractState *>() << &state_s__2__1); state_s__2__1__2__1__1__1.addTransition(&transition_s__2__1__2__1__1__1_4); transition_s__2__1__2__1__1__1_4.setTargetStates(QList<QAbstractState *>() << &state_s__1); + state_s__2__1__2__1__1__2.setObjectName(QStringLiteral("s_2_1_2_1_1_2")); state_s__2__1__2__1__1__2.addTransition(&transition_s__2__1__2__1__1__2_0); transition_s__2__1__2__1__1__2_0.setTargetStates(QList<QAbstractState *>() << &state_s__2__1__1); state_s__2__1__2__1__1__2.addTransition(&transition_s__2__1__2__1__1__2_1); @@ -106,6 +115,7 @@ struct StateMachine::Data { transition_s__2__1__2__1__1__2_2.setTargetStates(QList<QAbstractState *>() << &state_s__2__1__2__1__1); state_s__2__1__2__1__1__2.addTransition(&transition_s__2__1__2__1__1__2_3); transition_s__2__1__2__1__1__2_3.setTargetStates(QList<QAbstractState *>() << &state_s__2__1__2__1); + state_s__2__1__2__1__1__3.setObjectName(QStringLiteral("s_2_1_2_1_1_3")); state_s__2__1__2__1__1__3.addTransition(&transition_s__2__1__2__1__1__3_0); transition_s__2__1__2__1__1__3_0.setTargetStates(QList<QAbstractState *>() << &state_s__2__1__2__1); state_s__2__1__2__1__1__3.addTransition(&transition_s__2__1__2__1__1__3_1); @@ -170,7 +180,7 @@ struct StateMachine::Data { return true; } - Scxml::StateTable *table; + Scxml::StateTable &table; Scxml::ScxmlState state_s__1; Scxml::ScxmlTransition transition_s__1_0; Scxml::ScxmlTransition transition_s__1_1; @@ -233,7 +243,7 @@ struct StateMachine::Data { StateMachine::StateMachine(QObject *parent) : Scxml::StateTable(parent) - , data(new Data(this)) + , data(new Data(*this)) {} StateMachine::~StateMachine() diff --git a/tests/testCpp/out.h b/tests/testCpp/out.h index a868280..cc01ccc 100644 --- a/tests/testCpp/out.h +++ b/tests/testCpp/out.h @@ -1,3 +1,6 @@ +#ifndef OUT_H +#define OUT_H + #include <QScxmlLib/scxmlstatetable.h> class StateMachine : public Scxml::StateTable @@ -53,3 +56,5 @@ private: struct Data; struct Data *data; }; + +#endif // OUT_H |