From 973105d9fb3372910255825e7395fb1156e24c02 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Sep 2016 11:39:25 +0200 Subject: Add script to regenerate files using qtokenautomaton Add script and update README of qtokenautomaton accordingly. Change-Id: If18167a413280c4b65d8fff49eb0aa3cf05eb23e Reviewed-by: Marc Mutz --- src/xmlpatterns/qtokenautomaton/README | 12 +++++++-- src/xmlpatterns/qtokenautomaton/regenerate.sh | 38 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100755 src/xmlpatterns/qtokenautomaton/regenerate.sh diff --git a/src/xmlpatterns/qtokenautomaton/README b/src/xmlpatterns/qtokenautomaton/README index 8c5e552..32c348f 100644 --- a/src/xmlpatterns/qtokenautomaton/README +++ b/src/xmlpatterns/qtokenautomaton/README @@ -56,8 +56,16 @@ Using it is approached as follows: --schema qtokenautomaton.xsd yourFile.xml` 3. Produce the C++ files by invoking the stylesheet with an XSL-T 2.0 - processor[1]. For instance, with the implementation Saxon, this would be: - `java net.sf.saxon.Transform -xsl:qautomaton2cpp.xsl yourFile.xml` + processor[1], for example Saxon. + + If the Java SDK is installed, it can be invoked by: + java net.sf.saxon.Transform -xsl:qautomaton2cpp.xsl yourFile.xml + + Debian provides a command line utility saxonb-xslt for this: + sudo apt-get install libsaxonb-java + saxonb-xslt -ext:on -xsl:qautomaton2cpp.xsl -s:yourFile.xml + + The script regenerate.sh is provided to do this. 4. Include the produced C++ files with your build system. diff --git a/src/xmlpatterns/qtokenautomaton/regenerate.sh b/src/xmlpatterns/qtokenautomaton/regenerate.sh new file mode 100755 index 0000000..23b49b1 --- /dev/null +++ b/src/xmlpatterns/qtokenautomaton/regenerate.sh @@ -0,0 +1,38 @@ +#/bin/sh -x + +############################################################################# +## +## Copyright (C) 2016 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the build tools of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +cd $(dirname "$0")/.. +saxonb-xslt -ext:on -xsl:qtokenautomaton/qautomaton2cpp.xsl -s:schema/tokens.xml -o:schema/qxsdschematoken.cpp +saxonb-xslt -ext:on -xsl:qtokenautomaton/qautomaton2cpp.xsl -s:parser/qxslttokenlookup.xml -o:parser/qxslttokenlookup.cpp -- cgit v1.2.1 From 5a160606aefa5b07909faba55af53d1c95368486 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 21 Oct 2016 13:48:00 +0200 Subject: Add feature xml-schema Fix build warnings about missing qfeatures. Change-Id: I577b78fcf2037877f15d87006e279e61e4d86945 Reviewed-by: Lars Knoll --- configure.json | 5 +++++ examples/xmlpatterns/xmlpatterns.pro | 4 ++-- src/xmlpatterns/api/api.pri | 3 +-- src/xmlpatterns/configure.json | 24 ++++++++++++++++++++++++ src/xmlpatterns/xmlpatterns.pro | 3 +-- tests/auto/auto.pro | 4 ++-- tools/tools.pro | 4 ++-- 7 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 configure.json create mode 100644 src/xmlpatterns/configure.json diff --git a/configure.json b/configure.json new file mode 100644 index 0000000..b725f49 --- /dev/null +++ b/configure.json @@ -0,0 +1,5 @@ +{ + "subconfigs": [ + "src/xmlpatterns" + ] +} diff --git a/examples/xmlpatterns/xmlpatterns.pro b/examples/xmlpatterns/xmlpatterns.pro index bfc3a3e..b7c65d8 100644 --- a/examples/xmlpatterns/xmlpatterns.pro +++ b/examples/xmlpatterns/xmlpatterns.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += xmlpatterns-private SUBDIRS += xquery qtHaveModule(widgets) { SUBDIRS += recipes - load(qfeatures) - !contains(QT_DISABLED_FEATURES, xmlschema): SUBDIRS += filetree schema + qtConfig(xml-schema): SUBDIRS += filetree schema } EXAMPLE_FILES = \ diff --git a/src/xmlpatterns/api/api.pri b/src/xmlpatterns/api/api.pri index 2192d82..fec6499 100644 --- a/src/xmlpatterns/api/api.pri +++ b/src/xmlpatterns/api/api.pri @@ -50,8 +50,7 @@ SOURCES += $$PWD/qvariableloader.cpp \ $$PWD/qcoloringmessagehandler.cpp \ $$PWD/qcoloroutput.cpp -load(qfeatures) -!contains(QT_DISABLED_FEATURES, xmlschema) { +qtConfig(xml-schema) { HEADERS += $$PWD/qxmlschema.h \ $$PWD/qxmlschema_p.h \ $$PWD/qxmlschemavalidator.h \ diff --git a/src/xmlpatterns/configure.json b/src/xmlpatterns/configure.json new file mode 100644 index 0000000..2724334 --- /dev/null +++ b/src/xmlpatterns/configure.json @@ -0,0 +1,24 @@ +{ + "module": "xmlpatterns", + "depends": [ + "core-private", + "network" + ], + + "features": { + "xml-schema": { + "label": "XML schema support", + "purpose": "Support for XML schema validation", + "output": [ "privateFeature" ] + } + }, + + "summary": [ + { + "section": "QtXmlPatterns", + "entries": [ + "xml-schema" + ] + } + ] +} diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro index 1b53673..5244bb1 100644 --- a/src/xmlpatterns/xmlpatterns.pro +++ b/src/xmlpatterns/xmlpatterns.pro @@ -19,8 +19,7 @@ include($$PWD/janitors/janitors.pri) include($$PWD/parser/parser.pri) include($$PWD/projection/projection.pri) -load(qfeatures) -!contains(QT_DISABLED_FEATURES, xmlschema) { +qtConfig(xml-schema) { include($$PWD/schema/schema.pri) } include($$PWD/type/type.pri) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index df80f80..aba49b6 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,4 +1,5 @@ TEMPLATE=subdirs +QT_FOR_CONFIG += xmlpatterns-private SUBDIRS=\ checkxmlfiles \ cmake \ @@ -30,8 +31,7 @@ SUBDIRS=\ xmlpatternsxqts \ xmlpatternsxslts \ -load(qfeatures) -!contains(QT_DISABLED_FEATURES, xmlschema) { +qtConfig(xml-schema) { SUBDIRS += qxmlschema \ qxmlschemavalidator \ xmlpatternsschema \ diff --git a/tools/tools.pro b/tools/tools.pro index 92bbaca..df3f095 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += xmlpatterns-private -load(qfeatures) !android|android_app { SUBDIRS += xmlpatterns - !contains(QT_DISABLED_FEATURES, xmlschema) { + qtConfig(xml-schema) { SUBDIRS += xmlpatternsvalidator } } -- cgit v1.2.1 From 977d0fb3f0bf776e2aad3c8ff795115ce62909ff Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Oct 2016 14:04:15 +0200 Subject: configure.json: Remove depends-list Amends 5a160606aefa5b07909faba55af53d1c95368486. Change-Id: I4dd6523f4015922e4c5c76c5bf907e3f6c5b3b43 Reviewed-by: Oswald Buddenhagen --- src/xmlpatterns/configure.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/xmlpatterns/configure.json b/src/xmlpatterns/configure.json index 2724334..851ebf8 100644 --- a/src/xmlpatterns/configure.json +++ b/src/xmlpatterns/configure.json @@ -1,9 +1,5 @@ { "module": "xmlpatterns", - "depends": [ - "core-private", - "network" - ], "features": { "xml-schema": { -- cgit v1.2.1 From 6b6f7db32e7c9ca4bdda0341994dca1212b53e20 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 27 Oct 2016 17:43:43 +0200 Subject: Fix memory leak We can't have the ExpressionVariableReference/TemplateParameterReference holding a Ptr of VariableDeclaration because the VariableDeclaration holds a Ptr of them (in the references member) so they were referencing eachother and the reference count never reaches 0. Task-number: QTBUG-32745 Change-Id: I4cda6d9eccad123984f4ad35db3e56da01d4d5b1 Reviewed-by: Erik Verbruggen --- src/xmlpatterns/expr/qexpressionvariablereference.cpp | 4 ++-- src/xmlpatterns/expr/qexpressionvariablereference_p.h | 8 ++++---- src/xmlpatterns/expr/qtemplateparameterreference.cpp | 2 +- src/xmlpatterns/expr/qtemplateparameterreference_p.h | 8 ++++---- src/xmlpatterns/parser/qquerytransformparser.cpp | 4 ++-- src/xmlpatterns/parser/querytransformparser.ypp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/xmlpatterns/expr/qexpressionvariablereference.cpp b/src/xmlpatterns/expr/qexpressionvariablereference.cpp index c582629..d75e68c 100644 --- a/src/xmlpatterns/expr/qexpressionvariablereference.cpp +++ b/src/xmlpatterns/expr/qexpressionvariablereference.cpp @@ -39,8 +39,8 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; ExpressionVariableReference::ExpressionVariableReference(const VariableSlotID slotP, - const VariableDeclaration::Ptr &varDecl) : VariableReference(slotP) - , m_varDecl(varDecl) + const VariableDeclaration *varDecl) : VariableReference(slotP) + , m_varDecl(varDecl) { } diff --git a/src/xmlpatterns/expr/qexpressionvariablereference_p.h b/src/xmlpatterns/expr/qexpressionvariablereference_p.h index cc5645b..12a019c 100644 --- a/src/xmlpatterns/expr/qexpressionvariablereference_p.h +++ b/src/xmlpatterns/expr/qexpressionvariablereference_p.h @@ -67,7 +67,7 @@ namespace QPatternist { public: ExpressionVariableReference(const VariableSlotID slot, - const VariableDeclaration::Ptr &varDecl); + const VariableDeclaration *varDecl); virtual bool evaluateEBV(const DynamicContext::Ptr &context) const; virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; @@ -80,9 +80,9 @@ namespace QPatternist virtual ExpressionVisitorResult::Ptr accept(const ExpressionVisitor::Ptr &visitor) const; inline const Expression::Ptr &sourceExpression() const; - inline const VariableDeclaration::Ptr &variableDeclaration() const; + inline const VariableDeclaration *variableDeclaration() const; private: - const VariableDeclaration::Ptr m_varDecl; + const VariableDeclaration *m_varDecl; }; inline const Expression::Ptr &ExpressionVariableReference::sourceExpression() const @@ -90,7 +90,7 @@ namespace QPatternist return m_varDecl->expression(); } - inline const VariableDeclaration::Ptr &ExpressionVariableReference::variableDeclaration() const + inline const VariableDeclaration *ExpressionVariableReference::variableDeclaration() const { return m_varDecl; } diff --git a/src/xmlpatterns/expr/qtemplateparameterreference.cpp b/src/xmlpatterns/expr/qtemplateparameterreference.cpp index b2555a2..98808ab 100644 --- a/src/xmlpatterns/expr/qtemplateparameterreference.cpp +++ b/src/xmlpatterns/expr/qtemplateparameterreference.cpp @@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; -TemplateParameterReference::TemplateParameterReference(const VariableDeclaration::Ptr &varDecl) : m_varDecl(varDecl) +TemplateParameterReference::TemplateParameterReference(const VariableDeclaration *varDecl) : m_varDecl(varDecl) { } diff --git a/src/xmlpatterns/expr/qtemplateparameterreference_p.h b/src/xmlpatterns/expr/qtemplateparameterreference_p.h index b4bd6ca..a81f391 100644 --- a/src/xmlpatterns/expr/qtemplateparameterreference_p.h +++ b/src/xmlpatterns/expr/qtemplateparameterreference_p.h @@ -61,7 +61,7 @@ namespace QPatternist class TemplateParameterReference : public EmptyContainer { public: - TemplateParameterReference(const VariableDeclaration::Ptr &varDecl); + TemplateParameterReference(const VariableDeclaration *varDecl); virtual bool evaluateEBV(const DynamicContext::Ptr &context) const; virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; @@ -72,10 +72,10 @@ namespace QPatternist virtual Properties properties() const; inline const Expression::Ptr &sourceExpression() const; - inline const VariableDeclaration::Ptr &variableDeclaration() const; + inline const VariableDeclaration *variableDeclaration() const; private: - const VariableDeclaration::Ptr m_varDecl; + const VariableDeclaration *m_varDecl; }; inline const Expression::Ptr &TemplateParameterReference::sourceExpression() const @@ -83,7 +83,7 @@ namespace QPatternist return m_varDecl->expression(); } - inline const VariableDeclaration::Ptr &TemplateParameterReference::variableDeclaration() const + inline const VariableDeclaration *TemplateParameterReference::variableDeclaration() const { return m_varDecl; } diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index 5497fb8..fe2c3bb 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -1086,7 +1086,7 @@ static Expression::Ptr resolveVariable(const QXmlName &name, * mechanism must. */ case VariableDeclaration::ExpressionVariable: { - retval = create(new ExpressionVariableReference(var->slot, var), sourceLocator, parseInfo); + retval = create(new ExpressionVariableReference(var->slot, var.data()), sourceLocator, parseInfo); break; } case VariableDeclaration::FunctionArgument: @@ -1101,7 +1101,7 @@ static Expression::Ptr resolveVariable(const QXmlName &name, } case VariableDeclaration::TemplateParameter: { - retval = create(new TemplateParameterReference(var), sourceLocator, parseInfo); + retval = create(new TemplateParameterReference(var.data()), sourceLocator, parseInfo); break; } case VariableDeclaration::ExternalVariable: diff --git a/src/xmlpatterns/parser/querytransformparser.ypp b/src/xmlpatterns/parser/querytransformparser.ypp index edd2823..0a0b11c 100644 --- a/src/xmlpatterns/parser/querytransformparser.ypp +++ b/src/xmlpatterns/parser/querytransformparser.ypp @@ -1015,7 +1015,7 @@ static Expression::Ptr resolveVariable(const QXmlName &name, * mechanism must. */ case VariableDeclaration::ExpressionVariable: { - retval = create(new ExpressionVariableReference(var->slot, var), sourceLocator, parseInfo); + retval = create(new ExpressionVariableReference(var->slot, var.data()), sourceLocator, parseInfo); break; } case VariableDeclaration::FunctionArgument: @@ -1030,7 +1030,7 @@ static Expression::Ptr resolveVariable(const QXmlName &name, } case VariableDeclaration::TemplateParameter: { - retval = create(new TemplateParameterReference(var), sourceLocator, parseInfo); + retval = create(new TemplateParameterReference(var.data()), sourceLocator, parseInfo); break; } case VariableDeclaration::ExternalVariable: -- cgit v1.2.1 From 4dc384b7ae2b944d7d7c28c566abe52bce825502 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 3 Nov 2016 18:27:31 +0100 Subject: remove dependencies from sync.profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the CI obtains them from the qt5 super repo nowadays. Change-Id: If13877a687aba659675274e8a06be2ca9c9a50c9 Reviewed-by: Jędrzej Nowacki --- sync.profile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sync.profile b/sync.profile index 675c687..45a2b44 100644 --- a/sync.profile +++ b/sync.profile @@ -3,13 +3,3 @@ ); %moduleheaders = ( # restrict the module headers to those found in relative path ); -# Module dependencies. -# Every module that is required to build this module should have one entry. -# Each of the module version specifiers can take one of the following values: -# - A specific Git revision. -# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) -# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) -# -%dependencies = ( - "qtbase" => "", -); -- cgit v1.2.1 From b7f8783f25cf1ff0eadbab59701acd46bff58e9a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 Jan 2017 13:27:29 +0100 Subject: Bump version Change-Id: I688c3aaeeb12570544f3de32cb9585f8ebc5f74b --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index ae17d7b..63235ed 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) CONFIG += warning_clean DEFINES += QT_NO_FOREACH -MODULE_VERSION = 5.8.0 +MODULE_VERSION = 5.8.1 -- cgit v1.2.1 From 82c5cc6532ac5d0323ecda94b6767e1fdaef2639 Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Wed, 18 Jan 2017 11:00:13 +0200 Subject: fractionDigits doesn't count the trailing 0s anymore fractionDigits were counting also the trailing 0s, which is against the standard https://www.w3.org/TR/xmlschema-2/#rf-fractionDigits Task-number: QTBUG-58245 Change-Id: I9175d4870de82e25c4df2317394ccfba8048fb48 Reviewed-by: Andy Shaw --- src/xmlpatterns/schema/qxsdtypechecker.cpp | 13 +++++++------ tests/auto/xmlpatternsvalidator/files/fractiondigits.xml | 4 ++++ tests/auto/xmlpatternsvalidator/files/fractiondigits.xsd | 15 +++++++++++++++ .../xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp | 5 +++++ 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 tests/auto/xmlpatternsvalidator/files/fractiondigits.xml create mode 100644 tests/auto/xmlpatternsvalidator/files/fractiondigits.xsd diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp index 2e4ce8e..d6b224f 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker.cpp +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -37,6 +37,8 @@ ** ****************************************************************************/ +#include + #include "qxsdtypechecker_p.h" #include "qabstractdatetime_p.h" @@ -150,13 +152,12 @@ static int fractionDigitsForDecimal(const QString &lexicalValue) { // we use the lexical value here, as the conversion to double might strip // away decimal positions - - QString trimmedValue(lexicalValue.trimmed()); - const int pos = trimmedValue.indexOf(QLatin1Char('.')); - if (pos == -1) // no '.' -> 0 fraction digits + bool ok = false; + double dbl = lexicalValue.toDouble(&ok); + if (!ok) return 0; - else - return (trimmedValue.length() - pos - 1); + dbl = dbl - qFloor(dbl); + return QString::number(dbl).length() - 2; } XsdTypeChecker::XsdTypeChecker(const XsdSchemaContext::Ptr &context, const QVector &namespaceBindings, const QSourceLocation &location) diff --git a/tests/auto/xmlpatternsvalidator/files/fractiondigits.xml b/tests/auto/xmlpatternsvalidator/files/fractiondigits.xml new file mode 100644 index 0000000..55c2ee8 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/fractiondigits.xml @@ -0,0 +1,4 @@ + + + 1234.560000 + diff --git a/tests/auto/xmlpatternsvalidator/files/fractiondigits.xsd b/tests/auto/xmlpatternsvalidator/files/fractiondigits.xsd new file mode 100644 index 0000000..b8f266a --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/fractiondigits.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 8e86dd9..8a11418 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -227,6 +227,11 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << (QStringList() << path + QLatin1String("substitution-group-invalid.xml") << path + QLatin1String("substitution-group.xsd")) << QString(); + QTest::newRow("QTBUG-58245 fraction digits shouldn't take trailing 0 into account") + << 0 + << (QStringList() << path + QLatin1String("fractiondigits.xml") + << path + QLatin1String("fractiondigits.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) -- cgit v1.2.1