diff --git a/Skripten/eoaconvert.cfg b/Skripten/eoaconvert.cfg new file mode 100644 index 0000000..edcb398 --- /dev/null +++ b/Skripten/eoaconvert.cfg @@ -0,0 +1,17 @@ +[General] +# logging +logfile: ./eoaconvert.log +# choose between DEBUG, INFO, WARNING, ERROR, CRITICAL +loglevel: DEBUG + +[Executables] +graphicsmagic: /usr/local/bin/gm +texlive: /usr/local/texlive/2015/ +texbin: /Library/TeX/texbin/ +TRALICS_PATH_EXEC: /Users/kthoden/EOAKram/EOASkripts/thirdparty/tralics-2.15.2/src/tralics +#TRALICS_PATH_EXEC: /Users/kthoden/EOAKram/EOASkripts/thirdparty/tralics-2.14.4 +TRALICS_PATH_LIB: /Users/kthoden/EOAKram/EOASkripts/tralics +PDFTK_PATH: /usr/local/bin/pdftk +TEMPLATE_PATH: /Users/kthoden/EOAKram/EOASkripts/Templates/ +SUPPORT_PATH: /Users/kthoden/EOAKram/EOASkripts/Support/ +AUX_TEX_FILES_PATH: /Users/kthoden/EOAKram/EOASkripts/TeX/ \ No newline at end of file diff --git a/TeX/publication.cfg b/TeX/publication.cfg new file mode 100644 index 0000000..8de9dcf --- /dev/null +++ b/TeX/publication.cfg @@ -0,0 +1,40 @@ +[Technical] +Serie: Sources +Number: 7 +Title: Alvarus Thomas und sein Liber de triplici motu +Subtitle: Band I: Naturphilosophie an der Pariser Artistenfakultät +PublicationDate: 2016-05-01 +PublicationYear: 2016 +ISBN: 978-3-945561-09-6 +Price: 0,00 € +Shoplink: +Language: de +License: by-nc-sa + +[General] +BriefDescription: Untersuchung zum Leben und Werk von Alvarus Thomas im frühen 16. Jahrhundert +Submitter: Matteo Valleriani and Anne-Laurence Caudano +PublicationManagment: Lindy Divarci +PublicationAssistants: NN +Keyword1: MPRL +Keyword2: Edition Open Sources +Keyword3: Frühe Neuzeit +Keyword4: Geschichte der Philosophie +Keyword5: Naturphilosophie +Keyword6: Mechanik +Keyword7: Aristotelismus +Keyword8: +DetailedDescription: Der Liber de triplici +AdditionalInformation: +EditorialCoordination: +Copyediting: Lindy Divarci, Stefan Paul Trzeciok +Dedication: Für meine Familie +Translator: + +[Authors] +Author1: Stefan Paul Trzeciok +Author2: +Author3: +Author4: +Author5: +Zusatz: diff --git a/Templates/DejaVuSerif-BoldItalic.ttf b/Templates/DejaVuSerif-BoldItalic.ttf new file mode 100644 index 0000000..3d73ee7 Binary files /dev/null and b/Templates/DejaVuSerif-BoldItalic.ttf differ diff --git a/Templates/DejaVuSerif-Italic.ttf b/Templates/DejaVuSerif-Italic.ttf new file mode 100644 index 0000000..5057bd0 Binary files /dev/null and b/Templates/DejaVuSerif-Italic.ttf differ diff --git a/Templates/DejaVuSerif-bold.ttf b/Templates/DejaVuSerif-bold.ttf new file mode 100644 index 0000000..0a063ca Binary files /dev/null and b/Templates/DejaVuSerif-bold.ttf differ diff --git a/Templates/DejaVuSerif.ttf b/Templates/DejaVuSerif.ttf new file mode 100644 index 0000000..77f769e Binary files /dev/null and b/Templates/DejaVuSerif.ttf differ diff --git a/Templates/eoa-epub.css b/Templates/eoa-epub.css new file mode 100644 index 0000000..90321f1 --- /dev/null +++ b/Templates/eoa-epub.css @@ -0,0 +1,35 @@ +/* + * h1 { + * font-style: italic; + * } + */ + +body, div, p, h1, h2, h3, h4, dl, dt { + margin: 5pt; + padding: 0pt; + font-family: "DejaVu Serif"; +} +.bibliography { + padding-left: 1em; + text-indent: -1em; +} +@font-face { + font-family: "DejaVu Serif"; + src: url(fonts/DejaVuSerif.ttf); + } +@font-face { + font-family: "DejaVu Serif"; + font-weight: bold; + src: url(fonts/DejaVuSerif-bold.ttf); + } +@font-face { + font-family: "DejaVu Serif"; + font-style: italic; + src: url(fonts/DejaVuSerif-Italic.ttf); + } +@font-face { + font-family: "DejaVu Serif"; + font-style: italic; + font-weight: bold; + src: url(fonts/DejaVuSerif-BoldItalic.ttf); + } diff --git a/thirdparty/epubcheck/.classpath b/thirdparty/epubcheck/.classpath new file mode 100644 index 0000000..c83c666 --- /dev/null +++ b/thirdparty/epubcheck/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/thirdparty/epubcheck/.externalToolBuilders/Jar Builder.launch b/thirdparty/epubcheck/.externalToolBuilders/Jar Builder.launch new file mode 100644 index 0000000..16e017a --- /dev/null +++ b/thirdparty/epubcheck/.externalToolBuilders/Jar Builder.launch @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/.project b/thirdparty/epubcheck/.project new file mode 100644 index 0000000..fcb494b --- /dev/null +++ b/thirdparty/epubcheck/.project @@ -0,0 +1,27 @@ + + + com.adobe.epubcheck + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Jar Builder.launch + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/thirdparty/epubcheck/.settings/org.eclipse.jdt.core.prefs b/thirdparty/epubcheck/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4ac996c --- /dev/null +++ b/thirdparty/epubcheck/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Aug 20 22:49:53 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/thirdparty/epubcheck/.settings/org.eclipse.jdt.ui.prefs b/thirdparty/epubcheck/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..b032fe9 --- /dev/null +++ b/thirdparty/epubcheck/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,5 @@ +#Fri Sep 05 15:39:22 PDT 2008 +eclipse.preferences.version=1 +instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true +internal.default.compliance=default +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/thirdparty/epubcheck/COPYING.txt b/thirdparty/epubcheck/COPYING.txt new file mode 100644 index 0000000..bdfe74d --- /dev/null +++ b/thirdparty/epubcheck/COPYING.txt @@ -0,0 +1,19 @@ +Copyright (c) 2007 Adobe Systems Incorporated + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/thirdparty/epubcheck/Issue28.epub b/thirdparty/epubcheck/Issue28.epub new file mode 100644 index 0000000..fac1233 Binary files /dev/null and b/thirdparty/epubcheck/Issue28.epub differ diff --git a/thirdparty/epubcheck/README.txt b/thirdparty/epubcheck/README.txt new file mode 100644 index 0000000..6952865 --- /dev/null +++ b/thirdparty/epubcheck/README.txt @@ -0,0 +1,61 @@ +This folder contains the distribution of epubcheck project. + +EpubCheck is a tool to validate IDPF Epub files. It can detect many +types of errors in Epub. OCF container structure, OPF and OPS mark-up, +and internal reference consistency are checked. EpubCheck can be run +as a standalone command-line tool, installed as a web application or +used as a library. + +Epubcheck project home: http://code.google.com/p/epubcheck/ + +BUILDING + +To build epubcheck from the sources you need Java Development Kit (JDK) 1.5 or above +and Apache ant (http://ant.apache.org/) 1.6 or above installed + +Run + +ant -f build.xml + +RUNNING + +To run the tool you need Java Runtime (1.5 or above). Any OS should do. Run +it from the command line: + +java -jar epubcheck-x.x.x.jar file.epub + +All detected errors are simply printed to stderr. + +USING AS A LIBRARY + +You can also use EpubCheck as a library in your Java application. EpubCheck +public interfaces can be found in com.adobe.epubcheck.api package. EpubCheck +class can be used to instantiate a validation engine. Use one of its +constructors and then call validate() method. Report is an interface that +you can implement to get a list of the errors and warnings reported by the +validation engine (instead of the error list being printed out). + +LICENSING + +See COPYING.txt + +AUTHORS + +Peter Sorotokin +Garth Conboy +Markus Gylling +Piotr Kula + +Most of the EpubCheck functionality comes from the schema validation tool Jing +and schemas that were developed by IDPF and DAISY. EpubCheck development was +largely done at Adobe Systems. + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine new file mode 100644 index 0000000..327aad0 --- /dev/null +++ b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine @@ -0,0 +1,3 @@ +com.thaiopensource.datatype.xsd.regex.jdk1_4.RegexEngineImpl +com.thaiopensource.datatype.xsd.regex.xerces2.RegexEngineImpl +com.thaiopensource.datatype.xsd.regex.xerces.RegexEngineImpl diff --git a/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory new file mode 100644 index 0000000..44a7cc0 --- /dev/null +++ b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory @@ -0,0 +1,4 @@ +com.thaiopensource.validate.jarv.JarvSchemaReaderFactory +com.thaiopensource.validate.xerces.XsdSchemaReaderFactory +com.thaiopensource.validate.schematron.SaxonSchemaReaderFactory +com.thaiopensource.validate.schematron.XalanSchemaReaderFactory diff --git a/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory new file mode 100644 index 0000000..ff95351 --- /dev/null +++ b/thirdparty/epubcheck/bin/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory @@ -0,0 +1,4 @@ +com.thaiopensource.validate.rng.SAXSchemaReceiverFactory +com.thaiopensource.validate.mns.MnsSchemaReceiverFactory +com.thaiopensource.validate.nrl.NrlSchemaReceiverFactory +com.thaiopensource.validate.auto.SchemaReaderLoaderSchemaReceiverFactory diff --git a/thirdparty/epubcheck/bin/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader b/thirdparty/epubcheck/bin/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader new file mode 100644 index 0000000..6393d7f --- /dev/null +++ b/thirdparty/epubcheck/bin/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader @@ -0,0 +1 @@ +com.thaiopensource.relaxng.jarv.VerifierFactoryLoaderImpl diff --git a/thirdparty/epubcheck/bin/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory b/thirdparty/epubcheck/bin/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory new file mode 100644 index 0000000..1353184 --- /dev/null +++ b/thirdparty/epubcheck/bin/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory @@ -0,0 +1 @@ +com.thaiopensource.datatype.xsd.DatatypeLibraryFactoryImpl diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck$ProxyReport.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck$ProxyReport.class new file mode 100644 index 0000000..63cd16e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck$ProxyReport.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck.class new file mode 100644 index 0000000..0fc6def Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/EpubCheck.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/Report.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/Report.class new file mode 100644 index 0000000..5963235 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/api/Report.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTest.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTest.class new file mode 100644 index 0000000..6cba156 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTest.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTestContentHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTestContentHandler.class new file mode 100644 index 0000000..be8824a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/AutoTestContentHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/Result.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/Result.class new file mode 100644 index 0000000..a7a0ff8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/autotest/Result.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapChecker.class new file mode 100644 index 0000000..6e88671 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.class new file mode 100644 index 0000000..45a5dee Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookChecker.class new file mode 100644 index 0000000..04b23c6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.class new file mode 100644 index 0000000..6afa70b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookHandler.class new file mode 100644 index 0000000..2902740 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtbook/DTBookHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd new file mode 100644 index 0000000..72b26d3 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd @@ -0,0 +1,2824 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/ncx-2005-1.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/ncx-2005-1.dtd new file mode 100644 index 0000000..441b2cc --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/ncx-2005-1.dtd @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/oeb12.dtdinc b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/oeb12.dtdinc new file mode 100644 index 0000000..f2e4af6 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/oeb12.dtdinc @@ -0,0 +1,1136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/opf20.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/opf20.dtd new file mode 100644 index 0000000..72207eb --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/opf20.dtd @@ -0,0 +1,296 @@ + + + + + + +%OEBEntities; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/svg11.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/svg11.dtd new file mode 100644 index 0000000..30f87e8 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/svg11.dtd @@ -0,0 +1,5790 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc new file mode 100644 index 0000000..7b7b407 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-special.dtdinc b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-special.dtdinc new file mode 100644 index 0000000..2ea205f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-special.dtdinc @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc new file mode 100644 index 0000000..3f8f8e6 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-strict.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-strict.dtd new file mode 100644 index 0000000..8126d7e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-strict.dtd @@ -0,0 +1,979 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd new file mode 100644 index 0000000..59e6770 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd @@ -0,0 +1,1200 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXChecker.class new file mode 100644 index 0000000..8a9356a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXCheckerFactory.class new file mode 100644 index 0000000..38270a1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXHandler.class new file mode 100644 index 0000000..a531001 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ncx/NCXHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionFilter.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionFilter.class new file mode 100644 index 0000000..d4c47e4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionFilter.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionHandler.class new file mode 100644 index 0000000..a3554e9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/EncryptionHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.class new file mode 100644 index 0000000..7165cf4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFChecker.class new file mode 100644 index 0000000..18a4cdb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFHandler.class new file mode 100644 index 0000000..55a05f8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFPackage.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFPackage.class new file mode 100644 index 0000000..9fda516 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/OCFPackage.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.class new file mode 100644 index 0000000..8ee2d8b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentChecker.class new file mode 100644 index 0000000..39a27d1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentCheckerFactory.class new file mode 100644 index 0000000..e79c93d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/ContentCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentChecker.class new file mode 100644 index 0000000..0954da6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentCheckerFactory.class new file mode 100644 index 0000000..e28c6a9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/GenericContentCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFChecker.class new file mode 100644 index 0000000..f60693d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFHandler.class new file mode 100644 index 0000000..7c1de6b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFItem.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFItem.class new file mode 100644 index 0000000..f8b58ae Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/OPFItem.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Anchor.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Anchor.class new file mode 100644 index 0000000..1c92ccc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Anchor.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Reference.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Reference.class new file mode 100644 index 0000000..d35ca2a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Reference.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Resource.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Resource.class new file mode 100644 index 0000000..10314e6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker$Resource.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker.class new file mode 100644 index 0000000..bc8d6f7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/opf/XRefChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSChecker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSChecker.class new file mode 100644 index 0000000..a0fc80d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSCheckerFactory.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSCheckerFactory.class new file mode 100644 index 0000000..445498d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSCheckerFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSHandler.class new file mode 100644 index 0000000..c408c47 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/OPSHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/registeredSchemas.txt b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/registeredSchemas.txt new file mode 100644 index 0000000..6c4428f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/ops/registeredSchemas.txt @@ -0,0 +1,74 @@ +aaa:// +aaas:// +acap:// +cap:// +cid: +crid:// +data: +dav: +dict:// +dns:// +fax: +file:// +ftp:// +go:// +gopher:// +h323: +http:// +https:// +icap:// +im: +imap:// +info: +ipp:// +iris: +iris.beep: +iris.xpc: +iris.xpcs: +iris.lwz: +ldap:// +mailto: +mid: +modem: +msrp:// +msrps:// +mtqp:// +mupdate:// +news:// +nfs:// +nntp:// +opaquelocktoken: +pop:// +pres: +rtsp:// +service: +shttp:// +sip: +sips: +snmp:// +soap.beep:// +soap.beeps:// +tag: +tel: +telnet:// +tftp:// +thismessage: +tip:// +tv: +urn: +vemmi:// +xmlrpc.beep:// +xmlrpc.beeps:// +xmpp:// +z39.50r:// +z39.50s:// +afs: +dtn: +iax: +mailserver: +pack:// +tn3270: +prospero:// +snews:// +videotex: +wais:// diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/container.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/container.rng new file mode 100644 index 0000000..901d65a --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/container.rng @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-svg.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-svg.rng new file mode 100644 index 0000000..73cd553 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-svg.rng @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-xhtml.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-xhtml.rng new file mode 100644 index 0000000..5a63a6a --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content-xhtml.rng @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content.rng new file mode 100644 index 0000000..3c20017 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/content.rng @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/dtbook-2005-2.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/dtbook-2005-2.rng new file mode 100644 index 0000000..42fe625 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/dtbook-2005-2.rng @@ -0,0 +1,4110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + xxx + xxp + xlx + xlp + bxx + bxp + blx + blp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2005-2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + required + optional + + + + + + + + + + + + + + + + + + + + + required + optional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + front + normal + special + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ol + ul + pl + + + + + + + + + 1 + a + A + i + I + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + row + col + rowgroup + colgroup + + + + + + void + above + below + hsides + lhs + rhs + vsides + box + border + + + + + + none + groups + rows + cols + all + + + + + + + + left + center + right + justify + char + + + + + + + + + + + + + + + + + + + + top + middle + bottom + baseline + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/encryption.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/encryption.rng new file mode 100644 index 0000000..9cbf3d8 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/encryption.rng @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx-old.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx-old.rng new file mode 100644 index 0000000..dae2370 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx-old.rng @@ -0,0 +1,253 @@ + + + + + + 2005-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx.rng new file mode 100644 index 0000000..2b1d14a --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ncx.rng @@ -0,0 +1,295 @@ + + + + + + + + + 2005-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf.rng new file mode 100644 index 0000000..83b1cac --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf.rng @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf12.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf12.rng new file mode 100644 index 0000000..a63b77d --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf12.rng @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf20.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf20.rng new file mode 100644 index 0000000..f3f9142 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/opf20.rng @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops/ops-switch.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops/ops-switch.rng new file mode 100644 index 0000000..5dd7954 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops/ops-switch.rng @@ -0,0 +1,51 @@ + + + + + OPS conditional processing: switch, case and default elements + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.nrl b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.nrl new file mode 100644 index 0000000..64c3f05 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.nrl @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.rng new file mode 100644 index 0000000..619cade --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/ops20.rng @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/signatures.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/signatures.rng new file mode 100644 index 0000000..9bd9a12 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/signatures.rng @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animation.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animation.rng new file mode 100644 index 0000000..788166e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animation.rng @@ -0,0 +1,412 @@ + + + + + SVG 1.1 Animation Module + file: svg-animation.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-animation.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Animation + + animate, set, animateMotion, animateColor, animateTransform, mpath + + This module declares markup to provide support for animation. + + + + SVG.Animation.class + + + + + + + + + + + + + + + + + + + SVG.Animation.attrib + + + + + + + + + + + + + SVG.AnimationAttribute.attrib + + + + + + + + + + + + + + + + SVG.AnimationTiming.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + always + never + whenNotActive + + + + + + + + + + + + + remove + freeze + + + + + + + + SVG.AnimationValue.attrib + + + + + + + + + + + discrete + linear + paced + spline + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.AnimationAddtion.attrib + + + + + + + + + + + replace + sum + + + + + + + none + sum + + + + + + + + animate: Animate Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + set: Set Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateMotion: Animate Motion Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + discrete + linear + paced + spline + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateColor: Animate Color Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateTransform: Animate Transform Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + translate + scale + rotate + skewX + skewY + + + + + + + mpath: Motion Path Element + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng new file mode 100644 index 0000000..aeaf682 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng @@ -0,0 +1,61 @@ + + + + + SVG 1.1 Animation Events Attribute Module + file: svg-animevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-animevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Animation Events Attribute + + onbegin, onend, onrepeat, onload + + This module defines the AnimationEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng new file mode 100644 index 0000000..df313f9 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng @@ -0,0 +1,129 @@ + + + + + SVG 1.1 Basic Clip Module + file: svg-basic-clip.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-clip.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Clip + + clipPath + + This module declares markup to provide support for clipping. + + + + Datatypes + + + + + + + + SVG.Clip.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Clip.class + + + + + + + + + + + + + + + clipPath: Clip Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng new file mode 100644 index 0000000..d57e037 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng @@ -0,0 +1,870 @@ + + + + + SVG 1.1 Basic Filter Module + file: svg-basic-filter.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-filter.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Filter + + filter, feBlend, feColorMatrix, feComponentTransfer, feComposite, + feFlood, feGaussianBlur, feImage, feMerge, feMergeNode, feOffset, + feTile, feFuncR, feFuncG, feFuncB, feFuncA + + This module declares markup to provide support for filter effect. + + + + Datatypes + + + + + + + + + + + + SVG.Filter.attrib + + + + + + + + + + + + + + + + + SVG.FilterColor.attrib + + + + + + + + + + + auto + sRGB + linearRGB + inherit + + + + + + + + SVG.Filter.class + + + + + + + + + + + + + + + SVG.FilterPrimitive.class + + + + + + + + + + + + + + + + + + + + + + + + SVG.FilterPrimitive.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.FilterPrimitiveWithIn.attrib + + + + + + + + + + + + + + + + filter: Filter Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + feBlend: Filter Effect Blend Element + + + + + + + + + + + + + + + + + + + + + + + + + + + normal + multiply + screen + darken + lighten + + + + + + + feColorMatrix: Filter Effect Color Matrix Element + + + + + + + + + + + + + + + + + + + + + + + + + + matrix + saturate + hueRotate + luminanceToAlpha + + + + + + + + + + feComponentTransfer: Filter Effect Component Transfer Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feComposite: Filter Effect Composite Element + + + + + + + + + + + + + + + + + + + + + + + + + + + over + in + out + atop + xor + arithmetic + + + + + + + + + + + + + + + + + + + + + + + + + + + feFlood: Filter Effect Flood Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feGaussianBlur: Filter Effect Gaussian Blur Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feImage: Filter Effect Image Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feMerge: Filter Effect Merge Element + + + + + + + + + + + + + + + + + + + + + + + feMergeNode: Filter Effect Merge Node Element + + + + + + + + + + + + + + + + + + + + + + + + + + + feOffset: Filter Effect Offset Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feTile: Filter Effect Tile Element + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncR: Filter Effect Function Red Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncG: Filter Effect Function Green Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncB: Filter Effect Function Blue Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncA: Filter Effect Function Alpha Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-font.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-font.rng new file mode 100644 index 0000000..eb68203 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-font.rng @@ -0,0 +1,544 @@ + + + + + SVG 1.1 Basic Font Module + file: svg-basic-font.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-font.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Font + + font, font-face, glyph, missing-glyph, hkern, vkern, font-face-src, + font-face-uri, font-face-name + + This module declares markup to provide support for template. + + + + SVG.Font.class + + + + + + + + + + + + + + + + font: Font Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face: Font Face Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + glyph: Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + missing-glyph: Missing Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hkern: Horizontal Kerning Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vkern: Vertical Kerning Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face-src: Font Face Source Element + + + + + + + + + + + + + + + + + + + + + + + + font-face-uri: Font Face URI Element + + + + + + + + + + + + + + + + + + + + font-face-name: Font Face Name Element + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng new file mode 100644 index 0000000..6ab7361 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng @@ -0,0 +1,74 @@ + + + + + SVG 1.1 Basic Graphics Attribute Module + file: svg-basic-graphics-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-graphics-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Graphics Attribute + + display, visibility + + This module defines the Graphics attribute set. + + + + + + + inline + block + list-item + run-in + compact + marker + table + inline-table + table-row-group + table-header-group + table-footer-group + table-row + table-column-group + table-column + table-cell + table-caption + none + inherit + + + + + + + + + + visible + hidden + inherit + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng new file mode 100644 index 0000000..2839f7f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng @@ -0,0 +1,666 @@ + + + + + SVG 1.1 Basic Structure Module + file: svg-basic-structure.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-structure.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Structure + + svg, g, defs, desc, title, metadata, use + + This module declares the major structural elements and their attributes. + + + + +
+ + Include core set of modules + + + + + Datatypes Module + + + + + + Core Attribute Module + + +
+ + + Content Models (Default) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Attribute Collections (Default) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Description.class + + + + + + + + + + + + + + + + + SVG.Use.class + + + + + + + + + + + + + + + SVG.Structure.class + + + + + + + + + + + + + + + + + + SVG.Presentation.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + svg: SVG Document Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disable + magnify + + + + + + 1.1 + + + + + + + + + + + + + + + + + + + + + g: Group Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + defs: Definisions Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + desc: Description Element + + + + + + + + + + + + + + + + + + + + title: Title Element + + + + + + + + + + + + + + + + + + + + metadata: Metadata Element + + + + + + + + + + + + + + + + + + + use: Use Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-text.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-text.rng new file mode 100644 index 0000000..3a67492 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-basic-text.rng @@ -0,0 +1,273 @@ + + + + + SVG 1.1 Basic Text Module + file: svg-basic-text.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-text.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Text + + text, altGlyph, altGlyphDef, glyphRef + + This module declares markup to provide support for text. + + + + Datatypes + + + + + + + + + + + + SVG.Font.attrib + + + + + + + + + + + + + + + + + + + + + normal + italic + oblique + inherit + + + + + + + normal + bold + bolder + lighter + 100 + 200 + 300 + 400 + 500 + 600 + 700 + 800 + 900 + inherit + + + + + + + + SVG.Text.class + + + + + + + + + + + + + + + SVG.TextContent.class + + + + + + + + + + + + + + + text: Text Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyph: Alternate Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyphDef: Alternate Glyph Definition Element + + + + + + + + + + + + + + + + + + + + + glyphRef: Glyph Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-clip.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-clip.rng new file mode 100644 index 0000000..eacd793 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-clip.rng @@ -0,0 +1,37 @@ + + + + + SVG 1.1 Clip Module + file: svg-clip.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-clip.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Clip + + clipPath + + This module declares markup to provide support for clipping. + + + + + + + extend content model of clipPath + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-conditional.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-conditional.rng new file mode 100644 index 0000000..756f4ed --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-conditional.rng @@ -0,0 +1,124 @@ + + + + + SVG 1.1 Conditional Processing Module + file: svg-conditional.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-conditional.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Conditional Processing + + switch + + This module declares markup to provide support for conditional processing. + + + + Datatypes + + + + + + + + + + + + SVG.Conditional.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Conditional.class + + + + + + + + + + + + + + + switch: Switch Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng new file mode 100644 index 0000000..a2e958c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng @@ -0,0 +1,49 @@ + + + + + SVG 1.1 Container Attribute Module + file: svg-container-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-container-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Container Attribute + + enable-background + + This module defines the Container attribute set. + + + + + 'enable-background' property/attribute value (e.g., 'new', 'accumulate') + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng new file mode 100644 index 0000000..c8f0c81 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng @@ -0,0 +1,73 @@ + + + + + SVG 1.1 Core Attribute Module + file: svg-core-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-core-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Core Attribute + + id, xml:base, xml:lang, xml:space + + This module defines the core set of attributes that can be present on + any element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-cursor.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-cursor.rng new file mode 100644 index 0000000..d9ce19b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-cursor.rng @@ -0,0 +1,99 @@ + + + + + SVG 1.1 Cursor Module + file: svg-cursor.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-cursor.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Cursor + + cursor + + This module declares markup to provide support for cursor. + + + + Datatypes + + + + + + + + SVG.Cursor.attrib + + + + + + + + + + + + + + + + + SVG.Cursor.class + + + + + + + + + + + + + + + cursor: Cursor Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-datatypes.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-datatypes.rng new file mode 100644 index 0000000..82aee63 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-datatypes.rng @@ -0,0 +1,188 @@ + + + + + SVG 1.1 Datatypes Module + file: svg-datatypes.mod + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-datatypes.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Datatypes + + This module declares common data types for properties and attributes. + + + + feature specification + + + + + false + true + + + + + + 'clip-rule' or 'fill-rule' property/attribute value + + + nonzero + evenodd + inherit + + + + + + media type, as per [RFC2045] + + + + + + + a <coordinate> + + + + + + + a list of <coordinate>s + + + + + + + a <color> value + + + + + + + a <integer> + + + + + + + a language code, as per [RFC3066] + + + + + + + comma-separated list of language codes, as per [RFC3066] + + + + + + + a <ength> + + + + + + + a list of <length>s + + + + + + + a <number> + + + + + + + a list of <number>s + + + + + + + + opacity value (e.g., <number>) + + + + + + + a path data specification + + + + + + + 'preserveAspectRatio' attribute specification + + + \s*(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)\s+(meet|slice)?\s* + + + + + + script expression + + + + + + + An SVG color value (RGB plus optional ICC) + + + + + + + arbitrary text string + + + + + + + list of transforms + + + + + + + a Uniform Resource Identifier, see [URI] + + + + + + + 'viewBox' attribute specification + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng new file mode 100644 index 0000000..9d63bd4 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng @@ -0,0 +1,87 @@ + + + + + SVG 1.1 Document Events Attribute Module + file: svg-docevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-docevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Document Events Attribute + + onunload, onabort, onerror, onresize, onscroll, onzoom + + This module defines the DocumentEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extensibility.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extensibility.rng new file mode 100644 index 0000000..097a9e9 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extensibility.rng @@ -0,0 +1,125 @@ + + + + + SVG 1.1 Extensibility Module + file: svg-extensibility.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-extensibility.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + + Extensibility + + foreignObject + + This module declares markup to provide support for extensibility. + + + + SVG.Extensibility.class + + + + + + + + + + + + + + + + + + + foreignObject: Foreign Object Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + any element in foreign namespace + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng new file mode 100644 index 0000000..017b9e1 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng @@ -0,0 +1,42 @@ + + + + + SVG 1.1 External Resources Attribute Module + file: svg-extresources-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-extresources-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + External Resources Attribute + + externalResourcesRequired + + This module defines the External attribute set. + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-filter.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-filter.rng new file mode 100644 index 0000000..a7250bc --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-filter.rng @@ -0,0 +1,512 @@ + + + + + SVG 1.1 Filter Module + file: svg-filter.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-filter.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Filter + + filter, feBlend, feColorMatrix, feComponentTransfer, feComposite, + feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feFlood, + feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset, + feSpecularLighting, feTile, feTurbulence, feDistantLight, fePointLight, + feSpotLight, feFuncR, feFuncG, feFuncB, feFuncA + + This module declares markup to provide support for filter effect. + + + + + + + extend SVG.FilterPrimitive.class + + + + + + + + + + + + + feConvolveMatrix: Filter Effect Convolve Matrix Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + duplicate + wrap + none + + + + + + + + + + + + + + + + + feDiffuseLighting: Filter Effect Diffuse Lighting Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feDisplacementMap: Filter Effect Displacement Map Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + R + G + B + A + + + + + + + R + G + B + A + + + + + + + feMorphology: Filter Effect Morphology Element + + + + + + + + + + + + + + + + + + + + + + + + + + erode + dilate + + + + + + + + + + + + feSpecularLighting: Filter Effect Specular Lighting Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feTurbulence: Filter Effect Turbulence Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stitch + noStitch + + + + + + + fractalNoise + turbulence + + + + + + + feDistantLight: Filter Effect Distant Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fePointLight: Filter Effect Point Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feSpotLight: Filter Effect Spot Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-font.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-font.rng new file mode 100644 index 0000000..e545cfb --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-font.rng @@ -0,0 +1,146 @@ + + + + + SVG 1.1 Font Module + file: svg-font.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-font.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Font + + font, font-face, glyph, missing-glyph, hkern, vkern, font-face-src, + font-face-uri, font-face-format, font-face-name, definition-src + + This module declares markup to provide support for template. + + + + + + font-face: Font Face Element + + + + + + + + + + glyph: Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + missing-glyph: Missing Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face-uri: Font Face URI Element + + + + + + + + + + font-face-format: Font Face Format Element + + + + + + + + + + + + + + + + + + + + + + definition-src: Definition Source Element + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-gradient.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-gradient.rng new file mode 100644 index 0000000..425eff1 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-gradient.rng @@ -0,0 +1,259 @@ + + + + + SVG 1.1 Gradient Module + file: svg-gradient.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-gradient.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Gradient + + linearGradient, radialGradient, stop + + This module declares markup to provide support for gradient fill. + + + + Datatypes + + + + + + + + SVG.Gradient.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Gradient.class + + + + + + + + + + + + + + + + linearGradient: Linear Gradient Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + pad + reflect + repeat + + + + + + + radialGradient: Radial Gradient Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + pad + reflect + repeat + + + + + + + stop: Stop Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng new file mode 100644 index 0000000..edc7741 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng @@ -0,0 +1,124 @@ + + + + + SVG 1.1 Graphical Element Events Attribute Module + file: svg-graphevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-graphevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Graphical Element Events Attribute + + onfocusin, onfocusout, onactivate, onclick, onmousedown, onmouseup, + onmouseover, onmousemove, onmouseout, onload + + This module defines the GraphicalEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng new file mode 100644 index 0000000..15029e5 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng @@ -0,0 +1,95 @@ + + + + + SVG 1.1 Graphics Attribute Module + file: svg-graphics-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-graphics-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Graphics Attribute + + display, image-rendering, pointer-events, shape-rendering, + text-rendering, visibility + + This module defines the Graphics attribute set. + + + + + + + + + auto + optimizeSpeed + optimizeQuality + inherit + + + + + + + + + + visiblePainted + visibleFill + visibleStroke + visible + painted + fill + stroke + all + none + inherit + + + + + + + + + + auto + optimizeSpeed + crispEdges + geometricPrecision + inherit + + + + + + + + + + auto + optimizeSpeed + optimizeLegibility + geometricPrecision + inherit + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng new file mode 100644 index 0000000..d13ba49 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng @@ -0,0 +1,106 @@ + + + + + SVG 1.1 Hyperlinking Module + file: svg-hyperlink.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-hyperlink.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Hyperlinking + + a + + This module declares markup to provide support for hyper linking. + + + + + link to this target + + + + + + SVG.Hyperlink.class + + + + + + + + + + + + + + + a: Anchor Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-image.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-image.rng new file mode 100644 index 0000000..78bca9e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-image.rng @@ -0,0 +1,104 @@ + + + + + SVG 1.1 Image Module + file: svg-image.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-image.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Image + + image + + This module declares markup to provide support for image. + + + + SVG.Image.class + + + + + + + + + + + + + + + image: Image Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-marker.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-marker.rng new file mode 100644 index 0000000..311d59f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-marker.rng @@ -0,0 +1,161 @@ + + + + + SVG 1.1 Marker Module + file: svg-marker.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-marker.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Marker + + marker + + This module declares markup to provide support for marker. + + + + Datatypes + + + + + + + + SVG.Marker.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Marker.class + + + + + + + + + + + + + + + marker: Marker Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + strokeWidth + userSpaceOnUse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-mask.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-mask.rng new file mode 100644 index 0000000..929fc07 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-mask.rng @@ -0,0 +1,148 @@ + + + + + SVG 1.1 Mask Module + file: svg-mask.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-mask.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Mask + + mask + + This module declares markup to provide support for masking. + + + + + Datatypes + + + + + + + + SVG.Mask.attrib + + + + + + + + + + + + + + + + + SVG.Mask.class + + + + + + + + + + + + + + + mask: Mask Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng new file mode 100644 index 0000000..9ba06c5 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng @@ -0,0 +1,60 @@ + + + + + SVG 1.1 Paint Opacity Attribute Module + file: svg-opacity-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-opacity-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Paint Opacity Attribute + + opacity, fill-opacity, stroke-opacity + + This module defines the Opacity attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng new file mode 100644 index 0000000..9aea366 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng @@ -0,0 +1,207 @@ + + + + + SVG 1.1 Paint Attribute Module + file: svg-paint-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-paint-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Paint Attribute + + fill, fill-rule, stroke, stroke-dasharray, stroke-dashoffset, + stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-width, color, + color-interpolation, color-rendering + + This module defines the Paint and Color attribute sets. + + + + + a 'fill' or 'stroke' property/attribute value: <paint> + + + + + + + 'stroke-dasharray' property/attribute value + (e.g., 'none', list of <number>s) + + + + + + + 'stroke-dashoffset' property/attribute value (e.g., 'none', <legnth>) + + + + + + + 'stroke-miterlimit' property/attribute value (e.g., <number>) + + + + + + + 'stroke-width' property/attribute value (e.g., <length>) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + butt + round + square + inherit + + + + + + + + + + miter + round + bevel + inherit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auto + sRGB + linearRGB + inherit + + + + + + + + + + auto + optimizeSpeed + optimizeQuality + inherit + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-pattern.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-pattern.rng new file mode 100644 index 0000000..899cc99 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-pattern.rng @@ -0,0 +1,138 @@ + + + + + SVG 1.1 Pattern Module + file: svg-pattern.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-pattern.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Pattern + + pattern + + This module declares markup to provide support for pattern fill. + + + + SVG.Pattern.class + + + + + + + + + + + + + + + pattern: Pattern Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-profile.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-profile.rng new file mode 100644 index 0000000..4bf6072 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-profile.rng @@ -0,0 +1,92 @@ + + + + + SVG 1.1 Color Profile Module + file: svg-profile.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-profile.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Color Profile + + color-profile + + This module declares markup to provide support for color profile. + + + + SVG.Profile.attrib + + + + + + + + + + + + + + + SVG.Profile.class + + + + + + + + + + + + + + + color-profile: Color Profile Element + + + + + + + + + + + + + + + + + + + + + + + + + + auto + perceptual + relative-colorimetric + saturation + absolute-colorimetric + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-qname.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-qname.rng new file mode 100644 index 0000000..2a13e0d --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-qname.rng @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-script.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-script.rng new file mode 100644 index 0000000..1ddaf8a --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-script.rng @@ -0,0 +1,64 @@ + + + + + SVG 1.1 Scripting Module + file: svg-script.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-script.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Scripting + + script + + This module declares markup to provide support for scripting. + + + + SVG.Script.class + + + + + + + + + + + + + + + script: Script Element + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-shape.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-shape.rng new file mode 100644 index 0000000..5f788bf --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-shape.rng @@ -0,0 +1,433 @@ + + + + + SVG 1.1 Shape Module + file: svg-shape.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-shape.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Shape + + path, rect, circle, line, ellipse, polyline, polygon + + This module declares markup to provide support for graphical shapes. + + + + + a list of points + + + + + + SVG.Shape.class + + + + + + + + + + + + + + + + + + + + + path: Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rect: Rectangle Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + circle: Circle Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + line: Line Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ellipse: Ellipse Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + polyline: Polyline Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + polygon: Polygon Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-structure.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-structure.rng new file mode 100644 index 0000000..97ac566 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-structure.rng @@ -0,0 +1,92 @@ + + + + + SVG 1.1 Structure Module + file: svg-structure.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-structure.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Structure + + svg, g, defs, desc, title, metadata, symbol, use + + This module declares the major structural elements and their attributes. + + + + + + + extend SVG.Structure.class + + + + + + + + symbol: Symbol Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-style.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-style.rng new file mode 100644 index 0000000..ed2aa2c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-style.rng @@ -0,0 +1,121 @@ + + + + + SVG 1.1 Style Module + file: svg-style.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-style.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Style + + style + + This module declares markup to provide support for stylesheet. + + + + Datatypes + + + + + + + + + + + + + comma-separated list of media descriptors. + + + + + + SVG.Style.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Style.class + + + + + + + + + + + + + + + style: Style Element + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-text.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-text.rng new file mode 100644 index 0000000..6aece2b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-text.rng @@ -0,0 +1,627 @@ + + + + + SVG 1.1 Text Module + file: svg-text.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-text.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Text + + text, tspan, tref, textPath, altGlyph, altGlyphDef, altGlyphItem, + glyphRef + + This module declares markup to provide support for alternate glyph. + + + + + + Datatypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Text.attrib + + + + + + + + + + + lr-tb + rl-tb + tb-rl + lr + rl + tb + inherit + + + + + + + + SVG.TextContent.attrib + + + + + + + + + + + auto + baseline + before-edge + text-before-edge + middle + central + after-edge + text-after-edge + ideographic + alphabetic + hanging + mathematical + inherit + + + + + + + + + + + + ltr + rtl + inherit + + + + + + + auto + use-script + no-change + reset-size + ideographic + alphabetic + hanging + mathematical + central + middle + text-after-edge + text-before-edge + inherit + + + + + + + + + + + + + + + + + + + + + + + + + + + start + middle + end + inherit + + + + + + + + + + + + normal + embed + bidi-override + inherit + + + + + + + + + + + + + + + + + + + + + normal + wider + narrower + ultra-condensed + extra-condensed + condensed + semi-condensed + semi-expanded + expanded + extra-expanded + ultra-expanded + inherit + + + + + + + normal + small-caps + inherit + + + + + + + + extend SVG.Text.class + + + + + + + + + extend SVG.TextContent.class + + + + + + + + + + text: Text Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + tspan: Text Span Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + tref: Text Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + textPath: Text Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + align + stretch + + + + + + + auto + exact + + + + + + + altGlyph: Alternate Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyphDef: Alternate Glyph Definition Element + + + + + + + + + + + + altGlyphItem: Alternate Glyph Item Element + + + + + + + + + + + + + + + + + + + + + glyphRef: Glyph Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-view.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-view.rng new file mode 100644 index 0000000..15e790e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-view.rng @@ -0,0 +1,83 @@ + + + + + SVG 1.1 View Module + file: svg-view.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-view.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + View + + view + + This module declares markup to provide support for view. + + + + SVG.View.class + + + + + + + + + + + + + + + view: View Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disable + magnify + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng new file mode 100644 index 0000000..60f0ed0 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng @@ -0,0 +1,64 @@ + + + + + SVG 1.1 Viewport Attribute Module + file: svg-viewport-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-viewport-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Viewport Attribute + + clip, overflow + + This module defines the Viewport attribute set. + + + + + 'clip' property/attribute value (e.g., 'auto', rect(...)) + + + + + + + + + + + + + + + + + visible + hidden + scroll + auto + inherit + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng new file mode 100644 index 0000000..e28200b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng @@ -0,0 +1,194 @@ + + + + + SVG 1.1 XLink Attribute Module + file: svg-xlink-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-xlink-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + XLink Attribute + + type, href, role, arcrole, title, show, actuate + + This module defines the XLink, XLinkRequired, XLinkEmbed, and + XLinkReplace attribute set. + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + + + other + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + other + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + embed + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + new + replace + + + + + + onRequest + + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg11.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg11.rng new file mode 100644 index 0000000..d3ed76c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/svg11.rng @@ -0,0 +1,231 @@ + + + + + RELAX NG schema for SVG 1.1 + file: svg11.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + + The Scalable Vector Graphics (SVG) + Copyright 2001, 2002 World Wide Web Consortium + (Massachusetts Institute of Technology, Institut National de + Recherche en Informatique et en Automatique, Keio University). + All Rights Reserved. + + Permission to use, copy, modify and distribute this RELAX NG schema + for SVG and its accompanying documentation for any purpose and without + fee is hereby granted in perpetuity, provided that the above copyright + notice and this paragraph appear in all copies. The copyright holders + nor the author make no representation about the suitability of this + RELAX NG schema for any purpose. + + It is provided "as is" without expressed or implied warranty. + + Author: Masayasu Ishikawa (mimasa@w3.org) + $Id: svg11.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + This is the driver file for version 1.1 of the SVG RELAX NG schema. + + The DTD version is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD SVG 1.1//EN" + SYSTEM "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" + + Use this URI to identify the default namespace: + + "http://www.w3.org/2000/svg" + + + + + Container Attribute Module + + + + + + Viewport Attribute Module + + + + + + Paint Attribute Module + + + + + + Paint Opacity Attribute Module + + + + + + Graphics Attribute Module + + + + + + Document Events Attribute Module + + + + + + Graphical Element Events Attribute Module + + + + + + Animation Events Attribute Module + + + + + + XLink Attribute Module + + + + + + External Resources Attribute Module + + + + + + Structure Module (required) + + + + + + Conditional Processing Module + + + + + + Image Module + + + + + + Style Module + + + + + + Shape Module + + + + + + Text Module + + + + + + Marker Module + + + + + + Color Profile Module + + + + + + Gradient Module + + + + + + Pattern Module + + + + + + Clip Module + + + + + + Mask Module + + + + + + Filter Module + + + + + + Cursor Module + + + + + + Hyperlinking Module + + + + + + View Module + + + + + + Scripting Module + + + + + + Animation Module + + + + + + Font Module + + + + + + Extensibility Module + + + + + + The root element is "svg". + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xenc-schema.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xenc-schema.rng new file mode 100644 index 0000000..972a879 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xenc-schema.rng @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/applet.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/applet.rng new file mode 100644 index 0000000..dbdef46 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/applet.rng @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/attribs.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/attribs.rng new file mode 100644 index 0000000..2616a5c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/attribs.rng @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/base.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/base.rng new file mode 100644 index 0000000..e0f30bf --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/base.rng @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-form.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-form.rng new file mode 100644 index 0000000..d0c4075 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-form.rng @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + get + post + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + checked + + + + + + + + + + + + + + + + + + + + + + + + + text + password + checkbox + radio + submit + reset + hidden + + + + + + + + + + + + + + + + + + + + + + + + + multiple + + + + + + + + + + selected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-table.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-table.rng new file mode 100644 index 0000000..5855b4d --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/basic-table.rng @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + center + right + + + + + + + + + + top + middle + bottom + + + + + + + + + + row + col + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/bdo.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/bdo.rng new file mode 100644 index 0000000..7e5c7c6 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/bdo.rng @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/csismap.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/csismap.rng new file mode 100644 index 0000000..02004b8 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/csismap.rng @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + nohref + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rect + circle + poly + default + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/datatypes.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/datatypes.rng new file mode 100644 index 0000000..eac3e34 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/datatypes.rng @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/edit.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/edit.rng new file mode 100644 index 0000000..c9c0f13 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/edit.rng @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/events.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/events.rng new file mode 100644 index 0000000..a408c1e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/events.rng @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/form.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/form.rng new file mode 100644 index 0000000..80dd016 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/form.rng @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disabled + + + + + readonly + + + + + + + + + + + + + + + + + + + + image + button + + + + + + + disabled + + + + + + + + + + + + + disabled + + + + + + + + + + + + + + + + + + + + + + + disabled + + + + + + + + + + + disabled + + + + + readonly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + button + submit + reset + + + + + + disabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/frames.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/frames.rng new file mode 100644 index 0000000..c3887d9 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/frames.rng @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + + + + + noresize + + + + + + yes + no + auto + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/hypertext.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/hypertext.rng new file mode 100644 index 0000000..e880ebb --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/hypertext.rng @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/iframe.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/iframe.rng new file mode 100644 index 0000000..07a9187 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/iframe.rng @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + auto + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/image.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/image.rng new file mode 100644 index 0000000..6bc5d6c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/image.rng @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/inlstyle.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/inlstyle.rng new file mode 100644 index 0000000..e7342fb --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/inlstyle.rng @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/legacy.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/legacy.rng new file mode 100644 index 0000000..19e1983 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/legacy.rng @@ -0,0 +1,502 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + all + right + none + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + left + center + right + + + + + + noshade + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + + + top + bottom + left + right + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nowrap + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + left + all + right + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/link.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/link.rng new file mode 100644 index 0000000..8361603 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/link.rng @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/list.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/list.rng new file mode 100644 index 0000000..cc5c42e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/list.rng @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/meta.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/meta.rng new file mode 100644 index 0000000..cf58c86 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/meta.rng @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/nameident.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/nameident.rng new file mode 100644 index 0000000..59b260c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/nameident.rng @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/object.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/object.rng new file mode 100644 index 0000000..70f4df0 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/object.rng @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + declare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/param.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/param.rng new file mode 100644 index 0000000..88e887f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/param.rng @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + data + ref + object + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/pres.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/pres.rng new file mode 100644 index 0000000..3a0cf84 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/pres.rng @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ruby.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ruby.rng new file mode 100644 index 0000000..ace6e9c --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ruby.rng @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/script.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/script.rng new file mode 100644 index 0000000..7d2017b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/script.rng @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + defer + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ssismap.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ssismap.rng new file mode 100644 index 0000000..460c54f --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/ssismap.rng @@ -0,0 +1,14 @@ + + + + + + + + + ismap + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/struct.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/struct.rng new file mode 100644 index 0000000..a68fe9b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/struct.rng @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/style.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/style.rng new file mode 100644 index 0000000..610b8f4 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/style.rng @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/table.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/table.rng new file mode 100644 index 0000000..4373b64 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/table.rng @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + center + right + justify + char + + + + + + + + + + + + + + + + + + + + top + middle + bottom + baseline + + + + + + + + + + row + col + rowgroup + colgroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + void + above + below + hsides + lhs + rhs + vsides + box + border + + + + + + + + + + none + groups + rows + cols + all + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/target.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/target.rng new file mode 100644 index 0000000..a5fc723 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/target.rng @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/text.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/text.rng new file mode 100644 index 0000000..fb14fa8 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xhtml/text.rng @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xmldsig-core-schema.rng b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xmldsig-core-schema.rng new file mode 100644 index 0000000..99db430 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/rng/xmldsig-core-schema.rng @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/ncx.sch b/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/ncx.sch new file mode 100644 index 0000000..64b29e9 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/ncx.sch @@ -0,0 +1,81 @@ + + + + + + + + + + pageTarget combination of value and type is not unique + + + + + + + + + first playOrder value is not 1 + + + + + + + + + Multiple navLabels with same xml:lang attribute within an NCX node + + + + + + + + + Multiple navInfos with same xml:lang attribute within an NCX node + + + + + + + + + playOrder sequence has gaps + + + + + + + + + identical playOrder values for navPoint/navTarget/pageTarget that do not refer to same target + + + + + + + + + different playOrder values for navPoint/navTarget/pageTarget that refer to same target + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/opf.sch b/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/opf.sch new file mode 100644 index 0000000..0550d12 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/adobe/epubcheck/sch/opf.sch @@ -0,0 +1,15 @@ + + + + + + + + + + The "id" attribute does not have a unique value! + + + + + diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/tool/Checker.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/tool/Checker.class new file mode 100644 index 0000000..eb44527 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/tool/Checker.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/CheckUtil.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/CheckUtil.class new file mode 100644 index 0000000..6bceb64 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/CheckUtil.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/DefaultReportImpl.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/DefaultReportImpl.class new file mode 100644 index 0000000..332c273 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/DefaultReportImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/PathUtil.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/PathUtil.class new file mode 100644 index 0000000..9e41d03 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/PathUtil.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/ResourceUtil.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/ResourceUtil.class new file mode 100644 index 0000000..395a2e0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/ResourceUtil.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/WriterReportImpl.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/WriterReportImpl.class new file mode 100644 index 0000000..f674aef Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/util/WriterReportImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLAttribute.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLAttribute.class new file mode 100644 index 0000000..fd21d9e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLAttribute.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLElement.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLElement.class new file mode 100644 index 0000000..c85ff9f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLElement.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLHandler.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLHandler.class new file mode 100644 index 0000000..67ca742 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLNode.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLNode.class new file mode 100644 index 0000000..81bb49b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLNode.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLParser.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLParser.class new file mode 100644 index 0000000..0853fce Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLParser.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$1.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$1.class new file mode 100644 index 0000000..7f989d8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$1.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ErrorHandlerImpl.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ErrorHandlerImpl.class new file mode 100644 index 0000000..ba23eae Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ErrorHandlerImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ResourceEntityResolver.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ResourceEntityResolver.class new file mode 100644 index 0000000..65d10a5 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$ResourceEntityResolver.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$XMLReaderCreatorImpl.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$XMLReaderCreatorImpl.class new file mode 100644 index 0000000..9f8422b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator$XMLReaderCreatorImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator.class b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator.class new file mode 100644 index 0000000..2fec332 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/adobe/epubcheck/xml/XMLValidator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/Datatype2.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/Datatype2.class new file mode 100644 index 0000000..35779db Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/Datatype2.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/AnyUriDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/AnyUriDatatype.class new file mode 100644 index 0000000..bf8735f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/AnyUriDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.class new file mode 100644 index 0000000..68da85d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BinaryDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BinaryDatatype.class new file mode 100644 index 0000000..e51f823 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BinaryDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BooleanDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BooleanDatatype.class new file mode 100644 index 0000000..0f83e04 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/BooleanDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/CdataDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/CdataDatatype.class new file mode 100644 index 0000000..a081e56 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/CdataDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBase.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBase.class new file mode 100644 index 0000000..ad91e27 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBase.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.class new file mode 100644 index 0000000..8659521 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.class new file mode 100644 index 0000000..348bceb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.class new file mode 100644 index 0000000..9be05e4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$CalendarFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$CalendarFactory.class new file mode 100644 index 0000000..760f53c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$CalendarFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$DateTime.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$DateTime.class new file mode 100644 index 0000000..cb5ac0c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype$DateTime.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype.class new file mode 100644 index 0000000..4a2ba96 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DateTimeDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DecimalDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DecimalDatatype.class new file mode 100644 index 0000000..e4d3233 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DecimalDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DoubleDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DoubleDatatype.class new file mode 100644 index 0000000..c5985fb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DoubleDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype$Duration.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype$Duration.class new file mode 100644 index 0000000..a65e13b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype$Duration.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype.class new file mode 100644 index 0000000..6ca0233 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/DurationDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/EntityDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/EntityDatatype.class new file mode 100644 index 0000000..b6aa0cc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/EntityDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/FloatDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/FloatDatatype.class new file mode 100644 index 0000000..e190bfc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/FloatDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/HexBinaryDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/HexBinaryDatatype.class new file mode 100644 index 0000000..91a0d67 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/HexBinaryDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdDatatype.class new file mode 100644 index 0000000..ce00d69 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdrefDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdrefDatatype.class new file mode 100644 index 0000000..cd01af3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IdrefDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.class new file mode 100644 index 0000000..be2fb59 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.class new file mode 100644 index 0000000..3073ca0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ListDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ListDatatype.class new file mode 100644 index 0000000..57f72e8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ListDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.class new file mode 100644 index 0000000..de24b66 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.class new file mode 100644 index 0000000..867e3b4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.class new file mode 100644 index 0000000..33e4978 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Measure.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Measure.class new file mode 100644 index 0000000..f19bc6d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/Measure.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.class new file mode 100644 index 0000000..d891423 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.class new file mode 100644 index 0000000..e8143e7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.class new file mode 100644 index 0000000..292a2fd Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NCNameDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NCNameDatatype.class new file mode 100644 index 0000000..9714825 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NCNameDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NameDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NameDatatype.class new file mode 100644 index 0000000..e30903d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NameDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NmtokenDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NmtokenDatatype.class new file mode 100644 index 0000000..91ec5db Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/NmtokenDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/OrderRelation.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/OrderRelation.class new file mode 100644 index 0000000..5171657 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/OrderRelation.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.class new file mode 100644 index 0000000..733115e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.class new file mode 100644 index 0000000..a88f9d4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype$QName.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype$QName.class new file mode 100644 index 0000000..2a5e6d8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype$QName.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype.class new file mode 100644 index 0000000..bad289d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/QNameDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RegexDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RegexDatatype.class new file mode 100644 index 0000000..855c6fc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RegexDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RestrictDatatype.class new file mode 100644 index 0000000..2e5d7be Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/RestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.class new file mode 100644 index 0000000..6c9b80e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/StringDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/StringDatatype.class new file mode 100644 index 0000000..105d6c0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/StringDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/TokenDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/TokenDatatype.class new file mode 100644 index 0000000..8adaaae Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/TokenDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.class new file mode 100644 index 0000000..ce6387c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/Regex.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/Regex.class new file mode 100644 index 0000000..5772502 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/Regex.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexEngine.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexEngine.class new file mode 100644 index 0000000..baeb4d2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexEngine.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.class new file mode 100644 index 0000000..b3ded9d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.class new file mode 100644 index 0000000..6ffdf0c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.class new file mode 100644 index 0000000..9551dbd Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl$1.class new file mode 100644 index 0000000..08e0ee8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.class new file mode 100644 index 0000000..6fd22c9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharClass.class new file mode 100644 index 0000000..67391eb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharRange.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharRange.class new file mode 100644 index 0000000..43b41d0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$CharRange.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Complement.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Complement.class new file mode 100644 index 0000000..0d2da5b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Complement.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Empty.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Empty.class new file mode 100644 index 0000000..962b13c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Empty.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Property.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Property.class new file mode 100644 index 0000000..eaf077c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Property.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Range.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Range.class new file mode 100644 index 0000000..6152046 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Range.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SimpleCharClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SimpleCharClass.class new file mode 100644 index 0000000..a438150 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SimpleCharClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SingleChar.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SingleChar.class new file mode 100644 index 0000000..32c1649 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$SingleChar.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Subtraction.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Subtraction.class new file mode 100644 index 0000000..486e425 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Subtraction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Union.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Union.class new file mode 100644 index 0000000..bec599e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$Union.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$WideSingleChar.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$WideSingleChar.class new file mode 100644 index 0000000..104c355 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator$WideSingleChar.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.class new file mode 100644 index 0000000..5c92a8e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen$Range.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen$Range.class new file mode 100644 index 0000000..d1383d6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen$Range.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.class new file mode 100644 index 0000000..1b91b60 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.class new file mode 100644 index 0000000..381d55f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties new file mode 100644 index 0000000..817f31b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties @@ -0,0 +1,13 @@ +bad_block_name=unrecognized Unicode block name \"{0}\" +bad_category=unrecognized Unicode category \"{0}\" +bad_escape=illegal escape +bad_property_name=bad property name \"{0}\" +empty_property_name=property name must not be empty +expected=expected \"{0}\" +expected_digit=expected a digit +expected_eos=character is not allowed in this context +invalid_range=lower bound of range must not have Unicode code point greater than upper bound +invalid_surrogate=illegal surrogate pair +multi_range=bounds of range must be single characters +should_quote=character \"{0}\" must be escaped with \"\\\" in ths context +invalid_quantity_range=lower bound of quantifier must not be greater than upper bound diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.class new file mode 100644 index 0000000..f4ae1e5 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/TestDriver.class b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/TestDriver.class new file mode 100644 index 0000000..483cd9e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/regex/test/TestDriver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/resources/Messages.properties new file mode 100644 index 0000000..716fdb0 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/datatype/xsd/resources/Messages.properties @@ -0,0 +1,14 @@ +# Properties file specifying messages +enumeration_param=\"enumeration\" facet is not allowed as a parameter: use \"value\" element instead +whiteSpace_param=\"whiteSpace\" facet is not allowed as a parameter +unrecognized_param=unrecognized parameter \"{0}\" +invalid_regex=invalid regular expression: {0} +not_ordered=parameter can only be applied to ordered datatype +invalid_limit=\"{0}\" is not allowed by the base type +no_length=base datatype does not define a units of length +scale_not_derived_from_decimal=\"scale\" parameter can only be applied to datatype derived from \"decimal\" +value_not_non_negative_integer=\"value\" parameter must be non negative integer +precision_not_derived_from_decimal=\"precision\" parameter can only be applied to datatype derived from \"decimal\" +value_not_positive_integer=\"value\" parameter must be positive integer +regex_impl_not_found=cannot find regular expression implementation; use JDK 1.4 or add Xerces 1 or 2 to your classpath +regex_internal_error=internal error in regular expression for datatype {0} diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/SchemaFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/SchemaFactory.class new file mode 100644 index 0000000..2286a2e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/SchemaFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AbstractPatternFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AbstractPatternFunction.class new file mode 100644 index 0000000..ea88ba2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AbstractPatternFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AfterPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AfterPattern.class new file mode 100644 index 0000000..153ebf2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AfterPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Alphabet.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Alphabet.class new file mode 100644 index 0000000..8c43924 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Alphabet.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameClass.class new file mode 100644 index 0000000..b13c99a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.class new file mode 100644 index 0000000..9bc6f46 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ApplyAfterFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ApplyAfterFunction.class new file mode 100644 index 0000000..195c157 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ApplyAfterFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.class new file mode 100644 index 0000000..6f8f062 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributePattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributePattern.class new file mode 100644 index 0000000..00b08f1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/AttributePattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BinaryPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BinaryPattern.class new file mode 100644 index 0000000..cb9a1c4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BinaryPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BlankDataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BlankDataDerivType.class new file mode 100644 index 0000000..8e10020 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BlankDataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.class new file mode 100644 index 0000000..4991694 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.class new file mode 100644 index 0000000..c41f93a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.class new file mode 100644 index 0000000..974599a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoiceNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoiceNameClass.class new file mode 100644 index 0000000..51f272e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoiceNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoicePattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoicePattern.class new file mode 100644 index 0000000..afbc12b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ChoicePattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineSchema.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineSchema.class new file mode 100644 index 0000000..e2aebe7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineSchema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineValidator.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineValidator.class new file mode 100644 index 0000000..be342e2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CombineValidator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.class new file mode 100644 index 0000000..cb4f129 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDataDerivType.class new file mode 100644 index 0000000..d10334d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivFunction.class new file mode 100644 index 0000000..3f3f3ad Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivType.class new file mode 100644 index 0000000..d90ddbb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.class new file mode 100644 index 0000000..7450717 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataExceptPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataExceptPattern.class new file mode 100644 index 0000000..7a2e484 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataExceptPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataPattern.class new file mode 100644 index 0000000..2613dd3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DataPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DatatypeValue.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DatatypeValue.class new file mode 100644 index 0000000..26ea2bf Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DatatypeValue.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$1.class new file mode 100644 index 0000000..0fe3ab7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$Alternative.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$Alternative.class new file mode 100644 index 0000000..4c6c800 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector$Alternative.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.class new file mode 100644 index 0000000..4234967 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ElementPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ElementPattern.class new file mode 100644 index 0000000..15a53cf Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ElementPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EmptyPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EmptyPattern.class new file mode 100644 index 0000000..b3b631b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EmptyPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndAttributesFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndAttributesFunction.class new file mode 100644 index 0000000..7cd7f84 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndAttributesFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndTagDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndTagDerivFunction.class new file mode 100644 index 0000000..e86ef9d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/EndTagDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorNameClass.class new file mode 100644 index 0000000..fbc4710 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorPattern.class new file mode 100644 index 0000000..60b6623 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ErrorPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.class new file mode 100644 index 0000000..d1077d3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.class new file mode 100644 index 0000000..58e1ae9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform$FeasiblePatternFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform$FeasiblePatternFunction.class new file mode 100644 index 0000000..7b4535b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform$FeasiblePatternFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform.class new file mode 100644 index 0000000..8f042cb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FeasibleTransform.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FindElementFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FindElementFunction.class new file mode 100644 index 0000000..8ca90cf Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/FindElementFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/GroupPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/GroupPattern.class new file mode 100644 index 0000000..8ecb711 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/GroupPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$1.class new file mode 100644 index 0000000..2f65f82 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$Entry.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$Entry.class new file mode 100644 index 0000000..7e402d2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker$Entry.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker.class new file mode 100644 index 0000000..b3b6b8c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdSoundnessChecker.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMap.class new file mode 100644 index 0000000..4c3bb38 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$1.class new file mode 100644 index 0000000..0c80e2e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$BuildFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$BuildFunction.class new file mode 100644 index 0000000..d04967b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$BuildFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ElementNameClassVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ElementNameClassVisitor.class new file mode 100644 index 0000000..0f438f9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ElementNameClassVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeFunction.class new file mode 100644 index 0000000..50fa47b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeMapImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeMapImpl.class new file mode 100644 index 0000000..91d53e4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$IdTypeMapImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$PossibleConflict.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$PossibleConflict.class new file mode 100644 index 0000000..1d76bd4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$PossibleConflict.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ScopedName.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ScopedName.class new file mode 100644 index 0000000..5e1ab90 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$ScopedName.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$WrappedSAXException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$WrappedSAXException.class new file mode 100644 index 0000000..bd2a71a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder$WrappedSAXException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.class new file mode 100644 index 0000000..678a21d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapSchema.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapSchema.class new file mode 100644 index 0000000..f66ce3f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IdTypeMapSchema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.class new file mode 100644 index 0000000..41b1390 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.class new file mode 100644 index 0000000..35517a4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InterleavePattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InterleavePattern.class new file mode 100644 index 0000000..b218e82 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/InterleavePattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ListPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ListPattern.class new file mode 100644 index 0000000..8b057e7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ListPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.class new file mode 100644 index 0000000..4275195 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClass.class new file mode 100644 index 0000000..6bb1d55 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClassVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClassVisitor.class new file mode 100644 index 0000000..ca12aee Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameClassVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameFormatter.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameFormatter.class new file mode 100644 index 0000000..8fd655b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NameFormatter.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NotAllowedPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NotAllowedPattern.class new file mode 100644 index 0000000..3cc639d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NotAllowedPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameClass.class new file mode 100644 index 0000000..c4e3f82 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.class new file mode 100644 index 0000000..2fa6ba8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NullNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NullNameClass.class new file mode 100644 index 0000000..51244e1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/NullNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OneOrMorePattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OneOrMorePattern.class new file mode 100644 index 0000000..8cf36ff Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OneOrMorePattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OverlapDetector.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OverlapDetector.class new file mode 100644 index 0000000..df7a87c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/OverlapDetector.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Pattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Pattern.class new file mode 100644 index 0000000..855f182 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/Pattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternBuilder.class new file mode 100644 index 0000000..ea369ff Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpNameClassVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpNameClassVisitor.class new file mode 100644 index 0000000..cd070d3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpNameClassVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpPatternVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpPatternVisitor.class new file mode 100644 index 0000000..226595c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$ChoiceDumpPatternVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpNameClassVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpNameClassVisitor.class new file mode 100644 index 0000000..e7f348d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpNameClassVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpPatternVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpPatternVisitor.class new file mode 100644 index 0000000..41079ae Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$DumpPatternVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$GroupDumpPatternVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$GroupDumpPatternVisitor.class new file mode 100644 index 0000000..cfd2ada Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$GroupDumpPatternVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$InterleaveDumpPatternVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$InterleaveDumpPatternVisitor.class new file mode 100644 index 0000000..2e8f9e7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper$InterleaveDumpPatternVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper.class new file mode 100644 index 0000000..2813782 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternDumper.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFunction.class new file mode 100644 index 0000000..e3595c0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFuture.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFuture.class new file mode 100644 index 0000000..10f5806 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternFuture.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternInterner.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternInterner.class new file mode 100644 index 0000000..07a6b6b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternInterner.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternMemo.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternMemo.class new file mode 100644 index 0000000..8acdcca Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternMemo.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternSchema.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternSchema.class new file mode 100644 index 0000000..afa095b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternSchema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$1.class new file mode 100644 index 0000000..a30e978 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$PrefixMapping.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$PrefixMapping.class new file mode 100644 index 0000000..1298b7d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator$PrefixMapping.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator.class new file mode 100644 index 0000000..ea0ef7d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternValidator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternVisitor.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternVisitor.class new file mode 100644 index 0000000..dc060e8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/PatternVisitor.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RecoverAfterFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RecoverAfterFunction.class new file mode 100644 index 0000000..6e86bc4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RecoverAfterFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RefPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RefPattern.class new file mode 100644 index 0000000..9cd6e74 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RefPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RestrictionViolationException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RestrictionViolationException.class new file mode 100644 index 0000000..1de21ba Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/RestrictionViolationException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$1.class new file mode 100644 index 0000000..637a42c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DataPatternBuilderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DataPatternBuilderImpl.class new file mode 100644 index 0000000..a184002 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DataPatternBuilderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DummyDataPatternBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DummyDataPatternBuilder.class new file mode 100644 index 0000000..86ea120 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$DummyDataPatternBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$GrammarImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$GrammarImpl.class new file mode 100644 index 0000000..0aafd62 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$GrammarImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$IncludeImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$IncludeImpl.class new file mode 100644 index 0000000..4683f0a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$IncludeImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$LocatorImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$LocatorImpl.class new file mode 100644 index 0000000..13ef30b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$LocatorImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$OpenIncludes.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$OpenIncludes.class new file mode 100644 index 0000000..13ca691 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$OpenIncludes.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$Override.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$Override.class new file mode 100644 index 0000000..f8e0fe9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$Override.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$RootScope.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$RootScope.class new file mode 100644 index 0000000..26c4e07 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$RootScope.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$ValidationContextImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$ValidationContextImpl.class new file mode 100644 index 0000000..2de6edb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl$ValidationContextImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.class new file mode 100644 index 0000000..d3b7906 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.class new file mode 100644 index 0000000..f56be52 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReaderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReaderImpl.class new file mode 100644 index 0000000..1e6a256 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReaderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl$1.class new file mode 100644 index 0000000..50d3a9c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.class new file mode 100644 index 0000000..4f7ea19 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SimpleNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SimpleNameClass.class new file mode 100644 index 0000000..477f9f9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SimpleNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SingleDataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SingleDataDerivType.class new file mode 100644 index 0000000..8b40c2f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/SingleDataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$1.class new file mode 100644 index 0000000..4c72112 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$2.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$2.class new file mode 100644 index 0000000..88c2067 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction$2.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.class new file mode 100644 index 0000000..2e15147 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$1.class new file mode 100644 index 0000000..d959f77 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$2.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$2.class new file mode 100644 index 0000000..2e4bc9a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$2.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$3.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$3.class new file mode 100644 index 0000000..db6bd4f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$3.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$4.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$4.class new file mode 100644 index 0000000..c9aacb2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$4.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$5.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$5.class new file mode 100644 index 0000000..ef5633b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction$5.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.class new file mode 100644 index 0000000..07767a7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.class new file mode 100644 index 0000000..f26a310 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringDatatype.class new file mode 100644 index 0000000..5e233cc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringNormalizer.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringNormalizer.class new file mode 100644 index 0000000..95114b0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringNormalizer.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringPattern.class new file mode 100644 index 0000000..d4d68c3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/StringPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextOnlyFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextOnlyFunction.class new file mode 100644 index 0000000..58d41d8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextOnlyFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextPattern.class new file mode 100644 index 0000000..7e91e07 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TextPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TokenDatatype.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TokenDatatype.class new file mode 100644 index 0000000..e413c99 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/TokenDatatype.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.class new file mode 100644 index 0000000..e2cfb07 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$1.class new file mode 100644 index 0000000..a0ab4dc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$NoteChoicesFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$NoteChoicesFunction.class new file mode 100644 index 0000000..70cf52b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$NoteChoicesFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$RemoveChoicesFunction.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$RemoveChoicesFunction.class new file mode 100644 index 0000000..52c1974 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder$RemoveChoicesFunction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.class new file mode 100644 index 0000000..9995861 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValueDataDerivType.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValueDataDerivType.class new file mode 100644 index 0000000..a6d68a2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValueDataDerivType.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValuePattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValuePattern.class new file mode 100644 index 0000000..da23bd7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/ValuePattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/resources/Messages.properties new file mode 100644 index 0000000..0a30b04 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/impl/resources/Messages.properties @@ -0,0 +1,102 @@ +# Properties file specifying messages +illegal_href_attribute=illegal \"href\" attribute +ns_attribute_ignored=\"ns\" attribute ignored +reference_to_undefined=reference to undefined pattern \"{0}\" +missing_start_element=missing \"start\" element +recursive_reference=bad recursive reference to pattern \"{0}\" +recursive_include=recursive inclusion of URL \"{0}\" +duplicate_define=multiple definitions of \"{0}\" without \"combine\" attribute +duplicate_start=multiple definitions of start without \"combine\" attribute +conflict_combine_define=conflicting values of \"combine\" attribute for definition of \"{0}\" +conflict_combine_start=conflicting values of \"combine\" attribute for definition of start +missing_start_replacement=\"start\" in \"include\" does not override anything +missing_define_replacement=definition of \"{0}\" in \"include\" does not override anything +interleave_string=interleave of \"string\" or \"data\" element +group_string=group of \"string\" or \"data\" element +one_or_more_string=repeat of \"string\" or \"data\" element +unrecognized_datatype=datatype \"{1}\" from library \"{0}\" not recognized +unsupported_datatype_detail=datatype \"{1}\" from library \"{0}\" not supported: {2} +unrecognized_datatype_library=datatype library \"{0}\" not recognized +unrecognized_builtin_datatype=no such builtin datatype \"{0}\": must be \"string\" or \"token\" +invalid_value=\"{0}\" is not a valid value of the datatype +parent_ref_outside_grammar=reference to non-existent parent grammar +ref_outside_grammar=reference to non-existent grammar +expected_one_name_class=found \"{0}\" element but expected no further content +builtin_param=builtin datatypes do not have any parameters +invalid_param_display=invalid parameter:\n{0} +invalid_param_detail_display=invalid parameter: {0}:\n{1} +display_param={0}>>>>{1} +invalid_param_detail=invalid parameter: {0} +invalid_param=invalid parameter +invalid_params_detail=invalid parameters: {0} +invalid_params=invalid parameters +datatype_requires_parameter=datatype cannot be used without parameters +datatype_requires_parameter_detail=datatype cannot be used without parameters: {0} + +attribute_contains_attribute=\"attribute\" contains \"attribute\" +attribute_contains_element=\"attribute\" contains \"element\" +data_except_contains_attribute=\"except\" in \"data\" contains \"attribute\" +data_except_contains_element=\"except\" in \"data\" contains \"element\" +data_except_contains_empty=\"except\" in \"data\" contains \"empty\" +data_except_contains_group=\"except\" in \"data\" contains \"group\" +data_except_contains_interleave=\"except\" in \"data\" contains \"interleave\" +data_except_contains_list=\"except\" in \"data\" contains \"list\" +data_except_contains_one_or_more=\"except\" in \"data\" contains \"oneOrMore\" +data_except_contains_text=\"except\" in \"data\" contains \"text\" +list_contains_attribute=\"list\" contains \"attribute\" +list_contains_element=\"list\" contains \"element\" +list_contains_list=\"list\" contains \"list\" +list_contains_text=\"list\" contains \"text\" +one_or_more_contains_group_contains_attribute=\"oneOrMore\" contains \"group\" contains \"attribute\" +one_or_more_contains_interleave_contains_attribute=\"oneOrMore\" contains \"interleave\" contains \"attribute\" +start_contains_attribute=\"start\" contains \"attribute\" +start_contains_data=\"start\" contains \"data\" +start_contains_empty=\"start\" contains \"empty\" +start_contains_group=\"start\" contains \"group\" +start_contains_interleave=\"start\" contains \"interleave\" +start_contains_list=\"start\" contains \"list\" +start_contains_one_or_more=\"start\" contains \"oneOrMore\" +start_contains_text=\"start\" contains \"text\" +start_contains_value=\"start\" contains \"value\" +duplicate_attribute=duplicate attribute +duplicate_attribute_detail=duplicate attribute {0} +interleave_element_overlap=overlapping element names in operands of \"interleave\" +list_contains_interleave=\"list\" contains \"interleave\" +interleave_text_overlap=both operands of \"interleave\" contain \"text\" +open_name_class_not_repeated=attribute using \"nsName\" or \"anyName\" must be in \"oneOrMore\" +xmlns_uri_attribute=attribute must not have namespace URI \"http://www.w3.org/2000/xmlns\" +xmlns_attribute=attribute must not be named \"xmlns\" + +# Validation errors +unknown_element=unknown element {0} +required_elements_missing=required elements missing +out_of_context_element=element {0} not allowed in this context +impossible_attribute_ignored=attribute {0} not allowed at this point; ignored +bad_attribute_value=bad value for attribute {0} +required_attributes_missing=required attributes missing +unfinished_element=unfinished element +text_not_allowed=text not allowed here +document_incomplete=document incompletely matched +string_not_allowed=bad character content for element +only_text_not_allowed=element cannot have content that consists only of text +schema_allows_nothing=schema does not allow anything: it is equivalent to + +# ID correctness errors +id_element_name_class=an \"element\" pattern containing an \"attribute\" pattern with a non-null ID-type must have a name class that contains only \"choice\" and \"name\" elements +id_attribute_name_class=an \"attribute\" pattern with a non-null ID-type must have a name class that is a single name +id_parent=a \"data\" or \"value\" pattern with non-null ID-type must occur as the child of an \"attribute\" pattern +id_type_conflict=conflicting ID-types for attribute {1} of element {0} + +# ID soundness errors +id_no_tokens=value of attribute of type ID contained no tokens +id_multiple_tokens=value of attribute of type ID contained multiple tokens +idref_no_tokens=value of attribute of type IDREF contained no tokens +idref_multiple_tokens=value of attribute of type IDREF contained multiple tokens +idrefs_no_tokens=value of attribute of type IDREFS contained no tokens +missing_id=IDREF \"{0}\" without matching ID +duplicate_id=ID \"{0}\" has already been defined +first_id=first occurrence of ID \"{0}\" + +# Fragments +name_absent_namespace=\"{0}\" +name_with_namespace=\"{1}\" from namespace \"{0}\" \ No newline at end of file diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Annotations.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Annotations.class new file mode 100644 index 0000000..e5e97d4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Annotations.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/BuildException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/BuildException.class new file mode 100644 index 0000000..604204e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/BuildException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/CommentList.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/CommentList.class new file mode 100644 index 0000000..5dcfdeb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/CommentList.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Context.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Context.class new file mode 100644 index 0000000..c4c7aa8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Context.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/DataPatternBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/DataPatternBuilder.class new file mode 100644 index 0000000..eab7177 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/DataPatternBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Div.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Div.class new file mode 100644 index 0000000..b542cfc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Div.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.class new file mode 100644 index 0000000..440f5bc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Grammar.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Grammar.class new file mode 100644 index 0000000..6b2b1d0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Grammar.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$1.class new file mode 100644 index 0000000..6d66f0f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$Combine.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$Combine.class new file mode 100644 index 0000000..c6496f8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection$Combine.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection.class new file mode 100644 index 0000000..7681023 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/GrammarSection.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IllegalSchemaException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IllegalSchemaException.class new file mode 100644 index 0000000..a6bf703 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IllegalSchemaException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Include.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Include.class new file mode 100644 index 0000000..f2f1450 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Include.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IncludedGrammar.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IncludedGrammar.class new file mode 100644 index 0000000..a166400 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/IncludedGrammar.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Location.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Location.class new file mode 100644 index 0000000..10dda5f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Location.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParseReceiver.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParseReceiver.class new file mode 100644 index 0000000..7bc0ea1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParseReceiver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Parseable.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Parseable.class new file mode 100644 index 0000000..e8a0e36 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Parseable.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.class new file mode 100644 index 0000000..e4dcbe8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedNameClass.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedNameClass.class new file mode 100644 index 0000000..134cc32 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedNameClass.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPattern.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPattern.class new file mode 100644 index 0000000..b667961 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPattern.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPatternFuture.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPatternFuture.class new file mode 100644 index 0000000..9e7fc24 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/ParsedPatternFuture.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SchemaBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SchemaBuilder.class new file mode 100644 index 0000000..9f573d9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SchemaBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Scope.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Scope.class new file mode 100644 index 0000000..bf11c18 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/Scope.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SubParser.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SubParser.class new file mode 100644 index 0000000..c12b8f3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/SubParser.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactParseable.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactParseable.class new file mode 100644 index 0000000..6f0bb27 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactParseable.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$JJCalls.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$JJCalls.class new file mode 100644 index 0000000..1920e8e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$JJCalls.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$LocatedString.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$LocatedString.class new file mode 100644 index 0000000..c2b2446 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax$LocatedString.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.class new file mode 100644 index 0000000..786a1a4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj new file mode 100644 index 0000000..c00bc06 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj @@ -0,0 +1,1933 @@ +options { + STATIC = false; + UNICODE_INPUT = true; + JAVA_UNICODE_ESCAPE = true; +} + +PARSER_BEGIN(CompactSyntax) + +package com.thaiopensource.relaxng.parse.compact; + +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.Context; + +import com.thaiopensource.xml.util.WellKnownNamespaces; + +import com.thaiopensource.util.Localizer; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + +import java.util.Hashtable; +import java.util.Enumeration; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; + +public class CompactSyntax implements Context { + private static final int IN_ELEMENT = 0; + private static final int IN_ATTRIBUTE = 1; + private static final int IN_ANY_NAME = 2; + private static final int IN_NS_NAME = 4; + + private String defaultNamespace = SchemaBuilder.INHERIT_NS; + private String compatibilityPrefix = null; + private SchemaBuilder sb; + private String sourceUri; + private ErrorHandler eh; + private final Hashtable namespaceTable = new Hashtable(); + private final Hashtable datatypesTable = new Hashtable(); + private boolean hadError = false; + private static final Localizer localizer = new Localizer(CompactSyntax.class); + private final Hashtable attributeNameTable = new Hashtable(); + private boolean annotationsIncludeElements = false; + + final class LocatedString { + private final String str; + private final Token tok; + + LocatedString(String str, Token tok) { + this.str = str; + this.tok = tok; + } + + String getString() { + return str; + } + + Location getLocation() { + return makeLocation(tok); + } + + Token getToken() { + return tok; + } + + } + + public CompactSyntax(Reader r, String sourceUri, SchemaBuilder sb, ErrorHandler eh) { + this(r); + this.sourceUri = sourceUri; + this.sb = sb; + this.eh = eh; + // this causes the root pattern to have non-null annotations + // which is useful because it gives a context to trang + this.topLevelComments = sb.makeCommentList(); + } + + ParsedPattern parse(Scope scope) throws IllegalSchemaException { + try { + ParsedPattern p = Input(scope); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + ParsedPattern parseInclude(IncludedGrammar g) throws IllegalSchemaException { + try { + ParsedPattern p = IncludedGrammar(g); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + private void checkNsName(int context, LocatedString ns) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_ns_name", ns.getToken()); + } + + private void checkAnyName(int context, Token t) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_any_name", t); + if ((context & IN_ANY_NAME) != 0) + error("any_name_except_contains_any_name", t); + } + + private void error(String key, Token tok) { + doError(localizer.message(key), tok); + } + + private void error(String key, String arg, Token tok) { + doError(localizer.message(key, arg), tok); + } + + private void error(String key, String arg1, String arg2, Token tok) { + doError(localizer.message(key, arg1, arg2), tok); + } + + private void doError(String message, Token tok) { + hadError = true; + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(tok.beginLine); + loc.setColumnNumber(tok.beginColumn); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(message, loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private void reportEscapeSyntaxException(EscapeSyntaxException e) { + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(e.getLineNumber()); + loc.setColumnNumber(e.getColumnNumber()); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(localizer.message(e.getKey()), loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private static String unquote(String s) { + if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) { + s = s.replace('\u0000', '\n'); + return s.substring(3, s.length() - 3); + } + else + return s.substring(1, s.length() - 1); + } + + Location makeLocation(Token t) { + return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn); + } + + private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) { + if (i >= patterns.length) { + ParsedPattern[] oldPatterns = patterns; + patterns = new ParsedPattern[oldPatterns.length*2]; + System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length); + } + patterns[i] = p; + return patterns; + } + + String getCompatibilityPrefix() { + if (compatibilityPrefix == null) { + compatibilityPrefix = "a"; + while (namespaceTable.get(compatibilityPrefix) != null) + compatibilityPrefix = compatibilityPrefix + "a"; + } + return compatibilityPrefix; + } + + public String resolveNamespacePrefix(String prefix) { + String result = (String)namespaceTable.get(prefix); + if (result.length() == 0) + return null; + return result; + } + + public Enumeration prefixes() { + return namespaceTable.keys(); + } + + public String getBaseUri() { + return sourceUri; + } + + public boolean isUnparsedEntity(String entityName) { + return false; + } + + public boolean isNotation(String notationName) { + return false; + } + + public Context copy() { + return this; + } + + private Context getContext() { + return this; + } + + private CommentList getComments() { + return getComments(getTopLevelComments()); + } + + private CommentList topLevelComments; + + private CommentList getTopLevelComments() { + CommentList tem = topLevelComments; + topLevelComments = null; + return tem; + } + + private void noteTopLevelComments() { + topLevelComments = getComments(topLevelComments); + } + + private void topLevelComments(GrammarSection section) { + section.topLevelComment(getComments(null)); + } + + private Token lastCommentSourceToken = null; + + private CommentList getComments(CommentList comments) { + Token nextToken = getToken(1); + if (lastCommentSourceToken != nextToken) { + if (lastCommentSourceToken == null) + lastCommentSourceToken = token; + do { + lastCommentSourceToken = lastCommentSourceToken.next; + Token t = lastCommentSourceToken.specialToken; + if (t != null) { + while (t.specialToken != null) + t = t.specialToken; + if (comments == null) + comments = sb.makeCommentList(); + for (; t != null; t = t.next) { + String s = mungeComment(t.image); + Location loc = makeLocation(t); + if (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) { + StringBuffer buf = new StringBuffer(s); + do { + t = t.next; + buf.append('\n'); + buf.append(mungeComment(t.image)); + } while (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE); + s = buf.toString(); + } + comments.addComment(s, loc); + } + } + } while (lastCommentSourceToken != nextToken); + } + return comments; + } + + private ParsedPattern afterComments(ParsedPattern p) { + CommentList comments = getComments(null); + if (comments == null) + return p; + return sb.commentAfter(p, comments); + } + + private ParsedNameClass afterComments(ParsedNameClass nc) { + CommentList comments = getComments(null); + if (comments == null) + return nc; + return sb.commentAfter(nc, comments); + } + + private static String mungeComment(String image) { + int i = image.indexOf('#') + 1; + while (i < image.length() && image.charAt(i) == '#') + i++; + if (i < image.length() && image.charAt(i) == ' ') + i++; + return image.substring(i); + } + + private Annotations getCommentsAsAnnotations() { + CommentList comments = getComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private Annotations addCommentsToChildAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + a = sb.makeAnnotations(null, getContext()); + a.addComment(comments); + return a; + } + + private Annotations addCommentsToLeadingAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + return sb.makeAnnotations(comments, getContext()); + a.addLeadingComment(comments); + return a; + } + + private Annotations getTopLevelCommentsAsAnnotations() { + CommentList comments = getTopLevelComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private void clearAttributeList() { + attributeNameTable.clear(); + } + + private void addAttribute(Annotations a, String ns, String localName, String prefix, String value, Token tok) { + String key = ns + "#" + localName; + if (attributeNameTable.get(key) != null) + error("duplicate_attribute", ns, localName, tok); + else { + attributeNameTable.put(key, key); + a.addAttribute(ns, localName, prefix, value, makeLocation(tok)); + } + } + + private void checkExcept(Token[] except) { + if (except[0] != null) + error("except_missing_parentheses", except[0]); + } + + private String lookupPrefix(String prefix, Token t) { + String ns = (String)namespaceTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return "#error"; + } + return ns; + } + private String lookupDatatype(String prefix, Token t) { + String ns = (String)datatypesTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return ""; // XXX + } + return ns; + } + private String resolve(String str) { + try { + return new URL(new URL(sourceUri), str).toString(); + } + catch (MalformedURLException e) { } + return str; + } +} + +PARSER_END(CompactSyntax) + +ParsedPattern Input(Scope scope) : +{ + ParsedPattern p; +} +{ + Preamble() + (LOOKAHEAD(TopLevelLookahead()) p = TopLevelGrammar(scope) + | p = Expr(true, scope, null, null) { p = afterComments(p); } ) + { return p; } +} + +void TopLevelLookahead() : +{} +{ + "[" + | Identifier() ("[" | "=" | "&=" | "|=") + | LookaheadGrammarKeyword() + | LookaheadBody() LookaheadAfterAnnotations() + | LookaheadDocumentation() (LookaheadBody())? LookaheadAfterAnnotations() +} + +void LookaheadAfterAnnotations() : +{} +{ + Identifier() ("=" | "&=" | "|=") + | LookaheadGrammarKeyword() +} + +void LookaheadGrammarKeyword() : +{} +{ + "start" | "div" | "include" +} + +void LookaheadDocumentation() : +{} +{ + (( | ) ()*)+ +} + +void LookaheadBody() : +{} +{ + "[" + ( | UnprefixedName() | "=" | | "~" | LookaheadBody() )* + "]" +} + +ParsedPattern IncludedGrammar(IncludedGrammar g) : +{ + Annotations a; + ParsedPattern p; +} +{ + Preamble() + (LOOKAHEAD(TopLevelLookahead()) a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations()) + | a = Annotations() "grammar" "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}") + { p = afterComments(g.endIncludedGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } + + { return p; } +} + +ParsedPattern TopLevelGrammar(Scope scope) : +{ + Annotations a = getTopLevelCommentsAsAnnotations(); + Grammar g; + ParsedPattern p; +} +{ + { g = sb.makeGrammar(scope); } + a = GrammarBody(g, g, a) + { p = afterComments(g.endGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } + + { return p; } +} + +void Preamble() : +{} +{ + (NamespaceDecl() | DatatypesDecl())* + { + namespaceTable.put("xml", WellKnownNamespaces.XML); + if (datatypesTable.get("xsd") == null) + datatypesTable.put("xsd", WellKnownNamespaces.XML_SCHEMA_DATATYPES); + } +} + +void NamespaceDecl() : +{ + LocatedString prefix = null; + boolean isDefault = false; + String namespaceName; +} +{ + { noteTopLevelComments(); } + (("namespace" prefix = UnprefixedName()) + | ("default" { isDefault = true; } + "namespace" (prefix = UnprefixedName())?)) + "=" + namespaceName = NamespaceName() + { + if (isDefault) + defaultNamespace = namespaceName; + if (prefix != null) { + if (prefix.getString().equals("xmlns")) + error("xmlns_prefix", prefix.getToken()); + else if (prefix.getString().equals("xml")) { + if (!namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_prefix_bad_uri", prefix.getToken()); + } + else if (namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_uri_bad_prefix", prefix.getToken()); + else { + if (namespaceName.equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS)) + compatibilityPrefix = prefix.getString(); + namespaceTable.put(prefix.getString(), namespaceName); + } + } + } +} + +String NamespaceName() : +{ + String r; +} +{ + (r = Literal() | "inherit" { r = SchemaBuilder.INHERIT_NS; }) + { return r; } +} + +void DatatypesDecl() : +{ + LocatedString prefix; + String uri; +} +{ + { noteTopLevelComments(); } + "datatypes" prefix = UnprefixedName() "=" uri = Literal() + { + datatypesTable.put(prefix.getString(), uri); + } +} + +ParsedPattern AnnotatedPrimaryExpr(boolean topLevel, Scope scope, Token[] except) : +{ + Annotations a; + ParsedPattern p; + ParsedElementAnnotation e; + Token t; +} +{ + a = Annotations() + p = PrimaryExpr(topLevel, scope, a, except) + ( t = e = AnnotationElement(false) { + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + })* + { return p; } +} + + +ParsedPattern PrimaryExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : +{ + ParsedPattern p; +} +{ + (p = ElementExpr(scope, a) + | p = AttributeExpr(scope, a) + | p = GrammarExpr(scope, a) + | p = ExternalRefExpr(scope, a) + | p = ListExpr(scope, a) + | p = MixedExpr(scope, a) + | p = ParenExpr(topLevel, scope, a) + | p = IdentifierExpr(scope, a) + | p = ParentExpr(scope, a) + | p = DataExpr(topLevel, scope, a, except) + | p = ValueExpr(topLevel, a) + | p = TextExpr(a) + | p = EmptyExpr(a) + | p = NotAllowedExpr(a)) + { return p; } +} + +ParsedPattern EmptyExpr(Annotations a) : +{ + Token t; +} +{ + t = "empty" + { return sb.makeEmpty(makeLocation(t), a); } +} + +ParsedPattern TextExpr(Annotations a) : +{ + Token t; +} +{ + t = "text" + { return sb.makeText(makeLocation(t), a); } +} + +ParsedPattern NotAllowedExpr(Annotations a) : +{ + Token t; +} +{ + t = "notAllowed" + { return sb.makeNotAllowed(makeLocation(t), a); } +} + +ParsedPattern Expr(boolean topLevel, Scope scope, Token t, Annotations a) : +{ + ParsedPattern p; + ParsedPattern[] patterns = new ParsedPattern[2]; + int nPatterns = 1; + boolean[] hadOccur = new boolean[1]; + Token[] except = new Token[1]; +} +{ + p = UnaryExpr(topLevel, scope, hadOccur, except) + { patterns[0] = p; } + ( + { checkExcept(except); } + (t = "|" p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeChoice(patterns, nPatterns, makeLocation(t), a); } + | (t = "&" p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeInterleave(patterns, nPatterns, makeLocation(t), a); } + | (t = "," p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); } + )? + { + if (nPatterns == 1 && a != null) { + if (hadOccur[0]) + p = sb.annotate(p, a); + else + p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); + } + return p; + } +} + +ParsedPattern UnaryExpr(boolean topLevel, Scope scope, boolean[] hadOccur, Token[] except) : +{ + ParsedPattern p; + Token t; + ParsedElementAnnotation e; +} +{ + p = AnnotatedPrimaryExpr(topLevel, scope, except) + ( + { + if (hadOccur != null) hadOccur[0] = true; + p = afterComments(p); + } + (t = "+" { checkExcept(except); p = sb.makeOneOrMore(p, makeLocation(t), null); } + | t = "?" { checkExcept(except); p = sb.makeOptional(p, makeLocation(t), null); } + | t = "*" { checkExcept(except); p = sb.makeZeroOrMore(p, makeLocation(t), null); }) + ( t = e = AnnotationElement(false) { + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + } )* + )? + { return p; } +} + +ParsedPattern ElementExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedNameClass nc; + ParsedPattern p; +} +{ + t = "element" + nc = NameClass(IN_ELEMENT, null) + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeElement(nc, p, makeLocation(t), a); } +} + +ParsedPattern AttributeExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedNameClass nc; + ParsedPattern p; +} +{ + t = "attribute" + nc = NameClass(IN_ATTRIBUTE, null) + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeAttribute(nc, p, makeLocation(t), a); } +} + +ParsedNameClass NameClass(int context, Annotations[] pa) : +{ + Annotations a; + ParsedNameClass nc; +} +{ + a = Annotations() + (nc = PrimaryNameClass(context, a) nc = AnnotateAfter(nc) nc = NameClassAlternatives(context, nc, pa) + | nc = AnyNameExceptClass(context, a, pa) + | nc = NsNameExceptClass(context, a, pa)) + { return nc; } +} + +ParsedNameClass AnnotateAfter(ParsedNameClass nc) : +{ + ParsedElementAnnotation e; +} +{ + ( e = AnnotationElement(false) { nc = sb.annotateAfter(nc, e); })* + { return nc; } +} + +ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) : +{ + Token t; + ParsedNameClass[] nameClasses; + int nNameClasses; +} +{ + ( + { + nameClasses = new ParsedNameClass[2]; + nameClasses[0] = nc; + nNameClasses = 1; + } + (t = "|" nc = BasicNameClass(context) nc = AnnotateAfter(nc) + { + if (nNameClasses >= nameClasses.length) { + ParsedNameClass[] oldNameClasses = nameClasses; + nameClasses = new ParsedNameClass[oldNameClasses.length*2]; + System.arraycopy(oldNameClasses, 0, nameClasses, 0, oldNameClasses.length); + } + nameClasses[nNameClasses++] = nc; + })+ + { + Annotations a; + if (pa == null) + a = null; + else { + a = pa[0]; + pa[0] = null; + } + nc = sb.makeChoice(nameClasses, nNameClasses, makeLocation(t), a); + } + )? + { return nc; } +} + +ParsedNameClass BasicNameClass(int context) : +{ + Annotations a; + ParsedNameClass nc; +} +{ + a = Annotations() + (nc = PrimaryNameClass(context, a) + | nc = OpenNameClass(context, a)) + { return nc; } +} + +ParsedNameClass PrimaryNameClass(int context, Annotations a) : +{ + ParsedNameClass nc; +} +{ + (nc = UnprefixedNameClass(context, a) + | nc = PrefixedNameClass(a) + | nc = ParenNameClass(context, a)) + { return nc; } +} + +ParsedNameClass OpenNameClass(int context, Annotations a) : +{ + Token t; + LocatedString ns; +} +{ + ns = NsName() { checkNsName(context, ns); return sb.makeNsName(ns.getString(), ns.getLocation(), a); } + | t = "*" { checkAnyName(context, t); return sb.makeAnyName(makeLocation(t), a); } +} + + +ParsedNameClass UnprefixedNameClass(int context, Annotations a) : +{ + LocatedString name; +} +{ + name = UnprefixedName() + { + String ns; + if ((context & (IN_ATTRIBUTE|IN_ELEMENT)) == IN_ATTRIBUTE) + ns = ""; + else + ns = defaultNamespace; + return sb.makeName(ns, name.getString(), null, name.getLocation(), a); + } +} + +ParsedNameClass PrefixedNameClass(Annotations a) : +{ + Token t; +} +{ + t = + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + return sb.makeName(lookupPrefix(prefix, t), qn.substring(colon + 1), prefix, makeLocation(t), a); + } +} + +ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) : +{ + LocatedString ns; + ParsedNameClass nc; +} +{ + ns = NsName() + { checkNsName(context, ns); } + (nc = ExceptNameClass(context | IN_NS_NAME) + { nc = sb.makeNsName(ns.getString(), nc, ns.getLocation(), a); } + nc = AnnotateAfter(nc) + | { nc = sb.makeNsName(ns.getString(), ns.getLocation(), a); } + nc = AnnotateAfter(nc) + nc = NameClassAlternatives(context, nc, pa)) + { return nc; } +} + +LocatedString NsName() : +{ + Token t; +} +{ + t = + { + String qn = t.image; + String prefix = qn.substring(0, qn.length() - 2); + return new LocatedString(lookupPrefix(prefix, t), t); + } +} + +ParsedNameClass AnyNameExceptClass(int context, Annotations a, Annotations[] pa) : +{ + Token t; + ParsedNameClass nc; +} +{ + t = "*" + { checkAnyName(context, t); } + (nc = ExceptNameClass(context | IN_ANY_NAME) + { nc = sb.makeAnyName(nc, makeLocation(t), a); } + nc = AnnotateAfter(nc) + | { nc = sb.makeAnyName(makeLocation(t), a); } + nc = AnnotateAfter(nc) + nc = NameClassAlternatives(context, nc, pa)) + { return nc; } +} + +ParsedNameClass ParenNameClass(int context, Annotations a) : +{ + Token t; + ParsedNameClass nc; + Annotations[] pa = new Annotations[]{ a }; +} +{ + t = "(" nc = NameClass(context, pa) { nc = afterComments(nc); } ")" + { + if (pa[0] != null) + nc = sb.makeChoice(new ParsedNameClass[] { nc }, 1, makeLocation(t), pa[0]); + return nc; + } +} + +ParsedNameClass ExceptNameClass(int context) : +{ + ParsedNameClass nc; +} +{ + "-" nc = BasicNameClass(context) + { return nc; } +} + +ParsedPattern ListExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "list" + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeList(p, makeLocation(t), a); } +} + +ParsedPattern MixedExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "mixed" + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeMixed(p, makeLocation(t), a); } +} + +ParsedPattern GrammarExpr(Scope scope, Annotations a) : +{ + Token t; + Grammar g; +} +{ + t = "grammar" { g = sb.makeGrammar(scope); } + "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}" + { return g.endGrammar(makeLocation(t), a); } +} + +ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "(" p = Expr(topLevel, scope, t, a) { p = afterComments(p); } ")" + { return p; } +} + +Annotations GrammarBody(GrammarSection section, Scope scope, Annotations a) : +{ + ParsedElementAnnotation e; +} +{ + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() + { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* + (GrammarComponent(section, scope))* + { return a; } +} + +void GrammarComponent(GrammarSection section, Scope scope) : +{ + ParsedElementAnnotation e; + Annotations a; +} +{ + (a = Annotations() + (Definition(section, scope, a) + | Include(section, scope, a) + | Div(section, scope, a))) + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* +} + +void Definition(GrammarSection section, Scope scope, Annotations a) : +{} +{ + (Define(section, scope, a) | Start(section, scope, a)) +} + +void Start(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + GrammarSection.Combine combine; + ParsedPattern p; +} +{ + t = "start" combine = AssignOp() p = Expr(false, scope, null, null) + { section.define(GrammarSection.START, combine, p, makeLocation(t), a); } +} + +void Define(GrammarSection section, Scope scope, Annotations a) : +{ + LocatedString name; + GrammarSection.Combine combine; + ParsedPattern p; +} +{ + name = Identifier() combine = AssignOp() p = Expr(false, scope, null, null) + { section.define(name.getString(), combine, p, name.getLocation(), a); } +} + +GrammarSection.Combine AssignOp() : +{} +{ + "=" { return null; } + | "|=" { return GrammarSection.COMBINE_CHOICE; } + | "&=" { return GrammarSection.COMBINE_INTERLEAVE; } +} + +void Include(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + String href; + String ns; + Include include = section.makeInclude(); +} +{ + t = "include" href = Literal() + ns = Inherit() + ("{" a = IncludeBody(include, scope, a) { topLevelComments(include); } "}")? + { + try { + include.endInclude(resolve(href), ns, makeLocation(t), a); + } + catch (IllegalSchemaException e) { } + } +} + +Annotations IncludeBody(GrammarSection section, Scope scope, Annotations a) : +{ + ParsedElementAnnotation e; +} +{ + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() + { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* + (IncludeComponent(section, scope))* + { return a; } +} + + +void IncludeComponent(GrammarSection section, Scope scope) : +{ + ParsedElementAnnotation e; + Annotations a; +} +{ + (a = Annotations() (Definition(section, scope, a) + | IncludeDiv(section, scope, a))) + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* +} + +void Div(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + Div div = section.makeDiv(); +} +{ + t = "div" "{" a = GrammarBody(div, scope, a) { topLevelComments(div); } "}" + { div.endDiv(makeLocation(t), a); } +} + +void IncludeDiv(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + Div div = section.makeDiv(); +} +{ + t = "div" "{" a = IncludeBody(div, scope, a) { topLevelComments(div); } "}" + { div.endDiv(makeLocation(t), a); } +} + +ParsedPattern ExternalRefExpr(Scope scope, Annotations a) : +{ + Token t; + String href; + String ns; +} +{ + t = "external" href = Literal() + ns = Inherit() + { + try { + return sb.makeExternalRef(resolve(href), ns, scope, makeLocation(t), a); + } + catch (IllegalSchemaException e) { + return sb.makeErrorPattern(); + } + } +} + +String Inherit() : +{ + String ns = null; +} +{ + ("inherit" "=" ns = Prefix())? + { + if (ns == null) + ns = defaultNamespace; + return ns; + } +} + +ParsedPattern ParentExpr(Scope scope, Annotations a) : +{ + LocatedString name; +} +{ + "parent" { a = addCommentsToChildAnnotations(a); } name = Identifier() + { + return scope.makeParentRef(name.getString(), name.getLocation(), a); + } +} + +ParsedPattern IdentifierExpr(Scope scope, Annotations a) : +{ + LocatedString name; +} +{ + name = Identifier() + { + return scope.makeRef(name.getString(), name.getLocation(), a); + } +} + +ParsedPattern ValueExpr(boolean topLevel, Annotations a) : +{ + LocatedString s; +} +{ + s = LocatedLiteral() + { + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", s.getToken()); + a = null; + } + return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a); + } +} + +ParsedPattern DataExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : +{ + Token datatypeToken; + Location loc; + String datatype; + String datatypeUri = null; + String s = null; + ParsedPattern e = null; + DataPatternBuilder dpb; +} +{ + datatypeToken = DatatypeName() + { + datatype = datatypeToken.image; + loc = makeLocation(datatypeToken); + int colon = datatype.indexOf(':'); + if (colon < 0) + datatypeUri = ""; + else { + String prefix = datatype.substring(0, colon); + datatypeUri = lookupDatatype(prefix, datatypeToken); + datatype = datatype.substring(colon + 1); + } + } + ((s = Literal() + { + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", datatypeToken); + a = null; + } + return sb.makeValue(datatypeUri, datatype, s, getContext(), defaultNamespace, loc, a); + } + ) + | ( { dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc); } + ( (Params(dpb) (e = Except(scope, except))?) + | (e = Except(scope, except))?) + { return e == null ? dpb.makePattern(loc, a) : dpb.makePattern(e, loc, a); })) +} + +Token DatatypeName() : +{ + Token t; +} +{ + (t = "string" | t = "token" | t = ) + { return t; } +} + +LocatedString Identifier() : +{ + LocatedString s; + Token t; +} +{ + (t = { s = new LocatedString(t.image, t); } + | t = { s = new LocatedString(t.image.substring(1), t); }) + { return s; } +} + +String Prefix() : +{ + Token t; + String prefix; +} +{ + (t = { prefix = t.image; } + | t = { prefix = t.image.substring(1); } + | t = Keyword() { prefix = t.image; }) + { return lookupPrefix(prefix, t); } +} + +LocatedString UnprefixedName() : +{ + LocatedString s; + Token t; +} +{ + (s = Identifier() + | t = Keyword() { s = new LocatedString(t.image, t); }) + { return s; } +} + +void Params(DataPatternBuilder dpb) : +{} +{ + "{" (Param(dpb))* "}" +} + +void Param(DataPatternBuilder dpb) : +{ + LocatedString name; + Annotations a; + String value; +} +{ + a = Annotations() name = UnprefixedName() "=" { a = addCommentsToLeadingAnnotations(a); } value = Literal() + { dpb.addParam(name.getString(), value, getContext(), defaultNamespace, name.getLocation(), a); } +} + +ParsedPattern Except(Scope scope, Token[] except) : +{ + Annotations a; + ParsedPattern p; + Token t; + Token[] innerExcept = new Token[1]; +} +{ + t = "-" a = Annotations() p = PrimaryExpr(false, scope, a, innerExcept) + { + checkExcept(innerExcept); + except[0] = t; + return p; + } +} + +ParsedElementAnnotation Documentation() : +{ + CommentList comments = getComments(); + ElementAnnotationBuilder eab; + Token t; + String s; +} +{ + (t = | t = ) + { + eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS, + "documentation", + getCompatibilityPrefix(), + makeLocation(t), + comments, + getContext()); + eab.addText(mungeComment(t.image), makeLocation(t), null); + } + (t = { eab.addText("\n" + mungeComment(t.image), makeLocation(t), null); })* + { return eab.makeElementAnnotation(); } +} + +Annotations Annotations() : +{ + CommentList comments = getComments(); + Annotations a = null; + ParsedElementAnnotation e; +} +{ + ( { a = sb.makeAnnotations(comments, getContext()); } + (e = Documentation() { a.addElement(e); })+ + { + comments = getComments(); + if (comments != null) + a.addLeadingComment(comments); + } + )? + ("[" { if (a == null) a = sb.makeAnnotations(comments, getContext()); clearAttributeList(); annotationsIncludeElements = false; } + (LOOKAHEAD(2) PrefixedAnnotationAttribute(a, false) )* + ( e = AnnotationElement(false) { a.addElement(e); annotationsIncludeElements = true; } )* + { a.addComment(getComments()); } + "]")? + { + if (a == null && comments != null) + a = sb.makeAnnotations(comments, getContext()); + return a; + } +} + +void AnnotationAttribute(Annotations a) : +{} +{ + PrefixedAnnotationAttribute(a, true) | UnprefixedAnnotationAttribute(a) +} + +void PrefixedAnnotationAttribute(Annotations a, boolean nested) : +{ + Token t; + String value; +} +{ + t = "=" value = Literal() + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) + error("inherited_annotation_namespace", t); + else if (ns.length() == 0 && !nested) + error("unqualified_annotation_attribute", t); + else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested) + error("relax_ng_namespace", t); + /*else if (ns.length() == 0 + && qn.length() - colon - 1 == 5 + && qn.regionMatches(colon + 1, "xmlns", 0, 5)) + error("xmlns_annotation_attribute", t);*/ + else if (ns.equals(WellKnownNamespaces.XMLNS)) + error("xmlns_annotation_attribute_uri", t); + else { + if (ns.length() == 0) + prefix = null; + addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t); + } + } +} + +void UnprefixedAnnotationAttribute(Annotations a) : +{ + LocatedString name; + String value; +} +{ + name = UnprefixedName() "=" value = Literal() + { + if (name.getString().equals("xmlns")) + error("xmlns_annotation_attribute", name.getToken()); + else + addAttribute(a, "", name.getString(), null, value, name.getToken()); + } +} + +ParsedElementAnnotation AnnotationElement(boolean nested) : +{ + ParsedElementAnnotation a; +} +{ + (a = PrefixedAnnotationElement(nested) + | a = UnprefixedAnnotationElement()) + { return a; } +} + +ParsedElementAnnotation AnnotationElementNotKeyword() : +{ + ParsedElementAnnotation a; +} +{ + (a = PrefixedAnnotationElement(false) + | a = IdentifierAnnotationElement()) + { return a; } +} + +ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) : +{ + CommentList comments = getComments(); + Token t; + ElementAnnotationBuilder eab; +} +{ + t = + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) { + error("inherited_annotation_namespace", t); + ns = ""; + } + else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) { + error("relax_ng_namespace", t); + ns = ""; + } + else { + if (ns.length() == 0) + prefix = null; + } + eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix, + makeLocation(t), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +ParsedElementAnnotation UnprefixedAnnotationElement() : +{ + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; +} +{ + name = UnprefixedName() + { + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +ParsedElementAnnotation IdentifierAnnotationElement() : +{ + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; +} +{ + name = Identifier() + { + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +void AnnotationElementContent(ElementAnnotationBuilder eab) : +{ + ParsedElementAnnotation e; +} +{ + "[" { clearAttributeList(); } + (LOOKAHEAD(2) AnnotationAttribute(eab))* + ((AnnotationElementLiteral(eab) + ("~" AnnotationElementLiteral(eab))*) + | e = AnnotationElement(true) { eab.addElement(e); })* + { eab.addComment(getComments()); } + "]" +} + +void AnnotationElementLiteral(ElementAnnotationBuilder eab) : +{ + Token t; + CommentList comments = getComments(); +} +{ + t = { eab.addText(unquote(t.image), makeLocation(t), comments); } +} + +String Literal() : +{ + Token t; + String s; + StringBuffer buf; +} +{ + t = + { + s = unquote(t.image); + } + ( + { buf = new StringBuffer(s); } + ("~" t = { buf.append(unquote(t.image)); })+ + { s = buf.toString(); } + )? + { return s; } +} + +LocatedString LocatedLiteral() : +{ + Token t; + Token t2; + String s; + StringBuffer buf; +} +{ + t = + { + s = unquote(t.image); + } + ( + { buf = new StringBuffer(s); } + ("~" t2 = { buf.append(unquote(t2.image)); })+ + { s = buf.toString(); } + )? + { return new LocatedString(s, t); } +} + +Token Keyword() : +{ + Token t; +} +{ + (t = "element" + | t = "attribute" + | t = "namespace" + | t = "list" + | t = "mixed" + | t = "grammar" + | t = "empty" + | t = "text" + | t = "parent" + | t = "external" + | t = "notAllowed" + | t = "start" + | t = "include" + | t = "default" + | t = "inherit" + | t = "string" + | t = "token" + | t = "datatypes" + | t = "div") + { return t; } +} + +<*> +SKIP: { + < #NEWLINE : [ "\u0000", "\n" ] > + | < #NOT_NEWLINE : ~[ "\u0000", "\n" ] > + | < WS: ([ "\u0000", " ", "\n", "\t" ])+ > : DEFAULT +} + +TOKEN : +{ + < DOCUMENTATION: "##" ()* > : AFTER_DOCUMENTATION +} + + +TOKEN : +{ + < DOCUMENTATION_CONTINUE: ([" ", "\t"])* > +} + +SPECIAL_TOKEN: +{ + < SINGLE_LINE_COMMENT: "#" ()* > : AFTER_SINGLE_LINE_COMMENT +} + + +TOKEN : +{ + < DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: ([" ", "\t"])* > : AFTER_DOCUMENTATION +} + + +SPECIAL_TOKEN : +{ + < SINGLE_LINE_COMMENT_CONTINUE: ([" ", "\t"])* > +} + +TOKEN : +{ + < #BASE_CHAR : [ + "\u0041" - "\u005a", + "\u0061" - "\u007a", + "\u00c0" - "\u00d6", + "\u00d8" - "\u00f6", + "\u00f8" - "\u00ff", + "\u0100" - "\u0131", + "\u0134" - "\u013e", + "\u0141" - "\u0148", + "\u014a" - "\u017e", + "\u0180" - "\u01c3", + "\u01cd" - "\u01f0", + "\u01f4" - "\u01f5", + "\u01fa" - "\u0217", + "\u0250" - "\u02a8", + "\u02bb" - "\u02c1", + "\u0386", + "\u0388" - "\u038a", + "\u038c", + "\u038e" - "\u03a1", + "\u03a3" - "\u03ce", + "\u03d0" - "\u03d6", + "\u03da", + "\u03dc", + "\u03de", + "\u03e0", + "\u03e2" - "\u03f3", + "\u0401" - "\u040c", + "\u040e" - "\u044f", + "\u0451" - "\u045c", + "\u045e" - "\u0481", + "\u0490" - "\u04c4", + "\u04c7" - "\u04c8", + "\u04cb" - "\u04cc", + "\u04d0" - "\u04eb", + "\u04ee" - "\u04f5", + "\u04f8" - "\u04f9", + "\u0531" - "\u0556", + "\u0559", + "\u0561" - "\u0586", + "\u05d0" - "\u05ea", + "\u05f0" - "\u05f2", + "\u0621" - "\u063a", + "\u0641" - "\u064a", + "\u0671" - "\u06b7", + "\u06ba" - "\u06be", + "\u06c0" - "\u06ce", + "\u06d0" - "\u06d3", + "\u06d5", + "\u06e5" - "\u06e6", + "\u0905" - "\u0939", + "\u093d", + "\u0958" - "\u0961", + "\u0985" - "\u098c", + "\u098f" - "\u0990", + "\u0993" - "\u09a8", + "\u09aa" - "\u09b0", + "\u09b2", + "\u09b6" - "\u09b9", + "\u09dc" - "\u09dd", + "\u09df" - "\u09e1", + "\u09f0" - "\u09f1", + "\u0a05" - "\u0a0a", + "\u0a0f" - "\u0a10", + "\u0a13" - "\u0a28", + "\u0a2a" - "\u0a30", + "\u0a32" - "\u0a33", + "\u0a35" - "\u0a36", + "\u0a38" - "\u0a39", + "\u0a59" - "\u0a5c", + "\u0a5e", + "\u0a72" - "\u0a74", + "\u0a85" - "\u0a8b", + "\u0a8d", + "\u0a8f" - "\u0a91", + "\u0a93" - "\u0aa8", + "\u0aaa" - "\u0ab0", + "\u0ab2" - "\u0ab3", + "\u0ab5" - "\u0ab9", + "\u0abd", + "\u0ae0", + "\u0b05" - "\u0b0c", + "\u0b0f" - "\u0b10", + "\u0b13" - "\u0b28", + "\u0b2a" - "\u0b30", + "\u0b32" - "\u0b33", + "\u0b36" - "\u0b39", + "\u0b3d", + "\u0b5c" - "\u0b5d", + "\u0b5f" - "\u0b61", + "\u0b85" - "\u0b8a", + "\u0b8e" - "\u0b90", + "\u0b92" - "\u0b95", + "\u0b99" - "\u0b9a", + "\u0b9c", + "\u0b9e" - "\u0b9f", + "\u0ba3" - "\u0ba4", + "\u0ba8" - "\u0baa", + "\u0bae" - "\u0bb5", + "\u0bb7" - "\u0bb9", + "\u0c05" - "\u0c0c", + "\u0c0e" - "\u0c10", + "\u0c12" - "\u0c28", + "\u0c2a" - "\u0c33", + "\u0c35" - "\u0c39", + "\u0c60" - "\u0c61", + "\u0c85" - "\u0c8c", + "\u0c8e" - "\u0c90", + "\u0c92" - "\u0ca8", + "\u0caa" - "\u0cb3", + "\u0cb5" - "\u0cb9", + "\u0cde", + "\u0ce0" - "\u0ce1", + "\u0d05" - "\u0d0c", + "\u0d0e" - "\u0d10", + "\u0d12" - "\u0d28", + "\u0d2a" - "\u0d39", + "\u0d60" - "\u0d61", + "\u0e01" - "\u0e2e", + "\u0e30", + "\u0e32" - "\u0e33", + "\u0e40" - "\u0e45", + "\u0e81" - "\u0e82", + "\u0e84", + "\u0e87" - "\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94" - "\u0e97", + "\u0e99" - "\u0e9f", + "\u0ea1" - "\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa" - "\u0eab", + "\u0ead" - "\u0eae", + "\u0eb0", + "\u0eb2" - "\u0eb3", + "\u0ebd", + "\u0ec0" - "\u0ec4", + "\u0f40" - "\u0f47", + "\u0f49" - "\u0f69", + "\u10a0" - "\u10c5", + "\u10d0" - "\u10f6", + "\u1100", + "\u1102" - "\u1103", + "\u1105" - "\u1107", + "\u1109", + "\u110b" - "\u110c", + "\u110e" - "\u1112", + "\u113c", + "\u113e", + "\u1140", + "\u114c", + "\u114e", + "\u1150", + "\u1154" - "\u1155", + "\u1159", + "\u115f" - "\u1161", + "\u1163", + "\u1165", + "\u1167", + "\u1169", + "\u116d" - "\u116e", + "\u1172" - "\u1173", + "\u1175", + "\u119e", + "\u11a8", + "\u11ab", + "\u11ae" - "\u11af", + "\u11b7" - "\u11b8", + "\u11ba", + "\u11bc" - "\u11c2", + "\u11eb", + "\u11f0", + "\u11f9", + "\u1e00" - "\u1e9b", + "\u1ea0" - "\u1ef9", + "\u1f00" - "\u1f15", + "\u1f18" - "\u1f1d", + "\u1f20" - "\u1f45", + "\u1f48" - "\u1f4d", + "\u1f50" - "\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f" - "\u1f7d", + "\u1f80" - "\u1fb4", + "\u1fb6" - "\u1fbc", + "\u1fbe", + "\u1fc2" - "\u1fc4", + "\u1fc6" - "\u1fcc", + "\u1fd0" - "\u1fd3", + "\u1fd6" - "\u1fdb", + "\u1fe0" - "\u1fec", + "\u1ff2" - "\u1ff4", + "\u1ff6" - "\u1ffc", + "\u2126", + "\u212a" - "\u212b", + "\u212e", + "\u2180" - "\u2182", + "\u3041" - "\u3094", + "\u30a1" - "\u30fa", + "\u3105" - "\u312c", + "\uac00" - "\ud7a3" + ] > + | < #IDEOGRAPHIC : [ + "\u4e00" - "\u9fa5", + "\u3007", + "\u3021" - "\u3029" + ] > + | < #LETTER : ( | ) > + | < #COMBINING_CHAR : [ + "\u0300" - "\u0345", + "\u0360" - "\u0361", + "\u0483" - "\u0486", + "\u0591" - "\u05a1", + "\u05a3" - "\u05b9", + "\u05bb" - "\u05bd", + "\u05bf", + "\u05c1" - "\u05c2", + "\u05c4", + "\u064b" - "\u0652", + "\u0670", + "\u06d6" - "\u06dc", + "\u06dd" - "\u06df", + "\u06e0" - "\u06e4", + "\u06e7" - "\u06e8", + "\u06ea" - "\u06ed", + "\u0901" - "\u0903", + "\u093c", + "\u093e" - "\u094c", + "\u094d", + "\u0951" - "\u0954", + "\u0962" - "\u0963", + "\u0981" - "\u0983", + "\u09bc", + "\u09be", + "\u09bf", + "\u09c0" - "\u09c4", + "\u09c7" - "\u09c8", + "\u09cb" - "\u09cd", + "\u09d7", + "\u09e2" - "\u09e3", + "\u0a02", + "\u0a3c", + "\u0a3e", + "\u0a3f", + "\u0a40" - "\u0a42", + "\u0a47" - "\u0a48", + "\u0a4b" - "\u0a4d", + "\u0a70" - "\u0a71", + "\u0a81" - "\u0a83", + "\u0abc", + "\u0abe" - "\u0ac5", + "\u0ac7" - "\u0ac9", + "\u0acb" - "\u0acd", + "\u0b01" - "\u0b03", + "\u0b3c", + "\u0b3e" - "\u0b43", + "\u0b47" - "\u0b48", + "\u0b4b" - "\u0b4d", + "\u0b56" - "\u0b57", + "\u0b82" - "\u0b83", + "\u0bbe" - "\u0bc2", + "\u0bc6" - "\u0bc8", + "\u0bca" - "\u0bcd", + "\u0bd7", + "\u0c01" - "\u0c03", + "\u0c3e" - "\u0c44", + "\u0c46" - "\u0c48", + "\u0c4a" - "\u0c4d", + "\u0c55" - "\u0c56", + "\u0c82" - "\u0c83", + "\u0cbe" - "\u0cc4", + "\u0cc6" - "\u0cc8", + "\u0cca" - "\u0ccd", + "\u0cd5" - "\u0cd6", + "\u0d02" - "\u0d03", + "\u0d3e" - "\u0d43", + "\u0d46" - "\u0d48", + "\u0d4a" - "\u0d4d", + "\u0d57", + "\u0e31", + "\u0e34" - "\u0e3a", + "\u0e47" - "\u0e4e", + "\u0eb1", + "\u0eb4" - "\u0eb9", + "\u0ebb" - "\u0ebc", + "\u0ec8" - "\u0ecd", + "\u0f18" - "\u0f19", + "\u0f35", + "\u0f37", + "\u0f39", + "\u0f3e", + "\u0f3f", + "\u0f71" - "\u0f84", + "\u0f86" - "\u0f8b", + "\u0f90" - "\u0f95", + "\u0f97", + "\u0f99" - "\u0fad", + "\u0fb1" - "\u0fb7", + "\u0fb9", + "\u20d0" - "\u20dc", + "\u20e1", + "\u302a" - "\u302f", + "\u3099", + "\u309a" + ] > + | < #DIGIT : [ + "\u0030" - "\u0039", + "\u0660" - "\u0669", + "\u06f0" - "\u06f9", + "\u0966" - "\u096f", + "\u09e6" - "\u09ef", + "\u0a66" - "\u0a6f", + "\u0ae6" - "\u0aef", + "\u0b66" - "\u0b6f", + "\u0be7" - "\u0bef", + "\u0c66" - "\u0c6f", + "\u0ce6" - "\u0cef", + "\u0d66" - "\u0d6f", + "\u0e50" - "\u0e59", + "\u0ed0" - "\u0ed9", + "\u0f20" - "\u0f29" + ] > + | < #EXTENDER : [ + "\u00b7", + "\u02d0", + "\u02d1", + "\u0387", + "\u0640", + "\u0e46", + "\u0ec6", + "\u3005", + "\u3031" - "\u3035", + "\u309d" - "\u309e", + "\u30fc" - "\u30fe" + ] > + | < #NMSTART : ( | "_") > + | < #NMCHAR : ( | | | | "." | "-" | "_") > + | < #NCNAME: ()* > +} + +TOKEN : +{ + < IDENTIFIER: > + | < ESCAPED_IDENTIFIER: "\\" > + | < PREFIX_STAR: ":*" > + | < PREFIXED_NAME: ":" > + | < LITERAL : ("\"" (~["\u0000", "\""])* "\"") + | ("'" (~["\u0000", "'"])* "'") + | ("\"\"\"" (~["\""] + | ("\"" ~["\""]) + | ("\"\"" ~["\""]))* "\"\"\"") + | ("'''" (~["'"] + | ("'" ~["'"]) + | ("''" ~["'"]))* "'''") > + | < FANNOTATE : ">>" > +} + +/* This avoids lexical errors from JavaCC. */ +<*> +TOKEN : +{ + < ILLEGAL_CHAR : [ "\u0000" - "\u0008", "\u000b" - "\uffff" ] > +} diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.class new file mode 100644 index 0000000..56e0438 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.class new file mode 100644 index 0000000..fb2fb24 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EOFException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EOFException.class new file mode 100644 index 0000000..f1ddaba Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EOFException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.class new file mode 100644 index 0000000..bf3426a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/ParseException.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/ParseException.class new file mode 100644 index 0000000..4931f96 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/ParseException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/Token.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/Token.class new file mode 100644 index 0000000..16c9d4a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/Token.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/TokenMgrError.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/TokenMgrError.class new file mode 100644 index 0000000..1385d0f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/TokenMgrError.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.class new file mode 100644 index 0000000..8bf104e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties new file mode 100644 index 0000000..d1007c3 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties @@ -0,0 +1,22 @@ +syntax_error=syntax error +undeclared_prefix=undeclared prefix \"{0}\" +xmlns_prefix=prefix must not be \"xmlns\" +unqualified_annotation_attribute=annotation attribute must have a namespace URI +inherited_annotation_namespace=namespace URI for annotation cannot be inherited +xmlns_annotation_attribute=annotation attribute cannot be named \"xmlns\" +duplicate_attribute=multiple attributes with local name \"{0}\" and namespace URI \"{1}\" +except_missing_parentheses=parentheses required around \"-\" expression +xmlns_annotation_attribute_uri=annotation attribute cannot have namespace URI \"http://www.w3.org/2000/xmlns\" +xml_prefix_bad_uri=prefix \"xml\" can only be bound to namespace URI \"http://www.w3.org/XML/1998/namespace\" +xml_uri_bad_prefix=only prefix \"xml\" can be bound to namespace URI \"http://www.w3.org/XML/1998/namespace\" +illegal_hex_digit=expected hex digit +char_code_too_big=character code must be less than 0x110000 +illegal_char_code=code of character that is not allowed +illegal_char_code_ref=reference to character whose code is not allowed +incomplete_escape=incomplete escape sequence +any_name_except_contains_any_name=\"except\" in \"anyName\" contains \"anyName\" +ns_name_except_contains_any_name=\"except\" in \"nsName\" contains \"anyName\" +ns_name_except_contains_ns_name=\"except\" in \"nsName\" contains \"nsName\" +illegal_surrogate_pair=illegal surrogate pair +relax_ng_namespace=annotations cannot have namespace URI \"http://relaxng.org/ns/structure/1.0\" +top_level_follow_annotation=top-level pattern cannot have following annotations diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/DtdContext.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/DtdContext.class new file mode 100644 index 0000000..50a5fc3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/DtdContext.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.class new file mode 100644 index 0000000..3a2c464 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseable.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseable.class new file mode 100644 index 0000000..7e722d7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXParseable.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXSubParser.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXSubParser.class new file mode 100644 index 0000000..a626e8f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SAXSubParser.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AbstractContext.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AbstractContext.class new file mode 100644 index 0000000..03808fc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AbstractContext.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AnyNameState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AnyNameState.class new file mode 100644 index 0000000..efc91d1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AnyNameState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AttributeState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AttributeState.class new file mode 100644 index 0000000..cdb0601 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$AttributeState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ChoiceState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ChoiceState.class new file mode 100644 index 0000000..5facb6b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ChoiceState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$CommentHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$CommentHandler.class new file mode 100644 index 0000000..43e11f6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$CommentHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ContextImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ContextImpl.class new file mode 100644 index 0000000..7a12f3f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ContextImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DataState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DataState.class new file mode 100644 index 0000000..b8f40ed Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DataState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefineState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefineState.class new file mode 100644 index 0000000..081eaf2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefineState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefinitionState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefinitionState.class new file mode 100644 index 0000000..995cce9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DefinitionState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DivState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DivState.class new file mode 100644 index 0000000..130fbc3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$DivState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ElementState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ElementState.class new file mode 100644 index 0000000..1833817 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ElementState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyContentState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyContentState.class new file mode 100644 index 0000000..afd3a14 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyContentState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyState.class new file mode 100644 index 0000000..d88eef0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$EmptyState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ExternalRefState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ExternalRefState.class new file mode 100644 index 0000000..cb1dd09 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ExternalRefState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ForeignElementHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ForeignElementHandler.class new file mode 100644 index 0000000..23e97d4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ForeignElementHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarSectionState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarSectionState.class new file mode 100644 index 0000000..1e5e50e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarSectionState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarState.class new file mode 100644 index 0000000..fa74aad Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GrammarState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GroupState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GroupState.class new file mode 100644 index 0000000..1a1b6cd Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$GroupState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Handler.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Handler.class new file mode 100644 index 0000000..e2d0b62 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Handler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$IncludeState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$IncludeState.class new file mode 100644 index 0000000..6648373 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$IncludeState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$InterleaveState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$InterleaveState.class new file mode 100644 index 0000000..7503640 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$InterleaveState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$LexicalHandlerImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$LexicalHandlerImpl.class new file mode 100644 index 0000000..1d14212 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$LexicalHandlerImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ListState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ListState.class new file mode 100644 index 0000000..8c4b1f4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ListState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MergeGrammarState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MergeGrammarState.class new file mode 100644 index 0000000..d728b47 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MergeGrammarState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MixedState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MixedState.class new file mode 100644 index 0000000..c682338 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$MixedState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassBaseState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassBaseState.class new file mode 100644 index 0000000..6870b1d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassBaseState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChildState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChildState.class new file mode 100644 index 0000000..22b50b2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChildState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChoiceState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChoiceState.class new file mode 100644 index 0000000..8a7273b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassChoiceState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassContainerState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassContainerState.class new file mode 100644 index 0000000..5a8761d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassContainerState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassRef.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassRef.class new file mode 100644 index 0000000..7c88110 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameClassRef.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameState.class new file mode 100644 index 0000000..9048804 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NameState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NotAllowedState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NotAllowedState.class new file mode 100644 index 0000000..b7903f2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NotAllowedState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NsNameState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NsNameState.class new file mode 100644 index 0000000..0146d4a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$NsNameState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OneOrMoreState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OneOrMoreState.class new file mode 100644 index 0000000..7d9e5cb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OneOrMoreState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OptionalState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OptionalState.class new file mode 100644 index 0000000..72cd7aa Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$OptionalState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParamState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParamState.class new file mode 100644 index 0000000..25c43b0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParamState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParentRefState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParentRefState.class new file mode 100644 index 0000000..022aa0d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ParentRefState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PatternContainerState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PatternContainerState.class new file mode 100644 index 0000000..c8f5ca2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PatternContainerState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PrefixMapping.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PrefixMapping.class new file mode 100644 index 0000000..9473df3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$PrefixMapping.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RefState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RefState.class new file mode 100644 index 0000000..0e41e50 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RefState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RootState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RootState.class new file mode 100644 index 0000000..0df7bad Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$RootState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SavedContext.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SavedContext.class new file mode 100644 index 0000000..2d6c9f1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SavedContext.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SinglePatternContainerState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SinglePatternContainerState.class new file mode 100644 index 0000000..4cd0935 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$SinglePatternContainerState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Skipper.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Skipper.class new file mode 100644 index 0000000..1303492 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$Skipper.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$StartState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$StartState.class new file mode 100644 index 0000000..f21c518 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$StartState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$State.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$State.class new file mode 100644 index 0000000..b10f401 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$State.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$TextState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$TextState.class new file mode 100644 index 0000000..a939b7f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$TextState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ValueState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ValueState.class new file mode 100644 index 0000000..d6a3c18 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ValueState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ZeroOrMoreState.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ZeroOrMoreState.class new file mode 100644 index 0000000..18563af Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser$ZeroOrMoreState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser.class new file mode 100644 index 0000000..9e83b33 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/SchemaParser.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties new file mode 100644 index 0000000..63d7d7e --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties @@ -0,0 +1,38 @@ +no_comment_support=SAX parser \"{0}\" cannot report comments +any_name_except_contains_any_name=\"except\" in \"anyName\" contains \"anyName\" +attribute_multi_pattern=\"attribute\" pattern must contain at most one pattern +combine_attribute_bad_value=bad value \"{0}\" for \"combine\" attribute; value must be \"choice\" or \"interleave\" +expected_define=found \"{0}\" element but expected \"define\" or \"start\" or \"include\" or \"div\" element +expected_empty=found \"{0}\" element but expected empty content +expected_except=found \"{0}\" element but expected \"except\" +expected_grammar=found \"{0}\" element but expected \"grammar\" element +expected_name=found \"{0}\" element but expected a name +expected_name_class=found \"{0}\" element but expected a name-class +expected_param_except=only \"param\" and \"except\" child elements are allowed +expected_pattern=found \"{0}\" element but expected a pattern +fragment_identifier_datatype_library=URI in value of \"datatypeLibrary\" attribute must not have a fragment identifier +href_fragment_id=fragment identifier ignored in value of \"href\" attribute +illegal_attribute_ignored=illegal attribute \"{0}\" ignored +illegal_characters_ignored=illegal characters ignored +illegal_name_attribute=illegal \"name\" attribute +invalid_ncname=\"{0}\" is not a valid local name +invalid_uri=\"{0}\" is not a valid URI reference according to RFC 2396 +missing_children=missing children +missing_href_attribute=missing \"href\" attribute +missing_name_attribute=missing \"name\" attribute +missing_name_class=expected child element specifying name class +missing_type_attribute=missing \"type\" attribute +multiple_except=at most one \"except\" child element is allowed +name_contains_foreign_element=\"name\" element cannot contain foreign elements +ns_name_except_contains_any_name=\"except\" in \"nsName\" contains \"anyName\" +ns_name_except_contains_ns_name=\"except\" in \"nsName\" contains \"nsName\" +param_after_except=\"param\" is not allowed after \"except\" +param_contains_foreign_element=\"param\" element cannot contain foreign elements +qualified_attribute=attribute name \"{0}\" incorrectly qualified with RELAX NG namespace URI +relative_datatype_library=URI in value of \"datatypeLibrary\" attribute must not be relative +root_bad_namespace_uri=namespace URI of document element must be \"{0}\" +start_multi_pattern=\"start\" pattern must contain at most one pattern +too_many_children=too many child elements: only one child element is allowed +undefined_prefix=undefined prefix \"{0}\" +value_contains_foreign_element=\"value\" element cannot contain foreign elements +wrong_uri_version=namespace URI has wrong version: expected \"{0}\" but got \"{1}\" diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/Driver.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/Driver.class new file mode 100644 index 0000000..0edca23 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/Driver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ExegenDriver.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ExegenDriver.class new file mode 100644 index 0000000..6f37f32 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ExegenDriver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/TestDriver.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/TestDriver.class new file mode 100644 index 0000000..7c091d6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/TestDriver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ValidationEngine.class b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ValidationEngine.class new file mode 100644 index 0000000..9c9e8a7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/ValidationEngine.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Messages.properties new file mode 100644 index 0000000..9f5da9b --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Messages.properties @@ -0,0 +1,17 @@ +no_schematron=option \"-{0}\" is only applicable to Schematron, but this version of Jing does not support Schematron +invalid_phase=\"{0}\" is not a valid Schematron phase name + +elapsed_time=Elapsed time {0,number,#}+{1,number,#}={2,number,#} milliseconds + +option_missing_argument=option \"-{0}\" requires an argument +invalid_option=invalid option \"-{0}\" + +usage=Jing version {0}\n\ +usage: java com.thaiopensource.relaxng.util.Driver [-i] [-c] [-t] [-e encoding] RNGFile XMLFile...\n\ +RELAX NG is a schema language for XML\n\ +See http://relaxng.org/ for more information. + +exegen_usage=Jing version {0}\n\ +usage: jing [-i] [-c] [-t] [-e encoding] RNGFile XMLFile...\n\ +RELAX NG is a schema language for XML\n\ +See http://relaxng.org/ for more information. diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Version.properties b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Version.properties new file mode 100644 index 0000000..3634f19 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/relaxng/util/resources/Version.properties @@ -0,0 +1 @@ +version=20030619 diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Equal.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Equal.class new file mode 100644 index 0000000..becc939 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Equal.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Localizer.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Localizer.class new file mode 100644 index 0000000..cd6d9af Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Localizer.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$InvalidOptionException.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$InvalidOptionException.class new file mode 100644 index 0000000..704097a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$InvalidOptionException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$MissingArgumentException.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$MissingArgumentException.class new file mode 100644 index 0000000..198f3a7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser$MissingArgumentException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser.class new file mode 100644 index 0000000..689b423 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/OptionParser.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyId.class new file mode 100644 index 0000000..cc5391d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap$1.class new file mode 100644 index 0000000..86c8b44 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap.class new file mode 100644 index 0000000..b93dd36 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$1.class new file mode 100644 index 0000000..cc82349 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$PropertyMapImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$PropertyMapImpl.class new file mode 100644 index 0000000..ae856cc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder$PropertyMapImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder.class new file mode 100644 index 0000000..82a2b13 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/PropertyMapBuilder.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$1.class new file mode 100644 index 0000000..7fb2aec Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader.class new file mode 100644 index 0000000..bdfb435 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader2.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader2.class new file mode 100644 index 0000000..cd96f00 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Loader2.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$ProviderEnumeration.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$ProviderEnumeration.class new file mode 100644 index 0000000..d3b393a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$ProviderEnumeration.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Singleton.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Singleton.class new file mode 100644 index 0000000..d475a5b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service$Singleton.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Service.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service.class new file mode 100644 index 0000000..68cb1d7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Service.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/SinglePropertyMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/SinglePropertyMap.class new file mode 100644 index 0000000..a15ac79 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/SinglePropertyMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Uri.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Uri.class new file mode 100644 index 0000000..b51455c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Uri.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/UriOrFile.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/UriOrFile.class new file mode 100644 index 0000000..88af79d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/UriOrFile.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Utf16.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Utf16.class new file mode 100644 index 0000000..0b7503d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Utf16.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/util/Version.class b/thirdparty/epubcheck/bin/com/thaiopensource/util/Version.class new file mode 100644 index 0000000..c9601c6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/util/Version.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/AbstractSchema.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/AbstractSchema.class new file mode 100644 index 0000000..9e879c3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/AbstractSchema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/Flag.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Flag.class new file mode 100644 index 0000000..25ae5c3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Flag.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagOption.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagOption.class new file mode 100644 index 0000000..df88630 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagOption.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagPropertyId.class new file mode 100644 index 0000000..8e617a6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/FlagPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/IncorrectSchemaException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/IncorrectSchemaException.class new file mode 100644 index 0000000..c312007 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/IncorrectSchemaException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/Option.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Option.class new file mode 100644 index 0000000..716cb9c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Option.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentException.class new file mode 100644 index 0000000..4b26338 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentFormatException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentFormatException.class new file mode 100644 index 0000000..5e8936a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentFormatException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentPresenceException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentPresenceException.class new file mode 100644 index 0000000..e77505b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/OptionArgumentPresenceException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/Schema.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Schema.class new file mode 100644 index 0000000..d4472d3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Schema.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReader.class new file mode 100644 index 0000000..71325f0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderFactory.class new file mode 100644 index 0000000..230cc47 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderLoader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderLoader.class new file mode 100644 index 0000000..31018e0 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/SchemaReaderLoader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringOption.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringOption.class new file mode 100644 index 0000000..03dc3d5 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringOption.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringPropertyId.class new file mode 100644 index 0000000..b04fdc7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/StringPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$EntityResolverPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$EntityResolverPropertyId.class new file mode 100644 index 0000000..4490137 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$EntityResolverPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$ErrorHandlerPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$ErrorHandlerPropertyId.class new file mode 100644 index 0000000..e20bebd Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$ErrorHandlerPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$XMLReaderCreatorPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$XMLReaderCreatorPropertyId.class new file mode 100644 index 0000000..5cf6a3e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty$XMLReaderCreatorPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty.class new file mode 100644 index 0000000..b6d1471 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidateProperty.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidationDriver.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidationDriver.class new file mode 100644 index 0000000..9eeebf1 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/ValidationDriver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/Validator.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Validator.class new file mode 100644 index 0000000..773f81f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/Validator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReader.class new file mode 100644 index 0000000..d7fbfca Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$1.class new file mode 100644 index 0000000..f0f127d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$Handler.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$Handler.class new file mode 100644 index 0000000..613861a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver$Handler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver.class new file mode 100644 index 0000000..187dc82 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/AutoSchemaReceiver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/ReparseException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/ReparseException.class new file mode 100644 index 0000000..f8cfe9b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/ReparseException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/Rewindable.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/Rewindable.class new file mode 100644 index 0000000..55830e9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/Rewindable.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream$Block.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream$Block.class new file mode 100644 index 0000000..4e3ab9f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream$Block.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream.class new file mode 100644 index 0000000..5ca5ede Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/RewindableInputStream.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaFuture.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaFuture.class new file mode 100644 index 0000000..3195c96 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaFuture.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.class new file mode 100644 index 0000000..ca1d75e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.class new file mode 100644 index 0000000..5067152 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver$1.class new file mode 100644 index 0000000..1d425eb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.class new file mode 100644 index 0000000..2374519 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiver.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiver.class new file mode 100644 index 0000000..07519c2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiver.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$1.class new file mode 100644 index 0000000..36d85ef Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$SchemaReceiverFactoryPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$SchemaReceiverFactoryPropertyId.class new file mode 100644 index 0000000..bab7b80 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory$SchemaReceiverFactoryPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory.class new file mode 100644 index 0000000..39976d6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverLoader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverLoader.class new file mode 100644 index 0000000..729fcb3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/SchemaReceiverLoader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/resources/Messages.properties new file mode 100644 index 0000000..8e444b4 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/auto/resources/Messages.properties @@ -0,0 +1,2 @@ +unknown_namespace=no implementation available for schema language with namespace URI \"{0}\" +no_namespace=root element of schema must have a namespace diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ContextMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ContextMap.class new file mode 100644 index 0000000..2fb4dbc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ContextMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ElementsOrAttributes.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ElementsOrAttributes.class new file mode 100644 index 0000000..b20bb2d Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ElementsOrAttributes.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/Hashset.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/Hashset.class new file mode 100644 index 0000000..d0a5c2f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/Hashset.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.class new file mode 100644 index 0000000..e0512e7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.class new file mode 100644 index 0000000..80f5dbb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$1.class new file mode 100644 index 0000000..f4425d2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$ElementAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$ElementAction.class new file mode 100644 index 0000000..738acce Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$ElementAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Handler.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Handler.class new file mode 100644 index 0000000..7f5ae87 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Handler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Mode.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Mode.class new file mode 100644 index 0000000..78b409e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$Mode.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$WrappedIOException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$WrappedIOException.class new file mode 100644 index 0000000..a7aef37 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl$WrappedIOException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl.class new file mode 100644 index 0000000..8006a6e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaReceiverImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaReceiverImpl.class new file mode 100644 index 0000000..076e5d2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/SchemaReceiverImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$PrefixMapping.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$PrefixMapping.class new file mode 100644 index 0000000..92c4e16 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$PrefixMapping.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$Subtree.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$Subtree.class new file mode 100644 index 0000000..63f9f08 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl$Subtree.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl.class new file mode 100644 index 0000000..4df8b20 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/ValidatorImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/Messages.properties new file mode 100644 index 0000000..6cc1d91 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/Messages.properties @@ -0,0 +1,10 @@ +element_undeclared_namespace=no applicable schema for element with namespace \"{0}\" in this context +attributes_undeclared_namespace=no applicable schema for one or more attributes with namespace \"{0}\" in this context +lax_multiply_defined=laxness for mode \"{0}\" already defined +undefined_mode=mode \"{0}\" not defined +schema_fragment_id=schema URI must not have a fragment identifier +ns_absolute=namespace URI must be absolute URI +validate_attributes_multiply_defined=multiple applicable \"validateAttributes\" elements in mode \"{0}\" for namespace \"{1}\" +validate_element_multiply_defined=multiple applicable \"validateElement\" elements in mode \"{0}\" for namespace \"{1}\" +path_multiply_defined=mode for context \"{0}\" already defined +context_ns_not_covered=namespace of contextual element not covered diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/mns.rng b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/mns.rng new file mode 100644 index 0000000..ee9c633 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/mns/resources/mns.rng @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #default + + + + + + + elements + attributes + + + attributes + elements + + elements + attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Action.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Action.class new file mode 100644 index 0000000..ba6616a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Action.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ActionSet.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ActionSet.class new file mode 100644 index 0000000..17709bf Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ActionSet.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AllowAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AllowAction.class new file mode 100644 index 0000000..8af351e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AllowAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttachAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttachAction.class new file mode 100644 index 0000000..b1e5d5a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttachAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttributeActionSet.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttributeActionSet.class new file mode 100644 index 0000000..a4ec93e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/AttributeActionSet.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$1.class new file mode 100644 index 0000000..bfcc331 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$Enumerator.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$Enumerator.class new file mode 100644 index 0000000..b805910 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap$Enumerator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap.class new file mode 100644 index 0000000..8c95fa3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ContextMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ElementsOrAttributes.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ElementsOrAttributes.class new file mode 100644 index 0000000..96bdcb5 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ElementsOrAttributes.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/FilteredAttributes.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/FilteredAttributes.class new file mode 100644 index 0000000..049ffce Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/FilteredAttributes.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Hashset.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Hashset.class new file mode 100644 index 0000000..7190a0f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Hashset.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/IntSet.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/IntSet.class new file mode 100644 index 0000000..b4fce4f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/IntSet.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Mode.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Mode.class new file mode 100644 index 0000000..1e8b612 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Mode.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ModeUsage.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ModeUsage.class new file mode 100644 index 0000000..0bf3952 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ModeUsage.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NoResultAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NoResultAction.class new file mode 100644 index 0000000..83ef6e3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NoResultAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlProperty.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlProperty.class new file mode 100644 index 0000000..5cacfa8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlProperty.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.class new file mode 100644 index 0000000..81cd2bb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path$ParseException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path$ParseException.class new file mode 100644 index 0000000..b9999c3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path$ParseException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path.class new file mode 100644 index 0000000..83c8821 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/Path.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/RejectAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/RejectAction.class new file mode 100644 index 0000000..03f4942 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/RejectAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ResultAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ResultAction.class new file mode 100644 index 0000000..e3d63bc Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ResultAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$1.class new file mode 100644 index 0000000..bebcff5 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$Handler.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$Handler.class new file mode 100644 index 0000000..91fde63 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$Handler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$MustSupportOption.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$MustSupportOption.class new file mode 100644 index 0000000..a77e69a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$MustSupportOption.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$WrappedIOException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$WrappedIOException.class new file mode 100644 index 0000000..f7e6974 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl$WrappedIOException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl.class new file mode 100644 index 0000000..185c3d9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaReceiverImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaReceiverImpl.class new file mode 100644 index 0000000..755c01c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SchemaReceiverImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SectionState.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SectionState.class new file mode 100644 index 0000000..d636927 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/SectionState.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/UnwrapAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/UnwrapAction.class new file mode 100644 index 0000000..807d5b4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/UnwrapAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidateAction.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidateAction.class new file mode 100644 index 0000000..8f08f3b Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidateAction.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$PrefixMapping.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$PrefixMapping.class new file mode 100644 index 0000000..d4ae461 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$PrefixMapping.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Program.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Program.class new file mode 100644 index 0000000..590ea1e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Program.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Section.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Section.class new file mode 100644 index 0000000..f5d39d4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl$Section.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl.class new file mode 100644 index 0000000..235e9dd Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/ValidatorImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/Messages.properties new file mode 100644 index 0000000..7716924 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/Messages.properties @@ -0,0 +1,26 @@ +reject_element=elements from namespace \"{0}\" are not allowed +reject_attribute=attributes from namespace \"{0}\" are not allowed +undefined_mode=mode \"{0}\" not defined +schema_fragment_id=schema URI must not have a fragment identifier +ns_absolute=namespace URI must be absolute URI +unexpected_slash=unexpected \"/\" +expected_slash=expected \"/\" +expected_name=expected a name +empty_path=empty path +invalid_name=invalid name +duplicate_path=context with path \"{0}\" already defined +context_any_namespace=\"context\" not allowed within \"anyNamespace\" +duplicate_mode=mode \"{0}\" already defined +first_mode=mode \"{0}\" was first defined here +duplicate_attribute_action_any_namespace=rule for attributes from any namespace already specified in this mode +duplicate_attribute_action=rule for attributes from namespace \"{0}\" already specified in this mode +duplicate_element_action_any_namespace=rule for elements from any namespace already specified in this mode +duplicate_element_action=rule for elements from namespace \"{0}\" already specified in this mode +mode_cycle=mode \"{0}\" directly or indirectly extends itself +unknown_option=option \"{0}\" not recognized +unsupported_option=option \"{0}\" is not supported for this kind of schema +unsupported_option_arg=specified argument for option \"{0}\" is not supported +duplicate_option=option \"{0}\" cannot be specified more than once +option_requires_argument=option \"{0}\" requires an argument +option_unexpected_argument=option \"{0}\" does not take an argument +option_bad_argument=invalid argument for option \"{0}\" diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/nrl.rng b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/nrl.rng new file mode 100644 index 0000000..696fa1a --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/nrl/resources/nrl.rng @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + elements + attributes + + + attributes + elements + + elements + attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + allow + reject + + + + + + + + + + + + attach + unwrap + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #attach + #allow + #reject + #unwrap + + + + + + + + + + + + + \s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*(|\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*)* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/CompactSchemaReader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/CompactSchemaReader.class new file mode 100644 index 0000000..6d47f3c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/CompactSchemaReader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty$DatatypeLibraryFactoryPropertyId.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty$DatatypeLibraryFactoryPropertyId.class new file mode 100644 index 0000000..7b6a3bf Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty$DatatypeLibraryFactoryPropertyId.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty.class new file mode 100644 index 0000000..a3dd8d7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/RngProperty.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReader.class new file mode 100644 index 0000000..7c6f9fe Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.class new file mode 100644 index 0000000..f5e0969 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/DraconianErrorListener.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/DraconianErrorListener.class new file mode 100644 index 0000000..9661f77 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/DraconianErrorListener.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/OutputHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/OutputHandler.class new file mode 100644 index 0000000..32c5459 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/OutputHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.class new file mode 100644 index 0000000..161767c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaImpl.class new file mode 100644 index 0000000..f1dc527 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ErrorFilter.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ErrorFilter.class new file mode 100644 index 0000000..0e0554f Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ErrorFilter.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$LocationFilter.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$LocationFilter.class new file mode 100644 index 0000000..7a2097a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$LocationFilter.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$SAXErrorListener.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$SAXErrorListener.class new file mode 100644 index 0000000..ff86868 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$SAXErrorListener.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$TransformStage.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$TransformStage.class new file mode 100644 index 0000000..9bbe893 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$TransformStage.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserException.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserException.class new file mode 100644 index 0000000..f42b595 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserException.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserWrapErrorHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserWrapErrorHandler.class new file mode 100644 index 0000000..eef6e6c Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$UserWrapErrorHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ValidateStage.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ValidateStage.class new file mode 100644 index 0000000..2e093a2 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl$ValidateStage.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl.class new file mode 100644 index 0000000..3e7ea2a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchemaReaderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$1.class new file mode 100644 index 0000000..8a9a3e6 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$PhaseOption.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$PhaseOption.class new file mode 100644 index 0000000..d1f8a86 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty$PhaseOption.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty.class new file mode 100644 index 0000000..6e4d5b8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronProperty.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.class new file mode 100644 index 0000000..6ae2018 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$1.class new file mode 100644 index 0000000..e365638 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$BlockingReader.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$BlockingReader.class new file mode 100644 index 0000000..9f88358 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl$BlockingReader.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl.class new file mode 100644 index 0000000..ee6c4b4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/ValidatorImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/XMLReaderImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/XMLReaderImpl.class new file mode 100644 index 0000000..21623a4 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/XMLReaderImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/Messages.properties new file mode 100644 index 0000000..0cd5a66 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/Messages.properties @@ -0,0 +1,11 @@ +unexpected_schema_creation_error=could not create schema (please file a bug report) +# these messages are used in schematron.xsl +extends_cycle=cannot extend rule \"{0}\" because the extends chain has a cycle +active_missing=cannot activate non-existent pattern \"{0}\" +extends_missing=cannot extend non-existent rule \"{0}\" +extends_concrete=cannot extend rule \"{0}\" because it is not abstract +phase_missing=the schema does not define a phase \"{0}\" +default_phase_missing=the schema does not define its default phase \"{0}\" +diagnostic_missing=reference to non-existent diagnostic \"{0}\" +report=report: +failed_assertion=assertion failed: diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.rnc b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.rnc new file mode 100644 index 0000000..6a61909 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.rnc @@ -0,0 +1,167 @@ +# Based on +# http://www.ascc.net/xml/schematron/schematron1-5.dtd, version of 2002/08/16 + +# This version has the 1.6 feature that sch:key element with @match +# is allowed under sch:schema. This is not part of 1.5 proper. + +default namespace sch = "http://www.ascc.net/xml/schematron" +namespace local = "" + +start = schema + +# Element declarations +schema = + element schema { + attribute id { xsd:ID }?, + attribute fpi { fpi }?, + attribute ns { uri }?, + attribute schemaVersion { non-empty-string }?, + attribute defaultPhase { xsd:IDREF }?, + attribute icon { non-empty-string }?, + attribute version { non-empty-string }?, + (foreign + & (title?, + ns*, + p*, + (phase | key-with-match)*, + pattern+, + p*, + diagnostics?)) + } +active = + element active { + attribute pattern { xsd:IDREF }, + (foreign & (text | dir | emph | span)*) + } +assert = + element assert { + attribute test { expr }, + attribute role { role }?, + attribute id { xsd:ID }?, + attribute diagnostics { xsd:IDREFS }?, + attribute icon { uri }?, + attribute subject { path }?, + (foreign & (text | name | emph | dir | span)*) + } +dir = + element dir { + attribute value { "ltr" | "rtl" }?, + (foreign & text) + } +emph = element emph { text } +extends = + element extends { + attribute rule { xsd:IDREF }, + foreign-empty + } +diagnostic = + element diagnostic { + attribute id { xsd:ID }, + attribute icon { uri }?, + (foreign & (text | value-of | emph | dir | span)*) + } +diagnostics = element diagnostics { foreign & diagnostic* } +key = + element key { + attribute name { xsd:NMTOKEN }, + attribute path { path }, + attribute icon { uri }?, + foreign-empty + } +key-with-match = + element key { + attribute match { path }, + attribute name { xsd:NMTOKEN }, + attribute path { path }, + attribute icon { uri }?, + foreign-empty + } +name = + element name { + attribute path { path }?, + foreign-empty + } +ns = + element ns { + attribute uri { uri }, + attribute prefix { xsd:NMTOKEN }?, + foreign-empty + } +p = + element p { + attribute id { xsd:ID }?, + attribute class { non-empty-string }?, + attribute icon { uri }?, + (foreign & (text | dir | emph | span)*) + } +pattern = + element pattern { + attribute name { non-empty-string }, + attribute see { uri }?, + attribute id { xsd:ID }?, + attribute icon { uri }?, + (foreign & (p*, rule*)) + } +phase = + element phase { + attribute id { xsd:ID }, + attribute fpi { fpi }?, + attribute icon { uri }?, + (foreign & (p*, active*)) + } +report = + element report { + attribute test { expr }, + attribute role { role }?, + attribute id { xsd:ID }?, + attribute diagnostics { xsd:IDREFS }?, + attribute icon { uri }?, + attribute subject { path }?, + (foreign & (text | name | emph | dir | span)*) + } +rule = + element rule { + attribute role { role }?, + attribute id { xsd:ID }?, + (foreign + & ((attribute abstract { "true" }, (assert | report | extends)+) + | (attribute context { path }, + attribute abstract { "false" }?, + (assert | report | key | extends)+))) + } +span = + element span { + attribute class { non-empty-string }?, + (foreign & text) + } +title = element title { (text | dir)* } +value-of = + element value-of { + attribute select { path }, + foreign-empty + } + +foreign = foreign-attributes, foreign-element* + +foreign-empty = foreign-attributes + +foreign-attributes = attribute * - local:* { text }* +foreign-element = + element * - sch:* { + (attribute * { text } + | foreign-element + | schema + | text)* + } + +# Data types + +uri = xsd:anyURI +path = string +expr = string +fpi = string +lang = xsd:language + +role = xsd:NCName + +non-empty-string = xsd:token { minLength = "1" } diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.xsl b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.xsl new file mode 100644 index 0000000..7deb081 --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/validate/schematron/resources/schematron.xsl @@ -0,0 +1,405 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/AbstractLexicalHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/AbstractLexicalHandler.class new file mode 100644 index 0000000..e11ac34 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/AbstractLexicalHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/CountingErrorHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/CountingErrorHandler.class new file mode 100644 index 0000000..876203a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/CountingErrorHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DelegatingContentHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DelegatingContentHandler.class new file mode 100644 index 0000000..6347ed7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DelegatingContentHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DraconianErrorHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DraconianErrorHandler.class new file mode 100644 index 0000000..792d019 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/DraconianErrorHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ErrorHandlerImpl.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ErrorHandlerImpl.class new file mode 100644 index 0000000..f7ad7e8 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ErrorHandlerImpl.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkContentHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkContentHandler.class new file mode 100644 index 0000000..b231ceb Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkContentHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkDTDHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkDTDHandler.class new file mode 100644 index 0000000..85b6315 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/ForkDTDHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.class new file mode 100644 index 0000000..f7bdfa9 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.class new file mode 100644 index 0000000..516eb50 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XMLReaderCreator.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XMLReaderCreator.class new file mode 100644 index 0000000..9f7596a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XMLReaderCreator.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$1.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$1.class new file mode 100644 index 0000000..46b7e65 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$1.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$Entry.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$Entry.class new file mode 100644 index 0000000..75c4a7a Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler$Entry.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler.class new file mode 100644 index 0000000..72c2429 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/XmlBaseHandler.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/resources/Messages.properties b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/resources/Messages.properties new file mode 100644 index 0000000..7f133eb --- /dev/null +++ b/thirdparty/epubcheck/bin/com/thaiopensource/xml/sax/resources/Messages.properties @@ -0,0 +1,29 @@ +# first argument is message, second is location +fatal={1}fatal: {0} +# first argument is message, second is location +error={1}error: {0} +# first argument is message, second is location +warning={1}warning: {0} +# constructs string used as second argument of fatal, error, warning +locator_system_id={0}: \ + +# constructs string used as second argument of fatal, error, warning +locator_system_id_line_number={0}:{1,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_system_id_line_number_column_number={0}:{1,number,#}:{2,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_line_number=(unknown file):{0,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_line_number_column_number=(unknown file):{0,number,#}: \ + +# first argument is class name; second argument is detail message +exception=exception "{0}" thrown: {1} +# like "exception" except third argument is original message +tunnel_exception=exception "{0}" thrown: {1}: {2} +# special case for java.io.FileNotFoundException; first argument is detail +file_not_found=file not found: {0} +# when exception has no detail message available +no_detail=(no further details available) diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/EncodingMap.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/EncodingMap.class new file mode 100644 index 0000000..88207b3 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/EncodingMap.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Name.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Name.class new file mode 100644 index 0000000..d315250 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Name.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Naming.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Naming.class new file mode 100644 index 0000000..425a0c7 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/Naming.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/StringSplitter.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/StringSplitter.class new file mode 100644 index 0000000..c68cb4e Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/StringSplitter.class differ diff --git a/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/WellKnownNamespaces.class b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/WellKnownNamespaces.class new file mode 100644 index 0000000..afcaf22 Binary files /dev/null and b/thirdparty/epubcheck/bin/com/thaiopensource/xml/util/WellKnownNamespaces.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/Datatype.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/Datatype.class new file mode 100644 index 0000000..d5105d3 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/Datatype.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeBuilder.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeBuilder.class new file mode 100644 index 0000000..201db39 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeBuilder.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeException.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeException.class new file mode 100644 index 0000000..43e5197 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeException.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibrary.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibrary.class new file mode 100644 index 0000000..03f7b2b Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibrary.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibraryFactory.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibraryFactory.class new file mode 100644 index 0000000..645ca9e Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeLibraryFactory.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeStreamingValidator.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeStreamingValidator.class new file mode 100644 index 0000000..db6ea15 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/DatatypeStreamingValidator.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/ValidationContext.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/ValidationContext.class new file mode 100644 index 0000000..7613050 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/ValidationContext.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$1.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$1.class new file mode 100644 index 0000000..ab2113f Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$1.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader.class new file mode 100644 index 0000000..0afb5fb Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader2.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader2.class new file mode 100644 index 0000000..dc7a7f3 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Loader2.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$ProviderEnumeration.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$ProviderEnumeration.class new file mode 100644 index 0000000..897608a Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$ProviderEnumeration.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Singleton.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Singleton.class new file mode 100644 index 0000000..eaaa4a0 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service$Singleton.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service.class new file mode 100644 index 0000000..b1c7591 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader$Service.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader.class new file mode 100644 index 0000000..6e89f8d Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/DatatypeLibraryLoader.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.class new file mode 100644 index 0000000..8329ee2 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.class differ diff --git a/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/StreamingValidatorImpl.class b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/StreamingValidatorImpl.class new file mode 100644 index 0000000..12083f3 Binary files /dev/null and b/thirdparty/epubcheck/bin/org/relaxng/datatype/helpers/StreamingValidatorImpl.class differ diff --git a/thirdparty/epubcheck/build.bat b/thirdparty/epubcheck/build.bat new file mode 100644 index 0000000..07e14e5 --- /dev/null +++ b/thirdparty/epubcheck/build.bat @@ -0,0 +1,6 @@ +set path=..\..\main\ADE\tools\win\jdk1.5.0\bin;..\..\main\ADE\tools\apache-ant-1.6.2\bin; +set ANT_HOME=..\..\main\ADE\tools\apache-ant-1.6.2 +set JAVA_HOME=..\..\main\ADE\tools\win\jdk1.5.0 +set CLASSPATH= +call ant -f build.xml +pause \ No newline at end of file diff --git a/thirdparty/epubcheck/build.xml b/thirdparty/epubcheck/build.xml new file mode 100644 index 0000000..772891a --- /dev/null +++ b/thirdparty/epubcheck/build.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/epubcheck-1.0.5.jar b/thirdparty/epubcheck/epubcheck-1.0.5.jar new file mode 100644 index 0000000..fdaaca0 Binary files /dev/null and b/thirdparty/epubcheck/epubcheck-1.0.5.jar differ diff --git a/thirdparty/epubcheck/foo.epub b/thirdparty/epubcheck/foo.epub new file mode 100644 index 0000000..029ceee Binary files /dev/null and b/thirdparty/epubcheck/foo.epub differ diff --git a/thirdparty/epubcheck/jing_license.txt b/thirdparty/epubcheck/jing_license.txt new file mode 100644 index 0000000..57d36a3 --- /dev/null +++ b/thirdparty/epubcheck/jing_license.txt @@ -0,0 +1,12 @@ +Jing Copying Conditions + +Copyright (c) 2001-2003 Thai Open Source Software Center Ltd +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the Thai Open Source Software Center Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine new file mode 100644 index 0000000..327aad0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine @@ -0,0 +1,3 @@ +com.thaiopensource.datatype.xsd.regex.jdk1_4.RegexEngineImpl +com.thaiopensource.datatype.xsd.regex.xerces2.RegexEngineImpl +com.thaiopensource.datatype.xsd.regex.xerces.RegexEngineImpl diff --git a/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory new file mode 100644 index 0000000..44a7cc0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.SchemaReaderFactory @@ -0,0 +1,4 @@ +com.thaiopensource.validate.jarv.JarvSchemaReaderFactory +com.thaiopensource.validate.xerces.XsdSchemaReaderFactory +com.thaiopensource.validate.schematron.SaxonSchemaReaderFactory +com.thaiopensource.validate.schematron.XalanSchemaReaderFactory diff --git a/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory new file mode 100644 index 0000000..ff95351 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/META-INF/services/com.thaiopensource.validate.auto.SchemaReceiverFactory @@ -0,0 +1,4 @@ +com.thaiopensource.validate.rng.SAXSchemaReceiverFactory +com.thaiopensource.validate.mns.MnsSchemaReceiverFactory +com.thaiopensource.validate.nrl.NrlSchemaReceiverFactory +com.thaiopensource.validate.auto.SchemaReaderLoaderSchemaReceiverFactory diff --git a/thirdparty/epubcheck/jingsrc/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader b/thirdparty/epubcheck/jingsrc/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader new file mode 100644 index 0000000..6393d7f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader @@ -0,0 +1 @@ +com.thaiopensource.relaxng.jarv.VerifierFactoryLoaderImpl diff --git a/thirdparty/epubcheck/jingsrc/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory b/thirdparty/epubcheck/jingsrc/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory new file mode 100644 index 0000000..1353184 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory @@ -0,0 +1 @@ +com.thaiopensource.datatype.xsd.DatatypeLibraryFactoryImpl diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/Datatype2.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/Datatype2.java new file mode 100644 index 0000000..5e3d141 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/Datatype2.java @@ -0,0 +1,7 @@ +package com.thaiopensource.datatype; + +import org.relaxng.datatype.Datatype; + +public interface Datatype2 extends Datatype { + boolean alwaysValid(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/AnyUriDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/AnyUriDatatype.java new file mode 100644 index 0000000..c7ad5f5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/AnyUriDatatype.java @@ -0,0 +1,14 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.util.Uri; +import org.relaxng.datatype.ValidationContext; + +class AnyUriDatatype extends TokenDatatype { + public boolean lexicallyAllows(String str) { + return Uri.isValid(str); + } + + public boolean alwaysValid() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.java new file mode 100644 index 0000000..2bf526b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Base64BinaryDatatype.java @@ -0,0 +1,105 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class Base64BinaryDatatype extends BinaryDatatype { + static private final byte[] weightTable = makeWeightTable(); + static private final byte INVALID = (byte)-1; + static private final byte WHITESPACE = (byte)-2; + static private final byte PADDING = (byte)-3; + + // for efficiency, don't assume whitespace normalized + boolean lexicallyAllows(String str) { + return byteCount(str) >= 0; + } + + private static int byteCount(String str) { + int nChars = 0; + int nPadding = 0; + int lastCharWeight = -1; + for (int i = 0, len = str.length(); i < len; i++) { + char c = str.charAt(i); + if (c >= 128) + return -1; + int w = weightTable[c]; + switch (w) { + case WHITESPACE: + break; + case PADDING: + if (++nPadding > 2) + return -1; + break; + case INVALID: + return -1; + default: + if (nPadding > 0) + return -1; + lastCharWeight = w; + nChars++; + break; + } + } + if (((nChars + nPadding) & 0x3) != 0) + return -1; + switch (nPadding) { + case 1: + // 1 padding char; last quartet specifies 2 bytes = 16 bits = 6 + 6 + 4 bits + // lastChar must have 6 - 4 = 2 unused bits + if ((lastCharWeight & 0x3) != 0) + return -1; + break; + case 2: + // 2 padding chars; last quartet specifies 1 byte = 8 bits = 6 + 2 bits + // lastChar must have 6 - 2 = 4 unused bits + if ((lastCharWeight & 0xF) != 0) + return -1; + break; + } + return ((nChars + nPadding) >> 2)*3 - nPadding; + } + + Object getValue(String str, ValidationContext vc) { + int nBytes = byteCount(str); + byte[] value = new byte[nBytes]; + int valueIndex = 0; + int nBytesAccum = 0; + int accum = 0; + for (int i = 0, len = str.length(); i < len; i++) { + int w = weightTable[str.charAt(i)]; + if (w != WHITESPACE) { + accum <<= 6; + if (w != PADDING) + accum |= w; + if (++nBytesAccum == 4) { + for (int shift = 16; shift >= 0; shift -= 8) { + if (valueIndex < nBytes) + value[valueIndex++] = (byte)((accum >> shift) & 0xFF); + } + nBytesAccum = 0; + accum = 0; + } + } + } + return value; + } + + static private byte[] makeWeightTable() { + byte[] w = new byte[128]; + byte n = INVALID; + for (int i = 0; i < 128; i++) + w[i] = n; + n = 0; + for (int i = 'A'; i <= 'Z'; i++, n++) + w[i] = n; + for (int i = 'a'; i <= 'z'; i++, n++) + w[i] = n; + for (int i = '0'; i <= '9'; i++, n++) + w[i] = n; + w['+'] = n++; + w['/'] = n++; + w[' '] = w['\t'] = w['\r'] = w['\n'] = WHITESPACE; + w['='] = PADDING; + return w; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BinaryDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BinaryDatatype.java new file mode 100644 index 0000000..2cd3348 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BinaryDatatype.java @@ -0,0 +1,35 @@ +package com.thaiopensource.datatype.xsd; + +abstract class BinaryDatatype extends DatatypeBase implements Measure { + BinaryDatatype() { + // whiteSpace is actually collapse, but we handle it ourselves for efficiency + super(WHITE_SPACE_PRESERVE); + } + + public int valueHashCode(Object value) { + byte[] v = (byte[])value; + int hc = 0; + for (int i = 0, len = v.length; i < len; i++) + hc = (hc * 33) ^ (v[i] & 0xFF); + return hc; + } + + public boolean sameValue(Object value1, Object value2) { + byte[] v1 = (byte[])value1; + byte[] v2 = (byte[])value2; + if (v1.length != v2.length) + return false; + for (int i = 0, len = v1.length; i < len; i++) + if (v1[i] != v2[i]) + return false; + return true; + } + + public int getLength(Object obj) { + return ((byte[])obj).length; + } + + Measure getMeasure() { + return this; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BooleanDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BooleanDatatype.java new file mode 100644 index 0000000..d3fb9c8 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/BooleanDatatype.java @@ -0,0 +1,17 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class BooleanDatatype extends DatatypeBase { + boolean lexicallyAllows(String str) { + return str.equals("true") || str.equals("false") || str.equals("1") || str.equals("0"); + } + Object getValue(String str, ValidationContext vc) { + switch (str.charAt(0)) { + case 't': + case '1': + return Boolean.TRUE; + } + return Boolean.FALSE; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/CdataDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/CdataDatatype.java new file mode 100644 index 0000000..5c298af --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/CdataDatatype.java @@ -0,0 +1,7 @@ +package com.thaiopensource.datatype.xsd; + +class CdataDatatype extends TokenDatatype { + CdataDatatype() { + super(WHITE_SPACE_REPLACE); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBase.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBase.java new file mode 100644 index 0000000..d875c01 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBase.java @@ -0,0 +1,171 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.ValidationContext; +import org.relaxng.datatype.DatatypeStreamingValidator; +import org.relaxng.datatype.helpers.StreamingValidatorImpl; +import com.thaiopensource.datatype.Datatype2; + +abstract class DatatypeBase implements Datatype2 { + abstract boolean lexicallyAllows(String str); + private final int whiteSpace; + + static final int WHITE_SPACE_PRESERVE = 0; + static final int WHITE_SPACE_REPLACE = 1; + static final int WHITE_SPACE_COLLAPSE = 2; + + DatatypeBase() { + whiteSpace = WHITE_SPACE_COLLAPSE; + } + + DatatypeBase(int whiteSpace) { + this.whiteSpace = whiteSpace; + } + + int getWhiteSpace() { + return whiteSpace; + } + + public boolean isValid(String str, ValidationContext vc) { + str = normalizeWhiteSpace(str); + return lexicallyAllows(str) && allowsValue(str, vc); + } + + public void checkValid(String str, ValidationContext vc) throws DatatypeException { + if (!isValid(str, vc)) + throw new DatatypeException(); + } + + public Object createValue(String str, ValidationContext vc) { + str = normalizeWhiteSpace(str); + if (!lexicallyAllows(str)) + return null; + return getValue(str, vc); + } + + final String normalizeWhiteSpace(String str) { + switch (whiteSpace) { + case WHITE_SPACE_COLLAPSE: + return collapseWhiteSpace(str); + case WHITE_SPACE_REPLACE: + return replaceWhiteSpace(str); + } + return str; + } + + /* Requires lexicallyAllows to be true. Must return same value as + getValue(str, vc) != null. */ + boolean allowsValue(String str, ValidationContext vc) { + return true; + } + + /* Requires lexicallyAllows to be true. Returns null if value does not satisfy + constraints on value space. */ + abstract Object getValue(String str, ValidationContext vc); + + OrderRelation getOrderRelation() { + return null; + } + + /* For datatypes that have a length. */ + Measure getMeasure() { + return null; + } + + static private final String collapseWhiteSpace(String s) { + int i = collapseStart(s); + if (i < 0) + return s; + StringBuffer buf = new StringBuffer(s.substring(0, i)); + boolean collapsing = (i == 0 || s.charAt(i - 1) == ' '); + for (int len = s.length(); i < len; i++) { + char c = s.charAt(i); + switch (c) { + case '\r': + case '\n': + case '\t': + case ' ': + if (!collapsing) { + buf.append(' '); + collapsing = true; + } + break; + default: + collapsing = false; + buf.append(c); + break; + } + } + if (buf.length() > 0 && buf.charAt(buf.length() - 1) == ' ') + buf.setLength(buf.length() - 1); + return buf.toString(); + } + + static private final int collapseStart(String s) { + for (int i = 0, len = s.length(); i < len; i++) { + switch (s.charAt(i)) { + case ' ': + if (i == 0 || s.charAt(i - 1) == ' ' || i == len - 1) + return i; + break; + case '\r': + case '\n': + case '\t': + return i; + } + } + return -1; + } + + static private final String replaceWhiteSpace(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) + switch (s.charAt(i)) { + case '\r': + case '\n': + case '\t': + { + char[] buf = s.toCharArray(); + buf[i] = ' '; + for (++i; i < len; i++) + switch (buf[i]) { + case '\r': + case '\n': + case '\t': + buf[i] = ' '; + } + return new String(buf); + } + } + return s; + } + + DatatypeBase getPrimitive() { + return this; + } + + public boolean isContextDependent() { + return false; + } + + public boolean alwaysValid() { + return false; + } + + public int getIdType() { + return ID_TYPE_NULL; + } + + public int valueHashCode(Object value) { + return value.hashCode(); + } + + public boolean sameValue(Object value1, Object value2) { + return value1.equals(value2); + } + + public DatatypeStreamingValidator createStreamingValidator(ValidationContext vc) { + return new StreamingValidatorImpl(this, vc); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.java new file mode 100644 index 0000000..1bea8c1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeBuilderImpl.java @@ -0,0 +1,178 @@ +package com.thaiopensource.datatype.xsd; + +import java.util.ResourceBundle; +import java.text.MessageFormat; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeBuilder; +import org.relaxng.datatype.ValidationContext; +import org.relaxng.datatype.DatatypeException; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; +import com.thaiopensource.util.Localizer; + +class DatatypeBuilderImpl implements DatatypeBuilder { + static final Localizer localizer = new Localizer(DatatypeBuilderImpl.class); + + private DatatypeBase base; + private final DatatypeLibraryImpl library; + + DatatypeBuilderImpl(DatatypeLibraryImpl library, DatatypeBase base) throws DatatypeException { + this.library = library; + this.base = base; + } + + public void addParameter(String name, + String value, + ValidationContext context) throws DatatypeException { + if (name.equals("pattern")) + addPatternParam(value); + else if (name.equals("minInclusive")) + addMinInclusiveParam(value, context); + else if (name.equals("maxInclusive")) + addMaxInclusiveParam(value, context); + else if (name.equals("minExclusive")) + addMinExclusiveParam(value, context); + else if (name.equals("maxExclusive")) + addMaxExclusiveParam(value, context); + else if (name.equals("length")) + addLengthParam(value); + else if (name.equals("minLength")) + addMinLengthParam(value); + else if (name.equals("maxLength")) + addMaxLengthParam(value); + else if (name.equals("fractionDigits")) + addScaleParam(value); + else if (name.equals("totalDigits")) + addPrecisionParam(value); + else if (name.equals("enumeration")) + error("enumeration_param"); + else if (name.equals("whiteSpace")) + error("whiteSpace_param"); + else + error("unrecognized_param", name); + } + + private void addPatternParam(String value) throws DatatypeException { + try { + base = new PatternRestrictDatatype(base, + library.getRegexEngine().compile(value)); + } + catch (RegexSyntaxException e) { + int pos = e.getPosition(); + if (pos == RegexSyntaxException.UNKNOWN_POSITION) + pos = DatatypeException.UNKNOWN; + error("invalid_regex", e.getMessage(), pos); + } + } + + private void addMinInclusiveParam(String value, ValidationContext context) + throws DatatypeException { + base = new MinInclusiveRestrictDatatype(base, + getLimit(value, context)); + } + + private void addMaxInclusiveParam(String value, ValidationContext context) + throws DatatypeException { + base = new MaxInclusiveRestrictDatatype(base, + getLimit(value, context)); + } + + private void addMinExclusiveParam(String value, ValidationContext context) + throws DatatypeException { + base = new MinExclusiveRestrictDatatype(base, + getLimit(value, context)); + } + + private void addMaxExclusiveParam(String value, ValidationContext context) + throws DatatypeException { + base = new MaxExclusiveRestrictDatatype(base, + getLimit(value, context)); + } + + private Object getLimit(String str, ValidationContext context) + throws DatatypeException { + if (base.getOrderRelation() == null) + error("not_ordered"); + Object value = base.createValue(str, context); + if (value == null) + error("invalid_limit", str); + return value; + } + + private void addLengthParam(String value) throws DatatypeException { + base = new LengthRestrictDatatype(base, getLength(value)); + } + + private void addMinLengthParam(String value) throws DatatypeException { + base = new MinLengthRestrictDatatype(base, getLength(value)); + } + + private void addMaxLengthParam(String value) throws DatatypeException { + base = new MaxLengthRestrictDatatype(base, getLength(value)); + } + + private int getLength(String str) throws DatatypeException { + if (base.getMeasure() == null) + error("no_length"); + int len = convertNonNegativeInteger(str); + if (len < 0) + error("value_not_non_negative_integer"); + return len; + } + + private void addScaleParam(String str) throws DatatypeException { + if (!(base.getPrimitive() instanceof DecimalDatatype)) + error("scale_not_derived_from_decimal"); + int scale = convertNonNegativeInteger(str); + if (scale < 0) + error("value_not_non_negative_integer"); + base = new ScaleRestrictDatatype(base, scale); + } + + private void addPrecisionParam(String str) throws DatatypeException { + if (!(base.getPrimitive() instanceof DecimalDatatype)) + error("precision_not_derived_from_decimal"); + int scale = convertNonNegativeInteger(str); + if (scale <= 0) + error("value_not_positive_integer"); + base = new PrecisionRestrictDatatype(base, scale); + } + + public Datatype createDatatype() { + return base; + } + + private static void error(String key) throws DatatypeException { + throw new DatatypeException(localizer.message(key)); + } + + private static void error(String key, String arg) throws DatatypeException { + throw new DatatypeException(localizer.message(key, arg)); + } + + private static void error(String key, String arg, int pos) throws DatatypeException { + throw new DatatypeException(pos, localizer.message(key, arg)); + } + + // Return -1 for anything that is not a nonNegativeInteger + // Return Integer.MAX_VALUE for values that are too big + + private int convertNonNegativeInteger(String str) { + str = str.trim(); + DecimalDatatype decimal = new DecimalDatatype(); + if (!decimal.lexicallyAllows(str)) + return -1; + // Canonicalize the value + str = decimal.getValue(str, null).toString(); + // Reject negative and fractional numbers + if (str.charAt(0) == '-' || str.indexOf('.') >= 0) + return -1; + try { + return Integer.parseInt(str); + } + catch (NumberFormatException e) { + // Map out of range integers to MAX_VALUE + return Integer.MAX_VALUE; + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.java new file mode 100644 index 0000000..77f4d6d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryFactoryImpl.java @@ -0,0 +1,20 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.DatatypeLibrary; +import org.relaxng.datatype.DatatypeLibraryFactory; +import com.thaiopensource.xml.util.WellKnownNamespaces; + +public class DatatypeLibraryFactoryImpl implements DatatypeLibraryFactory { + + private DatatypeLibrary datatypeLibrary = null; + + public DatatypeLibrary createDatatypeLibrary(String uri) { + if (!WellKnownNamespaces.XML_SCHEMA_DATATYPES.equals(uri)) + return null; + synchronized (this) { + if (datatypeLibrary == null) + datatypeLibrary = new DatatypeLibraryImpl(); + return datatypeLibrary; + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.java new file mode 100644 index 0000000..f1ea515 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DatatypeLibraryImpl.java @@ -0,0 +1,149 @@ +package com.thaiopensource.datatype.xsd; + +import java.util.Hashtable; +import java.util.Enumeration; + +import com.thaiopensource.util.Service; +import com.thaiopensource.datatype.xsd.regex.RegexEngine; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; + +import org.relaxng.datatype.DatatypeLibrary; +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.DatatypeBuilder; + +public class DatatypeLibraryImpl implements DatatypeLibrary { + private final Hashtable typeTable = new Hashtable(); + private final RegexEngine regexEngine; + + static private final String LONG_MAX = "9223372036854775807"; + static private final String LONG_MIN = "-9223372036854775808"; + static private final String INT_MAX = "2147483647"; + static private final String INT_MIN = "-2147483648"; + static private final String SHORT_MAX = "32767"; + static private final String SHORT_MIN = "-32768"; + static private final String BYTE_MAX = "127"; + static private final String BYTE_MIN = "-128"; + + static private final String UNSIGNED_LONG_MAX = "18446744073709551615"; + static private final String UNSIGNED_INT_MAX = "4294967295"; + static private final String UNSIGNED_SHORT_MAX = "65535"; + static private final String UNSIGNED_BYTE_MAX = "255"; + // Follow RFC 3066 syntax. + static private final String LANGUAGE_PATTERN = "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"; + + public DatatypeLibraryImpl() { + this.regexEngine = findRegexEngine(); + typeTable.put("string", new StringDatatype()); + typeTable.put("normalizedString", new CdataDatatype()); + typeTable.put("token", new TokenDatatype()); + typeTable.put("boolean", new BooleanDatatype()); + + DatatypeBase decimalType = new DecimalDatatype(); + typeTable.put("decimal", decimalType); + DatatypeBase integerType = new IntegerRestrictDatatype(decimalType); + typeTable.put("integer", integerType); + typeTable.put("nonPositiveInteger", restrictMax(integerType, "0")); + typeTable.put("negativeInteger", restrictMax(integerType, "-1")); + typeTable.put("long", restrictMax(restrictMin(integerType, LONG_MIN), LONG_MAX)); + typeTable.put("int", restrictMax(restrictMin(integerType, INT_MIN), INT_MAX)); + typeTable.put("short", restrictMax(restrictMin(integerType, SHORT_MIN), SHORT_MAX)); + typeTable.put("byte", restrictMax(restrictMin(integerType, BYTE_MIN), BYTE_MAX)); + DatatypeBase nonNegativeIntegerType = restrictMin(integerType, "0"); + typeTable.put("nonNegativeInteger", nonNegativeIntegerType); + typeTable.put("unsignedLong", restrictMax(nonNegativeIntegerType, UNSIGNED_LONG_MAX)); + typeTable.put("unsignedInt", restrictMax(nonNegativeIntegerType, UNSIGNED_INT_MAX)); + typeTable.put("unsignedShort", restrictMax(nonNegativeIntegerType, UNSIGNED_SHORT_MAX)); + typeTable.put("unsignedByte", restrictMax(nonNegativeIntegerType, UNSIGNED_BYTE_MAX)); + typeTable.put("positiveInteger", restrictMin(integerType, "1")); + typeTable.put("double", new DoubleDatatype()); + typeTable.put("float", new FloatDatatype()); + + typeTable.put("Name", new NameDatatype()); + typeTable.put("QName", new QNameDatatype()); + + DatatypeBase ncNameType = new NCNameDatatype(); + typeTable.put("NCName", ncNameType); + + DatatypeBase nmtokenDatatype = new NmtokenDatatype(); + typeTable.put("NMTOKEN", nmtokenDatatype); + typeTable.put("NMTOKENS", list(nmtokenDatatype)); + + typeTable.put("ID", new IdDatatype()); + DatatypeBase idrefType = new IdrefDatatype(); + typeTable.put("IDREF", idrefType); + typeTable.put("IDREFS", list(idrefType)); + + typeTable.put("NOTATION", new QNameDatatype()); + + typeTable.put("base64Binary", new Base64BinaryDatatype()); + typeTable.put("hexBinary", new HexBinaryDatatype()); + typeTable.put("anyURI", new AnyUriDatatype()); + typeTable.put("language", new RegexDatatype(LANGUAGE_PATTERN)); + + typeTable.put("dateTime", new DateTimeDatatype("Y-M-DTt")); + typeTable.put("time", new DateTimeDatatype("t")); + typeTable.put("date", new DateTimeDatatype("Y-M-D")); + typeTable.put("gYearMonth", new DateTimeDatatype("Y-M")); + typeTable.put("gYear", new DateTimeDatatype("Y")); + typeTable.put("gMonthDay", new DateTimeDatatype("--M-D")); + typeTable.put("gDay", new DateTimeDatatype("---D")); + typeTable.put("gMonth", new DateTimeDatatype("--M")); + + DatatypeBase entityType = new EntityDatatype(); + typeTable.put("ENTITY", entityType); + typeTable.put("ENTITIES", list(entityType)); + // Partially implemented + typeTable.put("duration", new DurationDatatype()); + } + + public DatatypeBuilder createDatatypeBuilder(String localName) throws DatatypeException { + DatatypeBase base = (DatatypeBase)typeTable.get(localName); + if (base == null) + throw new DatatypeException(); + if (base instanceof RegexDatatype) { + try { + ((RegexDatatype)base).compile(getRegexEngine()); + } + catch (RegexSyntaxException e) { + throw new DatatypeException(DatatypeBuilderImpl.localizer.message("regex_internal_error", localName)); + } + } + return new DatatypeBuilderImpl(this, base); + } + + RegexEngine getRegexEngine() throws DatatypeException { + if (regexEngine == null) + throw new DatatypeException(DatatypeBuilderImpl.localizer.message("regex_impl_not_found")); + return regexEngine; + } + + private static DatatypeBase restrictMax(DatatypeBase base, String limit) { + return new MaxInclusiveRestrictDatatype(base, base.getValue(limit, null)); + } + + private static DatatypeBase restrictMin(DatatypeBase base, String limit) { + return new MinInclusiveRestrictDatatype(base, base.getValue(limit, null)); + } + + private static DatatypeBase list(DatatypeBase base) { + return new MinLengthRestrictDatatype(new ListDatatype(base), 1); + } + + private static RegexEngine findRegexEngine() { + Enumeration e = new Service(RegexEngine.class).getProviders(); + if (!e.hasMoreElements()) + return null; + return (RegexEngine)e.nextElement(); + } + + public Datatype createDatatype(String type) throws DatatypeException { + return createDatatypeBuilder(type).createDatatype(); + } + + static public void main(String[] args) throws DatatypeException { + System.err.println(new DatatypeLibraryImpl().createDatatype(args[0]).isValid(args[1], null) + ? "valid" + : "invalid"); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DateTimeDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DateTimeDatatype.java new file mode 100644 index 0000000..8a6ad04 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DateTimeDatatype.java @@ -0,0 +1,312 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +class DateTimeDatatype extends RegexDatatype implements OrderRelation { + static private final String YEAR_PATTERN = "-?([1-9][0-9]*)?[0-9]{4}"; + static private final String MONTH_PATTERN = "[0-9]{2}"; + static private final String DAY_OF_MONTH_PATTERN = "[0-9]{2}"; + static private final String TIME_PATTERN = "[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]*)?"; + static private final String TZ_PATTERN = "(Z|[+\\-][0-9][0-9]:[0-5][0-9])?"; + + private final String template; + + /** + * The argument specifies the lexical representation accepted: + * Y specifies a year with optional preceding minus + * M specifies a two digit month + * D specifies a two digit day of month + * t specifies a time (hh:mm:ss.sss) + * any other character stands for itself. + * All lexical representations are implicitly followed by an optional time zone. + */ + DateTimeDatatype(String template) { + super(makePattern(template)); + this.template = template; + } + + static private String makePattern(String template) { + StringBuffer pattern = new StringBuffer(); + for (int i = 0, len = template.length(); i < len; i++) { + char c = template.charAt(i); + switch (c) { + case 'Y': + pattern.append(YEAR_PATTERN); + break; + case 'M': + pattern.append(MONTH_PATTERN); + break; + case 'D': + pattern.append(DAY_OF_MONTH_PATTERN); + break; + case 't': + pattern.append(TIME_PATTERN); + break; + default: + pattern.append(c); + break; + } + } + pattern.append(TZ_PATTERN); + return pattern.toString(); + } + + boolean allowsValue(String str, ValidationContext vc) { + return getValue(str, vc) != null; + } + + static private class DateTime { + private final Date date; + private final int leapMilliseconds; + private final boolean hasTimeZone; + + DateTime(Date date, int leapMilliseconds, boolean hasTimeZone) { + this.date = date; + this.leapMilliseconds = leapMilliseconds; + this.hasTimeZone = hasTimeZone; + } + + public boolean equals(Object obj) { + if (!(obj instanceof DateTime)) + return false; + DateTime other = (DateTime)obj; + return (this.date.equals(other.date) + && this.leapMilliseconds == other.leapMilliseconds + && this.hasTimeZone == other.hasTimeZone); + } + + public int hashCode() { + return date.hashCode(); + } + + Date getDate() { + return date; + } + + int getLeapMilliseconds() { + return leapMilliseconds; + } + + boolean getHasTimeZone() { + return hasTimeZone; + } + } + + // XXX Check leap second validity? + // XXX Allow 24:00:00? + Object getValue(String str, ValidationContext vc) { + boolean negative = false; + int year = 2000; // any leap year will do + int month = 1; + int day = 1; + int hours = 0; + int minutes = 0; + int seconds = 0; + int milliseconds = 0; + int pos = 0; + int len = str.length(); + for (int templateIndex = 0, templateLength = template.length(); + templateIndex < templateLength; + templateIndex++) { + char templateChar = template.charAt(templateIndex); + switch (templateChar) { + case 'Y': + negative = str.charAt(pos) == '-'; + int yearStartIndex = negative ? pos + 1 : pos; + pos = skipDigits(str, yearStartIndex); + try { + year = Integer.parseInt(str.substring(yearStartIndex, pos)); + } + catch (NumberFormatException e) { + return null; + } + break; + case 'M': + month = parse2Digits(str, pos); + pos += 2; + break; + case 'D': + day = parse2Digits(str, pos); + pos += 2; + break; + case 't': + hours = parse2Digits(str, pos); + pos += 3; + minutes = parse2Digits(str, pos); + pos += 3; + seconds = parse2Digits(str, pos); + pos += 2; + if (pos < len && str.charAt(pos) == '.') { + int end = skipDigits(str, ++pos); + for (int j = 0; j < 3; j++) { + milliseconds *= 10; + if (pos < end) + milliseconds += str.charAt(pos++) - '0'; + } + pos = end; + } + break; + default: + pos++; + break; + } + } + boolean hasTimeZone = pos < len; + int tzOffset; + if (hasTimeZone && str.charAt(pos) != 'Z') + tzOffset = parseTimeZone(str, pos); + else + tzOffset = 0; + int leapMilliseconds; + if (seconds == 60) { + leapMilliseconds = milliseconds + 1; + milliseconds = 999; + seconds = 59; + } + else + leapMilliseconds = 0; + try { + GregorianCalendar cal = CalendarFactory.getCalendar(); + Date date; + if (cal == CalendarFactory.cal) { + synchronized (cal) { + date = createDate(cal, tzOffset, negative, year, month, day, hours, minutes, seconds, milliseconds); + } + } + else + date = createDate(cal, tzOffset, negative, year, month, day, hours, minutes, seconds, milliseconds); + return new DateTime(date, leapMilliseconds, hasTimeZone); + } + catch (IllegalArgumentException e) { + return null; + } + } + + // The GregorianCalendar constructor is incredibly slow with some + // versions of GCJ (specifically the version shipped with RedHat 9). + // This code attempts to detect when construction is slow. + // When it is, we synchronize access to a single + // object; otherwise, we create a new object each time we need it + // so as to avoid thread lock contention. + + static class CalendarFactory { + static private final int UNKNOWN = -1; + static private final int SLOW = 0; + static private final int FAST = 1; + static private final int LIMIT = 10; + static private int speed = UNKNOWN; + static GregorianCalendar cal = new GregorianCalendar(); + + static GregorianCalendar getCalendar() { + // Don't need to synchronize this because speed is atomic. + switch (speed) { + case SLOW: + return cal; + case FAST: + return new GregorianCalendar(); + } + // Note that we are not timing the first construction (which happens + // at class initialization), since that may involve one-time cache + // initialization. + long start = System.currentTimeMillis(); + GregorianCalendar tem = new GregorianCalendar(); + long time = System.currentTimeMillis() - start; + speed = time > LIMIT ? SLOW : FAST; + return tem; + } + } + + private static Date createDate(GregorianCalendar cal, int tzOffset, boolean negative, + int year, int month, int day, + int hours, int minutes, int seconds, int milliseconds) { + cal.setLenient(false); + cal.setGregorianChange(new Date(Long.MIN_VALUE)); + cal.clear(); + // Using a time zone of "GMT+XX:YY" doesn't work with JDK 1.1, so we have to do it like this. + cal.set(Calendar.ZONE_OFFSET, tzOffset); + cal.set(Calendar.DST_OFFSET, 0); + cal.set(Calendar.ERA, negative ? GregorianCalendar.BC : GregorianCalendar.AD); + // months in ISO8601 start with 1; months in Java start with 0 + month -= 1; + cal.set(year, month, day, hours, minutes, seconds); + cal.set(Calendar.MILLISECOND, milliseconds); + checkDate(cal.isLeapYear(year), month, day); // for GCJ + return cal.getTime(); + } + + static private void checkDate(boolean isLeapYear, int month, int day) { + if (month < 0 || month > 11 || day < 1) + throw new IllegalArgumentException(); + int dayMax; + switch (month) { + // Thirty days have September, April, June and November... + case Calendar.SEPTEMBER: + case Calendar.APRIL: + case Calendar.JUNE: + case Calendar.NOVEMBER: + dayMax = 30; + break; + case Calendar.FEBRUARY: + dayMax = isLeapYear ? 29 : 28; + break; + default: + dayMax = 31; + break; + } + if (day > dayMax) + throw new IllegalArgumentException(); + } + + static private int parseTimeZone(String str, int i) { + int sign = str.charAt(i) == '-' ? -1 : 1; + return (Integer.parseInt(str.substring(i + 1, i + 3))*60 + Integer.parseInt(str.substring(i + 4)))*60*1000*sign; + } + + static private int parse2Digits(String str, int i) { + return (str.charAt(i) - '0')*10 + (str.charAt(i + 1) - '0'); + } + + static private int skipDigits(String str, int i) { + for (int len = str.length(); i < len; i++) { + if ("0123456789".indexOf(str.charAt(i)) < 0) + break; + } + return i; + } + + OrderRelation getOrderRelation() { + return this; + } + + static private final int TIME_ZONE_MAX = 14*60*60*1000; + + public boolean isLessThan(Object obj1, Object obj2) { + DateTime dt1 = (DateTime)obj1; + DateTime dt2 = (DateTime)obj2; + long t1 = dt1.getDate().getTime(); + long t2 = dt2.getDate().getTime(); + if (dt1.getHasTimeZone() == dt2.getHasTimeZone()) + return isLessThan(t1, + dt1.getLeapMilliseconds(), + t2, + dt2.getLeapMilliseconds()); + else if (!dt2.getHasTimeZone()) + return isLessThan(t1, dt1.getLeapMilliseconds(), t2 - TIME_ZONE_MAX, dt2.getLeapMilliseconds()); + else + return isLessThan(t1 + TIME_ZONE_MAX, dt1.getLeapMilliseconds(), t2, dt2.getLeapMilliseconds()); + } + + static private boolean isLessThan(long t1, int leapMillis1, long t2, int leapMillis2) { + if (t1 < t2) + return true; + if (t1 > t2) + return false; + if (leapMillis1 < leapMillis2) + return true; + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DecimalDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DecimalDatatype.java new file mode 100644 index 0000000..0143586 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DecimalDatatype.java @@ -0,0 +1,79 @@ +package com.thaiopensource.datatype.xsd; + +import java.math.BigDecimal; + +import org.relaxng.datatype.ValidationContext; + +class DecimalDatatype extends DatatypeBase implements OrderRelation { + + boolean lexicallyAllows(String str) { + int len = str.length(); + if (len == 0) + return false; + int i = 0; + switch (str.charAt(i)) { + case '+': + case '-': + if (++i == len) + return false; + } + boolean hadDecimalPoint = false; + if (str.charAt(i) == '.') { + hadDecimalPoint = true; + if (++i == len) + return false; + } + do { + switch (str.charAt(i)) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + break; + case '.': + if (hadDecimalPoint) + return false; + hadDecimalPoint = true; + break; + default: + return false; + } + } while (++i < len); + return true; + } + + Object getValue(String str, ValidationContext vc) { + if (str.charAt(0) == '+') + str = str.substring(1); // JDK 1.1 doesn't handle leading + + return new BigDecimal(str); + } + + OrderRelation getOrderRelation() { + return this; + } + + public boolean isLessThan(Object obj1, Object obj2) { + return ((BigDecimal)obj1).compareTo((BigDecimal)obj2) < 0; + } + + /** + * BigDecimal.equals considers objects distinct if they have the + * different scales but the same mathematical value. Similarly + * for hashCode. + */ + + public boolean sameValue(Object value1, Object value2) { + return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0; + } + + public int valueHashCode(Object value) { + return ((BigDecimal)value).toBigInteger().hashCode(); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DoubleDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DoubleDatatype.java new file mode 100644 index 0000000..055a964 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DoubleDatatype.java @@ -0,0 +1,80 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class DoubleDatatype extends DatatypeBase implements OrderRelation { + + boolean lexicallyAllows(String str) { + if (str.equals("INF") || str.equals("-INF") || str.equals("NaN")) + return true; + int len = str.length(); + boolean hadSign = false; + boolean hadDecimalPoint = false; + boolean hadDigit = false; + boolean hadE = false; + for (int i = 0; i < len; i++) { + switch (str.charAt(i)) { + case '+': + case '-': + if (hadDigit || hadDecimalPoint || hadSign) + return false; + hadSign = true; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + hadDigit = true; + break; + case 'e': + case 'E': + if (hadE || !hadDigit) + return false; + hadDigit = false; + hadE = true; + hadSign = false; + hadDecimalPoint = false; + break; + case '.': + if (hadDecimalPoint || hadE) + return false; + hadDecimalPoint = true; + break; + default: + return false; + } + } + return hadDigit; + } + + Object getValue(String str, ValidationContext vc) { + if (str.equals("INF")) + return new Double(Double.POSITIVE_INFINITY); + if (str.equals("-INF")) + return new Double(Double.NEGATIVE_INFINITY); + if (str.equals("NaN")) + return new Double(Double.NaN); + return new Double(str); + } + + OrderRelation getOrderRelation() { + return this; + } + + public boolean isLessThan(Object obj1, Object obj2) { + return ((Double)obj1).doubleValue() < ((Double)obj2).doubleValue(); + } + + public boolean sameValue(Object value1, Object value2) { + double d1 = ((Double)value1).doubleValue(); + double d2 = ((Double)value2).doubleValue(); + // NaN = NaN + return d1 == d2 || (d1 != d1 && d2 != d2); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DurationDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DurationDatatype.java new file mode 100644 index 0000000..a13cbbe --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/DurationDatatype.java @@ -0,0 +1,243 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +import java.math.BigInteger; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.GregorianCalendar; + +class DurationDatatype extends RegexDatatype implements OrderRelation { + static private final String PATTERN = + "-?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?(([0-9]+(\\.[0-9]*)?|\\.[0-9]+)S)?)?"; + + DurationDatatype() { + super(PATTERN); + } + + public boolean lexicallyAllows(String str) { + if (!super.lexicallyAllows(str)) + return false; + char last = str.charAt(str.length()-1); + // This enforces that there must be at least one component + // and that T is omitted if all time components are omitted + return last != 'P' && last != 'T'; + } + + static private class Duration { + private final BigInteger years; + private final BigInteger months; + private final BigInteger days; + private final BigInteger hours; + private final BigInteger minutes; + private final BigDecimal seconds; + + Duration(boolean negative, + BigInteger years, BigInteger months, BigInteger days, + BigInteger hours, BigInteger minutes, BigDecimal seconds) { + if (negative) { + this.years = years.negate(); + this.months = months.negate(); + this.days = days.negate(); + this.hours = hours.negate(); + this.minutes = minutes.negate(); + this.seconds = seconds.negate(); + } + else { + this.years = years; + this.months = months; + this.days = days; + this.hours = hours; + this.minutes = minutes; + this.seconds = seconds; + } + } + + BigInteger getYears() { + return years; + } + + BigInteger getMonths() { + return months; + } + + BigInteger getDays() { + return days; + } + + BigInteger getHours() { + return hours; + } + + BigInteger getMinutes() { + return minutes; + } + + BigDecimal getSeconds() { + return seconds; + } + + public boolean equals(Object obj) { + if (!(obj instanceof Duration)) + return false; + Duration other = (Duration)obj; + return (this.years.equals(other.years) + && this.months.equals(other.months) + && this.days.equals(other.days) + && this.hours.equals(other.hours) + && this.minutes.equals(other.minutes) + && this.seconds.compareTo(other.seconds) == 0); + } + + public int hashCode() { + return (years.hashCode() + ^ months.hashCode() + ^ days.hashCode() + ^ hours.hashCode() + ^ minutes.hashCode() + ^ seconds.hashCode()); + } + } + + Object getValue(String str, ValidationContext vc) { + int t = str.indexOf('T'); + if (t < 0) + t = str.length(); + String date = str.substring(0, t); + String time = str.substring(t); + return new Duration(str.charAt(0) == '-', + getIntegerField(date, 'Y'), + getIntegerField(date, 'M'), + getIntegerField(date, 'D'), + getIntegerField(time, 'H'), + getIntegerField(time, 'M'), + getDecimalField(time, 'S')); + + } + + static private BigInteger getIntegerField(String str, char code) { + int end = str.indexOf(code); + if (end < 0) + return BigInteger.valueOf(0); + int start = end; + while (Character.isDigit(str.charAt(start - 1))) + --start; + return new BigInteger(str.substring(start, end)); + } + + static private BigDecimal getDecimalField(String str, char code) { + int end = str.indexOf(code); + if (end < 0) + return BigDecimal.valueOf(0); + int start = end; + while (!Character.isLetter(str.charAt(start - 1))) + --start; + return new BigDecimal(str.substring(start, end)); + } + + OrderRelation getOrderRelation() { + return this; + } + + private static final int[] REF_YEAR_MONTHS = { 1696, 9, 1697, 2, 1903, 3, 1903, 7 }; + + public boolean isLessThan(Object obj1, Object obj2) { + Duration d1 = (Duration)obj1; + Duration d2 = (Duration)obj2; + BigInteger months1 = computeMonths(d1); + BigInteger months2 = computeMonths(d2); + BigDecimal seconds1 = computeSeconds(d1); + BigDecimal seconds2 = computeSeconds(d2); + switch (months1.compareTo(months2)) { + case -1: + if (seconds1.compareTo(seconds2) <= 0) + return true; + break; + case 0: + return seconds1.compareTo(seconds2) < 0; + case 1: + if (seconds1.compareTo(seconds2) >= 0) + return false; + break; + } + for (int i = 0; i < REF_YEAR_MONTHS.length; i += 2) { + BigDecimal total1 = daysPlusSeconds(computeDays(months1, REF_YEAR_MONTHS[i], REF_YEAR_MONTHS[i + 1]), seconds1); + BigDecimal total2 = daysPlusSeconds(computeDays(months2, REF_YEAR_MONTHS[i], REF_YEAR_MONTHS[i + 1]), seconds2); + if (total1.compareTo(total2) >= 0) + return false; + } + return true; + } + + /** + * Returns the number of days spanned by a period of months starting with a particular + * reference year and month. + */ + private static BigInteger computeDays(BigInteger months, int refYear, int refMonth) { + switch (months.signum()) { + case 0: + return BigInteger.valueOf(0); + case -1: + return computeDays(months.negate(), refYear, refMonth).negate(); + } + // Complete cycle of Gregorian calendar is 400 years + BigInteger[] tem = months.divideAndRemainder(BigInteger.valueOf(400*12)); + --refMonth; // use 0 base to match Java + int total = 0; + for (int rem = tem[1].intValue(); rem > 0; rem--) { + total += daysInMonth(refYear, refMonth); + if (++refMonth == 12) { + refMonth = 0; + refYear++; + } + } + // In the Gregorian calendar, there are 97 (= 100 + 4 - 1) leap years every 400 years. + return tem[0].multiply(BigInteger.valueOf(365*400 + 97)).add(BigInteger.valueOf(total)); + } + + private static int daysInMonth(int year, int month) { + switch (month) { + case Calendar.SEPTEMBER: + case Calendar.APRIL: + case Calendar.JUNE: + case Calendar.NOVEMBER: + return 30; + case Calendar.FEBRUARY: + return isLeapYear(year) ? 29 : 28; + } + return 31; + } + + private static boolean isLeapYear(int year) { + return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0; + } + + /** + * Returns the total number of seconds from a specified number of days and seconds. + */ + private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) { + return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60)))); + } + + /** + * Returns the total number of months specified by the year and month fields of the duration + */ + private static BigInteger computeMonths(Duration d) { + return d.getYears().multiply(BigInteger.valueOf(12)).add(d.getMonths()); + } + + /** + * Returns the total number of seconds specified by the days, hours, minuts and seconds fields of + * the duration. + */ + private static BigDecimal computeSeconds(Duration d) { + return d.getSeconds().add(new BigDecimal(d.getDays().multiply(BigInteger.valueOf(24)) + .add(d.getHours()).multiply(BigInteger.valueOf(60)) + .add(d.getMinutes()).multiply(BigInteger.valueOf(60)))); + } + + public static void main(String[] args) { + DurationDatatype dt = new DurationDatatype(); + System.err.println(dt.isLessThan(dt.getValue(args[0], null), dt.getValue(args[1], null))); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/EntityDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/EntityDatatype.java new file mode 100644 index 0000000..0736c55 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/EntityDatatype.java @@ -0,0 +1,15 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class EntityDatatype extends NCNameDatatype { + boolean allowsValue(String str, ValidationContext vc) { + return vc.isUnparsedEntity(str); + } + + Object getValue(String str, ValidationContext vc) { + if (!allowsValue(str, vc)) + return null; + return super.getValue(str, vc); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/FloatDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/FloatDatatype.java new file mode 100644 index 0000000..e26f8cd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/FloatDatatype.java @@ -0,0 +1,27 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class FloatDatatype extends DoubleDatatype { + + Object getValue(String str, ValidationContext vc) { + if (str.equals("INF")) + return new Float(Float.POSITIVE_INFINITY); + if (str.equals("-INF")) + return new Float(Float.NEGATIVE_INFINITY); + if (str.equals("NaN")) + return new Float(Float.NaN); + return new Float(str); + } + + public boolean isLessThan(Object obj1, Object obj2) { + return ((Float)obj1).floatValue() < ((Float)obj2).floatValue(); + } + + public boolean sameValue(Object value1, Object value2) { + float f1 = ((Float)value1).floatValue(); + float f2 = ((Float)value2).floatValue(); + // NaN = NaN + return f1 == f2 || (f1 != f1 && f2 != f2); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/HexBinaryDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/HexBinaryDatatype.java new file mode 100644 index 0000000..603ccc1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/HexBinaryDatatype.java @@ -0,0 +1,53 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class HexBinaryDatatype extends BinaryDatatype { + static private final int INVALID = -1; + static private final int WHITESPACE = -2; + + boolean lexicallyAllows(String str) { + int len = str.length(); + int i = 0; + while (i < len && weight(str.charAt(i)) == WHITESPACE) + i++; + while (i + 1 < len && weight(str.charAt(i)) >= 0 && weight(str.charAt(i + 1)) >= 0) + i += 2; + while (i < len && weight(str.charAt(i)) == WHITESPACE) + i++; + return i == len; + } + + Object getValue(String str, ValidationContext vc) { + int len = str.length(); + int start = 0; + while (start < len && weight(str.charAt(start)) == WHITESPACE) + start++; + int end = len; + while (end > start && weight(str.charAt(end - 1)) == WHITESPACE) + end--; + byte[] value = new byte[(end - start) >> 1]; + int j = 0; + for (int i = start; i < end; i += 2, j++) + value[j] = (byte)((weight(str.charAt(i)) << 4) | weight(str.charAt(i + 1))); + return value; + } + + static private int weight(char c) { + switch (c) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + return c - '0'; + case 'A': case 'B': case 'C': + case 'D': case 'E': case 'F': + return c + (10 - 'A'); + case 'a': case 'b': case 'c': + case 'd': case 'e': case 'f': + return c + (10 - 'a'); + case ' ': case '\n': case '\r': case '\t': + return WHITESPACE; + } + return INVALID; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdDatatype.java new file mode 100644 index 0000000..290b210 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdDatatype.java @@ -0,0 +1,7 @@ +package com.thaiopensource.datatype.xsd; + +class IdDatatype extends NCNameDatatype { + public int getIdType() { + return ID_TYPE_ID; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdrefDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdrefDatatype.java new file mode 100644 index 0000000..fc2a554 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IdrefDatatype.java @@ -0,0 +1,7 @@ +package com.thaiopensource.datatype.xsd; + +class IdrefDatatype extends NCNameDatatype { + public int getIdType() { + return ID_TYPE_IDREF; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.java new file mode 100644 index 0000000..20ba6a9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/IntegerRestrictDatatype.java @@ -0,0 +1,11 @@ +package com.thaiopensource.datatype.xsd; + +class IntegerRestrictDatatype extends ScaleRestrictDatatype { + IntegerRestrictDatatype(DatatypeBase base) { + super(base, 0); + } + + boolean lexicallyAllows(String str) { + return super.lexicallyAllows(str) && str.charAt(str.length() - 1) != '.'; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.java new file mode 100644 index 0000000..4921557 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/LengthRestrictDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +class LengthRestrictDatatype extends ValueRestrictDatatype { + private final int length; + private final Measure measure; + + LengthRestrictDatatype(DatatypeBase base, int length) { + super(base); + this.measure = base.getMeasure(); + this.length = length; + } + + boolean satisfiesRestriction(Object obj) { + return measure.getLength(obj) == length; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ListDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ListDatatype.java new file mode 100644 index 0000000..49b1b1c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ListDatatype.java @@ -0,0 +1,77 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; +import com.thaiopensource.xml.util.StringSplitter; + +class ListDatatype extends DatatypeBase implements Measure { + private final DatatypeBase itemType; + + ListDatatype(DatatypeBase itemType) { + this.itemType = itemType; + } + + Object getValue(String str, ValidationContext vc) { + String[] tokens = StringSplitter.split(str); + Object[] items = new Object[tokens.length]; + for (int i = 0; i < items.length; i++) { + items[i] = itemType.getValue(tokens[i], vc); + if (items[i] == null) + return null; + } + return items; + } + + boolean lexicallyAllows(String str) { + String[] tokens = StringSplitter.split(str); + for (int i = 0; i < tokens.length; i++) + if (!itemType.lexicallyAllows(tokens[i])) + return false; + return true; + } + + boolean allowsValue(String str, ValidationContext vc) { + String[] tokens = StringSplitter.split(str); + for (int i = 0; i < tokens.length; i++) + if (!itemType.allowsValue(tokens[i], vc)) + return false; + return true; + } + + Measure getMeasure() { + return this; + } + + public int getLength(Object obj) { + return ((Object[])obj).length; + } + + public boolean isContextDependent() { + return itemType.isContextDependent(); + } + + public int getIdType() { + if (itemType.getIdType() == ID_TYPE_IDREF) + return ID_TYPE_IDREFS; + else + return ID_TYPE_NULL; + } + + public int valueHashCode(Object obj) { + Object[] items = (Object[])obj; + int hc = 0; + for (int i = 0; i < items.length; i++) + hc ^= itemType.valueHashCode(items[i]); + return hc; + } + + public boolean sameValue(Object obj1, Object obj2) { + Object[] items1 = (Object[])obj1; + Object[] items2 = (Object[])obj2; + if (items1.length != items2.length) + return false; + for (int i = 0; i < items1.length; i++) + if (!itemType.sameValue(items1[i], items2[i])) + return false; + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.java new file mode 100644 index 0000000..b1a113d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxExclusiveRestrictDatatype.java @@ -0,0 +1,18 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class MaxExclusiveRestrictDatatype extends ValueRestrictDatatype { + private final OrderRelation order; + private final Object limit; + + MaxExclusiveRestrictDatatype(DatatypeBase base, Object limit) { + super(base); + this.order = base.getOrderRelation(); + this.limit = limit; + } + + boolean satisfiesRestriction(Object value) { + return order.isLessThan(value, limit); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.java new file mode 100644 index 0000000..2fe0ebf --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxInclusiveRestrictDatatype.java @@ -0,0 +1,18 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class MaxInclusiveRestrictDatatype extends ValueRestrictDatatype { + private final OrderRelation order; + private final Object limit; + + MaxInclusiveRestrictDatatype(DatatypeBase base, Object limit) { + super(base); + this.order = base.getOrderRelation(); + this.limit = limit; + } + + boolean satisfiesRestriction(Object value) { + return order.isLessThan(value, limit) || super.sameValue(value, limit); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.java new file mode 100644 index 0000000..4290521 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MaxLengthRestrictDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +class MaxLengthRestrictDatatype extends ValueRestrictDatatype { + private final int length; + private final Measure measure; + + MaxLengthRestrictDatatype(DatatypeBase base, int length) { + super(base); + this.measure = base.getMeasure(); + this.length = length; + } + + boolean satisfiesRestriction(Object obj) { + return measure.getLength(obj) <= length; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Measure.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Measure.java new file mode 100644 index 0000000..10c31fc --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/Measure.java @@ -0,0 +1,5 @@ +package com.thaiopensource.datatype.xsd; + +interface Measure { + int getLength(Object obj); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.java new file mode 100644 index 0000000..3a9e19c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinExclusiveRestrictDatatype.java @@ -0,0 +1,18 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class MinExclusiveRestrictDatatype extends ValueRestrictDatatype { + private final OrderRelation order; + private final Object limit; + + MinExclusiveRestrictDatatype(DatatypeBase base, Object limit) { + super(base); + this.order = base.getOrderRelation(); + this.limit = limit; + } + + boolean satisfiesRestriction(Object value) { + return order.isLessThan(limit, value); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.java new file mode 100644 index 0000000..d92a5b3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinInclusiveRestrictDatatype.java @@ -0,0 +1,18 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class MinInclusiveRestrictDatatype extends ValueRestrictDatatype { + private final OrderRelation order; + private final Object limit; + + MinInclusiveRestrictDatatype(DatatypeBase base, Object limit) { + super(base); + this.order = base.getOrderRelation(); + this.limit = limit; + } + + boolean satisfiesRestriction(Object value) { + return order.isLessThan(limit, value) || super.sameValue(value, limit); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.java new file mode 100644 index 0000000..d185bd3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/MinLengthRestrictDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +class MinLengthRestrictDatatype extends ValueRestrictDatatype { + private final int length; + private final Measure measure; + + MinLengthRestrictDatatype(DatatypeBase base, int length) { + super(base); + this.measure = base.getMeasure(); + this.length = length; + } + + boolean satisfiesRestriction(Object obj) { + return measure.getLength(obj) >= length; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NCNameDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NCNameDatatype.java new file mode 100644 index 0000000..c6d3524 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NCNameDatatype.java @@ -0,0 +1,9 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.xml.util.Naming; + +class NCNameDatatype extends NameDatatype { + public boolean lexicallyAllows(String str) { + return Naming.isNcname(str); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NameDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NameDatatype.java new file mode 100644 index 0000000..45ee8fe --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NameDatatype.java @@ -0,0 +1,17 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.xml.util.Naming; + +class NameDatatype extends TokenDatatype { + public boolean lexicallyAllows(String str) { + return Naming.isName(str); + } + public int getLength(Object obj) { + // Surrogates are not possible in an Name. + return ((String)obj).length(); + } + + public boolean alwaysValid() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NmtokenDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NmtokenDatatype.java new file mode 100644 index 0000000..86f6dc9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/NmtokenDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.xml.util.Naming; + +class NmtokenDatatype extends TokenDatatype { + public boolean lexicallyAllows(String str) { + return Naming.isNmtoken(str); + } + public int getLength(Object obj) { + // Surrogates are not possible in an NMTOKEN. + return ((String)obj).length(); + } + public boolean alwaysValid() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/OrderRelation.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/OrderRelation.java new file mode 100644 index 0000000..55f0944 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/OrderRelation.java @@ -0,0 +1,5 @@ +package com.thaiopensource.datatype.xsd; + +interface OrderRelation { + boolean isLessThan(Object obj1, Object obj2); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.java new file mode 100644 index 0000000..9e64a3e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PatternRestrictDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.datatype.xsd.regex.Regex; + +class PatternRestrictDatatype extends RestrictDatatype { + private final Regex pattern; + + PatternRestrictDatatype(DatatypeBase base, Regex pattern) { + super(base); + this.pattern = pattern; + } + + boolean lexicallyAllows(String str) { + return pattern.matches(str) && super.lexicallyAllows(str); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.java new file mode 100644 index 0000000..c7085d5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/PrecisionRestrictDatatype.java @@ -0,0 +1,20 @@ +package com.thaiopensource.datatype.xsd; + +import java.math.BigDecimal; + +class PrecisionRestrictDatatype extends ValueRestrictDatatype { + private final int precision; + + PrecisionRestrictDatatype(DatatypeBase base, int precision) { + super(base); + this.precision = precision; + } + + boolean satisfiesRestriction(Object obj) { + return getPrecision((BigDecimal)obj) <= precision; + } + + static int getPrecision(BigDecimal n) { + return n.movePointRight(n.scale()).abs().toString().length(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/QNameDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/QNameDatatype.java new file mode 100644 index 0000000..54b8e8b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/QNameDatatype.java @@ -0,0 +1,54 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; +import com.thaiopensource.xml.util.Naming; + +class QNameDatatype extends DatatypeBase { + public boolean lexicallyAllows(String str) { + return Naming.isQname(str); + } + + static class QName { + private final String namespaceURI; + private final String localName; + QName(String namespaceURI, String localName) { + this.namespaceURI = namespaceURI; + this.localName = localName; + } + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof QName)) + return false; + QName other = (QName)obj; + return namespaceURI.equals(other.namespaceURI) && localName.equals(other.localName); + } + public int hashCode() { + return localName.hashCode() ^ namespaceURI.hashCode(); + } + } + + Object getValue(String str, ValidationContext vc) { + int i = str.indexOf(':'); + if (i < 0) { + String ns = vc.resolveNamespacePrefix(""); + if (ns == null) + ns = ""; + return new QName(ns, str); + } + else { + String prefix = str.substring(0, i); + String ns = vc.resolveNamespacePrefix(prefix); + if (ns == null) + return null; + return new QName(ns, str.substring(i + 1)); + } + } + + boolean allowsValue(String str, ValidationContext vc) { + int i = str.indexOf(':'); + return i < 0 || vc.resolveNamespacePrefix(str.substring(0, i)) != null; + } + + public boolean isContextDependent() { + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RegexDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RegexDatatype.java new file mode 100644 index 0000000..2f40be5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RegexDatatype.java @@ -0,0 +1,27 @@ +package com.thaiopensource.datatype.xsd; + +import com.thaiopensource.datatype.xsd.regex.Regex; +import com.thaiopensource.datatype.xsd.regex.RegexEngine; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; + +class RegexDatatype extends TokenDatatype { + private final String pattern; + private Regex regex; + + RegexDatatype(String pattern) { + this.pattern = pattern; + } + + synchronized void compile(RegexEngine engine) throws RegexSyntaxException { + if (regex == null) + regex = engine.compile(pattern); + } + + public boolean lexicallyAllows(String str) { + return regex.matches(str); + } + + public boolean alwaysValid() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RestrictDatatype.java new file mode 100644 index 0000000..53e1d43 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/RestrictDatatype.java @@ -0,0 +1,52 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +class RestrictDatatype extends DatatypeBase { + protected final DatatypeBase base; + + RestrictDatatype(DatatypeBase base) { + this(base, base.getWhiteSpace()); + } + + RestrictDatatype(DatatypeBase base, int whiteSpace) { + super(whiteSpace); + this.base = base; + } + + boolean lexicallyAllows(String str) { + return base.lexicallyAllows(str); + } + + boolean allowsValue(String str, ValidationContext vc) { + return base.allowsValue(str, vc); + } + + OrderRelation getOrderRelation() { + return base.getOrderRelation(); + } + + Measure getMeasure() { + return base.getMeasure(); + } + + Object getValue(String str, ValidationContext vc) { + return base.getValue(str, vc); + } + + DatatypeBase getPrimitive() { + return base.getPrimitive(); + } + + public int getIdType() { + return base.getIdType(); + } + + public boolean sameValue(Object value1, Object value2) { + return base.sameValue(value1, value2); + } + + public int valueHashCode(Object value) { + return base.valueHashCode(value); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.java new file mode 100644 index 0000000..d7956da --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ScaleRestrictDatatype.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd; + +import java.math.BigDecimal; + +class ScaleRestrictDatatype extends ValueRestrictDatatype { + private final int scale; + + ScaleRestrictDatatype(DatatypeBase base, int scale) { + super(base); + this.scale = scale; + } + + boolean satisfiesRestriction(Object obj) { + return ((BigDecimal)obj).scale() <= scale; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/StringDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/StringDatatype.java new file mode 100644 index 0000000..3753379 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/StringDatatype.java @@ -0,0 +1,7 @@ +package com.thaiopensource.datatype.xsd; + +class StringDatatype extends TokenDatatype { + StringDatatype() { + super(WHITE_SPACE_PRESERVE); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/TokenDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/TokenDatatype.java new file mode 100644 index 0000000..5fb1824 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/TokenDatatype.java @@ -0,0 +1,38 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; +import com.thaiopensource.util.Utf16; + +class TokenDatatype extends DatatypeBase implements Measure { + + TokenDatatype() { } + TokenDatatype(int whiteSpace) { + super(whiteSpace); + } + + public boolean lexicallyAllows(String str) { + return true; + } + + public boolean alwaysValid() { + return true; + } + + Object getValue(String str, ValidationContext vc) { + return str; + } + + Measure getMeasure() { + return this; + } + + public int getLength(Object obj) { + String str = (String)obj; + int len = str.length(); + int nSurrogatePairs = 0; + for (int i = 0; i < len; i++) + if (Utf16.isSurrogate1(str.charAt(i))) + nSurrogatePairs++; + return len - nSurrogatePairs; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.java new file mode 100644 index 0000000..dee7f09 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/ValueRestrictDatatype.java @@ -0,0 +1,22 @@ +package com.thaiopensource.datatype.xsd; + +import org.relaxng.datatype.ValidationContext; + +abstract class ValueRestrictDatatype extends RestrictDatatype { + ValueRestrictDatatype(DatatypeBase base) { + super(base); + } + + boolean allowsValue(String str, ValidationContext vc) { + return getValue(str, vc) != null; + } + + Object getValue(String str, ValidationContext vc) { + Object obj = base.getValue(str, vc); + if (obj == null || !satisfiesRestriction(obj)) + return null; + return obj; + } + + abstract boolean satisfiesRestriction(Object value); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/Regex.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/Regex.java new file mode 100644 index 0000000..60de4e5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/Regex.java @@ -0,0 +1,16 @@ +package com.thaiopensource.datatype.xsd.regex; + +/** + * A regular expression that can be matched against a string. + * @see RegexEngine + */ +public interface Regex { + /** + * Tests whether this regular expression matches a string. + * + * @param str the String to be tested + * @return true if str matches this regular expression, + * false otherwise + */ + boolean matches(String str); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexEngine.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexEngine.java new file mode 100644 index 0000000..2276b8f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexEngine.java @@ -0,0 +1,17 @@ +package com.thaiopensource.datatype.xsd.regex; + +/** + * A provider of a regular expression matching capability. + */ +public interface RegexEngine { + /** + * Compiles a string containing a regular expression into a Regex object. + * The Regex object can be used to test whether a string matches the regular + * expression. + * + * @param str a String containing a regular expression + * @return a Regex for str + * @throws RegexSyntaxException if str is not a valid regular expression + */ + Regex compile(String str) throws RegexSyntaxException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.java new file mode 100644 index 0000000..ec11b26 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/RegexSyntaxException.java @@ -0,0 +1,33 @@ +package com.thaiopensource.datatype.xsd.regex; + +/** + * Thrown when an syntactically incorrect regular expression is detected. + */ +public class RegexSyntaxException extends Exception { + private final int position; + + /** + * Represents an unknown position within a string containing a regular expression. + */ + static public final int UNKNOWN_POSITION = -1; + + public RegexSyntaxException(String detail) { + this(detail, UNKNOWN_POSITION); + } + + public RegexSyntaxException(String detail, int position) { + super(detail); + this.position = position; + } + + /** + * Returns the index into the regular expression where the error was detected + * or UNKNOWN_POSITION if this is unknown. + * + * @return the index into the regular expression where the error was detected, + * or UNKNOWNN_POSITION if this is unknown + */ + public int getPosition() { + return position; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.java new file mode 100644 index 0000000..2a4d51f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Categories.java @@ -0,0 +1,141 @@ +// This file was automatically generated by com.thaiopensource.datatype.xsd.regex.jdk1_4.gen.CategoriesGen +package com.thaiopensource.datatype.xsd.regex.jdk1_4; + +class Categories { + + static final String CATEGORY_NAMES = "NoLoMnCfLlNlLuMcNdSoSmCo"; + + static final int[][] CATEGORY_RANGES = { + { + // No + 0x10320, 0x10323 + }, + { + // Lo + 0x10300, 0x1031e, + 0x10330, 0x10349, + 0x20000, 0x2a6d6, + 0x2f800, 0x2fa1d + }, + { + // Mn + 0x1d167, 0x1d169, + 0x1d17b, 0x1d182, + 0x1d185, 0x1d18b, + 0x1d1aa, 0x1d1ad + }, + { + // Cf + 0x1d173, 0x1d17a, + 0xe0001, 0xe0001, + 0xe0020, 0xe007f + }, + { + // Ll + 0x10428, 0x1044d, + 0x1d41a, 0x1d433, + 0x1d44e, 0x1d454, + 0x1d456, 0x1d467, + 0x1d482, 0x1d49b, + 0x1d4b6, 0x1d4b9, + 0x1d4bb, 0x1d4bb, + 0x1d4bd, 0x1d4c0, + 0x1d4c2, 0x1d4c3, + 0x1d4c5, 0x1d4cf, + 0x1d4ea, 0x1d503, + 0x1d51e, 0x1d537, + 0x1d552, 0x1d56b, + 0x1d586, 0x1d59f, + 0x1d5ba, 0x1d5d3, + 0x1d5ee, 0x1d607, + 0x1d622, 0x1d63b, + 0x1d656, 0x1d66f, + 0x1d68a, 0x1d6a3, + 0x1d6c2, 0x1d6da, + 0x1d6dc, 0x1d6e1, + 0x1d6fc, 0x1d714, + 0x1d716, 0x1d71b, + 0x1d736, 0x1d74e, + 0x1d750, 0x1d755, + 0x1d770, 0x1d788, + 0x1d78a, 0x1d78f, + 0x1d7aa, 0x1d7c2, + 0x1d7c4, 0x1d7c9 + }, + { + // Nl + 0x1034a, 0x1034a + }, + { + // Lu + 0x10400, 0x10425, + 0x1d400, 0x1d419, + 0x1d434, 0x1d44d, + 0x1d468, 0x1d481, + 0x1d49c, 0x1d49c, + 0x1d49e, 0x1d49f, + 0x1d4a2, 0x1d4a2, + 0x1d4a5, 0x1d4a6, + 0x1d4a9, 0x1d4ac, + 0x1d4ae, 0x1d4b5, + 0x1d4d0, 0x1d4e9, + 0x1d504, 0x1d505, + 0x1d507, 0x1d50a, + 0x1d50d, 0x1d514, + 0x1d516, 0x1d51c, + 0x1d538, 0x1d539, + 0x1d53b, 0x1d53e, + 0x1d540, 0x1d544, + 0x1d546, 0x1d546, + 0x1d54a, 0x1d550, + 0x1d56c, 0x1d585, + 0x1d5a0, 0x1d5b9, + 0x1d5d4, 0x1d5ed, + 0x1d608, 0x1d621, + 0x1d63c, 0x1d655, + 0x1d670, 0x1d689, + 0x1d6a8, 0x1d6c0, + 0x1d6e2, 0x1d6fa, + 0x1d71c, 0x1d734, + 0x1d756, 0x1d76e, + 0x1d790, 0x1d7a8 + }, + { + // Mc + 0x1d165, 0x1d166, + 0x1d16d, 0x1d172 + }, + { + // Nd + 0x1d7ce, 0x1d7ff + }, + { + // So + 0x1d000, 0x1d0f5, + 0x1d100, 0x1d126, + 0x1d12a, 0x1d164, + 0x1d16a, 0x1d16c, + 0x1d183, 0x1d184, + 0x1d18c, 0x1d1a9, + 0x1d1ae, 0x1d1dd + }, + { + // Sm + 0x1d6c1, 0x1d6c1, + 0x1d6db, 0x1d6db, + 0x1d6fb, 0x1d6fb, + 0x1d715, 0x1d715, + 0x1d735, 0x1d735, + 0x1d74f, 0x1d74f, + 0x1d76f, 0x1d76f, + 0x1d789, 0x1d789, + 0x1d7a9, 0x1d7a9, + 0x1d7c3, 0x1d7c3 + }, + { + // Co + 0xf0000, 0xffffd, + 0x100000, 0x10fffd + } + }; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.java new file mode 100644 index 0000000..1f8bd69 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/NamingExceptions.java @@ -0,0 +1,46 @@ +// This file was automatically generated by com.thaiopensource.datatype.xsd.regex.jdk1_4.gen.NamingExceptionsGen +package com.thaiopensource.datatype.xsd.regex.jdk1_4; + +class NamingExceptions { + static final String NMSTRT_INCLUDES = + "\u003A\u005F\u02BB\u02BC\u02BD\u02BE\u02BF\u02C0\u02C1\u0559" + + "\u06E5\u06E6\u212E"; + static final String NMSTRT_EXCLUDE_RANGES = + "\u00AA\u00BA\u0132\u0133\u013F\u0140\u0149\u0149\u017F\u017F" + + "\u01C4\u01CC\u01F1\u01F3\u01F6\u01F9\u0218\u0233\u02A9\u02AD" + + "\u03D7\u03D7\u03DB\u03DB\u03DD\u03DD\u03DF\u03DF\u03E1\u03E1" + + "\u0400\u0400\u040D\u040D\u0450\u0450\u045D\u045D\u048C\u048F" + + "\u04EC\u04ED\u0587\u0587\u06B8\u06B9\u06BF\u06BF\u06CF\u06CF" + + "\u06FA\u07A5\u0950\u0950\u0AD0\u0AD0\u0D85\u0DC6\u0E2F\u0E2F" + + "\u0EAF\u0EAF\u0EDC\u0F00\u0F6A\u1055\u1101\u1101\u1104\u1104" + + "\u1108\u1108\u110A\u110A\u110D\u110D\u1113\u113B\u113D\u113D" + + "\u113F\u113F\u1141\u114B\u114D\u114D\u114F\u114F\u1151\u1153" + + "\u1156\u1158\u1162\u1162\u1164\u1164\u1166\u1166\u1168\u1168" + + "\u116A\u116C\u116F\u1171\u1174\u1174\u1176\u119D\u119F\u11A2" + + "\u11A9\u11AA\u11AC\u11AD\u11B0\u11B6\u11B9\u11B9\u11BB\u11BB" + + "\u11C3\u11EA\u11EC\u11EF\u11F1\u11F8\u1200\u18A8\u207F\u2124" + + "\u2128\u2128\u212C\u212D\u212F\u217F\u2183\u3006\u3038\u303A" + + "\u3131\u4DB5\uA000\uA48C\uF900\uFFDC"; + static final String NMSTRT_CATEGORIES = "LlLuLoLtNl"; + static final String NMCHAR_INCLUDES = + "\u002D\u002E\u003A\u005F\u00B7\u0387\u212E"; + static final String NMCHAR_EXCLUDE_RANGES = + "\u00AA\u00B5\u00BA\u00BA\u0132\u0133\u013F\u0140\u0149\u0149" + + "\u017F\u017F\u01C4\u01CC\u01F1\u01F3\u01F6\u01F9\u0218\u0233" + + "\u02A9\u02B8\u02E0\u02EE\u0346\u034E\u0362\u037A\u03D7\u03D7" + + "\u03DB\u03DB\u03DD\u03DD\u03DF\u03DF\u03E1\u03E1\u0400\u0400" + + "\u040D\u040D\u0450\u0450\u045D\u045D\u0488\u048F\u04EC\u04ED" + + "\u0587\u0587\u0653\u0655\u06B8\u06B9\u06BF\u06BF\u06CF\u06CF" + + "\u06FA\u07B0\u0950\u0950\u0AD0\u0AD0\u0D82\u0DF3\u0E2F\u0E2F" + + "\u0EAF\u0EAF\u0EDC\u0F00\u0F6A\u0F6A\u0F96\u0F96\u0FAE\u0FB0" + + "\u0FB8\u0FB8\u0FBA\u1059\u1101\u1101\u1104\u1104\u1108\u1108" + + "\u110A\u110A\u110D\u110D\u1113\u113B\u113D\u113D\u113F\u113F" + + "\u1141\u114B\u114D\u114D\u114F\u114F\u1151\u1153\u1156\u1158" + + "\u1162\u1162\u1164\u1164\u1166\u1166\u1168\u1168\u116A\u116C" + + "\u116F\u1171\u1174\u1174\u1176\u119D\u119F\u11A2\u11A9\u11AA" + + "\u11AC\u11AD\u11B0\u11B6\u11B9\u11B9\u11BB\u11BB\u11C3\u11EA" + + "\u11EC\u11EF\u11F1\u11F8\u1200\u18A9\u207F\u207F\u20DD\u20E0" + + "\u20E2\u2124\u2128\u2128\u212C\u212D\u212F\u217F\u2183\u2183" + + "\u3006\u3006\u3038\u303A\u3131\u4DB5\uA000\uA48C\uF900\uFFDC"; + static final String NMCHAR_CATEGORIES = "LlLuLoLtNlMcMeMnLmNd"; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.java new file mode 100644 index 0000000..e396fd1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/RegexEngineImpl.java @@ -0,0 +1,30 @@ +package com.thaiopensource.datatype.xsd.regex.jdk1_4; + +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +import com.thaiopensource.datatype.xsd.regex.RegexEngine; +import com.thaiopensource.datatype.xsd.regex.Regex; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; + +/** + * An implementation of RegexEngine using the JDK 1.4 java.util.regex + * package. + */ +public class RegexEngineImpl implements RegexEngine { + public RegexEngineImpl() { + // Force a linkage error on instantiation if JDK 1.4 is not available. + Pattern.compile("x"); + } + + public Regex compile(String str) throws RegexSyntaxException { + // Don't catch PatternSyntaxException + // The Translator should detect all syntax errors + final Pattern pattern = Pattern.compile(Translator.translate(str)); + return new Regex() { + public boolean matches(String str) { + return pattern.matcher(str).matches(); + } + }; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.java new file mode 100644 index 0000000..3437bba --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/Translator.java @@ -0,0 +1,1313 @@ +package com.thaiopensource.datatype.xsd.regex.jdk1_4; + +import com.thaiopensource.util.Utf16; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; + +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; +import java.math.BigDecimal; + +/** + * Translates XML Schema regexes into java.util.regex regexes. + * + * @see java.util.regex.Pattern + * @see XML Schema Part 2 + */ +public class Translator { + private final String regExp; + private int pos = 0; + private final int length; + private char curChar; + private boolean eos = false; + private final StringBuffer result = new StringBuffer(); + + static private final String categories = "LMNPZSC"; + static private final CharClass[] categoryCharClasses = new CharClass[categories.length()]; + static private final String subCategories = "LuLlLtLmLoMnMcMeNdNlNoPcPdPsPePiPfPoZsZlZpSmScSkSoCcCfCoCn"; + static private final CharClass[] subCategoryCharClasses = new CharClass[subCategories.length() / 2]; + + static private final int NONBMP_MIN = 0x10000; + static private final int NONBMP_MAX = 0x10FFFF; + static private final char SURROGATE2_MIN = '\uDC00'; + static private final char SURROGATE2_MAX = '\uDFFF'; + + static final Localizer localizer = new Localizer(Translator.class); + + static private final String[] blockNames = { + "BasicLatin", + "Latin-1Supplement", + "LatinExtended-A", + "LatinExtended-B", + "IPAExtensions", + "SpacingModifierLetters", + "CombiningDiacriticalMarks", + "Greek", + "Cyrillic", + "Armenian", + "Hebrew", + "Arabic", + "Syriac", + "Thaana", + "Devanagari", + "Bengali", + "Gurmukhi", + "Gujarati", + "Oriya", + "Tamil", + "Telugu", + "Kannada", + "Malayalam", + "Sinhala", + "Thai", + "Lao", + "Tibetan", + "Myanmar", + "Georgian", + "HangulJamo", + "Ethiopic", + "Cherokee", + "UnifiedCanadianAboriginalSyllabics", + "Ogham", + "Runic", + "Khmer", + "Mongolian", + "LatinExtendedAdditional", + "GreekExtended", + "GeneralPunctuation", + "SuperscriptsandSubscripts", + "CurrencySymbols", + "CombiningMarksforSymbols", + "LetterlikeSymbols", + "NumberForms", + "Arrows", + "MathematicalOperators", + "MiscellaneousTechnical", + "ControlPictures", + "OpticalCharacterRecognition", + "EnclosedAlphanumerics", + "BoxDrawing", + "BlockElements", + "GeometricShapes", + "MiscellaneousSymbols", + "Dingbats", + "BraillePatterns", + "CJKRadicalsSupplement", + "KangxiRadicals", + "IdeographicDescriptionCharacters", + "CJKSymbolsandPunctuation", + "Hiragana", + "Katakana", + "Bopomofo", + "HangulCompatibilityJamo", + "Kanbun", + "BopomofoExtended", + "EnclosedCJKLettersandMonths", + "CJKCompatibility", + "CJKUnifiedIdeographsExtensionA", + "CJKUnifiedIdeographs", + "YiSyllables", + "YiRadicals", + "HangulSyllables", + // surrogates excluded because there are never any *characters* with codes in surrogate range + // "PrivateUse", excluded because 3.1 adds non-BMP ranges + "CJKCompatibilityIdeographs", + "AlphabeticPresentationForms", + "ArabicPresentationForms-A", + "CombiningHalfMarks", + "CJKCompatibilityForms", + "SmallFormVariants", + "ArabicPresentationForms-B", + "Specials", + "HalfwidthandFullwidthForms", + "Specials" + }; + + + /** + * Names of blocks including ranges outside the BMP. + */ + static private final String[] specialBlockNames = { + "OldItalic", + "Gothic", + "Deseret", + "ByzantineMusicalSymbols", + "MusicalSymbols", + "MathematicalAlphanumericSymbols", + "CJKUnifiedIdeographsExtensionB", + "CJKCompatibilityIdeographsSupplement", + "Tags", + "PrivateUse", + "HighSurrogates", + "HighPrivateUseSurrogates", + "LowSurrogates", + }; + + /** + * CharClass for each block name in specialBlockNames. + */ + static private final CharClass[] specialBlockCharClasses = { + new CharRange(0x10300, 0x1032F), + new CharRange(0x10330, 0x1034F), + new CharRange(0x10400, 0x1044F), + new CharRange(0x1D000, 0x1D0FF), + new CharRange(0x1D100, 0x1D1FF), + new CharRange(0x1D400, 0x1D7FF), + new CharRange(0x20000, 0x2A6D6), + new CharRange(0x2F800, 0x2FA1F), + new CharRange(0xE0000, 0xE007F), + new Union(new CharClass[] { + new CharRange(0xE000, 0xF8FF), + new CharRange(0xF0000, 0xFFFFD), + new CharRange(0x100000, 0x10FFFD) + }), + Empty.getInstance(), + Empty.getInstance(), + Empty.getInstance() + }; + + static private final CharClass DOT = new Complement(new Union(new CharClass[] { new SingleChar('\n'), new SingleChar('\r') })); + + static private final CharClass ESC_d = new Property("Nd"); + + static private final CharClass ESC_D = new Complement(ESC_d); + + static private final CharClass ESC_W = new Union(new CharClass[] {new Property("P"), new Property("Z"), new Property("C")}); + + static private final CharClass ESC_w = new Complement(ESC_W); + + static private final CharClass ESC_s = new Union(new CharClass[] { + new SingleChar(' '), + new SingleChar('\n'), + new SingleChar('\r'), + new SingleChar('\t') + }); + + static private final CharClass ESC_S = new Complement(ESC_s); + + static private final CharClass ESC_i = makeCharClass(NamingExceptions.NMSTRT_CATEGORIES, + NamingExceptions.NMSTRT_INCLUDES, + NamingExceptions.NMSTRT_EXCLUDE_RANGES); + + static private final CharClass ESC_I = new Complement(ESC_i); + + static private final CharClass ESC_c = makeCharClass(NamingExceptions.NMCHAR_CATEGORIES, + NamingExceptions.NMCHAR_INCLUDES, + NamingExceptions.NMCHAR_EXCLUDE_RANGES); + + static private final CharClass ESC_C = new Complement(ESC_c); + + static private final char EOS = '\0'; + + private Translator(String regExp) { + this.regExp = regExp; + this.length = regExp.length(); + advance(); + } + + /** + * Translates a regular expression in the syntax of XML Schemas Part 2 into a regular + * expression in the syntax of java.util.regex.Pattern. The translation + * assumes that the string to be matched against the regex uses surrogate pairs correctly. + * If the string comes from XML content, a conforming XML parser will automatically + * check this; if the string comes from elsewhere, it may be necessary to check + * surrogate usage before matching. + * + * @param regexp a String containing a regular expression in the syntax of XML Schemas Part 2 + * @return a String containing a regular expression in the syntax of java.util.regex.Pattern + * @throws RegexSyntaxException if regexp is not a regular expression in the + * syntax of XML Schemas Part 2 + * @see java.util.regex.Pattern + * @see XML Schema Part 2 + */ + static public String translate(String regexp) throws RegexSyntaxException { + Translator tr = new Translator(regexp); + tr.translateTop(); + return tr.result.toString(); + } + + private void advance() { + if (pos < length) + curChar = regExp.charAt(pos++); + else { + pos++; + curChar = EOS; + eos = true; + } + } + + private void translateTop() throws RegexSyntaxException { + translateRegExp(); + if (!eos) + throw makeException("expected_eos"); + } + + private void translateRegExp() throws RegexSyntaxException { + translateBranch(); + while (curChar == '|') { + copyCurChar(); + translateBranch(); + } + } + + private void translateBranch() throws RegexSyntaxException { + while (translateAtom()) + translateQuantifier(); + } + + private void translateQuantifier() throws RegexSyntaxException { + switch (curChar) { + case '*': + case '?': + case '+': + copyCurChar(); + return; + case '{': + copyCurChar(); + translateQuantity(); + expect('}'); + copyCurChar(); + } + } + + private void translateQuantity() throws RegexSyntaxException { + String lower = parseQuantExact(); + int lowerValue = -1; + try { + lowerValue = Integer.parseInt(lower); + result.append(lower); + } + catch (NumberFormatException e) { + // JDK 1.4 cannot handle ranges bigger than this + result.append(Integer.MAX_VALUE); + } + if (curChar == ',') { + copyCurChar(); + if (curChar != '}') { + String upper = parseQuantExact(); + try { + int upperValue = Integer.parseInt(upper); + result.append(upper); + if (lowerValue < 0 || upperValue < lowerValue) + throw makeException("invalid_quantity_range"); + } + catch (NumberFormatException e) { + result.append(Integer.MAX_VALUE); + if (lowerValue < 0 && new BigDecimal(lower).compareTo(new BigDecimal(upper)) > 0) + throw makeException("invalid_quantity_range"); + } + } + } + } + + private String parseQuantExact() throws RegexSyntaxException { + StringBuffer buf = new StringBuffer(); + do { + if ("0123456789".indexOf(curChar) < 0) + throw makeException("expected_digit"); + buf.append(curChar); + advance(); + } while (curChar != ',' && curChar != '}'); + return buf.toString(); + } + + private void copyCurChar() { + result.append(curChar); + advance(); + } + + static final int NONE = -1; + static final int SOME = 0; + static final int ALL = 1; + + static final String SURROGATES1_CLASS = "[\uD800-\uDBFF]"; + static final String SURROGATES2_CLASS = "[\uDC00-\uDFFF]"; + static final String NOT_ALLOWED_CLASS = "[\u0000&&[^\u0000]]"; + + static final class Range implements Comparable { + private final int min; + private final int max; + + Range(int min, int max) { + this.min = min; + this.max = max; + } + + int getMin() { + return min; + } + + int getMax() { + return max; + } + + public int compareTo(Object o) { + Range other = (Range)o; + if (this.min < other.min) + return -1; + if (this.min > other.min) + return 1; + if (this.max > other.max) + return -1; + if (this.max < other.max) + return 1; + return 0; + } + } + + static abstract class CharClass { + + private final int containsBmp; + // if it contains ALL and containsBmp != NONE, then the generated class for containsBmp must + // contain all the high surrogates + private final int containsNonBmp; + + protected CharClass(int containsBmp, int containsNonBmp) { + this.containsBmp = containsBmp; + this.containsNonBmp = containsNonBmp; + } + + int getContainsBmp() { + return containsBmp; + } + + int getContainsNonBmp() { + return containsNonBmp; + } + + final void output(StringBuffer buf) { + switch (containsNonBmp) { + case NONE: + if (containsBmp == NONE) + buf.append(NOT_ALLOWED_CLASS); + else + outputBmp(buf); + break; + case ALL: + buf.append('('); + if (containsBmp == NONE) { + buf.append(SURROGATES1_CLASS); + buf.append(SURROGATES2_CLASS); + } + else { + outputBmp(buf); + buf.append(SURROGATES2_CLASS); + buf.append('?'); + } + buf.append(')'); + break; + case SOME: + buf.append('('); + boolean needSep = false; + if (containsBmp != NONE) { + needSep = true; + outputBmp(buf); + } + List ranges = new Vector(); + addNonBmpRanges(ranges); + sortRangeList(ranges); + String hi = highSurrogateRanges(ranges); + if (hi.length() > 0) { + if (needSep) + buf.append('|'); + else + needSep = true; + buf.append('['); + for (int i = 0, len = hi.length(); i < len; i += 2) { + char min = hi.charAt(i); + char max = hi.charAt(i + 1); + if (min == max) + buf.append(min); + else { + buf.append(min); + buf.append('-'); + buf.append(max); + } + } + buf.append(']'); + buf.append(SURROGATES2_CLASS); + } + String lo = lowSurrogateRanges(ranges); + for (int i = 0, len = lo.length(); i < len; i += 3) { + if (needSep) + buf.append('|'); + else + needSep = true; + buf.append(lo.charAt(i)); + char min = lo.charAt(i + 1); + char max = lo.charAt(i + 2); + if (min == max && (i + 3 >= len || lo.charAt(i + 3) != lo.charAt(i))) + buf.append(min); + else { + buf.append('['); + for (;;) { + if (min == max) + buf.append(min); + else { + buf.append(min); + buf.append('-'); + buf.append(max); + } + if (i + 3 >= len || lo.charAt(i + 3) != lo.charAt(i)) + break; + i += 3; + min = lo.charAt(i + 1); + max = lo.charAt(i + 2); + } + buf.append(']'); + } + } + if (!needSep) + buf.append(NOT_ALLOWED_CLASS); + buf.append(')'); + break; + } + } + + static String highSurrogateRanges(List ranges) { + StringBuffer highRanges = new StringBuffer(); + for (int i = 0, len = ranges.size(); i < len; i++) { + Range r = (Range)ranges.get(i); + char min1 = Utf16.surrogate1(r.getMin()); + char min2 = Utf16.surrogate2(r.getMin()); + char max1 = Utf16.surrogate1(r.getMax()); + char max2 = Utf16.surrogate2(r.getMax()); + if (min2 != SURROGATE2_MIN) + min1++; + if (max2 != SURROGATE2_MAX) + max1--; + if (max1 >= min1) { + highRanges.append(min1); + highRanges.append(max1); + } + } + return highRanges.toString(); + } + + static String lowSurrogateRanges(List ranges) { + StringBuffer lowRanges = new StringBuffer(); + for (int i = 0, len = ranges.size(); i < len; i++) { + Range r = (Range)ranges.get(i); + char min1 = Utf16.surrogate1(r.getMin()); + char min2 = Utf16.surrogate2(r.getMin()); + char max1 = Utf16.surrogate1(r.getMax()); + char max2 = Utf16.surrogate2(r.getMax()); + if (min1 == max1) { + if (min2 != SURROGATE2_MIN || max2 != SURROGATE2_MAX) { + lowRanges.append(min1); + lowRanges.append(min2); + lowRanges.append(max2); + } + } + else { + if (min2 != SURROGATE2_MIN) { + lowRanges.append(min1); + lowRanges.append(min2); + lowRanges.append(SURROGATE2_MAX); + } + if (max2 != SURROGATE2_MAX) { + lowRanges.append(max1); + lowRanges.append(SURROGATE2_MIN); + lowRanges.append(max2); + } + } + } + return lowRanges.toString(); + } + + abstract void outputBmp(StringBuffer buf); + abstract void outputComplementBmp(StringBuffer buf); + + int singleChar() { + return -1; + } + + void addNonBmpRanges(List ranges) { + } + + + static void sortRangeList(List ranges) { + Collections.sort(ranges); + int toIndex = 0; + int fromIndex = 0; + int len = ranges.size(); + while (fromIndex < len) { + Range r = (Range)ranges.get(fromIndex); + int min = r.getMin(); + int max = r.getMax(); + while (++fromIndex < len) { + Range r2 = (Range)ranges.get(fromIndex); + if (r2.getMin() > max + 1) + break; + if (r2.getMax() > max) + max = r2.getMax(); + } + if (max != r.getMax()) + r = new Range(min, max); + ranges.set(toIndex++, r); + } + while (len > toIndex) + ranges.remove(--len); + } + + } + + static abstract class SimpleCharClass extends CharClass { + SimpleCharClass(int containsBmp, int containsNonBmp) { + super(containsBmp, containsNonBmp); + } + + void outputBmp(StringBuffer buf) { + buf.append('['); + inClassOutputBmp(buf); + buf.append(']'); + } + + // must not call if containsBmp == ALL + void outputComplementBmp(StringBuffer buf) { + if (getContainsBmp() == NONE) + buf.append("[\u0000-\uFFFF]"); + else { + buf.append("[^"); + inClassOutputBmp(buf); + buf.append(']'); + } + } + abstract void inClassOutputBmp(StringBuffer buf); + } + + static class SingleChar extends SimpleCharClass { + private final char c; + SingleChar(char c) { + super(SOME, NONE); + this.c = c; + } + + int singleChar() { + return c; + } + + void outputBmp(StringBuffer buf) { + inClassOutputBmp(buf); + } + + void inClassOutputBmp(StringBuffer buf) { + if (isJavaMetaChar(c)) + buf.append('\\'); + buf.append(c); + } + + } + + static class WideSingleChar extends SimpleCharClass { + private final int c; + + WideSingleChar(int c) { + super(NONE, SOME); + this.c = c; + } + + void inClassOutputBmp(StringBuffer buf) { + throw new RuntimeException("BMP output botch"); + } + + int singleChar() { + return c; + } + + void addNonBmpRanges(List ranges) { + ranges.add(new Range(c, c)); + } + } + + static class Empty extends SimpleCharClass { + static private final Empty instance = new Empty(); + private Empty() { + super(NONE, NONE); + } + + static Empty getInstance() { + return instance; + } + + void inClassOutputBmp(StringBuffer buf) { + throw new RuntimeException("BMP output botch"); + } + + } + + static class CharRange extends SimpleCharClass { + private final int lower; + private final int upper; + + CharRange(int lower, int upper) { + super(lower < NONBMP_MIN ? SOME : NONE, + // don't use ALL here, because that requires that the BMP class contains high surrogates + upper >= NONBMP_MIN ? SOME : NONE); + this.lower = lower; + this.upper = upper; + } + + void inClassOutputBmp(StringBuffer buf) { + if (lower >= NONBMP_MIN) + throw new RuntimeException("BMP output botch"); + if (isJavaMetaChar((char)lower)) + buf.append('\\'); + buf.append((char)lower); + buf.append('-'); + if (upper < NONBMP_MIN) { + if (isJavaMetaChar((char)upper)) + buf.append('\\'); + buf.append((char)upper); + } + else + buf.append('\uFFFF'); + } + + void addNonBmpRanges(List ranges) { + if (upper >= NONBMP_MIN) + ranges.add(new Range(lower < NONBMP_MIN ? NONBMP_MIN : lower, upper)); + } + } + + static class Property extends SimpleCharClass { + private final String name; + + Property(String name) { + super(SOME, NONE); + this.name = name; + } + + void outputBmp(StringBuffer buf) { + inClassOutputBmp(buf); + } + + void inClassOutputBmp(StringBuffer buf) { + buf.append("\\p{"); + buf.append(name); + buf.append('}'); + } + + void outputComplementBmp(StringBuffer buf) { + buf.append("\\P{"); + buf.append(name); + buf.append('}'); + } + } + + static class Subtraction extends CharClass { + private final CharClass cc1; + private final CharClass cc2; + Subtraction(CharClass cc1, CharClass cc2) { + // min corresponds to intersection + // complement corresponds to negation + super(Math.min(cc1.getContainsBmp(), -cc2.getContainsBmp()), + Math.min(cc1.getContainsNonBmp(), -cc2.getContainsNonBmp())); + this.cc1 = cc1; + this.cc2 = cc2; + } + + void outputBmp(StringBuffer buf) { + buf.append('['); + cc1.outputBmp(buf); + buf.append("&&"); + cc2.outputComplementBmp(buf); + buf.append(']'); + } + + void outputComplementBmp(StringBuffer buf) { + buf.append('['); + cc1.outputComplementBmp(buf); + cc2.outputBmp(buf); + buf.append(']'); + } + + void addNonBmpRanges(List ranges) { + List posList = new Vector(); + cc1.addNonBmpRanges(posList); + List negList = new Vector(); + cc2.addNonBmpRanges(negList); + sortRangeList(posList); + sortRangeList(negList); + Iterator negIter = negList.iterator(); + Range negRange; + if (negIter.hasNext()) + negRange = (Range)negIter.next(); + else + negRange = null; + for (int i = 0, len = posList.size(); i < len; i++) { + Range posRange = (Range)posList.get(i); + while (negRange != null && negRange.getMax() < posRange.getMin()) { + if (negIter.hasNext()) + negRange = (Range)negIter.next(); + else + negRange = null; + } + // if negRange != null, negRange.max >= posRange.min + int min = posRange.getMin(); + while (negRange != null && negRange.getMin() <= posRange.getMax()) { + if (min < negRange.getMin()) { + ranges.add(new Range(min, negRange.getMin() - 1)); + } + min = negRange.getMax() + 1; + if (min > posRange.getMax()) + break; + if (negIter.hasNext()) + negRange = (Range)negIter.next(); + else + negRange = null; + } + if (min <= posRange.getMax()) + ranges.add(new Range(min, posRange.getMax())); + } + } + } + + static class Union extends CharClass { + private final List members; + + Union(CharClass[] v) { + this(toList(v)); + } + + static private List toList(CharClass[] v) { + List members = new Vector(); + for (int i = 0; i < v.length; i++) + members.add(v[i]); + return members; + } + + Union(List members) { + super(computeContainsBmp(members), computeContainsNonBmp(members)); + this.members = members; + } + + void outputBmp(StringBuffer buf) { + buf.append('['); + for (int i = 0, len = members.size(); i < len; i++) { + CharClass cc = (CharClass)members.get(i); + if (cc.getContainsBmp() != NONE) { + if (cc instanceof SimpleCharClass) + ((SimpleCharClass)cc).inClassOutputBmp(buf); + else + cc.outputBmp(buf); + } + } + buf.append(']'); + } + + void outputComplementBmp(StringBuffer buf) { + boolean first = true; + int len = members.size(); + for (int i = 0; i < len; i++) { + CharClass cc = (CharClass)members.get(i); + if (cc.getContainsBmp() != NONE && cc instanceof SimpleCharClass) { + if (first) { + buf.append("[^"); + first = false; + } + ((SimpleCharClass)cc).inClassOutputBmp(buf); + } + } + for (int i = 0; i < len; i++) { + CharClass cc = (CharClass)members.get(i); + if (cc.getContainsBmp() != NONE && !(cc instanceof SimpleCharClass)) { + if (first) { + buf.append('['); + first = false; + } + else + buf.append("&&"); + // can't have any members that are ALL, because that would make this ALL, which violates + // the precondition for outputComplementBmp + cc.outputComplementBmp(buf); + } + } + if (first == true) + // all members are NONE, so this is NONE, so complement is everything + buf.append("[\u0000-\uFFFF]"); + else + buf.append(']'); + } + + void addNonBmpRanges(List ranges) { + for (int i = 0, len = members.size(); i < len; i++) + ((CharClass)members.get(i)).addNonBmpRanges(ranges); + } + + private static int computeContainsBmp(List members) { + int ret = NONE; + for (int i = 0, len = members.size(); i < len; i++) + ret = Math.max(ret, ((CharClass)members.get(i)).getContainsBmp()); + return ret; + } + + private static int computeContainsNonBmp(List members) { + int ret = NONE; + for (int i = 0, len = members.size(); i < len; i++) + ret = Math.max(ret, ((CharClass)members.get(i)).getContainsNonBmp()); + return ret; + } + } + + static class Complement extends CharClass { + private final CharClass cc; + Complement(CharClass cc) { + super(-cc.getContainsBmp(), -cc.getContainsNonBmp()); + this.cc = cc; + } + + void outputBmp(StringBuffer buf) { + cc.outputComplementBmp(buf); + } + + void outputComplementBmp(StringBuffer buf) { + cc.outputBmp(buf); + } + + void addNonBmpRanges(List ranges) { + List tem = new Vector(); + cc.addNonBmpRanges(tem); + sortRangeList(tem); + int c = NONBMP_MIN; + for (int i = 0, len = tem.size(); i < len; i++) { + Range r = (Range)tem.get(i); + if (r.getMin() > c) + ranges.add(new Range(c, r.getMin() - 1)); + c = r.getMax() + 1; + } + if (c != NONBMP_MAX + 1) + ranges.add(new Range(c, NONBMP_MAX)); + } + } + + private boolean translateAtom() throws RegexSyntaxException { + switch (curChar) { + case EOS: + if (!eos) + break; + // fall through + case '?': + case '*': + case '+': + case ')': + case '{': + case '}': + case '|': + case ']': + return false; + case '(': + copyCurChar(); + translateRegExp(); + expect(')'); + copyCurChar(); + return true; + case '\\': + advance(); + parseEsc().output(result); + return true; + case '[': + advance(); + parseCharClassExpr().output(result); + return true; + case '.': + DOT.output(result); + advance(); + return true; + case '$': + case '^': + result.append('\\'); + break; + } + copyCurChar(); + return true; + } + + + static private CharClass makeCharClass(String categories, String includes, String excludeRanges) { + List includeList = new Vector(); + for (int i = 0, len = categories.length(); i < len; i += 2) + includeList.add(new Property(categories.substring(i, i + 2))); + for (int i = 0, len = includes.length(); i < len; i++) { + int j = i + 1; + for (; j < len && includes.charAt(j) - includes.charAt(i) == j - i; j++) + ; + --j; + if (i == j - 1) + --j; + if (i == j) + includeList.add(new SingleChar(includes.charAt(i))); + else + includeList.add(new CharRange(includes.charAt(i), includes.charAt(j))); + i = j; + } + List excludeList = new Vector(); + for (int i = 0, len = excludeRanges.length(); i < len; i += 2) { + char min = excludeRanges.charAt(i); + char max = excludeRanges.charAt(i + 1); + if (min == max) + excludeList.add(new SingleChar(min)); + else if (min == max - 1) { + excludeList.add(new SingleChar(min)); + excludeList.add(new SingleChar(max)); + } + else + excludeList.add(new CharRange(min, max)); + } + return new Subtraction(new Union(includeList), new Union(excludeList)); + } + + private CharClass parseEsc() throws RegexSyntaxException { + switch (curChar) { + case 'n': + advance(); + return new SingleChar('\n'); + case 'r': + advance(); + return new SingleChar('\r'); + case 't': + advance(); + return new SingleChar('\t'); + case '\\': + case '|': + case '.': + case '-': + case '^': + case '?': + case '*': + case '+': + case '(': + case ')': + case '{': + case '}': + case '[': + case ']': + break; + case 's': + advance(); + return ESC_s; + case 'S': + advance(); + return ESC_S; + case 'i': + advance(); + return ESC_i; + case 'I': + advance(); + return ESC_I; + case 'c': + advance(); + return ESC_c; + case 'C': + advance(); + return ESC_C; + case 'd': + advance(); + return ESC_d; + case 'D': + advance(); + return ESC_D; + case 'w': + advance(); + return ESC_w; + case 'W': + advance(); + return ESC_W; + case 'p': + advance(); + return parseProp(); + case 'P': + advance(); + return new Complement(parseProp()); + default: + throw makeException("bad_escape"); + } + CharClass tem = new SingleChar(curChar); + advance(); + return tem; + } + + private CharClass parseProp() throws RegexSyntaxException { + expect('{'); + int start = pos; + for (;;) { + advance(); + if (curChar == '}') + break; + if (!isAsciiAlnum(curChar) && curChar != '-') + expect('}'); + } + String propertyName = regExp.substring(start, pos - 1); + advance(); + switch (propertyName.length()) { + case 0: + throw makeException("empty_property_name"); + case 2: + int sci = subCategories.indexOf(propertyName); + if (sci < 0 || sci % 2 == 1) + throw makeException("bad_category"); + return getSubCategoryCharClass(sci / 2); + case 1: + int ci = categories.indexOf(propertyName.charAt(0)); + if (ci < 0) + throw makeException("bad_category", propertyName); + return getCategoryCharClass(ci); + default: + if (!propertyName.startsWith("Is")) + break; + String blockName = propertyName.substring(2); + for (int i = 0; i < specialBlockNames.length; i++) + if (blockName.equals(specialBlockNames[i])) + return specialBlockCharClasses[i]; + if (!isBlock(blockName)) + throw makeException("bad_block_name", blockName); + return new Property( "In" + blockName); + } + throw makeException("bad_property_name", propertyName); + } + + static private boolean isBlock(String name) { + for (int i = 0; i < blockNames.length; i++) + if (name.equals(blockNames[i])) + return true; + return false; + } + + static private boolean isAsciiAlnum(char c) { + if ('a' <= c && c <= 'z') + return true; + if ('A' <= c && c <= 'Z') + return true; + if ('0' <= c && c <= '9') + return true; + return false; + } + + private void expect(char c) throws RegexSyntaxException { + if (curChar != c) + throw makeException("expected", new String(new char[]{c})); + } + + private CharClass parseCharClassExpr() throws RegexSyntaxException { + boolean compl; + if (curChar == '^') { + advance(); + compl = true; + } + else + compl = false; + List members = new Vector(); + do { + CharClass lower = parseCharClassEscOrXmlChar(); + members.add(lower); + if (curChar == '-') { + advance(); + if (curChar == '[') + break; + CharClass upper = parseCharClassEscOrXmlChar(); + if (lower.singleChar() < 0 || upper.singleChar() < 0) + throw makeException("multi_range"); + if (lower.singleChar() > upper.singleChar()) + throw makeException("invalid_range"); + members.set(members.size() - 1, + new CharRange(lower.singleChar(), upper.singleChar())); + if (curChar == '-') { + advance(); + expect('['); + break; + } + } + } while (curChar != ']'); + CharClass result; + if (members.size() == 1) + result = (CharClass)members.get(0); + else + result = new Union(members); + if (compl) + result = new Complement(result); + if (curChar == '[') { + advance(); + result = new Subtraction(result, parseCharClassExpr()); + expect(']'); + } + advance(); + return result; + } + + private CharClass parseCharClassEscOrXmlChar() throws RegexSyntaxException { + switch (curChar) { + case EOS: + if (eos) + expect(']'); + break; + case '\\': + advance(); + return parseEsc(); + case '[': + case ']': + case '-': + throw makeException("should_quote", new String(new char[]{curChar})); + } + CharClass tem; + if (Utf16.isSurrogate(curChar)) { + if (!Utf16.isSurrogate1(curChar)) + throw makeException("invalid_surrogate"); + char c1 = curChar; + advance(); + if (!Utf16.isSurrogate2(curChar)) + throw makeException("invalid_surrogate"); + tem = new WideSingleChar(Utf16.scalarValue(c1, curChar)); + } + else + tem = new SingleChar(curChar); + advance(); + return tem; + } + + private RegexSyntaxException makeException(String key) { + return new RegexSyntaxException(localizer.message(key), pos - 1); + } + + private RegexSyntaxException makeException(String key, String arg) { + return new RegexSyntaxException(localizer.message(key, arg), pos - 1); + } + + static private boolean isJavaMetaChar(char c) { + switch (c) { + case '\\': + case '^': + case '?': + case '*': + case '+': + case '(': + case ')': + case '{': + case '}': + case '|': + case '[': + case ']': + case '-': + case '&': + case '$': + case '.': + return true; + } + return false; + } + + static private synchronized CharClass getCategoryCharClass(int ci) { + if (categoryCharClasses[ci] == null) + categoryCharClasses[ci] = computeCategoryCharClass(categories.charAt(ci)); + return categoryCharClasses[ci]; + } + + static private synchronized CharClass getSubCategoryCharClass(int sci) { + if (subCategoryCharClasses[sci] == null) + subCategoryCharClasses[sci] = computeSubCategoryCharClass(subCategories.substring(sci * 2, (sci + 1) * 2)); + return subCategoryCharClasses[sci]; + } + + static private final char UNICODE_3_1_ADD_Lu = '\u03F4'; // added in 3.1 + static private final char UNICODE_3_1_ADD_Ll = '\u03F5'; // added in 3.1 + // 3 characters changed from No to Nl between 3.0 and 3.1 + static private final char UNICODE_3_1_CHANGE_No_to_Nl_MIN = '\u16EE'; + static private final char UNICODE_3_1_CHANGE_No_to_Nl_MAX = '\u16F0'; + static private final String CATEGORY_Pi = "\u00AB\u2018\u201B\u201C\u201F\u2039"; // Java doesn't know about category Pi + static private final String CATEGORY_Pf = "\u00BB\u2019\u201D\u203A"; // Java doesn't know about category Pf + + static private CharClass computeCategoryCharClass(char code) { + List classes = new Vector(); + classes.add(new Property(new String(new char[] { code }))); + for (int ci = Categories.CATEGORY_NAMES.indexOf(code); ci >= 0; ci = Categories.CATEGORY_NAMES.indexOf(code, ci + 1)) { + int[] addRanges = Categories.CATEGORY_RANGES[ci/2]; + for (int i = 0; i < addRanges.length; i += 2) + classes.add(new CharRange(addRanges[i], addRanges[i + 1])); + } + if (code == 'P') + classes.add(makeCharClass(CATEGORY_Pi + CATEGORY_Pf)); + if (code == 'L') { + classes.add(new SingleChar(UNICODE_3_1_ADD_Ll)); + classes.add(new SingleChar(UNICODE_3_1_ADD_Lu)); + } + if (code == 'C') { + // JDK 1.4 leaves Cn out of C? + classes.add(new Subtraction(new Property("Cn"), + new Union(new CharClass[] { new SingleChar(UNICODE_3_1_ADD_Lu), + new SingleChar(UNICODE_3_1_ADD_Ll) }))); + List assignedRanges = new Vector(); + for (int i = 0; i < Categories.CATEGORY_RANGES.length; i++) + for (int j = 0; j < Categories.CATEGORY_RANGES[i].length; j += 2) + assignedRanges.add(new CharRange(Categories.CATEGORY_RANGES[i][j], + Categories.CATEGORY_RANGES[i][j + 1])); + classes.add(new Subtraction(new CharRange(NONBMP_MIN, NONBMP_MAX), + new Union(assignedRanges))); + } + if (classes.size() == 1) + return (CharClass)classes.get(0); + return new Union(classes); + } + + static private CharClass computeSubCategoryCharClass(String name) { + CharClass base = new Property(name); + int sci = Categories.CATEGORY_NAMES.indexOf(name); + if (sci < 0) { + if (name.equals("Cn")) { + // Unassigned + List assignedRanges = new Vector(); + assignedRanges.add(new SingleChar(UNICODE_3_1_ADD_Lu)); + assignedRanges.add(new SingleChar(UNICODE_3_1_ADD_Ll)); + for (int i = 0; i < Categories.CATEGORY_RANGES.length; i++) + for (int j = 0; j < Categories.CATEGORY_RANGES[i].length; j += 2) + assignedRanges.add(new CharRange(Categories.CATEGORY_RANGES[i][j], + Categories.CATEGORY_RANGES[i][j + 1])); + return new Subtraction(new Union(new CharClass[] { base, new CharRange(NONBMP_MIN, NONBMP_MAX) }), + new Union(assignedRanges)); + } + if (name.equals("Pi")) + return makeCharClass(CATEGORY_Pi); + if (name.equals("Pf")) + return makeCharClass(CATEGORY_Pf); + return base; + } + List classes = new Vector(); + classes.add(base); + int[] addRanges = Categories.CATEGORY_RANGES[sci/2]; + for (int i = 0; i < addRanges.length; i += 2) + classes.add(new CharRange(addRanges[i], addRanges[i + 1])); + if (name.equals("Lu")) + classes.add(new SingleChar(UNICODE_3_1_ADD_Lu)); + else if (name.equals("Ll")) + classes.add(new SingleChar(UNICODE_3_1_ADD_Ll)); + else if (name.equals("Nl")) + classes.add(new CharRange(UNICODE_3_1_CHANGE_No_to_Nl_MIN, UNICODE_3_1_CHANGE_No_to_Nl_MAX)); + else if (name.equals("No")) + return new Subtraction(new Union(classes), + new CharRange(UNICODE_3_1_CHANGE_No_to_Nl_MIN, + UNICODE_3_1_CHANGE_No_to_Nl_MAX)); + return new Union(classes); + } + + private static CharClass makeCharClass(String members) { + List list = new Vector(); + for (int i = 0, len = members.length(); i < len; i++) + list.add(new SingleChar(members.charAt(i))); + return new Union(list); + } + + public static void main(String[] args) throws RegexSyntaxException { + String s = translate(args[0]); + for (int i = 0, len = s.length(); i < len; i++) { + char c = s.charAt(i); + if (c >= 0x20 && c <= 0x7e) + System.err.print(c); + else { + System.err.print("\\u"); + for (int shift = 12; shift >= 0; shift -= 4) + System.err.print("0123456789ABCDEF".charAt((c >> shift) & 0xF)); + } + } + System.err.println(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.java new file mode 100644 index 0000000..3daf661 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/CategoriesGen.java @@ -0,0 +1,161 @@ +package com.thaiopensource.datatype.xsd.regex.jdk1_4.gen; + +import java.io.File; +import java.io.OutputStream; +import java.io.FileOutputStream; +import java.io.Writer; +import java.io.BufferedWriter; +import java.io.OutputStreamWriter; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.Reader; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.Vector; +import java.util.Iterator; +import java.util.Set; + +public class CategoriesGen { + static public void main(String[] args) throws IOException { + if (args.length != 3) { + System.err.println("usage: " + CategoriesGen.class.getName() + " className srcDir UnicodeData.txt"); + System.exit(2); + } + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[2]))); + CategoriesGen g = new CategoriesGen(); + g.load(r); + String className = args[0]; + String srcDir = args[1]; + int lastDot = className.lastIndexOf('.'); + String pkg; + if (lastDot < 0) + pkg = null; + else { + pkg = className.substring(0, lastDot); + className = className.substring(lastDot + 1); + srcDir = srcDir + File.separator + pkg.replace('.', File.separatorChar); + } + String srcFile = srcDir + File.separator + className + ".java"; + OutputStream stm = new FileOutputStream(srcFile); + Writer w = new BufferedWriter(new OutputStreamWriter(stm)); + String lineSep = System.getProperty("line.separator"); + w.write("// This file was automatically generated by "); + w.write(CategoriesGen.class.getName()); + w.write(lineSep); + if (pkg != null) + w.write("package " + pkg + ";" + lineSep + lineSep); + w.write("class " + className + " {" + lineSep); + g.save(w, lineSep); + w.write("}" + lineSep); + w.close(); + } + + void load(BufferedReader r) throws IOException { + String lastCategory = null; + int lastCode = 0; + int firstCode = 0; + for (;;) { + String line = r.readLine(); + if (line == null) + break; + int semi = line.indexOf(';'); + if (semi != 5 && semi != 6) + continue; + int code = Integer.parseInt(line.substring(0, semi), 16); + int semi2 = line.indexOf(';', semi + 1); + String name = line.substring(semi, semi2); + String category = line.substring(semi2 + 1, semi2 + 3); + if (!category.equals(lastCategory) || + !(lastCode + 1 == code || name.endsWith(", Last>"))) { + if (lastCategory != null) + add(firstCode, lastCode, lastCategory); + lastCategory = category; + firstCode = code; + } + lastCode = code; + } + if (lastCategory != null) + add(firstCode, lastCode, lastCategory); + } + + private final Map map = new HashMap(); + + static class Range { + private final int lower; + private final int upper; + + public Range(int lower, int upper) { + this.lower = lower; + this.upper = upper; + } + } + + void add(int firstCode, int lastCode, String category) { + List list = (List)map.get(category); + if (list == null) { + list = new Vector(); + map.put(category, list); + } + list.add(new Range(firstCode, lastCode)); + } + + static private final String INDENT = " "; + + void save(Writer w, String lineSep) throws IOException { + Set set = map.entrySet(); + w.write(lineSep); + w.write(INDENT); + w.write("static final String CATEGORY_NAMES = \""); + for (Iterator iter = set.iterator(); iter.hasNext();) { + Map.Entry entry = (Map.Entry)iter.next(); + w.write((String)entry.getKey()); + } + w.write("\";"); + w.write(lineSep); + w.write(lineSep); + w.write(INDENT); + w.write("static final int[][] CATEGORY_RANGES = {"); + w.write(lineSep); + + for (Iterator iter = set.iterator(); iter.hasNext();) { + Map.Entry entry = (Map.Entry)iter.next(); + w.write(INDENT); + w.write(INDENT); + w.write('{'); + w.write(lineSep); + w.write(INDENT); + w.write(INDENT); + w.write(INDENT); + w.write("// "); + w.write((String)entry.getKey()); + w.write(lineSep); + List list = (List)entry.getValue(); + for (int i = 0, len = list.size(); i < len; i++) { + Range r = (Range)list.get(i); + w.write(INDENT); + w.write(INDENT); + w.write(INDENT); + w.write("0x"); + w.write(Integer.toHexString(r.lower)); + w.write(", "); + w.write("0x"); + w.write(Integer.toHexString(r.upper)); + if (i + 1 != len) + w.write(","); + w.write(lineSep); + } + w.write(INDENT); + w.write(INDENT); + w.write('}'); + if (iter.hasNext()) + w.write(','); + w.write(lineSep); + } + w.write(INDENT); + w.write("};"); + w.write(lineSep); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.java new file mode 100644 index 0000000..69b68d3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/gen/NamingExceptionsGen.java @@ -0,0 +1,152 @@ +package com.thaiopensource.datatype.xsd.regex.jdk1_4.gen; + +import com.thaiopensource.xml.util.Naming; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.List; +import java.util.Vector; + +public class NamingExceptionsGen { + static public void main(String[] args) throws IOException { + if (args.length != 2) { + System.err.println("Usage: " + NamingExceptionsGen.class.toString() + " className srcDir"); + System.exit(1); + } + String className = args[0]; + String srcDir = args[1]; + int lastDot = className.lastIndexOf('.'); + String pkg; + if (lastDot < 0) + pkg = null; + else { + pkg = className.substring(0, lastDot); + className = className.substring(lastDot + 1); + srcDir = srcDir + File.separator + pkg.replace('.', File.separatorChar); + } + String srcFile = srcDir + File.separator + className + ".java"; + OutputStream stm = new FileOutputStream(srcFile); + Writer w = new BufferedWriter(new OutputStreamWriter(stm)); + String lineSep = System.getProperty("line.separator"); + w.write("// This file was automatically generated by "); + w.write(NamingExceptionsGen.class.getName()); + w.write(lineSep); + if (pkg != null) + w.write("package " + pkg + ";" + lineSep + lineSep); + w.write("class " + className + " {" + lineSep); + gen(true, w, lineSep); + gen(false, w, lineSep); + w.write("}" + lineSep); + w.close(); + } + + static private void gen(boolean isStart, Writer w, String lineSep) throws IOException { + char[] buf = new char[1]; + boolean excluding = false; + char excludeMin = 0; + char excludeMax = 0; + List includeList = new Vector(); + List excludeRangeList = new Vector(); + for (int i = 0; i < 65536; i++) { + char ch = (char)i; + buf[0] = ch; + String s = new String(buf); + boolean isName = isStart ? Naming.isName(s) : Naming.isNmtoken(s); + if (isName && excluding) { + excludeRangeList.add(new Character(excludeMin)); + excludeRangeList.add(new Character(excludeMax)); + excluding = false; + } + if (isName != isApproxName(ch, isStart)) { + if (isName) + includeList.add(new Character(ch)); + else { + if (!excluding) { + excluding = true; + excludeMin = ch; + } + excludeMax = ch; + } + } + } + if (excluding) { + excludeRangeList.add(new Character(excludeMin)); + excludeRangeList.add(new Character(excludeMax)); + } + String prefix = isStart ? "NMSTRT" : "NMCHAR"; + genList(prefix + "_INCLUDES", includeList, w, lineSep); + genList(prefix + "_EXCLUDE_RANGES", excludeRangeList, w, lineSep); + w.write(INDENT); + w.write("static final String "); + w.write(prefix); + w.write("_CATEGORIES = \""); + w.write(isStart ? NMSTRT_CATEGORIES : NMCHAR_CATEGORIES); + w.write("\";"); + w.write(lineSep); + } + + static private final int CHARS_PER_LINE = 10; + static private final String INDENT = " "; + + static private void genList(String varName, List includeList, Writer w, String lineSep) throws IOException { + w.write(INDENT); + w.write("static final String "); + w.write(varName); + w.write(" ="); + w.write(lineSep); + w.write(INDENT); + w.write(INDENT); + w.write('"'); + for (int i = 0, len = includeList.size(); i < len; i++) { + w.write("\\u"); + w.write(hex(((Character)includeList.get(i)).charValue())); + if (i % CHARS_PER_LINE == CHARS_PER_LINE - 1 && i + 1 != len) { + w.write("\" +"); + w.write(lineSep); + w.write(INDENT); + w.write(INDENT); + w.write('"'); + } + } + w.write("\";"); + w.write(lineSep); + } + + static private final String HEX_DIGITS = "0123456789ABCDEF"; + + static String hex(char c) { + char[] buf = new char[4]; + buf[0] = HEX_DIGITS.charAt((c >> 12) & 0xF); + buf[1] = HEX_DIGITS.charAt((c >> 8) & 0xF); + buf[2] = HEX_DIGITS.charAt((c >> 4) & 0xF); + buf[3] = HEX_DIGITS.charAt(c & 0xF); + return new String(buf); + } + + static private final String NMSTRT_CATEGORIES = "LlLuLoLtNl"; + static private final String NMCHAR_CATEGORIES = NMSTRT_CATEGORIES + "McMeMnLmNd"; + + static private boolean isApproxName(char c, boolean isStart) { + switch (Character.getType(c)) { + case Character.LOWERCASE_LETTER: // Ll + case Character.UPPERCASE_LETTER: // Lu + case Character.OTHER_LETTER: // Lo + case Character.TITLECASE_LETTER: // Lt + case Character.LETTER_NUMBER: // Nl + return true; + case Character.COMBINING_SPACING_MARK: // Mc + case Character.ENCLOSING_MARK: // Me + case Character.NON_SPACING_MARK: // Mn + case Character.MODIFIER_LETTER: // Lm + case Character.DECIMAL_DIGIT_NUMBER: // Nd + return !isStart; + } + return false; + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties new file mode 100644 index 0000000..817f31b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/jdk1_4/resources/Messages.properties @@ -0,0 +1,13 @@ +bad_block_name=unrecognized Unicode block name \"{0}\" +bad_category=unrecognized Unicode category \"{0}\" +bad_escape=illegal escape +bad_property_name=bad property name \"{0}\" +empty_property_name=property name must not be empty +expected=expected \"{0}\" +expected_digit=expected a digit +expected_eos=character is not allowed in this context +invalid_range=lower bound of range must not have Unicode code point greater than upper bound +invalid_surrogate=illegal surrogate pair +multi_range=bounds of range must be single characters +should_quote=character \"{0}\" must be escaped with \"\\\" in ths context +invalid_quantity_range=lower bound of quantifier must not be greater than upper bound diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.java new file mode 100644 index 0000000..1e4aafd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/CategoryTest.java @@ -0,0 +1,135 @@ +package com.thaiopensource.datatype.xsd.regex.test; + +import com.thaiopensource.datatype.xsd.regex.Regex; +import com.thaiopensource.datatype.xsd.regex.RegexEngine; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; +import com.thaiopensource.util.Utf16; +import com.thaiopensource.util.Service; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.Enumeration; + +public class CategoryTest { + static private final String categories = "LMNPZSC"; + static private final String subCategories = "LuLlLtLmLoMnMcMeNdNlNoPcPdPsPePiPfPoZsZlZpSmScSkSoCcCfCoCn"; + + private final Regex[] categoryPosRegexes = new Regex[categories.length()]; + private final Regex[] categoryNegRegexes = new Regex[categories.length()]; + private final Regex[] subCategoryPosRegexes = new Regex[subCategories.length()/2]; + private final Regex[] subCategoryNegRegexes = new Regex[subCategories.length()/2]; + + static public void main(String[] args) throws IOException, RegexSyntaxException { + if (args.length != 2) { + System.err.println("usage: " + CategoryTest.class.getName() + " engineClass UnicodeData"); + System.exit(2); + } + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[1]))); + Enumeration e = new Service(RegexEngine.class).getProviders(); + RegexEngine engine; + for (;;) { + if (!e.hasMoreElements()) { + System.err.println("couldn't find regex engine"); + System.exit(2); + } + engine = (RegexEngine)e.nextElement(); + if (engine.getClass().getName().equals(args[0])) + break; + } + int nFail = new CategoryTest(engine).testAll(r); + System.err.println(nFail + " tests failed"); + System.exit(nFail > 0 ? 1 : 0); + } + + CategoryTest(RegexEngine engine) throws RegexSyntaxException { + for (int i = 0, len = categories.length(); i < len; i++) { + String ch = categories.substring(i, i + 1); + categoryPosRegexes[i] = engine.compile("\\p{" + ch + "}"); + categoryNegRegexes[i] = engine.compile("\\P{" + ch + "}"); + } + for (int i = 0, len = subCategories.length(); i < len; i += 2) { + String name = subCategories.substring(i, i + 2); + subCategoryPosRegexes[i/2] = engine.compile("\\p{" + name + "}"); + subCategoryNegRegexes[i/2] = engine.compile("\\P{" + name + "}"); + } + } + + int testAll(BufferedReader r) throws IOException { + int lastCode = -1; + for (;;) { + String line = r.readLine(); + if (line == null) + break; + int semi = line.indexOf(';'); + if (semi < 0) + continue; + int code = Integer.parseInt(line.substring(0, semi), 16); + int semi2 = line.indexOf(';', semi + 1); + String name = line.substring(semi, semi2); + String category = line.substring(semi2 + 1, semi2 + 3); + if (lastCode + 1 != code) { + String missingCategory = name.endsWith(", Last>") ? category : "Cn"; + for (int i = lastCode + 1; i < code; i++) + test(i, missingCategory); + } + test(code, category); + lastCode = code; + } + for (++lastCode; lastCode < 0x110000; lastCode++) + test(lastCode, "Cn"); + return nFail; + } + + void test(int ch, String category) { + if (!isXmlChar(ch)) + return; + if (subCategories.indexOf(category) < 0) { + System.err.println("Missing category: " + category); + System.exit(2); + } + for (int i = 0, len = categories.length(); i < len; i++) + check(ch, categoryPosRegexes[i], categoryNegRegexes[i], + category.charAt(0) == categories.charAt(i), + categories.substring(i, i + 1)); + for (int i = 0, len = subCategories.length(); i < len; i += 2) + check(ch, subCategoryPosRegexes[i/2], subCategoryNegRegexes[i/2], + category.equals(subCategories.substring(i, i + 2)), + subCategories.substring(i, i + 2)); + } + + void check(int ch, Regex pos, Regex neg, boolean inPos, String cat) { + String str; + if (ch > 0xFFFF) + str = new String(new char[]{ Utf16.surrogate1(ch), Utf16.surrogate2(ch) }); + else + str = new String(new char[]{ (char)ch }); + if (pos.matches(str) != inPos ) + fail(ch, cat); + if (neg.matches(str) != !inPos) + fail(ch, "-" + cat); + } + + int nFail = 0; + + void fail(int ch, String cat) { + nFail++; + System.err.println("Failed: " + Integer.toHexString(ch) + "/" + cat); + } + + static boolean isXmlChar(int code) { + switch (code) { + case '\r': case '\n': case '\t': + return true; + case 0xFFFE: case 0xFFFF: + return false; + default: + if (code < 0x20) + return false; + if (code >= 0xD800 && code < 0xE000) + return false; + return true; + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/TestDriver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/TestDriver.java new file mode 100644 index 0000000..ad403a1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/regex/test/TestDriver.java @@ -0,0 +1,165 @@ +package com.thaiopensource.datatype.xsd.regex.test; + +import com.thaiopensource.datatype.xsd.regex.Regex; +import com.thaiopensource.datatype.xsd.regex.RegexEngine; +import com.thaiopensource.datatype.xsd.regex.RegexSyntaxException; +import com.thaiopensource.util.Service; +import com.thaiopensource.util.UriOrFile; +import com.thaiopensource.util.Utf16; +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; + +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.util.Enumeration; + +public class TestDriver extends DefaultHandler { + private final StringBuffer buf = new StringBuffer(); + private Regex regex; + private int nFail = 0; + private int nTests = 0; + private Locator loc; + private final RegexEngine engine; + + static public void main(String[] args) throws SAXException, IOException, ParserConfigurationException { + if (args.length != 2) { + System.err.println("usage: TestDriver class testfile"); + System.exit(2); + } + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setValidating(false); + XMLReader xr = factory.newSAXParser().getXMLReader(); + + Enumeration e = new Service(RegexEngine.class).getProviders(); + RegexEngine engine; + for (;;) { + if (!e.hasMoreElements()) { + System.err.println("couldn't find regex engine"); + System.exit(2); + } + engine = (RegexEngine)e.nextElement(); + if (engine.getClass().getName().equals(args[0])) + break; + } + TestDriver tester = new TestDriver(engine); + xr.setContentHandler(tester); + InputSource in = new InputSource(UriOrFile.fileToUri(args[1])); + xr.parse(in); + System.err.println(tester.nTests + " tests performed"); + System.err.println(tester.nFail + " failures"); + if (tester.nFail > 0) + System.exit(1); + } + + public TestDriver(RegexEngine engine) { + this.engine = engine; + } + + public void setDocumentLocator(Locator locator) { + this.loc = locator; + } + + public void characters(char ch[], int start, int length) + throws SAXException { + buf.append(ch, start, length); + } + + public void ignorableWhitespace(char ch[], int start, int length) + throws SAXException { + buf.append(ch, start, length); + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + buf.setLength(0); + } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + if (localName.equals("valid")) + valid(buf.toString()); + else if (localName.equals("invalid")) + invalid(buf.toString()); + else if (localName.equals("correct")) + correct(buf.toString()); + else if (localName.equals("incorrect")) + incorrect(buf.toString()); + } + + private void correct(String str) { + nTests++; + regex = null; + try { + regex = engine.compile(str); + } + catch (RegexSyntaxException e) { + error("unexpected error: " + e.getMessage() + ": " + display(str, e.getPosition())); + } + } + + private void incorrect(String str) { + nTests++; + regex = null; + try { + engine.compile(str); + error("failed to detect error in regex: " + display(str, -1)); + } + catch (RegexSyntaxException e) { } + } + + private void valid(String str) { + if (regex == null) + return; + nTests++; + if (!regex.matches(str)) + error("match failed for string: " + display(str, -1)); + } + + private void invalid(String str) { + if (regex == null) + return; + nTests++; + if (regex.matches(str)) + error("match incorrectly succeeded for string: " + display(str, -1)); + } + + private void error(String str) { + int line = -1; + if (loc != null) + line = loc.getLineNumber(); + if (line >= 0) + System.err.print("Line " + line + ": "); + System.err.println(str); + nFail++; + } + + static final private String ERROR_MARKER = ">>>>"; + + static String display(String str, int pos) { + StringBuffer buf = new StringBuffer(); + for (int i = 0, len = str.length(); i < len; i++) { + if (i == pos) + buf.append(ERROR_MARKER); + char c = str.charAt(i); + if (Utf16.isSurrogate1(c)) + buf.append("&#x" + Integer.toHexString(Utf16.scalarValue(c, str.charAt(++i))) + ";"); + else if (c < ' ' || c >= 0x7F) + buf.append("&#x" + Integer.toHexString(c) + ";"); + else if (c == '&') + buf.append("&"); + else + buf.append(c); + } + if (str.length() == pos) + buf.append(ERROR_MARKER); + return buf.toString(); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/resources/Messages.properties new file mode 100644 index 0000000..716fdb0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/datatype/xsd/resources/Messages.properties @@ -0,0 +1,14 @@ +# Properties file specifying messages +enumeration_param=\"enumeration\" facet is not allowed as a parameter: use \"value\" element instead +whiteSpace_param=\"whiteSpace\" facet is not allowed as a parameter +unrecognized_param=unrecognized parameter \"{0}\" +invalid_regex=invalid regular expression: {0} +not_ordered=parameter can only be applied to ordered datatype +invalid_limit=\"{0}\" is not allowed by the base type +no_length=base datatype does not define a units of length +scale_not_derived_from_decimal=\"scale\" parameter can only be applied to datatype derived from \"decimal\" +value_not_non_negative_integer=\"value\" parameter must be non negative integer +precision_not_derived_from_decimal=\"precision\" parameter can only be applied to datatype derived from \"decimal\" +value_not_positive_integer=\"value\" parameter must be positive integer +regex_impl_not_found=cannot find regular expression implementation; use JDK 1.4 or add Xerces 1 or 2 to your classpath +regex_internal_error=internal error in regular expression for datatype {0} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/SchemaFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/SchemaFactory.java new file mode 100644 index 0000000..991c614 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/SchemaFactory.java @@ -0,0 +1,210 @@ +package com.thaiopensource.relaxng; + +import com.thaiopensource.validate.auto.AutoSchemaReader; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.Flag; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.rng.RngProperty; +import org.relaxng.datatype.DatatypeLibraryFactory; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import java.io.IOException; + +/** + * A factory for RELAX NG schemas. The factory creates Schema objects from their + * XML representation. + * + * A single SchemaFactory is not safe for concurrent + * access by multiple threads; it must be accessed by at most one thread at a time. + * Schemas can be created concurrently by using a distinct SchemaFactory for each + * thread. However, the Schema objects created are safe for concurrent + * access by multiple threads. + * + * @author James Clark + */ +public class SchemaFactory { + private PropertyMapBuilder properties = new PropertyMapBuilder(); + private boolean compactSyntax = false; + private SchemaReader autoSchemaLanguage = new AutoSchemaReader(); + + /** + * Constructs a schema factory. + */ + public SchemaFactory() { + } + + /** + * Creates a schema by parsing an XML document. A non-null XMLReaderCreator must be specified + * with setXMLReaderCreator before calling createSchema. The ErrorHandler + * is allowed to be null. The DatatypeLibraryFactory is allowed to be null. + * + *

Normally, if a schema cannot be created, createSchema will throw + * a IncorrectSchemaException; however, + * before doing so, one or more errors will be reported using the ErrorHandler if it is non-null. If the + * ErrorHandler throws a SAXException, then createSchema will pass this + * through rather than throwing a IncorrectSchemaException. Similarly, if XMLReader.parse + * throws a SAXException or IOException, then createSchema will pass + * this through rather than throwing a IncorrectSchemaException. Thus, if an error handler + * is specified that reports errors to the user, there is no need to report any additional message to the + * user if createSchema throws IncorrectSchemaException. + * + * @param in the InputSource containing the XML document to be parsed; + * must not be null + * @return the Schema constructed from the XML document; + * never null. + * + * @throws IOException if an I/O error occurs + * @throws SAXException if there is an XML parsing error and the XMLReader or ErrorHandler + * throws a SAXException + * @throws com.thaiopensource.validate.IncorrectSchemaException if the XML document was not a correct RELAX NG schema + * @throws NullPointerException if the current XMLReaderCreator is null + */ + public Schema createSchema(InputSource in) throws IOException, SAXException, IncorrectSchemaException { + SchemaReader r = compactSyntax ? CompactSchemaReader.getInstance() : autoSchemaLanguage; + return r.createSchema(in, properties.toPropertyMap()); + } + + /** + * Specifies the XMLReaderCreator to be used for creating XMLReaders for parsing + * the XML document. Because of include and externalRef elements, + * parsing a single RELAX NG may require the creation of multiple more than one XMLReader. + * A non-null XMLReaderCreator must be specified before calling createSchema. + * + * @param xrc the XMLReaderCreator to be used for parsing the XML document containing + * the schema; may be null + * @see #getXMLReaderCreator + */ + public void setXMLReaderCreator(XMLReaderCreator xrc) { + properties.put(ValidateProperty.XML_READER_CREATOR, xrc); + } + + /** + * Returns the current XMLReaderCreator as specified by setXMLReaderCreator. + * If XMLReaderCreator has never been called, then getXMLReaderCreator + * returns null. + * + * @return the XMLReaderCreator that will be used for parsing the XML document containing + * the schema; may be null + * + * @see #setXMLReaderCreator + */ + public XMLReaderCreator getXMLReaderCreator() { + return (XMLReaderCreator)properties.get(ValidateProperty.XML_READER_CREATOR); + } + + /** + * Specifies the ErrorHandler to be used for reporting errors while creating the schema. + * This does not affect the error handler used for validation. + * + * @param eh the ErrorHandler to be used for reporting errors while creating the schema; + * may be null. + * @see #getErrorHandler + */ + public void setErrorHandler(ErrorHandler eh) { + properties.put(ValidateProperty.ERROR_HANDLER, eh); + } + + /** + * Returns the ErrorHandler that will be used for reporting errors while creating the + * schema. If setErrorHandler has not been called for this SchemaFactory, + * then getErrorHandler returns null. + * + * @return the ErrorHandler to be used for reporting errors while creating the schema; + * may be null. + * @see #setErrorHandler + */ + public ErrorHandler getErrorHandler() { + return (ErrorHandler)properties.get(ValidateProperty.ERROR_HANDLER); + } + + /** + * Specifies the DatatypeLibraryFactory to be used for handling datatypes in the schema. + * This also determines how datatypes are handled during validation. If null is + * specified then only the builtin datatypes will be supported. + * + * @param dlf the DatatypeLibraryFactory to be used for handling datatypes in the schema + * @see #getDatatypeLibraryFactory + */ + public void setDatatypeLibraryFactory(DatatypeLibraryFactory dlf) { + properties.put(RngProperty.DATATYPE_LIBRARY_FACTORY, dlf); + } + + /** + * Returns the DatatypeLibraryFactory that will be used for handling datatypes in the + * schema. If setDatatypeLibraryFactory has not been called for this SchemaFactory, + * then getDatatypeLibraryFactory returns null. + * + * @return the DatatypeLibraryFactory to be used for handling datatypes in the schema; + * may be null. + * @see #setDatatypeLibraryFactory + */ + public DatatypeLibraryFactory getDatatypeLibraryFactory() { + return (DatatypeLibraryFactory)properties.get(RngProperty.DATATYPE_LIBRARY_FACTORY); + } + + /** + * Specifies whether to perform checking of ID/IDREF/IDREFS attributes in accordance with + * RELAX NG DTD Compatibility. + * + * @param checkIdIdref true if ID/IDREF/IDREFS checking should be performed; + * false otherwise + * + * @see #getCheckIdIdref + * @see RELAX NG DTD Compatibility + */ + public void setCheckIdIdref(boolean checkIdIdref) { + properties.put(RngProperty.CHECK_ID_IDREF, checkIdIdref ? Flag.PRESENT : null); + } + + /** + * Indicates whether ID/IDREF/IDREFS attributes will be checked in accordance RELAX NG DTD + * Compatibility. If setCheckIdIdref has not been called for this SchemaFactory, + * then getCheckIdref will return false. + * + * @return true if ID/IDREF/IDREFS attributes will be checked; + * false otherwise. + * + * @see #setCheckIdIdref + * @see RELAX NG DTD Compatibility + */ + public boolean getCheckIdIdref() { + return properties.contains(RngProperty.CHECK_ID_IDREF); + } + + /** + * Specifies whether to use the compact syntax to parse the RELAX NG schema rather than the normal XML syntax. + * + * @param compactSyntax true if the compact syntax should be used; false + * if the XML syntax should be used + * @see #getCompactSyntax + */ + public void setCompactSyntax(boolean compactSyntax) { + this.compactSyntax = compactSyntax; + } + + /** + * Indicates whether the compact syntax will be used to parse the RELAX NG schema rather than + * the normal XML syntax. + * + * @return true if the compact syntax will be used; false if the XML + * syntax will be used + */ + public boolean getCompactSyntax() { + return compactSyntax; + } + + public void setFeasible(boolean feasible) { + properties.put(RngProperty.FEASIBLE, feasible ? Flag.PRESENT : null); + } + + public boolean getFeasible() { + return properties.contains(RngProperty.FEASIBLE); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AbstractPatternFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AbstractPatternFunction.java new file mode 100644 index 0000000..3b11847 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AbstractPatternFunction.java @@ -0,0 +1,69 @@ +package com.thaiopensource.relaxng.impl; + +abstract class AbstractPatternFunction implements PatternFunction { + public Object caseEmpty(EmptyPattern p) { + return caseOther(p); + } + + public Object caseNotAllowed(NotAllowedPattern p) { + return caseOther(p); + } + + public Object caseError(ErrorPattern p) { + return caseOther(p); + } + + public Object caseGroup(GroupPattern p) { + return caseOther(p); + } + + public Object caseInterleave(InterleavePattern p) { + return caseOther(p); + } + + public Object caseChoice(ChoicePattern p) { + return caseOther(p); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + return caseOther(p); + } + + public Object caseElement(ElementPattern p) { + return caseOther(p); + } + + public Object caseAttribute(AttributePattern p) { + return caseOther(p); + } + + public Object caseData(DataPattern p) { + return caseOther(p); + } + + public Object caseDataExcept(DataExceptPattern p) { + return caseOther(p); + } + + public Object caseValue(ValuePattern p) { + return caseOther(p); + } + + public Object caseText(TextPattern p) { + return caseOther(p); + } + + public Object caseList(ListPattern p) { + return caseOther(p); + } + + public Object caseAfter(AfterPattern p) { + return caseOther(p); + } + + public Object caseRef(RefPattern p) { + return caseOther(p); + } + + public abstract Object caseOther(Pattern p); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AfterPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AfterPattern.java new file mode 100644 index 0000000..eb4ef2c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AfterPattern.java @@ -0,0 +1,22 @@ +package com.thaiopensource.relaxng.impl; + + +class AfterPattern extends BinaryPattern { + AfterPattern(Pattern p1, Pattern p2) { + super(false, + combineHashCode(AFTER_HASH_CODE, p1.hashCode(), p2.hashCode()), + p1, + p2); + } + + boolean isNotAllowed() { + return p1.isNotAllowed(); + } + + Object apply(PatternFunction f) { + return f.caseAfter(this); + } + void accept(PatternVisitor visitor) { + // XXX visitor.visitAfter(p1, p2); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Alphabet.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Alphabet.java new file mode 100644 index 0000000..ffd728a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Alphabet.java @@ -0,0 +1,27 @@ +package com.thaiopensource.relaxng.impl; + +class Alphabet { + private NameClass nameClass; + + boolean isEmpty() { + return nameClass == null; + } + + void addElement(NameClass nc) { + if (nameClass == null) + nameClass = nc; + else if (nc != null) + nameClass = new ChoiceNameClass(nameClass, nc); + } + + void addAlphabet(Alphabet a) { + addElement(a.nameClass); + } + + void checkOverlap(Alphabet a) throws RestrictionViolationException { + if (nameClass != null + && a.nameClass != null + && OverlapDetector.overlap(nameClass, a.nameClass)) + throw new RestrictionViolationException("interleave_element_overlap"); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameClass.java new file mode 100644 index 0000000..b2c3a9a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameClass.java @@ -0,0 +1,30 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class AnyNameClass implements NameClass { + + public boolean contains(Name name) { + return true; + } + + public int containsSpecificity(Name name) { + return SPECIFICITY_ANY_NAME; + } + + public boolean equals(Object obj) { + return obj != null && obj instanceof AnyNameClass; + } + + public int hashCode() { + return AnyNameClass.class.hashCode(); + } + + public void accept(NameClassVisitor visitor) { + visitor.visitAnyName(); + } + + public boolean isOpen() { + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.java new file mode 100644 index 0000000..c64897d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AnyNameExceptNameClass.java @@ -0,0 +1,38 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class AnyNameExceptNameClass implements NameClass { + + private final NameClass nameClass; + + AnyNameExceptNameClass(NameClass nameClass) { + this.nameClass = nameClass; + } + + public boolean contains(Name name) { + return !nameClass.contains(name); + } + + public int containsSpecificity(Name name) { + return contains(name) ? SPECIFICITY_ANY_NAME : SPECIFICITY_NONE; + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof AnyNameExceptNameClass)) + return false; + return nameClass.equals(((AnyNameExceptNameClass)obj).nameClass); + } + + public int hashCode() { + return ~nameClass.hashCode(); + } + + public void accept(NameClassVisitor visitor) { + visitor.visitAnyNameExcept(nameClass); + } + + public boolean isOpen() { + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ApplyAfterFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ApplyAfterFunction.java new file mode 100644 index 0000000..605207f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ApplyAfterFunction.java @@ -0,0 +1,28 @@ +package com.thaiopensource.relaxng.impl; + +abstract class ApplyAfterFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + + ApplyAfterFunction(ValidatorPatternBuilder builder) { + this.builder = builder; + } + + public Object caseAfter(AfterPattern p) { + return builder.makeAfter(p.getOperand1(), apply(p.getOperand2())); + } + + public Object caseChoice(ChoicePattern p) { + return builder.makeChoice(p.getOperand1().applyForPattern(this), + p.getOperand2().applyForPattern(this)); + } + + public Object caseNotAllowed(NotAllowedPattern p) { + return p; + } + + public Object caseOther(Pattern p) { + throw new RuntimeException("apply after botch"); + } + + abstract Pattern apply(Pattern p); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.java new file mode 100644 index 0000000..d0f6ec8 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributeNameClassChecker.java @@ -0,0 +1,45 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.WellKnownNamespaces; +import com.thaiopensource.xml.util.Name; + +class AttributeNameClassChecker implements NameClassVisitor { + private String errorMessageId = null; + + public void visitChoice(NameClass nc1, NameClass nc2) { + nc1.accept(this); + nc2.accept(this); + } + + public void visitNsName(String ns) { + if (ns.equals(WellKnownNamespaces.XMLNS)) + errorMessageId = "xmlns_uri_attribute"; + } + + public void visitNsNameExcept(String ns, NameClass nc) { + visitNsName(ns); + nc.accept(this); + } + + public void visitAnyName() { } + + public void visitAnyNameExcept(NameClass nc) { + nc.accept(this); + } + + public void visitName(Name name) { + visitNsName(name.getNamespaceUri()); + if (name.equals(new Name("", "xmlns"))) + errorMessageId = "xmlns_attribute"; + } + + public void visitNull() { } + + public void visitError() { } + + String checkNameClass(NameClass nc) { + errorMessageId = null; + nc.accept(this); + return errorMessageId; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributePattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributePattern.java new file mode 100644 index 0000000..a0bb719 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/AttributePattern.java @@ -0,0 +1,95 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +class AttributePattern extends Pattern { + private final NameClass nameClass; + private final Pattern p; + private final Locator loc; + + AttributePattern(NameClass nameClass, Pattern value, Locator loc) { + super(false, + EMPTY_CONTENT_TYPE, + combineHashCode(ATTRIBUTE_HASH_CODE, + nameClass.hashCode(), + value.hashCode())); + this.nameClass = nameClass; + this.p = value; + this.loc = loc; + } + + Pattern expand(SchemaPatternBuilder b) { + Pattern ep = p.expand(b); + if (ep != p) + return b.makeAttribute(nameClass, ep, loc); + else + return this; + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_attribute"); + case ELEMENT_CONTEXT: + if (nameClass.isOpen()) + throw new RestrictionViolationException("open_name_class_not_repeated"); + break; + case ELEMENT_REPEAT_GROUP_CONTEXT: + throw new RestrictionViolationException("one_or_more_contains_group_contains_attribute"); + case ELEMENT_REPEAT_INTERLEAVE_CONTEXT: + throw new RestrictionViolationException("one_or_more_contains_interleave_contains_attribute"); + case LIST_CONTEXT: + throw new RestrictionViolationException("list_contains_attribute"); + case ATTRIBUTE_CONTEXT: + throw new RestrictionViolationException("attribute_contains_attribute"); + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_attribute"); + } + if (!dad.addAttribute(nameClass)) { + if (nameClass instanceof SimpleNameClass) + throw new RestrictionViolationException("duplicate_attribute_detail", ((SimpleNameClass)nameClass).getName()); + else + throw new RestrictionViolationException("duplicate_attribute"); + } + try { + p.checkRestrictions(ATTRIBUTE_CONTEXT, null, null); + } + catch (RestrictionViolationException e) { + e.maybeSetLocator(loc); + throw e; + } + } + + boolean samePattern(Pattern other) { + if (!(other instanceof AttributePattern)) + return false; + AttributePattern ap = (AttributePattern)other; + return nameClass.equals(ap.nameClass)&& p == ap.p; + } + + void checkRecursion(int depth) throws SAXException { + p.checkRecursion(depth); + } + + void accept(PatternVisitor visitor) { + visitor.visitAttribute(nameClass, p); + } + + Object apply(PatternFunction f) { + return f.caseAttribute(this); + } + + Pattern getContent() { + return p; + } + + NameClass getNameClass() { + return nameClass; + } + + Locator getLocator() { + return loc; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BinaryPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BinaryPattern.java new file mode 100644 index 0000000..3caea04 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BinaryPattern.java @@ -0,0 +1,40 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.SAXException; + +abstract class BinaryPattern extends Pattern { + final Pattern p1; + final Pattern p2; + + BinaryPattern(boolean nullable, int hc, Pattern p1, Pattern p2) { + super(nullable, Math.max(p1.getContentType(), p2.getContentType()), hc); + this.p1 = p1; + this.p2 = p2; + } + + void checkRecursion(int depth) throws SAXException { + p1.checkRecursion(depth); + p2.checkRecursion(depth); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + p1.checkRestrictions(context, dad, alpha); + p2.checkRestrictions(context, dad, alpha); + } + + boolean samePattern(Pattern other) { + if (getClass() != other.getClass()) + return false; + BinaryPattern b = (BinaryPattern)other; + return p1 == b.p1 && p2 == b.p2; + } + + Pattern getOperand1() { + return p1; + } + + Pattern getOperand2() { + return p2; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BlankDataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BlankDataDerivType.java new file mode 100644 index 0000000..36fe7c9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BlankDataDerivType.java @@ -0,0 +1,33 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.ValidationContext; + +class BlankDataDerivType extends DataDerivType { + private PatternMemo blankMemo; + private PatternMemo nonBlankMemo; + + BlankDataDerivType() { } + + PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { + if (DataDerivFunction.isBlank(str)) { + if (blankMemo == null) + blankMemo = super.dataDeriv(builder, p, str, vc); + return blankMemo; + } + else { + if (nonBlankMemo == null) + nonBlankMemo = super.dataDeriv(builder, p, str, vc); + return nonBlankMemo; + } + } + + DataDerivType copy() { + return new BlankDataDerivType(); + } + + DataDerivType combine(DataDerivType ddt) { + if (ddt instanceof BlankDataDerivType || ddt instanceof SingleDataDerivType) + return this; + return InconsistentDataDerivType.getInstance(); + } +} \ No newline at end of file diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.java new file mode 100644 index 0000000..f4f1386 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeBuilder.java @@ -0,0 +1,24 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeBuilder; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.ValidationContext; + +class BuiltinDatatypeBuilder implements DatatypeBuilder { + private final Datatype dt; + + BuiltinDatatypeBuilder(Datatype dt) { + this.dt = dt; + } + + public void addParameter(String name, + String value, + ValidationContext context) throws DatatypeException { + throw new DatatypeException(SchemaBuilderImpl.localizer.message("builtin_param")); + } + + public Datatype createDatatype() { + return dt; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.java new file mode 100644 index 0000000..020ed42 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibrary.java @@ -0,0 +1,24 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeBuilder; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.DatatypeLibrary; + +public class BuiltinDatatypeLibrary implements DatatypeLibrary { + private final DatatypeBuilder tokenDatatypeBuilder + = new BuiltinDatatypeBuilder(new TokenDatatype()); + private final DatatypeBuilder stringDatatypeBuilder + = new BuiltinDatatypeBuilder(new StringDatatype()); + public DatatypeBuilder createDatatypeBuilder(String type) + throws DatatypeException { + if (type.equals("token")) + return tokenDatatypeBuilder; + else if (type.equals("string")) + return stringDatatypeBuilder; + throw new DatatypeException(); + } + public Datatype createDatatype(String type) throws DatatypeException { + return createDatatypeBuilder(type).createDatatype(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.java new file mode 100644 index 0000000..0b0891c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/BuiltinDatatypeLibraryFactory.java @@ -0,0 +1,41 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.DatatypeLibrary; +import org.relaxng.datatype.DatatypeLibraryFactory; + +import java.util.Hashtable; + +import com.thaiopensource.xml.util.WellKnownNamespaces; + +class BuiltinDatatypeLibraryFactory implements DatatypeLibraryFactory { + private final Hashtable cache = new Hashtable(); + private final DatatypeLibraryFactory factory; + private final DatatypeLibrary builtinDatatypeLibrary + = new BuiltinDatatypeLibrary(); + private DatatypeLibrary lastDatatypeLibrary = null; + private String lastDatatypeLibraryUri = null; + + BuiltinDatatypeLibraryFactory(DatatypeLibraryFactory factory) { + this.factory = factory; + cache.put(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_DATATYPES, + new CompatibilityDatatypeLibrary(this)); + } + + public DatatypeLibrary createDatatypeLibrary(String uri) { + if (uri.equals("")) + return builtinDatatypeLibrary; + if (uri.equals(lastDatatypeLibraryUri)) + return lastDatatypeLibrary; + DatatypeLibrary library = (DatatypeLibrary)cache.get(uri); + if (library == null) { + if (factory == null) + return null; + library = factory.createDatatypeLibrary(uri); + if (library == null) + return null; + cache.put(uri, library); + } + lastDatatypeLibraryUri = uri; + return lastDatatypeLibrary = library; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoiceNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoiceNameClass.java new file mode 100644 index 0000000..3c1576b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoiceNameClass.java @@ -0,0 +1,44 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class ChoiceNameClass implements NameClass { + + private final NameClass nameClass1; + private final NameClass nameClass2; + + ChoiceNameClass(NameClass nameClass1, NameClass nameClass2) { + this.nameClass1 = nameClass1; + this.nameClass2 = nameClass2; + } + + public boolean contains(Name name) { + return (nameClass1.contains(name) + || nameClass2.contains(name)); + } + + public int containsSpecificity(Name name) { + return Math.max(nameClass1.containsSpecificity(name), + nameClass2.containsSpecificity(name)); + } + + public int hashCode() { + return nameClass1.hashCode() ^ nameClass2.hashCode(); + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof ChoiceNameClass)) + return false; + ChoiceNameClass other = (ChoiceNameClass)obj; + return (nameClass1.equals(other.nameClass1) + && nameClass2.equals(other.nameClass2)); + } + + public void accept(NameClassVisitor visitor) { + visitor.visitChoice(nameClass1, nameClass2); + } + + public boolean isOpen() { + return nameClass1.isOpen() || nameClass2.isOpen(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoicePattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoicePattern.java new file mode 100644 index 0000000..570ff60 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ChoicePattern.java @@ -0,0 +1,44 @@ +package com.thaiopensource.relaxng.impl; + +class ChoicePattern extends BinaryPattern { + ChoicePattern(Pattern p1, Pattern p2) { + super(p1.isNullable() || p2.isNullable(), + combineHashCode(CHOICE_HASH_CODE, p1.hashCode(), p2.hashCode()), + p1, + p2); + } + Pattern expand(SchemaPatternBuilder b) { + Pattern ep1 = p1.expand(b); + Pattern ep2 = p2.expand(b); + if (ep1 != p1 || ep2 != p2) + return b.makeChoice(ep1, ep2); + else + return this; + } + + boolean containsChoice(Pattern p) { + return p1.containsChoice(p) || p2.containsChoice(p); + } + + void accept(PatternVisitor visitor) { + visitor.visitChoice(p1, p2); + } + + Object apply(PatternFunction f) { + return f.caseChoice(this); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + if (dad != null) + dad.startChoice(); + p1.checkRestrictions(context, dad, alpha); + if (dad != null) + dad.alternative(); + p2.checkRestrictions(context, dad, alpha); + if (dad != null) + dad.endChoice(); + } + +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineSchema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineSchema.java new file mode 100644 index 0000000..978424a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineSchema.java @@ -0,0 +1,22 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.Validator; + +public class CombineSchema extends AbstractSchema { + private final Schema schema1; + private final Schema schema2; + + public CombineSchema(Schema schema1, Schema schema2, PropertyMap properties) { + super(properties); + this.schema1 = schema1; + this.schema2 = schema2; + } + + public Validator createValidator(PropertyMap properties) { + return new CombineValidator(schema1.createValidator(properties), + schema2.createValidator(properties)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineValidator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineValidator.java new file mode 100644 index 0000000..d0751b8 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CombineValidator.java @@ -0,0 +1,49 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.xml.sax.ForkContentHandler; +import com.thaiopensource.xml.sax.ForkDTDHandler; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; + +public class CombineValidator implements Validator { + private final Validator v1; + private final Validator v2; + private ContentHandler contentHandler; + private DTDHandler dtdHandler; + + public CombineValidator(Validator v1, Validator v2) { + this.v1 = v1; + this.v2 = v2; + createHandlers(); + } + + public void reset() { + v1.reset(); + v2.reset(); + createHandlers(); + } + + public ContentHandler getContentHandler() { + return contentHandler; + } + + public DTDHandler getDTDHandler() { + return dtdHandler; + } + + private void createHandlers() { + contentHandler = new ForkContentHandler(v1.getContentHandler(), + v2.getContentHandler()); + DTDHandler d1 = v1.getDTDHandler(); + DTDHandler d2 = v2.getDTDHandler(); + if (d1 != null && d2 != null) + dtdHandler = new ForkDTDHandler(d1, d2); + else if (d1 != null) + dtdHandler = d1; + else if (d2 != null) + dtdHandler = d2; + else + dtdHandler = null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.java new file mode 100644 index 0000000..eb44294 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/CompatibilityDatatypeLibrary.java @@ -0,0 +1,34 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeBuilder; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.DatatypeLibrary; +import org.relaxng.datatype.DatatypeLibraryFactory; +import com.thaiopensource.xml.util.WellKnownNamespaces; + +class CompatibilityDatatypeLibrary implements DatatypeLibrary { + private final DatatypeLibraryFactory factory; + private DatatypeLibrary xsdDatatypeLibrary = null; + + CompatibilityDatatypeLibrary(DatatypeLibraryFactory factory) { + this.factory = factory; + } + + public DatatypeBuilder createDatatypeBuilder(String type) + throws DatatypeException { + if (type.equals("ID") || type.equals("IDREF") || type.equals("IDREFS")) { + if (xsdDatatypeLibrary == null) { + xsdDatatypeLibrary = factory.createDatatypeLibrary(WellKnownNamespaces.XML_SCHEMA_DATATYPES); + if (xsdDatatypeLibrary == null) + throw new DatatypeException(); + } + return xsdDatatypeLibrary.createDatatypeBuilder(type); + } + throw new DatatypeException(); + } + + public Datatype createDatatype(String type) throws DatatypeException { + return createDatatypeBuilder(type).createDatatype(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDataDerivType.java new file mode 100644 index 0000000..a010e96 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDataDerivType.java @@ -0,0 +1,45 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.ValidationContext; + +class DataDataDerivType extends DataDerivType { + private final Datatype dt; + private PatternMemo validMemo; + private PatternMemo invalidMemo; + + DataDataDerivType(Datatype dt) { + this.dt = dt; + } + + PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { + if (dt.isValid(str, vc)) { + if (validMemo == null) + validMemo = super.dataDeriv(builder, p, str, vc); + return validMemo; + } + else { + if (invalidMemo == null) + invalidMemo = super.dataDeriv(builder, p, str, vc); + return invalidMemo; + } + } + + DataDerivType copy() { + return new DataDataDerivType(dt); + } + + DataDerivType combine(DataDerivType ddt) { + if (ddt instanceof DataDataDerivType) { + if (((DataDataDerivType)ddt).dt == dt) + return this; + return InconsistentDataDerivType.getInstance(); + } + if (ddt instanceof ValueDataDerivType) { + if (((ValueDataDerivType)ddt).getDatatype() == dt) + return ddt; + return InconsistentDataDerivType.getInstance(); + } + return ddt.combine(this); + } +} \ No newline at end of file diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivFunction.java new file mode 100644 index 0000000..eb9c541 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivFunction.java @@ -0,0 +1,135 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.ValidationContext; + +class DataDerivFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + private final ValidationContext vc; + private final String str; + + DataDerivFunction(String str, ValidationContext vc, ValidatorPatternBuilder builder) { + this.str = str; + this.vc = vc; + this.builder = builder; + } + + static boolean isBlank(String str) { + int len = str.length(); + for (int i = 0; i < len; i++) { + switch (str.charAt(i)) { + case '\r': + case '\n': + case ' ': + case '\t': + break; + default: + return false; + } + } + return true; + } + + public Object caseText(TextPattern p) { + return p; + } + + public Object caseList(ListPattern p) { + int len = str.length(); + int tokenStart = -1; + PatternMemo memo = builder.getPatternMemo(p.getOperand()); + for (int i = 0; i < len; i++) { + switch (str.charAt(i)) { + case '\r': + case '\n': + case ' ': + case '\t': + if (tokenStart >= 0) { + memo = tokenDeriv(memo, tokenStart, i); + tokenStart = -1; + } + break; + default: + if (tokenStart < 0) + tokenStart = i; + break; + } + } + if (tokenStart >= 0) + memo = tokenDeriv(memo, tokenStart, len); + if (memo.getPattern().isNullable()) + return builder.makeEmpty(); + else + return builder.makeNotAllowed(); + } + + private PatternMemo tokenDeriv(PatternMemo p, int i, int j) { + return p.dataDeriv(str.substring(i, j), vc); + } + + public Object caseValue(ValuePattern p) { + Datatype dt = p.getDatatype(); + Object value = dt.createValue(str, vc); + if (value != null && dt.sameValue(p.getValue(), value)) + return builder.makeEmpty(); + else + return builder.makeNotAllowed(); + } + + public Object caseData(DataPattern p) { + if (p.allowsAnyString()) + return builder.makeEmpty(); + if (p.getDatatype().isValid(str, vc)) + return builder.makeEmpty(); + else + return builder.makeNotAllowed(); + } + + public Object caseDataExcept(DataExceptPattern p) { + Pattern tem = (Pattern)caseData(p); + if (tem.isNullable() && memoApply(p.getExcept()).isNullable()) + return builder.makeNotAllowed(); + return tem; + } + + public Object caseAfter(AfterPattern p) { + Pattern p1 = p.getOperand1(); + if (memoApply(p1).isNullable() || (p1.isNullable() && isBlank(str))) + return p.getOperand2(); + return builder.makeNotAllowed(); + } + + public Object caseChoice(ChoicePattern p) { + return builder.makeChoice(memoApply(p.getOperand1()), + memoApply(p.getOperand2())); + } + + public Object caseGroup(GroupPattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + Pattern tem = builder.makeGroup(memoApply(p1), p2); + if (!p1.isNullable()) + return tem; + return builder.makeChoice(tem, memoApply(p2)); + } + + public Object caseInterleave(InterleavePattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + return builder.makeChoice(builder.makeInterleave(memoApply(p1), p2), + builder.makeInterleave(p1, memoApply(p2))); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + return builder.makeGroup(memoApply(p.getOperand()), + builder.makeOptional(p)); + } + + public Object caseOther(Pattern p) { + return builder.makeNotAllowed(); + } + + private Pattern memoApply(Pattern p) { + return builder.getPatternMemo(p).dataDeriv(str, vc).getPattern(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivType.java new file mode 100644 index 0000000..573f86b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivType.java @@ -0,0 +1,11 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.ValidationContext; + +abstract class DataDerivType { + abstract DataDerivType copy(); + abstract DataDerivType combine(DataDerivType ddt); + PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { + return builder.getPatternMemo(p.applyForPattern(new DataDerivFunction(str, vc, builder))); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.java new file mode 100644 index 0000000..5597088 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataDerivTypeFunction.java @@ -0,0 +1,69 @@ +package com.thaiopensource.relaxng.impl; + +class DataDerivTypeFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + + DataDerivTypeFunction(ValidatorPatternBuilder builder) { + this.builder = builder; + } + + static DataDerivType dataDerivType(ValidatorPatternBuilder builder, Pattern pattern) { + return (DataDerivType)pattern.apply(builder.getDataDerivTypeFunction()); + } + + public Object caseOther(Pattern p) { + return new SingleDataDerivType(); + } + + public Object caseAfter(AfterPattern p) { + Pattern p1 = p.getOperand1(); + DataDerivType ddt = apply(p.getOperand1()); + if (!p1.isNullable()) + return ddt; + return ddt.combine(new BlankDataDerivType()); + } + + private Object caseBinary(BinaryPattern p) { + return apply(p.getOperand1()).combine(apply(p.getOperand2())); + } + + public Object caseChoice(ChoicePattern p) { + return caseBinary(p); + } + + public Object caseGroup(GroupPattern p) { + return caseBinary(p); + } + + public Object caseInterleave(InterleavePattern p) { + return caseBinary(p); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + return apply(p.getOperand()); + } + + public Object caseList(ListPattern p) { + return InconsistentDataDerivType.getInstance(); + } + + public Object caseValue(ValuePattern p) { + return new ValueDataDerivType(p.getDatatype()); + } + + public Object caseData(DataPattern p) { + if (p.allowsAnyString()) + return new SingleDataDerivType(); + return new DataDataDerivType(p.getDatatype()); + } + + public Object caseDataExcept(DataExceptPattern p) { + if (p.allowsAnyString()) + return apply(p.getExcept()); + return new DataDataDerivType(p.getDatatype()).combine(apply(p.getExcept())); + } + + private DataDerivType apply(Pattern p) { + return builder.getPatternMemo(p).dataDerivType(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataExceptPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataExceptPattern.java new file mode 100644 index 0000000..942278a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataExceptPattern.java @@ -0,0 +1,45 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.xml.sax.Locator; + +class DataExceptPattern extends DataPattern { + private final Pattern except; + private final Locator loc; + + DataExceptPattern(Datatype dt, Pattern except, Locator loc) { + super(dt); + this.except = except; + this.loc = loc; + } + + boolean samePattern(Pattern other) { + if (!super.samePattern(other)) + return false; + return except.samePattern(((DataExceptPattern)other).except); + } + + void accept(PatternVisitor visitor) { + visitor.visitDataExcept(getDatatype(), except); + } + + Object apply(PatternFunction f) { + return f.caseDataExcept(this); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + super.checkRestrictions(context, dad, alpha); + try { + except.checkRestrictions(DATA_EXCEPT_CONTEXT, null, null); + } + catch (RestrictionViolationException e) { + e.maybeSetLocator(loc); + throw e; + } + } + + Pattern getExcept() { + return except; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataPattern.java new file mode 100644 index 0000000..c43aef9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DataPattern.java @@ -0,0 +1,43 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.datatype.Datatype2; +import org.relaxng.datatype.Datatype; + +class DataPattern extends StringPattern { + private final Datatype dt; + + DataPattern(Datatype dt) { + super(combineHashCode(DATA_HASH_CODE, dt.hashCode())); + this.dt = dt; + } + + boolean samePattern(Pattern other) { + if (other.getClass() != this.getClass()) + return false; + return dt.equals(((DataPattern)other).dt); + } + + void accept(PatternVisitor visitor) { + visitor.visitData(dt); + } + + Object apply(PatternFunction f) { + return f.caseData(this); + } + + Datatype getDatatype() { + return dt; + } + + boolean allowsAnyString() { + return dt instanceof Datatype2 && ((Datatype2)dt).alwaysValid(); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_data"); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DatatypeValue.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DatatypeValue.java new file mode 100644 index 0000000..3f53ae3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DatatypeValue.java @@ -0,0 +1,26 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; + +class DatatypeValue { + private final Object value; + private final Datatype dt; + + DatatypeValue(Object value, Datatype dt) { + this.value = value; + this.dt = dt; + } + + public int hashCode() { + return dt.hashCode() ^ dt.valueHashCode(value); + } + + public boolean equals(Object obj) { + if (!(obj instanceof DatatypeValue)) + return false; + DatatypeValue other = (DatatypeValue)obj; + if (other.dt != dt) + return false; + return dt.sameValue(value, other.value); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.java new file mode 100644 index 0000000..010e293 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/DuplicateAttributeDetector.java @@ -0,0 +1,48 @@ +package com.thaiopensource.relaxng.impl; + +import java.util.Vector; + +class DuplicateAttributeDetector { + private final Vector nameClasses = new Vector(); + private Alternative alternatives = null; + + private static class Alternative { + private final int startIndex; + private int endIndex; + private final Alternative parent; + + private Alternative(int startIndex, Alternative parent) { + this.startIndex = startIndex; + this.endIndex = startIndex; + this.parent = parent; + } + } + + boolean addAttribute(NameClass nc) { + int lim = nameClasses.size(); + for (Alternative a = alternatives; a != null; a = a.parent) { + for (int i = a.endIndex; i < lim; i++) + if (OverlapDetector.overlap(nc, (NameClass)nameClasses.elementAt(i))) + return false; + lim = a.startIndex; + } + for (int i = 0; i < lim; i++) + if (OverlapDetector.overlap(nc, (NameClass)nameClasses.elementAt(i))) + return false; + nameClasses.addElement(nc); + return true; + } + + void startChoice() { + alternatives = new Alternative(nameClasses.size(), alternatives); + } + + void alternative() { + alternatives.endIndex = nameClasses.size(); + } + + void endChoice() { + alternatives = alternatives.parent; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ElementPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ElementPattern.java new file mode 100644 index 0000000..354c5a1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ElementPattern.java @@ -0,0 +1,95 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +class ElementPattern extends Pattern { + private Pattern p; + private final NameClass origNameClass; + private NameClass nameClass; + private boolean expanded = false; + private boolean checkedRestrictions = false; + private final Locator loc; + + ElementPattern(NameClass nameClass, Pattern p, Locator loc) { + super(false, + ELEMENT_CONTENT_TYPE, + combineHashCode(ELEMENT_HASH_CODE, + nameClass.hashCode(), + p.hashCode())); + this.nameClass = nameClass; + this.origNameClass = nameClass; + this.p = p; + this.loc = loc; + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + if (alpha != null) + alpha.addElement(origNameClass); + if (checkedRestrictions) + return; + switch (context) { + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_element"); + case LIST_CONTEXT: + throw new RestrictionViolationException("list_contains_element"); + case ATTRIBUTE_CONTEXT: + throw new RestrictionViolationException("attribute_contains_element"); + } + checkedRestrictions = true; + try { + p.checkRestrictions(ELEMENT_CONTEXT, new DuplicateAttributeDetector(), null); + } + catch (RestrictionViolationException e) { + checkedRestrictions = false; + e.maybeSetLocator(loc); + throw e; + } + } + + Pattern expand(SchemaPatternBuilder b) { + if (!expanded) { + expanded = true; + p = p.expand(b); + if (p.isNotAllowed()) + nameClass = new NullNameClass(); + } + return this; + } + + boolean samePattern(Pattern other) { + if (!(other instanceof ElementPattern)) + return false; + ElementPattern ep = (ElementPattern)other; + return nameClass.equals(ep.nameClass) && p == ep.p; + } + + void checkRecursion(int depth) throws SAXException { + p.checkRecursion(depth + 1); + } + + void accept(PatternVisitor visitor) { + visitor.visitElement(nameClass, p); + } + + Object apply(PatternFunction f) { + return f.caseElement(this); + } + + void setContent(Pattern p) { + this.p = p; + } + + Pattern getContent() { + return p; + } + + NameClass getNameClass() { + return nameClass; + } + + Locator getLocator() { + return loc; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EmptyPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EmptyPattern.java new file mode 100644 index 0000000..a54f65c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EmptyPattern.java @@ -0,0 +1,25 @@ +package com.thaiopensource.relaxng.impl; + +class EmptyPattern extends Pattern { + EmptyPattern() { + super(true, EMPTY_CONTENT_TYPE, EMPTY_HASH_CODE); + } + boolean samePattern(Pattern other) { + return other instanceof EmptyPattern; + } + void accept(PatternVisitor visitor) { + visitor.visitEmpty(); + } + Object apply(PatternFunction f) { + return f.caseEmpty(this); + } + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_empty"); + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_empty"); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndAttributesFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndAttributesFunction.java new file mode 100644 index 0000000..5bb5912 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndAttributesFunction.java @@ -0,0 +1,75 @@ +package com.thaiopensource.relaxng.impl; + +class EndAttributesFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + + EndAttributesFunction(ValidatorPatternBuilder builder) { + this.builder = builder; + } + + public Object caseOther(Pattern p) { + return p; + } + + public Object caseGroup(GroupPattern p) { + Pattern p1 = p.getOperand1(); + Pattern p2 = p.getOperand2(); + Pattern q1 = memoApply(p1); + Pattern q2 = memoApply(p2); + if (p1 == q1 && p2 == q2) + return p; + return builder.makeGroup(q1, q2); + } + + public Object caseInterleave(InterleavePattern p) { + Pattern p1 = p.getOperand1(); + Pattern p2 = p.getOperand2(); + Pattern q1 = memoApply(p1); + Pattern q2 = memoApply(p2); + if (p1 == q1 && p2 == q2) + return p; + return builder.makeInterleave(q1, q2); + } + + public Object caseChoice(ChoicePattern p) { + Pattern p1 = p.getOperand1(); + Pattern p2 = p.getOperand2(); + Pattern q1 = memoApply(p1); + Pattern q2 = memoApply(p2); + if (p1 == q1 && p2 == q2) + return p; + return builder.makeChoice(q1, q2); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + Pattern p1 = p.getOperand(); + Pattern q1 = memoApply(p1); + if (p1 == q1) + return p; + return builder.makeOneOrMore(p1); + } + + public Object caseAfter(AfterPattern p) { + Pattern p1 = p.getOperand1(); + Pattern q1 = memoApply(p1); + if (p1 == q1) + return p; + return builder.makeAfter(q1, p.getOperand2()); + } + + public Object caseAttribute(AttributePattern p) { + return builder.makeNotAllowed(); + } + + final Pattern memoApply(Pattern p) { + return apply(builder.getPatternMemo(p)).getPattern(); + } + + PatternMemo apply(PatternMemo memo) { + return memo.endAttributes(this); + } + + ValidatorPatternBuilder getPatternBuilder() { + return builder; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndTagDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndTagDerivFunction.java new file mode 100644 index 0000000..21898ff --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/EndTagDerivFunction.java @@ -0,0 +1,33 @@ +package com.thaiopensource.relaxng.impl; + +class EndTagDerivFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + + EndTagDerivFunction(ValidatorPatternBuilder builder) { + this.builder = builder; + } + + public Object caseOther(Pattern p) { + return builder.makeNotAllowed(); + } + + public Object caseChoice(ChoicePattern p) { + return builder.makeChoice(memoApply(p.getOperand1()), + memoApply(p.getOperand2())); + } + + public Object caseAfter(AfterPattern p) { + if (p.getOperand1().isNullable()) + return p.getOperand2(); + else + return builder.makeNotAllowed(); + } + + final private Pattern memoApply(Pattern p) { + return apply(builder.getPatternMemo(p)).getPattern(); + } + + private PatternMemo apply(PatternMemo memo) { + return memo.endTagDeriv(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorNameClass.java new file mode 100644 index 0000000..6c046fa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorNameClass.java @@ -0,0 +1,21 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class ErrorNameClass implements NameClass { + public boolean contains(Name name) { + return false; + } + + public int containsSpecificity(Name name) { + return SPECIFICITY_NONE; + } + + public void accept(NameClassVisitor visitor) { + visitor.visitError(); + } + + public boolean isOpen() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorPattern.java new file mode 100644 index 0000000..2dec229 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ErrorPattern.java @@ -0,0 +1,16 @@ +package com.thaiopensource.relaxng.impl; + +class ErrorPattern extends Pattern { + ErrorPattern() { + super(false, EMPTY_CONTENT_TYPE, ERROR_HASH_CODE); + } + boolean samePattern(Pattern other) { + return other instanceof ErrorPattern; + } + void accept(PatternVisitor visitor) { + visitor.visitError(); + } + Object apply(PatternFunction f) { + return f.caseError(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.java new file mode 100644 index 0000000..a909a44 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdSoundnessChecker.java @@ -0,0 +1,14 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; + +public class FeasibleIdSoundnessChecker extends IdSoundnessChecker { + public FeasibleIdSoundnessChecker(IdTypeMap idTypeMap, ErrorHandler eh) { + super(idTypeMap, eh); + } + + public void endDocument() { + setComplete(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.java new file mode 100644 index 0000000..6a9c15e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleIdTypeMapSchema.java @@ -0,0 +1,21 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import org.xml.sax.ErrorHandler; + +public class FeasibleIdTypeMapSchema extends AbstractSchema { + private final IdTypeMap idTypeMap; + + public FeasibleIdTypeMapSchema(IdTypeMap idTypeMap, PropertyMap properties) { + super(properties); + this.idTypeMap = idTypeMap; + } + + public Validator createValidator(PropertyMap properties) { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + return new FeasibleIdSoundnessChecker(idTypeMap, eh); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleTransform.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleTransform.java new file mode 100644 index 0000000..2d366fb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FeasibleTransform.java @@ -0,0 +1,46 @@ +package com.thaiopensource.relaxng.impl; + +import java.util.Hashtable; + +public class FeasibleTransform { + private static class FeasiblePatternFunction extends AbstractPatternFunction { + private final SchemaPatternBuilder spb; + private final Hashtable elementTable = new Hashtable(); + + FeasiblePatternFunction(SchemaPatternBuilder spb) { + this.spb = spb; + } + + public Object caseChoice(ChoicePattern p) { + return spb.makeChoice(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this)); + } + + public Object caseGroup(GroupPattern p) { + return spb.makeGroup(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this)); + } + + public Object caseInterleave(InterleavePattern p) { + return spb.makeInterleave(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this)); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + return spb.makeOneOrMore(p.getOperand().applyForPattern(this)); + } + + public Object caseElement(ElementPattern p) { + if (elementTable.get(p) == null) { + elementTable.put(p, p); + p.setContent(p.getContent().applyForPattern(this)); + } + return spb.makeOptional(p); + } + + public Object caseOther(Pattern p) { + return spb.makeOptional(p); + } + } + + public static Pattern transform(SchemaPatternBuilder spb, Pattern p) { + return p.applyForPattern(new FeasiblePatternFunction(spb)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FindElementFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FindElementFunction.java new file mode 100644 index 0000000..2f7ba4a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/FindElementFunction.java @@ -0,0 +1,78 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +import java.util.Hashtable; + +class FindElementFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + private final Name name; + private final Hashtable processed = new Hashtable(); + private int specificity = NameClass.SPECIFICITY_NONE; + private Pattern pattern = null; + + static public Pattern findElement(ValidatorPatternBuilder builder, Name name, Pattern start) { + FindElementFunction f = new FindElementFunction(builder, name); + start.apply(f); + if (f.pattern == null) + return builder.makeNotAllowed(); + return f.pattern; + } + + private FindElementFunction(ValidatorPatternBuilder builder, Name name) { + this.builder = builder; + this.name = name; + } + + private boolean haveProcessed(Pattern p) { + if (processed.get(p) != null) + return true; + processed.put(p, p); + return false; + } + + private Object caseBinary(BinaryPattern p) { + if (!haveProcessed(p)) { + p.getOperand1().apply(this); + p.getOperand2().apply(this); + } + return null; + + } + + public Object caseGroup(GroupPattern p) { + return caseBinary(p); + } + + public Object caseInterleave(InterleavePattern p) { + return caseBinary(p); + } + + public Object caseChoice(ChoicePattern p) { + return caseBinary(p); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + if (!haveProcessed(p)) + p.getOperand().apply(this); + return null; + } + + public Object caseElement(ElementPattern p) { + if (!haveProcessed(p)) { + int s = p.getNameClass().containsSpecificity(name); + if (s > specificity) { + specificity = s; + pattern = p.getContent(); + } + else if (s == specificity && s != NameClass.SPECIFICITY_NONE) + pattern = builder.makeChoice(pattern, p.getContent()); + p.getContent().apply(this); + } + return null; + } + + public Object caseOther(Pattern p) { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/GroupPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/GroupPattern.java new file mode 100644 index 0000000..cccfe93 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/GroupPattern.java @@ -0,0 +1,43 @@ +package com.thaiopensource.relaxng.impl; + +class GroupPattern extends BinaryPattern { + GroupPattern(Pattern p1, Pattern p2) { + super(p1.isNullable() && p2.isNullable(), + combineHashCode(GROUP_HASH_CODE, p1.hashCode(), p2.hashCode()), + p1, + p2); + } + + Pattern expand(SchemaPatternBuilder b) { + Pattern ep1 = p1.expand(b); + Pattern ep2 = p2.expand(b); + if (ep1 != p1 || ep2 != p2) + return b.makeGroup(ep1, ep2); + else + return this; + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_group"); + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_group"); + } + super.checkRestrictions(context == ELEMENT_REPEAT_CONTEXT + ? ELEMENT_REPEAT_GROUP_CONTEXT + : context, + dad, + alpha); + if (context != LIST_CONTEXT + && !contentTypeGroupable(p1.getContentType(), p2.getContentType())) + throw new RestrictionViolationException("group_string"); + } + + void accept(PatternVisitor visitor) { + visitor.visitGroup(p1, p2); + } + Object apply(PatternFunction f) { + return f.caseGroup(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdSoundnessChecker.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdSoundnessChecker.java new file mode 100644 index 0000000..0cfc594 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdSoundnessChecker.java @@ -0,0 +1,185 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.xml.util.StringSplitter; +import com.thaiopensource.xml.util.Name; +import org.relaxng.datatype.Datatype; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.helpers.LocatorImpl; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +public class IdSoundnessChecker implements Validator, ContentHandler { + private final IdTypeMap idTypeMap; + private final ErrorHandler eh; + private Locator locator; + private final Hashtable table = new Hashtable(); + + private static class Entry { + Locator idLoc; + Vector idrefLocs; + boolean hadId; + } + + public IdSoundnessChecker(IdTypeMap idTypeMap, ErrorHandler eh) { + this.idTypeMap = idTypeMap; + this.eh = eh; + } + + public void reset() { + table.clear(); + locator = null; + } + + public ContentHandler getContentHandler() { + return this; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void startDocument() throws SAXException { + } + + void setComplete() { + } + + public void endDocument() throws SAXException { + for (Enumeration e = table.keys(); e.hasMoreElements();) { + String token = (String)e.nextElement(); + Entry entry = (Entry)table.get(token); + if (!entry.hadId) { + for (Enumeration f = entry.idrefLocs.elements(); f.hasMoreElements();) + error("missing_id", token, (Locator)f.nextElement()); + } + } + setComplete(); + } + + public void startPrefixMapping(String s, String s1) throws SAXException { + } + + public void endPrefixMapping(String s) throws SAXException { + } + + public void startElement(String namespaceUri, String localName, String qName, Attributes attributes) + throws SAXException { + Name elementName = new Name(namespaceUri, localName); + int len = attributes.getLength(); + for (int i = 0; i < len; i++) { + Name attributeName = new Name(attributes.getURI(i), attributes.getLocalName(i)); + int idType = idTypeMap.getIdType(elementName, attributeName); + if (idType != Datatype.ID_TYPE_NULL) { + String[] tokens = StringSplitter.split(attributes.getValue(i)); + switch (idType) { + case Datatype.ID_TYPE_ID: + if (tokens.length == 1) + id(tokens[0]); + else if (tokens.length == 0) + error("id_no_tokens"); + else + error("id_multiple_tokens"); + break; + case Datatype.ID_TYPE_IDREF: + if (tokens.length == 1) + idref(tokens[0]); + else if (tokens.length == 0) + error("idref_no_tokens"); + else + error("idref_multiple_tokens"); + break; + case Datatype.ID_TYPE_IDREFS: + if (tokens.length > 0) { + for (int j = 0; j < tokens.length; j++) + idref(tokens[j]); + } + else + error("idrefs_no_tokens"); + break; + } + } + } + } + + private void id(String token) throws SAXException { + Entry entry = (Entry)table.get(token); + if (entry == null) { + entry = new Entry(); + table.put(token, entry); + } + else if (entry.hadId) { + error("duplicate_id", token); + error("first_id", token, entry.idLoc); + return; + } + entry.idLoc = new LocatorImpl(locator); + entry.hadId = true; + } + + private void idref(String token) { + Entry entry = (Entry)table.get(token); + if (entry == null) { + entry = new Entry(); + table.put(token, entry); + } + if (entry.hadId) + return; + if (entry.idrefLocs == null) + entry.idrefLocs = new Vector(); + entry.idrefLocs.addElement(new LocatorImpl(locator)); + } + + public void endElement(String s, String s1, String s2) throws SAXException { + } + + public void characters(char[] chars, int i, int i1) throws SAXException { + } + + public void ignorableWhitespace(char[] chars, int i, int i1) throws SAXException { + } + + public void processingInstruction(String s, String s1) throws SAXException { + } + + public void skippedEntity(String s) throws SAXException { + } + + public void notationDecl(String name, + String publicId, + String systemId) + throws SAXException { + } + + public void unparsedEntityDecl(String name, + String publicId, + String systemId, + String notationName) + throws SAXException { + } + + private void error(String key) throws SAXException { + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key), locator)); + } + + private void error(String key, String arg) throws SAXException { + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key, arg), locator)); + } + + private void error(String key, String arg, Locator loc) throws SAXException { + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key, arg), + loc)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMap.java new file mode 100644 index 0000000..bdac7bf --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMap.java @@ -0,0 +1,7 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +public interface IdTypeMap { + int getIdType(Name elementName, Name attributeName); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.java new file mode 100644 index 0000000..f2d619e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapBuilder.java @@ -0,0 +1,315 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import com.thaiopensource.xml.util.Name; + +public class IdTypeMapBuilder { + private boolean hadError; + private final ErrorHandler eh; + private final PatternFunction idTypeFunction = new IdTypeFunction(); + private final IdTypeMapImpl idTypeMap = new IdTypeMapImpl(); + private final Hashtable elementProcessed = new Hashtable(); + private final Vector possibleConflicts = new Vector(); + + private void notePossibleConflict(NameClass elementNameClass, NameClass attributeNameClass, Locator loc) { + possibleConflicts.addElement(new PossibleConflict(elementNameClass, attributeNameClass, loc)); + } + + private static class WrappedSAXException extends RuntimeException { + private final SAXException cause; + WrappedSAXException(SAXException cause) { + this.cause = cause; + } + } + + private static class PossibleConflict { + private final NameClass elementNameClass; + private final NameClass attributeNameClass; + private final Locator locator; + + private PossibleConflict(NameClass elementNameClass, NameClass attributeNameClass, Locator locator) { + this.elementNameClass = elementNameClass; + this.attributeNameClass = attributeNameClass; + this.locator = locator; + } + } + + private static class ScopedName { + private final Name elementName; + private final Name attributeName; + + private ScopedName(Name elementName, Name attributeName) { + this.elementName = elementName; + this.attributeName = attributeName; + } + + public int hashCode() { + return elementName.hashCode() ^ attributeName.hashCode(); + } + + public boolean equals(Object obj) { + if (!(obj instanceof ScopedName)) + return false; + ScopedName other = (ScopedName)obj; + return elementName.equals(other.elementName) && attributeName.equals(other.attributeName); + } + } + + private static class IdTypeMapImpl implements IdTypeMap { + private final Hashtable table = new Hashtable(); + public int getIdType(Name elementName, Name attributeName) { + Integer n = (Integer)table.get(new ScopedName(elementName, attributeName)); + if (n == null) + return Datatype.ID_TYPE_NULL; + return n.intValue(); + } + private void add(Name elementName, Name attributeName, int idType) { + table.put(new ScopedName(elementName, attributeName), new Integer(idType)); + } + } + + private class IdTypeFunction extends AbstractPatternFunction { + public Object caseOther(Pattern p) { + return new Integer(Datatype.ID_TYPE_NULL); + } + + public Object caseData(DataPattern p) { + return new Integer(p.getDatatype().getIdType()); + } + + public Object caseDataExcept(DataExceptPattern p) { + return new Integer(p.getDatatype().getIdType()); + } + + public Object caseValue(ValuePattern p) { + return new Integer(p.getDatatype().getIdType()); + } + } + + private class BuildFunction extends AbstractPatternFunction { + private final NameClass elementNameClass; + private final Locator locator; + private final boolean attributeIsParent; + + BuildFunction(NameClass elementNameClass, Locator locator) { + this.elementNameClass = elementNameClass; + this.locator = locator; + this.attributeIsParent = false; + } + + BuildFunction(NameClass elementNameClass, Locator locator, boolean attributeIsParent) { + this.elementNameClass = elementNameClass; + this.locator = locator; + this.attributeIsParent = attributeIsParent; + } + + private BuildFunction down() { + if (!attributeIsParent) + return this; + return new BuildFunction(elementNameClass, locator, false); + } + + public Object caseChoice(ChoicePattern p) { + BuildFunction f = down(); + p.getOperand1().apply(f); + p.getOperand2().apply(f); + return null; + } + + public Object caseInterleave(InterleavePattern p) { + BuildFunction f = down(); + p.getOperand1().apply(f); + p.getOperand2().apply(f); + return null; + } + + public Object caseGroup(GroupPattern p) { + BuildFunction f = down(); + p.getOperand1().apply(f); + p.getOperand2().apply(f); + return null; + } + + public Object caseOneOrMore(OneOrMorePattern p) { + p.getOperand().apply(down()); + return null; + } + + public Object caseElement(ElementPattern p) { + if (elementProcessed.get(p) != null) + return null; + elementProcessed.put(p, p); + p.getContent().apply(new BuildFunction(p.getNameClass(), p.getLocator())); + return null; + } + + public Object caseAttribute(AttributePattern p) { + int idType = ((Integer)p.getContent().apply(idTypeFunction)).intValue(); + if (idType != Datatype.ID_TYPE_NULL) { + NameClass attributeNameClass = p.getNameClass(); + if (!(attributeNameClass instanceof SimpleNameClass)) { + error("id_attribute_name_class", p.getLocator()); + return null; + } + elementNameClass.accept(new ElementNameClassVisitor(((SimpleNameClass)attributeNameClass).getName(), + locator, + idType)); + } + else + notePossibleConflict(elementNameClass, p.getNameClass(), locator); + p.getContent().apply(new BuildFunction(null, p.getLocator(), true)); + return null; + } + + private void datatype(Datatype dt) { + if (dt.getIdType() != Datatype.ID_TYPE_NULL && !attributeIsParent) + error("id_parent", locator); + } + + public Object caseData(DataPattern p) { + datatype(p.getDatatype()); + return null; + } + + public Object caseDataExcept(DataExceptPattern p) { + datatype(p.getDatatype()); + p.getExcept().apply(down()); + return null; + } + + public Object caseValue(ValuePattern p) { + datatype(p.getDatatype()); + return null; + } + + public Object caseList(ListPattern p) { + p.getOperand().apply(down()); + return null; + } + + public Object caseOther(Pattern p) { + return null; + } + } + + private class ElementNameClassVisitor implements NameClassVisitor { + private final Name attributeName; + private final Locator locator; + private final int idType; + + ElementNameClassVisitor(Name attributeName, Locator locator, int idType) { + this.attributeName = attributeName; + this.locator = locator; + this.idType = idType; + } + + public void visitChoice(NameClass nc1, NameClass nc2) { + nc1.accept(this); + nc2.accept(this); + } + + public void visitName(Name elementName) { + int tem = idTypeMap.getIdType(elementName, attributeName); + if (tem != Datatype.ID_TYPE_NULL && tem != idType) + error("id_type_conflict", elementName, attributeName, locator); + idTypeMap.add(elementName, attributeName, idType); + } + + public void visitNsName(String ns) { + visitOther(); + } + + public void visitNsNameExcept(String ns, NameClass nc) { + visitOther(); + } + + public void visitAnyName() { + visitOther(); + } + + public void visitAnyNameExcept(NameClass nc) { + visitOther(); + } + + public void visitNull() { + } + + public void visitError() { + } + + private void visitOther() { + error("id_element_name_class", locator); + } + } + + private void error(String key, Locator locator) { + hadError = true; + if (eh != null) + try { + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key), locator)); + } + catch (SAXException e) { + throw new WrappedSAXException(e); + } + } + + private void error(String key, Name arg1, Name arg2, Locator locator) { + hadError = true; + if (eh != null) + try { + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key, NameFormatter.format(arg1), NameFormatter.format(arg2)), + locator)); + } + catch (SAXException e) { + throw new WrappedSAXException(e); + } + } + + public IdTypeMapBuilder(ErrorHandler eh, Pattern pattern) throws SAXException { + this.eh = eh; + try { + pattern.apply(new BuildFunction(null, null)); + for (Enumeration e = possibleConflicts.elements(); + e.hasMoreElements();) { + PossibleConflict pc = (PossibleConflict)e.nextElement(); + if (pc.elementNameClass instanceof SimpleNameClass + && pc.attributeNameClass instanceof SimpleNameClass) { + Name elementName = ((SimpleNameClass)pc.elementNameClass).getName(); + Name attributeName = ((SimpleNameClass)pc.attributeNameClass).getName(); + int idType = idTypeMap.getIdType(elementName, + attributeName); + if (idType != Datatype.ID_TYPE_NULL) + error("id_type_conflict", elementName, attributeName, pc.locator); + } + else { + for (Enumeration f = idTypeMap.table.keys(); f.hasMoreElements();) { + ScopedName sn = (ScopedName)f.nextElement(); + if (pc.elementNameClass.contains(sn.elementName) + && pc.attributeNameClass.contains(sn.attributeName)) { + error("id_type_conflict", sn.elementName, sn.attributeName, pc.locator); + break; + } + } + } + } + } + catch (WrappedSAXException e) { + throw e.cause; + } + } + + public IdTypeMap getIdTypeMap() { + if (hadError) + return null; + return idTypeMap; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapSchema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapSchema.java new file mode 100644 index 0000000..4390cdb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IdTypeMapSchema.java @@ -0,0 +1,22 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.AbstractSchema; +import org.xml.sax.ErrorHandler; + +public class IdTypeMapSchema extends AbstractSchema { + private final IdTypeMap idTypeMap; + + public IdTypeMapSchema(IdTypeMap idTypeMap, PropertyMap properties) { + super(properties); + this.idTypeMap = idTypeMap; + } + + public Validator createValidator(PropertyMap properties) { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + return new IdSoundnessChecker(idTypeMap, eh); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.java new file mode 100644 index 0000000..80ac964 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/IgnoreMissingAttributesFunction.java @@ -0,0 +1,15 @@ +package com.thaiopensource.relaxng.impl; + +class IgnoreMissingAttributesFunction extends EndAttributesFunction { + IgnoreMissingAttributesFunction(ValidatorPatternBuilder builder) { + super(builder); + } + + public Object caseAttribute(AttributePattern p) { + return getPatternBuilder().makeEmpty(); + } + + PatternMemo apply(PatternMemo memo) { + return memo.ignoreMissingAttributes(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.java new file mode 100644 index 0000000..304ee03 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InconsistentDataDerivType.java @@ -0,0 +1,19 @@ +package com.thaiopensource.relaxng.impl; + +class InconsistentDataDerivType extends DataDerivType { + static private final InconsistentDataDerivType instance = new InconsistentDataDerivType(); + + static InconsistentDataDerivType getInstance() { + return instance; + } + + private InconsistentDataDerivType() { } + + DataDerivType combine(DataDerivType ddt) { + return this; + } + + DataDerivType copy() { + return this; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InterleavePattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InterleavePattern.java new file mode 100644 index 0000000..97cceab --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/InterleavePattern.java @@ -0,0 +1,61 @@ +package com.thaiopensource.relaxng.impl; + +class InterleavePattern extends BinaryPattern { + InterleavePattern(Pattern p1, Pattern p2) { + super(p1.isNullable() && p2.isNullable(), + combineHashCode(INTERLEAVE_HASH_CODE, p1.hashCode(), p2.hashCode()), + p1, + p2); + } + Pattern expand(SchemaPatternBuilder b) { + Pattern ep1 = p1.expand(b); + Pattern ep2 = p2.expand(b); + if (ep1 != p1 || ep2 != p2) + return b.makeInterleave(ep1, ep2); + else + return this; + } + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_interleave"); + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_interleave"); + case LIST_CONTEXT: + throw new RestrictionViolationException("list_contains_interleave"); + } + if (context == ELEMENT_REPEAT_CONTEXT) + context = ELEMENT_REPEAT_INTERLEAVE_CONTEXT; + Alphabet a1; + if (alpha != null && alpha.isEmpty()) + a1 = alpha; + else + a1 = new Alphabet(); + p1.checkRestrictions(context, dad, a1); + if (a1.isEmpty()) + p2.checkRestrictions(context, dad, a1); + else { + Alphabet a2 = new Alphabet(); + p2.checkRestrictions(context, dad, a2); + a1.checkOverlap(a2); + if (alpha != null) { + if (alpha != a1) + alpha.addAlphabet(a1); + alpha.addAlphabet(a2); + } + } + if (!contentTypeGroupable(p1.getContentType(), p2.getContentType())) + throw new RestrictionViolationException("interleave_string"); + if (p1.getContentType() == MIXED_CONTENT_TYPE + && p2.getContentType() == MIXED_CONTENT_TYPE) + throw new RestrictionViolationException("interleave_text_overlap"); + } + + void accept(PatternVisitor visitor) { + visitor.visitInterleave(p1, p2); + } + Object apply(PatternFunction f) { + return f.caseInterleave(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ListPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ListPattern.java new file mode 100644 index 0000000..8528a80 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ListPattern.java @@ -0,0 +1,65 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +class ListPattern extends Pattern { + private final Pattern p; + private final Locator locator; + + ListPattern(Pattern p, Locator locator) { + super(false, + DATA_CONTENT_TYPE, + combineHashCode(LIST_HASH_CODE, p.hashCode())); + this.p = p; + this.locator = locator; + } + + Pattern expand(SchemaPatternBuilder b) { + Pattern ep = p.expand(b); + if (ep != p) + return b.makeList(ep, locator); + else + return this; + } + + void checkRecursion(int depth) throws SAXException { + p.checkRecursion(depth); + } + + boolean samePattern(Pattern other) { + return (other instanceof ListPattern + && p == ((ListPattern)other).p); + } + + void accept(PatternVisitor visitor) { + visitor.visitList(p); + } + + Object apply(PatternFunction f) { + return f.caseList(this); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_list"); + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_list"); + case LIST_CONTEXT: + throw new RestrictionViolationException("list_contains_list"); + } + try { + p.checkRestrictions(LIST_CONTEXT, dad, null); + } + catch (RestrictionViolationException e) { + e.maybeSetLocator(locator); + throw e; + } + } + + Pattern getOperand() { + return p; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.java new file mode 100644 index 0000000..dca4f66 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/MixedTextDerivFunction.java @@ -0,0 +1,45 @@ +package com.thaiopensource.relaxng.impl; + +class MixedTextDerivFunction extends EndAttributesFunction { + + MixedTextDerivFunction(ValidatorPatternBuilder builder) { + super(builder); + } + + public Object caseText(TextPattern p) { + return p; + } + + public Object caseGroup(GroupPattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + final Pattern q1 = memoApply(p1); + Pattern tem = (q1 == p1) ? p : getPatternBuilder().makeGroup(q1, p2); + if (!p1.isNullable()) + return tem; + return getPatternBuilder().makeChoice(tem, memoApply(p2)); + } + + public Object caseInterleave(InterleavePattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + final Pattern q1 = memoApply(p1); + final Pattern q2 = memoApply(p2); + final Pattern i1 = (q1 == p1) ? p : getPatternBuilder().makeInterleave(q1, p2); + final Pattern i2 = (q2 == p2) ? p : getPatternBuilder().makeInterleave(p1, q2); + return getPatternBuilder().makeChoice(i1, i2); + } + + public Object caseOneOrMore(OneOrMorePattern p) { + return getPatternBuilder().makeGroup(memoApply(p.getOperand()), + getPatternBuilder().makeOptional(p)); + } + + public Object caseOther(Pattern p) { + return getPatternBuilder().makeNotAllowed(); + } + + PatternMemo apply(PatternMemo memo) { + return memo.mixedTextDeriv(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClass.java new file mode 100644 index 0000000..c60f46e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClass.java @@ -0,0 +1,15 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.xml.util.Name; + +public interface NameClass extends ParsedNameClass { + static final int SPECIFICITY_NONE = -1; + static final int SPECIFICITY_ANY_NAME = 0; + static final int SPECIFICITY_NS_NAME = 1; + static final int SPECIFICITY_NAME = 2; + boolean contains(Name name); + int containsSpecificity(Name name); + void accept(NameClassVisitor visitor); + boolean isOpen(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClassVisitor.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClassVisitor.java new file mode 100644 index 0000000..1f265fd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameClassVisitor.java @@ -0,0 +1,14 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +public interface NameClassVisitor { + void visitChoice(NameClass nc1, NameClass nc2); + void visitNsName(String ns); + void visitNsNameExcept(String ns, NameClass nc); + void visitAnyName(); + void visitAnyNameExcept(NameClass nc); + void visitName(Name name); + void visitNull(); + void visitError(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameFormatter.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameFormatter.java new file mode 100644 index 0000000..d7b95dd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NameFormatter.java @@ -0,0 +1,15 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + + +class NameFormatter { + static String format(Name name) { + String localName = name.getLocalName(); + String namespaceUri = name.getNamespaceUri(); + if (namespaceUri.equals("")) + return SchemaBuilderImpl.localizer.message("name_absent_namespace", localName); + else + return SchemaBuilderImpl.localizer.message("name_with_namespace", namespaceUri, localName); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NotAllowedPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NotAllowedPattern.java new file mode 100644 index 0000000..b2af65d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NotAllowedPattern.java @@ -0,0 +1,20 @@ +package com.thaiopensource.relaxng.impl; + +class NotAllowedPattern extends Pattern { + NotAllowedPattern() { + super(false, EMPTY_CONTENT_TYPE, NOT_ALLOWED_HASH_CODE); + } + boolean isNotAllowed() { + return true; + } + boolean samePattern(Pattern other) { + // needs to work for UnexpandedNotAllowedPattern + return other.getClass() == this.getClass(); + } + void accept(PatternVisitor visitor) { + visitor.visitNotAllowed(); + } + Object apply(PatternFunction f) { + return f.caseNotAllowed(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameClass.java new file mode 100644 index 0000000..7e69822 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameClass.java @@ -0,0 +1,38 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class NsNameClass implements NameClass { + + private final String namespaceUri; + + NsNameClass(String namespaceUri) { + this.namespaceUri = namespaceUri; + } + + public boolean contains(Name name) { + return this.namespaceUri.equals(name.getNamespaceUri()); + } + + public int containsSpecificity(Name name) { + return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE; + } + + public int hashCode() { + return namespaceUri.hashCode(); + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof NsNameClass)) + return false; + return namespaceUri.equals(((NsNameClass)obj).namespaceUri); + } + + public void accept(NameClassVisitor visitor) { + visitor.visitNsName(namespaceUri); + } + + public boolean isOpen() { + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.java new file mode 100644 index 0000000..9ac0631 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NsNameExceptNameClass.java @@ -0,0 +1,44 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class NsNameExceptNameClass implements NameClass { + + private final NameClass nameClass; + private final String namespaceURI; + + NsNameExceptNameClass(String namespaceURI, NameClass nameClass) { + this.namespaceURI = namespaceURI; + this.nameClass = nameClass; + } + + public boolean contains(Name name) { + return (this.namespaceURI.equals(name.getNamespaceUri()) + && !nameClass.contains(name)); + } + + public int containsSpecificity(Name name) { + return contains(name) ? SPECIFICITY_NS_NAME : SPECIFICITY_NONE; + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof NsNameExceptNameClass)) + return false; + NsNameExceptNameClass other = (NsNameExceptNameClass)obj; + return (namespaceURI.equals(other.namespaceURI) + && nameClass.equals(other.nameClass)); + } + + public int hashCode() { + return namespaceURI.hashCode() ^ nameClass.hashCode(); + } + + public void accept(NameClassVisitor visitor) { + visitor.visitNsNameExcept(namespaceURI, nameClass); + } + + public boolean isOpen() { + return true; + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NullNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NullNameClass.java new file mode 100644 index 0000000..6b4611c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/NullNameClass.java @@ -0,0 +1,31 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class NullNameClass implements NameClass { + public boolean contains(Name name) { + return false; + } + + public int containsSpecificity(Name name) { + return SPECIFICITY_NONE; + } + + public int hashCode() { + return NullNameClass.class.hashCode(); + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof NullNameClass)) + return false; + return true; + } + + public void accept(NameClassVisitor visitor) { + visitor.visitNull(); + } + + public boolean isOpen() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OneOrMorePattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OneOrMorePattern.java new file mode 100644 index 0000000..3c29276 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OneOrMorePattern.java @@ -0,0 +1,62 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.SAXException; + +class OneOrMorePattern extends Pattern { + private final Pattern p; + + OneOrMorePattern(Pattern p) { + super(p.isNullable(), + p.getContentType(), + combineHashCode(ONE_OR_MORE_HASH_CODE, p.hashCode())); + this.p = p; + } + + Pattern expand(SchemaPatternBuilder b) { + Pattern ep = p.expand(b); + if (ep != p) + return b.makeOneOrMore(ep); + else + return this; + } + + void checkRecursion(int depth) throws SAXException { + p.checkRecursion(depth); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_one_or_more"); + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_one_or_more"); + } + + p.checkRestrictions(context == ELEMENT_CONTEXT + ? ELEMENT_REPEAT_CONTEXT + : context, + dad, + alpha); + if (context != LIST_CONTEXT + && !contentTypeGroupable(p.getContentType(), p.getContentType())) + throw new RestrictionViolationException("one_or_more_string"); + } + + boolean samePattern(Pattern other) { + return (other instanceof OneOrMorePattern + && p == ((OneOrMorePattern)other).p); + } + + void accept(PatternVisitor visitor) { + visitor.visitOneOrMore(p); + } + + Object apply(PatternFunction f) { + return f.caseOneOrMore(this); + } + + Pattern getOperand() { + return p; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OverlapDetector.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OverlapDetector.java new file mode 100644 index 0000000..c6925bb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/OverlapDetector.java @@ -0,0 +1,68 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class OverlapDetector implements NameClassVisitor { + private final NameClass nc1; + private final NameClass nc2; + private boolean overlaps = false; + + private static final String IMPOSSIBLE = "\u0000"; + + private OverlapDetector(NameClass nc1, NameClass nc2) { + this.nc1 = nc1; + this.nc2 = nc2; + nc1.accept(this); + nc2.accept(this); + } + + private void probe(Name name) { + if (nc1.contains(name) && nc2.contains(name)) + overlaps = true; + } + + public void visitChoice(NameClass nc1, NameClass nc2) { + nc1.accept(this); + nc2.accept(this); + } + + public void visitNsName(String ns) { + probe(new Name(ns, IMPOSSIBLE)); + } + + public void visitNsNameExcept(String ns, NameClass ex) { + probe(new Name(ns, IMPOSSIBLE)); + ex.accept(this); + } + + public void visitAnyName() { + probe(new Name(IMPOSSIBLE, IMPOSSIBLE)); + } + + public void visitAnyNameExcept(NameClass ex) { + probe(new Name(IMPOSSIBLE, IMPOSSIBLE)); + ex.accept(this); + } + + public void visitName(Name name) { + probe(name); + } + + public void visitNull() { + } + + public void visitError() { + } + + static boolean overlap(NameClass nc1, NameClass nc2) { + if (nc2 instanceof SimpleNameClass) { + SimpleNameClass snc = (SimpleNameClass)nc2; + return nc1.contains(snc.getName()); + } + if (nc1 instanceof SimpleNameClass) { + SimpleNameClass snc = (SimpleNameClass)nc1; + return nc2.contains(snc.getName()); + } + return new OverlapDetector(nc1, nc2).overlaps; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Pattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Pattern.java new file mode 100644 index 0000000..cfd342e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/Pattern.java @@ -0,0 +1,108 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.SAXException; +import com.thaiopensource.relaxng.parse.ParsedPattern; + +public abstract class Pattern implements ParsedPattern { + private final boolean nullable; + private final int hc; + private final int contentType; + + static final int TEXT_HASH_CODE = 1; + static final int ERROR_HASH_CODE = 3; + static final int EMPTY_HASH_CODE = 5; + static final int NOT_ALLOWED_HASH_CODE = 7; + static final int CHOICE_HASH_CODE = 11; + static final int GROUP_HASH_CODE = 13; + static final int INTERLEAVE_HASH_CODE = 17; + static final int ONE_OR_MORE_HASH_CODE = 19; + static final int ELEMENT_HASH_CODE = 23; + static final int VALUE_HASH_CODE = 27; + static final int ATTRIBUTE_HASH_CODE = 29; + static final int DATA_HASH_CODE = 31; + static final int LIST_HASH_CODE = 37; + static final int AFTER_HASH_CODE = 41; + + static int combineHashCode(int hc1, int hc2, int hc3) { + return hc1 * hc2 * hc3; + } + + static int combineHashCode(int hc1, int hc2) { + return hc1 * hc2; + } + + static final int EMPTY_CONTENT_TYPE = 0; + static final int ELEMENT_CONTENT_TYPE = 1; + static final int MIXED_CONTENT_TYPE = 2; + static final int DATA_CONTENT_TYPE = 3; + + Pattern(boolean nullable, int contentType, int hc) { + this.nullable = nullable; + this.contentType = contentType; + this.hc = hc; + } + + Pattern() { + this.nullable = false; + this.hc = hashCode(); + this.contentType = EMPTY_CONTENT_TYPE; + } + + void checkRecursion(int depth) throws SAXException { } + + Pattern expand(SchemaPatternBuilder b) { + return this; + } + + final boolean isNullable() { + return nullable; + } + + boolean isNotAllowed() { + return false; + } + + static final int START_CONTEXT = 0; + static final int ELEMENT_CONTEXT = 1; + static final int ELEMENT_REPEAT_CONTEXT = 2; + static final int ELEMENT_REPEAT_GROUP_CONTEXT = 3; + static final int ELEMENT_REPEAT_INTERLEAVE_CONTEXT = 4; + static final int ATTRIBUTE_CONTEXT = 5; + static final int LIST_CONTEXT = 6; + static final int DATA_EXCEPT_CONTEXT = 7; + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + } + + // Know that other is not null + abstract boolean samePattern(Pattern other); + + final int patternHashCode() { + return hc; + } + + final int getContentType() { + return contentType; + } + + boolean containsChoice(Pattern p) { + return this == p; + } + + abstract void accept(PatternVisitor visitor); + abstract Object apply(PatternFunction f); + + Pattern applyForPattern(PatternFunction f) { + return (Pattern)apply(f); + } + + static boolean contentTypeGroupable(int ct1, int ct2) { + if (ct1 == EMPTY_CONTENT_TYPE || ct2 == EMPTY_CONTENT_TYPE) + return true; + if (ct1 == DATA_CONTENT_TYPE || ct2 == DATA_CONTENT_TYPE) + return false; + return true; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternBuilder.java new file mode 100644 index 0000000..359423f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternBuilder.java @@ -0,0 +1,92 @@ +package com.thaiopensource.relaxng.impl; + +public class PatternBuilder { + private final EmptyPattern empty; + protected final NotAllowedPattern notAllowed; + protected final PatternInterner interner; + + public PatternBuilder() { + empty = new EmptyPattern(); + notAllowed = new NotAllowedPattern(); + interner = new PatternInterner(); + } + + public PatternBuilder(PatternBuilder parent) { + empty = parent.empty; + notAllowed = parent.notAllowed; + interner = new PatternInterner(parent.interner); + } + + Pattern makeEmpty() { + return empty; + } + + Pattern makeNotAllowed() { + return notAllowed; + } + + Pattern makeGroup(Pattern p1, Pattern p2) { + if (p1 == empty) + return p2; + if (p2 == empty) + return p1; + if (p1 == notAllowed || p2 == notAllowed) + return notAllowed; + if (false && p1 instanceof GroupPattern) { + GroupPattern sp = (GroupPattern)p1; + return makeGroup(sp.p1, makeGroup(sp.p2, p2)); + } + Pattern p = new GroupPattern(p1, p2); + return interner.intern(p); + } + + Pattern makeInterleave(Pattern p1, Pattern p2) { + if (p1 == empty) + return p2; + if (p2 == empty) + return p1; + if (p1 == notAllowed || p2 == notAllowed) + return notAllowed; + if (false && p1 instanceof InterleavePattern) { + InterleavePattern ip = (InterleavePattern)p1; + return makeInterleave(ip.p1, makeInterleave(ip.p2, p2)); + } + if (false) { + if (p2 instanceof InterleavePattern) { + InterleavePattern ip = (InterleavePattern)p2; + if (p1.hashCode() > ip.p1.hashCode()) + return makeInterleave(ip.p1, makeInterleave(p1, ip.p2)); + } + else if (p1.hashCode() > p2.hashCode()) + return makeInterleave(p2, p1); + } + Pattern p = new InterleavePattern(p1, p2); + return interner.intern(p); + } + + Pattern makeChoice(Pattern p1, Pattern p2) { + if (p1 == empty && p2.isNullable()) + return p2; + if (p2 == empty && p1.isNullable()) + return p1; + Pattern p = new ChoicePattern(p1, p2); + return interner.intern(p); + } + + Pattern makeOneOrMore(Pattern p) { + if (p == empty + || p == notAllowed + || p instanceof OneOrMorePattern) + return p; + Pattern p1 = new OneOrMorePattern(p); + return interner.intern(p1); + } + + Pattern makeOptional(Pattern p) { + return makeChoice(p, empty); + } + + Pattern makeZeroOrMore(Pattern p) { + return makeOptional(makeOneOrMore(p)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternDumper.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternDumper.java new file mode 100644 index 0000000..f218dde --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternDumper.java @@ -0,0 +1,341 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; + +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.Hashtable; +import java.util.Vector; + +import com.thaiopensource.xml.util.WellKnownNamespaces; +import com.thaiopensource.xml.util.Name; + +public class PatternDumper { + private boolean startTagOpen = false; + private final Vector tagStack = new Vector(); + private final PrintWriter writer; + private int level = 0; + private boolean suppressIndent = false; + private final Vector patternList = new Vector(); + private final Hashtable patternTable = new Hashtable(); + + private final PatternVisitor patternVisitor = new DumpPatternVisitor(); + private final PatternVisitor groupPatternVisitor = new GroupDumpPatternVisitor(); + private final PatternVisitor choicePatternVisitor = new ChoiceDumpPatternVisitor(); + private final PatternVisitor interleavePatternVisitor = new InterleaveDumpPatternVisitor(); + private final NameClassVisitor nameClassVisitor = new DumpNameClassVisitor(); + private final NameClassVisitor choiceNameClassVisitor = new ChoiceDumpNameClassVisitor(); + + static public void dump(PrintWriter writer, Pattern p) { + new PatternDumper(writer).dump(p); + } + + static public void dump(OutputStream out, Pattern p) { + new PatternDumper(new PrintWriter(out)).dump(p); + } + + private PatternDumper(PrintWriter writer) { + this.writer = writer; + } + + private void dump(Pattern p) { + write(""); + startElement("grammar"); + attribute("xmlns", WellKnownNamespaces.RELAX_NG); + startElement("start"); + p.accept(groupPatternVisitor); + endElement(); + for (int i = 0; i < patternList.size(); i++) { + startElement("define"); + Pattern tem = (Pattern)patternList.elementAt(i); + attribute("name", getName(tem)); + tem.accept(groupPatternVisitor); + endElement(); + } + endElement(); + writer.println(); + writer.flush(); + } + + private String getName(Pattern p) { + String name = (String)patternTable.get(p); + if (name == null) { + name = "p" + patternList.size(); + patternList.addElement(p); + patternTable.put(p, name); + } + return name; + } + + private void startElement(String name) { + closeStartTag(); + indent(level); + write('<'); + write(name); + push(name); + startTagOpen = true; + level++; + } + + private void closeStartTag() { + if (startTagOpen) { + startTagOpen = false; + write('>'); + } + } + + private void attribute(String name, String value) { + write(' '); + write(name); + write('='); + write('"'); + chars(value, true); + write('"'); + } + + private void data(String str) { + if (str.length() > 0) { + closeStartTag(); + chars(str, false); + suppressIndent = true; + } + } + + private void chars(String str, boolean isAttribute) { + int len = str.length(); + for (int i = 0; i < len; i++) { + char c = str.charAt(i); + switch (c) { + case '&': + write("&"); + break; + case '<': + write("<"); + break; + case '>': + write(">"); + break; + case '"': + if (isAttribute) { + write("""); + break; + } + // fall through + default: + write(c); + break; + } + } + } + + private void endElement() { + --level; + if (startTagOpen) { + startTagOpen = false; + write("/>"); + pop(); + } + else { + if (!suppressIndent) + indent(level); + write(""); + } + suppressIndent = false; + } + + private void indent(int level) { + writer.println(); + for (int i = 0; i < level; i++) + write(" "); + } + + private void write(String str) { + writer.print(str); + } + + private void write(char c) { + writer.print(c); + } + + private void push(String s) { + tagStack.addElement(s); + } + + private String pop() { + String s = (String)tagStack.lastElement(); + tagStack.setSize(tagStack.size() - 1); + return s; + } + + class DumpPatternVisitor implements PatternVisitor { + public void visitEmpty() { + startElement("empty"); + endElement(); + } + + public void visitNotAllowed() { + startElement("notAllowed"); + endElement(); + } + + public void visitError() { + startElement("error"); + endElement(); + } + + public void visitGroup(Pattern p1, Pattern p2) { + startElement("group"); + p1.accept(groupPatternVisitor); + p2.accept(groupPatternVisitor); + endElement(); + } + + public void visitInterleave(Pattern p1, Pattern p2) { + startElement("interleave"); + p1.accept(interleavePatternVisitor); + p2.accept(interleavePatternVisitor); + endElement(); + } + + public void visitChoice(Pattern p1, Pattern p2) { + startElement("choice"); + p1.accept(choicePatternVisitor); + p2.accept(choicePatternVisitor); + endElement(); + } + + public void visitOneOrMore(Pattern p) { + startElement("oneOrMore"); + p.accept(groupPatternVisitor); + endElement(); + } + + public void visitElement(NameClass nc, Pattern content) { + startElement("element"); + nc.accept(nameClassVisitor); + startElement("ref"); + attribute("name", getName(content)); + endElement(); + endElement(); + } + + public void visitAttribute(NameClass nc, Pattern value) { + startElement("attribute"); + nc.accept(nameClassVisitor); + value.accept(patternVisitor); + endElement(); + } + + public void visitData(Datatype dt) { + startElement("text"); // XXX + endElement(); + } + + public void visitDataExcept(Datatype dt, Pattern except) { + startElement("text"); // XXX + endElement(); + } + + public void visitValue(Datatype dt, Object obj) { + startElement("value"); + // XXX dump dt + // XXX toString will not handle QName + data(obj.toString()); + endElement(); + } + + public void visitText() { + startElement("text"); + endElement(); + } + + public void visitList(Pattern p) { + startElement("list"); + p.accept(groupPatternVisitor); + endElement(); + } + } + + class GroupDumpPatternVisitor extends DumpPatternVisitor { + public void visitGroup(Pattern p1, Pattern p2) { + p1.accept(this); + p2.accept(this); + } + } + + class ChoiceDumpPatternVisitor extends DumpPatternVisitor { + public void visitChoice(Pattern p1, Pattern p2) { + p1.accept(this); + p2.accept(this); + } + } + + class InterleaveDumpPatternVisitor extends DumpPatternVisitor { + public void visitInterleave(Pattern p1, Pattern p2) { + p1.accept(this); + p2.accept(this); + } + } + + + class DumpNameClassVisitor implements NameClassVisitor { + public void visitChoice(NameClass nc1, NameClass nc2) { + startElement("choice"); + nc1.accept(choiceNameClassVisitor); + nc2.accept(choiceNameClassVisitor); + endElement(); + } + + public void visitNsName(String ns) { + startElement("nsName"); + attribute("ns", ns); + endElement(); + } + + public void visitNsNameExcept(String ns, NameClass nc) { + startElement("nsName"); + startElement("except"); + nc.accept(choiceNameClassVisitor); + endElement(); + endElement(); + } + + public void visitAnyName() { + startElement("anyName"); + endElement(); + } + + public void visitAnyNameExcept(NameClass nc) { + startElement("anyName"); + startElement("except"); + nc.accept(choiceNameClassVisitor); + endElement(); + endElement(); + } + + public void visitName(Name name) { + startElement("name"); + attribute("ns", name.getNamespaceUri()); + data(name.getLocalName()); + endElement(); + } + + public void visitError() { + startElement("error"); + endElement(); + } + + public void visitNull() { + visitAnyName(); + } + } + + class ChoiceDumpNameClassVisitor extends DumpNameClassVisitor { + public void visitChoice(NameClass nc1, NameClass nc2) { + nc1.accept(this); + nc2.accept(this); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFunction.java new file mode 100644 index 0000000..92ea93a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFunction.java @@ -0,0 +1,20 @@ +package com.thaiopensource.relaxng.impl; + +interface PatternFunction { + Object caseEmpty(EmptyPattern p); + Object caseNotAllowed(NotAllowedPattern p); + Object caseError(ErrorPattern p); + Object caseGroup(GroupPattern p); + Object caseInterleave(InterleavePattern p); + Object caseChoice(ChoicePattern p); + Object caseOneOrMore(OneOrMorePattern p); + Object caseElement(ElementPattern p); + Object caseAttribute(AttributePattern p); + Object caseData(DataPattern p); + Object caseDataExcept(DataExceptPattern p); + Object caseValue(ValuePattern p); + Object caseText(TextPattern p); + Object caseList(ListPattern p); + Object caseRef(RefPattern p); + Object caseAfter(AfterPattern p); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFuture.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFuture.java new file mode 100644 index 0000000..5e6fadc --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternFuture.java @@ -0,0 +1,10 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.SAXException; +import com.thaiopensource.validate.IncorrectSchemaException; + +import java.io.IOException; + +public interface PatternFuture { + Pattern getPattern(boolean isAttributesPattern) throws IncorrectSchemaException, SAXException, IOException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternInterner.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternInterner.java new file mode 100644 index 0000000..bfa8c6d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternInterner.java @@ -0,0 +1,68 @@ +package com.thaiopensource.relaxng.impl; + + +final class PatternInterner { + private static final int INIT_SIZE = 256; + private static final float LOAD_FACTOR = 0.3f; + private Pattern[] table; + private int used; + private int usedLimit; + + PatternInterner() { + table = null; + used = 0; + usedLimit = 0; + } + + PatternInterner(PatternInterner parent) { + table = parent.table; + if (table != null) + table = (Pattern[])table.clone(); + used = parent.used; + usedLimit = parent.usedLimit; + } + + Pattern intern(Pattern p) { + int h; + + if (table == null) { + table = new Pattern[INIT_SIZE]; + usedLimit = (int)(INIT_SIZE * LOAD_FACTOR); + h = firstIndex(p); + } + else { + for (h = firstIndex(p); table[h] != null; h = nextIndex(h)) { + if (p.samePattern(table[h])) + return table[h]; + } + } + if (used >= usedLimit) { + // rehash + Pattern[] oldTable = table; + table = new Pattern[table.length << 1]; + for (int i = oldTable.length; i > 0;) { + --i; + if (oldTable[i] != null) { + int j; + for (j = firstIndex(oldTable[i]); table[j] != null; j = nextIndex(j)) + ; + table[j] = oldTable[i]; + } + } + for (h = firstIndex(p); table[h] != null; h = nextIndex(h)) + ; + usedLimit = (int)(table.length * LOAD_FACTOR); + } + used++; + table[h] = p; + return p; + } + + private int firstIndex(Pattern p) { + return p.patternHashCode() & (table.length - 1); + } + + private int nextIndex(int i) { + return i == 0 ? table.length - 1 : i - 1; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternMemo.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternMemo.java new file mode 100644 index 0000000..236bdb3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternMemo.java @@ -0,0 +1,193 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.ValidationContext; + +import java.util.Hashtable; + +import com.thaiopensource.xml.util.Name; + +final class PatternMemo { + private final Pattern pattern; + private final ValidatorPatternBuilder builder; + private final boolean notAllowed; + private PatternMemo memoEndAttributes; + private PatternMemo memoTextOnly; + private PatternMemo memoEndTagDeriv; + private PatternMemo memoMixedTextDeriv; + private PatternMemo memoIgnoreMissingAttributes; + private Hashtable startTagOpenDerivMap; + private Hashtable startTagOpenRecoverDerivMap; + private Hashtable startAttributeDerivMap; + private DataDerivType memoDataDerivType; + + PatternMemo(Pattern pattern, ValidatorPatternBuilder builder) { + this.pattern = pattern; + this.builder = builder; + this.notAllowed = pattern.isNotAllowed(); + } + + Pattern getPattern() { + return pattern; + } + + ValidatorPatternBuilder getPatternBuilder() { + return builder; + } + + boolean isNotAllowed() { + return notAllowed; + } + + PatternMemo endAttributes() { + if (memoEndAttributes == null) + memoEndAttributes = applyForPatternMemo(builder.getEndAttributesFunction()); + return memoEndAttributes; + } + + PatternMemo endAttributes(PatternFunction f) { + if (memoEndAttributes == null) + memoEndAttributes = applyForPatternMemo(f); + return memoEndAttributes; + } + + PatternMemo ignoreMissingAttributes() { + if (memoIgnoreMissingAttributes == null) + memoIgnoreMissingAttributes + = applyForPatternMemo(builder.getIgnoreMissingAttributesFunction()); + return memoIgnoreMissingAttributes; + } + + PatternMemo ignoreMissingAttributes(PatternFunction f) { + if (memoIgnoreMissingAttributes == null) + memoIgnoreMissingAttributes = applyForPatternMemo(f); + return memoIgnoreMissingAttributes; + } + + PatternMemo textOnly() { + if (memoTextOnly == null) + memoTextOnly = applyForPatternMemo(builder.getTextOnlyFunction()); + return memoTextOnly; + } + + PatternMemo textOnly(PatternFunction f) { + if (memoTextOnly == null) + memoTextOnly = applyForPatternMemo(f); + return memoTextOnly; + } + + PatternMemo endTagDeriv() { + if (memoEndTagDeriv == null) + memoEndTagDeriv = applyForPatternMemo(builder.getEndTagDerivFunction()); + return memoEndTagDeriv; + } + + PatternMemo endTagDeriv(PatternFunction f) { + if (memoEndTagDeriv == null) + memoEndTagDeriv = applyForPatternMemo(f); + return memoEndTagDeriv; + } + + + PatternMemo mixedTextDeriv() { + if (memoMixedTextDeriv == null) + memoMixedTextDeriv = applyForPatternMemo(builder.getMixedTextDerivFunction()); + return memoMixedTextDeriv; + } + + PatternMemo mixedTextDeriv(PatternFunction f) { + if (memoMixedTextDeriv == null) + memoMixedTextDeriv = applyForPatternMemo(f); + return memoMixedTextDeriv; + } + + PatternMemo startTagOpenDeriv(Name name) { + return startTagOpenDeriv(name, null); + } + + PatternMemo startTagOpenDeriv(StartTagOpenDerivFunction f) { + return startTagOpenDeriv(f.getName(), f); + } + + private PatternMemo startTagOpenDeriv(Name name, StartTagOpenDerivFunction f) { + PatternMemo tem; + if (startTagOpenDerivMap == null) + startTagOpenDerivMap = new Hashtable(); + else { + tem = (PatternMemo)startTagOpenDerivMap.get(name); + if (tem != null) + return tem; + } + if (f == null) + f = new StartTagOpenDerivFunction(name, builder); + tem = applyForPatternMemo(f); + startTagOpenDerivMap.put(name, tem); + return tem; + } + + PatternMemo startTagOpenRecoverDeriv(Name name) { + return startTagOpenRecoverDeriv(name, null); + } + + PatternMemo startTagOpenRecoverDeriv(StartTagOpenRecoverDerivFunction f) { + return startTagOpenRecoverDeriv(f.getName(), f); + } + + private PatternMemo startTagOpenRecoverDeriv(Name name, StartTagOpenRecoverDerivFunction f) { + PatternMemo tem; + if (startTagOpenRecoverDerivMap == null) + startTagOpenRecoverDerivMap = new Hashtable(); + else { + tem = (PatternMemo)startTagOpenRecoverDerivMap.get(name); + if (tem != null) + return tem; + } + if (f == null) + f = new StartTagOpenRecoverDerivFunction(name, builder); + tem = applyForPatternMemo(f); + startTagOpenRecoverDerivMap.put(name, tem); + return tem; + } + + PatternMemo startAttributeDeriv(Name name) { + return startAttributeDeriv(name, null); + } + + PatternMemo startAttributeDeriv(StartAttributeDerivFunction f) { + return startAttributeDeriv(f.getName(), f); + } + + private PatternMemo startAttributeDeriv(Name name, StartAttributeDerivFunction f) { + PatternMemo tem; + if (startAttributeDerivMap == null) + startAttributeDerivMap = new Hashtable(); + else { + tem = (PatternMemo)startAttributeDerivMap.get(name); + if (tem != null) + return tem; + } + if (f == null) + f = new StartAttributeDerivFunction(name, builder); + tem = applyForPatternMemo(f); + startAttributeDerivMap.put(name, tem); + return tem; + } + + DataDerivType dataDerivType() { + if (memoDataDerivType == null) + memoDataDerivType = DataDerivTypeFunction.dataDerivType(builder, pattern).copy(); + return memoDataDerivType; + } + + PatternMemo dataDeriv(String str, ValidationContext vc) { + return dataDerivType().dataDeriv(builder, pattern, str, vc); + } + + PatternMemo recoverAfter() { + // XXX memoize + return applyForPatternMemo(builder.getRecoverAfterFunction()); + } + + private PatternMemo applyForPatternMemo(PatternFunction f) { + return builder.getPatternMemo(pattern.applyForPattern(f)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternSchema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternSchema.java new file mode 100644 index 0000000..3ae8b56 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternSchema.java @@ -0,0 +1,23 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import org.xml.sax.ErrorHandler; + +public class PatternSchema extends AbstractSchema { + private final SchemaPatternBuilder spb; + private final Pattern start; + + public PatternSchema(SchemaPatternBuilder spb, Pattern start, PropertyMap properties) { + super(properties); + this.spb = spb; + this.start = start; + } + + public Validator createValidator(PropertyMap properties) { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + return new PatternValidator(start, new ValidatorPatternBuilder(spb), eh); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternValidator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternValidator.java new file mode 100644 index 0000000..62a144b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternValidator.java @@ -0,0 +1,271 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.relaxng.parse.sax.DtdContext; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import com.thaiopensource.xml.util.Name; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.DTDHandler; +import org.xml.sax.ContentHandler; + +import java.util.Hashtable; + +public class PatternValidator extends DtdContext implements Validator, ContentHandler, DTDHandler { + private final ValidatorPatternBuilder builder; + private final Pattern start; + private final ErrorHandler eh; + private Hashtable recoverPatternTable; + private PatternMemo memo; + private boolean hadError; + private boolean collectingCharacters; + private final StringBuffer charBuf = new StringBuffer(); + private PrefixMapping prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null); + private Locator locator; + + private static final class PrefixMapping { + private final String prefix; + private final String namespaceURI; + private final PrefixMapping previous; + + PrefixMapping(String prefix, String namespaceURI, PrefixMapping prev) { + this.prefix = prefix; + this.namespaceURI = namespaceURI; + this.previous = prev; + } + + PrefixMapping getPrevious() { + return previous; + } + } + + private void startCollectingCharacters() { + if (!collectingCharacters) { + collectingCharacters = true; + charBuf.setLength(0); + } + } + + private void flushCharacters() throws SAXException { + collectingCharacters = false; + int len = charBuf.length(); + for (int i = 0; i < len; i++) { + switch (charBuf.charAt(i)) { + case ' ': + case '\r': + case '\t': + case '\n': + break; + default: + text(); + return; + } + } + } + + public void startElement(String namespaceURI, + String localName, + String qName, + Attributes atts) throws SAXException { + if (collectingCharacters) + flushCharacters(); + + Name name = new Name(namespaceURI, localName); + if (!setMemo(memo.startTagOpenDeriv(name))) { + PatternMemo next = memo.startTagOpenRecoverDeriv(name); + if (!next.isNotAllowed()) + error("required_elements_missing"); + else { + next = builder.getPatternMemo(builder.makeAfter(findElement(name), memo.getPattern())); + error(next.isNotAllowed() ? "unknown_element" : "out_of_context_element", name); + } + memo = next; + } + int len = atts.getLength(); + for (int i = 0; i < len; i++) { + Name attName = new Name(atts.getURI(i), atts.getLocalName(i)); + + if (!setMemo(memo.startAttributeDeriv(attName))) + error("impossible_attribute_ignored", attName); + else if (!setMemo(memo.dataDeriv(atts.getValue(i), this))) { + error("bad_attribute_value", attName); + memo = memo.recoverAfter(); + } + } + if (!setMemo(memo.endAttributes())) { + // XXX should specify which attributes + error("required_attributes_missing"); + memo = memo.ignoreMissingAttributes(); + } + if (memo.getPattern().getContentType() == Pattern.DATA_CONTENT_TYPE) + startCollectingCharacters(); + } + + private PatternMemo fixAfter(PatternMemo p) { + return builder.getPatternMemo(p.getPattern().applyForPattern(new ApplyAfterFunction(builder) { + Pattern apply(Pattern p) { + return builder.makeEmpty(); + } + })); + } + + public void endElement(String namespaceURI, + String localName, + String qName) throws SAXException { + // The tricky thing here is that the derivative that we compute may be notAllowed simply because the parent + // is notAllowed; we don't want to give an error in this case. + if (collectingCharacters) { + collectingCharacters = false; + if (!setMemo(memo.textOnly())) { + error("only_text_not_allowed"); + memo = memo.recoverAfter(); + return; + } + final String data = charBuf.toString(); + if (!setMemo(memo.dataDeriv(data, this))) { + PatternMemo next = memo.recoverAfter(); + if (!memo.isNotAllowed()) { + if (!next.isNotAllowed() + || fixAfter(memo).dataDeriv(data, this).isNotAllowed()) + error("string_not_allowed"); + } + memo = next; + } + } + else if (!setMemo(memo.endTagDeriv())) { + PatternMemo next = memo.recoverAfter(); + if (!memo.isNotAllowed()) { + if (!next.isNotAllowed() + || fixAfter(memo).endTagDeriv().isNotAllowed()) + error("unfinished_element"); + } + memo = next; + } + } + + public void characters(char ch[], int start, int length) throws SAXException { + if (collectingCharacters) { + charBuf.append(ch, start, length); + return; + } + for (int i = 0; i < length; i++) { + switch (ch[start + i]) { + case ' ': + case '\r': + case '\t': + case '\n': + break; + default: + text(); + return; + } + } + } + + private void text() throws SAXException { + if (!setMemo(memo.mixedTextDeriv())) + error("text_not_allowed"); + } + + public void endDocument() { + // XXX maybe check that memo.isNullable if !hadError + } + + public void setDocumentLocator(Locator loc) { + locator = loc; + } + + public void startDocument() throws SAXException { + if (memo.isNotAllowed()) + error("schema_allows_nothing"); + } + public void processingInstruction(String target, String date) { } + public void skippedEntity(String name) { } + public void ignorableWhitespace(char[] ch, int start, int len) { } + public void startPrefixMapping(String prefix, String uri) { + prefixMapping = new PrefixMapping(prefix, uri, prefixMapping); + } + public void endPrefixMapping(String prefix) { + prefixMapping = prefixMapping.getPrevious(); + } + + public PatternValidator(Pattern pattern, ValidatorPatternBuilder builder, ErrorHandler eh) { + this.start = pattern; + this.builder = builder; + this.eh = eh; + reset(); + } + + public void reset() { + hadError = false; + collectingCharacters = false; + locator = null; + memo = builder.getPatternMemo(start); + prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null); + clearDtdContext(); + } + + public ContentHandler getContentHandler() { + return this; + } + + public DTDHandler getDTDHandler() { + return this; + } + + private void error(String key) throws SAXException { + if (hadError && memo.isNotAllowed()) + return; + hadError = true; + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key), locator)); + } + + private void error(String key, Name arg) throws SAXException { + error(key, NameFormatter.format(arg)); + } + + private void error(String key, String arg) throws SAXException { + if (hadError && memo.isNotAllowed()) + return; + hadError = true; + eh.error(new SAXParseException(SchemaBuilderImpl.localizer.message(key, arg), locator)); + } + + /* Return false if m is notAllowed. */ + private boolean setMemo(PatternMemo m) { + if (m.isNotAllowed()) + return false; + else { + memo = m; + return true; + } + } + + private Pattern findElement(Name name) { + if (recoverPatternTable == null) + recoverPatternTable = new Hashtable(); + Pattern p = (Pattern)recoverPatternTable.get(name); + if (p == null) { + p = FindElementFunction.findElement(builder, name, start); + recoverPatternTable.put(name, p); + } + return p; + } + + public String resolveNamespacePrefix(String prefix) { + PrefixMapping tem = prefixMapping; + do { + if (tem.prefix.equals(prefix)) + return tem.namespaceURI; + tem = tem.previous; + } while (tem != null); + return null; + } + + public String getBaseUri() { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternVisitor.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternVisitor.java new file mode 100644 index 0000000..d590b35 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/PatternVisitor.java @@ -0,0 +1,20 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; + +public interface PatternVisitor { + void visitEmpty(); + void visitNotAllowed(); + void visitError(); + void visitGroup(Pattern p1, Pattern p2); + void visitInterleave(Pattern p1, Pattern p2); + void visitChoice(Pattern p1, Pattern p2); + void visitOneOrMore(Pattern p); + void visitElement(NameClass nc, Pattern content); + void visitAttribute(NameClass ns, Pattern value); + void visitData(Datatype dt); + void visitDataExcept(Datatype dt, Pattern except); + void visitValue(Datatype dt, Object obj); + void visitText(); + void visitList(Pattern p); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RecoverAfterFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RecoverAfterFunction.java new file mode 100644 index 0000000..765e009 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RecoverAfterFunction.java @@ -0,0 +1,22 @@ +package com.thaiopensource.relaxng.impl; + +class RecoverAfterFunction extends AbstractPatternFunction { + private final ValidatorPatternBuilder builder; + + RecoverAfterFunction(ValidatorPatternBuilder builder) { + this.builder = builder; + } + + public Object caseOther(Pattern p) { + throw new RuntimeException("recover after botch"); + } + + public Object caseChoice(ChoicePattern p) { + return builder.makeChoice(p.getOperand1().applyForPattern(this), + p.getOperand2().applyForPattern(this)); + } + + public Object caseAfter(AfterPattern p) { + return p.getOperand2(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RefPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RefPattern.java new file mode 100644 index 0000000..0a7de03 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RefPattern.java @@ -0,0 +1,105 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +class RefPattern extends Pattern { + private Pattern p; + private Locator refLoc; + private final String name; + private int checkRecursionDepth = -1; + private boolean combineImplicit = false; + private byte combineType = COMBINE_NONE; + private byte replacementStatus = REPLACEMENT_KEEP; + private boolean expanded = false; + + static final byte REPLACEMENT_KEEP = 0; + static final byte REPLACEMENT_REQUIRE = 1; + static final byte REPLACEMENT_IGNORE = 2; + + static final byte COMBINE_NONE = 0; + static final byte COMBINE_CHOICE = 1; + static final byte COMBINE_INTERLEAVE = 2; + + RefPattern(String name) { + this.name = name; + } + + Pattern getPattern() { + return p; + } + + void setPattern(Pattern p) { + this.p = p; + } + + Locator getRefLocator() { + return refLoc; + } + + void setRefLocator(Locator loc) { + this.refLoc = loc; + } + + void checkRecursion(int depth) throws SAXException { + if (checkRecursionDepth == -1) { + checkRecursionDepth = depth; + p.checkRecursion(depth); + checkRecursionDepth = -2; + } + else if (depth == checkRecursionDepth) + // XXX try to recover from this? + throw new SAXParseException(SchemaBuilderImpl.localizer.message("recursive_reference", name), + refLoc); + } + + Pattern expand(SchemaPatternBuilder b) { + if (!expanded) { + p = p.expand(b); + expanded = true; + } + return p; + } + + boolean samePattern(Pattern other) { + return false; + } + + void accept(PatternVisitor visitor) { + p.accept(visitor); + } + + Object apply(PatternFunction f) { + return f.caseRef(this); + } + + byte getReplacementStatus() { + return replacementStatus; + } + + void setReplacementStatus(byte replacementStatus) { + this.replacementStatus = replacementStatus; + } + + boolean isCombineImplicit() { + return combineImplicit; + } + + void setCombineImplicit() { + combineImplicit = true; + } + + byte getCombineType() { + return combineType; + } + + void setCombineType(byte combineType) { + this.combineType = combineType; + } + + String getName() { + return name; + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RestrictionViolationException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RestrictionViolationException.java new file mode 100644 index 0000000..223df74 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/RestrictionViolationException.java @@ -0,0 +1,37 @@ +package com.thaiopensource.relaxng.impl; + +import org.xml.sax.Locator; +import com.thaiopensource.xml.util.Name; + +class RestrictionViolationException extends Exception { + private final String messageId; + private Locator loc; + private Name name; + + RestrictionViolationException(String messageId) { + this.messageId = messageId; + } + + RestrictionViolationException(String messageId, Name name) { + this.messageId = messageId; + this.name = name; + } + + String getMessageId() { + return messageId; + } + + Locator getLocator() { + return loc; + } + + void maybeSetLocator(Locator loc) { + if (this.loc == null) + this.loc = loc; + } + + Name getName() { + return name; + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.java new file mode 100644 index 0000000..970c225 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaBuilderImpl.java @@ -0,0 +1,896 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.Context; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.SubParser; +import com.thaiopensource.relaxng.parse.ParseReceiver; +import com.thaiopensource.relaxng.parse.ParsedPatternFuture; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.xml.util.Name; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.DatatypeLibrary; +import org.relaxng.datatype.DatatypeLibraryFactory; +import org.relaxng.datatype.ValidationContext; +import org.relaxng.datatype.DatatypeBuilder; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.io.IOException; + +public class SchemaBuilderImpl implements SchemaBuilder, ElementAnnotationBuilder, CommentList { + private final SchemaBuilderImpl parent; + private boolean hadError = false; + private final SubParser subParser; + private final SchemaPatternBuilder pb; + private final DatatypeLibraryFactory datatypeLibraryFactory; + private final String inheritNs; + private final ErrorHandler eh; + private final OpenIncludes openIncludes; + private final AttributeNameClassChecker attributeNameClassChecker = new AttributeNameClassChecker(); + static final Localizer localizer = new Localizer(SchemaBuilderImpl.class); + + static class OpenIncludes { + final String uri; + final OpenIncludes parent; + + OpenIncludes(String uri, OpenIncludes parent) { + this.uri = uri; + this.parent = parent; + } + } + + static public Pattern parse(Parseable parseable, + ErrorHandler eh, + DatatypeLibraryFactory datatypeLibraryFactory, + SchemaPatternBuilder pb, + boolean isAttributesPattern) + throws IncorrectSchemaException, IOException, SAXException { + try { + SchemaBuilderImpl sb = new SchemaBuilderImpl(parseable, + eh, + new BuiltinDatatypeLibraryFactory(datatypeLibraryFactory), + pb); + ParsedPattern pp = parseable.parse(sb, new RootScope(sb)); + if (isAttributesPattern) + pp = sb.wrapAttributesPattern(pp); + return sb.expandPattern((Pattern)pp); + } + catch (IllegalSchemaException e) { + throw new IncorrectSchemaException(); + } + catch (BuildException e) { + throw unwrapBuildException(e); + } + } + + + static public PatternFuture installHandlers(ParseReceiver parser, XMLReader xr, ErrorHandler eh, DatatypeLibraryFactory dlf, + SchemaPatternBuilder pb) + throws SAXException { + final SchemaBuilderImpl sb = new SchemaBuilderImpl(parser, + eh, + new BuiltinDatatypeLibraryFactory(dlf), + pb); + final ParsedPatternFuture pf = parser.installHandlers(xr, sb, new RootScope(sb)); + return new PatternFuture() { + public Pattern getPattern(boolean isAttributesPattern) throws IncorrectSchemaException, SAXException, IOException { + try { + ParsedPattern pp = pf.getParsedPattern(); + if (isAttributesPattern) + pp = sb.wrapAttributesPattern(pp); + return sb.expandPattern((Pattern)pp); + } + catch (IllegalSchemaException e) { + throw new IncorrectSchemaException(); + } + catch (BuildException e) { + throw unwrapBuildException(e); + } + } + }; + } + + static RuntimeException unwrapBuildException(BuildException e) throws SAXException, IncorrectSchemaException, IOException { + Throwable t = e.getCause(); + if (t instanceof IOException) + throw (IOException)t; + if (t instanceof RuntimeException) + return (RuntimeException)t; + if (t instanceof IllegalSchemaException) + throw new IncorrectSchemaException(); + if (t instanceof SAXException) + throw (SAXException)t; + if (t instanceof Exception) + throw new SAXException((Exception)t); + throw new SAXException(t.getClass().getName() + " thrown"); + } + + private ParsedPattern wrapAttributesPattern(ParsedPattern pattern) { + // XXX where can we get a locator from? + return makeElement(makeAnyName(null, null), pattern, null, null); + } + + private Pattern expandPattern(Pattern pattern) throws IllegalSchemaException, BuildException { + if (!hadError) { + try { + pattern.checkRecursion(0); + pattern = pattern.expand(pb); + pattern.checkRestrictions(Pattern.START_CONTEXT, null, null); + if (!hadError) + return pattern; + } + catch (SAXParseException e) { + error(e); + } + catch (SAXException e) { + throw new BuildException(e); + } + catch (RestrictionViolationException e) { + if (e.getName() != null) + error(e.getMessageId(), NameFormatter.format(e.getName()), e.getLocator()); + else + error(e.getMessageId(), e.getLocator()); + } + } + throw new IllegalSchemaException(); + } + + private SchemaBuilderImpl(SubParser subParser, + ErrorHandler eh, + DatatypeLibraryFactory datatypeLibraryFactory, + SchemaPatternBuilder pb) { + this.parent = null; + this.subParser = subParser; + this.eh = eh; + this.datatypeLibraryFactory = datatypeLibraryFactory; + this.pb = pb; + this.inheritNs = ""; + this.openIncludes = null; + } + + private SchemaBuilderImpl(String inheritNs, + String uri, + SchemaBuilderImpl parent) { + this.parent = parent; + this.subParser = parent.subParser; + this.eh = parent.eh; + this.datatypeLibraryFactory = parent.datatypeLibraryFactory; + this.pb = parent.pb; + this.inheritNs = parent.resolveInherit(inheritNs); + this.openIncludes = new OpenIncludes(uri, parent.openIncludes); + } + + public ParsedPattern makeChoice(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) + throws BuildException { + if (nPatterns <= 0) + throw new IllegalArgumentException(); + Pattern result = (Pattern)patterns[0]; + for (int i = 1; i < nPatterns; i++) + result = pb.makeChoice(result, (Pattern)patterns[i]); + return result; + } + + public ParsedPattern makeInterleave(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) + throws BuildException { + if (nPatterns <= 0) + throw new IllegalArgumentException(); + Pattern result = (Pattern)patterns[0]; + for (int i = 1; i < nPatterns; i++) + result = pb.makeInterleave(result, (Pattern)patterns[i]); + return result; + } + + public ParsedPattern makeGroup(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) + throws BuildException { + if (nPatterns <= 0) + throw new IllegalArgumentException(); + Pattern result = (Pattern)patterns[0]; + for (int i = 1; i < nPatterns; i++) + result = pb.makeGroup(result, (Pattern)patterns[i]); + return result; + } + + public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeOneOrMore((Pattern)p); + } + + public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeZeroOrMore((Pattern)p); + } + + public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeOptional((Pattern)p); + } + + public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeList((Pattern)p, (Locator)loc); + } + + public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeMixed((Pattern)p); + } + + public ParsedPattern makeEmpty(Location loc, Annotations anno) { + return pb.makeEmpty(); + } + + public ParsedPattern makeNotAllowed(Location loc, Annotations anno) { + return pb.makeUnexpandedNotAllowed(); + } + + public ParsedPattern makeText(Location loc, Annotations anno) { + return pb.makeText(); + } + + public ParsedPattern makeErrorPattern() { + return pb.makeError(); + } + + public ParsedNameClass makeErrorNameClass() { + return new ErrorNameClass(); + } + + public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + String messageId = attributeNameClassChecker.checkNameClass((NameClass)nc); + if (messageId != null) + error(messageId, (Locator)loc); + return pb.makeAttribute((NameClass)nc, (Pattern)p, (Locator)loc); + } + + public ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) + throws BuildException { + return pb.makeElement((NameClass)nc, (Pattern)p, (Locator)loc); + } + + private class DummyDataPatternBuilder implements DataPatternBuilder { + public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno) + throws BuildException { + } + + public void annotation(ParsedElementAnnotation ea) + throws BuildException { + } + + public ParsedPattern makePattern(Location loc, Annotations anno) + throws BuildException { + return pb.makeError(); + } + + public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) + throws BuildException { + return pb.makeError(); + } + } + + private class ValidationContextImpl implements ValidationContext { + private final ValidationContext vc; + private final String ns; + + ValidationContextImpl(ValidationContext vc, String ns) { + this.vc = vc; + this.ns = ns.length() == 0 ? null : ns; + } + + public String resolveNamespacePrefix(String prefix) { + String result = prefix.length() == 0 ? ns : vc.resolveNamespacePrefix(prefix); + if (result == INHERIT_NS) { + if (inheritNs.length() == 0) + return null; + return inheritNs; + } + return result; + } + + public String getBaseUri() { + return vc.getBaseUri(); + } + + public boolean isUnparsedEntity(String entityName) { + return vc.isUnparsedEntity(entityName); + } + + public boolean isNotation(String notationName) { + return vc.isNotation(notationName); + } + } + + private class DataPatternBuilderImpl implements DataPatternBuilder { + private final DatatypeBuilder dtb; + DataPatternBuilderImpl(DatatypeBuilder dtb) { + this.dtb = dtb; + } + + public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno) + throws BuildException { + try { + dtb.addParameter(name, value, new ValidationContextImpl(context, ns)); + } + catch (DatatypeException e) { + String detail = e.getMessage(); + int pos = e.getIndex(); + String displayedParam; + if (pos == DatatypeException.UNKNOWN) + displayedParam = null; + else + displayedParam = displayParam(value, pos); + if (displayedParam != null) { + if (detail != null) + error("invalid_param_detail_display", detail, displayedParam, (Locator)loc); + else + error("invalid_param_display", displayedParam, (Locator)loc); + } + else if (detail != null) + error("invalid_param_detail", detail, (Locator)loc); + else + error("invalid_param", (Locator)loc); + } + } + + public void annotation(ParsedElementAnnotation ea) + throws BuildException { + } + + String displayParam(String value, int pos) { + if (pos < 0) + pos = 0; + else if (pos > value.length()) + pos = value.length(); + return localizer.message("display_param", value.substring(0, pos), value.substring(pos)); + } + + public ParsedPattern makePattern(Location loc, Annotations anno) + throws BuildException { + try { + return pb.makeData(dtb.createDatatype()); + } + catch (DatatypeException e) { + String detail = e.getMessage(); + if (detail != null) + error("invalid_params_detail", detail, (Locator)loc); + else + error("invalid_params", (Locator)loc); + return pb.makeError(); + } + } + + public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) + throws BuildException { + try { + return pb.makeDataExcept(dtb.createDatatype(), (Pattern)except, (Locator)loc); + } + catch (DatatypeException e) { + String detail = e.getMessage(); + if (detail != null) + error("invalid_params_detail", detail, (Locator)loc); + else + error("invalid_params", (Locator)loc); + return pb.makeError(); + } + } + } + + public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc) + throws BuildException { + DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary); + if (dl == null) + error("unrecognized_datatype_library", datatypeLibrary, (Locator)loc); + else { + try { + return new DataPatternBuilderImpl(dl.createDatatypeBuilder(type)); + } + catch (DatatypeException e) { + String detail = e.getMessage(); + if (detail != null) + error("unsupported_datatype_detail", datatypeLibrary, type, detail, (Locator)loc); + else + error("unrecognized_datatype", datatypeLibrary, type, (Locator)loc); + } + } + return new DummyDataPatternBuilder(); + } + + public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context context, String ns, + Location loc, Annotations anno) throws BuildException { + DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary); + if (dl == null) + error("unrecognized_datatype_library", datatypeLibrary, (Locator)loc); + else { + try { + DatatypeBuilder dtb = dl.createDatatypeBuilder(type); + try { + Datatype dt = dtb.createDatatype(); + Object obj = dt.createValue(value, new ValidationContextImpl(context, ns)); + if (obj != null) + return pb.makeValue(dt, obj); + error("invalid_value", value, (Locator)loc); + } + catch (DatatypeException e) { + String detail = e.getMessage(); + if (detail != null) + error("datatype_requires_param_detail", detail, (Locator)loc); + else + error("datatype_requires_param", (Locator)loc); + } + } + catch (DatatypeException e) { + error("unrecognized_datatype", datatypeLibrary, type, (Locator)loc); + } + } + return pb.makeError(); + } + + static class GrammarImpl implements Grammar, Div, IncludedGrammar { + private final SchemaBuilderImpl sb; + private final Hashtable defines; + private final RefPattern startRef; + private final Scope parent; + + private GrammarImpl(SchemaBuilderImpl sb, Scope parent) { + this.sb = sb; + this.parent = parent; + this.defines = new Hashtable(); + this.startRef = new RefPattern(null); + } + + protected GrammarImpl(SchemaBuilderImpl sb, GrammarImpl g) { + this.sb = sb; + parent = g.parent; + startRef = g.startRef; + defines = g.defines; + } + + public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException { + for (Enumeration enumList = defines.keys(); + enumList.hasMoreElements();) { + String name = (String)enumList.nextElement(); + RefPattern rp = (RefPattern)defines.get(name); + if (rp.getPattern() == null) { + sb.error("reference_to_undefined", name, rp.getRefLocator()); + rp.setPattern(sb.pb.makeError()); + } + } + Pattern start = startRef.getPattern(); + if (start == null) { + sb.error("missing_start_element", (Locator)loc); + start = sb.pb.makeError(); + } + return start; + } + + public void endDiv(Location loc, Annotations anno) throws BuildException { + // nothing to do + } + + public ParsedPattern endIncludedGrammar(Location loc, Annotations anno) throws BuildException { + return null; + } + + public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno) + throws BuildException { + define(lookup(name), combine, pattern, loc); + } + + private void define(RefPattern rp, GrammarSection.Combine combine, ParsedPattern pattern, Location loc) + throws BuildException { + switch (rp.getReplacementStatus()) { + case RefPattern.REPLACEMENT_KEEP: + if (combine == null) { + if (rp.isCombineImplicit()) { + if (rp.getName() == null) + sb.error("duplicate_start", (Locator)loc); + else + sb.error("duplicate_define", rp.getName(), (Locator)loc); + } + else + rp.setCombineImplicit(); + } + else { + byte combineType = (combine == COMBINE_CHOICE ? RefPattern.COMBINE_CHOICE : RefPattern.COMBINE_INTERLEAVE); + if (rp.getCombineType() != RefPattern.COMBINE_NONE + && rp.getCombineType() != combineType) { + if (rp.getName() == null) + sb.error("conflict_combine_start", (Locator)loc); + else + sb.error("conflict_combine_define", rp.getName(), (Locator)loc); + } + rp.setCombineType(combineType); + } + Pattern p = (Pattern)pattern; + if (rp.getPattern() == null) + rp.setPattern(p); + else if (rp.getCombineType() == RefPattern.COMBINE_INTERLEAVE) + rp.setPattern(sb.pb.makeInterleave(rp.getPattern(), p)); + else + rp.setPattern(sb.pb.makeChoice(rp.getPattern(), p)); + break; + case RefPattern.REPLACEMENT_REQUIRE: + rp.setReplacementStatus(RefPattern.REPLACEMENT_IGNORE); + break; + case RefPattern.REPLACEMENT_IGNORE: + break; + } + } + + public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException { + } + + public void topLevelComment(CommentList comments) throws BuildException { + } + + private RefPattern lookup(String name) { + if (name == START) + return startRef; + return lookup1(name); + } + + private RefPattern lookup1(String name) { + RefPattern p = (RefPattern)defines.get(name); + if (p == null) { + p = new RefPattern(name); + defines.put(name, p); + } + return p; + } + + public ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException { + RefPattern p = lookup1(name); + if (p.getRefLocator() == null && loc != null) + p.setRefLocator((Locator)loc); + return p; + } + + public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException { + if (parent == null) { + sb.error("parent_ref_outside_grammar", (Locator)loc); + return sb.makeErrorPattern(); + } + return parent.makeRef(name, loc, anno); + } + + public Div makeDiv() { + return this; + } + + public Include makeInclude() { + return new IncludeImpl(sb, this); + } + + } + + static class RootScope implements Scope { + private final SchemaBuilderImpl sb; + RootScope(SchemaBuilderImpl sb) { + this.sb = sb; + } + + public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException { + sb.error("parent_ref_outside_grammar", (Locator)loc); + return sb.makeErrorPattern(); + } + public ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException { + sb.error("ref_outside_grammar", (Locator)loc); + return sb.makeErrorPattern(); + } + + } + + static class Override { + Override(RefPattern prp, Override next) { + this.prp = prp; + this.next = next; + } + + final RefPattern prp; + final Override next; + byte replacementStatus; + } + + + private static class IncludeImpl implements Include, Div { + private final SchemaBuilderImpl sb; + private Override overrides; + private final GrammarImpl grammar; + + private IncludeImpl(SchemaBuilderImpl sb, GrammarImpl grammar) { + this.sb = sb; + this.grammar = grammar; + } + + public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno) + throws BuildException { + RefPattern rp = grammar.lookup(name); + overrides = new Override(rp, overrides); + grammar.define(rp, combine, pattern, loc); + } + + public void endDiv(Location loc, Annotations anno) throws BuildException { + // nothing to do + } + + public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException { + // nothing to do + } + + public void topLevelComment(CommentList comments) throws BuildException { + } + + public Div makeDiv() { + return this; + } + + public void endInclude(String uri, String ns, + Location loc, Annotations anno) throws BuildException { + for (OpenIncludes inc = sb.openIncludes; + inc != null; + inc = inc.parent) { + if (inc.uri.equals(uri)) { + sb.error("recursive_include", uri, (Locator)loc); + return; + } + } + + for (Override o = overrides; o != null; o = o.next) { + o.replacementStatus = o.prp.getReplacementStatus(); + o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE); + } + try { + SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb); + sb.subParser.parseInclude(uri, isb, new GrammarImpl(isb, grammar)); + for (Override o = overrides; o != null; o = o.next) { + if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) { + if (o.prp.getName() == null) + sb.error("missing_start_replacement", (Locator)loc); + else + sb.error("missing_define_replacement", o.prp.getName(), (Locator)loc); + } + } + } + catch (IllegalSchemaException e) { + sb.noteError(); + } + finally { + for (Override o = overrides; o != null; o = o.next) + o.prp.setReplacementStatus(o.replacementStatus); + } + } + + public Include makeInclude() { + return null; + } + } + + public Grammar makeGrammar(Scope parent) { + return new GrammarImpl(this, parent); + } + + public ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException { + return p; + } + + public ParsedNameClass annotate(ParsedNameClass nc, Annotations anno) throws BuildException { + return nc; + } + + public ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException { + return p; + } + + public ParsedNameClass annotateAfter(ParsedNameClass nc, ParsedElementAnnotation e) throws BuildException { + return nc; + } + + public ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException { + return p; + } + + public ParsedNameClass commentAfter(ParsedNameClass nc, CommentList comments) throws BuildException { + return nc; + } + + public ParsedPattern makeExternalRef(String uri, String ns, Scope scope, + Location loc, Annotations anno) + throws BuildException { + for (OpenIncludes inc = openIncludes; + inc != null; + inc = inc.parent) { + if (inc.uri.equals(uri)) { + error("recursive_include", uri, (Locator)loc); + return pb.makeError(); + } + } + try { + return subParser.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope); + } + catch (IllegalSchemaException e) { + noteError(); + return pb.makeError(); + } + } + + public ParsedNameClass makeChoice(ParsedNameClass[] nameClasses, int nNameClasses, Location loc, Annotations anno) { + if (nNameClasses <= 0) + throw new IllegalArgumentException(); + NameClass result = (NameClass)nameClasses[0]; + for (int i = 1; i < nNameClasses; i++) + result = new ChoiceNameClass(result, (NameClass)nameClasses[i]); + return result; + } + + public ParsedNameClass makeName(String ns, String localName, String prefix, Location loc, Annotations anno) { + return new SimpleNameClass(new Name(resolveInherit(ns), localName)); + } + + public ParsedNameClass makeNsName(String ns, Location loc, Annotations anno) { + return new NsNameClass(resolveInherit(ns)); + } + + public ParsedNameClass makeNsName(String ns, ParsedNameClass except, Location loc, Annotations anno) { + return new NsNameExceptNameClass(resolveInherit(ns), (NameClass)except); + } + + public ParsedNameClass makeAnyName(Location loc, Annotations anno) { + return new AnyNameClass(); + } + + public ParsedNameClass makeAnyName(ParsedNameClass except, Location loc, Annotations anno) { + return new AnyNameExceptNameClass((NameClass)except); + } + + private final String resolveInherit(String ns) { + if (ns == INHERIT_NS) + return inheritNs; + return ns; + } + + private class LocatorImpl implements Locator, Location { + private final String systemId; + private final int lineNumber; + private final int columnNumber; + + private LocatorImpl(String systemId, int lineNumber, int columnNumber) { + this.systemId = systemId; + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; + } + + public String getPublicId() { + return null; + } + + public String getSystemId() { + return systemId; + } + + public int getLineNumber() { + return lineNumber; + } + + public int getColumnNumber() { + return columnNumber; + } + } + + public Location makeLocation(String systemId, int lineNumber, int columnNumber) { + return new LocatorImpl(systemId, lineNumber, columnNumber); + } + + public Annotations makeAnnotations(CommentList comments, Context context) { + return this; + } + + public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, + Location loc, CommentList comments, Context context) { + return this; + } + + public CommentList makeCommentList() { + return this; + } + + public void addComment(String value, Location loc) throws BuildException { + } + + public void addAttribute(String ns, String localName, String prefix, String value, Location loc) { + // nothing needed + } + + public void addElement(ParsedElementAnnotation ea) { + // nothing needed + } + + public void addComment(CommentList comments) throws BuildException { + // nothing needed + } + + public void addLeadingComment(CommentList comments) throws BuildException { + // nothing needed + } + + public void addText(String value, Location loc, CommentList comments) { + // nothing needed + } + + public ParsedElementAnnotation makeElementAnnotation() { + return null; + } + + public boolean usesComments() { + return false; + } + + private void error(SAXParseException message) throws BuildException { + noteError(); + try { + if (eh != null) + eh.error(message); + } + catch (SAXException e) { + throw new BuildException(e); + } + } + + /* + private void warning(SAXParseException message) throws BuildException { + try { + if (eh != null) + eh.warning(message); + } + catch (SAXException e) { + throw new BuildException(e); + } + } + */ + + private void error(String key, Locator loc) throws BuildException { + error(new SAXParseException(localizer.message(key), loc)); + } + + private void error(String key, String arg, Locator loc) throws BuildException { + error(new SAXParseException(localizer.message(key, arg), loc)); + } + + private void error(String key, String arg1, String arg2, Locator loc) throws BuildException { + error(new SAXParseException(localizer.message(key, arg1, arg2), loc)); + } + + private void error(String key, String arg1, String arg2, String arg3, Locator loc) throws BuildException { + error(new SAXParseException(localizer.message(key, new Object[]{arg1, arg2, arg3}), loc)); + } + private void noteError() { + if (!hadError && parent != null) + parent.noteError(); + hadError = true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.java new file mode 100644 index 0000000..65a239a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaPatternBuilder.java @@ -0,0 +1,90 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.xml.sax.Locator; + +public class SchemaPatternBuilder extends PatternBuilder { + private boolean idTypes; + private final UnexpandedNotAllowedPattern unexpandedNotAllowed = new UnexpandedNotAllowedPattern(); + private final TextPattern text = new TextPattern(); + private final PatternInterner schemaInterner = new PatternInterner(); + + public SchemaPatternBuilder() { } + + public boolean hasIdTypes() { + return idTypes; + } + + Pattern makeElement(NameClass nameClass, Pattern content, Locator loc) { + Pattern p = new ElementPattern(nameClass, content, loc); + return schemaInterner.intern(p); + } + + Pattern makeAttribute(NameClass nameClass, Pattern value, Locator loc) { + if (value == notAllowed) + return value; + Pattern p = new AttributePattern(nameClass, value, loc); + return schemaInterner.intern(p); + } + + Pattern makeData(Datatype dt) { + noteDatatype(dt); + Pattern p = new DataPattern(dt); + return schemaInterner.intern(p); + } + + Pattern makeDataExcept(Datatype dt, Pattern except, Locator loc) { + noteDatatype(dt); + Pattern p = new DataExceptPattern(dt, except, loc); + return schemaInterner.intern(p); + } + + Pattern makeValue(Datatype dt, Object obj) { + noteDatatype(dt); + Pattern p = new ValuePattern(dt, obj); + return schemaInterner.intern(p); + } + + Pattern makeText() { + return text; + } + + Pattern makeOneOrMore(Pattern p) { + if (p == text) + return p; + return super.makeOneOrMore(p); + } + + Pattern makeUnexpandedNotAllowed() { + return unexpandedNotAllowed; + } + + Pattern makeError() { + Pattern p = new ErrorPattern(); + return schemaInterner.intern(p); + } + + Pattern makeChoice(Pattern p1, Pattern p2) { + if (p1 == notAllowed || p1 == p2) + return p2; + if (p2 == notAllowed) + return p1; + return super.makeChoice(p1, p2); + } + + Pattern makeList(Pattern p, Locator loc) { + if (p == notAllowed) + return p; + Pattern p1 = new ListPattern(p, loc); + return schemaInterner.intern(p1); + } + + Pattern makeMixed(Pattern p) { + return makeInterleave(text, p); + } + + private void noteDatatype(Datatype dt) { + if (dt.getIdType() != Datatype.ID_TYPE_NULL) + idTypes = true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReaderImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReaderImpl.java new file mode 100644 index 0000000..b0c3288 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReaderImpl.java @@ -0,0 +1,72 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.nrl.NrlSchemaReceiverFactory; +import com.thaiopensource.validate.nrl.NrlProperty; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.relaxng.datatype.DatatypeLibraryFactory; +import org.relaxng.datatype.helpers.DatatypeLibraryLoader; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import java.io.IOException; + +public abstract class SchemaReaderImpl implements SchemaReader { + private static final PropertyId[] supportedPropertyIds = { + ValidateProperty.XML_READER_CREATOR, + ValidateProperty.ERROR_HANDLER, + RngProperty.DATATYPE_LIBRARY_FACTORY, + RngProperty.CHECK_ID_IDREF, + RngProperty.FEASIBLE, + NrlProperty.ATTRIBUTES_SCHEMA, + }; + + public Schema createSchema(InputSource in, PropertyMap properties) + throws IOException, SAXException, IncorrectSchemaException { + SchemaPatternBuilder spb = new SchemaPatternBuilder(); + XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties); + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + DatatypeLibraryFactory dlf = RngProperty.DATATYPE_LIBRARY_FACTORY.get(properties); + if (dlf == null) + dlf = new DatatypeLibraryLoader(); + Pattern start = SchemaBuilderImpl.parse(createParseable(xrc, in, eh), eh, dlf, spb, + properties.contains(NrlProperty.ATTRIBUTES_SCHEMA)); + return wrapPattern(start, spb, properties); + } + + public Option getOption(String uri) { + return RngProperty.getOption(uri); + } + + static Schema wrapPattern(Pattern start, SchemaPatternBuilder spb, PropertyMap properties) throws SAXException, IncorrectSchemaException { + properties = AbstractSchema.filterProperties(properties, supportedPropertyIds); + if (properties.contains(RngProperty.FEASIBLE)) + start = FeasibleTransform.transform(spb, start); + Schema schema = new PatternSchema(spb, start, properties); + if (spb.hasIdTypes() && properties.contains(RngProperty.CHECK_ID_IDREF)) { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + IdTypeMap idTypeMap = new IdTypeMapBuilder(eh, start).getIdTypeMap(); + if (idTypeMap == null) + throw new IncorrectSchemaException(); + Schema idSchema; + if (properties.contains(RngProperty.FEASIBLE)) + idSchema = new FeasibleIdTypeMapSchema(idTypeMap, properties); + else + idSchema = new IdTypeMapSchema(idTypeMap, properties); + schema = new CombineSchema(schema, idSchema, properties); + } + return schema; + } + + protected abstract Parseable createParseable(XMLReaderCreator xrc, InputSource in, ErrorHandler eh); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.java new file mode 100644 index 0000000..47c1b3d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SchemaReceiverImpl.java @@ -0,0 +1,50 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.validate.nrl.NrlSchemaReceiverFactory; +import com.thaiopensource.validate.nrl.NrlProperty; +import com.thaiopensource.validate.auto.SchemaFuture; +import com.thaiopensource.relaxng.parse.ParseReceiver; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.util.PropertyMap; +import org.relaxng.datatype.DatatypeLibraryFactory; +import org.relaxng.datatype.helpers.DatatypeLibraryLoader; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; + +public class SchemaReceiverImpl implements SchemaReceiver { + private final ParseReceiver parser; + private final PropertyMap properties; + + public SchemaReceiverImpl(ParseReceiver parser, PropertyMap properties) { + this.parser = parser; + this.properties = properties; + } + + public SchemaFuture installHandlers(XMLReader xr) throws SAXException { + final SchemaPatternBuilder pb = new SchemaPatternBuilder(); + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + DatatypeLibraryFactory dlf = RngProperty.DATATYPE_LIBRARY_FACTORY.get(properties); + if (dlf == null) + dlf = new DatatypeLibraryLoader(); + final PatternFuture pf = SchemaBuilderImpl.installHandlers(parser, xr, eh, dlf, pb); + return new SchemaFuture() { + public Schema getSchema() throws IncorrectSchemaException, SAXException, IOException { + return SchemaReaderImpl.wrapPattern(pf.getPattern(properties.contains(NrlProperty.ATTRIBUTES_SCHEMA)), + pb, properties); + } + public RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException { + if (e instanceof BuildException) + return SchemaBuilderImpl.unwrapBuildException((BuildException)e); + return e; + } + }; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SimpleNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SimpleNameClass.java new file mode 100644 index 0000000..b0aca62 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SimpleNameClass.java @@ -0,0 +1,44 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + + +class SimpleNameClass implements NameClass { + + private final Name name; + + SimpleNameClass(Name name) { + this.name = name; + } + + public boolean contains(Name name) { + return this.name.equals(name); + } + + public int containsSpecificity(Name name) { + return contains(name) ? SPECIFICITY_NAME : SPECIFICITY_NONE; + } + + public int hashCode() { + return name.hashCode(); + } + + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof SimpleNameClass)) + return false; + SimpleNameClass other = (SimpleNameClass)obj; + return name.equals(other.name); + } + + Name getName() { + return name; + } + + public void accept(NameClassVisitor visitor) { + visitor.visitName(name); + } + + public boolean isOpen() { + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SingleDataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SingleDataDerivType.java new file mode 100644 index 0000000..2b485b0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/SingleDataDerivType.java @@ -0,0 +1,26 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.ValidationContext; + +/** + * DerivType for a Pattern whose derivative wrt any data is always the same. + */ +class SingleDataDerivType extends DataDerivType { + private PatternMemo memo; + + SingleDataDerivType() { } + + PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { + if (memo == null) + memo = super.dataDeriv(builder, p, str, vc); + return memo; + } + + DataDerivType copy() { + return new SingleDataDerivType(); + } + + DataDerivType combine(DataDerivType ddt) { + return ddt; + } +} \ No newline at end of file diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.java new file mode 100644 index 0000000..8c33f18 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartAttributeDerivFunction.java @@ -0,0 +1,40 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class StartAttributeDerivFunction extends StartTagOpenDerivFunction { + StartAttributeDerivFunction(Name name, ValidatorPatternBuilder builder) { + super(name, builder); + } + + public Object caseElement(ElementPattern p) { + return getPatternBuilder().makeNotAllowed(); + } + + public Object caseGroup(GroupPattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + return getPatternBuilder().makeChoice( + memoApply(p1).applyForPattern(new ApplyAfterFunction(getPatternBuilder()) { + Pattern apply(Pattern x) { + return getPatternBuilder().makeGroup(x, p2); + } + }), + memoApply(p2).applyForPattern(new ApplyAfterFunction(getPatternBuilder()) { + Pattern apply(Pattern x) { + return getPatternBuilder().makeGroup(p1, x); + } + })); + } + + public Object caseAttribute(AttributePattern p) { + if (!p.getNameClass().contains(getName())) + return getPatternBuilder().makeNotAllowed(); + return getPatternBuilder().makeAfter(p.getContent(), + getPatternBuilder().makeEmpty()); + } + + PatternMemo apply(PatternMemo memo) { + return memo.startAttributeDeriv(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.java new file mode 100644 index 0000000..8eebf44 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenDerivFunction.java @@ -0,0 +1,95 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class StartTagOpenDerivFunction extends AbstractPatternFunction { + private final Name name; + private final ValidatorPatternBuilder builder; + + StartTagOpenDerivFunction(Name name, ValidatorPatternBuilder builder) { + this.name = name; + this.builder = builder; + } + + public Object caseChoice(ChoicePattern p) { + return builder.makeChoice(memoApply(p.getOperand1()), + memoApply(p.getOperand2())); + } + + public Object caseGroup(GroupPattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + Pattern tem = memoApply(p1).applyForPattern( + new ApplyAfterFunction(builder) { + Pattern apply(Pattern x) { + return builder.makeGroup(x, p2); + } + }); + return p1.isNullable() ? builder.makeChoice(tem, memoApply(p2)) : tem; + } + + public Object caseInterleave(InterleavePattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + return builder.makeChoice( + memoApply(p1).applyForPattern(new ApplyAfterFunction(builder) { + Pattern apply(Pattern x) { + return builder.makeInterleave(x, p2); + } + }), + memoApply(p2).applyForPattern(new ApplyAfterFunction(builder) { + Pattern apply(Pattern x) { + return builder.makeInterleave(p1, x); + } + })); + } + + public Object caseAfter(AfterPattern p) { + final Pattern p1 = p.getOperand1(); + final Pattern p2 = p.getOperand2(); + return memoApply(p1).applyForPattern( + new ApplyAfterFunction(builder) { + Pattern apply(Pattern x) { + return builder.makeAfter(x, p2); + } + }); + } + + public Object caseOneOrMore(final OneOrMorePattern p) { + final Pattern p1 = p.getOperand(); + return memoApply(p1).applyForPattern( + new ApplyAfterFunction(builder) { + Pattern apply(Pattern x) { + return builder.makeGroup(x, + builder.makeOptional(p)); + } + }); + } + + + public Object caseElement(ElementPattern p) { + if (!p.getNameClass().contains(name)) + return builder.makeNotAllowed(); + return builder.makeAfter(p.getContent(), builder.makeEmpty()); + } + + public Object caseOther(Pattern p) { + return builder.makeNotAllowed(); + } + + final Pattern memoApply(Pattern p) { + return apply(builder.getPatternMemo(p)).getPattern(); + } + + PatternMemo apply(PatternMemo memo) { + return memo.startTagOpenDeriv(this); + } + + Name getName() { + return name; + } + + ValidatorPatternBuilder getPatternBuilder() { + return builder; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.java new file mode 100644 index 0000000..c74474d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StartTagOpenRecoverDerivFunction.java @@ -0,0 +1,20 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.xml.util.Name; + +class StartTagOpenRecoverDerivFunction extends StartTagOpenDerivFunction { + StartTagOpenRecoverDerivFunction(Name name, ValidatorPatternBuilder builder) { + super(name, builder); + } + + public Object caseGroup(GroupPattern p) { + Pattern tem = (Pattern)super.caseGroup(p); + if (p.getOperand1().isNullable()) + return tem; + return getPatternBuilder().makeChoice(tem, memoApply(p.getOperand2())); + } + + PatternMemo apply(PatternMemo memo) { + return memo.startTagOpenRecoverDeriv(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringDatatype.java new file mode 100644 index 0000000..36dd7d3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringDatatype.java @@ -0,0 +1,46 @@ +package com.thaiopensource.relaxng.impl; + +import com.thaiopensource.datatype.Datatype2; +import org.relaxng.datatype.DatatypeException; +import org.relaxng.datatype.DatatypeStreamingValidator; +import org.relaxng.datatype.ValidationContext; +import org.relaxng.datatype.helpers.StreamingValidatorImpl; + +class StringDatatype implements Datatype2 { + public boolean isValid(String str, ValidationContext vc) { + return true; + } + + public void checkValid(String str, ValidationContext vc) throws DatatypeException { + if (!isValid(str, vc)) + throw new DatatypeException(); + } + + public Object createValue(String str, ValidationContext vc) { + return str; + } + + public boolean isContextDependent() { + return false; + } + + public boolean alwaysValid() { + return true; + } + + public int getIdType() { + return ID_TYPE_NULL; + } + + public boolean sameValue(Object obj1, Object obj2) { + return obj1.equals(obj2); + } + + public int valueHashCode(Object obj) { + return obj.hashCode(); + } + + public DatatypeStreamingValidator createStreamingValidator(ValidationContext vc) { + return new StreamingValidatorImpl(this, vc); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringNormalizer.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringNormalizer.java new file mode 100644 index 0000000..88650c5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringNormalizer.java @@ -0,0 +1,15 @@ +package com.thaiopensource.relaxng.impl; + +import java.util.StringTokenizer; + +class StringNormalizer { + static String normalize(String s) { + StringBuffer buf = new StringBuffer(); + for (StringTokenizer e = new StringTokenizer(s); e.hasMoreElements();) { + if (buf.length() > 0) + buf.append(' '); + buf.append((String)e.nextElement()); + } + return buf.toString(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringPattern.java new file mode 100644 index 0000000..6bbc3d0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/StringPattern.java @@ -0,0 +1,7 @@ +package com.thaiopensource.relaxng.impl; + +abstract class StringPattern extends Pattern { + StringPattern(int hc) { + super(false, DATA_CONTENT_TYPE, hc); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextOnlyFunction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextOnlyFunction.java new file mode 100644 index 0000000..452d7a2 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextOnlyFunction.java @@ -0,0 +1,19 @@ +package com.thaiopensource.relaxng.impl; + +class TextOnlyFunction extends EndAttributesFunction { + TextOnlyFunction(ValidatorPatternBuilder builder) { + super(builder); + } + public Object caseAttribute(AttributePattern p) { + return p; + } + public Object caseElement(ElementPattern p) { + return getPatternBuilder().makeNotAllowed(); + } + + PatternMemo apply(PatternMemo memo) { + return memo.textOnly(this); + } + +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextPattern.java new file mode 100644 index 0000000..489c320 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TextPattern.java @@ -0,0 +1,32 @@ +package com.thaiopensource.relaxng.impl; + +class TextPattern extends Pattern { + TextPattern() { + super(true, MIXED_CONTENT_TYPE, TEXT_HASH_CODE); + } + + boolean samePattern(Pattern other) { + return other instanceof TextPattern; + } + + void accept(PatternVisitor visitor) { + visitor.visitText(); + } + + Object apply(PatternFunction f) { + return f.caseText(this); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case DATA_EXCEPT_CONTEXT: + throw new RestrictionViolationException("data_except_contains_text"); + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_text"); + case LIST_CONTEXT: + throw new RestrictionViolationException("list_contains_text"); + } + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TokenDatatype.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TokenDatatype.java new file mode 100644 index 0000000..7b8f04c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/TokenDatatype.java @@ -0,0 +1,9 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.ValidationContext; + +class TokenDatatype extends StringDatatype { + public Object createValue(String str, ValidationContext vc) { + return StringNormalizer.normalize(str); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.java new file mode 100644 index 0000000..e53deeb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/UnexpandedNotAllowedPattern.java @@ -0,0 +1,12 @@ +package com.thaiopensource.relaxng.impl; + +class UnexpandedNotAllowedPattern extends NotAllowedPattern { + UnexpandedNotAllowedPattern() { + } + boolean isNotAllowed() { + return false; + } + Pattern expand(SchemaPatternBuilder b) { + return b.makeNotAllowed(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.java new file mode 100644 index 0000000..13c02fa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValidatorPatternBuilder.java @@ -0,0 +1,141 @@ +package com.thaiopensource.relaxng.impl; + +import java.util.Hashtable; + +public class ValidatorPatternBuilder extends PatternBuilder { + private final Hashtable patternMemoMap = new Hashtable(); + private final PatternFunction endAttributesFunction; + private final PatternFunction ignoreMissingAttributesFunction; + private final PatternFunction endTagDerivFunction; + private final PatternFunction mixedTextDerivFunction; + private final PatternFunction textOnlyFunction; + private final PatternFunction recoverAfterFunction; + private final PatternFunction dataDerivTypeFunction; + + private final Hashtable choiceMap = new Hashtable(); + private final PatternFunction removeChoicesFunction = new RemoveChoicesFunction(); + private final PatternFunction noteChoicesFunction = new NoteChoicesFunction(); + + private class NoteChoicesFunction extends AbstractPatternFunction { + public Object caseOther(Pattern p) { + choiceMap.put(p, p); + return null; + } + + public Object caseChoice(ChoicePattern p) { + p.getOperand1().apply(this); + p.getOperand2().apply(this); + return null; + } + } + + private class RemoveChoicesFunction extends AbstractPatternFunction { + public Object caseOther(Pattern p) { + if (choiceMap.get(p) != null) + return notAllowed; + return p; + } + + public Object caseChoice(ChoicePattern p) { + Pattern p1 = p.getOperand1().applyForPattern(this); + Pattern p2 = p.getOperand2().applyForPattern(this); + if (p1 == p.getOperand1() && p2 == p.getOperand2()) + return p; + if (p1 == notAllowed) + return p2; + if (p2 == notAllowed) + return p1; + Pattern p3 = new ChoicePattern(p1, p2); + return interner.intern(p3); + } + } + + public ValidatorPatternBuilder(PatternBuilder builder) { + super(builder); + endAttributesFunction = new EndAttributesFunction(this); + ignoreMissingAttributesFunction = new IgnoreMissingAttributesFunction(this); + endTagDerivFunction = new EndTagDerivFunction(this); + mixedTextDerivFunction = new MixedTextDerivFunction(this); + textOnlyFunction = new TextOnlyFunction(this); + recoverAfterFunction = new RecoverAfterFunction(this); + dataDerivTypeFunction = new DataDerivTypeFunction(this); + } + + PatternMemo getPatternMemo(Pattern p) { + PatternMemo memo = (PatternMemo)patternMemoMap.get(p); + if (memo == null) { + memo = new PatternMemo(p, this); + patternMemoMap.put(p, memo); + } + return memo; + } + + PatternFunction getEndAttributesFunction() { + return endAttributesFunction; + } + + PatternFunction getIgnoreMissingAttributesFunction() { + return ignoreMissingAttributesFunction; + } + + PatternFunction getEndTagDerivFunction() { + return endTagDerivFunction; + } + + PatternFunction getMixedTextDerivFunction() { + return mixedTextDerivFunction; + } + + PatternFunction getTextOnlyFunction() { + return textOnlyFunction; + } + + PatternFunction getRecoverAfterFunction() { + return recoverAfterFunction; + } + + PatternFunction getDataDerivTypeFunction() { + return dataDerivTypeFunction; + } + + Pattern makeAfter(Pattern p1, Pattern p2) { + Pattern p = new AfterPattern(p1, p2); + return interner.intern(p); + } + + Pattern makeChoice(Pattern p1, Pattern p2) { + if (p1 == p2) + return p1; + if (p1 == notAllowed) + return p2; + if (p2 == notAllowed) + return p1; + if (!(p1 instanceof ChoicePattern)) { + if (p2.containsChoice(p1)) + return p2; + } + else if (!(p2 instanceof ChoicePattern)) { + if (p1.containsChoice(p2)) + return p1; + } + else { + p1.apply(noteChoicesFunction); + p2 = p2.applyForPattern(removeChoicesFunction); + if (choiceMap.size() > 0) + choiceMap.clear(); + } + if (p1 instanceof AfterPattern && p2 instanceof AfterPattern) { + AfterPattern ap1 = (AfterPattern)p1; + AfterPattern ap2 = (AfterPattern)p2; + if (ap1.getOperand1() == ap2.getOperand1()) + return makeAfter(ap1.getOperand1(), makeChoice(ap1.getOperand2(), ap2.getOperand2())); + if (ap1.getOperand1() == notAllowed) + return ap2; + if (ap2.getOperand1() == notAllowed) + return ap1; + if (ap1.getOperand2() == ap2.getOperand2()) + return makeAfter(makeChoice(ap1.getOperand1(), ap2.getOperand1()), ap1.getOperand2()); + } + return super.makeChoice(p1, p2); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValueDataDerivType.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValueDataDerivType.java new file mode 100644 index 0000000..989bfaf --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValueDataDerivType.java @@ -0,0 +1,55 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; +import org.relaxng.datatype.ValidationContext; + +import java.util.Hashtable; + +class ValueDataDerivType extends DataDerivType { + private final Datatype dt; + private PatternMemo noValue; + private Hashtable valueTable; + + ValueDataDerivType(Datatype dt) { + this.dt = dt; + } + + DataDerivType copy() { + return new ValueDataDerivType(dt); + } + + PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { + Object value = dt.createValue(str, vc); + if (value == null) { + if (noValue == null) + noValue = super.dataDeriv(builder, p, str, vc); + return noValue; + } + else { + DatatypeValue dtv = new DatatypeValue(value, dt); + if (valueTable == null) + valueTable = new Hashtable(); + PatternMemo tem = (PatternMemo)valueTable.get(dtv); + if (tem == null) { + tem = super.dataDeriv(builder, p, str, vc); + valueTable.put(dtv, tem); + } + return tem; + } + } + + DataDerivType combine(DataDerivType ddt) { + if (ddt instanceof ValueDataDerivType) { + if (((ValueDataDerivType)ddt).dt == this.dt) + return this; + else + return InconsistentDataDerivType.getInstance(); + } + else + return ddt.combine(this); + } + + Datatype getDatatype() { + return dt; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValuePattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValuePattern.java new file mode 100644 index 0000000..1e33d49 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/ValuePattern.java @@ -0,0 +1,48 @@ +package com.thaiopensource.relaxng.impl; + +import org.relaxng.datatype.Datatype; + +class ValuePattern extends StringPattern { + private final Object obj; + private final Datatype dt; + + ValuePattern(Datatype dt, Object obj) { + super(combineHashCode(VALUE_HASH_CODE, obj.hashCode())); + this.dt = dt; + this.obj = obj; + } + + boolean samePattern(Pattern other) { + if (getClass() != other.getClass()) + return false; + if (!(other instanceof ValuePattern)) + return false; + return (dt.equals(((ValuePattern)other).dt) + && dt.sameValue(obj, ((ValuePattern)other).obj)); + } + + void accept(PatternVisitor visitor) { + visitor.visitValue(dt, obj); + } + + Object apply(PatternFunction f) { + return f.caseValue(this); + } + + void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) + throws RestrictionViolationException { + switch (context) { + case START_CONTEXT: + throw new RestrictionViolationException("start_contains_value"); + } + } + + Datatype getDatatype() { + return dt; + } + + Object getValue() { + return obj; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/resources/Messages.properties new file mode 100644 index 0000000..0a30b04 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/impl/resources/Messages.properties @@ -0,0 +1,102 @@ +# Properties file specifying messages +illegal_href_attribute=illegal \"href\" attribute +ns_attribute_ignored=\"ns\" attribute ignored +reference_to_undefined=reference to undefined pattern \"{0}\" +missing_start_element=missing \"start\" element +recursive_reference=bad recursive reference to pattern \"{0}\" +recursive_include=recursive inclusion of URL \"{0}\" +duplicate_define=multiple definitions of \"{0}\" without \"combine\" attribute +duplicate_start=multiple definitions of start without \"combine\" attribute +conflict_combine_define=conflicting values of \"combine\" attribute for definition of \"{0}\" +conflict_combine_start=conflicting values of \"combine\" attribute for definition of start +missing_start_replacement=\"start\" in \"include\" does not override anything +missing_define_replacement=definition of \"{0}\" in \"include\" does not override anything +interleave_string=interleave of \"string\" or \"data\" element +group_string=group of \"string\" or \"data\" element +one_or_more_string=repeat of \"string\" or \"data\" element +unrecognized_datatype=datatype \"{1}\" from library \"{0}\" not recognized +unsupported_datatype_detail=datatype \"{1}\" from library \"{0}\" not supported: {2} +unrecognized_datatype_library=datatype library \"{0}\" not recognized +unrecognized_builtin_datatype=no such builtin datatype \"{0}\": must be \"string\" or \"token\" +invalid_value=\"{0}\" is not a valid value of the datatype +parent_ref_outside_grammar=reference to non-existent parent grammar +ref_outside_grammar=reference to non-existent grammar +expected_one_name_class=found \"{0}\" element but expected no further content +builtin_param=builtin datatypes do not have any parameters +invalid_param_display=invalid parameter:\n{0} +invalid_param_detail_display=invalid parameter: {0}:\n{1} +display_param={0}>>>>{1} +invalid_param_detail=invalid parameter: {0} +invalid_param=invalid parameter +invalid_params_detail=invalid parameters: {0} +invalid_params=invalid parameters +datatype_requires_parameter=datatype cannot be used without parameters +datatype_requires_parameter_detail=datatype cannot be used without parameters: {0} + +attribute_contains_attribute=\"attribute\" contains \"attribute\" +attribute_contains_element=\"attribute\" contains \"element\" +data_except_contains_attribute=\"except\" in \"data\" contains \"attribute\" +data_except_contains_element=\"except\" in \"data\" contains \"element\" +data_except_contains_empty=\"except\" in \"data\" contains \"empty\" +data_except_contains_group=\"except\" in \"data\" contains \"group\" +data_except_contains_interleave=\"except\" in \"data\" contains \"interleave\" +data_except_contains_list=\"except\" in \"data\" contains \"list\" +data_except_contains_one_or_more=\"except\" in \"data\" contains \"oneOrMore\" +data_except_contains_text=\"except\" in \"data\" contains \"text\" +list_contains_attribute=\"list\" contains \"attribute\" +list_contains_element=\"list\" contains \"element\" +list_contains_list=\"list\" contains \"list\" +list_contains_text=\"list\" contains \"text\" +one_or_more_contains_group_contains_attribute=\"oneOrMore\" contains \"group\" contains \"attribute\" +one_or_more_contains_interleave_contains_attribute=\"oneOrMore\" contains \"interleave\" contains \"attribute\" +start_contains_attribute=\"start\" contains \"attribute\" +start_contains_data=\"start\" contains \"data\" +start_contains_empty=\"start\" contains \"empty\" +start_contains_group=\"start\" contains \"group\" +start_contains_interleave=\"start\" contains \"interleave\" +start_contains_list=\"start\" contains \"list\" +start_contains_one_or_more=\"start\" contains \"oneOrMore\" +start_contains_text=\"start\" contains \"text\" +start_contains_value=\"start\" contains \"value\" +duplicate_attribute=duplicate attribute +duplicate_attribute_detail=duplicate attribute {0} +interleave_element_overlap=overlapping element names in operands of \"interleave\" +list_contains_interleave=\"list\" contains \"interleave\" +interleave_text_overlap=both operands of \"interleave\" contain \"text\" +open_name_class_not_repeated=attribute using \"nsName\" or \"anyName\" must be in \"oneOrMore\" +xmlns_uri_attribute=attribute must not have namespace URI \"http://www.w3.org/2000/xmlns\" +xmlns_attribute=attribute must not be named \"xmlns\" + +# Validation errors +unknown_element=unknown element {0} +required_elements_missing=required elements missing +out_of_context_element=element {0} not allowed in this context +impossible_attribute_ignored=attribute {0} not allowed at this point; ignored +bad_attribute_value=bad value for attribute {0} +required_attributes_missing=required attributes missing +unfinished_element=unfinished element +text_not_allowed=text not allowed here +document_incomplete=document incompletely matched +string_not_allowed=bad character content for element +only_text_not_allowed=element cannot have content that consists only of text +schema_allows_nothing=schema does not allow anything: it is equivalent to + +# ID correctness errors +id_element_name_class=an \"element\" pattern containing an \"attribute\" pattern with a non-null ID-type must have a name class that contains only \"choice\" and \"name\" elements +id_attribute_name_class=an \"attribute\" pattern with a non-null ID-type must have a name class that is a single name +id_parent=a \"data\" or \"value\" pattern with non-null ID-type must occur as the child of an \"attribute\" pattern +id_type_conflict=conflicting ID-types for attribute {1} of element {0} + +# ID soundness errors +id_no_tokens=value of attribute of type ID contained no tokens +id_multiple_tokens=value of attribute of type ID contained multiple tokens +idref_no_tokens=value of attribute of type IDREF contained no tokens +idref_multiple_tokens=value of attribute of type IDREF contained multiple tokens +idrefs_no_tokens=value of attribute of type IDREFS contained no tokens +missing_id=IDREF \"{0}\" without matching ID +duplicate_id=ID \"{0}\" has already been defined +first_id=first occurrence of ID \"{0}\" + +# Fragments +name_absent_namespace=\"{0}\" +name_with_namespace=\"{1}\" from namespace \"{0}\" \ No newline at end of file diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Annotations.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Annotations.java new file mode 100644 index 0000000..2f02c25 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Annotations.java @@ -0,0 +1,15 @@ +package com.thaiopensource.relaxng.parse; + +/** + * Includes attributes and child elements before any RELAX NG element. + */ +public interface Annotations { + void addAttribute(String ns, String localName, String prefix, String value, Location loc) + throws BuildException; + void addElement(ParsedElementAnnotation ea) throws BuildException; + /** + * Adds comments following the last initial child element annotation. + */ + void addComment(CommentList comments) throws BuildException; + void addLeadingComment(CommentList comments) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/BuildException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/BuildException.java new file mode 100644 index 0000000..8fa7ed6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/BuildException.java @@ -0,0 +1,14 @@ +package com.thaiopensource.relaxng.parse; + +public class BuildException extends RuntimeException { + private final Throwable cause; + public BuildException(Throwable cause) { + if (cause == null) + throw new NullPointerException("null cause"); + this.cause = cause; + } + + public Throwable getCause() { + return cause; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/CommentList.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/CommentList.java new file mode 100644 index 0000000..11a5ac0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/CommentList.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface CommentList { + void addComment(String value, Location loc) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Context.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Context.java new file mode 100644 index 0000000..0b83e10 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Context.java @@ -0,0 +1,10 @@ +package com.thaiopensource.relaxng.parse; + +import org.relaxng.datatype.ValidationContext; + +import java.util.Enumeration; + +public interface Context extends ValidationContext { + Enumeration prefixes(); + Context copy(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/DataPatternBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/DataPatternBuilder.java new file mode 100644 index 0000000..224a100 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/DataPatternBuilder.java @@ -0,0 +1,11 @@ +package com.thaiopensource.relaxng.parse; + +public interface DataPatternBuilder { + void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno) + throws BuildException; + void annotation(ParsedElementAnnotation ea); + ParsedPattern makePattern(Location loc, Annotations anno) + throws BuildException; + ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) + throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Div.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Div.java new file mode 100644 index 0000000..6deafac --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Div.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface Div extends GrammarSection { + void endDiv(Location loc, Annotations anno) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.java new file mode 100644 index 0000000..118d3b5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ElementAnnotationBuilder.java @@ -0,0 +1,6 @@ +package com.thaiopensource.relaxng.parse; + +public interface ElementAnnotationBuilder extends Annotations { + void addText(String value, Location loc, CommentList comments) throws BuildException; + ParsedElementAnnotation makeElementAnnotation() throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Grammar.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Grammar.java new file mode 100644 index 0000000..da294f6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Grammar.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface Grammar extends GrammarSection, Scope { + ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/GrammarSection.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/GrammarSection.java new file mode 100644 index 0000000..a1c7d08 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/GrammarSection.java @@ -0,0 +1,29 @@ +package com.thaiopensource.relaxng.parse; + +public interface GrammarSection { + + static final class Combine { + private final String name; + private Combine(String name) { + this.name = name; + } + final public String toString() { + return name; + } + } + + static final Combine COMBINE_CHOICE = new Combine("choice"); + static final Combine COMBINE_INTERLEAVE = new Combine("interleave"); + + static final String START = new String("#start"); + + void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) + throws BuildException; + void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException; + void topLevelComment(CommentList comments) throws BuildException; + Div makeDiv(); + /** + * Returns null if already in an include. + */ + Include makeInclude(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IllegalSchemaException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IllegalSchemaException.java new file mode 100644 index 0000000..21148ac --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IllegalSchemaException.java @@ -0,0 +1,3 @@ +package com.thaiopensource.relaxng.parse; + +public class IllegalSchemaException extends Exception { } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Include.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Include.java new file mode 100644 index 0000000..4f4d71c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Include.java @@ -0,0 +1,6 @@ +package com.thaiopensource.relaxng.parse; + +public interface Include extends GrammarSection { + void endInclude(String uri, String ns, + Location loc, Annotations anno) throws BuildException, IllegalSchemaException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IncludedGrammar.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IncludedGrammar.java new file mode 100644 index 0000000..3259ad7 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/IncludedGrammar.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface IncludedGrammar extends GrammarSection, Scope { + ParsedPattern endIncludedGrammar(Location loc, Annotations anno) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Location.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Location.java new file mode 100644 index 0000000..445ace0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Location.java @@ -0,0 +1,3 @@ +package com.thaiopensource.relaxng.parse; + +public interface Location { } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParseReceiver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParseReceiver.java new file mode 100644 index 0000000..be5dd89 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParseReceiver.java @@ -0,0 +1,8 @@ +package com.thaiopensource.relaxng.parse; + +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; + +public interface ParseReceiver extends SubParser { + ParsedPatternFuture installHandlers(XMLReader xr, SchemaBuilder schemaBuilder, Scope scope) throws SAXException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Parseable.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Parseable.java new file mode 100644 index 0000000..13e8e9f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Parseable.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface Parseable extends SubParser { + ParsedPattern parse(SchemaBuilder f, Scope scope) throws BuildException, IllegalSchemaException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.java new file mode 100644 index 0000000..864503d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedElementAnnotation.java @@ -0,0 +1,3 @@ +package com.thaiopensource.relaxng.parse; + +public interface ParsedElementAnnotation { } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedNameClass.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedNameClass.java new file mode 100644 index 0000000..b730ea4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedNameClass.java @@ -0,0 +1,3 @@ +package com.thaiopensource.relaxng.parse; + +public interface ParsedNameClass { } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPattern.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPattern.java new file mode 100644 index 0000000..d465ef1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPattern.java @@ -0,0 +1,3 @@ +package com.thaiopensource.relaxng.parse; + +public interface ParsedPattern { } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPatternFuture.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPatternFuture.java new file mode 100644 index 0000000..f38c2f7 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/ParsedPatternFuture.java @@ -0,0 +1,5 @@ +package com.thaiopensource.relaxng.parse; + +public interface ParsedPatternFuture { + ParsedPattern getParsedPattern() throws IllegalSchemaException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SchemaBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SchemaBuilder.java new file mode 100644 index 0000000..40cdbea --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SchemaBuilder.java @@ -0,0 +1,53 @@ +package com.thaiopensource.relaxng.parse; + +import org.relaxng.datatype.ValidationContext; + +public interface SchemaBuilder { + ParsedPattern makeChoice(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeInterleave(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeGroup(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeEmpty(Location loc, Annotations anno); + ParsedPattern makeNotAllowed(Location loc, Annotations anno); + ParsedPattern makeText(Location loc, Annotations anno); + ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException; + DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc) throws BuildException; + ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context c, String ns, + Location loc, Annotations anno) throws BuildException; + Grammar makeGrammar(Scope parent); + ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException; + ParsedNameClass annotate(ParsedNameClass nc, Annotations anno) throws BuildException; + ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException; + ParsedNameClass annotateAfter(ParsedNameClass nc, ParsedElementAnnotation e) throws BuildException; + ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException; + ParsedNameClass commentAfter(ParsedNameClass nc, CommentList comments) throws BuildException; + ParsedPattern makeExternalRef(String uri, String ns, Scope scope, + Location loc, Annotations anno) throws BuildException, IllegalSchemaException; + ParsedNameClass makeChoice(ParsedNameClass[] nameClasses, int nNameClasses, Location loc, Annotations anno); + + static final String INHERIT_NS = new String("#inherit"); + ParsedNameClass makeName(String ns, String localName, String prefix, Location loc, Annotations anno); + ParsedNameClass makeNsName(String ns, Location loc, Annotations anno); + /** + * Caller must enforce constraints on except. + */ + ParsedNameClass makeNsName(String ns, ParsedNameClass except, Location loc, Annotations anno); + ParsedNameClass makeAnyName(Location loc, Annotations anno); + /** + * Caller must enforce constraints on except. + */ + ParsedNameClass makeAnyName(ParsedNameClass except, Location loc, Annotations anno); + Location makeLocation(String systemId, int lineNumber, int columnNumber); + Annotations makeAnnotations(CommentList comments, Context context); + ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, + Location loc, CommentList comments, Context context); + CommentList makeCommentList(); + ParsedPattern makeErrorPattern(); + ParsedNameClass makeErrorNameClass(); + boolean usesComments(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Scope.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Scope.java new file mode 100644 index 0000000..d4cf9f6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/Scope.java @@ -0,0 +1,6 @@ +package com.thaiopensource.relaxng.parse; + +public interface Scope { + ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException; + ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SubParser.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SubParser.java new file mode 100644 index 0000000..ef6e808 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/SubParser.java @@ -0,0 +1,8 @@ +package com.thaiopensource.relaxng.parse; + +public interface SubParser { + ParsedPattern parseInclude(String uri, SchemaBuilder f, IncludedGrammar g) + throws BuildException, IllegalSchemaException; + ParsedPattern parseExternal(String uri, SchemaBuilder f, Scope s) + throws BuildException, IllegalSchemaException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactParseable.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactParseable.java new file mode 100644 index 0000000..960bc9e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactParseable.java @@ -0,0 +1,89 @@ +package com.thaiopensource.relaxng.parse.compact; + +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.xml.util.EncodingMap; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PushbackInputStream; +import java.io.Reader; +import java.net.URL; + +public class CompactParseable implements Parseable { + private final InputSource in; + private final ErrorHandler eh; + + public CompactParseable(InputSource in, ErrorHandler eh) { + this.in = in; + this.eh = eh; + } + + public ParsedPattern parse(SchemaBuilder sb, Scope scope) throws BuildException, IllegalSchemaException { + return new CompactSyntax(makeReader(in), in.getSystemId(), sb, eh).parse(scope); + } + + public ParsedPattern parseInclude(String uri, SchemaBuilder sb, IncludedGrammar g) + throws BuildException, IllegalSchemaException { + InputSource tem = new InputSource(uri); + tem.setEncoding(in.getEncoding()); + return new CompactSyntax(makeReader(tem), uri, sb, eh).parseInclude(g); + } + + public ParsedPattern parseExternal(String uri, SchemaBuilder sb, Scope scope) + throws BuildException, IllegalSchemaException { + InputSource tem = new InputSource(uri); + tem.setEncoding(in.getEncoding()); + return new CompactSyntax(makeReader(tem), uri, sb, eh).parse(scope); + } + + private static final String UTF8 = EncodingMap.getJavaName("UTF-8"); + private static final String UTF16 = EncodingMap.getJavaName("UTF-16"); + + private static Reader makeReader(InputSource is) throws BuildException { + try { + Reader r = is.getCharacterStream(); + if (r == null) { + InputStream in = is.getByteStream(); + if (in == null) { + String systemId = is.getSystemId(); + in = new URL(systemId).openStream(); + } + String encoding = is.getEncoding(); + if (encoding == null) { + PushbackInputStream pb = new PushbackInputStream(in, 2); + encoding = detectEncoding(pb); + in = pb; + } + r = new InputStreamReader(in, encoding); + } + return r; + } + catch (IOException e) { + throw new BuildException(e); + } + } + + static private String detectEncoding(PushbackInputStream in) throws IOException { + String encoding = UTF8; + int b1 = in.read(); + if (b1 != -1) { + int b2 = in.read(); + if (b2 != -1) { + in.unread(b2); + if ((b1 == 0xFF && b2 == 0xFE) || (b1 == 0xFE && b2 == 0xFF)) + encoding = UTF16; + } + in.unread(b1); + } + return encoding; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.java new file mode 100644 index 0000000..560fdbe --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.java @@ -0,0 +1,3554 @@ +/* Generated By:JavaCC: Do not edit this line. CompactSyntax.java */ +package com.thaiopensource.relaxng.parse.compact; + +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.Context; + +import com.thaiopensource.xml.util.WellKnownNamespaces; + +import com.thaiopensource.util.Localizer; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + +import java.util.Hashtable; +import java.util.Enumeration; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; + +public class CompactSyntax implements Context, CompactSyntaxConstants { + private static final int IN_ELEMENT = 0; + private static final int IN_ATTRIBUTE = 1; + private static final int IN_ANY_NAME = 2; + private static final int IN_NS_NAME = 4; + + private String defaultNamespace = SchemaBuilder.INHERIT_NS; + private String compatibilityPrefix = null; + private SchemaBuilder sb; + private String sourceUri; + private ErrorHandler eh; + private final Hashtable namespaceTable = new Hashtable(); + private final Hashtable datatypesTable = new Hashtable(); + private boolean hadError = false; + private static final Localizer localizer = new Localizer(CompactSyntax.class); + private final Hashtable attributeNameTable = new Hashtable(); + private boolean annotationsIncludeElements = false; + + final class LocatedString { + private final String str; + private final Token tok; + + LocatedString(String str, Token tok) { + this.str = str; + this.tok = tok; + } + + String getString() { + return str; + } + + Location getLocation() { + return makeLocation(tok); + } + + Token getToken() { + return tok; + } + + } + + public CompactSyntax(Reader r, String sourceUri, SchemaBuilder sb, ErrorHandler eh) { + this(r); + this.sourceUri = sourceUri; + this.sb = sb; + this.eh = eh; + // this causes the root pattern to have non-null annotations + // which is useful because it gives a context to trang + this.topLevelComments = sb.makeCommentList(); + } + + ParsedPattern parse(Scope scope) throws IllegalSchemaException { + try { + ParsedPattern p = Input(scope); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + ParsedPattern parseInclude(IncludedGrammar g) throws IllegalSchemaException { + try { + ParsedPattern p = IncludedGrammar(g); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + private void checkNsName(int context, LocatedString ns) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_ns_name", ns.getToken()); + } + + private void checkAnyName(int context, Token t) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_any_name", t); + if ((context & IN_ANY_NAME) != 0) + error("any_name_except_contains_any_name", t); + } + + private void error(String key, Token tok) { + doError(localizer.message(key), tok); + } + + private void error(String key, String arg, Token tok) { + doError(localizer.message(key, arg), tok); + } + + private void error(String key, String arg1, String arg2, Token tok) { + doError(localizer.message(key, arg1, arg2), tok); + } + + private void doError(String message, Token tok) { + hadError = true; + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(tok.beginLine); + loc.setColumnNumber(tok.beginColumn); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(message, loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private void reportEscapeSyntaxException(EscapeSyntaxException e) { + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(e.getLineNumber()); + loc.setColumnNumber(e.getColumnNumber()); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(localizer.message(e.getKey()), loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private static String unquote(String s) { + if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) { + s = s.replace('\u0000', '\n'); + return s.substring(3, s.length() - 3); + } + else + return s.substring(1, s.length() - 1); + } + + Location makeLocation(Token t) { + return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn); + } + + private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) { + if (i >= patterns.length) { + ParsedPattern[] oldPatterns = patterns; + patterns = new ParsedPattern[oldPatterns.length*2]; + System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length); + } + patterns[i] = p; + return patterns; + } + + String getCompatibilityPrefix() { + if (compatibilityPrefix == null) { + compatibilityPrefix = "a"; + while (namespaceTable.get(compatibilityPrefix) != null) + compatibilityPrefix = compatibilityPrefix + "a"; + } + return compatibilityPrefix; + } + + public String resolveNamespacePrefix(String prefix) { + String result = (String)namespaceTable.get(prefix); + if (result.length() == 0) + return null; + return result; + } + + public Enumeration prefixes() { + return namespaceTable.keys(); + } + + public String getBaseUri() { + return sourceUri; + } + + public boolean isUnparsedEntity(String entityName) { + return false; + } + + public boolean isNotation(String notationName) { + return false; + } + + public Context copy() { + return this; + } + + private Context getContext() { + return this; + } + + private CommentList getComments() { + return getComments(getTopLevelComments()); + } + + private CommentList topLevelComments; + + private CommentList getTopLevelComments() { + CommentList tem = topLevelComments; + topLevelComments = null; + return tem; + } + + private void noteTopLevelComments() { + topLevelComments = getComments(topLevelComments); + } + + private void topLevelComments(GrammarSection section) { + section.topLevelComment(getComments(null)); + } + + private Token lastCommentSourceToken = null; + + private CommentList getComments(CommentList comments) { + Token nextToken = getToken(1); + if (lastCommentSourceToken != nextToken) { + if (lastCommentSourceToken == null) + lastCommentSourceToken = token; + do { + lastCommentSourceToken = lastCommentSourceToken.next; + Token t = lastCommentSourceToken.specialToken; + if (t != null) { + while (t.specialToken != null) + t = t.specialToken; + if (comments == null) + comments = sb.makeCommentList(); + for (; t != null; t = t.next) { + String s = mungeComment(t.image); + Location loc = makeLocation(t); + if (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) { + StringBuffer buf = new StringBuffer(s); + do { + t = t.next; + buf.append('\n'); + buf.append(mungeComment(t.image)); + } while (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE); + s = buf.toString(); + } + comments.addComment(s, loc); + } + } + } while (lastCommentSourceToken != nextToken); + } + return comments; + } + + private ParsedPattern afterComments(ParsedPattern p) { + CommentList comments = getComments(null); + if (comments == null) + return p; + return sb.commentAfter(p, comments); + } + + private ParsedNameClass afterComments(ParsedNameClass nc) { + CommentList comments = getComments(null); + if (comments == null) + return nc; + return sb.commentAfter(nc, comments); + } + + private static String mungeComment(String image) { + int i = image.indexOf('#') + 1; + while (i < image.length() && image.charAt(i) == '#') + i++; + if (i < image.length() && image.charAt(i) == ' ') + i++; + return image.substring(i); + } + + private Annotations getCommentsAsAnnotations() { + CommentList comments = getComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private Annotations addCommentsToChildAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + a = sb.makeAnnotations(null, getContext()); + a.addComment(comments); + return a; + } + + private Annotations addCommentsToLeadingAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + return sb.makeAnnotations(comments, getContext()); + a.addLeadingComment(comments); + return a; + } + + private Annotations getTopLevelCommentsAsAnnotations() { + CommentList comments = getTopLevelComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private void clearAttributeList() { + attributeNameTable.clear(); + } + + private void addAttribute(Annotations a, String ns, String localName, String prefix, String value, Token tok) { + String key = ns + "#" + localName; + if (attributeNameTable.get(key) != null) + error("duplicate_attribute", ns, localName, tok); + else { + attributeNameTable.put(key, key); + a.addAttribute(ns, localName, prefix, value, makeLocation(tok)); + } + } + + private void checkExcept(Token[] except) { + if (except[0] != null) + error("except_missing_parentheses", except[0]); + } + + private String lookupPrefix(String prefix, Token t) { + String ns = (String)namespaceTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return "#error"; + } + return ns; + } + private String lookupDatatype(String prefix, Token t) { + String ns = (String)datatypesTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return ""; // XXX + } + return ns; + } + private String resolve(String str) { + try { + return new URL(new URL(sourceUri), str).toString(); + } + catch (MalformedURLException e) { } + return str; + } + + final public ParsedPattern Input(Scope scope) throws ParseException { + ParsedPattern p; + Preamble(); + if (jj_2_1(2147483647)) { + p = TopLevelGrammar(scope); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 10: + case 17: + case 18: + case 19: + case 26: + case 27: + case 28: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + case LITERAL: + p = Expr(true, scope, null, null); + p = afterComments(p); + jj_consume_token(0); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public void TopLevelLookahead() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIXED_NAME: + jj_consume_token(PREFIXED_NAME); + jj_consume_token(1); + break; + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + Identifier(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + jj_consume_token(1); + break; + case 2: + jj_consume_token(2); + break; + case 3: + jj_consume_token(3); + break; + case 4: + jj_consume_token(4); + break; + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 5: + case 6: + case 7: + LookaheadGrammarKeyword(); + break; + case 1: + LookaheadBody(); + LookaheadAfterAnnotations(); + break; + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + LookaheadDocumentation(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + LookaheadBody(); + break; + default: + jj_la1[2] = jj_gen; + ; + } + LookaheadAfterAnnotations(); + break; + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void LookaheadAfterAnnotations() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + Identifier(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 2: + jj_consume_token(2); + break; + case 3: + jj_consume_token(3); + break; + case 4: + jj_consume_token(4); + break; + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 5: + case 6: + case 7: + LookaheadGrammarKeyword(); + break; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void LookaheadGrammarKeyword() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + jj_consume_token(5); + break; + case 6: + jj_consume_token(6); + break; + case 7: + jj_consume_token(7); + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void LookaheadDocumentation() throws ParseException { + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION: + jj_consume_token(DOCUMENTATION); + break; + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION_CONTINUE: + ; + break; + default: + jj_la1[8] = jj_gen; + break label_2; + } + jj_consume_token(DOCUMENTATION_CONTINUE); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + ; + break; + default: + jj_la1[9] = jj_gen; + break label_1; + } + } + } + + final public void LookaheadBody() throws ParseException { + jj_consume_token(1); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 2: + case 5: + case 6: + case 7: + case 8: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + case LITERAL: + ; + break; + default: + jj_la1[10] = jj_gen; + break label_3; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIXED_NAME: + jj_consume_token(PREFIXED_NAME); + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + UnprefixedName(); + break; + case 2: + jj_consume_token(2); + break; + case LITERAL: + jj_consume_token(LITERAL); + break; + case 8: + jj_consume_token(8); + break; + case 1: + LookaheadBody(); + break; + default: + jj_la1[11] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + jj_consume_token(9); + } + + final public ParsedPattern IncludedGrammar(IncludedGrammar g) throws ParseException { + Annotations a; + ParsedPattern p; + Preamble(); + if (jj_2_2(2147483647)) { + a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations()); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 10: + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + a = Annotations(); + jj_consume_token(10); + jj_consume_token(11); + a = GrammarBody(g, g, a); + topLevelComments(g); + jj_consume_token(12); + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + p = afterComments(g.endIncludedGrammar(sb.makeLocation(sourceUri, 1, 1), a)); + jj_consume_token(0); + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern TopLevelGrammar(Scope scope) throws ParseException { + Annotations a = getTopLevelCommentsAsAnnotations(); + Grammar g; + ParsedPattern p; + g = sb.makeGrammar(scope); + a = GrammarBody(g, g, a); + p = afterComments(g.endGrammar(sb.makeLocation(sourceUri, 1, 1), a)); + jj_consume_token(0); + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public void Preamble() throws ParseException { + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 13: + case 14: + case 16: + ; + break; + default: + jj_la1[13] = jj_gen; + break label_4; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 13: + case 14: + NamespaceDecl(); + break; + case 16: + DatatypesDecl(); + break; + default: + jj_la1[14] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + namespaceTable.put("xml", WellKnownNamespaces.XML); + if (datatypesTable.get("xsd") == null) + datatypesTable.put("xsd", WellKnownNamespaces.XML_SCHEMA_DATATYPES); + } + + final public void NamespaceDecl() throws ParseException { + LocatedString prefix = null; + boolean isDefault = false; + String namespaceName; + noteTopLevelComments(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 13: + jj_consume_token(13); + prefix = UnprefixedName(); + break; + case 14: + jj_consume_token(14); + isDefault = true; + jj_consume_token(13); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + prefix = UnprefixedName(); + break; + default: + jj_la1[15] = jj_gen; + ; + } + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(2); + namespaceName = NamespaceName(); + if (isDefault) + defaultNamespace = namespaceName; + if (prefix != null) { + if (prefix.getString().equals("xmlns")) + error("xmlns_prefix", prefix.getToken()); + else if (prefix.getString().equals("xml")) { + if (!namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_prefix_bad_uri", prefix.getToken()); + } + else if (namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_uri_bad_prefix", prefix.getToken()); + else { + if (namespaceName.equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS)) + compatibilityPrefix = prefix.getString(); + namespaceTable.put(prefix.getString(), namespaceName); + } + } + } + + final public String NamespaceName() throws ParseException { + String r; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LITERAL: + r = Literal(); + break; + case 15: + jj_consume_token(15); + r = SchemaBuilder.INHERIT_NS; + break; + default: + jj_la1[17] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return r;} + throw new Error("Missing return statement in function"); + } + + final public void DatatypesDecl() throws ParseException { + LocatedString prefix; + String uri; + noteTopLevelComments(); + jj_consume_token(16); + prefix = UnprefixedName(); + jj_consume_token(2); + uri = Literal(); + datatypesTable.put(prefix.getString(), uri); + } + + final public ParsedPattern AnnotatedPrimaryExpr(boolean topLevel, Scope scope, Token[] except) throws ParseException { + Annotations a; + ParsedPattern p; + ParsedElementAnnotation e; + Token t; + a = Annotations(); + p = PrimaryExpr(topLevel, scope, a, except); + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FANNOTATE: + ; + break; + default: + jj_la1[18] = jj_gen; + break label_5; + } + t = jj_consume_token(FANNOTATE); + e = AnnotationElement(false); + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + } + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern PrimaryExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) throws ParseException { + ParsedPattern p; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 26: + p = ElementExpr(scope, a); + break; + case 27: + p = AttributeExpr(scope, a); + break; + case 10: + p = GrammarExpr(scope, a); + break; + case 33: + p = ExternalRefExpr(scope, a); + break; + case 31: + p = ListExpr(scope, a); + break; + case 32: + p = MixedExpr(scope, a); + break; + case 28: + p = ParenExpr(topLevel, scope, a); + break; + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + p = IdentifierExpr(scope, a); + break; + case 34: + p = ParentExpr(scope, a); + break; + case 35: + case 36: + case PREFIXED_NAME: + p = DataExpr(topLevel, scope, a, except); + break; + case LITERAL: + p = ValueExpr(topLevel, a); + break; + case 18: + p = TextExpr(a); + break; + case 17: + p = EmptyExpr(a); + break; + case 19: + p = NotAllowedExpr(a); + break; + default: + jj_la1[19] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern EmptyExpr(Annotations a) throws ParseException { + Token t; + t = jj_consume_token(17); + {if (true) return sb.makeEmpty(makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern TextExpr(Annotations a) throws ParseException { + Token t; + t = jj_consume_token(18); + {if (true) return sb.makeText(makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern NotAllowedExpr(Annotations a) throws ParseException { + Token t; + t = jj_consume_token(19); + {if (true) return sb.makeNotAllowed(makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern Expr(boolean topLevel, Scope scope, Token t, Annotations a) throws ParseException { + ParsedPattern p; + ParsedPattern[] patterns = new ParsedPattern[2]; + int nPatterns = 1; + boolean[] hadOccur = new boolean[1]; + Token[] except = new Token[1]; + p = UnaryExpr(topLevel, scope, hadOccur, except); + patterns[0] = p; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + case 21: + case 22: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + checkExcept(except); + label_6: + while (true) { + t = jj_consume_token(20); + p = UnaryExpr(topLevel, scope, null, except); + patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[20] = jj_gen; + break label_6; + } + } + p = sb.makeChoice(patterns, nPatterns, makeLocation(t), a); + break; + case 21: + label_7: + while (true) { + t = jj_consume_token(21); + p = UnaryExpr(topLevel, scope, null, except); + patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 21: + ; + break; + default: + jj_la1[21] = jj_gen; + break label_7; + } + } + p = sb.makeInterleave(patterns, nPatterns, makeLocation(t), a); + break; + case 22: + label_8: + while (true) { + t = jj_consume_token(22); + p = UnaryExpr(topLevel, scope, null, except); + patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 22: + ; + break; + default: + jj_la1[22] = jj_gen; + break label_8; + } + } + p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); + break; + default: + jj_la1[23] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[24] = jj_gen; + ; + } + if (nPatterns == 1 && a != null) { + if (hadOccur[0]) + p = sb.annotate(p, a); + else + p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); + } + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern UnaryExpr(boolean topLevel, Scope scope, boolean[] hadOccur, Token[] except) throws ParseException { + ParsedPattern p; + Token t; + ParsedElementAnnotation e; + p = AnnotatedPrimaryExpr(topLevel, scope, except); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 23: + case 24: + case 25: + if (hadOccur != null) hadOccur[0] = true; + p = afterComments(p); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 23: + t = jj_consume_token(23); + checkExcept(except); p = sb.makeOneOrMore(p, makeLocation(t), null); + break; + case 24: + t = jj_consume_token(24); + checkExcept(except); p = sb.makeOptional(p, makeLocation(t), null); + break; + case 25: + t = jj_consume_token(25); + checkExcept(except); p = sb.makeZeroOrMore(p, makeLocation(t), null); + break; + default: + jj_la1[25] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FANNOTATE: + ; + break; + default: + jj_la1[26] = jj_gen; + break label_9; + } + t = jj_consume_token(FANNOTATE); + e = AnnotationElement(false); + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + } + break; + default: + jj_la1[27] = jj_gen; + ; + } + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern ElementExpr(Scope scope, Annotations a) throws ParseException { + Token t; + ParsedNameClass nc; + ParsedPattern p; + t = jj_consume_token(26); + nc = NameClass(IN_ELEMENT, null); + jj_consume_token(11); + p = Expr(false, scope, null, null); + p = afterComments(p); + jj_consume_token(12); + {if (true) return sb.makeElement(nc, p, makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern AttributeExpr(Scope scope, Annotations a) throws ParseException { + Token t; + ParsedNameClass nc; + ParsedPattern p; + t = jj_consume_token(27); + nc = NameClass(IN_ATTRIBUTE, null); + jj_consume_token(11); + p = Expr(false, scope, null, null); + p = afterComments(p); + jj_consume_token(12); + {if (true) return sb.makeAttribute(nc, p, makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass NameClass(int context, Annotations[] pa) throws ParseException { + Annotations a; + ParsedNameClass nc; + a = Annotations(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 28: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + nc = PrimaryNameClass(context, a); + nc = AnnotateAfter(nc); + nc = NameClassAlternatives(context, nc, pa); + break; + case 25: + nc = AnyNameExceptClass(context, a, pa); + break; + case PREFIX_STAR: + nc = NsNameExceptClass(context, a, pa); + break; + default: + jj_la1[28] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass AnnotateAfter(ParsedNameClass nc) throws ParseException { + ParsedElementAnnotation e; + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FANNOTATE: + ; + break; + default: + jj_la1[29] = jj_gen; + break label_10; + } + jj_consume_token(FANNOTATE); + e = AnnotationElement(false); + nc = sb.annotateAfter(nc, e); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) throws ParseException { + Token t; + ParsedNameClass[] nameClasses; + int nNameClasses; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + nameClasses = new ParsedNameClass[2]; + nameClasses[0] = nc; + nNameClasses = 1; + label_11: + while (true) { + t = jj_consume_token(20); + nc = BasicNameClass(context); + nc = AnnotateAfter(nc); + if (nNameClasses >= nameClasses.length) { + ParsedNameClass[] oldNameClasses = nameClasses; + nameClasses = new ParsedNameClass[oldNameClasses.length*2]; + System.arraycopy(oldNameClasses, 0, nameClasses, 0, oldNameClasses.length); + } + nameClasses[nNameClasses++] = nc; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[30] = jj_gen; + break label_11; + } + } + Annotations a; + if (pa == null) + a = null; + else { + a = pa[0]; + pa[0] = null; + } + nc = sb.makeChoice(nameClasses, nNameClasses, makeLocation(t), a); + break; + default: + jj_la1[31] = jj_gen; + ; + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass BasicNameClass(int context) throws ParseException { + Annotations a; + ParsedNameClass nc; + a = Annotations(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 28: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + nc = PrimaryNameClass(context, a); + break; + case 25: + case PREFIX_STAR: + nc = OpenNameClass(context, a); + break; + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass PrimaryNameClass(int context, Annotations a) throws ParseException { + ParsedNameClass nc; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + nc = UnprefixedNameClass(context, a); + break; + case PREFIXED_NAME: + nc = PrefixedNameClass(a); + break; + case 28: + nc = ParenNameClass(context, a); + break; + default: + jj_la1[33] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass OpenNameClass(int context, Annotations a) throws ParseException { + Token t; + LocatedString ns; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIX_STAR: + ns = NsName(); + checkNsName(context, ns); {if (true) return sb.makeNsName(ns.getString(), ns.getLocation(), a);} + break; + case 25: + t = jj_consume_token(25); + checkAnyName(context, t); {if (true) return sb.makeAnyName(makeLocation(t), a);} + break; + default: + jj_la1[34] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass UnprefixedNameClass(int context, Annotations a) throws ParseException { + LocatedString name; + name = UnprefixedName(); + String ns; + if ((context & (IN_ATTRIBUTE|IN_ELEMENT)) == IN_ATTRIBUTE) + ns = ""; + else + ns = defaultNamespace; + {if (true) return sb.makeName(ns, name.getString(), null, name.getLocation(), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass PrefixedNameClass(Annotations a) throws ParseException { + Token t; + t = jj_consume_token(PREFIXED_NAME); + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + {if (true) return sb.makeName(lookupPrefix(prefix, t), qn.substring(colon + 1), prefix, makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) throws ParseException { + LocatedString ns; + ParsedNameClass nc; + ns = NsName(); + checkNsName(context, ns); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + nc = ExceptNameClass(context | IN_NS_NAME); + nc = sb.makeNsName(ns.getString(), nc, ns.getLocation(), a); + nc = AnnotateAfter(nc); + break; + default: + jj_la1[35] = jj_gen; + nc = sb.makeNsName(ns.getString(), ns.getLocation(), a); + nc = AnnotateAfter(nc); + nc = NameClassAlternatives(context, nc, pa); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public LocatedString NsName() throws ParseException { + Token t; + t = jj_consume_token(PREFIX_STAR); + String qn = t.image; + String prefix = qn.substring(0, qn.length() - 2); + {if (true) return new LocatedString(lookupPrefix(prefix, t), t);} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass AnyNameExceptClass(int context, Annotations a, Annotations[] pa) throws ParseException { + Token t; + ParsedNameClass nc; + t = jj_consume_token(25); + checkAnyName(context, t); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + nc = ExceptNameClass(context | IN_ANY_NAME); + nc = sb.makeAnyName(nc, makeLocation(t), a); + nc = AnnotateAfter(nc); + break; + default: + jj_la1[36] = jj_gen; + nc = sb.makeAnyName(makeLocation(t), a); + nc = AnnotateAfter(nc); + nc = NameClassAlternatives(context, nc, pa); + } + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass ParenNameClass(int context, Annotations a) throws ParseException { + Token t; + ParsedNameClass nc; + Annotations[] pa = new Annotations[]{ a }; + t = jj_consume_token(28); + nc = NameClass(context, pa); + nc = afterComments(nc); + jj_consume_token(29); + if (pa[0] != null) + nc = sb.makeChoice(new ParsedNameClass[] { nc }, 1, makeLocation(t), pa[0]); + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedNameClass ExceptNameClass(int context) throws ParseException { + ParsedNameClass nc; + jj_consume_token(30); + nc = BasicNameClass(context); + {if (true) return nc;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern ListExpr(Scope scope, Annotations a) throws ParseException { + Token t; + ParsedPattern p; + t = jj_consume_token(31); + jj_consume_token(11); + p = Expr(false, scope, null, null); + p = afterComments(p); + jj_consume_token(12); + {if (true) return sb.makeList(p, makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern MixedExpr(Scope scope, Annotations a) throws ParseException { + Token t; + ParsedPattern p; + t = jj_consume_token(32); + jj_consume_token(11); + p = Expr(false, scope, null, null); + p = afterComments(p); + jj_consume_token(12); + {if (true) return sb.makeMixed(p, makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern GrammarExpr(Scope scope, Annotations a) throws ParseException { + Token t; + Grammar g; + t = jj_consume_token(10); + g = sb.makeGrammar(scope); + jj_consume_token(11); + a = GrammarBody(g, g, a); + topLevelComments(g); + jj_consume_token(12); + {if (true) return g.endGrammar(makeLocation(t), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) throws ParseException { + Token t; + ParsedPattern p; + t = jj_consume_token(28); + p = Expr(topLevel, scope, t, a); + p = afterComments(p); + jj_consume_token(29); + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public Annotations GrammarBody(GrammarSection section, Scope scope, Annotations a) throws ParseException { + ParsedElementAnnotation e; + label_12: + while (true) { + if (jj_2_3(2)) { + ; + } else { + break label_12; + } + e = AnnotationElementNotKeyword(); + if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); + } + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 5: + case 6: + case 7: + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + ; + break; + default: + jj_la1[37] = jj_gen; + break label_13; + } + GrammarComponent(section, scope); + } + {if (true) return a;} + throw new Error("Missing return statement in function"); + } + + final public void GrammarComponent(GrammarSection section, Scope scope) throws ParseException { + ParsedElementAnnotation e; + Annotations a; + a = Annotations(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + Definition(section, scope, a); + break; + case 7: + Include(section, scope, a); + break; + case 6: + Div(section, scope, a); + break; + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + label_14: + while (true) { + if (jj_2_4(2)) { + ; + } else { + break label_14; + } + e = AnnotationElementNotKeyword(); + section.topLevelAnnotation(e); + } + } + + final public void Definition(GrammarSection section, Scope scope, Annotations a) throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + Define(section, scope, a); + break; + case 5: + Start(section, scope, a); + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void Start(GrammarSection section, Scope scope, Annotations a) throws ParseException { + Token t; + GrammarSection.Combine combine; + ParsedPattern p; + t = jj_consume_token(5); + combine = AssignOp(); + p = Expr(false, scope, null, null); + section.define(GrammarSection.START, combine, p, makeLocation(t), a); + } + + final public void Define(GrammarSection section, Scope scope, Annotations a) throws ParseException { + LocatedString name; + GrammarSection.Combine combine; + ParsedPattern p; + name = Identifier(); + combine = AssignOp(); + p = Expr(false, scope, null, null); + section.define(name.getString(), combine, p, name.getLocation(), a); + } + + final public GrammarSection.Combine AssignOp() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 2: + jj_consume_token(2); + {if (true) return null;} + break; + case 4: + jj_consume_token(4); + {if (true) return GrammarSection.COMBINE_CHOICE;} + break; + case 3: + jj_consume_token(3); + {if (true) return GrammarSection.COMBINE_INTERLEAVE;} + break; + default: + jj_la1[40] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public void Include(GrammarSection section, Scope scope, Annotations a) throws ParseException { + Token t; + String href; + String ns; + Include include = section.makeInclude(); + t = jj_consume_token(7); + href = Literal(); + ns = Inherit(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + a = IncludeBody(include, scope, a); + topLevelComments(include); + jj_consume_token(12); + break; + default: + jj_la1[41] = jj_gen; + ; + } + try { + include.endInclude(resolve(href), ns, makeLocation(t), a); + } + catch (IllegalSchemaException e) { } + } + + final public Annotations IncludeBody(GrammarSection section, Scope scope, Annotations a) throws ParseException { + ParsedElementAnnotation e; + label_15: + while (true) { + if (jj_2_5(2)) { + ; + } else { + break label_15; + } + e = AnnotationElementNotKeyword(); + if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); + } + label_16: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 5: + case 6: + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + ; + break; + default: + jj_la1[42] = jj_gen; + break label_16; + } + IncludeComponent(section, scope); + } + {if (true) return a;} + throw new Error("Missing return statement in function"); + } + + final public void IncludeComponent(GrammarSection section, Scope scope) throws ParseException { + ParsedElementAnnotation e; + Annotations a; + a = Annotations(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + Definition(section, scope, a); + break; + case 6: + IncludeDiv(section, scope, a); + break; + default: + jj_la1[43] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + label_17: + while (true) { + if (jj_2_6(2)) { + ; + } else { + break label_17; + } + e = AnnotationElementNotKeyword(); + section.topLevelAnnotation(e); + } + } + + final public void Div(GrammarSection section, Scope scope, Annotations a) throws ParseException { + Token t; + Div div = section.makeDiv(); + t = jj_consume_token(6); + jj_consume_token(11); + a = GrammarBody(div, scope, a); + topLevelComments(div); + jj_consume_token(12); + div.endDiv(makeLocation(t), a); + } + + final public void IncludeDiv(GrammarSection section, Scope scope, Annotations a) throws ParseException { + Token t; + Div div = section.makeDiv(); + t = jj_consume_token(6); + jj_consume_token(11); + a = IncludeBody(div, scope, a); + topLevelComments(div); + jj_consume_token(12); + div.endDiv(makeLocation(t), a); + } + + final public ParsedPattern ExternalRefExpr(Scope scope, Annotations a) throws ParseException { + Token t; + String href; + String ns; + t = jj_consume_token(33); + href = Literal(); + ns = Inherit(); + try { + {if (true) return sb.makeExternalRef(resolve(href), ns, scope, makeLocation(t), a);} + } + catch (IllegalSchemaException e) { + {if (true) return sb.makeErrorPattern();} + } + throw new Error("Missing return statement in function"); + } + + final public String Inherit() throws ParseException { + String ns = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 15: + jj_consume_token(15); + jj_consume_token(2); + ns = Prefix(); + break; + default: + jj_la1[44] = jj_gen; + ; + } + if (ns == null) + ns = defaultNamespace; + {if (true) return ns;} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern ParentExpr(Scope scope, Annotations a) throws ParseException { + LocatedString name; + jj_consume_token(34); + a = addCommentsToChildAnnotations(a); + name = Identifier(); + {if (true) return scope.makeParentRef(name.getString(), name.getLocation(), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern IdentifierExpr(Scope scope, Annotations a) throws ParseException { + LocatedString name; + name = Identifier(); + {if (true) return scope.makeRef(name.getString(), name.getLocation(), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern ValueExpr(boolean topLevel, Annotations a) throws ParseException { + LocatedString s; + s = LocatedLiteral(); + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", s.getToken()); + a = null; + } + {if (true) return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a);} + throw new Error("Missing return statement in function"); + } + + final public ParsedPattern DataExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) throws ParseException { + Token datatypeToken; + Location loc; + String datatype; + String datatypeUri = null; + String s = null; + ParsedPattern e = null; + DataPatternBuilder dpb; + datatypeToken = DatatypeName(); + datatype = datatypeToken.image; + loc = makeLocation(datatypeToken); + int colon = datatype.indexOf(':'); + if (colon < 0) + datatypeUri = ""; + else { + String prefix = datatype.substring(0, colon); + datatypeUri = lookupDatatype(prefix, datatypeToken); + datatype = datatype.substring(colon + 1); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LITERAL: + s = Literal(); + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", datatypeToken); + a = null; + } + {if (true) return sb.makeValue(datatypeUri, datatype, s, getContext(), defaultNamespace, loc, a);} + break; + default: + jj_la1[48] = jj_gen; + dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + Params(dpb); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + e = Except(scope, except); + break; + default: + jj_la1[45] = jj_gen; + ; + } + break; + default: + jj_la1[47] = jj_gen; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + e = Except(scope, except); + break; + default: + jj_la1[46] = jj_gen; + ; + } + } + {if (true) return e == null ? dpb.makePattern(loc, a) : dpb.makePattern(e, loc, a);} + } + throw new Error("Missing return statement in function"); + } + + final public Token DatatypeName() throws ParseException { + Token t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 35: + t = jj_consume_token(35); + break; + case 36: + t = jj_consume_token(36); + break; + case PREFIXED_NAME: + t = jj_consume_token(PREFIXED_NAME); + break; + default: + jj_la1[49] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return t;} + throw new Error("Missing return statement in function"); + } + + final public LocatedString Identifier() throws ParseException { + LocatedString s; + Token t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + t = jj_consume_token(IDENTIFIER); + s = new LocatedString(t.image, t); + break; + case ESCAPED_IDENTIFIER: + t = jj_consume_token(ESCAPED_IDENTIFIER); + s = new LocatedString(t.image.substring(1), t); + break; + default: + jj_la1[50] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return s;} + throw new Error("Missing return statement in function"); + } + + final public String Prefix() throws ParseException { + Token t; + String prefix; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + t = jj_consume_token(IDENTIFIER); + prefix = t.image; + break; + case ESCAPED_IDENTIFIER: + t = jj_consume_token(ESCAPED_IDENTIFIER); + prefix = t.image.substring(1); + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + t = Keyword(); + prefix = t.image; + break; + default: + jj_la1[51] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return lookupPrefix(prefix, t);} + throw new Error("Missing return statement in function"); + } + + final public LocatedString UnprefixedName() throws ParseException { + LocatedString s; + Token t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + s = Identifier(); + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + t = Keyword(); + s = new LocatedString(t.image, t); + break; + default: + jj_la1[52] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return s;} + throw new Error("Missing return statement in function"); + } + + final public void Params(DataPatternBuilder dpb) throws ParseException { + jj_consume_token(11); + label_18: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + ; + break; + default: + jj_la1[53] = jj_gen; + break label_18; + } + Param(dpb); + } + jj_consume_token(12); + } + + final public void Param(DataPatternBuilder dpb) throws ParseException { + LocatedString name; + Annotations a; + String value; + a = Annotations(); + name = UnprefixedName(); + jj_consume_token(2); + a = addCommentsToLeadingAnnotations(a); + value = Literal(); + dpb.addParam(name.getString(), value, getContext(), defaultNamespace, name.getLocation(), a); + } + + final public ParsedPattern Except(Scope scope, Token[] except) throws ParseException { + Annotations a; + ParsedPattern p; + Token t; + Token[] innerExcept = new Token[1]; + t = jj_consume_token(30); + a = Annotations(); + p = PrimaryExpr(false, scope, a, innerExcept); + checkExcept(innerExcept); + except[0] = t; + {if (true) return p;} + throw new Error("Missing return statement in function"); + } + + final public ParsedElementAnnotation Documentation() throws ParseException { + CommentList comments = getComments(); + ElementAnnotationBuilder eab; + Token t; + String s; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION: + t = jj_consume_token(DOCUMENTATION); + break; + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + t = jj_consume_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT); + break; + default: + jj_la1[54] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS, + "documentation", + getCompatibilityPrefix(), + makeLocation(t), + comments, + getContext()); + eab.addText(mungeComment(t.image), makeLocation(t), null); + label_19: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION_CONTINUE: + ; + break; + default: + jj_la1[55] = jj_gen; + break label_19; + } + t = jj_consume_token(DOCUMENTATION_CONTINUE); + eab.addText("\n" + mungeComment(t.image), makeLocation(t), null); + } + {if (true) return eab.makeElementAnnotation();} + throw new Error("Missing return statement in function"); + } + + final public Annotations Annotations() throws ParseException { + CommentList comments = getComments(); + Annotations a = null; + ParsedElementAnnotation e; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + a = sb.makeAnnotations(comments, getContext()); + label_20: + while (true) { + e = Documentation(); + a.addElement(e); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOCUMENTATION: + case DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: + ; + break; + default: + jj_la1[56] = jj_gen; + break label_20; + } + } + comments = getComments(); + if (comments != null) + a.addLeadingComment(comments); + break; + default: + jj_la1[57] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + jj_consume_token(1); + if (a == null) a = sb.makeAnnotations(comments, getContext()); clearAttributeList(); annotationsIncludeElements = false; + label_21: + while (true) { + if (jj_2_7(2)) { + ; + } else { + break label_21; + } + PrefixedAnnotationAttribute(a, false); + } + label_22: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + ; + break; + default: + jj_la1[58] = jj_gen; + break label_22; + } + e = AnnotationElement(false); + a.addElement(e); annotationsIncludeElements = true; + } + a.addComment(getComments()); + jj_consume_token(9); + break; + default: + jj_la1[59] = jj_gen; + ; + } + if (a == null && comments != null) + a = sb.makeAnnotations(comments, getContext()); + {if (true) return a;} + throw new Error("Missing return statement in function"); + } + + final public void AnnotationAttribute(Annotations a) throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIXED_NAME: + PrefixedAnnotationAttribute(a, true); + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + UnprefixedAnnotationAttribute(a); + break; + default: + jj_la1[60] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void PrefixedAnnotationAttribute(Annotations a, boolean nested) throws ParseException { + Token t; + String value; + t = jj_consume_token(PREFIXED_NAME); + jj_consume_token(2); + value = Literal(); + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) + error("inherited_annotation_namespace", t); + else if (ns.length() == 0 && !nested) + error("unqualified_annotation_attribute", t); + else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested) + error("relax_ng_namespace", t); + /*else if (ns.length() == 0 + && qn.length() - colon - 1 == 5 + && qn.regionMatches(colon + 1, "xmlns", 0, 5)) + error("xmlns_annotation_attribute", t);*/ + else if (ns.equals(WellKnownNamespaces.XMLNS)) + error("xmlns_annotation_attribute_uri", t); + else { + if (ns.length() == 0) + prefix = null; + addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t); + } + } + + final public void UnprefixedAnnotationAttribute(Annotations a) throws ParseException { + LocatedString name; + String value; + name = UnprefixedName(); + jj_consume_token(2); + value = Literal(); + if (name.getString().equals("xmlns")) + error("xmlns_annotation_attribute", name.getToken()); + else + addAttribute(a, "", name.getString(), null, value, name.getToken()); + } + + final public ParsedElementAnnotation AnnotationElement(boolean nested) throws ParseException { + ParsedElementAnnotation a; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIXED_NAME: + a = PrefixedAnnotationElement(nested); + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + a = UnprefixedAnnotationElement(); + break; + default: + jj_la1[61] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return a;} + throw new Error("Missing return statement in function"); + } + + final public ParsedElementAnnotation AnnotationElementNotKeyword() throws ParseException { + ParsedElementAnnotation a; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PREFIXED_NAME: + a = PrefixedAnnotationElement(false); + break; + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + a = IdentifierAnnotationElement(); + break; + default: + jj_la1[62] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return a;} + throw new Error("Missing return statement in function"); + } + + final public ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) throws ParseException { + CommentList comments = getComments(); + Token t; + ElementAnnotationBuilder eab; + t = jj_consume_token(PREFIXED_NAME); + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) { + error("inherited_annotation_namespace", t); + ns = ""; + } + else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) { + error("relax_ng_namespace", t); + ns = ""; + } + else { + if (ns.length() == 0) + prefix = null; + } + eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix, + makeLocation(t), comments, getContext()); + AnnotationElementContent(eab); + {if (true) return eab.makeElementAnnotation();} + throw new Error("Missing return statement in function"); + } + + final public ParsedElementAnnotation UnprefixedAnnotationElement() throws ParseException { + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; + name = UnprefixedName(); + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + AnnotationElementContent(eab); + {if (true) return eab.makeElementAnnotation();} + throw new Error("Missing return statement in function"); + } + + final public ParsedElementAnnotation IdentifierAnnotationElement() throws ParseException { + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; + name = Identifier(); + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + AnnotationElementContent(eab); + {if (true) return eab.makeElementAnnotation();} + throw new Error("Missing return statement in function"); + } + + final public void AnnotationElementContent(ElementAnnotationBuilder eab) throws ParseException { + ParsedElementAnnotation e; + jj_consume_token(1); + clearAttributeList(); + label_23: + while (true) { + if (jj_2_8(2)) { + ; + } else { + break label_23; + } + AnnotationAttribute(eab); + } + label_24: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + case LITERAL: + ; + break; + default: + jj_la1[63] = jj_gen; + break label_24; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LITERAL: + AnnotationElementLiteral(eab); + label_25: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + ; + break; + default: + jj_la1[64] = jj_gen; + break label_25; + } + jj_consume_token(8); + AnnotationElementLiteral(eab); + } + break; + case 5: + case 6: + case 7: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 26: + case 27: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case IDENTIFIER: + case ESCAPED_IDENTIFIER: + case PREFIXED_NAME: + e = AnnotationElement(true); + eab.addElement(e); + break; + default: + jj_la1[65] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + eab.addComment(getComments()); + jj_consume_token(9); + } + + final public void AnnotationElementLiteral(ElementAnnotationBuilder eab) throws ParseException { + Token t; + CommentList comments = getComments(); + t = jj_consume_token(LITERAL); + eab.addText(unquote(t.image), makeLocation(t), comments); + } + + final public String Literal() throws ParseException { + Token t; + String s; + StringBuffer buf; + t = jj_consume_token(LITERAL); + s = unquote(t.image); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + buf = new StringBuffer(s); + label_26: + while (true) { + jj_consume_token(8); + t = jj_consume_token(LITERAL); + buf.append(unquote(t.image)); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + ; + break; + default: + jj_la1[66] = jj_gen; + break label_26; + } + } + s = buf.toString(); + break; + default: + jj_la1[67] = jj_gen; + ; + } + {if (true) return s;} + throw new Error("Missing return statement in function"); + } + + final public LocatedString LocatedLiteral() throws ParseException { + Token t; + Token t2; + String s; + StringBuffer buf; + t = jj_consume_token(LITERAL); + s = unquote(t.image); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + buf = new StringBuffer(s); + label_27: + while (true) { + jj_consume_token(8); + t2 = jj_consume_token(LITERAL); + buf.append(unquote(t2.image)); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + ; + break; + default: + jj_la1[68] = jj_gen; + break label_27; + } + } + s = buf.toString(); + break; + default: + jj_la1[69] = jj_gen; + ; + } + {if (true) return new LocatedString(s, t);} + throw new Error("Missing return statement in function"); + } + + final public Token Keyword() throws ParseException { + Token t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 26: + t = jj_consume_token(26); + break; + case 27: + t = jj_consume_token(27); + break; + case 13: + t = jj_consume_token(13); + break; + case 31: + t = jj_consume_token(31); + break; + case 32: + t = jj_consume_token(32); + break; + case 10: + t = jj_consume_token(10); + break; + case 17: + t = jj_consume_token(17); + break; + case 18: + t = jj_consume_token(18); + break; + case 34: + t = jj_consume_token(34); + break; + case 33: + t = jj_consume_token(33); + break; + case 19: + t = jj_consume_token(19); + break; + case 5: + t = jj_consume_token(5); + break; + case 7: + t = jj_consume_token(7); + break; + case 14: + t = jj_consume_token(14); + break; + case 15: + t = jj_consume_token(15); + break; + case 35: + t = jj_consume_token(35); + break; + case 36: + t = jj_consume_token(36); + break; + case 16: + t = jj_consume_token(16); + break; + case 6: + t = jj_consume_token(6); + break; + default: + jj_la1[70] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return t;} + throw new Error("Missing return statement in function"); + } + + final private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_1(); + jj_save(0, xla); + return retval; + } + + final private boolean jj_2_2(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_2(); + jj_save(1, xla); + return retval; + } + + final private boolean jj_2_3(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_3(); + jj_save(2, xla); + return retval; + } + + final private boolean jj_2_4(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_4(); + jj_save(3, xla); + return retval; + } + + final private boolean jj_2_5(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_5(); + jj_save(4, xla); + return retval; + } + + final private boolean jj_2_6(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_6(); + jj_save(5, xla); + return retval; + } + + final private boolean jj_2_7(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_7(); + jj_save(6, xla); + return retval; + } + + final private boolean jj_2_8(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_8(); + jj_save(7, xla); + return retval; + } + + final private boolean jj_3R_92() { + if (jj_scan_token(7)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_91() { + if (jj_scan_token(5)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_90() { + if (jj_scan_token(19)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_89() { + if (jj_scan_token(33)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_88() { + if (jj_scan_token(34)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_87() { + if (jj_scan_token(18)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_86() { + if (jj_scan_token(17)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_85() { + if (jj_scan_token(10)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_84() { + if (jj_scan_token(32)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_83() { + if (jj_scan_token(31)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_82() { + if (jj_scan_token(13)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_81() { + if (jj_scan_token(27)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_80() { + if (jj_scan_token(26)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_79() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_80()) { + jj_scanpos = xsp; + if (jj_3R_81()) { + jj_scanpos = xsp; + if (jj_3R_82()) { + jj_scanpos = xsp; + if (jj_3R_83()) { + jj_scanpos = xsp; + if (jj_3R_84()) { + jj_scanpos = xsp; + if (jj_3R_85()) { + jj_scanpos = xsp; + if (jj_3R_86()) { + jj_scanpos = xsp; + if (jj_3R_87()) { + jj_scanpos = xsp; + if (jj_3R_88()) { + jj_scanpos = xsp; + if (jj_3R_89()) { + jj_scanpos = xsp; + if (jj_3R_90()) { + jj_scanpos = xsp; + if (jj_3R_91()) { + jj_scanpos = xsp; + if (jj_3R_92()) { + jj_scanpos = xsp; + if (jj_3R_93()) { + jj_scanpos = xsp; + if (jj_3R_94()) { + jj_scanpos = xsp; + if (jj_3R_95()) { + jj_scanpos = xsp; + if (jj_3R_96()) { + jj_scanpos = xsp; + if (jj_3R_97()) { + jj_scanpos = xsp; + if (jj_3R_98()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_30() { + if (jj_scan_token(PREFIXED_NAME)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(2)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_39() { + if (jj_3R_30()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_31() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_39()) { + jj_scanpos = xsp; + if (jj_3R_40()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_7() { + if (jj_3R_30()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_70() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_69() { + if (jj_scan_token(8)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_76() { + if (jj_scan_token(DOCUMENTATION_CONTINUE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_8() { + if (jj_3R_31()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_68() { + if (jj_scan_token(LITERAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_63() { + if (jj_scan_token(1)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_67() { + if (jj_scan_token(2)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_52() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_63()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_6() { + if (jj_3R_29()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_2() { + if (jj_3R_28()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_66() { + if (jj_3R_64()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_5() { + if (jj_3R_29()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_75() { + if (jj_scan_token(DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_78() { + if (jj_3R_79()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_73() { + if (jj_scan_token(4)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_77() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_45() { + if (jj_scan_token(4)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_64() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_77()) { + jj_scanpos = xsp; + if (jj_3R_78()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_58() { + if (jj_scan_token(7)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_50() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_59() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_65()) { + jj_scanpos = xsp; + if (jj_3R_66()) { + jj_scanpos = xsp; + if (jj_3R_67()) { + jj_scanpos = xsp; + if (jj_3R_68()) { + jj_scanpos = xsp; + if (jj_3R_69()) { + jj_scanpos = xsp; + if (jj_3R_70()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_65() { + if (jj_scan_token(PREFIXED_NAME)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_72() { + if (jj_scan_token(3)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_47() { + if (jj_scan_token(1)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_59()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + if (jj_scan_token(9)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_44() { + if (jj_scan_token(3)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_57() { + if (jj_scan_token(6)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_74() { + if (jj_scan_token(DOCUMENTATION)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_62() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_74()) { + jj_scanpos = xsp; + if (jj_3R_75()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + while (true) { + xsp = jj_scanpos; + if (jj_3R_76()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + final private boolean jj_3R_71() { + if (jj_scan_token(2)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_49() { + Token xsp; + if (jj_3R_62()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + while (true) { + xsp = jj_scanpos; + if (jj_3R_62()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + final private boolean jj_3R_43() { + if (jj_scan_token(2)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_46() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_56()) { + jj_scanpos = xsp; + if (jj_3R_57()) { + jj_scanpos = xsp; + if (jj_3R_58()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_42() { + if (jj_scan_token(1)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_56() { + if (jj_scan_token(5)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_55() { + if (jj_scan_token(ESCAPED_IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_54() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_61() { + if (jj_3R_46()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_41() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_54()) { + jj_scanpos = xsp; + if (jj_3R_55()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_51() { + if (jj_scan_token(PREFIXED_NAME)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_63()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_48() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_60()) { + jj_scanpos = xsp; + if (jj_3R_61()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_60() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_71()) { + jj_scanpos = xsp; + if (jj_3R_72()) { + jj_scanpos = xsp; + if (jj_3R_73()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_36() { + if (jj_3R_49()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_50()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_48()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_35() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_48()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_34() { + if (jj_3R_46()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_38() { + if (jj_3R_52()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_1() { + if (jj_3R_28()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_33() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_42()) { + jj_scanpos = xsp; + if (jj_3R_43()) { + jj_scanpos = xsp; + if (jj_3R_44()) { + jj_scanpos = xsp; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_37() { + if (jj_3R_51()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_28() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_32()) { + jj_scanpos = xsp; + if (jj_3R_33()) { + jj_scanpos = xsp; + if (jj_3R_34()) { + jj_scanpos = xsp; + if (jj_3R_35()) { + jj_scanpos = xsp; + if (jj_3R_36()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_32() { + if (jj_scan_token(PREFIXED_NAME)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(1)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_29() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_37()) { + jj_scanpos = xsp; + if (jj_3R_38()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_4() { + if (jj_3R_29()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_53() { + if (jj_3R_64()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(2)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_40() { + if (jj_3R_53()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_98() { + if (jj_scan_token(6)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3_3() { + if (jj_3R_29()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_97() { + if (jj_scan_token(16)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_96() { + if (jj_scan_token(36)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_95() { + if (jj_scan_token(35)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_94() { + if (jj_scan_token(15)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + final private boolean jj_3R_93() { + if (jj_scan_token(14)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + public CompactSyntaxTokenManager token_source; + UCode_UCodeESC_CharStream jj_input_stream; + public Token token, jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + public boolean lookingAhead = false; + private boolean jj_semLA; + private int jj_gen; + final private int[] jj_la1 = new int[71]; + final private int[] jj_la1_0 = {0x9c0e0402,0x1e,0x2,0xe2,0x1c,0xe0,0xe0,0x0,0x0,0x0,0x8c0fe5e6,0x8c0fe5e6,0x402,0x16000,0x16000,0x8c0fe4e0,0x6000,0x8000,0x0,0x9c0e0400,0x100000,0x200000,0x400000,0x700000,0x700000,0x3800000,0x0,0x3800000,0x9e0fe4e0,0x0,0x100000,0x100000,0x9e0fe4e0,0x9c0fe4e0,0x2000000,0x40000000,0x40000000,0xe2,0xe0,0x20,0x1c,0x800,0x62,0x60,0x8000,0x40000000,0x40000000,0x800,0x0,0x0,0x0,0x8c0fe4e0,0x8c0fe4e0,0x8c0fe4e2,0x0,0x0,0x0,0x0,0x8c0fe4e0,0x2,0x8c0fe4e0,0x8c0fe4e0,0x0,0x8c0fe4e0,0x100,0x8c0fe4e0,0x100,0x100,0x100,0x100,0x8c0fe4e0,}; + final private int[] jj_la1_1 = {0x6c0091f,0x0,0x0,0x2c00900,0x0,0xc00000,0x0,0x900,0x200,0x900,0x6c0001f,0x6c0001f,0x900,0x0,0x0,0xc0001f,0x0,0x4000000,0x8000000,0x6c0001f,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x3c0001f,0x8000000,0x0,0x0,0x3c0001f,0x2c0001f,0x1000000,0x0,0x0,0xc00900,0xc00000,0xc00000,0x0,0x0,0xc00900,0xc00000,0x0,0x0,0x0,0x0,0x4000000,0x2000018,0xc00000,0xc0001f,0xc0001f,0xc0091f,0x900,0x200,0x900,0x900,0x2c0001f,0x0,0x2c0001f,0x2c0001f,0x2c00000,0x6c0001f,0x0,0x6c0001f,0x0,0x0,0x0,0x0,0x1f,}; + final private JJCalls[] jj_2_rtns = new JJCalls[8]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + public CompactSyntax(java.io.InputStream stream) { + jj_input_stream = new UCode_UCodeESC_CharStream(stream, 1, 1); + token_source = new CompactSyntaxTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(java.io.InputStream stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public CompactSyntax(java.io.Reader stream) { + jj_input_stream = new UCode_UCodeESC_CharStream(stream, 1, 1); + token_source = new CompactSyntaxTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public CompactSyntax(CompactSyntaxTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(CompactSyntaxTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 71; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + final private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + return (jj_scanpos.kind != kind); + } + + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + final public Token getToken(int index) { + Token t = lookingAhead ? jj_scanpos : token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.Vector jj_expentries = new java.util.Vector(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Enumeration enumList = jj_expentries.elements(); enumList.hasMoreElements();) { + int[] oldentry = (int[])(enumList.nextElement()); + if (oldentry.length == jj_expentry.length) { + exists = true; + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.addElement(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + final public ParseException generateParseException() { + jj_expentries.removeAllElements(); + boolean[] la1tokens = new boolean[61]; + for (int i = 0; i < 61; i++) { + la1tokens[i] = false; + } + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 71; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + case 5: jj_3_6(); break; + case 6: jj_3_7(); break; + case 7: jj_3_8(); break; + } + } + p = p.next; + } while (p != null); + } + jj_rescan = false; + } + + final private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj new file mode 100644 index 0000000..c00bc06 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj @@ -0,0 +1,1933 @@ +options { + STATIC = false; + UNICODE_INPUT = true; + JAVA_UNICODE_ESCAPE = true; +} + +PARSER_BEGIN(CompactSyntax) + +package com.thaiopensource.relaxng.parse.compact; + +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.Context; + +import com.thaiopensource.xml.util.WellKnownNamespaces; + +import com.thaiopensource.util.Localizer; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + +import java.util.Hashtable; +import java.util.Enumeration; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; + +public class CompactSyntax implements Context { + private static final int IN_ELEMENT = 0; + private static final int IN_ATTRIBUTE = 1; + private static final int IN_ANY_NAME = 2; + private static final int IN_NS_NAME = 4; + + private String defaultNamespace = SchemaBuilder.INHERIT_NS; + private String compatibilityPrefix = null; + private SchemaBuilder sb; + private String sourceUri; + private ErrorHandler eh; + private final Hashtable namespaceTable = new Hashtable(); + private final Hashtable datatypesTable = new Hashtable(); + private boolean hadError = false; + private static final Localizer localizer = new Localizer(CompactSyntax.class); + private final Hashtable attributeNameTable = new Hashtable(); + private boolean annotationsIncludeElements = false; + + final class LocatedString { + private final String str; + private final Token tok; + + LocatedString(String str, Token tok) { + this.str = str; + this.tok = tok; + } + + String getString() { + return str; + } + + Location getLocation() { + return makeLocation(tok); + } + + Token getToken() { + return tok; + } + + } + + public CompactSyntax(Reader r, String sourceUri, SchemaBuilder sb, ErrorHandler eh) { + this(r); + this.sourceUri = sourceUri; + this.sb = sb; + this.eh = eh; + // this causes the root pattern to have non-null annotations + // which is useful because it gives a context to trang + this.topLevelComments = sb.makeCommentList(); + } + + ParsedPattern parse(Scope scope) throws IllegalSchemaException { + try { + ParsedPattern p = Input(scope); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + ParsedPattern parseInclude(IncludedGrammar g) throws IllegalSchemaException { + try { + ParsedPattern p = IncludedGrammar(g); + if (!hadError) + return p; + } + catch (ParseException e) { + error("syntax_error", e.currentToken.next); + } + catch (EscapeSyntaxException e) { + reportEscapeSyntaxException(e); + } + throw new IllegalSchemaException(); + } + + private void checkNsName(int context, LocatedString ns) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_ns_name", ns.getToken()); + } + + private void checkAnyName(int context, Token t) { + if ((context & IN_NS_NAME) != 0) + error("ns_name_except_contains_any_name", t); + if ((context & IN_ANY_NAME) != 0) + error("any_name_except_contains_any_name", t); + } + + private void error(String key, Token tok) { + doError(localizer.message(key), tok); + } + + private void error(String key, String arg, Token tok) { + doError(localizer.message(key, arg), tok); + } + + private void error(String key, String arg1, String arg2, Token tok) { + doError(localizer.message(key, arg1, arg2), tok); + } + + private void doError(String message, Token tok) { + hadError = true; + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(tok.beginLine); + loc.setColumnNumber(tok.beginColumn); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(message, loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private void reportEscapeSyntaxException(EscapeSyntaxException e) { + if (eh != null) { + LocatorImpl loc = new LocatorImpl(); + loc.setLineNumber(e.getLineNumber()); + loc.setColumnNumber(e.getColumnNumber()); + loc.setSystemId(sourceUri); + try { + eh.error(new SAXParseException(localizer.message(e.getKey()), loc)); + } + catch (SAXException se) { + throw new BuildException(se); + } + } + } + + private static String unquote(String s) { + if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) { + s = s.replace('\u0000', '\n'); + return s.substring(3, s.length() - 3); + } + else + return s.substring(1, s.length() - 1); + } + + Location makeLocation(Token t) { + return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn); + } + + private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) { + if (i >= patterns.length) { + ParsedPattern[] oldPatterns = patterns; + patterns = new ParsedPattern[oldPatterns.length*2]; + System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length); + } + patterns[i] = p; + return patterns; + } + + String getCompatibilityPrefix() { + if (compatibilityPrefix == null) { + compatibilityPrefix = "a"; + while (namespaceTable.get(compatibilityPrefix) != null) + compatibilityPrefix = compatibilityPrefix + "a"; + } + return compatibilityPrefix; + } + + public String resolveNamespacePrefix(String prefix) { + String result = (String)namespaceTable.get(prefix); + if (result.length() == 0) + return null; + return result; + } + + public Enumeration prefixes() { + return namespaceTable.keys(); + } + + public String getBaseUri() { + return sourceUri; + } + + public boolean isUnparsedEntity(String entityName) { + return false; + } + + public boolean isNotation(String notationName) { + return false; + } + + public Context copy() { + return this; + } + + private Context getContext() { + return this; + } + + private CommentList getComments() { + return getComments(getTopLevelComments()); + } + + private CommentList topLevelComments; + + private CommentList getTopLevelComments() { + CommentList tem = topLevelComments; + topLevelComments = null; + return tem; + } + + private void noteTopLevelComments() { + topLevelComments = getComments(topLevelComments); + } + + private void topLevelComments(GrammarSection section) { + section.topLevelComment(getComments(null)); + } + + private Token lastCommentSourceToken = null; + + private CommentList getComments(CommentList comments) { + Token nextToken = getToken(1); + if (lastCommentSourceToken != nextToken) { + if (lastCommentSourceToken == null) + lastCommentSourceToken = token; + do { + lastCommentSourceToken = lastCommentSourceToken.next; + Token t = lastCommentSourceToken.specialToken; + if (t != null) { + while (t.specialToken != null) + t = t.specialToken; + if (comments == null) + comments = sb.makeCommentList(); + for (; t != null; t = t.next) { + String s = mungeComment(t.image); + Location loc = makeLocation(t); + if (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) { + StringBuffer buf = new StringBuffer(s); + do { + t = t.next; + buf.append('\n'); + buf.append(mungeComment(t.image)); + } while (t.next != null + && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE); + s = buf.toString(); + } + comments.addComment(s, loc); + } + } + } while (lastCommentSourceToken != nextToken); + } + return comments; + } + + private ParsedPattern afterComments(ParsedPattern p) { + CommentList comments = getComments(null); + if (comments == null) + return p; + return sb.commentAfter(p, comments); + } + + private ParsedNameClass afterComments(ParsedNameClass nc) { + CommentList comments = getComments(null); + if (comments == null) + return nc; + return sb.commentAfter(nc, comments); + } + + private static String mungeComment(String image) { + int i = image.indexOf('#') + 1; + while (i < image.length() && image.charAt(i) == '#') + i++; + if (i < image.length() && image.charAt(i) == ' ') + i++; + return image.substring(i); + } + + private Annotations getCommentsAsAnnotations() { + CommentList comments = getComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private Annotations addCommentsToChildAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + a = sb.makeAnnotations(null, getContext()); + a.addComment(comments); + return a; + } + + private Annotations addCommentsToLeadingAnnotations(Annotations a) { + CommentList comments = getComments(); + if (comments == null) + return a; + if (a == null) + return sb.makeAnnotations(comments, getContext()); + a.addLeadingComment(comments); + return a; + } + + private Annotations getTopLevelCommentsAsAnnotations() { + CommentList comments = getTopLevelComments(); + if (comments == null) + return null; + return sb.makeAnnotations(comments, getContext()); + } + + private void clearAttributeList() { + attributeNameTable.clear(); + } + + private void addAttribute(Annotations a, String ns, String localName, String prefix, String value, Token tok) { + String key = ns + "#" + localName; + if (attributeNameTable.get(key) != null) + error("duplicate_attribute", ns, localName, tok); + else { + attributeNameTable.put(key, key); + a.addAttribute(ns, localName, prefix, value, makeLocation(tok)); + } + } + + private void checkExcept(Token[] except) { + if (except[0] != null) + error("except_missing_parentheses", except[0]); + } + + private String lookupPrefix(String prefix, Token t) { + String ns = (String)namespaceTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return "#error"; + } + return ns; + } + private String lookupDatatype(String prefix, Token t) { + String ns = (String)datatypesTable.get(prefix); + if (ns == null) { + error("undeclared_prefix", prefix, t); + return ""; // XXX + } + return ns; + } + private String resolve(String str) { + try { + return new URL(new URL(sourceUri), str).toString(); + } + catch (MalformedURLException e) { } + return str; + } +} + +PARSER_END(CompactSyntax) + +ParsedPattern Input(Scope scope) : +{ + ParsedPattern p; +} +{ + Preamble() + (LOOKAHEAD(TopLevelLookahead()) p = TopLevelGrammar(scope) + | p = Expr(true, scope, null, null) { p = afterComments(p); } ) + { return p; } +} + +void TopLevelLookahead() : +{} +{ + "[" + | Identifier() ("[" | "=" | "&=" | "|=") + | LookaheadGrammarKeyword() + | LookaheadBody() LookaheadAfterAnnotations() + | LookaheadDocumentation() (LookaheadBody())? LookaheadAfterAnnotations() +} + +void LookaheadAfterAnnotations() : +{} +{ + Identifier() ("=" | "&=" | "|=") + | LookaheadGrammarKeyword() +} + +void LookaheadGrammarKeyword() : +{} +{ + "start" | "div" | "include" +} + +void LookaheadDocumentation() : +{} +{ + (( | ) ()*)+ +} + +void LookaheadBody() : +{} +{ + "[" + ( | UnprefixedName() | "=" | | "~" | LookaheadBody() )* + "]" +} + +ParsedPattern IncludedGrammar(IncludedGrammar g) : +{ + Annotations a; + ParsedPattern p; +} +{ + Preamble() + (LOOKAHEAD(TopLevelLookahead()) a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations()) + | a = Annotations() "grammar" "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}") + { p = afterComments(g.endIncludedGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } + + { return p; } +} + +ParsedPattern TopLevelGrammar(Scope scope) : +{ + Annotations a = getTopLevelCommentsAsAnnotations(); + Grammar g; + ParsedPattern p; +} +{ + { g = sb.makeGrammar(scope); } + a = GrammarBody(g, g, a) + { p = afterComments(g.endGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } + + { return p; } +} + +void Preamble() : +{} +{ + (NamespaceDecl() | DatatypesDecl())* + { + namespaceTable.put("xml", WellKnownNamespaces.XML); + if (datatypesTable.get("xsd") == null) + datatypesTable.put("xsd", WellKnownNamespaces.XML_SCHEMA_DATATYPES); + } +} + +void NamespaceDecl() : +{ + LocatedString prefix = null; + boolean isDefault = false; + String namespaceName; +} +{ + { noteTopLevelComments(); } + (("namespace" prefix = UnprefixedName()) + | ("default" { isDefault = true; } + "namespace" (prefix = UnprefixedName())?)) + "=" + namespaceName = NamespaceName() + { + if (isDefault) + defaultNamespace = namespaceName; + if (prefix != null) { + if (prefix.getString().equals("xmlns")) + error("xmlns_prefix", prefix.getToken()); + else if (prefix.getString().equals("xml")) { + if (!namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_prefix_bad_uri", prefix.getToken()); + } + else if (namespaceName.equals(WellKnownNamespaces.XML)) + error("xml_uri_bad_prefix", prefix.getToken()); + else { + if (namespaceName.equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS)) + compatibilityPrefix = prefix.getString(); + namespaceTable.put(prefix.getString(), namespaceName); + } + } + } +} + +String NamespaceName() : +{ + String r; +} +{ + (r = Literal() | "inherit" { r = SchemaBuilder.INHERIT_NS; }) + { return r; } +} + +void DatatypesDecl() : +{ + LocatedString prefix; + String uri; +} +{ + { noteTopLevelComments(); } + "datatypes" prefix = UnprefixedName() "=" uri = Literal() + { + datatypesTable.put(prefix.getString(), uri); + } +} + +ParsedPattern AnnotatedPrimaryExpr(boolean topLevel, Scope scope, Token[] except) : +{ + Annotations a; + ParsedPattern p; + ParsedElementAnnotation e; + Token t; +} +{ + a = Annotations() + p = PrimaryExpr(topLevel, scope, a, except) + ( t = e = AnnotationElement(false) { + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + })* + { return p; } +} + + +ParsedPattern PrimaryExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : +{ + ParsedPattern p; +} +{ + (p = ElementExpr(scope, a) + | p = AttributeExpr(scope, a) + | p = GrammarExpr(scope, a) + | p = ExternalRefExpr(scope, a) + | p = ListExpr(scope, a) + | p = MixedExpr(scope, a) + | p = ParenExpr(topLevel, scope, a) + | p = IdentifierExpr(scope, a) + | p = ParentExpr(scope, a) + | p = DataExpr(topLevel, scope, a, except) + | p = ValueExpr(topLevel, a) + | p = TextExpr(a) + | p = EmptyExpr(a) + | p = NotAllowedExpr(a)) + { return p; } +} + +ParsedPattern EmptyExpr(Annotations a) : +{ + Token t; +} +{ + t = "empty" + { return sb.makeEmpty(makeLocation(t), a); } +} + +ParsedPattern TextExpr(Annotations a) : +{ + Token t; +} +{ + t = "text" + { return sb.makeText(makeLocation(t), a); } +} + +ParsedPattern NotAllowedExpr(Annotations a) : +{ + Token t; +} +{ + t = "notAllowed" + { return sb.makeNotAllowed(makeLocation(t), a); } +} + +ParsedPattern Expr(boolean topLevel, Scope scope, Token t, Annotations a) : +{ + ParsedPattern p; + ParsedPattern[] patterns = new ParsedPattern[2]; + int nPatterns = 1; + boolean[] hadOccur = new boolean[1]; + Token[] except = new Token[1]; +} +{ + p = UnaryExpr(topLevel, scope, hadOccur, except) + { patterns[0] = p; } + ( + { checkExcept(except); } + (t = "|" p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeChoice(patterns, nPatterns, makeLocation(t), a); } + | (t = "&" p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeInterleave(patterns, nPatterns, makeLocation(t), a); } + | (t = "," p = UnaryExpr(topLevel, scope, null, except) + { patterns = addPattern(patterns, nPatterns++, p); checkExcept(except); } )+ + { p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); } + )? + { + if (nPatterns == 1 && a != null) { + if (hadOccur[0]) + p = sb.annotate(p, a); + else + p = sb.makeGroup(patterns, nPatterns, makeLocation(t), a); + } + return p; + } +} + +ParsedPattern UnaryExpr(boolean topLevel, Scope scope, boolean[] hadOccur, Token[] except) : +{ + ParsedPattern p; + Token t; + ParsedElementAnnotation e; +} +{ + p = AnnotatedPrimaryExpr(topLevel, scope, except) + ( + { + if (hadOccur != null) hadOccur[0] = true; + p = afterComments(p); + } + (t = "+" { checkExcept(except); p = sb.makeOneOrMore(p, makeLocation(t), null); } + | t = "?" { checkExcept(except); p = sb.makeOptional(p, makeLocation(t), null); } + | t = "*" { checkExcept(except); p = sb.makeZeroOrMore(p, makeLocation(t), null); }) + ( t = e = AnnotationElement(false) { + if (topLevel) + error("top_level_follow_annotation", t); + else + p = sb.annotateAfter(p, e); + } )* + )? + { return p; } +} + +ParsedPattern ElementExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedNameClass nc; + ParsedPattern p; +} +{ + t = "element" + nc = NameClass(IN_ELEMENT, null) + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeElement(nc, p, makeLocation(t), a); } +} + +ParsedPattern AttributeExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedNameClass nc; + ParsedPattern p; +} +{ + t = "attribute" + nc = NameClass(IN_ATTRIBUTE, null) + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeAttribute(nc, p, makeLocation(t), a); } +} + +ParsedNameClass NameClass(int context, Annotations[] pa) : +{ + Annotations a; + ParsedNameClass nc; +} +{ + a = Annotations() + (nc = PrimaryNameClass(context, a) nc = AnnotateAfter(nc) nc = NameClassAlternatives(context, nc, pa) + | nc = AnyNameExceptClass(context, a, pa) + | nc = NsNameExceptClass(context, a, pa)) + { return nc; } +} + +ParsedNameClass AnnotateAfter(ParsedNameClass nc) : +{ + ParsedElementAnnotation e; +} +{ + ( e = AnnotationElement(false) { nc = sb.annotateAfter(nc, e); })* + { return nc; } +} + +ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) : +{ + Token t; + ParsedNameClass[] nameClasses; + int nNameClasses; +} +{ + ( + { + nameClasses = new ParsedNameClass[2]; + nameClasses[0] = nc; + nNameClasses = 1; + } + (t = "|" nc = BasicNameClass(context) nc = AnnotateAfter(nc) + { + if (nNameClasses >= nameClasses.length) { + ParsedNameClass[] oldNameClasses = nameClasses; + nameClasses = new ParsedNameClass[oldNameClasses.length*2]; + System.arraycopy(oldNameClasses, 0, nameClasses, 0, oldNameClasses.length); + } + nameClasses[nNameClasses++] = nc; + })+ + { + Annotations a; + if (pa == null) + a = null; + else { + a = pa[0]; + pa[0] = null; + } + nc = sb.makeChoice(nameClasses, nNameClasses, makeLocation(t), a); + } + )? + { return nc; } +} + +ParsedNameClass BasicNameClass(int context) : +{ + Annotations a; + ParsedNameClass nc; +} +{ + a = Annotations() + (nc = PrimaryNameClass(context, a) + | nc = OpenNameClass(context, a)) + { return nc; } +} + +ParsedNameClass PrimaryNameClass(int context, Annotations a) : +{ + ParsedNameClass nc; +} +{ + (nc = UnprefixedNameClass(context, a) + | nc = PrefixedNameClass(a) + | nc = ParenNameClass(context, a)) + { return nc; } +} + +ParsedNameClass OpenNameClass(int context, Annotations a) : +{ + Token t; + LocatedString ns; +} +{ + ns = NsName() { checkNsName(context, ns); return sb.makeNsName(ns.getString(), ns.getLocation(), a); } + | t = "*" { checkAnyName(context, t); return sb.makeAnyName(makeLocation(t), a); } +} + + +ParsedNameClass UnprefixedNameClass(int context, Annotations a) : +{ + LocatedString name; +} +{ + name = UnprefixedName() + { + String ns; + if ((context & (IN_ATTRIBUTE|IN_ELEMENT)) == IN_ATTRIBUTE) + ns = ""; + else + ns = defaultNamespace; + return sb.makeName(ns, name.getString(), null, name.getLocation(), a); + } +} + +ParsedNameClass PrefixedNameClass(Annotations a) : +{ + Token t; +} +{ + t = + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + return sb.makeName(lookupPrefix(prefix, t), qn.substring(colon + 1), prefix, makeLocation(t), a); + } +} + +ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) : +{ + LocatedString ns; + ParsedNameClass nc; +} +{ + ns = NsName() + { checkNsName(context, ns); } + (nc = ExceptNameClass(context | IN_NS_NAME) + { nc = sb.makeNsName(ns.getString(), nc, ns.getLocation(), a); } + nc = AnnotateAfter(nc) + | { nc = sb.makeNsName(ns.getString(), ns.getLocation(), a); } + nc = AnnotateAfter(nc) + nc = NameClassAlternatives(context, nc, pa)) + { return nc; } +} + +LocatedString NsName() : +{ + Token t; +} +{ + t = + { + String qn = t.image; + String prefix = qn.substring(0, qn.length() - 2); + return new LocatedString(lookupPrefix(prefix, t), t); + } +} + +ParsedNameClass AnyNameExceptClass(int context, Annotations a, Annotations[] pa) : +{ + Token t; + ParsedNameClass nc; +} +{ + t = "*" + { checkAnyName(context, t); } + (nc = ExceptNameClass(context | IN_ANY_NAME) + { nc = sb.makeAnyName(nc, makeLocation(t), a); } + nc = AnnotateAfter(nc) + | { nc = sb.makeAnyName(makeLocation(t), a); } + nc = AnnotateAfter(nc) + nc = NameClassAlternatives(context, nc, pa)) + { return nc; } +} + +ParsedNameClass ParenNameClass(int context, Annotations a) : +{ + Token t; + ParsedNameClass nc; + Annotations[] pa = new Annotations[]{ a }; +} +{ + t = "(" nc = NameClass(context, pa) { nc = afterComments(nc); } ")" + { + if (pa[0] != null) + nc = sb.makeChoice(new ParsedNameClass[] { nc }, 1, makeLocation(t), pa[0]); + return nc; + } +} + +ParsedNameClass ExceptNameClass(int context) : +{ + ParsedNameClass nc; +} +{ + "-" nc = BasicNameClass(context) + { return nc; } +} + +ParsedPattern ListExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "list" + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeList(p, makeLocation(t), a); } +} + +ParsedPattern MixedExpr(Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "mixed" + "{" + p = Expr(false, scope, null, null) + { p = afterComments(p); } + "}" + { return sb.makeMixed(p, makeLocation(t), a); } +} + +ParsedPattern GrammarExpr(Scope scope, Annotations a) : +{ + Token t; + Grammar g; +} +{ + t = "grammar" { g = sb.makeGrammar(scope); } + "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}" + { return g.endGrammar(makeLocation(t), a); } +} + +ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) : +{ + Token t; + ParsedPattern p; +} +{ + t = "(" p = Expr(topLevel, scope, t, a) { p = afterComments(p); } ")" + { return p; } +} + +Annotations GrammarBody(GrammarSection section, Scope scope, Annotations a) : +{ + ParsedElementAnnotation e; +} +{ + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() + { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* + (GrammarComponent(section, scope))* + { return a; } +} + +void GrammarComponent(GrammarSection section, Scope scope) : +{ + ParsedElementAnnotation e; + Annotations a; +} +{ + (a = Annotations() + (Definition(section, scope, a) + | Include(section, scope, a) + | Div(section, scope, a))) + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* +} + +void Definition(GrammarSection section, Scope scope, Annotations a) : +{} +{ + (Define(section, scope, a) | Start(section, scope, a)) +} + +void Start(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + GrammarSection.Combine combine; + ParsedPattern p; +} +{ + t = "start" combine = AssignOp() p = Expr(false, scope, null, null) + { section.define(GrammarSection.START, combine, p, makeLocation(t), a); } +} + +void Define(GrammarSection section, Scope scope, Annotations a) : +{ + LocatedString name; + GrammarSection.Combine combine; + ParsedPattern p; +} +{ + name = Identifier() combine = AssignOp() p = Expr(false, scope, null, null) + { section.define(name.getString(), combine, p, name.getLocation(), a); } +} + +GrammarSection.Combine AssignOp() : +{} +{ + "=" { return null; } + | "|=" { return GrammarSection.COMBINE_CHOICE; } + | "&=" { return GrammarSection.COMBINE_INTERLEAVE; } +} + +void Include(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + String href; + String ns; + Include include = section.makeInclude(); +} +{ + t = "include" href = Literal() + ns = Inherit() + ("{" a = IncludeBody(include, scope, a) { topLevelComments(include); } "}")? + { + try { + include.endInclude(resolve(href), ns, makeLocation(t), a); + } + catch (IllegalSchemaException e) { } + } +} + +Annotations IncludeBody(GrammarSection section, Scope scope, Annotations a) : +{ + ParsedElementAnnotation e; +} +{ + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() + { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* + (IncludeComponent(section, scope))* + { return a; } +} + + +void IncludeComponent(GrammarSection section, Scope scope) : +{ + ParsedElementAnnotation e; + Annotations a; +} +{ + (a = Annotations() (Definition(section, scope, a) + | IncludeDiv(section, scope, a))) + (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* +} + +void Div(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + Div div = section.makeDiv(); +} +{ + t = "div" "{" a = GrammarBody(div, scope, a) { topLevelComments(div); } "}" + { div.endDiv(makeLocation(t), a); } +} + +void IncludeDiv(GrammarSection section, Scope scope, Annotations a) : +{ + Token t; + Div div = section.makeDiv(); +} +{ + t = "div" "{" a = IncludeBody(div, scope, a) { topLevelComments(div); } "}" + { div.endDiv(makeLocation(t), a); } +} + +ParsedPattern ExternalRefExpr(Scope scope, Annotations a) : +{ + Token t; + String href; + String ns; +} +{ + t = "external" href = Literal() + ns = Inherit() + { + try { + return sb.makeExternalRef(resolve(href), ns, scope, makeLocation(t), a); + } + catch (IllegalSchemaException e) { + return sb.makeErrorPattern(); + } + } +} + +String Inherit() : +{ + String ns = null; +} +{ + ("inherit" "=" ns = Prefix())? + { + if (ns == null) + ns = defaultNamespace; + return ns; + } +} + +ParsedPattern ParentExpr(Scope scope, Annotations a) : +{ + LocatedString name; +} +{ + "parent" { a = addCommentsToChildAnnotations(a); } name = Identifier() + { + return scope.makeParentRef(name.getString(), name.getLocation(), a); + } +} + +ParsedPattern IdentifierExpr(Scope scope, Annotations a) : +{ + LocatedString name; +} +{ + name = Identifier() + { + return scope.makeRef(name.getString(), name.getLocation(), a); + } +} + +ParsedPattern ValueExpr(boolean topLevel, Annotations a) : +{ + LocatedString s; +} +{ + s = LocatedLiteral() + { + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", s.getToken()); + a = null; + } + return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a); + } +} + +ParsedPattern DataExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : +{ + Token datatypeToken; + Location loc; + String datatype; + String datatypeUri = null; + String s = null; + ParsedPattern e = null; + DataPatternBuilder dpb; +} +{ + datatypeToken = DatatypeName() + { + datatype = datatypeToken.image; + loc = makeLocation(datatypeToken); + int colon = datatype.indexOf(':'); + if (colon < 0) + datatypeUri = ""; + else { + String prefix = datatype.substring(0, colon); + datatypeUri = lookupDatatype(prefix, datatypeToken); + datatype = datatype.substring(colon + 1); + } + } + ((s = Literal() + { + if (topLevel && annotationsIncludeElements) { + error("top_level_follow_annotation", datatypeToken); + a = null; + } + return sb.makeValue(datatypeUri, datatype, s, getContext(), defaultNamespace, loc, a); + } + ) + | ( { dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc); } + ( (Params(dpb) (e = Except(scope, except))?) + | (e = Except(scope, except))?) + { return e == null ? dpb.makePattern(loc, a) : dpb.makePattern(e, loc, a); })) +} + +Token DatatypeName() : +{ + Token t; +} +{ + (t = "string" | t = "token" | t = ) + { return t; } +} + +LocatedString Identifier() : +{ + LocatedString s; + Token t; +} +{ + (t = { s = new LocatedString(t.image, t); } + | t = { s = new LocatedString(t.image.substring(1), t); }) + { return s; } +} + +String Prefix() : +{ + Token t; + String prefix; +} +{ + (t = { prefix = t.image; } + | t = { prefix = t.image.substring(1); } + | t = Keyword() { prefix = t.image; }) + { return lookupPrefix(prefix, t); } +} + +LocatedString UnprefixedName() : +{ + LocatedString s; + Token t; +} +{ + (s = Identifier() + | t = Keyword() { s = new LocatedString(t.image, t); }) + { return s; } +} + +void Params(DataPatternBuilder dpb) : +{} +{ + "{" (Param(dpb))* "}" +} + +void Param(DataPatternBuilder dpb) : +{ + LocatedString name; + Annotations a; + String value; +} +{ + a = Annotations() name = UnprefixedName() "=" { a = addCommentsToLeadingAnnotations(a); } value = Literal() + { dpb.addParam(name.getString(), value, getContext(), defaultNamespace, name.getLocation(), a); } +} + +ParsedPattern Except(Scope scope, Token[] except) : +{ + Annotations a; + ParsedPattern p; + Token t; + Token[] innerExcept = new Token[1]; +} +{ + t = "-" a = Annotations() p = PrimaryExpr(false, scope, a, innerExcept) + { + checkExcept(innerExcept); + except[0] = t; + return p; + } +} + +ParsedElementAnnotation Documentation() : +{ + CommentList comments = getComments(); + ElementAnnotationBuilder eab; + Token t; + String s; +} +{ + (t = | t = ) + { + eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS, + "documentation", + getCompatibilityPrefix(), + makeLocation(t), + comments, + getContext()); + eab.addText(mungeComment(t.image), makeLocation(t), null); + } + (t = { eab.addText("\n" + mungeComment(t.image), makeLocation(t), null); })* + { return eab.makeElementAnnotation(); } +} + +Annotations Annotations() : +{ + CommentList comments = getComments(); + Annotations a = null; + ParsedElementAnnotation e; +} +{ + ( { a = sb.makeAnnotations(comments, getContext()); } + (e = Documentation() { a.addElement(e); })+ + { + comments = getComments(); + if (comments != null) + a.addLeadingComment(comments); + } + )? + ("[" { if (a == null) a = sb.makeAnnotations(comments, getContext()); clearAttributeList(); annotationsIncludeElements = false; } + (LOOKAHEAD(2) PrefixedAnnotationAttribute(a, false) )* + ( e = AnnotationElement(false) { a.addElement(e); annotationsIncludeElements = true; } )* + { a.addComment(getComments()); } + "]")? + { + if (a == null && comments != null) + a = sb.makeAnnotations(comments, getContext()); + return a; + } +} + +void AnnotationAttribute(Annotations a) : +{} +{ + PrefixedAnnotationAttribute(a, true) | UnprefixedAnnotationAttribute(a) +} + +void PrefixedAnnotationAttribute(Annotations a, boolean nested) : +{ + Token t; + String value; +} +{ + t = "=" value = Literal() + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) + error("inherited_annotation_namespace", t); + else if (ns.length() == 0 && !nested) + error("unqualified_annotation_attribute", t); + else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested) + error("relax_ng_namespace", t); + /*else if (ns.length() == 0 + && qn.length() - colon - 1 == 5 + && qn.regionMatches(colon + 1, "xmlns", 0, 5)) + error("xmlns_annotation_attribute", t);*/ + else if (ns.equals(WellKnownNamespaces.XMLNS)) + error("xmlns_annotation_attribute_uri", t); + else { + if (ns.length() == 0) + prefix = null; + addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t); + } + } +} + +void UnprefixedAnnotationAttribute(Annotations a) : +{ + LocatedString name; + String value; +} +{ + name = UnprefixedName() "=" value = Literal() + { + if (name.getString().equals("xmlns")) + error("xmlns_annotation_attribute", name.getToken()); + else + addAttribute(a, "", name.getString(), null, value, name.getToken()); + } +} + +ParsedElementAnnotation AnnotationElement(boolean nested) : +{ + ParsedElementAnnotation a; +} +{ + (a = PrefixedAnnotationElement(nested) + | a = UnprefixedAnnotationElement()) + { return a; } +} + +ParsedElementAnnotation AnnotationElementNotKeyword() : +{ + ParsedElementAnnotation a; +} +{ + (a = PrefixedAnnotationElement(false) + | a = IdentifierAnnotationElement()) + { return a; } +} + +ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) : +{ + CommentList comments = getComments(); + Token t; + ElementAnnotationBuilder eab; +} +{ + t = + { + String qn = t.image; + int colon = qn.indexOf(':'); + String prefix = qn.substring(0, colon); + String ns = lookupPrefix(prefix, t); + if (ns == SchemaBuilder.INHERIT_NS) { + error("inherited_annotation_namespace", t); + ns = ""; + } + else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) { + error("relax_ng_namespace", t); + ns = ""; + } + else { + if (ns.length() == 0) + prefix = null; + } + eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix, + makeLocation(t), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +ParsedElementAnnotation UnprefixedAnnotationElement() : +{ + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; +} +{ + name = UnprefixedName() + { + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +ParsedElementAnnotation IdentifierAnnotationElement() : +{ + CommentList comments = getComments(); + LocatedString name; + ElementAnnotationBuilder eab; +} +{ + name = Identifier() + { + eab = sb.makeElementAnnotationBuilder("", name.getString(), null, + name.getLocation(), comments, getContext()); + } + AnnotationElementContent(eab) + { return eab.makeElementAnnotation(); } +} + +void AnnotationElementContent(ElementAnnotationBuilder eab) : +{ + ParsedElementAnnotation e; +} +{ + "[" { clearAttributeList(); } + (LOOKAHEAD(2) AnnotationAttribute(eab))* + ((AnnotationElementLiteral(eab) + ("~" AnnotationElementLiteral(eab))*) + | e = AnnotationElement(true) { eab.addElement(e); })* + { eab.addComment(getComments()); } + "]" +} + +void AnnotationElementLiteral(ElementAnnotationBuilder eab) : +{ + Token t; + CommentList comments = getComments(); +} +{ + t = { eab.addText(unquote(t.image), makeLocation(t), comments); } +} + +String Literal() : +{ + Token t; + String s; + StringBuffer buf; +} +{ + t = + { + s = unquote(t.image); + } + ( + { buf = new StringBuffer(s); } + ("~" t = { buf.append(unquote(t.image)); })+ + { s = buf.toString(); } + )? + { return s; } +} + +LocatedString LocatedLiteral() : +{ + Token t; + Token t2; + String s; + StringBuffer buf; +} +{ + t = + { + s = unquote(t.image); + } + ( + { buf = new StringBuffer(s); } + ("~" t2 = { buf.append(unquote(t2.image)); })+ + { s = buf.toString(); } + )? + { return new LocatedString(s, t); } +} + +Token Keyword() : +{ + Token t; +} +{ + (t = "element" + | t = "attribute" + | t = "namespace" + | t = "list" + | t = "mixed" + | t = "grammar" + | t = "empty" + | t = "text" + | t = "parent" + | t = "external" + | t = "notAllowed" + | t = "start" + | t = "include" + | t = "default" + | t = "inherit" + | t = "string" + | t = "token" + | t = "datatypes" + | t = "div") + { return t; } +} + +<*> +SKIP: { + < #NEWLINE : [ "\u0000", "\n" ] > + | < #NOT_NEWLINE : ~[ "\u0000", "\n" ] > + | < WS: ([ "\u0000", " ", "\n", "\t" ])+ > : DEFAULT +} + +TOKEN : +{ + < DOCUMENTATION: "##" ()* > : AFTER_DOCUMENTATION +} + + +TOKEN : +{ + < DOCUMENTATION_CONTINUE: ([" ", "\t"])* > +} + +SPECIAL_TOKEN: +{ + < SINGLE_LINE_COMMENT: "#" ()* > : AFTER_SINGLE_LINE_COMMENT +} + + +TOKEN : +{ + < DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: ([" ", "\t"])* > : AFTER_DOCUMENTATION +} + + +SPECIAL_TOKEN : +{ + < SINGLE_LINE_COMMENT_CONTINUE: ([" ", "\t"])* > +} + +TOKEN : +{ + < #BASE_CHAR : [ + "\u0041" - "\u005a", + "\u0061" - "\u007a", + "\u00c0" - "\u00d6", + "\u00d8" - "\u00f6", + "\u00f8" - "\u00ff", + "\u0100" - "\u0131", + "\u0134" - "\u013e", + "\u0141" - "\u0148", + "\u014a" - "\u017e", + "\u0180" - "\u01c3", + "\u01cd" - "\u01f0", + "\u01f4" - "\u01f5", + "\u01fa" - "\u0217", + "\u0250" - "\u02a8", + "\u02bb" - "\u02c1", + "\u0386", + "\u0388" - "\u038a", + "\u038c", + "\u038e" - "\u03a1", + "\u03a3" - "\u03ce", + "\u03d0" - "\u03d6", + "\u03da", + "\u03dc", + "\u03de", + "\u03e0", + "\u03e2" - "\u03f3", + "\u0401" - "\u040c", + "\u040e" - "\u044f", + "\u0451" - "\u045c", + "\u045e" - "\u0481", + "\u0490" - "\u04c4", + "\u04c7" - "\u04c8", + "\u04cb" - "\u04cc", + "\u04d0" - "\u04eb", + "\u04ee" - "\u04f5", + "\u04f8" - "\u04f9", + "\u0531" - "\u0556", + "\u0559", + "\u0561" - "\u0586", + "\u05d0" - "\u05ea", + "\u05f0" - "\u05f2", + "\u0621" - "\u063a", + "\u0641" - "\u064a", + "\u0671" - "\u06b7", + "\u06ba" - "\u06be", + "\u06c0" - "\u06ce", + "\u06d0" - "\u06d3", + "\u06d5", + "\u06e5" - "\u06e6", + "\u0905" - "\u0939", + "\u093d", + "\u0958" - "\u0961", + "\u0985" - "\u098c", + "\u098f" - "\u0990", + "\u0993" - "\u09a8", + "\u09aa" - "\u09b0", + "\u09b2", + "\u09b6" - "\u09b9", + "\u09dc" - "\u09dd", + "\u09df" - "\u09e1", + "\u09f0" - "\u09f1", + "\u0a05" - "\u0a0a", + "\u0a0f" - "\u0a10", + "\u0a13" - "\u0a28", + "\u0a2a" - "\u0a30", + "\u0a32" - "\u0a33", + "\u0a35" - "\u0a36", + "\u0a38" - "\u0a39", + "\u0a59" - "\u0a5c", + "\u0a5e", + "\u0a72" - "\u0a74", + "\u0a85" - "\u0a8b", + "\u0a8d", + "\u0a8f" - "\u0a91", + "\u0a93" - "\u0aa8", + "\u0aaa" - "\u0ab0", + "\u0ab2" - "\u0ab3", + "\u0ab5" - "\u0ab9", + "\u0abd", + "\u0ae0", + "\u0b05" - "\u0b0c", + "\u0b0f" - "\u0b10", + "\u0b13" - "\u0b28", + "\u0b2a" - "\u0b30", + "\u0b32" - "\u0b33", + "\u0b36" - "\u0b39", + "\u0b3d", + "\u0b5c" - "\u0b5d", + "\u0b5f" - "\u0b61", + "\u0b85" - "\u0b8a", + "\u0b8e" - "\u0b90", + "\u0b92" - "\u0b95", + "\u0b99" - "\u0b9a", + "\u0b9c", + "\u0b9e" - "\u0b9f", + "\u0ba3" - "\u0ba4", + "\u0ba8" - "\u0baa", + "\u0bae" - "\u0bb5", + "\u0bb7" - "\u0bb9", + "\u0c05" - "\u0c0c", + "\u0c0e" - "\u0c10", + "\u0c12" - "\u0c28", + "\u0c2a" - "\u0c33", + "\u0c35" - "\u0c39", + "\u0c60" - "\u0c61", + "\u0c85" - "\u0c8c", + "\u0c8e" - "\u0c90", + "\u0c92" - "\u0ca8", + "\u0caa" - "\u0cb3", + "\u0cb5" - "\u0cb9", + "\u0cde", + "\u0ce0" - "\u0ce1", + "\u0d05" - "\u0d0c", + "\u0d0e" - "\u0d10", + "\u0d12" - "\u0d28", + "\u0d2a" - "\u0d39", + "\u0d60" - "\u0d61", + "\u0e01" - "\u0e2e", + "\u0e30", + "\u0e32" - "\u0e33", + "\u0e40" - "\u0e45", + "\u0e81" - "\u0e82", + "\u0e84", + "\u0e87" - "\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94" - "\u0e97", + "\u0e99" - "\u0e9f", + "\u0ea1" - "\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa" - "\u0eab", + "\u0ead" - "\u0eae", + "\u0eb0", + "\u0eb2" - "\u0eb3", + "\u0ebd", + "\u0ec0" - "\u0ec4", + "\u0f40" - "\u0f47", + "\u0f49" - "\u0f69", + "\u10a0" - "\u10c5", + "\u10d0" - "\u10f6", + "\u1100", + "\u1102" - "\u1103", + "\u1105" - "\u1107", + "\u1109", + "\u110b" - "\u110c", + "\u110e" - "\u1112", + "\u113c", + "\u113e", + "\u1140", + "\u114c", + "\u114e", + "\u1150", + "\u1154" - "\u1155", + "\u1159", + "\u115f" - "\u1161", + "\u1163", + "\u1165", + "\u1167", + "\u1169", + "\u116d" - "\u116e", + "\u1172" - "\u1173", + "\u1175", + "\u119e", + "\u11a8", + "\u11ab", + "\u11ae" - "\u11af", + "\u11b7" - "\u11b8", + "\u11ba", + "\u11bc" - "\u11c2", + "\u11eb", + "\u11f0", + "\u11f9", + "\u1e00" - "\u1e9b", + "\u1ea0" - "\u1ef9", + "\u1f00" - "\u1f15", + "\u1f18" - "\u1f1d", + "\u1f20" - "\u1f45", + "\u1f48" - "\u1f4d", + "\u1f50" - "\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f" - "\u1f7d", + "\u1f80" - "\u1fb4", + "\u1fb6" - "\u1fbc", + "\u1fbe", + "\u1fc2" - "\u1fc4", + "\u1fc6" - "\u1fcc", + "\u1fd0" - "\u1fd3", + "\u1fd6" - "\u1fdb", + "\u1fe0" - "\u1fec", + "\u1ff2" - "\u1ff4", + "\u1ff6" - "\u1ffc", + "\u2126", + "\u212a" - "\u212b", + "\u212e", + "\u2180" - "\u2182", + "\u3041" - "\u3094", + "\u30a1" - "\u30fa", + "\u3105" - "\u312c", + "\uac00" - "\ud7a3" + ] > + | < #IDEOGRAPHIC : [ + "\u4e00" - "\u9fa5", + "\u3007", + "\u3021" - "\u3029" + ] > + | < #LETTER : ( | ) > + | < #COMBINING_CHAR : [ + "\u0300" - "\u0345", + "\u0360" - "\u0361", + "\u0483" - "\u0486", + "\u0591" - "\u05a1", + "\u05a3" - "\u05b9", + "\u05bb" - "\u05bd", + "\u05bf", + "\u05c1" - "\u05c2", + "\u05c4", + "\u064b" - "\u0652", + "\u0670", + "\u06d6" - "\u06dc", + "\u06dd" - "\u06df", + "\u06e0" - "\u06e4", + "\u06e7" - "\u06e8", + "\u06ea" - "\u06ed", + "\u0901" - "\u0903", + "\u093c", + "\u093e" - "\u094c", + "\u094d", + "\u0951" - "\u0954", + "\u0962" - "\u0963", + "\u0981" - "\u0983", + "\u09bc", + "\u09be", + "\u09bf", + "\u09c0" - "\u09c4", + "\u09c7" - "\u09c8", + "\u09cb" - "\u09cd", + "\u09d7", + "\u09e2" - "\u09e3", + "\u0a02", + "\u0a3c", + "\u0a3e", + "\u0a3f", + "\u0a40" - "\u0a42", + "\u0a47" - "\u0a48", + "\u0a4b" - "\u0a4d", + "\u0a70" - "\u0a71", + "\u0a81" - "\u0a83", + "\u0abc", + "\u0abe" - "\u0ac5", + "\u0ac7" - "\u0ac9", + "\u0acb" - "\u0acd", + "\u0b01" - "\u0b03", + "\u0b3c", + "\u0b3e" - "\u0b43", + "\u0b47" - "\u0b48", + "\u0b4b" - "\u0b4d", + "\u0b56" - "\u0b57", + "\u0b82" - "\u0b83", + "\u0bbe" - "\u0bc2", + "\u0bc6" - "\u0bc8", + "\u0bca" - "\u0bcd", + "\u0bd7", + "\u0c01" - "\u0c03", + "\u0c3e" - "\u0c44", + "\u0c46" - "\u0c48", + "\u0c4a" - "\u0c4d", + "\u0c55" - "\u0c56", + "\u0c82" - "\u0c83", + "\u0cbe" - "\u0cc4", + "\u0cc6" - "\u0cc8", + "\u0cca" - "\u0ccd", + "\u0cd5" - "\u0cd6", + "\u0d02" - "\u0d03", + "\u0d3e" - "\u0d43", + "\u0d46" - "\u0d48", + "\u0d4a" - "\u0d4d", + "\u0d57", + "\u0e31", + "\u0e34" - "\u0e3a", + "\u0e47" - "\u0e4e", + "\u0eb1", + "\u0eb4" - "\u0eb9", + "\u0ebb" - "\u0ebc", + "\u0ec8" - "\u0ecd", + "\u0f18" - "\u0f19", + "\u0f35", + "\u0f37", + "\u0f39", + "\u0f3e", + "\u0f3f", + "\u0f71" - "\u0f84", + "\u0f86" - "\u0f8b", + "\u0f90" - "\u0f95", + "\u0f97", + "\u0f99" - "\u0fad", + "\u0fb1" - "\u0fb7", + "\u0fb9", + "\u20d0" - "\u20dc", + "\u20e1", + "\u302a" - "\u302f", + "\u3099", + "\u309a" + ] > + | < #DIGIT : [ + "\u0030" - "\u0039", + "\u0660" - "\u0669", + "\u06f0" - "\u06f9", + "\u0966" - "\u096f", + "\u09e6" - "\u09ef", + "\u0a66" - "\u0a6f", + "\u0ae6" - "\u0aef", + "\u0b66" - "\u0b6f", + "\u0be7" - "\u0bef", + "\u0c66" - "\u0c6f", + "\u0ce6" - "\u0cef", + "\u0d66" - "\u0d6f", + "\u0e50" - "\u0e59", + "\u0ed0" - "\u0ed9", + "\u0f20" - "\u0f29" + ] > + | < #EXTENDER : [ + "\u00b7", + "\u02d0", + "\u02d1", + "\u0387", + "\u0640", + "\u0e46", + "\u0ec6", + "\u3005", + "\u3031" - "\u3035", + "\u309d" - "\u309e", + "\u30fc" - "\u30fe" + ] > + | < #NMSTART : ( | "_") > + | < #NMCHAR : ( | | | | "." | "-" | "_") > + | < #NCNAME: ()* > +} + +TOKEN : +{ + < IDENTIFIER: > + | < ESCAPED_IDENTIFIER: "\\" > + | < PREFIX_STAR: ":*" > + | < PREFIXED_NAME: ":" > + | < LITERAL : ("\"" (~["\u0000", "\""])* "\"") + | ("'" (~["\u0000", "'"])* "'") + | ("\"\"\"" (~["\""] + | ("\"" ~["\""]) + | ("\"\"" ~["\""]))* "\"\"\"") + | ("'''" (~["'"] + | ("'" ~["'"]) + | ("''" ~["'"]))* "'''") > + | < FANNOTATE : ">>" > +} + +/* This avoids lexical errors from JavaCC. */ +<*> +TOKEN : +{ + < ILLEGAL_CHAR : [ "\u0000" - "\u0008", "\u000b" - "\uffff" ] > +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.java new file mode 100644 index 0000000..dc5855c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxConstants.java @@ -0,0 +1,100 @@ +/* Generated By:JavaCC: Do not edit this line. CompactSyntaxConstants.java */ +package com.thaiopensource.relaxng.parse.compact; + +public interface CompactSyntaxConstants { + + int EOF = 0; + int NEWLINE = 37; + int NOT_NEWLINE = 38; + int WS = 39; + int DOCUMENTATION = 40; + int DOCUMENTATION_CONTINUE = 41; + int SINGLE_LINE_COMMENT = 42; + int DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT = 43; + int SINGLE_LINE_COMMENT_CONTINUE = 44; + int BASE_CHAR = 45; + int IDEOGRAPHIC = 46; + int LETTER = 47; + int COMBINING_CHAR = 48; + int DIGIT = 49; + int EXTENDER = 50; + int NMSTART = 51; + int NMCHAR = 52; + int NCNAME = 53; + int IDENTIFIER = 54; + int ESCAPED_IDENTIFIER = 55; + int PREFIX_STAR = 56; + int PREFIXED_NAME = 57; + int LITERAL = 58; + int FANNOTATE = 59; + int ILLEGAL_CHAR = 60; + + int DEFAULT = 0; + int AFTER_SINGLE_LINE_COMMENT = 1; + int AFTER_DOCUMENTATION = 2; + + String[] tokenImage = { + "", + "\"[\"", + "\"=\"", + "\"&=\"", + "\"|=\"", + "\"start\"", + "\"div\"", + "\"include\"", + "\"~\"", + "\"]\"", + "\"grammar\"", + "\"{\"", + "\"}\"", + "\"namespace\"", + "\"default\"", + "\"inherit\"", + "\"datatypes\"", + "\"empty\"", + "\"text\"", + "\"notAllowed\"", + "\"|\"", + "\"&\"", + "\",\"", + "\"+\"", + "\"?\"", + "\"*\"", + "\"element\"", + "\"attribute\"", + "\"(\"", + "\")\"", + "\"-\"", + "\"list\"", + "\"mixed\"", + "\"external\"", + "\"parent\"", + "\"string\"", + "\"token\"", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\">>\"", + "", + }; + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java new file mode 100644 index 0000000..09572ef --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java @@ -0,0 +1,1803 @@ +/* Generated By:JavaCC: Do not edit this line. CompactSyntaxTokenManager.java */ +package com.thaiopensource.relaxng.parse.compact; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.Context; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import com.thaiopensource.util.Localizer; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; +import java.util.Hashtable; +import java.util.Enumeration; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; + +public class CompactSyntaxTokenManager implements CompactSyntaxConstants +{ +private final int jjStopStringLiteralDfa_0(int pos, long active0) +{ + switch (pos) + { + case 0: + if ((active0 & 0x1f8c0fe4e0L) != 0L) + { + jjmatchedKind = 54; + return 43; + } + if ((active0 & 0x800000000000000L) != 0L) + { + jjmatchedKind = 60; + return -1; + } + return -1; + case 1: + if ((active0 & 0x1f8c0fe4e0L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 1; + return 43; + } + if ((active0 & 0x800000000000000L) != 0L) + { + if (jjmatchedPos == 0) + { + jjmatchedKind = 60; + jjmatchedPos = 0; + } + return -1; + } + return -1; + case 2: + if ((active0 & 0x1f8c0fe4a0L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 2; + return 43; + } + if ((active0 & 0x40L) != 0L) + return 43; + return -1; + case 3: + if ((active0 & 0x1f0c0be4a0L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 3; + return 43; + } + if ((active0 & 0x80040000L) != 0L) + return 43; + return -1; + case 4: + if ((active0 & 0xe0c09e480L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 4; + return 43; + } + if ((active0 & 0x1100020020L) != 0L) + return 43; + return -1; + case 5: + if ((active0 & 0x20c09e480L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 5; + return 43; + } + if ((active0 & 0xc00000000L) != 0L) + return 43; + return -1; + case 6: + if ((active0 & 0x208092000L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 6; + return 43; + } + if ((active0 & 0x400c480L) != 0L) + return 43; + return -1; + case 7: + if ((active0 & 0x8092000L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 7; + return 43; + } + if ((active0 & 0x200000000L) != 0L) + return 43; + return -1; + case 8: + if ((active0 & 0x80000L) != 0L) + { + jjmatchedKind = 54; + jjmatchedPos = 8; + return 43; + } + if ((active0 & 0x8012000L) != 0L) + return 43; + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); +} +private final int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private final int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(EOFException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +private final int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 38: + jjmatchedKind = 21; + return jjMoveStringLiteralDfa1_0(0x8L); + case 40: + return jjStopAtPos(0, 28); + case 41: + return jjStopAtPos(0, 29); + case 42: + return jjStopAtPos(0, 25); + case 43: + return jjStopAtPos(0, 23); + case 44: + return jjStopAtPos(0, 22); + case 45: + return jjStopAtPos(0, 30); + case 61: + return jjStopAtPos(0, 2); + case 62: + return jjMoveStringLiteralDfa1_0(0x800000000000000L); + case 63: + return jjStopAtPos(0, 24); + case 91: + return jjStopAtPos(0, 1); + case 93: + return jjStopAtPos(0, 9); + case 97: + return jjMoveStringLiteralDfa1_0(0x8000000L); + case 100: + return jjMoveStringLiteralDfa1_0(0x14040L); + case 101: + return jjMoveStringLiteralDfa1_0(0x204020000L); + case 103: + return jjMoveStringLiteralDfa1_0(0x400L); + case 105: + return jjMoveStringLiteralDfa1_0(0x8080L); + case 108: + return jjMoveStringLiteralDfa1_0(0x80000000L); + case 109: + return jjMoveStringLiteralDfa1_0(0x100000000L); + case 110: + return jjMoveStringLiteralDfa1_0(0x82000L); + case 112: + return jjMoveStringLiteralDfa1_0(0x400000000L); + case 115: + return jjMoveStringLiteralDfa1_0(0x800000020L); + case 116: + return jjMoveStringLiteralDfa1_0(0x1000040000L); + case 123: + return jjStopAtPos(0, 11); + case 124: + jjmatchedKind = 20; + return jjMoveStringLiteralDfa1_0(0x10L); + case 125: + return jjStopAtPos(0, 12); + case 126: + return jjStopAtPos(0, 8); + default : + return jjMoveNfa_0(3, 0); + } +} +private final int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(0, active0); + return 1; + } + switch(curChar) + { + case 61: + if ((active0 & 0x8L) != 0L) + return jjStopAtPos(1, 3); + else if ((active0 & 0x10L) != 0L) + return jjStopAtPos(1, 4); + break; + case 62: + if ((active0 & 0x800000000000000L) != 0L) + return jjStopAtPos(1, 59); + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x400012000L); + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x44000L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x180000040L); + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); + case 109: + return jjMoveStringLiteralDfa2_0(active0, 0x20000L); + case 110: + return jjMoveStringLiteralDfa2_0(active0, 0x8080L); + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x1000080000L); + case 114: + return jjMoveStringLiteralDfa2_0(active0, 0x400L); + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x808000020L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x200000000L); + default : + break; + } + return jjStartNfa_0(0, active0); +} +private final int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(0, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(1, active0); + return 2; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x420L); + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x4000000L); + case 102: + return jjMoveStringLiteralDfa3_0(active0, 0x4000L); + case 104: + return jjMoveStringLiteralDfa3_0(active0, 0x8000L); + case 107: + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000L); + case 109: + return jjMoveStringLiteralDfa3_0(active0, 0x2000L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x20000L); + case 114: + return jjMoveStringLiteralDfa3_0(active0, 0xc00000000L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x80000000L); + case 116: + return jjMoveStringLiteralDfa3_0(active0, 0x208090000L); + case 118: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(2, 6, 43); + break; + case 120: + return jjMoveStringLiteralDfa3_0(active0, 0x100040000L); + default : + break; + } + return jjStartNfa_0(1, active0); +} +private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(1, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(2, active0); + return 3; + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa4_0(active0, 0x80000L); + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x14000L); + case 101: + return jjMoveStringLiteralDfa4_0(active0, 0x170000a000L); + case 105: + return jjMoveStringLiteralDfa4_0(active0, 0x800000000L); + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x80L); + case 109: + return jjMoveStringLiteralDfa4_0(active0, 0x4000400L); + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x8000020L); + case 116: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(3, 18, 43); + else if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(3, 31, 43); + return jjMoveStringLiteralDfa4_0(active0, 0x20000L); + default : + break; + } + return jjStartNfa_0(2, active0); +} +private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(2, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(3, active0); + return 4; + } + switch(curChar) + { + case 100: + if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(4, 32, 43); + break; + case 101: + return jjMoveStringLiteralDfa5_0(active0, 0x4000000L); + case 105: + return jjMoveStringLiteralDfa5_0(active0, 0x8000000L); + case 108: + return jjMoveStringLiteralDfa5_0(active0, 0x80000L); + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x400L); + case 110: + if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(4, 36, 43); + return jjMoveStringLiteralDfa5_0(active0, 0xc00000000L); + case 114: + return jjMoveStringLiteralDfa5_0(active0, 0x200008000L); + case 115: + return jjMoveStringLiteralDfa5_0(active0, 0x2000L); + case 116: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(4, 5, 43); + return jjMoveStringLiteralDfa5_0(active0, 0x10000L); + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x4080L); + case 121: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(4, 17, 43); + break; + default : + break; + } + return jjStartNfa_0(3, active0); +} +private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(3, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(4, active0); + return 5; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x400L); + case 98: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000L); + case 100: + return jjMoveStringLiteralDfa6_0(active0, 0x80L); + case 103: + if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_0(5, 35, 43); + break; + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x8000L); + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x84000L); + case 110: + return jjMoveStringLiteralDfa6_0(active0, 0x204000000L); + case 112: + return jjMoveStringLiteralDfa6_0(active0, 0x2000L); + case 116: + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(5, 34, 43); + break; + case 121: + return jjMoveStringLiteralDfa6_0(active0, 0x10000L); + default : + break; + } + return jjStartNfa_0(4, active0); +} +private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(4, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(5, active0); + return 6; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x200002000L); + case 101: + if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(6, 7, 43); + break; + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x80000L); + case 112: + return jjMoveStringLiteralDfa7_0(active0, 0x10000L); + case 114: + if ((active0 & 0x400L) != 0L) + return jjStartNfaWithStates_0(6, 10, 43); + break; + case 116: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(6, 14, 43); + else if ((active0 & 0x8000L) != 0L) + return jjStartNfaWithStates_0(6, 15, 43); + else if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(6, 26, 43); + break; + case 117: + return jjMoveStringLiteralDfa7_0(active0, 0x8000000L); + default : + break; + } + return jjStartNfa_0(5, active0); +} +private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(5, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(6, active0); + return 7; + } + switch(curChar) + { + case 99: + return jjMoveStringLiteralDfa8_0(active0, 0x2000L); + case 101: + return jjMoveStringLiteralDfa8_0(active0, 0x10000L); + case 108: + if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(7, 33, 43); + break; + case 116: + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L); + case 119: + return jjMoveStringLiteralDfa8_0(active0, 0x80000L); + default : + break; + } + return jjStartNfa_0(6, active0); +} +private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(6, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(7, active0); + return 8; + } + switch(curChar) + { + case 101: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(8, 13, 43); + else if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(8, 27, 43); + return jjMoveStringLiteralDfa9_0(active0, 0x80000L); + case 115: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(8, 16, 43); + break; + default : + break; + } + return jjStartNfa_0(7, active0); +} +private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(7, old0); + try { curChar = input_stream.readChar(); } + catch(EOFException e) { + jjStopStringLiteralDfa_0(8, active0); + return 9; + } + switch(curChar) + { + case 100: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(9, 19, 43); + break; + default : + break; + } + return jjStartNfa_0(8, active0); +} +private final void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private final void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private final void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} +private final void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} +private final void jjCheckNAddStates(int start) +{ + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); +} +static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { + 0x0L, 0xffffffffffffc000L, 0xfffff0007fffffffL, 0x7fffffL +}; +static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec5 = { + 0x7ff3ffffffffffffL, 0x7ffffffffffffdfeL, 0xffffffffffffffffL, 0xfc31ffffffffe00fL +}; +static final long[] jjbitVec6 = { + 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x3L +}; +static final long[] jjbitVec7 = { + 0x0L, 0x0L, 0xfffffffbffffd740L, 0xffffd547f7fffL +}; +static final long[] jjbitVec8 = { + 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff0003L, 0x33fcfffffff199fL +}; +static final long[] jjbitVec9 = { + 0xfffe000000000000L, 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L +}; +static final long[] jjbitVec10 = { + 0x7fffffe00000000L, 0xfffe0000000007feL, 0x7cffffffffffffffL, 0x60002f7fffL +}; +static final long[] jjbitVec11 = { + 0x23ffffffffffffe0L, 0x3ff000000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L +}; +static final long[] jjbitVec12 = { + 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100000000L +}; +static final long[] jjbitVec13 = { + 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L +}; +static final long[] jjbitVec14 = { + 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L +}; +static final long[] jjbitVec15 = { + 0x3fffdfffffddfe0L, 0x300000000L, 0x0L, 0x0L +}; +static final long[] jjbitVec16 = { + 0xd7ffffffffffeL, 0x3fL, 0x200d6caefef02596L, 0x1fL +}; +static final long[] jjbitVec17 = { + 0x0L, 0x3fffffffeffL, 0x0L, 0x0L +}; +static final long[] jjbitVec18 = { + 0x0L, 0x0L, 0xffffffff00000000L, 0x7fffffffff003fL +}; +static final long[] jjbitVec19 = { + 0x500000000007daedL, 0x2c62ab82315001L, 0xf580c90040000000L, 0x201080000000007L +}; +static final long[] jjbitVec20 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL +}; +static final long[] jjbitVec21 = { + 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL +}; +static final long[] jjbitVec22 = { + 0x4c4000000000L, 0x0L, 0x7L, 0x0L +}; +static final long[] jjbitVec23 = { + 0x3fe00000080L, 0xfffffffffffffffeL, 0xfffffffe001fffffL, 0x7ffffffffffffffL +}; +static final long[] jjbitVec24 = { + 0x1fffffffffe0L, 0x0L, 0x0L, 0x0L +}; +static final long[] jjbitVec25 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L +}; +static final long[] jjbitVec26 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L +}; +static final long[] jjbitVec27 = { + 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec28 = { + 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x30003L +}; +static final long[] jjbitVec29 = { + 0xffffffffffffffffL, 0x30000003fL, 0xfffffffbffffd7c0L, 0xffffd547f7fffL +}; +static final long[] jjbitVec30 = { + 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff007bL, 0x33fcfffffff199fL +}; +static final long[] jjbitVec31 = { + 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe007fL, 0x707ffffff0016L +}; +static final long[] jjbitVec32 = { + 0x7fffffe00000000L, 0xffff03ff0007ffffL, 0x7cffffffffffffffL, 0x3ff3dffffef7fffL +}; +static final long[] jjbitVec33 = { + 0xf3ffffffffffffeeL, 0xffcfff1e3fffL, 0xd3c5fdfffff99feeL, 0x3ffcfb080399fL +}; +static final long[] jjbitVec34 = { + 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100003bbfL +}; +static final long[] jjbitVec35 = { + 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L +}; +static final long[] jjbitVec36 = { + 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL +}; +static final long[] jjbitVec37 = { + 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x0L, 0x0L +}; +static final long[] jjbitVec38 = { + 0x7ff7ffffffffffeL, 0x3ff7fffL, 0x3bff6caefef02596L, 0x3ff3f5fL +}; +static final long[] jjbitVec39 = { + 0xc2a003ff03000000L, 0xfffe03fffffffeffL, 0x2fe3ffffebf0fdfL, 0x0L +}; +static final long[] jjbitVec40 = { + 0x0L, 0x0L, 0x0L, 0x21fff0000L +}; +static final long[] jjbitVec41 = { + 0x3efffe000000a0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x77ffffffffffffffL +}; +private final int jjMoveNfa_0(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 43; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 3: + if ((0xfffffffffffff9ffL & l) != 0L) + { + if (kind > 60) + kind = 60; + } + if ((0x100000601L & l) != 0L) + { + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + } + else if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 31; + else if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 22; + else if (curChar == 35) + { + if (kind > 42) + kind = 42; + jjCheckNAdd(5); + } + if (curChar == 39) + jjCheckNAddTwoStates(13, 14); + else if (curChar == 34) + jjCheckNAddTwoStates(10, 11); + else if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 43: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(39, 40); + else if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 41; + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(36, 38); + else if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 37; + if ((0x3ff600000000000L & l) != 0L) + { + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + } + break; + case 0: + if ((0x100000601L & l) == 0L) + break; + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + break; + case 1: + if (curChar != 35) + break; + if (kind > 40) + kind = 40; + jjCheckNAdd(2); + break; + case 2: + if ((0xfffffffffffffbfeL & l) == 0L) + break; + if (kind > 40) + kind = 40; + jjCheckNAdd(2); + break; + case 4: + if (curChar != 35) + break; + if (kind > 42) + kind = 42; + jjCheckNAdd(5); + break; + case 5: + if ((0xfffffffffffffbfeL & l) == 0L) + break; + if (kind > 42) + kind = 42; + jjCheckNAdd(5); + break; + case 8: + if ((0x3ff600000000000L & l) == 0L) + break; + if (kind > 55) + kind = 55; + jjstateSet[jjnewStateCnt++] = 8; + break; + case 9: + if (curChar == 34) + jjCheckNAddTwoStates(10, 11); + break; + case 10: + if ((0xfffffffbfffffffeL & l) != 0L) + jjCheckNAddTwoStates(10, 11); + break; + case 11: + case 20: + if (curChar == 34 && kind > 58) + kind = 58; + break; + case 12: + if (curChar == 39) + jjCheckNAddTwoStates(13, 14); + break; + case 13: + if ((0xffffff7ffffffffeL & l) != 0L) + jjCheckNAddTwoStates(13, 14); + break; + case 14: + case 29: + if (curChar == 39 && kind > 58) + kind = 58; + break; + case 15: + if (curChar == 34) + jjCheckNAddStates(0, 2); + break; + case 16: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(0, 2); + break; + case 17: + case 19: + if (curChar == 34) + jjCheckNAdd(16); + break; + case 18: + if (curChar == 34) + jjAddStates(3, 4); + break; + case 21: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 23: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 39) + jjCheckNAddStates(5, 7); + break; + case 25: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(5, 7); + break; + case 26: + case 28: + if (curChar == 39) + jjCheckNAdd(25); + break; + case 27: + if (curChar == 39) + jjAddStates(8, 9); + break; + case 30: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 29; + break; + case 31: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 32: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 31; + break; + case 33: + if ((0xfffffffffffff9ffL & l) != 0L && kind > 60) + kind = 60; + break; + case 35: + if ((0x3ff600000000000L & l) == 0L) + break; + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + break; + case 36: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(36, 38); + break; + case 37: + if (curChar == 42 && kind > 56) + kind = 56; + break; + case 38: + if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 37; + break; + case 39: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(39, 40); + break; + case 40: + if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 41; + break; + case 42: + if ((0x3ff600000000000L & l) == 0L) + break; + if (kind > 57) + kind = 57; + jjstateSet[jjnewStateCnt++] = 42; + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 3: + if (kind > 60) + kind = 60; + if ((0x7fffffe87fffffeL & l) != 0L) + { + if (kind > 54) + kind = 54; + jjCheckNAddStates(10, 14); + } + else if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 43: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(39, 40); + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(36, 38); + if ((0x7fffffe87fffffeL & l) != 0L) + { + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + } + break; + case 2: + if (kind > 40) + kind = 40; + jjstateSet[jjnewStateCnt++] = 2; + break; + case 5: + if (kind > 42) + kind = 42; + jjstateSet[jjnewStateCnt++] = 5; + break; + case 6: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 7: + case 8: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 55) + kind = 55; + jjCheckNAdd(8); + break; + case 10: + jjAddStates(15, 16); + break; + case 13: + jjAddStates(17, 18); + break; + case 16: + jjAddStates(0, 2); + break; + case 25: + jjAddStates(5, 7); + break; + case 33: + if (kind > 60) + kind = 60; + break; + case 34: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 54) + kind = 54; + jjCheckNAddStates(10, 14); + break; + case 35: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + break; + case 36: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(36, 38); + break; + case 39: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(39, 40); + break; + case 41: + case 42: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 57) + kind = 57; + jjCheckNAdd(42); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 3: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + { + if (kind > 60) + kind = 60; + } + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) + { + if (kind > 54) + kind = 54; + jjCheckNAddStates(10, 14); + } + break; + case 43: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + { + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + } + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(36, 38); + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(39, 40); + break; + case 2: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 40) + kind = 40; + jjstateSet[jjnewStateCnt++] = 2; + break; + case 5: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 42) + kind = 42; + jjstateSet[jjnewStateCnt++] = 5; + break; + case 7: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 55) + kind = 55; + jjCheckNAdd(8); + break; + case 8: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 55) + kind = 55; + jjCheckNAdd(8); + break; + case 10: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(15, 16); + break; + case 13: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(17, 18); + break; + case 16: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(0, 2); + break; + case 25: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(5, 7); + break; + case 33: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 60) + kind = 60; + break; + case 34: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 54) + kind = 54; + jjCheckNAddStates(10, 14); + break; + case 35: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 54) + kind = 54; + jjCheckNAdd(35); + break; + case 36: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(36, 38); + break; + case 39: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(39, 40); + break; + case 41: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 57) + kind = 57; + jjCheckNAdd(42); + break; + case 42: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 57) + kind = 57; + jjCheckNAdd(42); + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 43 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(EOFException e) { return curPos; } + } +} +private final int jjMoveStringLiteralDfa0_1() +{ + return jjMoveNfa_1(1, 0); +} +private final int jjMoveNfa_1(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 10; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if ((0xfffffffffffff9ffL & l) != 0L) + { + if (kind > 60) + kind = 60; + } + if ((0x100000601L & l) != 0L) + { + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + } + if ((0x401L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 0: + if ((0x100000601L & l) == 0L) + break; + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + break; + case 2: + if ((0x401L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 3: + if ((0x100000200L & l) != 0L) + jjCheckNAddTwoStates(3, 6); + break; + case 4: + if (curChar != 35) + break; + if (kind > 43) + kind = 43; + jjCheckNAdd(5); + break; + case 5: + if ((0xfffffffffffffbfeL & l) == 0L) + break; + if (kind > 43) + kind = 43; + jjCheckNAdd(5); + break; + case 6: + if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 7: + if ((0x100000200L & l) != 0L) + jjCheckNAddTwoStates(7, 8); + break; + case 8: + if (curChar != 35) + break; + if (kind > 44) + kind = 44; + jjCheckNAdd(9); + break; + case 9: + if ((0xfffffffffffffbfeL & l) == 0L) + break; + if (kind > 44) + kind = 44; + jjCheckNAdd(9); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if (kind > 60) + kind = 60; + break; + case 5: + if (kind > 43) + kind = 43; + jjstateSet[jjnewStateCnt++] = 5; + break; + case 9: + if (kind > 44) + kind = 44; + jjstateSet[jjnewStateCnt++] = 9; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 60) + kind = 60; + break; + case 5: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 43) + kind = 43; + jjstateSet[jjnewStateCnt++] = 5; + break; + case 9: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 44) + kind = 44; + jjstateSet[jjnewStateCnt++] = 9; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 10 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(EOFException e) { return curPos; } + } +} +private final int jjMoveStringLiteralDfa0_2() +{ + return jjMoveNfa_2(1, 0); +} +private final int jjMoveNfa_2(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 7; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if ((0xfffffffffffff9ffL & l) != 0L) + { + if (kind > 60) + kind = 60; + } + if ((0x100000601L & l) != 0L) + { + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + } + if ((0x401L & l) != 0L) + jjCheckNAddTwoStates(2, 5); + break; + case 0: + if ((0x100000601L & l) == 0L) + break; + if (kind > 39) + kind = 39; + jjCheckNAdd(0); + break; + case 2: + if ((0x100000200L & l) != 0L) + jjCheckNAddTwoStates(2, 5); + break; + case 3: + if (curChar != 35) + break; + if (kind > 41) + kind = 41; + jjCheckNAdd(4); + break; + case 4: + if ((0xfffffffffffffbfeL & l) == 0L) + break; + if (kind > 41) + kind = 41; + jjCheckNAdd(4); + break; + case 5: + if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 3; + break; + case 6: + if ((0xfffffffffffff9ffL & l) != 0L && kind > 60) + kind = 60; + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if (kind > 60) + kind = 60; + break; + case 4: + if (kind > 41) + kind = 41; + jjstateSet[jjnewStateCnt++] = 4; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 60) + kind = 60; + break; + case 4: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 41) + kind = 41; + jjstateSet[jjnewStateCnt++] = 4; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(EOFException e) { return curPos; } + } +} +static final int[] jjnextStates = { + 16, 17, 18, 19, 21, 25, 26, 27, 28, 30, 35, 36, 38, 39, 40, 10, + 11, 13, 14, 3, 6, 7, 8, +}; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 1: + return ((jjbitVec5[i2] & l2) != 0L); + case 2: + return ((jjbitVec6[i2] & l2) != 0L); + case 3: + return ((jjbitVec7[i2] & l2) != 0L); + case 4: + return ((jjbitVec8[i2] & l2) != 0L); + case 5: + return ((jjbitVec9[i2] & l2) != 0L); + case 6: + return ((jjbitVec10[i2] & l2) != 0L); + case 9: + return ((jjbitVec11[i2] & l2) != 0L); + case 10: + return ((jjbitVec12[i2] & l2) != 0L); + case 11: + return ((jjbitVec13[i2] & l2) != 0L); + case 12: + return ((jjbitVec14[i2] & l2) != 0L); + case 13: + return ((jjbitVec15[i2] & l2) != 0L); + case 14: + return ((jjbitVec16[i2] & l2) != 0L); + case 15: + return ((jjbitVec17[i2] & l2) != 0L); + case 16: + return ((jjbitVec18[i2] & l2) != 0L); + case 17: + return ((jjbitVec19[i2] & l2) != 0L); + case 30: + return ((jjbitVec20[i2] & l2) != 0L); + case 31: + return ((jjbitVec21[i2] & l2) != 0L); + case 33: + return ((jjbitVec22[i2] & l2) != 0L); + case 48: + return ((jjbitVec23[i2] & l2) != 0L); + case 49: + return ((jjbitVec24[i2] & l2) != 0L); + case 159: + return ((jjbitVec25[i2] & l2) != 0L); + case 215: + return ((jjbitVec26[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec27[i2] & l2) != 0L); + case 1: + return ((jjbitVec5[i2] & l2) != 0L); + case 2: + return ((jjbitVec28[i2] & l2) != 0L); + case 3: + return ((jjbitVec29[i2] & l2) != 0L); + case 4: + return ((jjbitVec30[i2] & l2) != 0L); + case 5: + return ((jjbitVec31[i2] & l2) != 0L); + case 6: + return ((jjbitVec32[i2] & l2) != 0L); + case 9: + return ((jjbitVec33[i2] & l2) != 0L); + case 10: + return ((jjbitVec34[i2] & l2) != 0L); + case 11: + return ((jjbitVec35[i2] & l2) != 0L); + case 12: + return ((jjbitVec36[i2] & l2) != 0L); + case 13: + return ((jjbitVec37[i2] & l2) != 0L); + case 14: + return ((jjbitVec38[i2] & l2) != 0L); + case 15: + return ((jjbitVec39[i2] & l2) != 0L); + case 16: + return ((jjbitVec18[i2] & l2) != 0L); + case 17: + return ((jjbitVec19[i2] & l2) != 0L); + case 30: + return ((jjbitVec20[i2] & l2) != 0L); + case 31: + return ((jjbitVec21[i2] & l2) != 0L); + case 32: + return ((jjbitVec40[i2] & l2) != 0L); + case 33: + return ((jjbitVec22[i2] & l2) != 0L); + case 48: + return ((jjbitVec41[i2] & l2) != 0L); + case 49: + return ((jjbitVec24[i2] & l2) != 0L); + case 159: + return ((jjbitVec25[i2] & l2) != 0L); + case 215: + return ((jjbitVec26[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +public static final String[] jjstrLiteralImages = { +"", "\133", "\75", "\46\75", "\174\75", "\163\164\141\162\164", +"\144\151\166", "\151\156\143\154\165\144\145", "\176", "\135", +"\147\162\141\155\155\141\162", "\173", "\175", "\156\141\155\145\163\160\141\143\145", +"\144\145\146\141\165\154\164", "\151\156\150\145\162\151\164", "\144\141\164\141\164\171\160\145\163", +"\145\155\160\164\171", "\164\145\170\164", "\156\157\164\101\154\154\157\167\145\144", "\174", "\46", +"\54", "\53", "\77", "\52", "\145\154\145\155\145\156\164", +"\141\164\164\162\151\142\165\164\145", "\50", "\51", "\55", "\154\151\163\164", "\155\151\170\145\144", +"\145\170\164\145\162\156\141\154", "\160\141\162\145\156\164", "\163\164\162\151\156\147", +"\164\157\153\145\156", null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, "\76\76", null, }; +public static final String[] lexStateNames = { + "DEFAULT", + "AFTER_SINGLE_LINE_COMMENT", + "AFTER_DOCUMENTATION", +}; +public static final int[] jjnewLexState = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2, -1, 1, 2, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; +static final long[] jjtoToken = { + 0x1fc00b1fffffffffL, +}; +static final long[] jjtoSkip = { + 0x148000000000L, +}; +static final long[] jjtoSpecial = { + 0x140000000000L, +}; +private UCode_UCodeESC_CharStream input_stream; +private final int[] jjrounds = new int[43]; +private final int[] jjstateSet = new int[86]; +StringBuffer image; +int jjimageLen; +int lengthOfMatch; +protected char curChar; +public CompactSyntaxTokenManager(UCode_UCodeESC_CharStream stream) +{ + if (UCode_UCodeESC_CharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} +public CompactSyntaxTokenManager(UCode_UCodeESC_CharStream stream, int lexState) +{ + this(stream); + SwitchTo(lexState); +} +public void ReInit(UCode_UCodeESC_CharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private final void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 43; i-- > 0;) + jjrounds[i] = 0x80000000; +} +public void ReInit(UCode_UCodeESC_CharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} +public void SwitchTo(int lexState) +{ + if (lexState >= 3 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +private final Token jjFillToken() +{ + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +public final Token getNextToken() +{ + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(EOFException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + return matchedToken; + } + image = null; + jjimageLen = 0; + + switch(curLexState) + { + case 0: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + break; + case 1: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + break; + } + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } + else + { + if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + if (specialToken == null) + specialToken = matchedToken; + else + { + matchedToken.specialToken = specialToken; + specialToken = (specialToken.next = matchedToken); + } + SkipLexicalActions(matchedToken); + } + else + SkipLexicalActions(null); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (EOFException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +final void SkipLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + default : + break; + } +} +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EOFException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EOFException.java new file mode 100644 index 0000000..c374146 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EOFException.java @@ -0,0 +1,4 @@ +package com.thaiopensource.relaxng.parse.compact; + +class EOFException extends Exception { +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.java new file mode 100644 index 0000000..78f0b29 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/EscapeSyntaxException.java @@ -0,0 +1,25 @@ +package com.thaiopensource.relaxng.parse.compact; + +class EscapeSyntaxException extends RuntimeException { + private final String key; + private final int lineNumber; + private final int columnNumber; + + EscapeSyntaxException(String key, int lineNumber, int columnNumber) { + this.key = key; + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; + } + + String getKey() { + return key; + } + + int getLineNumber() { + return lineNumber; + } + + int getColumnNumber() { + return columnNumber; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/ParseException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/ParseException.java new file mode 100644 index 0000000..9c5ba9b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/ParseException.java @@ -0,0 +1,191 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */ +package com.thaiopensource.relaxng.parse.compact; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. The boolean + * flag "specialConstructor" is also set to true to indicate that + * this constructor was used to create this object. + * This constructor calls its super class with the empty string + * to force the "toString" method of parent class "Throwable" to + * print the error message in the form: + * ParseException: + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(""); + specialConstructor = true; + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + specialConstructor = false; + } + + public ParseException(String message) { + super(message); + specialConstructor = false; + } + + /** + * This variable determines which constructor was used to create + * this object and thereby affects the semantics of the + * "getMessage" method (see below). + */ + protected boolean specialConstructor; + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * This method has the standard behavior when this object has been + * created using the standard constructors. Otherwise, it uses + * "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser), then this method is called during the printing + * of the final stack trace, and hence the correct error message + * gets displayed. + */ + public String getMessage() { + if (!specialConstructor) { + return super.getMessage(); + } + String expected = ""; + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected += tokenImage[expectedTokenSequences[i][j]] + " "; + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected += "..."; + } + expected += eol + " "; + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += add_escapes(tok.image); + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected; + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + protected String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/Token.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/Token.java new file mode 100644 index 0000000..b5fad5b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/Token.java @@ -0,0 +1,81 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */ +package com.thaiopensource.relaxng.parse.compact; + +/** + * Describes the input token stream. + */ + +public class Token { + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * beginLine and beginColumn describe the position of the first character + * of this token; endLine and endColumn describe the position of the + * last character of this token. + */ + public int beginLine, beginColumn, endLine, endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * Returns the image. + */ + public final String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simlpy add something like : + * + * case MyParserConstants.ID : return new IDToken(); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use it in your lexical actions. + */ + public static final Token newToken(int ofKind) + { + switch(ofKind) + { + default : return new Token(); + } + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/TokenMgrError.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/TokenMgrError.java new file mode 100644 index 0000000..9556bff --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/TokenMgrError.java @@ -0,0 +1,133 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */ +package com.thaiopensource.relaxng.parse.compact; + +public class TokenMgrError extends Error +{ + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occured. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt wass made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexicl error + * curLexState : lexical state in which this error occured + * errorLine : line number when the error occured + * errorColumn : column number when the error occured + * errorAfter : prefix that was seen before this error occured + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.java new file mode 100644 index 0000000..6b3d8d1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/UCode_UCodeESC_CharStream.java @@ -0,0 +1,549 @@ +/* Generated By:JavaCC: Do not edit this line. UCode_UCodeESC_CharStream.java Version 0.7pre6 */ +/* The previous line keeps JavaCC quiet. In fact, the JavaCC generated file + has been edited to fix some bugs. */ +package com.thaiopensource.relaxng.parse.compact; + +import com.thaiopensource.util.Utf16; +import com.thaiopensource.relaxng.parse.BuildException; + +import java.io.IOException; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain 16-bit unicode characters. + */ +public final class UCode_UCodeESC_CharStream { + public static final boolean staticFlag = false; + + static final int hexval(char c) { + switch (c) { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + + case 'a': + case 'A': + return 10; + case 'b': + case 'B': + return 11; + case 'c': + case 'C': + return 12; + case 'd': + case 'D': + return 13; + case 'e': + case 'E': + return 14; + case 'f': + case 'F': + return 15; + } + return -1; + } + + public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + private int bufline[]; + private int bufcolumn[]; + + private int column = 0; + private int line = 1; + + private java.io.Reader inputStream; + private boolean closed = false; + + private boolean prevCharIsLF = false; + + private char[] nextCharBuf; + private char[] buffer; + private int maxNextCharInd = 0; + private int nextCharInd = -1; + private int inBuf = 0; + + private final void ExpandBuff(boolean wrapAround) { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + if (wrapAround) { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } + else { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + private final void FillBuff() throws EOFException { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + if (closed) + throw new EOFException(); + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { + closed = true; + inputStream.close(); + throw new EOFException(); + } + else + maxNextCharInd += i; + } + catch (IOException e) { + throw new BuildException(e); + } + } + + private final char ReadChar() throws EOFException { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + + private final char PeekChar() throws EOFException { + char c = ReadChar(); + --nextCharInd; + return c; + } + + public final char BeginToken() throws EOFException { + if (inBuf > 0) { + --inBuf; + return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0) + : ++bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + private final void AdjustBuffSize() { + if (available == bufsize) { + if (tokenBegin > 2048) { + bufpos = 0; + available = tokenBegin; + } + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + private final void UpdateLineColumn(char c) { + column++; + + if (prevCharIsLF) { + prevCharIsLF = false; + line += (column = 1); + } + + switch (c) { + case NEWLINE_MARKER: + prevCharIsLF = true; + break; + case '\t': + column--; + column += (8 - (column & 07)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + private final char NEWLINE_MARKER = '\u0000'; + + public final char readChar() throws EOFException { + if (inBuf > 0) { + --inBuf; + return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; + } + + char c; + try { + c = ReadChar(); + switch (c) { + case '\r': + c = NEWLINE_MARKER; + try { + if (PeekChar() == '\n') + ReadChar(); + } + catch (EOFException e) { + } + break; + case '\n': + c = NEWLINE_MARKER; + break; + case '\t': + break; + default: + if (c >= 0x20) { + if (Utf16.isSurrogate(c)) { + if (Utf16.isSurrogate2(c)) + throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1); + if (++bufpos == available) + AdjustBuffSize(); + buffer[bufpos] = c; + // UpdateLineColumn(c); + try { + c = ReadChar(); + } + catch (EOFException e) { + throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1); + } + if (!Utf16.isSurrogate2(c)) + throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 2); + } + break; + } + // fall through + case '\uFFFE': + case '\uFFFF': + throw new EscapeSyntaxException("illegal_char_code", line, column + 1); + } + } + catch (EOFException e) { + if (bufpos == -1) { + if (++bufpos == available) + AdjustBuffSize(); + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + if (++bufpos == available) + AdjustBuffSize(); + buffer[bufpos] = c; + UpdateLineColumn(c); + try { + if (c != '\\' || PeekChar() != 'x') + return c; + } + catch (EOFException e) { + return c; + } + + int xCnt = 1; + for (;;) { + ReadChar(); + if (++bufpos == available) + AdjustBuffSize(); + buffer[bufpos] = 'x'; + UpdateLineColumn('x'); + try { + c = PeekChar(); + } + catch (EOFException e) { + backup(xCnt); + return '\\'; + } + if (c == '{') { + ReadChar(); + column++; + // backup past the 'x's + bufpos -= xCnt; + if (bufpos < 0) + bufpos += bufsize; + break; + } + if (c != 'x') { + backup(xCnt); + return '\\'; + } + xCnt++; + } + try { + int scalarValue = hexval(ReadChar()); + column++; + if (scalarValue < 0) + throw new EscapeSyntaxException("illegal_hex_digit", line, column); + while ((c = ReadChar()) != '}') { + column++; + int n = hexval(c); + if (n < 0) + throw new EscapeSyntaxException("illegal_hex_digit", line, column); + scalarValue <<= 4; + scalarValue |= n; + if (scalarValue >= 0x110000) + throw new EscapeSyntaxException("char_code_too_big", line, column); + } + column++; // for the '}' + if (scalarValue <= 0xFFFF) { + c = (char)scalarValue; + switch (c) { + case '\n': + case '\r': + case '\t': + break; + default: + if (c >= 0x20 && !Utf16.isSurrogate(c)) + break; + // fall through + case '\uFFFE': + case '\uFFFF': + throw new EscapeSyntaxException("illegal_char_code_ref", line, column); + } + buffer[bufpos] = c; + return c; + } + c = Utf16.surrogate1(scalarValue); + buffer[bufpos] = c; + int bufpos1 = bufpos; + if (++bufpos == bufsize) + bufpos = 0; + buffer[bufpos] = Utf16.surrogate2(scalarValue); + bufline[bufpos] = bufline[bufpos1]; + bufcolumn[bufpos] = bufcolumn[bufpos1]; + backup(1); + return c; + } + catch (EOFException e) { + throw new EscapeSyntaxException("incomplete_escape", line, column); + } + } + + /** + * @deprecated + * @see #getEndColumn + */ + + public final int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @deprecated + * @see #getEndLine + */ + + public final int getLine() { + return bufline[bufpos]; + } + + public final int getEndColumn() { + return bufcolumn[bufpos]; + } + + public final int getEndLine() { + return bufline[bufpos]; + } + + public final int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public final int getBeginLine() { + return bufline[tokenBegin]; + } + + public final void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public UCode_UCodeESC_CharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + skipBOM(); + } + + public UCode_UCodeESC_CharStream(java.io.Reader dstream, + int startline, int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + closed = false; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + skipBOM(); + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + static private final char BOM = '\ufeff'; + + private void skipBOM() { + try { + if (PeekChar() == BOM) + ReadChar(); + } + catch (EOFException e) { + } + } + + public final String GetImage() { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public final char[] GetSuffix(int len) { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token.
+ */ + public void adjustBeginLineColumn(int newLine, int newCol) { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) { + len = bufpos - tokenBegin + inBuf + 1; + } + else { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties new file mode 100644 index 0000000..d1007c3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/compact/resources/Messages.properties @@ -0,0 +1,22 @@ +syntax_error=syntax error +undeclared_prefix=undeclared prefix \"{0}\" +xmlns_prefix=prefix must not be \"xmlns\" +unqualified_annotation_attribute=annotation attribute must have a namespace URI +inherited_annotation_namespace=namespace URI for annotation cannot be inherited +xmlns_annotation_attribute=annotation attribute cannot be named \"xmlns\" +duplicate_attribute=multiple attributes with local name \"{0}\" and namespace URI \"{1}\" +except_missing_parentheses=parentheses required around \"-\" expression +xmlns_annotation_attribute_uri=annotation attribute cannot have namespace URI \"http://www.w3.org/2000/xmlns\" +xml_prefix_bad_uri=prefix \"xml\" can only be bound to namespace URI \"http://www.w3.org/XML/1998/namespace\" +xml_uri_bad_prefix=only prefix \"xml\" can be bound to namespace URI \"http://www.w3.org/XML/1998/namespace\" +illegal_hex_digit=expected hex digit +char_code_too_big=character code must be less than 0x110000 +illegal_char_code=code of character that is not allowed +illegal_char_code_ref=reference to character whose code is not allowed +incomplete_escape=incomplete escape sequence +any_name_except_contains_any_name=\"except\" in \"anyName\" contains \"anyName\" +ns_name_except_contains_any_name=\"except\" in \"nsName\" contains \"anyName\" +ns_name_except_contains_ns_name=\"except\" in \"nsName\" contains \"nsName\" +illegal_surrogate_pair=illegal surrogate pair +relax_ng_namespace=annotations cannot have namespace URI \"http://relaxng.org/ns/structure/1.0\" +top_level_follow_annotation=top-level pattern cannot have following annotations diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/DtdContext.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/DtdContext.java new file mode 100644 index 0000000..b6ff202 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/DtdContext.java @@ -0,0 +1,50 @@ +package com.thaiopensource.relaxng.parse.sax; + +import org.xml.sax.DTDHandler; +import org.xml.sax.SAXException; +import org.relaxng.datatype.ValidationContext; + +import java.util.Hashtable; + +public abstract class DtdContext implements DTDHandler, ValidationContext { + private final Hashtable notationTable; + private final Hashtable unparsedEntityTable; + + public DtdContext() { + notationTable = new Hashtable(); + unparsedEntityTable = new Hashtable(); + } + + public DtdContext(DtdContext dc) { + notationTable = dc.notationTable; + unparsedEntityTable = dc.unparsedEntityTable; + } + + public void notationDecl(String name, + String publicId, + String systemId) + throws SAXException { + notationTable.put(name, name); + } + + public void unparsedEntityDecl(String name, + String publicId, + String systemId, + String notationName) + throws SAXException { + unparsedEntityTable.put(name, name); + } + + public boolean isNotation(String notationName) { + return notationTable.get(notationName) != null; + } + + public boolean isUnparsedEntity(String entityName) { + return unparsedEntityTable.get(entityName) != null; + } + + public void clearDtdContext() { + notationTable.clear(); + unparsedEntityTable.clear(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.java new file mode 100644 index 0000000..12546ed --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseReceiver.java @@ -0,0 +1,21 @@ +package com.thaiopensource.relaxng.parse.sax; + +import com.thaiopensource.relaxng.parse.ParseReceiver; +import com.thaiopensource.relaxng.parse.ParsedPatternFuture; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.XMLReader; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; + +public class SAXParseReceiver extends SAXSubParser implements ParseReceiver { + public SAXParseReceiver(XMLReaderCreator xrc, ErrorHandler eh) { + super(xrc, eh); + } + + public ParsedPatternFuture installHandlers(XMLReader xr, SchemaBuilder schemaBuilder, Scope scope) + throws SAXException { + return new SchemaParser(xr, eh, schemaBuilder, null, scope); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseable.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseable.java new file mode 100644 index 0000000..00fb8ef --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXParseable.java @@ -0,0 +1,40 @@ +package com.thaiopensource.relaxng.parse.sax; + +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Scope; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; + +public class SAXParseable extends SAXSubParser implements Parseable { + private final InputSource in; + + public SAXParseable(XMLReaderCreator xrc, InputSource in, ErrorHandler eh) { + super(xrc, eh); + this.in = in; + } + + public ParsedPattern parse(SchemaBuilder schemaBuilder, Scope scope) throws BuildException, IllegalSchemaException { + try { + XMLReader xr = xrc.createXMLReader(); + SchemaParser sp = new SchemaParser(xr, eh, schemaBuilder, null, scope); + xr.parse(in); + return sp.getParsedPattern(); + } + catch (SAXException e) { + throw toBuildException(e); + } + catch (IOException e) { + throw new BuildException(e); + } + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXSubParser.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXSubParser.java new file mode 100644 index 0000000..6081121 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SAXSubParser.java @@ -0,0 +1,76 @@ +package com.thaiopensource.relaxng.parse.sax; + +import com.thaiopensource.relaxng.parse.SubParser; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.BuildException; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; + +import java.io.IOException; + +public class SAXSubParser implements SubParser { + final XMLReaderCreator xrc; + final ErrorHandler eh; + + SAXSubParser(XMLReaderCreator xrc, ErrorHandler eh) { + this.xrc = xrc; + this.eh = eh; + } + + public ParsedPattern parseInclude(String uri, SchemaBuilder schemaBuilder, IncludedGrammar g) + throws BuildException, IllegalSchemaException { + try { + XMLReader xr = xrc.createXMLReader(); + SchemaParser sp = new SchemaParser(xr, eh, schemaBuilder, g, g); + xr.parse(makeInputSource(xr, uri)); + return sp.getParsedPattern(); + } + catch (SAXException e) { + throw SAXParseable.toBuildException(e); + } + catch (IOException e) { + throw new BuildException(e); + } + } + + public ParsedPattern parseExternal(String uri, SchemaBuilder schemaBuilder, Scope s) + throws BuildException, IllegalSchemaException { + try { + XMLReader xr = xrc.createXMLReader(); + SchemaParser sp = new SchemaParser(xr, eh, schemaBuilder, null, s); + xr.parse(makeInputSource(xr, uri)); + return sp.getParsedPattern(); + } + catch (SAXException e) { + throw SAXParseable.toBuildException(e); + } + catch (IOException e) { + throw new BuildException(e); + } + } + + private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException { + EntityResolver er = xr.getEntityResolver(); + if (er != null) { + InputSource inputSource = er.resolveEntity(null, systemId); + if (inputSource != null) + return inputSource; + } + return new InputSource(systemId); + } + + static BuildException toBuildException(SAXException e) { + Exception inner = e.getException(); + if (inner instanceof BuildException) + throw (BuildException)inner; + throw new BuildException(e); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SchemaParser.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SchemaParser.java new file mode 100644 index 0000000..9ed0aaa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/SchemaParser.java @@ -0,0 +1,1615 @@ +package com.thaiopensource.relaxng.parse.sax; + +import com.thaiopensource.relaxng.parse.DataPatternBuilder; +import com.thaiopensource.relaxng.parse.Grammar; +import com.thaiopensource.relaxng.parse.GrammarSection; +import com.thaiopensource.relaxng.parse.IllegalSchemaException; +import com.thaiopensource.relaxng.parse.Include; +import com.thaiopensource.relaxng.parse.IncludedGrammar; +import com.thaiopensource.relaxng.parse.Location; +import com.thaiopensource.relaxng.parse.ParsedNameClass; +import com.thaiopensource.relaxng.parse.ParsedPattern; +import com.thaiopensource.relaxng.parse.SchemaBuilder; +import com.thaiopensource.relaxng.parse.Scope; +import com.thaiopensource.relaxng.parse.Annotations; +import com.thaiopensource.relaxng.parse.Context; +import com.thaiopensource.relaxng.parse.CommentList; +import com.thaiopensource.relaxng.parse.Div; +import com.thaiopensource.relaxng.parse.ElementAnnotationBuilder; +import com.thaiopensource.relaxng.parse.ParsedElementAnnotation; +import com.thaiopensource.relaxng.parse.ParsedPatternFuture; +import com.thaiopensource.util.Uri; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.xml.util.Naming; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import com.thaiopensource.xml.sax.XmlBaseHandler; +import com.thaiopensource.xml.sax.AbstractLexicalHandler; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.DefaultHandler; + +import java.util.Hashtable; +import java.util.Enumeration; +import java.util.Vector; +import java.util.Stack; + +class SchemaParser implements ParsedPatternFuture { + + private static final String relaxngURIPrefix = + WellKnownNamespaces.RELAX_NG.substring(0, WellKnownNamespaces.RELAX_NG.lastIndexOf('/') + 1); + static final String relaxng10URI = WellKnownNamespaces.RELAX_NG; + private static final Localizer localizer = new Localizer(SchemaParser.class); + + private String relaxngURI; + private final XMLReader xr; + private final ErrorHandler eh; + private final SchemaBuilder schemaBuilder; + private ParsedPattern startPattern; + private Locator locator; + private final XmlBaseHandler xmlBaseHandler = new XmlBaseHandler(); + private final ContextImpl context = new ContextImpl(); + + private boolean hadError = false; + + private Hashtable patternTable; + private Hashtable nameClassTable; + + static class PrefixMapping { + final String prefix; + final String uri; + final PrefixMapping next; + + PrefixMapping(String prefix, String uri, PrefixMapping next) { + this.prefix = prefix; + this.uri = uri; + this.next = next; + } + } + + static abstract class AbstractContext extends DtdContext implements Context { + PrefixMapping prefixMapping; + + AbstractContext() { + prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null); + } + + AbstractContext(AbstractContext context) { + super(context); + prefixMapping = context.prefixMapping; + } + + public String resolveNamespacePrefix(String prefix) { + for (PrefixMapping p = prefixMapping; p != null; p = p.next) + if (p.prefix.equals(prefix)) + return p.uri; + return null; + } + + public Enumeration prefixes() { + Vector v = new Vector(); + for (PrefixMapping p = prefixMapping; p != null; p = p.next) { + if (!v.contains(p.prefix)) + v.addElement(p.prefix); + } + return v.elements(); + } + + public Context copy() { + return new SavedContext(this); + } + } + + static class SavedContext extends AbstractContext { + private final String baseUri; + SavedContext(AbstractContext context) { + super(context); + this.baseUri = context.getBaseUri(); + } + + public String getBaseUri() { + return baseUri; + } + } + + class ContextImpl extends AbstractContext { + public String getBaseUri() { + return xmlBaseHandler.getBaseUri(); + } + } + + static interface CommentHandler { + void comment(String value); + } + + abstract class Handler implements ContentHandler, CommentHandler { + CommentList comments; + + CommentList getComments() { + CommentList tem = comments; + comments = null; + return tem; + } + + public void comment(String value) { + if (comments == null) + comments = schemaBuilder.makeCommentList(); + comments.addComment(value, makeLocation()); + } + public void processingInstruction(String target, String date) { } + public void skippedEntity(String name) { } + public void ignorableWhitespace(char[] ch, int start, int len) { } + public void startDocument() { } + public void endDocument() { } + public void startPrefixMapping(String prefix, String uri) { + context.prefixMapping = new PrefixMapping(prefix, uri, context.prefixMapping); + } + + public void endPrefixMapping(String prefix) { + context.prefixMapping = context.prefixMapping.next; + } + + public void setDocumentLocator(Locator loc) { + locator = loc; + xmlBaseHandler.setLocator(loc); + } + } + + abstract class State extends Handler { + State parent; + String nsInherit; + String ns; + String datatypeLibrary; + Scope scope; + Location startLocation; + Annotations annotations; + + void set() { + xr.setContentHandler(this); + } + + abstract State create(); + abstract State createChildState(String localName) throws SAXException; + + + void setParent(State parent) { + this.parent = parent; + this.nsInherit = parent.getNs(); + this.datatypeLibrary = parent.datatypeLibrary; + this.scope = parent.scope; + this.startLocation = makeLocation(); + if (parent.comments != null) { + annotations = schemaBuilder.makeAnnotations(parent.comments, getContext()); + parent.comments = null; + } + else if (parent instanceof RootState) + annotations = schemaBuilder.makeAnnotations(null, getContext()); + } + + String getNs() { + return ns == null ? nsInherit : ns; + } + + boolean isRelaxNGElement(String uri) throws SAXException { + return uri.equals(relaxngURI); + } + + public void startElement(String namespaceURI, + String localName, + String qName, + Attributes atts) throws SAXException { + xmlBaseHandler.startElement(); + if (isRelaxNGElement(namespaceURI)) { + State state = createChildState(localName); + if (state == null) { + xr.setContentHandler(new Skipper(this)); + return; + } + state.setParent(this); + state.set(); + state.attributes(atts); + } + else { + checkForeignElement(); + ForeignElementHandler feh = new ForeignElementHandler(this, getComments()); + feh.startElement(namespaceURI, localName, qName, atts); + xr.setContentHandler(feh); + } + } + + public void endElement(String namespaceURI, + String localName, + String qName) throws SAXException { + xmlBaseHandler.endElement(); + parent.set(); + end(); + } + + void setName(String name) throws SAXException { + error("illegal_name_attribute"); + } + + void setOtherAttribute(String name, String value) throws SAXException { + error("illegal_attribute_ignored", name); + } + + void endAttributes() throws SAXException { + } + + void checkForeignElement() throws SAXException { + } + + void attributes(Attributes atts) throws SAXException { + int len = atts.getLength(); + for (int i = 0; i < len; i++) { + String uri = atts.getURI(i); + if (uri.length() == 0) { + String name = atts.getLocalName(i); + if (name.equals("name")) + setName(atts.getValue(i).trim()); + else if (name.equals("ns")) + ns = atts.getValue(i); + else if (name.equals("datatypeLibrary")) { + datatypeLibrary = atts.getValue(i); + checkUri(datatypeLibrary); + if (!datatypeLibrary.equals("") + && !Uri.isAbsolute(datatypeLibrary)) + error("relative_datatype_library"); + if (Uri.hasFragmentId(datatypeLibrary)) + error("fragment_identifier_datatype_library"); + datatypeLibrary = Uri.escapeDisallowedChars(datatypeLibrary); + } + else + setOtherAttribute(name, atts.getValue(i)); + } + else if (uri.equals(relaxngURI)) + error("qualified_attribute", atts.getLocalName(i)); + else if (uri.equals(WellKnownNamespaces.XML) + && atts.getLocalName(i).equals("base")) + xmlBaseHandler.xmlBaseAttribute(atts.getValue(i)); + else { + if (annotations == null) + annotations = schemaBuilder.makeAnnotations(null, getContext()); + annotations.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri), + atts.getValue(i), startLocation); + } + } + endAttributes(); + } + + abstract void end() throws SAXException; + + void endChild(ParsedPattern pattern) { + // XXX cannot happen; throw exception + } + + void endChild(ParsedNameClass nc) { + // XXX cannot happen; throw exception + } + + public void startDocument() { } + public void endDocument() { + if (comments != null && startPattern != null) { + startPattern = schemaBuilder.commentAfter(startPattern, comments); + comments = null; + } + } + + public void characters(char[] ch, int start, int len) throws SAXException { + for (int i = 0; i < len; i++) { + switch(ch[start + i]) { + case ' ': + case '\r': + case '\n': + case '\t': + break; + default: + error("illegal_characters_ignored"); + break; + } + } + } + + boolean isPatternNamespaceURI(String s) { + return s.equals(relaxngURI); + } + + void endForeignChild(ParsedElementAnnotation ea) { + if (annotations == null) + annotations = schemaBuilder.makeAnnotations(null, getContext()); + annotations.addElement(ea); + } + + void mergeLeadingComments() { + if (comments != null) { + if (annotations == null) + annotations = schemaBuilder.makeAnnotations(comments, getContext()); + else + annotations.addLeadingComment(comments); + comments = null; + } + } + } + + class ForeignElementHandler extends Handler { + final State nextState; + ElementAnnotationBuilder builder; + final Stack builderStack = new Stack(); + StringBuffer textBuf; + Location textLoc; + + ForeignElementHandler(State nextState, CommentList comments) { + this.nextState = nextState; + this.comments = comments; + } + + public void startElement(String namespaceURI, String localName, + String qName, Attributes atts) { + flushText(); + if (builder != null) + builderStack.push(builder); + Location loc = makeLocation(); + builder = schemaBuilder.makeElementAnnotationBuilder(namespaceURI, + localName, + findPrefix(qName, namespaceURI), + loc, + getComments(), + getContext()); + int len = atts.getLength(); + for (int i = 0; i < len; i++) { + String uri = atts.getURI(i); + builder.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri), + atts.getValue(i), loc); + } + } + + public void endElement(String namespaceURI, String localName, + String qName) { + flushText(); + if (comments != null) + builder.addComment(getComments()); + ParsedElementAnnotation ea = builder.makeElementAnnotation(); + if (builderStack.empty()) { + nextState.endForeignChild(ea); + nextState.set(); + } + else { + builder = (ElementAnnotationBuilder)builderStack.pop(); + builder.addElement(ea); + } + } + + public void characters(char ch[], int start, int length) { + if (textBuf == null) + textBuf = new StringBuffer(); + textBuf.append(ch, start, length); + if (textLoc == null) + textLoc = makeLocation(); + } + + public void comment(String value) { + flushText(); + super.comment(value); + } + + void flushText() { + if (textBuf != null && textBuf.length() != 0) { + builder.addText(textBuf.toString(), textLoc, getComments()); + textBuf.setLength(0); + } + textLoc = null; + } + } + + class Skipper extends DefaultHandler implements CommentHandler { + int level = 1; + final State nextState; + + Skipper(State nextState) { + this.nextState = nextState; + } + + public void startElement(String namespaceURI, + String localName, + String qName, + Attributes atts) throws SAXException { + ++level; + } + + public void endElement(String namespaceURI, + String localName, + String qName) throws SAXException { + if (--level == 0) + nextState.set(); + } + + public void comment(String value) { + } + } + + abstract class EmptyContentState extends State { + + State createChildState(String localName) throws SAXException { + error("expected_empty", localName); + return null; + } + + abstract ParsedPattern makePattern() throws SAXException; + + void end() throws SAXException { + if (comments != null) { + if (annotations == null) + annotations = schemaBuilder.makeAnnotations(null, getContext()); + annotations.addComment(comments); + comments = null; + } + parent.endChild(makePattern()); + } + } + + static private final int INIT_CHILD_ALLOC = 5; + + abstract class PatternContainerState extends State { + ParsedPattern[] childPatterns; + int nChildPatterns = 0; + + State createChildState(String localName) throws SAXException { + State state = (State)patternTable.get(localName); + if (state == null) { + error("expected_pattern", localName); + return null; + } + return state.create(); + } + + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + if (nPatterns == 1 && anno == null) + return patterns[0]; + return schemaBuilder.makeGroup(patterns, nPatterns, loc, anno); + } + + void endChild(ParsedPattern pattern) { + if (childPatterns == null) + childPatterns = new ParsedPattern[INIT_CHILD_ALLOC]; + else if (nChildPatterns >= childPatterns.length) { + ParsedPattern[] newChildPatterns = new ParsedPattern[childPatterns.length * 2]; + System.arraycopy(childPatterns, 0, newChildPatterns, 0, childPatterns.length); + childPatterns = newChildPatterns; + } + childPatterns[nChildPatterns++] = pattern; + } + + void endForeignChild(ParsedElementAnnotation ea) { + if (nChildPatterns == 0) + super.endForeignChild(ea); + else + childPatterns[nChildPatterns - 1] = schemaBuilder.annotateAfter(childPatterns[nChildPatterns - 1], ea); + } + + void end() throws SAXException { + if (nChildPatterns == 0) { + error("missing_children"); + endChild(schemaBuilder.makeErrorPattern()); + } + if (comments != null) { + childPatterns[nChildPatterns - 1] = schemaBuilder.commentAfter(childPatterns[nChildPatterns - 1], comments); + comments = null; + } + sendPatternToParent(buildPattern(childPatterns, nChildPatterns, startLocation, annotations)); + } + + void sendPatternToParent(ParsedPattern p) { + parent.endChild(p); + } + } + + class GroupState extends PatternContainerState { + State create() { + return new GroupState(); + } + } + + class ZeroOrMoreState extends PatternContainerState { + State create() { + return new ZeroOrMoreState(); + } + + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeZeroOrMore(super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + } + + class OneOrMoreState extends PatternContainerState { + State create() { + return new OneOrMoreState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeOneOrMore(super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + } + + class OptionalState extends PatternContainerState { + State create() { + return new OptionalState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeOptional(super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + } + + class ListState extends PatternContainerState { + State create() { + return new ListState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeList(super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + } + + class ChoiceState extends PatternContainerState { + State create() { + return new ChoiceState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeChoice(patterns, nPatterns, loc, anno); + } + } + + class InterleaveState extends PatternContainerState { + State create() { + return new InterleaveState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) { + return schemaBuilder.makeInterleave(patterns, nPatterns, loc, anno); + } + } + + class MixedState extends PatternContainerState { + State create() { + return new MixedState(); + } + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeMixed(super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + } + + static interface NameClassRef { + void setNameClass(ParsedNameClass nc); + } + + class ElementState extends PatternContainerState implements NameClassRef { + ParsedNameClass nameClass; + boolean nameClassWasAttribute; + String name; + + void setName(String name) { + this.name = name; + } + + public void setNameClass(ParsedNameClass nc) { + nameClass = nc; + } + + void endAttributes() throws SAXException { + if (name != null) { + nameClass = expandName(name, getNs(), null); + nameClassWasAttribute = true; + } + else + new NameClassChildState(this, this).set(); + } + + State create() { + return new ElementState(); + } + + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeElement(nameClass, super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + + void endForeignChild(ParsedElementAnnotation ea) { + if (nameClassWasAttribute || nChildPatterns > 0 || nameClass == null) + super.endForeignChild(ea); + else + nameClass = schemaBuilder.annotateAfter(nameClass, ea); + } + } + + class RootState extends PatternContainerState { + IncludedGrammar grammar; + + RootState() { + } + + RootState(IncludedGrammar grammar, Scope scope, String ns) { + this.grammar = grammar; + this.scope = scope; + this.nsInherit = ns; + this.datatypeLibrary = ""; + } + + State create() { + return new RootState(); + } + + State createChildState(String localName) throws SAXException { + if (grammar == null) + return super.createChildState(localName); + if (localName.equals("grammar")) + return new MergeGrammarState(grammar); + error("expected_grammar", localName); + return null; + } + + void checkForeignElement() throws SAXException { + error("root_bad_namespace_uri", WellKnownNamespaces.RELAX_NG); + } + + void endChild(ParsedPattern pattern) { + startPattern = pattern; + } + + boolean isRelaxNGElement(String uri) throws SAXException { + if (!uri.startsWith(relaxngURIPrefix)) + return false; + if (!uri.equals(WellKnownNamespaces.RELAX_NG)) + warning("wrong_uri_version", + WellKnownNamespaces.RELAX_NG.substring(relaxngURIPrefix.length()), + uri.substring(relaxngURIPrefix.length())); + relaxngURI = uri; + return true; + } + + } + + class NotAllowedState extends EmptyContentState { + State create() { + return new NotAllowedState(); + } + + ParsedPattern makePattern() { + return schemaBuilder.makeNotAllowed(startLocation, annotations); + } + } + + class EmptyState extends EmptyContentState { + State create() { + return new EmptyState(); + } + + ParsedPattern makePattern() { + return schemaBuilder.makeEmpty(startLocation, annotations); + } + } + + class TextState extends EmptyContentState { + State create() { + return new TextState(); + } + + ParsedPattern makePattern() { + return schemaBuilder.makeText(startLocation, annotations); + } + } + + class ValueState extends EmptyContentState { + final StringBuffer buf = new StringBuffer(); + String type; + + State create() { + return new ValueState(); + } + + void setOtherAttribute(String name, String value) throws SAXException { + if (name.equals("type")) + type = checkNCName(value.trim()); + else + super.setOtherAttribute(name, value); + } + + public void characters(char[] ch, int start, int len) { + buf.append(ch, start, len); + } + + void checkForeignElement() throws SAXException { + error("value_contains_foreign_element"); + } + + ParsedPattern makePattern() throws SAXException { + if (type == null) + return makePattern("", "token"); + else + return makePattern(datatypeLibrary, type); + } + + void end() throws SAXException { + mergeLeadingComments(); + super.end(); + } + + ParsedPattern makePattern(String datatypeLibrary, String type) { + return schemaBuilder.makeValue(datatypeLibrary, + type, + buf.toString(), + getContext(), + getNs(), + startLocation, + annotations); + } + + } + + class DataState extends State { + String type; + ParsedPattern except = null; + DataPatternBuilder dpb = null; + + State create() { + return new DataState(); + } + + State createChildState(String localName) throws SAXException { + if (localName.equals("param")) { + if (except != null) + error("param_after_except"); + return new ParamState(dpb); + } + if (localName.equals("except")) { + if (except != null) + error("multiple_except"); + return new ChoiceState(); + } + error("expected_param_except", localName); + return null; + } + + void setOtherAttribute(String name, String value) throws SAXException { + if (name.equals("type")) + type = checkNCName(value.trim()); + else + super.setOtherAttribute(name, value); + } + + void endAttributes() throws SAXException { + if (type == null) + error("missing_type_attribute"); + else + dpb = schemaBuilder.makeDataPatternBuilder(datatypeLibrary, type, startLocation); + } + + void endForeignChild(ParsedElementAnnotation ea) { + dpb.annotation(ea); + } + + void end() throws SAXException { + ParsedPattern p; + if (dpb != null) { + if (except != null) + p = dpb.makePattern(except, startLocation, annotations); + else + p = dpb.makePattern(startLocation, annotations); + } + else + p = schemaBuilder.makeErrorPattern(); + // XXX need to capture comments + parent.endChild(p); + } + + void endChild(ParsedPattern pattern) { + except = pattern; + } + + } + + class ParamState extends State { + private final StringBuffer buf = new StringBuffer(); + private final DataPatternBuilder dpb; + private String name; + + ParamState(DataPatternBuilder dpb) { + this.dpb = dpb; + } + + State create() { + return new ParamState(null); + } + + void setName(String name) throws SAXException { + this.name = checkNCName(name); + } + + void endAttributes() throws SAXException { + if (name == null) + error("missing_name_attribute"); + } + + State createChildState(String localName) throws SAXException { + error("expected_empty", localName); + return null; + } + + public void characters(char[] ch, int start, int len) { + buf.append(ch, start, len); + } + + void checkForeignElement() throws SAXException { + error("param_contains_foreign_element"); + } + + void end() throws SAXException { + if (name == null) + return; + if (dpb == null) + return; + mergeLeadingComments(); + dpb.addParam(name, buf.toString(), getContext(), getNs(), startLocation, annotations); + } + } + + class AttributeState extends PatternContainerState implements NameClassRef { + ParsedNameClass nameClass; + boolean nameClassWasAttribute; + String name; + + State create() { + return new AttributeState(); + } + + void setName(String name) { + this.name = name; + } + + public void setNameClass(ParsedNameClass nc) { + nameClass = nc; + } + + void endAttributes() throws SAXException { + if (name != null) { + String nsUse; + if (ns != null) + nsUse = ns; + else + nsUse = ""; + nameClass = expandName(name, nsUse, null); + nameClassWasAttribute = true; + } + else + new NameClassChildState(this, this).set(); + } + + void endForeignChild(ParsedElementAnnotation ea) { + if (nameClassWasAttribute || nChildPatterns > 0 || nameClass == null) + super.endForeignChild(ea); + else + nameClass = schemaBuilder.annotateAfter(nameClass, ea); + } + + void end() throws SAXException { + if (nChildPatterns == 0) + endChild(schemaBuilder.makeText(startLocation, null)); + super.end(); + } + + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return schemaBuilder.makeAttribute(nameClass, super.buildPattern(patterns, nPatterns, loc, null), loc, anno); + } + + State createChildState(String localName) throws SAXException { + State tem = super.createChildState(localName); + if (tem != null && nChildPatterns != 0) + error("attribute_multi_pattern"); + return tem; + } + + } + + abstract class SinglePatternContainerState extends PatternContainerState { + State createChildState(String localName) throws SAXException { + if (nChildPatterns == 0) + return super.createChildState(localName); + error("too_many_children"); + return null; + } + } + + class GrammarSectionState extends State { + GrammarSection section; + + GrammarSectionState() { } + + GrammarSectionState(GrammarSection section) { + this.section = section; + } + + State create() { + return new GrammarSectionState(null); + } + + State createChildState(String localName) throws SAXException { + if (localName.equals("define")) + return new DefineState(section); + if (localName.equals("start")) + return new StartState(section); + if (localName.equals("include")) { + Include include = section.makeInclude(); + if (include != null) + return new IncludeState(include); + } + if (localName.equals("div")) + return new DivState(section.makeDiv()); + error("expected_define", localName); + // XXX better errors + return null; + } + + void end() throws SAXException { + if (comments != null) { + section.topLevelComment(comments); + comments = null; + } + } + + void endForeignChild(ParsedElementAnnotation ea) { + section.topLevelAnnotation(ea); + } + } + + class DivState extends GrammarSectionState { + final Div div; + DivState(Div div) { + super(div); + this.div = div; + } + + void end() throws SAXException { + super.end(); + div.endDiv(startLocation, annotations); + } + } + + class IncludeState extends GrammarSectionState { + String href; + final Include include; + + IncludeState(Include include) { + super(include); + this.include = include; + } + + void setOtherAttribute(String name, String value) throws SAXException { + if (name.equals("href")) { + href = value; + checkUri(href); + } + else + super.setOtherAttribute(name, value); + } + + void endAttributes() throws SAXException { + if (href == null) + error("missing_href_attribute"); + else + href = resolve(href); + } + + void end() throws SAXException { + super.end(); + if (href != null) { + try { + include.endInclude(href, getNs(), startLocation, annotations); + } + catch (IllegalSchemaException e) { + } + } + } + } + + class MergeGrammarState extends GrammarSectionState { + final IncludedGrammar grammar; + MergeGrammarState(IncludedGrammar grammar) { + super(grammar); + this.grammar = grammar; + } + + void end() throws SAXException { + super.end(); + parent.endChild(grammar.endIncludedGrammar(startLocation, annotations)); + } + } + + class GrammarState extends GrammarSectionState { + Grammar grammar; + + void setParent(State parent) { + super.setParent(parent); + grammar = schemaBuilder.makeGrammar(scope); + section = grammar; + scope = grammar; + } + + State create() { + return new GrammarState(); + } + + void end() throws SAXException { + super.end(); + parent.endChild(grammar.endGrammar(startLocation, annotations)); + } + } + + class RefState extends EmptyContentState { + String name; + + State create() { + return new RefState(); + } + + void endAttributes() throws SAXException { + if (name == null) + error("missing_name_attribute"); + } + + void setName(String name) throws SAXException { + this.name = checkNCName(name); + } + + ParsedPattern makePattern() { + if (name == null) + return schemaBuilder.makeErrorPattern(); + return scope.makeRef(name, startLocation, annotations); + } + } + + class ParentRefState extends RefState { + State create() { + return new ParentRefState(); + } + + ParsedPattern makePattern() { + if (name == null) + return schemaBuilder.makeErrorPattern(); + return scope.makeParentRef(name, startLocation, annotations); + } + } + + class ExternalRefState extends EmptyContentState { + String href; + ParsedPattern includedPattern; + + State create() { + return new ExternalRefState(); + } + + void setOtherAttribute(String name, String value) throws SAXException { + if (name.equals("href")) { + href = value; + checkUri(href); + } + else + super.setOtherAttribute(name, value); + } + + void endAttributes() throws SAXException { + if (href == null) + error("missing_href_attribute"); + else + href = resolve(href); + } + + ParsedPattern makePattern() { + if (href != null) { + try { + return schemaBuilder.makeExternalRef(href, + getNs(), + scope, + startLocation, + annotations); + } + catch (IllegalSchemaException e) { } + } + return schemaBuilder.makeErrorPattern(); + } + } + + abstract class DefinitionState extends PatternContainerState { + GrammarSection.Combine combine = null; + final GrammarSection section; + + DefinitionState(GrammarSection section) { + this.section = section; + } + + void setOtherAttribute(String name, String value) throws SAXException { + if (name.equals("combine")) { + value = value.trim(); + if (value.equals("choice")) + combine = GrammarSection.COMBINE_CHOICE; + else if (value.equals("interleave")) + combine = GrammarSection.COMBINE_INTERLEAVE; + else + error("combine_attribute_bad_value", value); + } + else + super.setOtherAttribute(name, value); + } + + ParsedPattern buildPattern(ParsedPattern[] patterns, int nPatterns, Location loc, Annotations anno) throws SAXException { + return super.buildPattern(patterns, nPatterns, loc, null); + } + } + + class DefineState extends DefinitionState { + String name; + + DefineState(GrammarSection section) { + super(section); + } + + State create() { + return new DefineState(null); + } + + void setName(String name) throws SAXException { + this.name = checkNCName(name); + } + + void endAttributes() throws SAXException { + if (name == null) + error("missing_name_attribute"); + } + + void sendPatternToParent(ParsedPattern p) { + if (name != null) + section.define(name, combine, p, startLocation, annotations); + } + + } + + class StartState extends DefinitionState { + + StartState(GrammarSection section) { + super(section); + } + + State create() { + return new StartState(null); + } + + void sendPatternToParent(ParsedPattern p) { + section.define(GrammarSection.START, combine, p, startLocation, annotations); + } + + State createChildState(String localName) throws SAXException { + State tem = super.createChildState(localName); + if (tem != null && nChildPatterns != 0) + error("start_multi_pattern"); + return tem; + } + + } + + abstract class NameClassContainerState extends State { + State createChildState(String localName) throws SAXException { + State state = (State)nameClassTable.get(localName); + if (state == null) { + error("expected_name_class", localName); + return null; + } + return state.create(); + } + } + + class NameClassChildState extends NameClassContainerState { + final State prevState; + final NameClassRef nameClassRef; + + State create() { + return null; + } + + NameClassChildState(State prevState, NameClassRef nameClassRef) { + this.prevState = prevState; + this.nameClassRef = nameClassRef; + setParent(prevState.parent); + this.ns = prevState.ns; + } + + void endChild(ParsedNameClass nameClass) { + nameClassRef.setNameClass(nameClass); + prevState.set(); + } + + void endForeignChild(ParsedElementAnnotation ea) { + prevState.endForeignChild(ea); + } + + void end() throws SAXException { + nameClassRef.setNameClass(schemaBuilder.makeErrorNameClass()); + error("missing_name_class"); + prevState.set(); + prevState.end(); + } + } + + abstract class NameClassBaseState extends State { + + abstract ParsedNameClass makeNameClass() throws SAXException; + + void end() throws SAXException { + parent.endChild(makeNameClass()); + } + } + + class NameState extends NameClassBaseState { + final StringBuffer buf = new StringBuffer(); + + State createChildState(String localName) throws SAXException { + error("expected_name", localName); + return null; + } + + State create() { + return new NameState(); + } + + public void characters(char[] ch, int start, int len) { + buf.append(ch, start, len); + } + + void checkForeignElement() throws SAXException { + error("name_contains_foreign_element"); + } + + ParsedNameClass makeNameClass() throws SAXException { + mergeLeadingComments(); + return expandName(buf.toString().trim(), getNs(), annotations); + } + + } + + private static final int PATTERN_CONTEXT = 0; + private static final int ANY_NAME_CONTEXT = 1; + private static final int NS_NAME_CONTEXT = 2; + + class AnyNameState extends NameClassBaseState { + ParsedNameClass except = null; + + State create() { + return new AnyNameState(); + } + + State createChildState(String localName) throws SAXException { + if (localName.equals("except")) { + if (except != null) + error("multiple_except"); + return new NameClassChoiceState(getContext()); + } + error("expected_except", localName); + return null; + } + + int getContext() { + return ANY_NAME_CONTEXT; + } + + ParsedNameClass makeNameClass() { + if (except == null) + return makeNameClassNoExcept(); + else + return makeNameClassExcept(except); + } + + ParsedNameClass makeNameClassNoExcept() { + return schemaBuilder.makeAnyName(startLocation, annotations); + } + + ParsedNameClass makeNameClassExcept(ParsedNameClass except) { + return schemaBuilder.makeAnyName(except, startLocation, annotations); + } + + void endChild(ParsedNameClass nameClass) { + except = nameClass; + } + + } + + class NsNameState extends AnyNameState { + State create() { + return new NsNameState(); + } + + ParsedNameClass makeNameClassNoExcept() { + return schemaBuilder.makeNsName(getNs(), null, null); + } + + ParsedNameClass makeNameClassExcept(ParsedNameClass except) { + return schemaBuilder.makeNsName(getNs(), except, null, null); + } + + int getContext() { + return NS_NAME_CONTEXT; + } + + } + + class NameClassChoiceState extends NameClassContainerState { + private ParsedNameClass[] nameClasses; + private int nNameClasses; + private int context; + + NameClassChoiceState() { + this.context = PATTERN_CONTEXT; + } + + NameClassChoiceState(int context) { + this.context = context; + } + + void setParent(State parent) { + super.setParent(parent); + if (parent instanceof NameClassChoiceState) + this.context = ((NameClassChoiceState)parent).context; + } + + State create() { + return new NameClassChoiceState(); + } + + State createChildState(String localName) throws SAXException { + if (localName.equals("anyName")) { + if (context >= ANY_NAME_CONTEXT) { + error(context == ANY_NAME_CONTEXT + ? "any_name_except_contains_any_name" + : "ns_name_except_contains_any_name"); + return null; + } + } + else if (localName.equals("nsName")) { + if (context == NS_NAME_CONTEXT) { + error("ns_name_except_contains_ns_name"); + return null; + } + } + return super.createChildState(localName); + } + + void endChild(ParsedNameClass nc) { + if (nameClasses == null) + nameClasses = new ParsedNameClass[INIT_CHILD_ALLOC]; + else if (nNameClasses >= nameClasses.length) { + ParsedNameClass[] newNameClasses = new ParsedNameClass[nameClasses.length * 2]; + System.arraycopy(nameClasses, 0, newNameClasses, 0, nameClasses.length); + nameClasses = newNameClasses; + } + nameClasses[nNameClasses++] = nc; + } + + void endForeignChild(ParsedElementAnnotation ea) { + if (nNameClasses == 0) + super.endForeignChild(ea); + else + nameClasses[nNameClasses - 1] = schemaBuilder.annotateAfter(nameClasses[nNameClasses - 1], ea); + } + + void end() throws SAXException { + if (nNameClasses == 0) { + error("missing_name_class"); + parent.endChild(schemaBuilder.makeErrorNameClass()); + return; + } + if (comments != null) { + nameClasses[nNameClasses - 1] = schemaBuilder.commentAfter(nameClasses[nNameClasses - 1], comments); + comments = null; + } + parent.endChild(schemaBuilder.makeChoice(nameClasses, nNameClasses, startLocation, annotations)); + } + } + + private void initPatternTable() { + patternTable = new Hashtable(); + patternTable.put("zeroOrMore", new ZeroOrMoreState()); + patternTable.put("oneOrMore", new OneOrMoreState()); + patternTable.put("optional", new OptionalState()); + patternTable.put("list", new ListState()); + patternTable.put("choice", new ChoiceState()); + patternTable.put("interleave", new InterleaveState()); + patternTable.put("group", new GroupState()); + patternTable.put("mixed", new MixedState()); + patternTable.put("element", new ElementState()); + patternTable.put("attribute", new AttributeState()); + patternTable.put("empty", new EmptyState()); + patternTable.put("text", new TextState()); + patternTable.put("value", new ValueState()); + patternTable.put("data", new DataState()); + patternTable.put("notAllowed", new NotAllowedState()); + patternTable.put("grammar", new GrammarState()); + patternTable.put("ref", new RefState()); + patternTable.put("parentRef", new ParentRefState()); + patternTable.put("externalRef", new ExternalRefState()); + } + + private void initNameClassTable() { + nameClassTable = new Hashtable(); + nameClassTable.put("name", new NameState()); + nameClassTable.put("anyName", new AnyNameState()); + nameClassTable.put("nsName", new NsNameState()); + nameClassTable.put("choice", new NameClassChoiceState()); + } + + public ParsedPattern getParsedPattern() throws IllegalSchemaException { + if (hadError) + throw new IllegalSchemaException(); + return startPattern; + } + + private void error(String key) throws SAXException { + error(key, locator); + } + + private void error(String key, String arg) throws SAXException { + error(key, arg, locator); + } + + void error(String key, String arg1, String arg2) throws SAXException { + error(key, arg1, arg2, locator); + } + + private void error(String key, Locator loc) throws SAXException { + error(new SAXParseException(localizer.message(key), loc)); + } + + private void error(String key, String arg, Locator loc) throws SAXException { + error(new SAXParseException(localizer.message(key, arg), loc)); + } + + private void error(String key, String arg1, String arg2, Locator loc) + throws SAXException { + error(new SAXParseException(localizer.message(key, arg1, arg2), loc)); + } + + private void error(SAXParseException e) throws SAXException { + hadError = true; + if (eh != null) + eh.error(e); + } + + void warning(String key) throws SAXException { + warning(key, locator); + } + + private void warning(String key, String arg) throws SAXException { + warning(key, arg, locator); + } + + private void warning(String key, String arg1, String arg2) throws SAXException { + warning(key, arg1, arg2, locator); + } + + private void warning(String key, Locator loc) throws SAXException { + warning(new SAXParseException(localizer.message(key), loc)); + } + + private void warning(String key, String arg, Locator loc) throws SAXException { + warning(new SAXParseException(localizer.message(key, arg), loc)); + } + + private void warning(String key, String arg1, String arg2, Locator loc) + throws SAXException { + warning(new SAXParseException(localizer.message(key, arg1, arg2), loc)); + } + + private void warning(SAXParseException e) throws SAXException { + if (eh != null) + eh.warning(e); + } + + SchemaParser(XMLReader xr, + ErrorHandler eh, + SchemaBuilder schemaBuilder, + IncludedGrammar grammar, + Scope scope) throws SAXException { + this.xr = xr; + this.eh = eh; + this.schemaBuilder = schemaBuilder; + if (eh != null) + xr.setErrorHandler(eh); + xr.setDTDHandler(context); + if (schemaBuilder.usesComments()) { + try { + xr.setProperty("http://xml.org/sax/properties/lexical-handler", new LexicalHandlerImpl()); + } + catch (SAXNotRecognizedException e) { + warning("no_comment_support", xr.getClass().getName()); + } + catch (SAXNotSupportedException e) { + warning("no_comment_support", xr.getClass().getName()); + } + } + initPatternTable(); + initNameClassTable(); + new RootState(grammar, scope, SchemaBuilder.INHERIT_NS).set(); + } + + + private Context getContext() { + return context; + } + + class LexicalHandlerImpl extends AbstractLexicalHandler { + private boolean inDtd = false; + + public void startDTD(String s, String s1, String s2) throws SAXException { + inDtd = true; + } + + public void endDTD() throws SAXException { + inDtd = false; + } + + public void comment(char[] chars, int start, int length) throws SAXException { + if (!inDtd) + ((CommentHandler)xr.getContentHandler()).comment(new String(chars, start, length)); + } + } + + private ParsedNameClass expandName(String name, String ns, Annotations anno) throws SAXException { + int ic = name.indexOf(':'); + if (ic == -1) + return schemaBuilder.makeName(ns, checkNCName(name), null, null, anno); + String prefix = checkNCName(name.substring(0, ic)); + String localName = checkNCName(name.substring(ic + 1)); + for (PrefixMapping tem = context.prefixMapping; tem != null; tem = tem.next) + if (tem.prefix.equals(prefix)) + return schemaBuilder.makeName(tem.uri, localName, prefix, null, anno); + error("undefined_prefix", prefix); + return schemaBuilder.makeName("", localName, null, null, anno); + } + + private String findPrefix(String qName, String uri) { + String prefix = null; + if (qName == null || qName.equals("")) { + for (PrefixMapping p = context.prefixMapping; p != null; p = p.next) + if (p.uri.equals(uri)) { + prefix = p.prefix; + break; + } + } + else { + int off = qName.indexOf(':'); + if (off > 0) + prefix = qName.substring(0, off); + } + return prefix; + } + private String checkNCName(String str) throws SAXException { + if (!Naming.isNcname(str)) + error("invalid_ncname", str); + return str; + } + + private String resolve(String systemId) throws SAXException { + if (Uri.hasFragmentId(systemId)) + error("href_fragment_id"); + systemId = Uri.escapeDisallowedChars(systemId); + return Uri.resolve(xmlBaseHandler.getBaseUri(), systemId); + } + + private Location makeLocation() { + if (locator == null) + return null; + return schemaBuilder.makeLocation(locator.getSystemId(), + locator.getLineNumber(), + locator.getColumnNumber()); + } + + private void checkUri(String s) throws SAXException { + if (!Uri.isValid(s)) + error("invalid_uri", s); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties new file mode 100644 index 0000000..63d7d7e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/parse/sax/resources/Messages.properties @@ -0,0 +1,38 @@ +no_comment_support=SAX parser \"{0}\" cannot report comments +any_name_except_contains_any_name=\"except\" in \"anyName\" contains \"anyName\" +attribute_multi_pattern=\"attribute\" pattern must contain at most one pattern +combine_attribute_bad_value=bad value \"{0}\" for \"combine\" attribute; value must be \"choice\" or \"interleave\" +expected_define=found \"{0}\" element but expected \"define\" or \"start\" or \"include\" or \"div\" element +expected_empty=found \"{0}\" element but expected empty content +expected_except=found \"{0}\" element but expected \"except\" +expected_grammar=found \"{0}\" element but expected \"grammar\" element +expected_name=found \"{0}\" element but expected a name +expected_name_class=found \"{0}\" element but expected a name-class +expected_param_except=only \"param\" and \"except\" child elements are allowed +expected_pattern=found \"{0}\" element but expected a pattern +fragment_identifier_datatype_library=URI in value of \"datatypeLibrary\" attribute must not have a fragment identifier +href_fragment_id=fragment identifier ignored in value of \"href\" attribute +illegal_attribute_ignored=illegal attribute \"{0}\" ignored +illegal_characters_ignored=illegal characters ignored +illegal_name_attribute=illegal \"name\" attribute +invalid_ncname=\"{0}\" is not a valid local name +invalid_uri=\"{0}\" is not a valid URI reference according to RFC 2396 +missing_children=missing children +missing_href_attribute=missing \"href\" attribute +missing_name_attribute=missing \"name\" attribute +missing_name_class=expected child element specifying name class +missing_type_attribute=missing \"type\" attribute +multiple_except=at most one \"except\" child element is allowed +name_contains_foreign_element=\"name\" element cannot contain foreign elements +ns_name_except_contains_any_name=\"except\" in \"nsName\" contains \"anyName\" +ns_name_except_contains_ns_name=\"except\" in \"nsName\" contains \"nsName\" +param_after_except=\"param\" is not allowed after \"except\" +param_contains_foreign_element=\"param\" element cannot contain foreign elements +qualified_attribute=attribute name \"{0}\" incorrectly qualified with RELAX NG namespace URI +relative_datatype_library=URI in value of \"datatypeLibrary\" attribute must not be relative +root_bad_namespace_uri=namespace URI of document element must be \"{0}\" +start_multi_pattern=\"start\" pattern must contain at most one pattern +too_many_children=too many child elements: only one child element is allowed +undefined_prefix=undefined prefix \"{0}\" +value_contains_foreign_element=\"value\" element cannot contain foreign elements +wrong_uri_version=namespace URI has wrong version: expected \"{0}\" but got \"{1}\" diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/Driver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/Driver.java new file mode 100644 index 0000000..042c87b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/Driver.java @@ -0,0 +1,154 @@ +package com.thaiopensource.relaxng.util; + +import com.thaiopensource.util.OptionParser; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.util.Version; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.validate.Flag; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.OptionArgumentException; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.ValidationDriver; +import com.thaiopensource.validate.auto.AutoSchemaReader; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.xml.sax.ErrorHandlerImpl; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import java.io.IOException; + +class Driver { + static private String usageKey = "usage"; + + static public void setUsageKey(String key) { + usageKey = key; + } + + static public void main(String[] args) { + System.exit(new Driver().doMain(args)); + } + + private boolean timing = false; + private String encoding = null; + private Localizer localizer = new Localizer(Driver.class); + + public int doMain(String[] args) { + ErrorHandlerImpl eh = new ErrorHandlerImpl(System.out); + OptionParser op = new OptionParser("itcdfe:p:", args); + PropertyMapBuilder properties = new PropertyMapBuilder(); + ValidateProperty.ERROR_HANDLER.put(properties, eh); + RngProperty.CHECK_ID_IDREF.add(properties); + SchemaReader sr = null; + boolean compact = false; + + try { + while (op.moveToNextOption()) { + switch (op.getOptionChar()) { + case 'i': + properties.put(RngProperty.CHECK_ID_IDREF, null); + break; + case 'c': + compact = true; + break; + case 'd': + { + if (sr == null) + sr = new AutoSchemaReader(); + Option option = sr.getOption(SchemaReader.BASE_URI + "diagnose"); + if (option == null) { + eh.print(localizer.message("no_schematron", op.getOptionCharString())); + return 2; + } + properties.put(option.getPropertyId(), Flag.PRESENT); + } + break; + case 't': + timing = true; + break; + case 'e': + encoding = op.getOptionArg(); + break; + case 'f': + RngProperty.FEASIBLE.add(properties); + break; + case 'p': + { + if (sr == null) + sr = new AutoSchemaReader(); + Option option = sr.getOption(SchemaReader.BASE_URI + "phase"); + if (option == null) { + eh.print(localizer.message("no_schematron", op.getOptionCharString())); + return 2; + } + try { + properties.put(option.getPropertyId(), option.valueOf(op.getOptionArg())); + } + catch (OptionArgumentException e) { + eh.print(localizer.message("invalid_phase", op.getOptionArg())); + return 2; + } + } + break; + } + } + } + catch (OptionParser.InvalidOptionException e) { + eh.print(localizer.message("invalid_option", op.getOptionCharString())); + return 2; + } + catch (OptionParser.MissingArgumentException e) { + eh.print(localizer.message("option_missing_argument",op.getOptionCharString())); + return 2; + } + if (compact) + sr = CompactSchemaReader.getInstance(); + args = op.getRemainingArgs(); + if (args.length < 1) { + eh.print(localizer.message(usageKey, Version.getVersion(Driver.class))); + return 2; + } + long startTime = System.currentTimeMillis(); + long loadedPatternTime = -1; + boolean hadError = false; + try { + ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), sr); + InputSource in = ValidationDriver.uriOrFileInputSource(args[0]); + if (encoding != null) + in.setEncoding(encoding); + if (driver.loadSchema(in)) { + loadedPatternTime = System.currentTimeMillis(); + for (int i = 1; i < args.length; i++) { + if (!driver.validate(ValidationDriver.uriOrFileInputSource(args[i]))) + hadError = true; + } + } + else + hadError = true; + } + catch (SAXException e) { + hadError = true; + eh.printException(e); + } + catch (IOException e) { + hadError = true; + eh.printException(e); + } + if (timing) { + long endTime = System.currentTimeMillis(); + if (loadedPatternTime < 0) + loadedPatternTime = endTime; + eh.print(localizer.message("elapsed_time", + new Object[] { + new Long(loadedPatternTime - startTime), + new Long(endTime - loadedPatternTime), + new Long(endTime - startTime) + })); + } + if (hadError) + return 1; + return 0; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ExegenDriver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ExegenDriver.java new file mode 100644 index 0000000..631d4a6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ExegenDriver.java @@ -0,0 +1,8 @@ +package com.thaiopensource.relaxng.util; + +class ExegenDriver { + static public void main(String[] args) { + Driver.setUsageKey("exegen_usage"); + Driver.main(args); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/TestDriver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/TestDriver.java new file mode 100644 index 0000000..b45ce9e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/TestDriver.java @@ -0,0 +1,153 @@ +package com.thaiopensource.relaxng.util; + +import com.thaiopensource.util.OptionParser; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.ValidationDriver; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.xml.sax.ErrorHandlerImpl; +import org.xml.sax.SAXException; +import org.relaxng.datatype.helpers.DatatypeLibraryLoader; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; + +class TestDriver { + static public void main(String[] args) throws IOException { + System.exit(new TestDriver().doMain(args)); + } + + private ValidationDriver driver; + private ErrorHandlerImpl eh; + private Localizer localizer = new Localizer(TestDriver.class); + private int nTests = 0; + + public int doMain(String[] args) throws IOException { + long startTime = System.currentTimeMillis(); + eh = new ErrorHandlerImpl(System.out); + OptionParser op = new OptionParser("i", args); + PropertyMapBuilder properties = new PropertyMapBuilder(); + // This is an optimization. It ensures that all SchemaReaders share a + // single DatatypeLibraryLoader. + RngProperty.DATATYPE_LIBRARY_FACTORY.put(properties, new DatatypeLibraryLoader()); + try { + while (op.moveToNextOption()) { + switch (op.getOptionChar()) { + case 'i': + RngProperty.CHECK_ID_IDREF.add(properties); + break; + } + } + } + catch (OptionParser.InvalidOptionException e) { + eh.print(localizer.message("invalid_option", op.getOptionCharString())); + return 2; + } + catch (OptionParser.MissingArgumentException e) { + eh.print(localizer.message("option_missing_argument", op.getOptionCharString())); + return 2; + } + args = op.getRemainingArgs(); + eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[0])))); + ValidateProperty.ERROR_HANDLER.put(properties, eh); + driver = new ValidationDriver(properties.toPropertyMap()); + int result = 0; + for (int i = 1; i < args.length; i++) { + int n = runTestSuite(new File(args[i])); + if (n > result) + result = n; + } + System.err.println("Number of tests: " + nTests); + System.err.println("Elapsed time: " + (System.currentTimeMillis() - startTime)); + eh.close(); + return result; + } + + private static final String CORRECT_SCHEMA_NAME = "c.rng"; + private static final String INCORRECT_SCHEMA_NAME = "i.rng"; + private static final String VALID_INSTANCE_SUFFIX = ".v.xml"; + private static final String INVALID_INSTANCE_SUFFIX = ".i.xml"; + + public int runTestSuite(File dir) throws IOException { + int result = 0; + String[] subdirs = dir.list(); + for (int i = 0; i < subdirs.length; i++) { + File subdir = new File(dir, subdirs[i]); + if (subdir.isDirectory()) { + int n = runTestCase(subdir); + if (n > result) + result = n; + } + } + return result; + } + + private int runTestCase(File dir) throws IOException { + File f = new File(dir, INCORRECT_SCHEMA_NAME); + if (f.exists()) { + if (loadSchema(f)) { + failed(f); + return 1; + } + return 0; + } + f = new File(dir, CORRECT_SCHEMA_NAME); + if (!f.exists()) + return 0; + if (!loadSchema(f)) { + failed(f); + return 1; + } + String[] files = dir.list(); + int result = 0; + for (int i = 0; i < files.length; i++) { + if (files[i].endsWith(VALID_INSTANCE_SUFFIX)) { + f = new File(dir, files[i]); + if (!validateInstance(f)) { + failed(f); + result = 1; + } + } + else if (files[i].endsWith(INVALID_INSTANCE_SUFFIX)) { + f = new File(dir, files[i]); + if (validateInstance(f)) { + failed(f); + result = 1; + } + } + } + return result; + } + + private static void failed(File f) { + System.err.println("Failed: " + f.toString()); + } + + private boolean loadSchema(File schema) throws IOException { + nTests++; + try { + if (driver.loadSchema(ValidationDriver.fileInputSource(schema))) + return true; + } + catch (SAXException e) { + eh.printException(e); + } + return false; + } + + private boolean validateInstance(File instance) throws IOException { + nTests++; + try { + if (driver.validate(ValidationDriver.fileInputSource(instance))) + return true; + } + catch (SAXException e) { + eh.printException(e); + } + return false; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ValidationEngine.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ValidationEngine.java new file mode 100644 index 0000000..c2ce545 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/ValidationEngine.java @@ -0,0 +1,127 @@ +package com.thaiopensource.relaxng.util; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.ValidationDriver; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.xml.sax.Sax2XMLReaderCreator; +import org.xml.sax.ErrorHandler; + +/** + * Provides a compatibility wrapper around ValidationDriver. New applications + * should use ValidationDriver directly. + * + * @author James Clark + * @see ValidationDriver + * @deprecated + */ +public class ValidationEngine extends ValidationDriver { + + /** + * Flag indicating that ID/IDREF/IDREFS should be checked. + * @see RngProperty#CHECK_ID_IDREF + */ + public static final int CHECK_ID_IDREF = 01; + /** + * Flag indicating that the schema is in the RELAX NG compact syntax rather than the XML syntax. + * @see CompactSchemaReader + */ + public static final int COMPACT_SYNTAX = 02; + /** + * @see RngProperty#FEASIBLE + */ + public static final int FEASIBLE = 04; + + /** + * Default constructor. Equivalent to ValidationEngine(null, null, CHECK_ID_IDREF). + */ + public ValidationEngine() { + this(null, null, CHECK_ID_IDREF); + } + /** + * Constructs a ValidationEngine. + * + * @param xrc the XMLReaderCreator to be used for constructing XMLReaders; + * if null uses Sax2XMLReaderCreator + * @param eh the ErrorHandler to be used for reporting errors; if null + * uses DraconianErrorHandler + * @param flags bitwise OR of flags selected from CHECK_ID_IDREF, COMPACT_SYNTAX, + * FEASIBLE, MNS + * @see com.thaiopensource.xml.sax.DraconianErrorHandler + * @see com.thaiopensource.xml.sax.Sax2XMLReaderCreator + * @see #CHECK_ID_IDREF + * @see #COMPACT_SYNTAX + * @see #FEASIBLE + */ + public ValidationEngine(XMLReaderCreator xrc, + ErrorHandler eh, + int flags) { + super(makePropertyMap(xrc, eh, flags), + (flags & COMPACT_SYNTAX) == 0 ? null : CompactSchemaReader.getInstance()); + } + + private static PropertyMap makePropertyMap(XMLReaderCreator xrc, ErrorHandler eh, int flags) { + PropertyMapBuilder builder = new PropertyMapBuilder(); + if (xrc == null) + xrc = new Sax2XMLReaderCreator(); + ValidateProperty.XML_READER_CREATOR.put(builder, xrc); + if (eh != null) + ValidateProperty.ERROR_HANDLER.put(builder, eh); + if ((flags & CHECK_ID_IDREF) != 0) + RngProperty.CHECK_ID_IDREF.add(builder); + if ((flags & FEASIBLE) != 0) + RngProperty.FEASIBLE.add(builder); + return builder.toPropertyMap(); + } + + /** + * Constructs a ValidationEngine. + * + * @param xrc the XMLReaderCreator to be used for constructing XMLReaders; + * if null uses Sax2XMLReaderCreator + * @param eh the ErrorHandler to be used for reporting errors; if null + * uses DraconianErrorHandler + * @param checkIdIdref true if ID/IDREF/IDREFS should be checked; false otherwise + * @see com.thaiopensource.xml.sax.DraconianErrorHandler + * @see com.thaiopensource.xml.sax.Sax2XMLReaderCreator + */ + public ValidationEngine(XMLReaderCreator xrc, + ErrorHandler eh, + boolean checkIdIdref) { + this(xrc, eh, checkIdIdref ? CHECK_ID_IDREF : 0); + } + + /** + * Constructs a ValidationEngine. + * + * @param xrc the XMLReaderCreator to be used for constructing XMLReaders; + * if null uses Sax2XMLReaderCreator + * @param eh the ErrorHandler to be used for reporting errors; if null + * uses DraconianErrorHandler + * @param checkIdIdref true if ID/IDREF/IDREFS should be checked; false otherwise + * @param compactSyntax true if the RELAX NG compact syntax should be used to parse the schema; + * false if the XML syntax should be used + * @see com.thaiopensource.xml.sax.DraconianErrorHandler + * @see com.thaiopensource.xml.sax.Sax2XMLReaderCreator + */ + public ValidationEngine(XMLReaderCreator xrc, ErrorHandler eh, boolean checkIdIdref, boolean compactSyntax) { + this(xrc, + eh, + (checkIdIdref ? CHECK_ID_IDREF : 0) + | (compactSyntax ? COMPACT_SYNTAX : 0)); + } + + + public ValidationEngine(XMLReaderCreator xrc, ErrorHandler eh, boolean checkIdIdref, boolean compactSyntax, + boolean feasible) { + this(xrc, + eh, + (checkIdIdref ? CHECK_ID_IDREF : 0) + | (compactSyntax ? COMPACT_SYNTAX : 0) + | (feasible ? FEASIBLE : 0)); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Messages.properties new file mode 100644 index 0000000..9f5da9b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Messages.properties @@ -0,0 +1,17 @@ +no_schematron=option \"-{0}\" is only applicable to Schematron, but this version of Jing does not support Schematron +invalid_phase=\"{0}\" is not a valid Schematron phase name + +elapsed_time=Elapsed time {0,number,#}+{1,number,#}={2,number,#} milliseconds + +option_missing_argument=option \"-{0}\" requires an argument +invalid_option=invalid option \"-{0}\" + +usage=Jing version {0}\n\ +usage: java com.thaiopensource.relaxng.util.Driver [-i] [-c] [-t] [-e encoding] RNGFile XMLFile...\n\ +RELAX NG is a schema language for XML\n\ +See http://relaxng.org/ for more information. + +exegen_usage=Jing version {0}\n\ +usage: jing [-i] [-c] [-t] [-e encoding] RNGFile XMLFile...\n\ +RELAX NG is a schema language for XML\n\ +See http://relaxng.org/ for more information. diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Version.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Version.properties new file mode 100644 index 0000000..3634f19 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/relaxng/util/resources/Version.properties @@ -0,0 +1 @@ +version=20030619 diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Equal.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Equal.java new file mode 100644 index 0000000..974409c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Equal.java @@ -0,0 +1,9 @@ +package com.thaiopensource.util; + +public class Equal { + private Equal() { } + + static public boolean equal(Object obj1, Object obj2) { + return obj1 == null ? obj2 == null : obj1.equals(obj2); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Localizer.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Localizer.java new file mode 100644 index 0000000..bca7f0f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Localizer.java @@ -0,0 +1,44 @@ +package com.thaiopensource.util; + +import java.util.ResourceBundle; +import java.text.MessageFormat; + +public class Localizer { + private final Class cls; + private ResourceBundle bundle; + + public Localizer(Class cls) { + this.cls = cls; + } + + public String message(String key) { + return MessageFormat.format(getBundle().getString(key), new Object[]{}); + } + + public String message(String key, Object arg) { + return MessageFormat.format(getBundle().getString(key), + new Object[]{arg}); + } + + public String message(String key, Object arg1, Object arg2) { + return MessageFormat.format(getBundle().getString(key), + new Object[]{arg1, arg2}); + } + + public String message(String key, Object[] args) { + return MessageFormat.format(getBundle().getString(key), args); + } + + private ResourceBundle getBundle() { + if (bundle == null){ + String s = cls.getName(); + int i = s.lastIndexOf('.'); + if (i > 0) + s = s.substring(0, i + 1); + else + s = ""; + bundle = ResourceBundle.getBundle(s + "resources.Messages"); + } + return bundle; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/OptionParser.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/OptionParser.java new file mode 100644 index 0000000..c5ae9cb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/OptionParser.java @@ -0,0 +1,108 @@ +package com.thaiopensource.util; + +public class OptionParser { + private final String optionSpec; + private char optionChar = 0; + private String optionArg = null; + private int argIndex = 0; + private int currentOptionIndex = 0; + private final String[] args; + + private static final char OPTION_CHAR = '-'; + + public static class MissingArgumentException extends Exception { } + + public static class InvalidOptionException extends Exception { } + + public OptionParser(String optionSpec, String[] args) { + this.optionSpec = optionSpec; + this.args = new String[args.length]; + System.arraycopy(args, 0, this.args, 0, args.length); + } + + public char getOptionChar() { + return optionChar; + } + + public String getOptionCharString() { + return new String(new char[]{optionChar}); + } + + public String getOptionArg() { + return optionArg; + } + + public boolean moveToNextOption() + throws InvalidOptionException, MissingArgumentException { + if (currentOptionIndex > 0 + && currentOptionIndex == args[argIndex].length()) { + currentOptionIndex = 0; + argIndex++; + } + if (currentOptionIndex == 0) { + if (argIndex >= args.length) + return false; + String arg = args[argIndex]; + if (arg.length() < 2 || arg.charAt(0) != OPTION_CHAR) + return false; + if (arg.length() == 2 && arg.charAt(1) == OPTION_CHAR) { + argIndex++; + return false; + } + currentOptionIndex = 1; + } + optionChar = args[argIndex].charAt(currentOptionIndex++); + optionArg = null; + int i = optionSpec.indexOf(optionChar); + if (i < 0 || (optionChar == ':' && i > 0)) + throw new InvalidOptionException(); + if (i + 1 < optionSpec.length() && optionSpec.charAt(i + 1) == ':') { + if (currentOptionIndex < args[argIndex].length()) { + optionArg = args[argIndex].substring(currentOptionIndex); + currentOptionIndex = 0; + argIndex++; + } + else if (argIndex + 1 < args.length) { + optionArg = args[++argIndex]; + ++argIndex; + currentOptionIndex = 0; + } + else + throw new MissingArgumentException(); + } + return true; + } + + public String[] getRemainingArgs() { + String[] tem = new String[args.length - argIndex]; + System.arraycopy(args, argIndex, tem, 0, tem.length); + return tem; + } + + public static void main(String[] args) { + String optSpec = args[0]; + String[] tem = new String[args.length - 1]; + System.arraycopy(args, 1, tem, 0, tem.length); + args = tem; + OptionParser opts = new OptionParser(optSpec, args); + try { + while (opts.moveToNextOption()) { + System.err.print("option " + opts.getOptionChar()); + String arg = opts.getOptionArg(); + if (arg == null) + System.err.println(" (no argument)"); + else + System.err.println(" arg=" + arg); + } + args = opts.getRemainingArgs(); + for (int i = 0; i < args.length; i++) + System.err.println("arg=" + args[i]); + } + catch (OptionParser.MissingArgumentException e) { + System.err.println("missing argument for option " + opts.getOptionChar()); + } + catch (OptionParser.InvalidOptionException e) { + System.err.println("invalid option " + opts.getOptionChar()); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyId.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyId.java new file mode 100644 index 0000000..86372cb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyId.java @@ -0,0 +1,29 @@ +package com.thaiopensource.util; + +public class PropertyId { + private final String name; + private final Class valueClass; + + public PropertyId(String name, Class valueClass) { + if (name == null || valueClass == null) + throw new NullPointerException(); + this.name = name; + this.valueClass = valueClass; + } + + public Class getValueClass() { + return valueClass; + } + + public final int hashCode() { + return super.hashCode(); + } + + public final boolean equals(Object obj) { + return super.equals(obj); + } + + public String toString() { + return name; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMap.java new file mode 100644 index 0000000..760ab4e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMap.java @@ -0,0 +1,25 @@ +package com.thaiopensource.util; + +public interface PropertyMap { + public static final PropertyMap EMPTY = new PropertyMap() { + public Object get(PropertyId pid) { + return null; + } + + public boolean contains(PropertyId pid) { + return false; + } + + public int size() { + return 0; + } + + public PropertyId getKey(int i) { + throw new IndexOutOfBoundsException(); + } + }; + Object get(PropertyId pid); + boolean contains(PropertyId pid); + int size(); + PropertyId getKey(int i); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMapBuilder.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMapBuilder.java new file mode 100644 index 0000000..1610d9b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/PropertyMapBuilder.java @@ -0,0 +1,95 @@ +package com.thaiopensource.util; + +import java.util.Hashtable; +import java.util.Enumeration; + +public class PropertyMapBuilder { + private Hashtable map; + private PropertyId[] keys; + + private static class PropertyMapImpl implements PropertyMap { + private final Hashtable map; + private final PropertyId[] keys; + + private PropertyMapImpl(Hashtable map, PropertyId[] keys) { + this.map = map; + this.keys = keys; + } + + public Object get(PropertyId pid) { + return map.get(pid); + } + + public int size() { + return keys.length; + } + + public boolean contains(PropertyId pid) { + return map.get(pid) != null; + } + + public PropertyId getKey(int i) { + return keys[i]; + } + } + + public PropertyMapBuilder() { + this.map = new Hashtable(); + } + + public PropertyMapBuilder(PropertyMap pm) { + if (pm instanceof PropertyMapImpl) { + PropertyMapImpl pmi = (PropertyMapImpl)pm; + this.map = pmi.map; + this.keys = pmi.keys; + } + else { + this.map = new Hashtable(); + for (int i = 0, len = pm.size(); i < len; i++) { + PropertyId pid = pm.getKey(i); + put(pid, pm.get(pid)); + } + } + } + + private void lock() { + if (keys != null) + return; + keys = new PropertyId[map.size()]; + int i = 0; + for (Enumeration e = map.keys(); e.hasMoreElements();) + keys[i++] = (PropertyId)e.nextElement(); + } + + private void copyIfLocked() { + if (keys == null) + return; + Hashtable newMap = new Hashtable(); + for (int i = 0; i < keys.length; i++) + newMap.put(keys[i], map.get(keys[i])); + map = newMap; + keys = null; + } + + public PropertyMap toPropertyMap() { + lock(); + return new PropertyMapImpl(map, keys); + } + + public Object put(PropertyId id, Object value) { + copyIfLocked(); + if (value == null) + return map.remove(id); + if (!id.getValueClass().isInstance(value)) + throw new ClassCastException(); + return map.put(id, value); + } + + public Object get(PropertyId pid) { + return map.get(pid); + } + + public boolean contains(PropertyId pid) { + return map.get(pid) != null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Service.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Service.java new file mode 100644 index 0000000..49a6597 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Service.java @@ -0,0 +1,213 @@ +package com.thaiopensource.util; + +import java.util.Enumeration; +import java.util.NoSuchElementException; +import java.util.Vector; +import java.io.Reader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URL; + +public class Service { + private final Class serviceClass; + private final Enumeration configFiles; + private Enumeration classNames = null; + private final Vector providers = new Vector(); + private Loader loader; + + private class ProviderEnumeration implements Enumeration { + private int nextIndex = 0; + + public boolean hasMoreElements() { + return nextIndex < providers.size() || moreProviders(); + } + + public Object nextElement() { + try { + return providers.elementAt(nextIndex++); + } + catch (ArrayIndexOutOfBoundsException e) { + throw new NoSuchElementException(); + } + } + } + + private static class Singleton implements Enumeration { + private Object obj; + private Singleton(Object obj) { + this.obj = obj; + } + + public boolean hasMoreElements() { + return obj != null; + } + + public Object nextElement() { + if (obj == null) + throw new NoSuchElementException(); + Object tem = obj; + obj = null; + return tem; + } + } + + // JDK 1.1 + private static class Loader { + Enumeration getResources(String resName) { + ClassLoader cl = Loader.class.getClassLoader(); + URL url; + if (cl == null) + url = ClassLoader.getSystemResource(resName); + else + url = cl.getResource(resName); + return new Singleton(url); + } + + Class loadClass(String name) throws ClassNotFoundException { + return Class.forName(name); + } + } + + // JDK 1.2+ + private static class Loader2 extends Loader { + private ClassLoader cl; + + Loader2() { + cl = Loader2.class.getClassLoader(); + // If the thread context class loader has the class loader + // of this class as an ancestor, use the thread context class + // loader. Otherwise, the thread context class loader + // probably hasn't been set up properly, so don't use it. + ClassLoader clt = Thread.currentThread().getContextClassLoader(); + for (ClassLoader tem = clt; tem != null; tem = tem.getParent()) + if (tem == cl) { + cl = clt; + break; + } + } + + Enumeration getResources(String resName) { + try { + Enumeration resources = cl.getResources(resName); + if (resources.hasMoreElements()) + return resources; + // Some application servers apparently do not implement findResources + // in their class loaders, so fall back to getResource. + return new Singleton(cl.getResource(resName)); + } + catch (IOException e) { + return new Singleton(null); + } + } + + Class loadClass(String name) throws ClassNotFoundException { + return Class.forName(name, true, cl); + } + } + + public Service(Class cls) { + try { + loader = new Loader2(); + } + catch (NoSuchMethodError e) { + loader = new Loader(); + } + serviceClass = cls; + String resName = "META-INF/services/" + serviceClass.getName(); + configFiles = loader.getResources(resName); + } + + public Enumeration getProviders() { + return new ProviderEnumeration(); + } + + synchronized private boolean moreProviders() { + for (;;) { + while (classNames == null) { + if (!configFiles.hasMoreElements()) + return false; + classNames = parseConfigFile((URL)configFiles.nextElement()); + } + while (classNames.hasMoreElements()) { + String className = (String)classNames.nextElement(); + try { + Class cls = loader.loadClass(className); + Object obj = cls.newInstance(); + if (serviceClass.isInstance(obj)) { + providers.addElement(obj); + return true; + } + } + catch (ClassNotFoundException e) { } + catch (InstantiationException e) { } + catch (IllegalAccessException e) { } + catch (LinkageError e) { } + } + classNames = null; + } + } + + private static final int START = 0; + private static final int IN_NAME = 1; + private static final int IN_COMMENT = 2; + + private static Enumeration parseConfigFile(URL url) { + try { + InputStream in = url.openStream(); + Reader r; + try { + r = new InputStreamReader(in, "UTF-8"); + } + catch (UnsupportedEncodingException e) { + r = new InputStreamReader(in, "UTF8"); + } + r = new BufferedReader(r); + Vector tokens = new Vector(); + StringBuffer tokenBuf = new StringBuffer(); + int state = START; + for (;;) { + int n = r.read(); + if (n < 0) + break; + char c = (char)n; + switch (c) { + case '\r': + case '\n': + state = START; + break; + case ' ': + case '\t': + break; + case '#': + state = IN_COMMENT; + break; + default: + if (state != IN_COMMENT) { + state = IN_NAME; + tokenBuf.append(c); + } + break; + } + if (tokenBuf.length() != 0 && state != IN_NAME) { + tokens.addElement(tokenBuf.toString()); + tokenBuf.setLength(0); + } + } + if (tokenBuf.length() != 0) + tokens.addElement(tokenBuf.toString()); + return tokens.elements(); + } + catch (IOException e) { + return null; + } + } + + public static void main(String[] args) throws ClassNotFoundException { + Service svc = new Service(Class.forName(args[0])); + for (Enumeration e = svc.getProviders(); e.hasMoreElements();) + System.out.println(e.nextElement().getClass().getName()); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/SinglePropertyMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/SinglePropertyMap.java new file mode 100644 index 0000000..8c1013b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/SinglePropertyMap.java @@ -0,0 +1,36 @@ +package com.thaiopensource.util; + +public class SinglePropertyMap implements PropertyMap { + private final PropertyId pid; + private final Object value; + + public SinglePropertyMap(PropertyId pid, Object value) { + if (!(pid.getValueClass().isInstance(value))) { + if (value == null) + throw new NullPointerException(); + throw new ClassCastException(); + } + this.pid = pid; + this.value = value; + } + + public Object get(PropertyId pid) { + if (pid != this.pid) + return null; + return value; + } + + public boolean contains(PropertyId pid) { + return pid == this.pid; + } + + public int size() { + return 1; + } + + public PropertyId getKey(int i) { + if (i != 0) + throw new IndexOutOfBoundsException(); + return pid; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Uri.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Uri.java new file mode 100644 index 0000000..f894b9a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Uri.java @@ -0,0 +1,149 @@ +package com.thaiopensource.util; + +import java.net.URL; +import java.net.MalformedURLException; +import java.io.UnsupportedEncodingException; + +public class Uri { + private static String utf8 = "UTF-8"; + + public static boolean isValid(String s) { + return isValidPercent(s) && isValidFragment(s) && isValidScheme(s); + } + + private static final String HEX_DIGITS = "0123456789abcdef"; + + public static String escapeDisallowedChars(String s) { + StringBuffer buf = null; + int len = s.length(); + int done = 0; + for (;;) { + int i = done; + for (;;) { + if (i == len) { + if (done == 0) + return s; + break; + } + if (isExcluded(s.charAt(i))) + break; + i++; + } + if (buf == null) + buf = new StringBuffer(); + if (i > done) { + buf.append(s.substring(done, i)); + done = i; + } + if (i == len) + break; + for (i++; i < len && isExcluded(s.charAt(i)); i++) + ; + String tem = s.substring(done, i); + byte[] bytes; + try { + bytes = tem.getBytes(utf8); + } + catch (UnsupportedEncodingException e) { + utf8 = "UTF8"; + try { + bytes = tem.getBytes(utf8); + } + catch (UnsupportedEncodingException e2) { + // Give up + return s; + } + } + for (int j = 0; j < bytes.length; j++) { + buf.append('%'); + buf.append(HEX_DIGITS.charAt((bytes[j] & 0xFF) >> 4)); + buf.append(HEX_DIGITS.charAt(bytes[j] & 0xF)); + } + done = i; + } + return buf.toString(); + } + + private static final String excluded = "<>\"{}|\\^`"; + + private static boolean isExcluded(char c) { + return c <= 0x20 || c >= 0x7F || excluded.indexOf(c) >= 0; + } + + private static boolean isAlpha(char c) { + return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); + } + + private static boolean isHexDigit(char c) { + return ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || isDigit(c); + } + + private static boolean isDigit(char c) { + return '0' <= c && c <= '9'; + } + + private static boolean isSchemeChar(char c) { + return isAlpha(c) || isDigit(c) || c == '+' || c == '-' || c =='.'; + } + + private static boolean isValidPercent(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) + if (s.charAt(i) == '%') { + if (i + 2 >= len) + return false; + else if (!isHexDigit(s.charAt(i + 1)) + || !isHexDigit(s.charAt(i + 2))) + return false; + } + return true; + } + + private static boolean isValidFragment(String s) { + int i = s.indexOf('#'); + return i < 0 || s.indexOf('#', i + 1) < 0; + } + + private static boolean isValidScheme(String s) { + if (!isAbsolute(s)) + return true; + int i = s.indexOf(':'); + if (i == 0 + || i + 1 == s.length() + || !isAlpha(s.charAt(0))) + return false; + while (--i > 0) + if (!isSchemeChar(s.charAt(i))) + return false; + return true; + } + + public static String resolve(String baseUri, String uriReference) { + if (!isAbsolute(uriReference) && baseUri != null && isAbsolute(baseUri)) { + try { + return new URL(new URL(baseUri), uriReference).toString(); + } + catch (MalformedURLException e) { } + } + return uriReference; + } + + public static boolean hasFragmentId(String uri) { + return uri.indexOf('#') >= 0; + } + + public static boolean isAbsolute(String uri) { + int i = uri.indexOf(':'); + if (i < 0) + return false; + while (--i >= 0) { + switch (uri.charAt(i)) { + case '#': + case '/': + case '?': + return false; + } + } + return true; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/UriOrFile.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/UriOrFile.java new file mode 100644 index 0000000..00dfcff --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/UriOrFile.java @@ -0,0 +1,80 @@ +package com.thaiopensource.util; + +import java.net.URL; +import java.net.MalformedURLException; +import java.io.File; + +public class UriOrFile { + private UriOrFile() { + } + + public static String toUri(String uriOrFile) { + if (!hasScheme(uriOrFile)) { + try { + return fileToUri(uriOrFile); + } + catch (MalformedURLException e) { } + } + return uriOrFile; + } + + private static boolean hasScheme(String str) { + int len = str.length(); + if (len == 0) + return false; + if (!isAlpha(str.charAt(0))) + return false; + for (int i = 1; i < len; i++) { + char c = str.charAt(i); + switch (c) { + case ':': + // Don't recognize single letters as schemes + return i == 1 ? false : true; + case '+': + case '-': + break; + default: + if (!isAlnum(c)) + return false; + break; + } + } + return false; + } + + private static boolean isAlpha(char c) { + return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); + } + + private static boolean isAlnum(char c) { + return isAlpha(c) || ('0' <= c && c <= '9'); + } + + public static String fileToUri(String file) throws MalformedURLException { + return fileToUri(new File(file)); + } + + public static String fileToUri(File file) throws MalformedURLException { + String path = file.getAbsolutePath().replace(File.separatorChar, '/'); + if (path.length() > 0 && path.charAt(0) != '/') + path = '/' + path; + return new URL("file", "", path).toString(); + } + + public static String uriToUriOrFile(String uri) { + if (!uri.startsWith("file:")) + return uri; + uri = uri.substring(5); + int nSlashes = 0; + while (nSlashes < uri.length() && uri.charAt(nSlashes) == '/') + nSlashes++; + File f = new File(uri.substring(nSlashes).replace('/', File.separatorChar)); + if (f.isAbsolute()) + return f.toString(); + return uri.replace('/', File.separatorChar); + } + + static public void main(String[] args) { + System.err.println(uriToUriOrFile(args[0])); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Utf16.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Utf16.java new file mode 100644 index 0000000..7b5f4d0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Utf16.java @@ -0,0 +1,24 @@ +package com.thaiopensource.util; + +public abstract class Utf16 { + // 110110XX XXXXXX 110111XX XXXXXX + static public boolean isSurrogate(char c) { + return (c & 0xF800) == 0xD800; + } + static public boolean isSurrogate1(char c) { + return (c & 0xFC00) == 0xD800; + } + static public boolean isSurrogate2(char c) { + return (c & 0xFC00) == 0xDC00; + } + static public int scalarValue(char c1, char c2) { + return (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; + } + static public char surrogate1(int c) { + return (char)(((c - 0x10000) >> 10) | 0xD800); + } + static public char surrogate2(int c) { + return (char)(((c - 0x10000) & 0x3FF) | 0xDC00); + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Version.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Version.java new file mode 100644 index 0000000..bca7890 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/util/Version.java @@ -0,0 +1,28 @@ +package com.thaiopensource.util; + +import java.io.InputStream; +import java.io.IOException; +import java.util.Properties; +import java.util.MissingResourceException; + +public class Version { + private Version() { } + + public static String getVersion(Class cls) { + InputStream in = cls.getResourceAsStream("resources/Version.properties"); + if (in != null) { + Properties props = new Properties(); + try { + props.load(in); + String version = props.getProperty("version"); + if (version != null) + return version; + } + catch (IOException e) { } + } + throw new MissingResourceException("no version property", + cls.getName(), + "version"); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/AbstractSchema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/AbstractSchema.java new file mode 100644 index 0000000..813d045 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/AbstractSchema.java @@ -0,0 +1,35 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMapBuilder; + +public abstract class AbstractSchema implements Schema { + private final PropertyMap properties; + + public AbstractSchema() { + this(PropertyMap.EMPTY); + } + + public AbstractSchema(PropertyMap properties) { + this.properties = properties; + } + + public AbstractSchema(PropertyMap properties, PropertyId[] supportedPropertyIds) { + this(filterProperties(properties, supportedPropertyIds)); + } + + public PropertyMap getProperties() { + return properties; + } + + static public PropertyMap filterProperties(PropertyMap properties, PropertyId[] supportedPropertyIds) { + PropertyMapBuilder builder = new PropertyMapBuilder(); + for (int i = 0; i < supportedPropertyIds.length; i++) { + Object value = properties.get(supportedPropertyIds[i]); + if (value != null) + builder.put(supportedPropertyIds[i], value); + } + return builder.toPropertyMap(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Flag.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Flag.java new file mode 100644 index 0000000..442b99e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Flag.java @@ -0,0 +1,14 @@ +package com.thaiopensource.validate; + +/** + * A class with a unique value, used as the value of properties whose + * significance is purely whether or not they are present in the + * PropertyMap. + */ +public class Flag { + private Flag() { } + /** + * The unique value of this class. + */ + public static final Flag PRESENT = new Flag(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagOption.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagOption.java new file mode 100644 index 0000000..f0631b6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagOption.java @@ -0,0 +1,24 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyId; + +public class FlagOption implements Option { + private final FlagPropertyId pid; + public FlagOption(FlagPropertyId pid) { + this.pid = pid; + } + + public PropertyId getPropertyId() { + return pid; + } + + public Object valueOf(String arg) throws OptionArgumentException { + if (arg != null) + throw new OptionArgumentPresenceException(); + return Flag.PRESENT; + } + + public Object combine(Object[] values) { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagPropertyId.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagPropertyId.java new file mode 100644 index 0000000..a4c0a76 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/FlagPropertyId.java @@ -0,0 +1,29 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.validate.Flag; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMapBuilder; + +/** + * A PropertyId whose value is not significant. Its significance + * rests purely on whether it is present in a PropertyMap. The + * value is constrained to be Flag.PRESENT. + * + * @see Flag + */ +public class FlagPropertyId extends PropertyId { + public FlagPropertyId(String name) { + super(name, Flag.class); + } + + /** + * Adds this property to a PropertyMapBuilder. Modifies + * the PropertyMapBuilder so that this PropertyId is + * mapped to Flag.PRESENT. + * + * @param builder the PropertyMapBuilder to be modified + */ + public void add(PropertyMapBuilder builder) { + builder.put(this, Flag.PRESENT); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/IncorrectSchemaException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/IncorrectSchemaException.java new file mode 100644 index 0000000..d35d2a2 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/IncorrectSchemaException.java @@ -0,0 +1,13 @@ +package com.thaiopensource.validate; + +/** + * Thrown to indicate an XML document is not a correct schema, either because the + * XML document is not well-formed or because it fails to be correct in some other + * way. + * + * @see SchemaReader#createSchema + * + * @author James Clark + */ +public class IncorrectSchemaException extends Exception { +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Option.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Option.java new file mode 100644 index 0000000..05c72a5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Option.java @@ -0,0 +1,18 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyId; + +public interface Option { + PropertyId getPropertyId(); + Object valueOf(String arg) throws OptionArgumentException; + /** + * Combines multiple values of an option into a single value. A property + * whose value is logically a sequence may be represented by multiple options + * each representing a single member of the sequence. + * + * @param values an array of values to be combined + * @return an Object representing the combination, or null + * if they cannot be combined + */ + Object combine(Object[] values); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentException.java new file mode 100644 index 0000000..db32af0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentException.java @@ -0,0 +1,10 @@ +package com.thaiopensource.validate; + +public class OptionArgumentException extends Exception { + public OptionArgumentException() { + } + + public OptionArgumentException(String message) { + super(message); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentFormatException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentFormatException.java new file mode 100644 index 0000000..99eca1c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentFormatException.java @@ -0,0 +1,10 @@ +package com.thaiopensource.validate; + +public class OptionArgumentFormatException extends OptionArgumentException { + public OptionArgumentFormatException() { + } + + public OptionArgumentFormatException(String message) { + super(message); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentPresenceException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentPresenceException.java new file mode 100644 index 0000000..6c54f42 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/OptionArgumentPresenceException.java @@ -0,0 +1,6 @@ +package com.thaiopensource.validate; + +public class OptionArgumentPresenceException extends OptionArgumentException { + public OptionArgumentPresenceException() { + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Schema.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Schema.java new file mode 100644 index 0000000..3b12d75 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Schema.java @@ -0,0 +1,33 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyMap; + +/** + * A schema that can be used to validate an XML document. A single Schema object + * is safe for concurrent access by multiple threads. + * + * @see SchemaReader + * @see Validator + * + * @author James Clark + */ +public interface Schema { + /** + * Creates a new Validator that can be used to validate XML documents with + * respect to this schema. The PropertyMap should contain a + * ValidateProperty.ERROR_HANDLER property, which will be + * used to report errors. If it does not, then an ErrorHandler + * will be used that ignores warnings and throws its argument on errors and fatal errors. + * Common properties are defined in ValidateProperty. Implementations + * may support additional properties. + * + * @param properties a PropertyMap specifying the properties of the + * Validator to be created + * @return a new Validator that can be used to validate an XML document + * with respect to this schema; never null + * + * @see ValidateProperty#ERROR_HANDLER + */ + Validator createValidator(PropertyMap properties); + PropertyMap getProperties(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReader.java new file mode 100644 index 0000000..44ea048 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReader.java @@ -0,0 +1,34 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.IncorrectSchemaException; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import java.io.IOException; + +/** + * A SchemaReader object is immutable and can thus be safely accessed + * concurrently from multiple threads. + */ +public interface SchemaReader { + public static final String BASE_URI = "http://www.thaiopensource.com/validate/"; + /** + * Creates a Schema by reading it from an InputSource. + * + * @param in the InputSource from which to read the schema; + * must not be null + * @param properties a PropertyMap to control the schema creation; + * must not be null + * @return a newly created Schema, never null + * @throws IOException if an I/O error occurs + * @throws SAXException + * @throws IncorrectSchemaException + * + * @see ValidateProperty + */ + Schema createSchema(InputSource in, PropertyMap properties) + throws IOException, SAXException, IncorrectSchemaException; + + Option getOption(String uri); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderFactory.java new file mode 100644 index 0000000..5b4a06f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderFactory.java @@ -0,0 +1,29 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.validate.SchemaReader; + +/** + * A factory for SchemaReader. A class that implements this interface can be + * automatically discovered by SchemaReaderLoader, if it has + * a 0-argument constructor and if its name is listed in the file + * META-INF/services/com.thaiopensource.validate.SchemaReaderFactory. + * + * @see SchemaReaderLoader + * @see SchemaReader + */ +public interface SchemaReaderFactory { + /** + * Creates a SchemaReader for a particular schema language. + * + * @param namespaceUri a String identifing the schema language; must not be null; + * for schema languages that use XML, this should be the namespace URI + * of the root element if the root element has a non-absent namespace URI + * + * @return a SchemaReader for the specified schema language, or null, + * if this SchemaReaderFactory cannot create a SchemaReader for the specified + * schema language + */ + public SchemaReader createSchemaReader(String namespaceUri); + + Option getOption(String uri); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderLoader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderLoader.java new file mode 100644 index 0000000..4ac88d6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/SchemaReaderLoader.java @@ -0,0 +1,35 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.util.Service; + +import java.util.Enumeration; +/** + * A SchemaReaderFactory that automatically discovers SchemaReader implementations. + * For a SchemeaReader implementation to be discoverable by this class, it must have + * a factory class with a no-argument constructor implementing SchemaReaderFactory, + * and the fully-qualified name of this factory class must be listed in the file + * META-INF/services/com.thaiopensource.validate.SchemaReaderFactory. + */ +public class SchemaReaderLoader implements SchemaReaderFactory { + private final Service service = new Service(SchemaReaderFactory.class); + public SchemaReader createSchemaReader(String namespaceUri) { + for (Enumeration enumList = service.getProviders(); enumList.hasMoreElements();) { + SchemaReaderFactory srf = (SchemaReaderFactory)enumList.nextElement(); + SchemaReader sr = srf.createSchemaReader(namespaceUri); + if (sr != null) + return sr; + } + return null; + } + + public Option getOption(String uri) { + for (Enumeration enumList = service.getProviders(); enumList.hasMoreElements();) { + SchemaReaderFactory srf = (SchemaReaderFactory)enumList.nextElement(); + Option option = srf.getOption(uri); + if (option != null) + return option; + } + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringOption.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringOption.java new file mode 100644 index 0000000..1e764e6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringOption.java @@ -0,0 +1,33 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyId; + +public class StringOption implements Option { + private final StringPropertyId pid; + + public StringOption(StringPropertyId pid) { + this.pid = pid; + } + + public PropertyId getPropertyId() { + return pid; + } + + public Object valueOf(String arg) throws OptionArgumentException { + if (arg == null) + return defaultValue(); + return normalize(arg); + } + + public String defaultValue() throws OptionArgumentPresenceException { + throw new OptionArgumentPresenceException(); + } + + public String normalize(String value) throws OptionArgumentFormatException { + return value; + } + + public Object combine(Object[] values) { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringPropertyId.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringPropertyId.java new file mode 100644 index 0000000..3ae8d50 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/StringPropertyId.java @@ -0,0 +1,47 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; + +/** + * A PropertyId whose value is constrained to be an instance of + * String. + * + * @see String + */ + +public class StringPropertyId extends PropertyId { + public StringPropertyId(String name) { + super(name, String.class); + } + + /** + * Returns the value of the property. This is a typesafe + * version of PropertyMap.get. + * + * @param properties the PropertyMap to be used + * @return the String to which the PropertyMap maps this PropertyId, + * or null if this PropertyId is not in the PropertyMap + * @see com.thaiopensource.util.PropertyMap#get + */ + public String get(PropertyMap properties) { + return (String)properties.get(this); + } + + /** + * Sets the value of the property. Modifies the PropertyMapBuilder + * so that this PropertyId is mapped to the specified value. This + * is a typesafe version of PropertyMapBuilder.put. + * + * @param builder the PropertyMapBuilder to be modified + * @param value the String to which this PropertyId is to be mapped + * @return the String to which this PropertyId was mapped before, + * or null if it was not mapped + * + * @see com.thaiopensource.util.PropertyMapBuilder#put + */ + public String put(PropertyMapBuilder builder, String value) { + return (String)builder.put(this, value); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidateProperty.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidateProperty.java new file mode 100644 index 0000000..23c2f28 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidateProperty.java @@ -0,0 +1,169 @@ +package com.thaiopensource.validate; + +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.ErrorHandler; +import org.xml.sax.EntityResolver; + +/** + * Provides common properties to control reading schemas and validation. + * + * @see Schema#createValidator + * @see SchemaReader#createSchema + * @see PropertyMap + * @see PropertyId + * @see com.thaiopensource.validate.rng.RngProperty + * @see com.thaiopensource.validate.schematron.SchematronProperty + */ +public class ValidateProperty { + /** + * Property specifying ErrorHandler to be used for reporting errors. The value + * to which this PropertyId maps must be an instance of ErrorHandler. + * + * @see ErrorHandler + */ + public static final ErrorHandlerPropertyId ERROR_HANDLER = new ErrorHandlerPropertyId("ERROR_HANDLER"); + + /** + * Property specifying EntityResolver to be used for resolving entities. The value + * to which this PropertyId maps must be an instance of EntityResolver. + * + * @see EntityResolver + */ + public static final EntityResolverPropertyId ENTITY_RESOLVER = new EntityResolverPropertyId("ENTITY_RESOLVER"); + + /** + * Property specifying XMLReaderCreator used to create XMLReader objects needed for + * parsing XML documents. The value to which this PropertyId maps must be an + * instance of XMLReaderCreator. + */ + public static final XMLReaderCreatorPropertyId XML_READER_CREATOR + = new XMLReaderCreatorPropertyId("XML_READER_CREATOR"); + + private ValidateProperty() { } + + /** + * A PropertyId whose value is constrained to be an instance of + * ErrorHandler. + * + * @see ErrorHandler + */ + public static class ErrorHandlerPropertyId extends PropertyId { + public ErrorHandlerPropertyId(String name) { + super(name, ErrorHandler.class); + } + + /** + * Returns the value of the property. This is a typesafe + * version of PropertyMap.get. + * + * @param properties the PropertyMap to be used + * @return the ErrorHandler to which the PropertyMap maps this PropertyId, + * or null if this PropertyId is not in the PropertyMap + * @see PropertyMap#get + */ + public ErrorHandler get(PropertyMap properties) { + return (ErrorHandler)properties.get(this); + } + + /** + * Sets the value of the property. Modifies the PropertyMapBuilder + * so that this PropertyId is mapped to the specified value. This + * is a typesafe version of PropertyMapBuilder.put. + * + * @param builder the PropertyMapBuilder to be modified + * @param value the ErrorHandler to which this PropertyId is to be mapped + * @return the ErrorHandler to which this PropertyId was mapped before, + * or null if it was not mapped + * + * @see PropertyMapBuilder#put + */ + public ErrorHandler put(PropertyMapBuilder builder, ErrorHandler value) { + return (ErrorHandler)builder.put(this, value); + } + } + + /** + * A PropertyId whose value is constrained to be an instance of + * EntityResolver. + * + * @see EntityResolver + */ + public static class EntityResolverPropertyId extends PropertyId { + public EntityResolverPropertyId(String name) { + super(name, EntityResolver.class); + } + + /** + * Returns the value of the property. This is a typesafe + * version of PropertyMap.get. + * + * @param properties the PropertyMap to be used + * @return the EntityResolver to which the PropertyMap maps this PropertyId, + * or null if this PropertyId is not in the PropertyMap + * @see PropertyMap#get + */ + public EntityResolver get(PropertyMap properties) { + return (EntityResolver)properties.get(this); + } + + /** + * Sets the value of the property. Modifies the PropertyMapBuilder + * so that this PropertyId is mapped to the specified value. This + * is a typesafe version of PropertyMapBuilder.put. + * + * @param builder the PropertyMapBuilder to be modified + * @param value the EntityResolver to which this PropertyId is to be mapped + * @return the EntityResolver to which this PropertyId was mapped before, + * or null if it was not mapped + * + * @see PropertyMapBuilder#put + */ + public EntityResolver put(PropertyMapBuilder builder, EntityResolver value) { + return (EntityResolver)builder.put(this, value); + } + } + + /** + * A PropertyId whose value is constrained to be an instance of + * XMLReaderCreator. + * + * @see XMLReaderCreator + */ + public static class XMLReaderCreatorPropertyId extends PropertyId { + public XMLReaderCreatorPropertyId(String name) { + super(name, XMLReaderCreator.class); + } + + /** + * Returns the value of the property. This is a typesafe + * version of PropertyMap.get. + * + * @param properties the PropertyMap to be used + * @return the XMLReaderCreator to which the PropertyMap maps this PropertyId, + * or null if this PropertyId is not in the PropertyMap + * @see PropertyMap#get + */ + public XMLReaderCreator get(PropertyMap properties) { + return (XMLReaderCreator)properties.get(this); + } + + /** + * Sets the value of the property. Modifies the PropertyMapBuilder + * so that this PropertyId is mapped to the specified value. This + * is a typesafe version of PropertyMapBuilder.put. + * + * @param builder the PropertyMapBuilder to be modified + * @param value the XMLReaderCreator to which this PropertyId is to be mapped + * @return the XMLReaderCreator to which this PropertyId was mapped before, + * or null if it was not mapped + * + * @see PropertyMapBuilder#put + */ + public XMLReaderCreator put(PropertyMapBuilder builder, XMLReaderCreator value) { + return (XMLReaderCreator)builder.put(this, value); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidationDriver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidationDriver.java new file mode 100644 index 0000000..189f8a3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/ValidationDriver.java @@ -0,0 +1,221 @@ +package com.thaiopensource.validate; + +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; +import org.xml.sax.DTDHandler; +import org.xml.sax.XMLReader; +import org.xml.sax.ErrorHandler; + +import java.io.IOException; +import java.io.File; +import java.net.MalformedURLException; + +import com.thaiopensource.util.UriOrFile; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.xml.sax.CountingErrorHandler; +import com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator; +import com.thaiopensource.xml.sax.ErrorHandlerImpl; +import com.thaiopensource.validate.auto.AutoSchemaReader; + +/** + * Provides a simplified API for validating XML documents against schemas. + * This class is neither reentrant nor safe for access from multiple threads. + * + * @author James Clark + */ + +public class ValidationDriver { + private static final PropertyId[] requiredProperties = { + ValidateProperty.XML_READER_CREATOR, + ValidateProperty.ERROR_HANDLER + }; + + private static final Class[] defaultClasses = { + Jaxp11XMLReaderCreator.class, + ErrorHandlerImpl.class + }; + + private final XMLReaderCreator xrc; + private XMLReader xr; + private final CountingErrorHandler eh; + private final SchemaReader sr; + private final PropertyMap schemaProperties; + private final PropertyMap instanceProperties; + private Validator validator; + private Schema schema; + + /** + * Creates and initializes a ValidationDriver. + * + * @param schemaProperties a PropertyMap specifying properties controlling schema creation; + * must not be null + * @param instanceProperties a PropertyMap specifying properties controlling validation; + * must not be null + * @param schemaReader the SchemaReader to use; if this is null, then the schema + * must be in XML, and the namespace URI of the root element will be used to determine what + * the schema language is + */ + public ValidationDriver(PropertyMap schemaProperties, + PropertyMap instanceProperties, + SchemaReader schemaReader) { + PropertyMapBuilder builder = new PropertyMapBuilder(schemaProperties); + for (int i = 0; i < requiredProperties.length; i++) { + if (!builder.contains(requiredProperties[i])) { + try { + builder.put(requiredProperties[i], + defaultClasses[i].newInstance()); + } + catch (InstantiationException e) { + } + catch (IllegalAccessException e) { + } + } + } + this.schemaProperties = builder.toPropertyMap(); + builder = new PropertyMapBuilder(instanceProperties); + for (int i = 0; i < requiredProperties.length; i++) { + if (!builder.contains(requiredProperties[i])) + builder.put(requiredProperties[i], + this.schemaProperties.get(requiredProperties[i])); + } + eh = new CountingErrorHandler((ErrorHandler)builder.get(ValidateProperty.ERROR_HANDLER)); + ValidateProperty.ERROR_HANDLER.put(builder, eh); + this.instanceProperties = builder.toPropertyMap(); + this.xrc = ValidateProperty.XML_READER_CREATOR.get(this.instanceProperties); + this.sr = schemaReader == null ? new AutoSchemaReader() : schemaReader; + } + + /** + * Equivalent to ValidationDriver(schemaProperties, instanceProperties, null). + * + * @see #ValidationDriver(PropertyMap,PropertyMap,SchemaReader) + */ + public ValidationDriver(PropertyMap schemaProperties, PropertyMap instanceProperties) { + this(schemaProperties, instanceProperties, null); + } + + /** + * Equivalent to ValidationDriver(properties, properties, sr). + * + * @see #ValidationDriver(PropertyMap,PropertyMap,SchemaReader) + */ + public ValidationDriver(PropertyMap properties, SchemaReader sr) { + this(properties, properties, sr); + } + + /** + * Equivalent to ValidationDriver(properties, properties, null). + * + * @see #ValidationDriver(PropertyMap,PropertyMap,SchemaReader) + */ + public ValidationDriver(PropertyMap properties) { + this(properties, properties, null); + } + + /** + * Equivalent to ValidationDriver(PropertyMap.EMPTY, PropertyMap.EMPTY, null). + * + * @see #ValidationDriver(PropertyMap,PropertyMap,SchemaReader) + */ + public ValidationDriver(SchemaReader sr) { + this(PropertyMap.EMPTY, sr); + } + + /** + * Equivalent to ValidationDriver(PropertyMap.EMPTY, PropertyMap.EMPTY, null). + * + * @see #ValidationDriver(PropertyMap,PropertyMap,SchemaReader) + */ + public ValidationDriver() { + this(PropertyMap.EMPTY, PropertyMap.EMPTY, null); + } + + /** + * Loads a schema. Subsequent calls to validate will validate with + * respect the loaded schema. This can be called more than once to allow + * multiple documents to be validated against different schemas. + * + * @param in the InputSource for the schema + * @return true if the schema was loaded successfully; false otherwise + * @throws IOException if an I/O error occurred + * @throws SAXException if an XMLReader or ErrorHandler threw a SAXException + */ + public boolean loadSchema(InputSource in) throws SAXException, IOException { + try { + schema = sr.createSchema(in, schemaProperties); + validator = null; + return true; + } + catch (IncorrectSchemaException e) { + return false; + } + } + + /** + * Validates a document against the currently loaded schema. This can be called + * multiple times in order to validate multiple documents. + * + * @param in the InputSource for the document to be validated + * @return true if the document is valid; false otherwise + * @throws java.lang.IllegalStateException if there is no currently loaded schema + * @throws java.io.IOException if an I/O error occurred + * @throws org.xml.sax.SAXException if an XMLReader or ErrorHandler threw a SAXException + */ + public boolean validate(InputSource in) throws SAXException, IOException { + if (schema == null) + throw new IllegalStateException("cannot validate without schema"); + if (validator == null) + validator = schema.createValidator(instanceProperties); + if (xr == null) { + xr = xrc.createXMLReader(); + xr.setErrorHandler(eh); + } + eh.reset(); + xr.setContentHandler(validator.getContentHandler()); + DTDHandler dh = validator.getDTDHandler(); + if (dh != null) + xr.setDTDHandler(dh); + try { + xr.parse(in); + return !eh.getHadErrorOrFatalError(); + } + finally { + validator.reset(); + } + } + + /** + * Returns an InputSource for a filename. + * + * @param filename a String specifying the filename + * @return an InputSource for the filename + */ + static public InputSource fileInputSource(String filename) throws MalformedURLException { + return ValidationDriver.fileInputSource(new File(filename)); + } + + /** + * Returns an InputSource for a File. + * + * @param file the File + * @return an InputSource for the filename + */ + static public InputSource fileInputSource(File file) throws MalformedURLException { + return new InputSource(UriOrFile.fileToUri(file)); + } + + /** + * Returns an InputSource for a string that represents either a file + * or an absolute URI. If the string looks like an absolute URI, it will be + * treated as an absolute URI, otherwise it will be treated as a filename. + * + * @param uriOrFile a String representing either a file or an absolute URI + * @return an InputSource for the file or absolute URI + */ + static public InputSource uriOrFileInputSource(String uriOrFile) throws MalformedURLException { + return new InputSource(UriOrFile.toUri(uriOrFile)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Validator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Validator.java new file mode 100644 index 0000000..47c77fa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/Validator.java @@ -0,0 +1,80 @@ +package com.thaiopensource.validate; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; + +/** + * Validates an XML document with respect to a schema. The schema is + * determined when the Validator is created and cannot be + * changed. The XML document is provided to the Validator + * by calling methods of the ContentHandler object returned + * by getContentHandler; the methods must be called in + * the sequence specified by the ContentHandler + * interface. If the getDTDHandler method returns + * a non-null object, then method calls must be made on it + * reporting DTD information. + * + *

Any errors will be reported to the ErrorHandler + * specified when the Validator was created. If, after the + * call to the endDocument method, no errors have been + * reported, then the XML document is valid. + * + *

A single Validator object is not safe for + * concurrent access from multiple threads. A single + * ValidatorHandler can be used to validate only a single + * document at a time. + * + *

After completing validation of an XML document (i.e. after calling + * the endDocument on the ContentHandler), + * reset can be called to allow validation of another + * document. The reset method may create new ContentHandler + * and DTDHandler objects or may simply reinitialize the + * state of the existing objects. Therefore, getContentHandler + * and getDTDHandler must be called after reset + * to retrieve the objects to which the XML document to be validated + * must be provided. + * + * @author James Clark + */ +public interface Validator { + /** + * Returns the ContentHandler that will receive the XML document. + * Information about the XML document to be validated must be + * reported by calling methods on the returned ContentHandler. + * When validation of an XML document has been completed (either + * endDocument() has been called or validation has been abandoned + * prematurely), reset() must be called. If no calls are made + * on the ContentHandler, then reset() need not be called. + * Implementations should allocate resources that require + * cleanup (e.g. threads, open files) lazily, typically + * in startDocument(). + * + * This method does not change the state of the Validator: the same + * object will always be returned unless reset is called. + * + * @see #reset() + * @return a ContentHandler, never null + */ + ContentHandler getContentHandler(); + + /** + * Returns a DTDHandler. Information about the DTD must be reported + * by calling methods on the returned object, unless null + * is returned. The same object will always be returned unless + * reset is called: this method does not change the state + * of the Validator. + * + * @return a DTDHandler, maybe null if DTD information is + * not significant to the Validator + */ + DTDHandler getDTDHandler(); + + /** + * Cleans up after validating a document. After completing validation + * of a document, reset must be called. After calling + * reset(), another document may be validated. Calling this method + * may create new ContentHandler and DTDHandler objects or may simply + * reinitialize the state of the existing objects. + */ + void reset(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReader.java new file mode 100644 index 0000000..22f241f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReader.java @@ -0,0 +1,95 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Option; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +public class AutoSchemaReader implements SchemaReader { + private final SchemaReceiverFactory srf; + + public AutoSchemaReader() { + this(new SchemaReceiverLoader()); + } + + public AutoSchemaReader(SchemaReceiverFactory srf) { + this.srf = srf == null ? new SchemaReceiverLoader() : srf; + } + + public Schema createSchema(InputSource in, PropertyMap properties) + throws IOException, SAXException, IncorrectSchemaException { + if (SchemaReceiverFactory.PROPERTY.get(properties) != srf) { + PropertyMapBuilder builder = new PropertyMapBuilder(properties); + SchemaReceiverFactory.PROPERTY.put(builder, srf); + properties = builder.toPropertyMap(); + } + InputSource in2 = new InputSource(); + in2.setSystemId(in.getSystemId()); + in2.setPublicId(in.getPublicId()); + in2.setEncoding(in.getEncoding()); + Rewindable rewindable; + if (in.getCharacterStream() != null) + throw new IllegalArgumentException("character stream input sources not supported for auto-detection"); + else { + InputStream byteStream = in.getByteStream(); + if (byteStream == null) { + String systemId = in.getSystemId(); + if (systemId == null) + throw new IllegalArgumentException("null systemId and null byteStream"); + byteStream = new URL(systemId).openStream(); + // XXX should use encoding from MIME header + } + RewindableInputStream rewindableByteStream = new RewindableInputStream(byteStream); + in.setByteStream(rewindableByteStream); + in2.setByteStream(rewindableByteStream); + rewindable = rewindableByteStream; + } + SchemaReceiver sr = new AutoSchemaReceiver(properties, rewindable); + XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties); + XMLReader xr = xrc.createXMLReader(); + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + if (eh != null) + xr.setErrorHandler(eh); + SchemaFuture sf = sr.installHandlers(xr); + try { + try { + xr.parse(in); + return sf.getSchema(); + } + catch (ReparseException e) { + rewindable.rewind(); + rewindable.willNotRewind(); + return e.reparse(in2); + } + finally { + rewindable.willNotRewind(); + } + } + catch (SAXException e) { + // Work around broken SAX parsers that catch and wrap runtime exceptions thrown by handlers + Exception nested = e.getException(); + if (nested instanceof RuntimeException) + sf.unwrapException((RuntimeException)nested); + throw e; + } + catch (RuntimeException e) { + throw sf.unwrapException(e); + } + } + + public Option getOption(String uri) { + return srf.getOption(uri); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReceiver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReceiver.java new file mode 100644 index 0000000..24a269c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/AutoSchemaReceiver.java @@ -0,0 +1,96 @@ +package com.thaiopensource.validate.auto; + +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; +import org.xml.sax.Locator; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +import java.io.IOException; +import java.util.Vector; + +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyMap; + +public class AutoSchemaReceiver implements SchemaReceiver { + private final PropertyMap properties; + private final Rewindable rewindable; + + private class Handler extends DefaultHandler implements SchemaFuture { + private final XMLReader xr; + private SchemaFuture sf = null; + private Locator locator = null; + private final Vector prefixMappings = new Vector(); + + private Handler(XMLReader xr) { + this.xr = xr; + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void startPrefixMapping(String prefix, String uri) { + prefixMappings.addElement(prefix); + prefixMappings.addElement(uri); + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + SchemaReceiverFactory srf = SchemaReceiverFactory.PROPERTY.get(properties); + SchemaReceiver sr = srf.createSchemaReceiver(uri, properties); + if (sr == null) { + Localizer localizer = new Localizer(AutoSchemaReceiver.class); + String detail = ("".equals(uri) + ? localizer.message("no_namespace") + : localizer.message("unknown_namespace", uri)); + throw new SAXParseException(detail, locator); + } + sf = sr.installHandlers(xr); + rewindable.willNotRewind(); + ContentHandler contentHandler = xr.getContentHandler(); + if (contentHandler == null) + return; + if (locator != null) { + contentHandler.setDocumentLocator(locator); + contentHandler = xr.getContentHandler(); + } + contentHandler.startDocument(); + contentHandler = xr.getContentHandler(); + for (int i = 0, len = prefixMappings.size(); i < len; i += 2) { + contentHandler.startPrefixMapping((String)prefixMappings.elementAt(i), + (String)prefixMappings.elementAt(i + 1)); + contentHandler = xr.getContentHandler(); + } + contentHandler.startElement(uri, localName, qName, attributes); + } + + public Schema getSchema() throws IncorrectSchemaException, SAXException, IOException { + if (sf == null) + throw new IncorrectSchemaException(); + return sf.getSchema(); + } + + public RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException { + if (sf == null) + return e; + return sf.unwrapException(e); + } + } + + public AutoSchemaReceiver(PropertyMap properties, Rewindable rewindable) { + this.properties = properties; + this.rewindable = rewindable; + } + + public SchemaFuture installHandlers(XMLReader xr) { + Handler h = new Handler(xr); + xr.setContentHandler(h); + return h; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/ReparseException.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/ReparseException.java new file mode 100644 index 0000000..81b1668 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/ReparseException.java @@ -0,0 +1,16 @@ +package com.thaiopensource.validate.auto; + +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.IncorrectSchemaException; + +import java.io.IOException; + +public abstract class ReparseException extends SAXException { + public ReparseException() { + super((Exception)null); + } + + public abstract Schema reparse(InputSource in) throws IncorrectSchemaException, SAXException, IOException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/Rewindable.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/Rewindable.java new file mode 100644 index 0000000..ed0465c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/Rewindable.java @@ -0,0 +1,7 @@ +package com.thaiopensource.validate.auto; + +public interface Rewindable { + void willNotRewind(); + void rewind(); + boolean canRewind(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/RewindableInputStream.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/RewindableInputStream.java new file mode 100644 index 0000000..ffe9c92 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/RewindableInputStream.java @@ -0,0 +1,192 @@ +package com.thaiopensource.validate.auto; + +import java.io.InputStream; +import java.io.IOException; + +public class RewindableInputStream extends InputStream implements Rewindable { + static class Block { + Block next; + final byte[] buf; + int used = 0; + static final int MIN_SIZE = 1024; + Block(int minSize) { + buf = new byte[Math.max(MIN_SIZE, minSize)]; + } + + Block() { + this(0); + } + + void append(byte b) { + buf[used++] = b; + } + + void append(byte[] b, int off, int len) { + System.arraycopy(b, off, buf, used, len); + used += len; + } + } + + private Block head; + /** + * If curBlockAvail > 0, then there are curBlockAvail bytes available to be + * returned starting at curBlockPos in curBlock.buf. + */ + private int curBlockAvail; + private Block curBlock; + private int curBlockPos; + private Block lastBlock; + /** + * true unless willNotRewind has been called + */ + private boolean saving = true; + private final InputStream in; + private boolean pretendClosed = false; + /** + * true if we have got an EOF from the underlying InputStream + */ + private boolean eof; + + public RewindableInputStream(InputStream in) { + if (in == null) + throw new NullPointerException(); + this.in = in; + } + + public void close() throws IOException { + if (saving) { + curBlockAvail = 0; + curBlock = null; + pretendClosed = true; + } + else { + head = null; + curBlock = null; + lastBlock = null; + saving = false; + curBlockAvail = 0; + in.close(); + } + } + + public void rewind() { + if (!saving) + throw new IllegalStateException("rewind() after willNotRewind()"); + pretendClosed = false; + if (head == null) + return; + curBlock = head; + curBlockPos = 0; + curBlockAvail = curBlock.used; + } + + public boolean canRewind() { + return saving; + } + + public void willNotRewind() { + saving = false; + head = null; + lastBlock = null; + if (pretendClosed) { + pretendClosed = false; + try { + in.close(); + } + catch (IOException e) { } + } + } + + public int read() throws IOException { + if (curBlockAvail > 0) { + int c = curBlock.buf[curBlockPos++] & 0xFF; + --curBlockAvail; + if (curBlockAvail == 0) { + curBlock = curBlock.next; + if (curBlock != null) { + curBlockPos = 0; + curBlockAvail = curBlock.used; + } + } + return c; + } + int c = in.read(); + if (saving && c != -1) { + if (lastBlock == null) + lastBlock = head = new Block(); + else if (lastBlock.used == lastBlock.buf.length) + lastBlock = lastBlock.next = new Block(); + lastBlock.append((byte)c); + } + return c; + } + + public int read(byte b[], int off, int len) throws IOException { + if (curBlockAvail == 0 && !saving) + return in.read(b, off, len); + if (b == null) + throw new NullPointerException(); + if (len < 0) + throw new IndexOutOfBoundsException(); + int nRead = 0; + if (curBlockAvail != 0) { + for (;;) { + if (len == 0) + return nRead; + b[off++] = curBlock.buf[curBlockPos++]; + --len; + nRead++; + --curBlockAvail; + if (curBlockAvail == 0) { + curBlock = curBlock.next; + if (curBlock == null) + break; + curBlockAvail = curBlock.used; + curBlockPos = 0; + } + } + } + if (len == 0) + return nRead; + if (eof) + return nRead > 0 ? nRead : -1; + try { + int n = in.read(b, off, len); + if (n < 0) { + eof = true; + return nRead > 0 ? nRead : -1; + } + nRead += n; + if (saving) { + if (lastBlock == null) + lastBlock = head = new Block(n); + else if (lastBlock.buf.length - lastBlock.used < n) { + if (lastBlock.used != lastBlock.buf.length) { + int free = lastBlock.buf.length - lastBlock.used; + lastBlock.append(b, off, free); + off += free; + n -= free; + } + lastBlock = lastBlock.next = new Block(n); + } + lastBlock.append(b, off, n); + } + } + catch (IOException e) { + eof = true; + if (nRead == 0) + throw e; + } + return nRead; + } + + public int available() throws IOException { + if (curBlockAvail == 0) + return in.available(); + int n = curBlockAvail; + for (Block b = curBlock.next; b != null; b = b.next) + n += b.used; + return n + in.available(); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaFuture.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaFuture.java new file mode 100644 index 0000000..fabd895 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaFuture.java @@ -0,0 +1,13 @@ +package com.thaiopensource.validate.auto; + +import org.xml.sax.SAXException; + +import java.io.IOException; + +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.IncorrectSchemaException; + +public interface SchemaFuture { + Schema getSchema() throws IncorrectSchemaException, SAXException, IOException; + RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.java new file mode 100644 index 0000000..4562d17 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderFactorySchemaReceiverFactory.java @@ -0,0 +1,26 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.SchemaReaderFactory; +import com.thaiopensource.validate.Option; + +public class SchemaReaderFactorySchemaReceiverFactory implements SchemaReceiverFactory { + private final SchemaReaderFactory srf; + + public SchemaReaderFactorySchemaReceiverFactory(SchemaReaderFactory srf) { + this.srf = srf; + } + + public SchemaReceiver createSchemaReceiver(String namespaceUri, + PropertyMap properties) { + SchemaReader sr = srf.createSchemaReader(namespaceUri); + if (sr == null) + return null; + return new SchemaReaderSchemaReceiver(sr, properties); + } + + public Option getOption(String uri) { + return srf.getOption(uri); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.java new file mode 100644 index 0000000..97f2da4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderLoaderSchemaReceiverFactory.java @@ -0,0 +1,10 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.validate.SchemaReaderLoader; +import com.thaiopensource.validate.auto.SchemaReaderFactorySchemaReceiverFactory; + +public class SchemaReaderLoaderSchemaReceiverFactory extends SchemaReaderFactorySchemaReceiverFactory { + public SchemaReaderLoaderSchemaReceiverFactory() { + super(new SchemaReaderLoader()); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.java new file mode 100644 index 0000000..19de882 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReaderSchemaReceiver.java @@ -0,0 +1,31 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.auto.ReparseException; +import com.thaiopensource.validate.auto.SchemaFuture; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; + +public class SchemaReaderSchemaReceiver implements SchemaReceiver { + private final SchemaReader schemaLanguage; + private final PropertyMap properties; + + public SchemaReaderSchemaReceiver(SchemaReader schemaLanguage, PropertyMap properties) { + this.schemaLanguage = schemaLanguage; + this.properties = properties; + } + + public SchemaFuture installHandlers(XMLReader xr) throws SAXException { + throw new ReparseException() { + public Schema reparse(InputSource in) throws IncorrectSchemaException, SAXException, IOException { + return schemaLanguage.createSchema(in, properties); + } + }; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiver.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiver.java new file mode 100644 index 0000000..f130caa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiver.java @@ -0,0 +1,9 @@ +package com.thaiopensource.validate.auto; + +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import com.thaiopensource.validate.auto.SchemaFuture; + +public interface SchemaReceiver { + SchemaFuture installHandlers(XMLReader xr) throws SAXException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverFactory.java new file mode 100644 index 0000000..2b681f0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverFactory.java @@ -0,0 +1,30 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.Option; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMapBuilder; + +public interface SchemaReceiverFactory { + public static class SchemaReceiverFactoryPropertyId extends PropertyId { + public SchemaReceiverFactoryPropertyId(String name) { + super(name, SchemaReceiverFactory.class); + } + + public SchemaReceiverFactory get(PropertyMap properties) { + return (SchemaReceiverFactory)properties.get(this); + } + + public SchemaReceiverFactory put(PropertyMapBuilder builder, SchemaReceiverFactory value) { + return (SchemaReceiverFactory)builder.put(this, value); + } + } + + static final SchemaReceiverFactoryPropertyId PROPERTY + = new SchemaReceiverFactoryPropertyId("SCHEMA_RECEIVER_FACTORY"); + SchemaReceiver createSchemaReceiver(String namespaceUri, + PropertyMap properties); + Option getOption(String uri); + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverLoader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverLoader.java new file mode 100644 index 0000000..6af945e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/SchemaReceiverLoader.java @@ -0,0 +1,34 @@ +package com.thaiopensource.validate.auto; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.Service; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.validate.Option; + +import java.util.Enumeration; + +public class SchemaReceiverLoader implements SchemaReceiverFactory { + private final Service service = new Service(SchemaReceiverFactory.class); + public SchemaReceiver createSchemaReceiver(String namespaceUri, + PropertyMap properties) { + for (Enumeration enumList = service.getProviders(); enumList.hasMoreElements();) { + SchemaReceiverFactory srf = (SchemaReceiverFactory)enumList.nextElement(); + SchemaReceiver sr = srf.createSchemaReceiver(namespaceUri, properties); + if (sr != null) + return sr; + } + return null; + } + + public Option getOption(String uri) { + for (Enumeration enumList = service.getProviders(); enumList.hasMoreElements();) { + SchemaReceiverFactory srf = (SchemaReceiverFactory)enumList.nextElement(); + Option option = srf.getOption(uri); + if (option != null) + return option; + } + return null; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/resources/Messages.properties new file mode 100644 index 0000000..8e444b4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/auto/resources/Messages.properties @@ -0,0 +1,2 @@ +unknown_namespace=no implementation available for schema language with namespace URI \"{0}\" +no_namespace=root element of schema must have a namespace diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ContextMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ContextMap.java new file mode 100644 index 0000000..f22ff2f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ContextMap.java @@ -0,0 +1,59 @@ +package com.thaiopensource.validate.mns; + +import com.thaiopensource.xml.util.Name; + +import java.util.Vector; +import java.util.Hashtable; + +class ContextMap { + private Object rootValue; + private Object otherValue; + private final Hashtable nameTable = new Hashtable(); + + Object get(Vector context) { + return get(context, context.size()); + } + + boolean put(boolean isRoot, Vector names, Object value) { + return put(isRoot, names, names.size(), value); + } + + private Object get(Vector context, int len) { + if (len > 0) { + ContextMap nestedMap = (ContextMap)nameTable.get(context.elementAt(len - 1)); + if (nestedMap != null) { + Object value = nestedMap.get(context, len - 1); + if (value != null) + return value; + } + } + if (rootValue != null && len == 0) + return rootValue; + return otherValue; + } + + private boolean put(boolean isRoot, Vector names, int len, Object value) { + if (len == 0) { + if (isRoot) { + if (rootValue != null) + return false; + rootValue = value; + } + else { + if (otherValue != null) + return false; + otherValue = value; + } + return true; + } + else { + Name name = (Name)names.elementAt(len - 1); + ContextMap nestedMap = (ContextMap)nameTable.get(name); + if (nestedMap == null) { + nestedMap = new ContextMap(); + nameTable.put(name, nestedMap); + } + return nestedMap.put(isRoot, names, len - 1, value); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ElementsOrAttributes.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ElementsOrAttributes.java new file mode 100644 index 0000000..8f4d40f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ElementsOrAttributes.java @@ -0,0 +1,41 @@ +package com.thaiopensource.validate.mns; + +class ElementsOrAttributes { + private static final int ELEMENTS_FLAG = 01; + private static final int ATTRIBUTES_FLAG = 02; + + static final ElementsOrAttributes NEITHER = new ElementsOrAttributes(0); + static final ElementsOrAttributes ELEMENTS = new ElementsOrAttributes(ELEMENTS_FLAG); + static final ElementsOrAttributes ATTRIBUTES = new ElementsOrAttributes(ATTRIBUTES_FLAG); + static final ElementsOrAttributes BOTH = new ElementsOrAttributes(ELEMENTS_FLAG|ATTRIBUTES_FLAG); + + private static final ElementsOrAttributes values[] = { + NEITHER, + ELEMENTS, + ATTRIBUTES, + BOTH + }; + + private int flags = 0; + + private ElementsOrAttributes(int flags) { + this.flags = flags; + } + + ElementsOrAttributes addElements() { + return values[flags | ELEMENTS_FLAG]; + } + + ElementsOrAttributes addAttributes() { + return values[flags | ATTRIBUTES_FLAG]; + } + + boolean containsAttributes() { + return (flags & ATTRIBUTES_FLAG) != 0; + } + + boolean containsElements() { + return (flags & ELEMENTS_FLAG) != 0; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/Hashset.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/Hashset.java new file mode 100644 index 0000000..5182cdc --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/Hashset.java @@ -0,0 +1,19 @@ +package com.thaiopensource.validate.mns; + +import java.util.Hashtable; + +class Hashset { + private final Hashtable table = new Hashtable(); + + boolean contains(Object key) { + return table.get(key) != null; + } + + void add(Object key) { + table.put(key, key); + } + + void clear() { + table.clear(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.java new file mode 100644 index 0000000..d629b94 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/MnsSchemaReceiverFactory.java @@ -0,0 +1,18 @@ +package com.thaiopensource.validate.mns; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.validate.Option; + +public class MnsSchemaReceiverFactory implements SchemaReceiverFactory { + public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { + if (!SchemaImpl.MNS_URI.equals(namespaceUri)) + return null; + return new SchemaReceiverImpl(properties); + } + + public Option getOption(String uri) { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.java new file mode 100644 index 0000000..e0d23bd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/NamespaceFilteredAttributes.java @@ -0,0 +1,110 @@ +package com.thaiopensource.validate.mns; + +import org.xml.sax.Attributes; + +class NamespaceFilteredAttributes implements Attributes { + private final String ns; + private final boolean keepLocal; + private final Attributes attributes; + private final int[] indexMap; + private final int[] reverseIndexMap; + + public NamespaceFilteredAttributes(String ns, boolean keepLocal, Attributes attributes) { + this.ns = ns; + this.keepLocal = keepLocal; + this.attributes = attributes; + int n = 0; + for (int i = 0, len = attributes.getLength(); i < len; i++) + if (keepAttribute(attributes.getURI(i))) + n++; + indexMap = new int[n]; + reverseIndexMap = new int[attributes.getLength()]; + n = 0; + for (int i = 0, len = attributes.getLength(); i < len; i++) { + if (keepAttribute(attributes.getURI(i))) { + reverseIndexMap[i] = n; + indexMap[n++] = i; + } + else + reverseIndexMap[i] = -1; + } + } + + private boolean keepAttribute(String uri) { + return uri.equals(ns) || (keepLocal && uri.equals("")); + } + + public int getLength() { + return indexMap.length; + } + + public String getURI(int index) { + if (index < 0 || index >= indexMap.length) + return null; + return attributes.getURI(indexMap[index]); + } + + public String getLocalName(int index) { + if (index < 0 || index >= indexMap.length) + return null; + return attributes.getLocalName(indexMap[index]); + } + + public String getQName(int index) { + if (index < 0 || index >= indexMap.length) + return null; + return attributes.getQName(indexMap[index]); + } + + public String getType(int index) { + if (index < 0 || index >= indexMap.length) + return null; + return attributes.getType(indexMap[index]); + } + + public String getValue(int index) { + if (index < 0 || index >= indexMap.length) + return null; + return attributes.getValue(indexMap[index]); + } + + public int getIndex(String uri, String localName) { + int n = attributes.getIndex(uri, localName); + if (n < 0) + return n; + return reverseIndexMap[n]; + } + + public int getIndex(String qName) { + int n = attributes.getIndex(qName); + if (n < 0) + return n; + return reverseIndexMap[n]; + } + + public String getType(String uri, String localName) { + if (keepAttribute(uri)) + return attributes.getType(uri, localName); + return null; + } + + public String getValue(String uri, String localName) { + if (keepAttribute(uri)) + return attributes.getValue(uri, localName); + return null; + } + + public String getType(String qName) { + int i = getIndex(qName); + if (i < 0) + return null; + return getType(i); + } + + public String getValue(String qName) { + int i = getIndex(qName); + if (i < 0) + return null; + return getValue(i); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaImpl.java new file mode 100644 index 0000000..cfeeef8 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaImpl.java @@ -0,0 +1,464 @@ +package com.thaiopensource.validate.mns; + +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.Uri; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.auto.SchemaFuture; +import com.thaiopensource.xml.sax.XmlBaseHandler; +import com.thaiopensource.xml.sax.DelegatingContentHandler; +import com.thaiopensource.xml.sax.CountingErrorHandler; +import com.thaiopensource.xml.util.Name; +import com.thaiopensource.xml.util.StringSplitter; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.LocatorImpl; + +import java.io.IOException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Stack; + +class SchemaImpl extends AbstractSchema { + static final String MNS_URI = "http://www.thaiopensource.com/ns/mns"; + private final Hashtable modeMap = new Hashtable(); + private Mode startMode; + private static final String DEFAULT_MODE_NAME = "#default"; + private final boolean attributesSchema; + + static private final class WrappedIOException extends RuntimeException { + private final IOException exception; + + private WrappedIOException(IOException exception) { + this.exception = exception; + } + + private IOException getException() { + return exception; + } + } + + static class ElementAction { + private final Schema schema; + private final Mode mode; + private final ContextMap contextMap; + private final ElementsOrAttributes prune; + private final Hashset covered = new Hashset(); + + ElementAction(String ns, Schema schema, Mode mode, ContextMap contextMap, ElementsOrAttributes prune) { + this.schema = schema; + this.mode = mode; + this.contextMap = contextMap; + this.prune = prune; + covered.add(ns); + } + + Mode getMode() { + return mode; + } + + ContextMap getContextMap() { + return contextMap; + } + + Schema getSchema() { + return schema; + } + + ElementsOrAttributes getPrune() { + return prune; + } + + Hashset getCoveredNamespaces() { + return covered; + } + } + + static class Mode { + private Locator whereDefined; + private boolean defined = false; + private ElementsOrAttributes lax; + private boolean strictDefined = false; + private final Hashtable elementMap = new Hashtable(); + private final Hashtable attributesMap = new Hashtable(); + + Mode(ElementsOrAttributes lax) { + this.lax = lax; + } + + ElementsOrAttributes getLax() { + return lax; + } + + Schema getAttributesSchema(String ns) { + return (Schema)attributesMap.get(ns); + } + + ElementAction getElementAction(String ns) { + return (ElementAction)elementMap.get(ns); + } + } + + private class Handler extends DelegatingContentHandler implements SchemaFuture { + private final SchemaReceiverImpl sr; + private ElementAction currentElementAction; + private boolean hadError = false; + private final ErrorHandler eh; + private final CountingErrorHandler ceh; + private final Localizer localizer = new Localizer(SchemaImpl.class); + private Locator locator; + private final XmlBaseHandler xmlBaseHandler = new XmlBaseHandler(); + private int foreignDepth = 0; + private String contextNs; + private Mode contextMode; + private String elementNs; + private String defaultSchemaType; + private final Stack nameStack = new Stack(); + private boolean isRoot; + private int pathDepth = 0; + private Validator validator; + + + Handler(SchemaReceiverImpl sr) { + this.sr = sr; + this.eh = ValidateProperty.ERROR_HANDLER.get(sr.getProperties()); + this.ceh = new CountingErrorHandler(eh); + } + + public void setDocumentLocator(Locator locator) { + xmlBaseHandler.setLocator(locator); + this.locator = locator; + } + + public void startDocument() throws SAXException { + try { + PropertyMapBuilder builder = new PropertyMapBuilder(sr.getProperties()); + ValidateProperty.ERROR_HANDLER.put(builder, ceh); + validator = sr.getMnsSchema().createValidator(builder.toPropertyMap()); + } + catch (IOException e) { + throw new WrappedIOException(e); + } + catch (IncorrectSchemaException e) { + throw new RuntimeException("internal error in RNG schema for MNS"); + } + setDelegate(validator.getContentHandler()); + if (locator != null) + super.setDocumentLocator(locator); + super.startDocument(); + } + + public Schema getSchema() throws IncorrectSchemaException, SAXException { + if (validator == null || ceh.getHadErrorOrFatalError()) + throw new IncorrectSchemaException(); + for (Enumeration enumList = modeMap.keys(); enumList.hasMoreElements();) { + String modeName = (String)enumList.nextElement(); + Mode mode = (Mode)modeMap.get(modeName); + if (!mode.defined && !modeName.equals(DEFAULT_MODE_NAME)) + error("undefined_mode", modeName, mode.whereDefined); + } + if (hadError) + throw new IncorrectSchemaException(); + return SchemaImpl.this; + } + + public RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException { + if (e instanceof WrappedIOException) + throw ((WrappedIOException)e).getException(); + return e; + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + super.startElement(uri, localName, qName, attributes); + xmlBaseHandler.startElement(); + String xmlBase = attributes.getValue(WellKnownNamespaces.XML, "base"); + if (xmlBase != null) + xmlBaseHandler.xmlBaseAttribute(xmlBase); + if (!MNS_URI.equals(uri) || foreignDepth > 0) { + foreignDepth++; + return; + } + if (ceh.getHadErrorOrFatalError()) + return; + if (localName.equals("rules")) + parseRules(attributes); + else if (localName.equals("cover")) + parseCover(attributes); + else if (localName.equals("context")) + parseContext(attributes); + else if (localName.equals("root")) + parseRoot(attributes); + else if (localName.equals("element")) + parseElement(attributes); + else if (localName.equals("lax")) + parseLax(attributes); + else + parseValidate(localName.equals("validateAttributes"), attributes); + } + + public void endElement(String namespaceURI, String localName, + String qName) + throws SAXException { + super.endElement(namespaceURI, localName, qName); + xmlBaseHandler.endElement(); + if (foreignDepth > 0) { + foreignDepth--; + return; + } + if (pathDepth > 0) { + pathDepth--; + if (pathDepth == 0) + endPath(); + } + } + + + private void parseRules(Attributes attributes) { + String modeName = attributes.getValue("", "startMode"); + if (modeName == null) + modeName = DEFAULT_MODE_NAME; + defaultSchemaType = getSchemaType(attributes); + startMode = lookupCreateMode(modeName); + } + + private void parseCover(Attributes attributes) throws SAXException { + String ns = getNs(attributes, false); + currentElementAction.covered.add(ns); + } + + private void parseLax(Attributes attributes) throws SAXException { + String[] modeNames = getInModes(attributes); + Mode[] modes = getModes(modeNames); + ElementsOrAttributes lax = toElementsOrAttributes(attributes.getValue("", "allow"), + ElementsOrAttributes.BOTH); + for (int i = 0; i < modes.length; i++) { + if (modes[i].strictDefined) + error("lax_multiply_defined", modeNames[i]); + else { + modes[i].lax = lax; + modes[i].strictDefined = true; + } + } + } + + private void parseValidate(boolean isAttribute, Attributes attributes) throws SAXException { + String[] modeNames = getInModes(attributes); + Mode[] modes = getModes(modeNames); + String ns = getNs(attributes, isAttribute); + String schemaUri = getSchema(attributes); + String schemaType = getSchemaType(attributes); + if (schemaType == null) + schemaType = defaultSchemaType; + try { + if (isAttribute) { + Schema schema = sr.createChildSchema(new InputSource(schemaUri), schemaType, true); + for (int i = 0; i < modes.length; i++) { + if (modes[i].attributesMap.get(ns) != null) + error("validate_attributes_multiply_defined", modeNames[i], ns); + else + modes[i].attributesMap.put(ns, schema); + } + } + else { + Schema schema = sr.createChildSchema(new InputSource(schemaUri), schemaType, false); + currentElementAction = new ElementAction(ns, + schema, + getUseMode(attributes), + new ContextMap(), + getPrune(attributes)); + contextNs = ns; + for (int i = 0; i < modes.length; i++) { + if (modes[i].elementMap.get(ns) != null) + error("validate_element_multiply_defined", modeNames[i], ns); + else + modes[i].elementMap.put(ns, currentElementAction); + } + } + } + catch (IncorrectSchemaException e) { + hadError = true; + } + catch (IOException e) { + throw new WrappedIOException(e); + } + } + + private void parseContext(Attributes attributes) throws SAXException { + String ns = getNs(attributes, false); + if (ns != null) + contextNs = ns; + elementNs = contextNs; + contextMode = getUseMode(attributes); + } + + private void parseRoot(Attributes attributes) throws SAXException { + String ns = getNs(attributes, false); + if (ns != null) + elementNs = ns; + isRoot = true; + pathDepth++; + } + + private void parseElement(Attributes attributes) throws SAXException { + String ns = getNs(attributes, false); + if (ns != null) + elementNs = ns; + if (!currentElementAction.covered.contains(elementNs)) + error("context_ns_not_covered", elementNs); + nameStack.push(new Name(elementNs, attributes.getValue("", "name").trim())); + pathDepth++; + } + + private void endPath() throws SAXException { + if (!currentElementAction.contextMap.put(isRoot, nameStack, contextMode)) + error("path_multiply_defined", displayPath(isRoot, nameStack)); + elementNs = contextNs; + isRoot = false; + nameStack.setSize(0); + } + + private String displayPath(boolean isRoot, Stack nameStack) { + StringBuffer buf = new StringBuffer(); + for (int i = 0, len = nameStack.size(); i < len; i++) { + if (i > 0 || isRoot) + buf.append('/'); + Name name = (Name)nameStack.elementAt(i); + if (name.getNamespaceUri().length() > 0) { + buf.append('{'); + buf.append(name.getNamespaceUri()); + buf.append('}'); + } + buf.append(name.getLocalName()); + } + return buf.toString(); + } + + private String getSchema(Attributes attributes) throws SAXException { + String schemaUri = attributes.getValue("", "schema"); + if (Uri.hasFragmentId(schemaUri)) + error("schema_fragment_id"); + return Uri.resolve(xmlBaseHandler.getBaseUri(), + Uri.escapeDisallowedChars(schemaUri)); + } + + private String getSchemaType(Attributes attributes) { + return attributes.getValue("", "schemaType"); + } + + private ElementsOrAttributes getPrune(Attributes attributes) { + return toElementsOrAttributes(attributes.getValue("", "prune"), + ElementsOrAttributes.NEITHER); + } + + private ElementsOrAttributes toElementsOrAttributes(String value, ElementsOrAttributes defaultValue) { + if (value == null) + return defaultValue; + ElementsOrAttributes eoa = ElementsOrAttributes.NEITHER; + if (value.indexOf("elements") >= 0) + eoa = eoa.addElements(); + if (value.indexOf("attributes") >= 0) + eoa = eoa.addAttributes(); + return eoa; + } + + private Mode getUseMode(Attributes attributes) { + String modeName = attributes.getValue("", "useMode"); + if (modeName == null) + modeName = DEFAULT_MODE_NAME; + Mode mode = lookupCreateMode(modeName); + if (mode.whereDefined == null && locator != null) + mode.whereDefined = new LocatorImpl(locator); + return mode; + } + + private String getNs(Attributes attributes, boolean forbidEmpty) throws SAXException { + String ns = attributes.getValue("", "ns"); + if (ns != null && !Uri.isAbsolute(ns) && (forbidEmpty || !ns.equals(""))) + error("ns_absolute"); + return ns; + } + + private Mode[] getModes(String[] modeNames) { + Mode[] modes = new Mode[modeNames.length]; + for (int i = 0; i < modes.length; i++) { + modes[i] = lookupCreateMode(modeNames[i]); + modes[i].defined = true; + } + return modes; + } + + private String[] getInModes(Attributes attributes) { + String inModes = attributes.getValue("", "inModes"); + if (inModes == null) + return new String[] { DEFAULT_MODE_NAME }; + return StringSplitter.split(inModes); + } + + + void error(String key) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key), locator)); + } + + void error(String key, String arg) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg), locator)); + } + + void error(String key, String arg, Locator locator) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg), locator)); + } + + void error(String key, String arg1, String arg2) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg1, arg2), locator)); + } + + } + + SchemaImpl(boolean attributesSchema) { + this.attributesSchema = attributesSchema; + } + + SchemaFuture installHandlers(XMLReader in, SchemaReceiverImpl sr) { + Handler h = new Handler(sr); + in.setContentHandler(h); + return h; + } + + public Validator createValidator(PropertyMap properties) { + return new ValidatorImpl(startMode, properties); + } + + private Mode lookupCreateMode(String name) { + Mode mode = (Mode)modeMap.get(name); + if (mode == null) { + mode = new Mode(attributesSchema ? ElementsOrAttributes.ELEMENTS : ElementsOrAttributes.NEITHER); + modeMap.put(name, mode); + } + return mode; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaReceiverImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaReceiverImpl.java new file mode 100644 index 0000000..766f4cc --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/SchemaReceiverImpl.java @@ -0,0 +1,92 @@ +package com.thaiopensource.validate.mns; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.validate.rng.SAXSchemaReader; +import com.thaiopensource.validate.nrl.NrlSchemaReceiverFactory; +import com.thaiopensource.validate.nrl.NrlProperty; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.auto.AutoSchemaReader; +import com.thaiopensource.validate.auto.SchemaFuture; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; +import java.net.URL; + +class SchemaReceiverImpl implements SchemaReceiver { + private static final String MNS_SCHEMA = "mns.rng"; + private static final String RNC_MEDIA_TYPE = "application/x-rnc"; + private final PropertyMap properties; + private final PropertyMap attributeSchemaProperties; + private final boolean attributesSchema; + private final SchemaReader autoSchemaLanguage; + private Schema mnsSchema = null; + + public SchemaReceiverImpl(PropertyMap properties) { + this.attributesSchema = properties.contains(NrlProperty.ATTRIBUTES_SCHEMA); + PropertyMapBuilder builder = new PropertyMapBuilder(properties); + if (attributesSchema) { + attributeSchemaProperties = properties; + builder.put(NrlProperty.ATTRIBUTES_SCHEMA, null); + this.properties = builder.toPropertyMap(); + } + else { + this.properties = properties; + NrlProperty.ATTRIBUTES_SCHEMA.add(builder); + attributeSchemaProperties = builder.toPropertyMap(); + } + this.autoSchemaLanguage = new AutoSchemaReader(SchemaReceiverFactory.PROPERTY.get(properties)); + } + + public SchemaFuture installHandlers(XMLReader xr) { + return new SchemaImpl(attributesSchema).installHandlers(xr, this); + } + + Schema getMnsSchema() throws IOException, IncorrectSchemaException, SAXException { + if (mnsSchema == null) { + String className = SchemaReceiverImpl.class.getName(); + String resourceName = className.substring(0, className.lastIndexOf('.')).replace('.', '/') + "/resources/" + MNS_SCHEMA; + URL mnsSchemaUrl = getResource(resourceName); + mnsSchema = SAXSchemaReader.getInstance().createSchema( + new InputSource(mnsSchemaUrl.toString()), + properties); + } + return mnsSchema; + } + + private static URL getResource(String resourceName) { + ClassLoader cl = SchemaReceiverImpl.class.getClassLoader(); + // XXX see if we should borrow 1.2 code from Service + if (cl == null) + return ClassLoader.getSystemResource(resourceName); + else + return cl.getResource(resourceName); + } + + PropertyMap getProperties() { + return properties; + } + + Schema createChildSchema(InputSource inputSource, String schemaType, boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException { + SchemaReader lang = isRnc(schemaType) ? CompactSchemaReader.getInstance() : autoSchemaLanguage; + return lang.createSchema(inputSource, + isAttributesSchema ? attributeSchemaProperties : properties); + } + + private static boolean isRnc(String schemaType) { + if (schemaType == null) + return false; + schemaType = schemaType.trim(); + return schemaType.equals(RNC_MEDIA_TYPE); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ValidatorImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ValidatorImpl.java new file mode 100644 index 0000000..8287656 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/ValidatorImpl.java @@ -0,0 +1,263 @@ +package com.thaiopensource.validate.mns; + +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.mns.ContextMap; +import com.thaiopensource.validate.mns.Hashset; +import com.thaiopensource.validate.mns.ElementsOrAttributes; +import com.thaiopensource.xml.util.Name; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyMap; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.helpers.DefaultHandler; + +import java.util.Stack; +import java.util.Hashtable; + +class ValidatorImpl extends DefaultHandler implements Validator { + private static final String BEARER_URI = ""; + private static final String BEARER_LOCAL_NAME = "#bearer"; + private SchemaImpl.Mode currentMode; + private int laxDepth = 0; + private final ErrorHandler eh; + private final PropertyMap properties; + private Locator locator; + private Subtree subtrees = null; + private final Hashset attributeNamespaces = new Hashset(); + private PrefixMapping prefixMapping = null; + private final Localizer localizer = new Localizer(ValidatorImpl.class); + private final Hashtable validatorCache = new Hashtable(); + + static private class Subtree { + final Subtree parent; + final Validator validator; + final Schema schema; + final Hashset coveredNamespaces; + final ElementsOrAttributes prune; + final SchemaImpl.Mode parentMode; + final int parentLaxDepth; + final Stack context = new Stack(); + final ContextMap contextMap; + + Subtree(Hashset coveredNamespaces, ContextMap contextMap, + ElementsOrAttributes prune, Validator validator, + Schema schema, SchemaImpl.Mode parentMode, int parentLaxDepth, Subtree parent) { + this.coveredNamespaces = coveredNamespaces; + this.contextMap = contextMap; + this.prune = prune; + this.validator = validator; + this.schema = schema; + this.parentMode = parentMode; + this.parentLaxDepth = parentLaxDepth; + this.parent = parent; + } + } + + static private class PrefixMapping { + final String prefix; + final String uri; + final PrefixMapping parent; + + PrefixMapping(String prefix, String uri, PrefixMapping parent) { + this.prefix = prefix; + this.uri = uri; + this.parent = parent; + } + } + + ValidatorImpl(SchemaImpl.Mode mode, PropertyMap properties) { + this.currentMode = mode; + this.properties = properties; + this.eh = ValidateProperty.ERROR_HANDLER.get(properties); + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void characters(char ch[], int start, int length) + throws SAXException { + for (Subtree st = subtrees; wantsEvent(st); st = st.parent) + st.validator.getContentHandler().characters(ch, start, length); + } + + public void ignorableWhitespace(char ch[], int start, int length) + throws SAXException { + for (Subtree st = subtrees; wantsEvent(st); st = st.parent) + st.validator.getContentHandler().ignorableWhitespace(ch, start, length); + } + + private SchemaImpl.Mode getMode() { + if (subtrees != null) { + SchemaImpl.Mode mode = (SchemaImpl.Mode)subtrees.contextMap.get(subtrees.context); + if (mode != null) + return mode; + } + return currentMode; + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + if (namespaceCovered(uri)) + subtrees.context.push(new Name(uri, localName)); + else { + SchemaImpl.Mode mode = getMode(); + SchemaImpl.ElementAction elementAction = mode.getElementAction(uri); + if (elementAction == null) { + if (laxDepth == 0 && !mode.getLax().containsElements()) + error("element_undeclared_namespace", uri); + laxDepth++; + } + else { + subtrees = new Subtree(elementAction.getCoveredNamespaces(), + elementAction.getContextMap(), + elementAction.getPrune(), + createValidator(elementAction.getSchema()), + elementAction.getSchema(), + currentMode, + laxDepth, + subtrees); + subtrees.context.push(new Name(uri, localName)); + currentMode = elementAction.getMode(); + laxDepth = 0; + startSubtree(subtrees.validator.getContentHandler()); + } + } + for (Subtree st = subtrees; wantsEvent(st); st = st.parent) { + Attributes prunedAtts; + if (st.prune.containsAttributes()) + prunedAtts = new NamespaceFilteredAttributes(uri, true, attributes); + else + prunedAtts = attributes; + st.validator.getContentHandler().startElement(uri, localName, qName, prunedAtts); + } + for (int i = 0, len = attributes.getLength(); i < len; i++) { + String ns = attributes.getURI(i); + if (!ns.equals("") + && !ns.equals(uri) + && !namespaceCovered(ns) + && !attributeNamespaces.contains(ns)) { + attributeNamespaces.add(ns); + validateAttributes(ns, attributes); + } + } + attributeNamespaces.clear(); + } + + private boolean namespaceCovered(String ns) { + return (laxDepth == 0 + && subtrees != null + && subtrees.coveredNamespaces.contains(ns)); + } + + private boolean wantsEvent(Subtree st) { + return st != null && (!st.prune.containsElements() || (laxDepth == 0 && st == subtrees)); + } + + private void validateAttributes(String ns, Attributes attributes) throws SAXException { + SchemaImpl.Mode mode = getMode(); + Schema attributesSchema = mode.getAttributesSchema(ns); + if (attributesSchema == null) { + if (!mode.getLax().containsAttributes()) + error("attributes_undeclared_namespace", ns); + return; + } + Validator validator = createValidator(attributesSchema); + ContentHandler ch = validator.getContentHandler(); + startSubtree(ch); + ch.startElement(BEARER_URI, BEARER_LOCAL_NAME, BEARER_LOCAL_NAME, + new NamespaceFilteredAttributes(ns, false, attributes)); + ch.endElement(BEARER_URI, BEARER_LOCAL_NAME, BEARER_LOCAL_NAME); + endSubtree(ch); + releaseValidator(attributesSchema, validator); + } + + private void startSubtree(ContentHandler ch) throws SAXException { + if (locator != null) + ch.setDocumentLocator(locator); + ch.startDocument(); + for (PrefixMapping pm = prefixMapping; pm != null; pm = pm.parent) + ch.startPrefixMapping(pm.prefix, pm.uri); + } + + private void endSubtree(ContentHandler ch) throws SAXException { + for (PrefixMapping pm = prefixMapping; pm != null; pm = pm.parent) + ch.endPrefixMapping(pm.prefix); + ch.endDocument(); + } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + for (Subtree st = subtrees; wantsEvent(st); st = st.parent) + st.validator.getContentHandler().endElement(uri, localName, qName); + if (laxDepth > 0) + laxDepth--; + else if (!subtrees.context.empty()) { + subtrees.context.pop(); + if (subtrees.context.empty()) { + endSubtree(subtrees.validator.getContentHandler()); + releaseValidator(subtrees.schema, subtrees.validator); + currentMode = subtrees.parentMode; + laxDepth = subtrees.parentLaxDepth; + subtrees = subtrees.parent; + } + } + } + + private Validator createValidator(Schema schema) { + Stack stack = (Stack)validatorCache.get(schema); + if (stack == null) { + stack = new Stack(); + validatorCache.put(schema, stack); + } + if (stack.empty()) + return schema.createValidator(properties); + return (Validator)stack.pop(); + } + + private void releaseValidator(Schema schema, Validator validator) { + validator.reset(); + ((Stack)validatorCache.get(schema)).push(validator); + } + + public void endDocument() + throws SAXException { + } + + public void startPrefixMapping(String prefix, String uri) + throws SAXException { + super.startPrefixMapping(prefix, uri); + prefixMapping = new PrefixMapping(prefix, uri, prefixMapping); + } + + public void endPrefixMapping(String prefix) + throws SAXException { + super.endPrefixMapping(prefix); + prefixMapping = prefixMapping.parent; + } + + public void reset() { + subtrees = null; + locator = null; + } + + public ContentHandler getContentHandler() { + return this; + } + + public DTDHandler getDTDHandler() { + return null; + } + + private void error(String key, String arg) throws SAXException { + eh.error(new SAXParseException(localizer.message(key, arg), locator)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/Messages.properties new file mode 100644 index 0000000..6cc1d91 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/Messages.properties @@ -0,0 +1,10 @@ +element_undeclared_namespace=no applicable schema for element with namespace \"{0}\" in this context +attributes_undeclared_namespace=no applicable schema for one or more attributes with namespace \"{0}\" in this context +lax_multiply_defined=laxness for mode \"{0}\" already defined +undefined_mode=mode \"{0}\" not defined +schema_fragment_id=schema URI must not have a fragment identifier +ns_absolute=namespace URI must be absolute URI +validate_attributes_multiply_defined=multiple applicable \"validateAttributes\" elements in mode \"{0}\" for namespace \"{1}\" +validate_element_multiply_defined=multiple applicable \"validateElement\" elements in mode \"{0}\" for namespace \"{1}\" +path_multiply_defined=mode for context \"{0}\" already defined +context_ns_not_covered=namespace of contextual element not covered diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/mns.rng b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/mns.rng new file mode 100644 index 0000000..ee9c633 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/mns/resources/mns.rng @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #default + + + + + + + elements + attributes + + + attributes + elements + + elements + attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Action.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Action.java new file mode 100644 index 0000000..4b271f4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Action.java @@ -0,0 +1,21 @@ +package com.thaiopensource.validate.nrl; + +abstract class Action { + private final ModeUsage modeUsage; + + Action(ModeUsage modeUsage) { + this.modeUsage = modeUsage; + } + + ModeUsage getModeUsage() { + return modeUsage; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass() && ((Action)obj).modeUsage.equals(modeUsage); + } + + public int hashCode() { + return getClass().hashCode() ^ modeUsage.hashCode(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ActionSet.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ActionSet.java new file mode 100644 index 0000000..874ed59 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ActionSet.java @@ -0,0 +1,35 @@ +package com.thaiopensource.validate.nrl; + +class ActionSet { + private ResultAction resultAction; + private NoResultAction[] noResultActions = new NoResultAction[0]; + + ResultAction getResultAction() { + return resultAction; + } + + void setResultAction(ResultAction resultAction) { + this.resultAction = resultAction; + } + + void addNoResultAction(NoResultAction action) { + NoResultAction[] actions = new NoResultAction[noResultActions.length + 1]; + System.arraycopy(noResultActions, 0, actions, 0, noResultActions.length); + actions[noResultActions.length] = action; + noResultActions = actions; + } + + NoResultAction[] getNoResultActions() { + return noResultActions; + } + + ActionSet changeCurrentMode(Mode mode) { + ActionSet actions = new ActionSet(); + if (this.resultAction != null) + actions.resultAction = this.resultAction.changeCurrentMode(mode); + actions.noResultActions = new NoResultAction[this.noResultActions.length]; + for (int i = 0; i < actions.noResultActions.length; i++) + actions.noResultActions[i] = this.noResultActions[i].changeCurrentMode(mode); + return actions; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AllowAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AllowAction.java new file mode 100644 index 0000000..1f33ca4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AllowAction.java @@ -0,0 +1,16 @@ +package com.thaiopensource.validate.nrl; + +class AllowAction extends NoResultAction { + AllowAction(ModeUsage modeUsage) { + super(modeUsage); + } + + void perform(SectionState state) { + state.addChildMode(getModeUsage(), null); + state.addAttributeValidationModeUsage(getModeUsage()); + } + + NoResultAction changeCurrentMode(Mode mode) { + return new AllowAction(getModeUsage().changeCurrentMode(mode)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttachAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttachAction.java new file mode 100644 index 0000000..2c162ab --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttachAction.java @@ -0,0 +1,25 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import org.xml.sax.ContentHandler; + +class AttachAction extends ResultAction { + AttachAction(ModeUsage modeUsage) { + super(modeUsage); + } + + void perform(ContentHandler handler, SectionState state) { + final ModeUsage modeUsage = getModeUsage(); + if (handler != null) + state.addActiveHandler(handler, modeUsage); + else + state.addAttributeValidationModeUsage(modeUsage); + state.addChildMode(modeUsage, handler); + } + + ResultAction changeCurrentMode(Mode mode) { + return new AttachAction(getModeUsage().changeCurrentMode(mode)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttributeActionSet.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttributeActionSet.java new file mode 100644 index 0000000..596fa6f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/AttributeActionSet.java @@ -0,0 +1,36 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Schema; + +class AttributeActionSet { + private boolean attach; + private boolean reject; + private Schema[] schemas = new Schema[0]; + + boolean getAttach() { + return attach; + } + + void setAttach(boolean attach) { + this.attach = attach; + } + + boolean getReject() { + return reject; + } + + void setReject(boolean reject) { + this.reject = reject; + } + + Schema[] getSchemas() { + return schemas; + } + + void addSchema(Schema schema) { + Schema[] s = new Schema[schemas.length + 1]; + System.arraycopy(schemas, 0, s, 0, schemas.length); + s[schemas.length] = schema; + schemas = s; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ContextMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ContextMap.java new file mode 100644 index 0000000..f947040 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ContextMap.java @@ -0,0 +1,137 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.util.Equal; + +import java.util.Vector; +import java.util.Hashtable; +import java.util.Enumeration; +import java.util.NoSuchElementException; + +class ContextMap { + private Object rootValue; + private Object otherValue; + private final Hashtable nameTable = new Hashtable(); + + Object get(Vector context) { + return get(context, context.size()); + } + + boolean put(boolean isRoot, Vector names, Object value) { + return put(isRoot, names, names.size(), value); + } + + private Object get(Vector context, int len) { + if (len > 0) { + ContextMap nestedMap = (ContextMap)nameTable.get(context.elementAt(len - 1)); + if (nestedMap != null) { + Object value = nestedMap.get(context, len - 1); + if (value != null) + return value; + } + } + if (rootValue != null && len == 0) + return rootValue; + return otherValue; + } + + private boolean put(boolean isRoot, Vector names, int len, Object value) { + if (len == 0) { + if (isRoot) { + if (rootValue != null) + return false; + rootValue = value; + } + else { + if (otherValue != null) + return false; + otherValue = value; + } + return true; + } + else { + Object name = names.elementAt(len - 1); + ContextMap nestedMap = (ContextMap)nameTable.get(name); + if (nestedMap == null) { + nestedMap = new ContextMap(); + nameTable.put(name, nestedMap); + } + return nestedMap.put(isRoot, names, len - 1, value); + } + } + + public boolean equals(Object obj) { + if (!(obj instanceof ContextMap)) + return false; + ContextMap other = (ContextMap)obj; + if (!Equal.equal(this.rootValue, other.rootValue) + || !Equal.equal(this.otherValue, other.otherValue)) + return false; + // We want jing to work with JDK 1.1 so we cannot use Hashtable.equals + if (this.nameTable.size() != other.nameTable.size()) + return false; + for (Enumeration e = nameTable.keys(); e.hasMoreElements();) { + Object key = e.nextElement(); + if (!nameTable.get(key).equals(other.nameTable.get(key))) + return false; + } + return true; + } + + public int hashCode() { + int hc = 0; + if (rootValue != null) + hc ^= rootValue.hashCode(); + if (otherValue != null) + hc ^= otherValue.hashCode(); + for (Enumeration e = nameTable.keys(); e.hasMoreElements();) { + Object key = e.nextElement(); + hc ^= key.hashCode(); + hc ^= nameTable.get(key).hashCode(); + } + return hc; + } + + static private class Enumerator implements Enumeration { + private Object rootValue; + private Object otherValue; + private Enumeration subMapValues; + private final Enumeration subMaps; + + private Enumerator(ContextMap map) { + rootValue = map.rootValue; + otherValue = map.otherValue; + subMaps = map.nameTable.elements(); + } + + private void prep() { + while ((subMapValues == null || !subMapValues.hasMoreElements()) && subMaps.hasMoreElements()) + subMapValues = ((ContextMap)subMaps.nextElement()).values(); + } + + public boolean hasMoreElements() { + prep(); + return rootValue != null || otherValue != null || (subMapValues != null && subMapValues.hasMoreElements()); + } + + public Object nextElement() { + if (rootValue != null) { + Object tem = rootValue; + rootValue = null; + return tem; + } + if (otherValue != null) { + Object tem = otherValue; + otherValue = null; + return tem; + } + prep(); + if (subMapValues == null) + throw new NoSuchElementException(); + return subMapValues.nextElement(); + } + } + + Enumeration values() { + return new Enumerator(this); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ElementsOrAttributes.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ElementsOrAttributes.java new file mode 100644 index 0000000..96e5bd5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ElementsOrAttributes.java @@ -0,0 +1,41 @@ +package com.thaiopensource.validate.nrl; + +class ElementsOrAttributes { + private static final int ELEMENTS_FLAG = 01; + private static final int ATTRIBUTES_FLAG = 02; + + static final ElementsOrAttributes NEITHER = new ElementsOrAttributes(0); + static final ElementsOrAttributes ELEMENTS = new ElementsOrAttributes(ELEMENTS_FLAG); + static final ElementsOrAttributes ATTRIBUTES = new ElementsOrAttributes(ATTRIBUTES_FLAG); + static final ElementsOrAttributes BOTH = new ElementsOrAttributes(ELEMENTS_FLAG|ATTRIBUTES_FLAG); + + private static final ElementsOrAttributes values[] = { + NEITHER, + ELEMENTS, + ATTRIBUTES, + BOTH + }; + + private int flags = 0; + + private ElementsOrAttributes(int flags) { + this.flags = flags; + } + + ElementsOrAttributes addElements() { + return values[flags | ELEMENTS_FLAG]; + } + + ElementsOrAttributes addAttributes() { + return values[flags | ATTRIBUTES_FLAG]; + } + + boolean containsAttributes() { + return (flags & ATTRIBUTES_FLAG) != 0; + } + + boolean containsElements() { + return (flags & ELEMENTS_FLAG) != 0; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/FilteredAttributes.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/FilteredAttributes.java new file mode 100644 index 0000000..5cd4fab --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/FilteredAttributes.java @@ -0,0 +1,102 @@ +package com.thaiopensource.validate.nrl; + +import org.xml.sax.Attributes; + +class FilteredAttributes implements Attributes { + private final Attributes attributes; + private final IntSet indexSet; + private int[] reverseIndexMap; + + public FilteredAttributes(IntSet indexSet, Attributes attributes) { + this.indexSet = indexSet; + this.attributes = attributes; + } + + private int reverseIndex(int k) { + if (reverseIndexMap == null) { + reverseIndexMap = new int[attributes.getLength()]; + for (int i = 0, len = indexSet.size(); i < len; i++) + reverseIndexMap[indexSet.get(i)] = i + 1; + } + return reverseIndexMap[k] - 1; + } + + public int getLength() { + return indexSet.size(); + } + + public String getURI(int index) { + if (index < 0 || index >= indexSet.size()) + return null; + return attributes.getURI(indexSet.get(index)); + } + + public String getLocalName(int index) { + if (index < 0 || index >= indexSet.size()) + return null; + return attributes.getLocalName(indexSet.get(index)); + } + + public String getQName(int index) { + if (index < 0 || index >= indexSet.size()) + return null; + return attributes.getQName(indexSet.get(index)); + } + + public String getType(int index) { + if (index < 0 || index >= indexSet.size()) + return null; + return attributes.getType(indexSet.get(index)); + } + + public String getValue(int index) { + if (index < 0 || index >= indexSet.size()) + return null; + return attributes.getValue(indexSet.get(index)); + } + + public int getIndex(String uri, String localName) { + int n = attributes.getIndex(uri, localName); + if (n < 0) + return n; + return reverseIndex(n); + } + + public int getIndex(String qName) { + int n = attributes.getIndex(qName); + if (n < 0) + return n; + return reverseIndex(n); + } + + private int getRealIndex(String uri, String localName) { + int index = attributes.getIndex(uri, localName); + if (index < 0 || reverseIndex(index) < 0) + return -1; + return index; + } + + private int getRealIndex(String qName) { + int index = attributes.getIndex(qName); + if (index < 0 || reverseIndex(index) < 0) + return -1; + return index; + } + + public String getType(String uri, String localName) { + return attributes.getType(getRealIndex(uri, localName)); + } + + public String getValue(String uri, String localName) { + return attributes.getValue(getRealIndex(uri, localName)); + } + + public String getType(String qName) { + return attributes.getType(getRealIndex(qName)); + } + + public String getValue(String qName) { + return attributes.getValue(getRealIndex(qName)); + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Hashset.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Hashset.java new file mode 100644 index 0000000..1e448ae --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Hashset.java @@ -0,0 +1,29 @@ +package com.thaiopensource.validate.nrl; + +import java.util.Hashtable; +import java.util.Enumeration; + +class Hashset { + private final Hashtable table = new Hashtable(); + + boolean contains(Object key) { + return table.get(key) != null; + } + + void add(Object key) { + table.put(key, key); + } + + void addAll(Hashset set) { + for (Enumeration enumList = set.table.keys(); enumList.hasMoreElements();) + add(enumList.nextElement()); + } + + void clear() { + table.clear(); + } + + Enumeration members() { + return table.keys(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/IntSet.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/IntSet.java new file mode 100644 index 0000000..4912e4b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/IntSet.java @@ -0,0 +1,75 @@ +package com.thaiopensource.validate.nrl; + +class IntSet { + static private final int INIT_SIZE = 4; + private int[] v = null; + private int len = 0; + + void add(int n) { + if (v == null) { + v = new int[INIT_SIZE]; + v[0] = n; + len = 1; + return; + } + if (len == v.length) { + int[] newv = new int[len*2]; + System.arraycopy(v, 0, newv, 0, len); + v = newv; + } + if (n > v[len - 1]) { + v[len++] = n; + return; + } + int i = 0; + for (; i < len; i++) { + if (n <= v[i]) { + if (n == v[i]) + return; + break; + } + } + for (int j = len; j >= i; j--) + v[j + 1] = v[j]; + v[i] = n; + ++len; + } + + void addAll(IntSet is) { + if (is.len == 0) + return; + int[] newv = new int[len + is.len]; + int i = 0, j = 0, k = 0; + while (i < len && j < is.len) { + if (v[i] < is.v[j]) + newv[k++] = v[i++]; + else if (is.v[j] < v[i]) + newv[k++] = is.v[j++]; + else { + newv[k++] = v[i++]; + j++; + } + } + while (i < len) + newv[k++] = v[i++]; + while (j < is.len) + newv[k++] = is.v[j++]; + v = newv; + len = k; + } + + int size() { + return len; + } + + int get(int i) { + if (i >= len) + throw new IndexOutOfBoundsException(); + try { + return v[i]; + } + catch (NullPointerException e) { + throw new IndexOutOfBoundsException(); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Mode.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Mode.java new file mode 100644 index 0000000..a3d087c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Mode.java @@ -0,0 +1,144 @@ +package com.thaiopensource.validate.nrl; + +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + +import java.util.Hashtable; +import java.util.Enumeration; + +import com.thaiopensource.validate.nrl.ActionSet; +import com.thaiopensource.validate.nrl.AttributeActionSet; + +class Mode { + static final String ANY_NAMESPACE = "##any"; + static final int ATTRIBUTE_PROCESSING_NONE = 0; + static final int ATTRIBUTE_PROCESSING_QUALIFIED = 1; + static final int ATTRIBUTE_PROCESSING_FULL = 2; + static final Mode CURRENT = new Mode("#current", null); + + private final String name; + private Mode baseMode; + private boolean defined; + private Locator whereDefined; + private Locator whereUsed; + private final Hashtable elementMap = new Hashtable(); + private final Hashtable attributeMap = new Hashtable(); + private int attributeProcessing = -1; + + Mode(String name, Mode baseMode) { + this.name = name; + this.baseMode = baseMode; + } + + String getName() { + return name; + } + + Mode getBaseMode() { + return baseMode; + } + + void setBaseMode(Mode baseMode) { + this.baseMode = baseMode; + } + + ActionSet getElementActions(String ns) { + ActionSet actions = getElementActionsExplicit(ns); + if (actions == null) { + actions = getElementActionsExplicit(ANY_NAMESPACE); + // this is not correct: it breaks a derived mode that use anyNamespace + // elementMap.put(ns, actions); + } + return actions; + } + + private ActionSet getElementActionsExplicit(String ns) { + ActionSet actions = (ActionSet)elementMap.get(ns); + if (actions == null && baseMode != null) { + actions = baseMode.getElementActionsExplicit(ns); + if (actions != null) { + actions = actions.changeCurrentMode(this); + elementMap.put(ns, actions); + } + } + return actions; + } + + AttributeActionSet getAttributeActions(String ns) { + AttributeActionSet actions = getAttributeActionsExplicit(ns); + if (actions == null) { + actions = getAttributeActionsExplicit(ANY_NAMESPACE); + // this is not correct: it breaks a derived mode that use anyNamespace + // attributeMap.put(ns, actions); + } + return actions; + } + + private AttributeActionSet getAttributeActionsExplicit(String ns) { + AttributeActionSet actions = (AttributeActionSet)attributeMap.get(ns); + if (actions == null && baseMode != null) { + actions = baseMode.getAttributeActionsExplicit(ns); + if (actions != null) + attributeMap.put(ns, actions); + } + return actions; + } + + int getAttributeProcessing() { + if (attributeProcessing == -1) { + if (baseMode != null) + attributeProcessing = baseMode.getAttributeProcessing(); + else + attributeProcessing = ATTRIBUTE_PROCESSING_NONE; + for (Enumeration enumList = attributeMap.keys(); enumList.hasMoreElements() && attributeProcessing != ATTRIBUTE_PROCESSING_FULL;) { + String ns = (String)enumList.nextElement(); + AttributeActionSet actions = (AttributeActionSet)attributeMap.get(ns); + if (!actions.getAttach() + || actions.getReject() + || actions.getSchemas().length > 0) + attributeProcessing = ((ns.equals("") || ns.equals(ANY_NAMESPACE)) + ? ATTRIBUTE_PROCESSING_FULL + : ATTRIBUTE_PROCESSING_QUALIFIED); + } + } + return attributeProcessing; + } + + Locator getWhereDefined() { + return whereDefined; + } + + boolean isDefined() { + return defined; + } + + Locator getWhereUsed() { + return whereUsed; + } + + void noteUsed(Locator locator) { + if (whereUsed == null && locator != null) + whereUsed = new LocatorImpl(locator); + } + + void noteDefined(Locator locator) { + defined = true; + if (whereDefined == null && locator != null) + whereDefined = new LocatorImpl(locator); + } + + boolean bindElement(String ns, ActionSet actions) { + if (elementMap.get(ns) != null) + return false; + elementMap.put(ns, actions); + return true; + } + + boolean bindAttribute(String ns, AttributeActionSet actions) { + if (attributeMap.get(ns) != null) + return false; + attributeMap.put(ns, actions); + return true; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ModeUsage.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ModeUsage.java new file mode 100644 index 0000000..4415b6d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ModeUsage.java @@ -0,0 +1,80 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.util.Equal; +import com.thaiopensource.validate.nrl.ContextMap; +import com.thaiopensource.validate.nrl.Mode; + +import java.util.Vector; +import java.util.Enumeration; + +class ModeUsage { + private final Mode mode; + private final Mode currentMode; + private ContextMap modeMap; + private int attributeProcessing = -1; + + ModeUsage(Mode mode, Mode currentMode) { + this(mode, currentMode, null); + } + + private ModeUsage(Mode mode, Mode currentMode, ContextMap modeMap) { + this.mode = mode; + this.currentMode = currentMode; + this.modeMap = modeMap; + } + + ModeUsage changeCurrentMode(Mode currentMode) { + return new ModeUsage(mode, currentMode, modeMap); + } + + public boolean equals(Object obj) { + if (!(obj instanceof ModeUsage)) + return false; + ModeUsage other = (ModeUsage)obj; + return this.mode == other.mode && this.currentMode == other.currentMode && Equal.equal(this.modeMap, other.modeMap); + } + + public int hashCode() { + int hc = mode.hashCode() ^ currentMode.hashCode(); + if (modeMap != null) + hc ^= modeMap.hashCode(); + return hc; + } + + private Mode resolve(Mode mode) { + return mode == Mode.CURRENT ? currentMode : mode; + } + + int getAttributeProcessing() { + if (attributeProcessing == -1) { + attributeProcessing = resolve(mode).getAttributeProcessing(); + if (modeMap != null) { + for (Enumeration enumList = modeMap.values(); + enumList.hasMoreElements() + && attributeProcessing != Mode.ATTRIBUTE_PROCESSING_FULL;) + attributeProcessing = Math.max(resolve((Mode)enumList.nextElement()).getAttributeProcessing(), + attributeProcessing); + } + } + return attributeProcessing; + } + + boolean isContextDependent() { + return modeMap != null; + } + + Mode getMode(Vector context) { + if (modeMap != null) { + Mode m = (Mode)modeMap.get(context); + if (m != null) + return resolve(m); + } + return resolve(mode); + } + + boolean addContext(boolean isRoot, Vector names, Mode mode) { + if (modeMap == null) + modeMap = new ContextMap(); + return modeMap.put(isRoot, names, mode); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NoResultAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NoResultAction.java new file mode 100644 index 0000000..1979e60 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NoResultAction.java @@ -0,0 +1,16 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.nrl.Action; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import org.xml.sax.SAXException; + +abstract class NoResultAction extends Action { + NoResultAction(ModeUsage modeUsage) { + super(modeUsage); + } + + abstract void perform(SectionState state) throws SAXException; + abstract NoResultAction changeCurrentMode(Mode mode); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlProperty.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlProperty.java new file mode 100644 index 0000000..f6e32f1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlProperty.java @@ -0,0 +1,9 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.FlagPropertyId; + +public class NrlProperty { + private NrlProperty() { } + + public static final FlagPropertyId ATTRIBUTES_SCHEMA = new FlagPropertyId("ATTRIBUTES_SCHEMA"); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.java new file mode 100644 index 0000000..86363da --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/NrlSchemaReceiverFactory.java @@ -0,0 +1,22 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.xml.sax.XMLReaderCreator; + +public class NrlSchemaReceiverFactory implements SchemaReceiverFactory { + public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { + if (!SchemaImpl.NRL_URI.equals(namespaceUri)) + return null; + // modified for ePubCheck + XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties); + return new SchemaReceiverImpl(properties, xrc); + } + + public Option getOption(String uri) { + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Path.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Path.java new file mode 100644 index 0000000..ad5d778 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/Path.java @@ -0,0 +1,151 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.xml.util.Naming; + +import java.util.Vector; + +class Path { + private final boolean root; + private final Vector names; + + Path(boolean root, Vector names) { + this.root = root; + this.names = names; + } + + boolean isRoot() { + return root; + } + + Vector getNames() { + return names; + } + + public String toString() { + StringBuffer buf = new StringBuffer(); + if (root) + buf.append('/'); + for (int i = 0, len = names.size(); i < len; i++) { + if (i != 0) + buf.append('/'); + buf.append((String)names.elementAt(i)); + } + return buf.toString(); + } + + static class ParseException extends Exception { + private final String messageKey; + + ParseException(String messageKey) { + super(messageKey); + this.messageKey = messageKey; + } + + public String getMessageKey() { + return messageKey; + } + } + + private static final int START = 0; + private static final int IN_NAME = 1; + private static final int AFTER_NAME = 2; + private static final int AFTER_SLASH = 3; + + static Vector parse(String str) throws ParseException { + int state = START; + int nameStartIndex = -1; + Vector paths = new Vector(); + Vector names = new Vector(); + boolean root = false; + for (int i = 0, len = str.length(); i < len; i++) { + char c = str.charAt(i); + switch (c) { + case ' ': + case '\r': + case '\n': + case '\t': + if (state == IN_NAME) { + names.addElement(makeName(str, nameStartIndex, i)); + state = AFTER_NAME; + } + break; + case '/': + switch (state) { + case IN_NAME: + names.addElement(makeName(str, nameStartIndex, i)); + break; + case START: + root = true; + break; + case AFTER_SLASH: + throw new ParseException("unexpected_slash"); + } + state = AFTER_SLASH; + break; + case '|': + switch (state) { + case START: + throw new ParseException("empty_path"); + case AFTER_NAME: + break; + case AFTER_SLASH: + throw new ParseException("expected_name"); + case IN_NAME: + names.addElement(makeName(str, nameStartIndex, i)); + break; + } + paths.addElement(new Path(root, names)); + root = false; + names = new Vector(); + state = START; + break; + default: + switch (state) { + case AFTER_NAME: + throw new ParseException("expected_slash"); + case AFTER_SLASH: + case START: + nameStartIndex = i; + state = IN_NAME; + break; + case IN_NAME: + break; + } + break; + } + } + switch (state) { + case START: + throw new ParseException("empty_path"); + case AFTER_NAME: + break; + case AFTER_SLASH: + throw new ParseException("expected_name"); + case IN_NAME: + names.addElement(makeName(str, nameStartIndex, str.length())); + break; + } + paths.addElement(new Path(root, names)); + return paths; + } + + private static String makeName(String str, int start, int end) throws ParseException { + String name = str.substring(start, end); + if (!Naming.isNcname(name)) + throw new ParseException("invalid_name"); + return name; + } + + static public void main(String[] args) throws ParseException { + Vector paths = parse(args[0]); + for (int i = 0; i < paths.size(); i++) { + if (i != 0) + System.out.println("---"); + Path path = (Path)paths.elementAt(i); + if (path.isRoot()) + System.out.println("/"); + for (int j = 0; j < path.getNames().size(); j++) + System.out.println(path.getNames().elementAt(j)); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/RejectAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/RejectAction.java new file mode 100644 index 0000000..c49f3e1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/RejectAction.java @@ -0,0 +1,23 @@ +package com.thaiopensource.validate.nrl; + +import org.xml.sax.SAXException; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import com.thaiopensource.validate.nrl.NoResultAction; + +class RejectAction extends NoResultAction { + RejectAction(ModeUsage modeUsage) { + super(modeUsage); + } + + void perform(SectionState state) throws SAXException { + final ModeUsage modeUsage = getModeUsage(); + state.reject(); + state.addChildMode(modeUsage, null); + state.addAttributeValidationModeUsage(modeUsage); + } + + NoResultAction changeCurrentMode(Mode mode) { + return new RejectAction(getModeUsage().changeCurrentMode(mode)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ResultAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ResultAction.java new file mode 100644 index 0000000..4f2df3a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ResultAction.java @@ -0,0 +1,17 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.nrl.Action; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import org.xml.sax.SAXException; +import org.xml.sax.ContentHandler; + +abstract class ResultAction extends Action { + ResultAction(ModeUsage modeUsage) { + super(modeUsage); + } + + abstract void perform(ContentHandler handler, SectionState state) throws SAXException; + abstract ResultAction changeCurrentMode(Mode mode); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaImpl.java new file mode 100644 index 0000000..3dce5f5 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaImpl.java @@ -0,0 +1,582 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.Uri; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.OptionArgumentException; +import com.thaiopensource.validate.OptionArgumentPresenceException; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.auto.SchemaFuture; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.xml.sax.XmlBaseHandler; +import com.thaiopensource.xml.sax.DelegatingContentHandler; +import com.thaiopensource.xml.sax.CountingErrorHandler; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import org.xml.sax.Attributes; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.LocatorImpl; + +import java.io.IOException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +class SchemaImpl extends AbstractSchema { + static private final String IMPLICIT_MODE_NAME = "#implicit"; + static private final String WRAPPER_MODE_NAME = "#wrapper"; + static final String NRL_URI = SchemaReader.BASE_URI + "nrl"; + private final Hashtable modeMap = new Hashtable(); + private Mode startMode; + private final Mode defaultBaseMode; + private final boolean attributesSchema; + private final XMLReaderCreator xrc; // added for ePubCheck + + static private final class WrappedIOException extends RuntimeException { + private final IOException exception; + + private WrappedIOException(IOException exception) { + this.exception = exception; + } + + private IOException getException() { + return exception; + } + } + + static private class MustSupportOption { + private final String name; + private final PropertyId pid; + private final Locator locator; + + MustSupportOption(String name, PropertyId pid, Locator locator) { + this.name = name; + this.pid = pid; + this.locator = locator; + } + } + + private class Handler extends DelegatingContentHandler implements SchemaFuture { + private final SchemaReceiverImpl sr; + private boolean hadError = false; + private final ErrorHandler eh; + private final CountingErrorHandler ceh; + private final Localizer localizer = new Localizer(SchemaImpl.class); + private Locator locator; + private final XmlBaseHandler xmlBaseHandler = new XmlBaseHandler(); + private int foreignDepth = 0; + private Mode currentMode = null; + private String defaultSchemaType; + private Validator validator; + private ElementsOrAttributes match; + private ActionSet actions; + private AttributeActionSet attributeActions; + private String schemaUri; + private String schemaType; + private PropertyMapBuilder options; + private final Vector mustSupportOptions = new Vector(); + private ModeUsage modeUsage; + private boolean anyNamespace; + + Handler(SchemaReceiverImpl sr) { + this.sr = sr; + this.eh = ValidateProperty.ERROR_HANDLER.get(sr.getProperties()); + this.ceh = new CountingErrorHandler(this.eh); + } + + public void setDocumentLocator(Locator locator) { + xmlBaseHandler.setLocator(locator); + this.locator = locator; + } + + public void startDocument() throws SAXException { + try { + PropertyMapBuilder builder = new PropertyMapBuilder(sr.getProperties()); + ValidateProperty.ERROR_HANDLER.put(builder, ceh); + validator = sr.getNrlSchema().createValidator(builder.toPropertyMap()); + } + catch (IOException e) { + throw new WrappedIOException(e); + } + catch (IncorrectSchemaException e) { + throw new RuntimeException("internal error in RNG schema for NRL"); + } + setDelegate(validator.getContentHandler()); + if (locator != null) + super.setDocumentLocator(locator); + super.startDocument(); + } + + public Schema getSchema() throws IncorrectSchemaException, SAXException { + if (validator == null || ceh.getHadErrorOrFatalError()) + throw new IncorrectSchemaException(); + Hashset openModes = new Hashset(); + Hashset checkedModes = new Hashset(); + for (Enumeration enumList = modeMap.keys(); enumList.hasMoreElements();) { + String modeName = (String)enumList.nextElement(); + Mode mode = (Mode)modeMap.get(modeName); + if (!mode.isDefined()) + error("undefined_mode", modeName, mode.getWhereUsed()); + for (Mode tem = mode; tem != null; tem = tem.getBaseMode()) { + if (checkedModes.contains(tem)) + break; + if (openModes.contains(tem)) { + error("mode_cycle", tem.getName(), tem.getWhereDefined()); + break; + } + openModes.add(tem); + } + checkedModes.addAll(openModes); + openModes.clear(); + } + if (hadError) + throw new IncorrectSchemaException(); + return SchemaImpl.this; + } + + public RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException { + if (e instanceof WrappedIOException) + throw ((WrappedIOException)e).getException(); + return e; + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + super.startElement(uri, localName, qName, attributes); + xmlBaseHandler.startElement(); + String xmlBase = attributes.getValue(WellKnownNamespaces.XML, "base"); + if (xmlBase != null) + xmlBaseHandler.xmlBaseAttribute(xmlBase); + if (!NRL_URI.equals(uri) || foreignDepth > 0) { + foreignDepth++; + return; + } + if (ceh.getHadErrorOrFatalError()) + return; + if (localName.equals("rules")) + parseRules(attributes); + else if (localName.equals("mode")) + parseMode(attributes); + else if (localName.equals("namespace")) + parseNamespace(attributes); + else if (localName.equals("anyNamespace")) + parseAnyNamespace(attributes); + else if (localName.equals("validate")) + parseValidate(attributes); + else if (localName.equals("reject")) + parseReject(attributes); + else if (localName.equals("attach")) + parseAttach(attributes); + else if (localName.equals("unwrap")) + parseUnwrap(attributes); + else if (localName.equals("allow")) + parseAllow(attributes); + else if (localName.equals("context")) + parseContext(attributes); + else if (localName.equals("option")) + parseOption(attributes); + else + throw new RuntimeException("unexpected element \"" + localName + "\""); + } + + public void endElement(String namespaceURI, String localName, + String qName) + throws SAXException { + super.endElement(namespaceURI, localName, qName); + xmlBaseHandler.endElement(); + if (foreignDepth > 0) { + foreignDepth--; + return; + } + if (ceh.getHadErrorOrFatalError()) + return; + if (localName.equals("validate")) + finishValidate(); + } + + private void parseRules(Attributes attributes) { + startMode = getModeAttribute(attributes, "startMode"); + if (startMode == null) { + startMode = lookupCreateMode(IMPLICIT_MODE_NAME); + currentMode = startMode; + startMode.noteDefined(null); + } + startMode.noteUsed(locator); + if (attributesSchema) { + Mode wrapper = lookupCreateMode(WRAPPER_MODE_NAME); + ActionSet actions = new ActionSet(); + actions.addNoResultAction(new AllowAction(new ModeUsage(startMode, startMode))); + wrapper.bindElement(Mode.ANY_NAMESPACE, actions); + wrapper.noteDefined(null); + startMode = wrapper; + } + defaultSchemaType = getSchemaType(attributes); + } + + private void parseMode(Attributes attributes) throws SAXException { + currentMode = getModeAttribute(attributes, "name"); + if (currentMode.isDefined()) { + error("duplicate_mode", currentMode.getName()); + error("first_mode", currentMode.getName(), currentMode.getWhereDefined()); + } + else { + Mode base = getModeAttribute(attributes, "extends"); + if (base != null) + currentMode.setBaseMode(base); + currentMode.noteDefined(locator); + } + } + + private void parseNamespace(Attributes attributes) throws SAXException { + anyNamespace = false; + parseRule(getNs(attributes), attributes); + } + + private void parseAnyNamespace(Attributes attributes) throws SAXException { + anyNamespace = true; + parseRule(Mode.ANY_NAMESPACE, attributes); + } + + private void parseRule(String ns, Attributes attributes) throws SAXException { + match = toElementsOrAttributes(attributes.getValue("", "match"), + ElementsOrAttributes.ELEMENTS); + if (match.containsAttributes()) { + attributeActions = new AttributeActionSet(); + if (!currentMode.bindAttribute(ns, attributeActions)) { + if (ns.equals(Mode.ANY_NAMESPACE)) + error("duplicate_attribute_action_any_namespace"); + else + error("duplicate_attribute_action", ns); + } + } + if (match.containsElements()) { + actions = new ActionSet(); + if (!currentMode.bindElement(ns, actions)) { + if (ns.equals(Mode.ANY_NAMESPACE)) + error("duplicate_element_action_any_namespace"); + else + error("duplicate_element_action", ns); + } + } + else + actions = null; + } + + private void parseValidate(Attributes attributes) throws SAXException { + schemaUri = getSchema(attributes); + schemaType = getSchemaType(attributes); + if (schemaType == null) + schemaType = defaultSchemaType; + if (actions != null) + modeUsage = getModeUsage(attributes); + else + modeUsage = null; + options = new PropertyMapBuilder(); + mustSupportOptions.clear(); + } + + private void finishValidate() throws SAXException { + try { + if (attributeActions != null) { + Schema schema = createSubSchema(true); + attributeActions.addSchema(schema); + } + if (actions != null) { + Schema schema = createSubSchema(false); + actions.addNoResultAction(new ValidateAction(modeUsage, schema)); + } + } + catch (IncorrectSchemaException e) { + hadError = true; + } + catch (IOException e) { + throw new WrappedIOException(e); + } + } + + // Added for ePubCheck + private InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException { + EntityResolver er = xr.getEntityResolver(); + if (er != null) { + InputSource inputSource = er.resolveEntity(null, systemId); + if (inputSource != null) + return inputSource; + } + return new InputSource(systemId); + } + + private Schema createSubSchema(boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException { + PropertyMap requestedProperties = options.toPropertyMap(); + Schema schema = sr.createChildSchema(makeInputSource(xrc.createXMLReader(), schemaUri), // Modified for ePubCheck + schemaType, + requestedProperties, + isAttributesSchema); + PropertyMap actualProperties = schema.getProperties(); + for (Enumeration enumList = mustSupportOptions.elements(); enumList.hasMoreElements();) { + MustSupportOption mso = (MustSupportOption)enumList.nextElement(); + Object actualValue = actualProperties.get(mso.pid); + if (actualValue == null) + error("unsupported_option", mso.name, mso.locator); + else if (!actualValue.equals(requestedProperties.get(mso.pid))) + error("unsupported_option_arg", mso.name, mso.locator); + } + return schema; + } + + private void parseOption(Attributes attributes) throws SAXException { + boolean mustSupport; + String mustSupportValue = attributes.getValue("", "mustSupport"); + if (mustSupportValue != null) { + mustSupportValue = mustSupportValue.trim(); + mustSupport = mustSupportValue.equals("1") || mustSupportValue.equals("true"); + } + else + mustSupport = false; + String name = Uri.resolve(NRL_URI, attributes.getValue("", "name")); + Option option = sr.getOption(name); + if (option == null) { + if (mustSupport) + error("unknown_option", name); + } + else { + String arg = attributes.getValue("", "arg"); + try { + PropertyId pid = option.getPropertyId(); + Object value = option.valueOf(arg); + Object oldValue = options.get(pid); + if (oldValue != null) { + value = option.combine(new Object[]{oldValue, value}); + if (value == null) + error("duplicate_option", name); + else + options.put(pid, value); + } + else { + options.put(pid, value); + mustSupportOptions.addElement(new MustSupportOption(name, pid, + locator == null + ? null + : new LocatorImpl(locator))); + } + } + catch (OptionArgumentPresenceException e) { + error(arg == null ? "option_requires_argument" : "option_unexpected_argument", name); + } + catch (OptionArgumentException e) { + if (arg == null) + error("option_requires_argument", name); + else + error("option_bad_argument", name, arg); + } + } + } + + private void parseAttach(Attributes attributes) { + if (attributeActions != null) + attributeActions.setAttach(true); + if (actions != null) { + modeUsage = getModeUsage(attributes); + actions.setResultAction(new AttachAction(modeUsage)); + } + else + modeUsage = null; + } + + private void parseUnwrap(Attributes attributes) { + if (actions != null) { + modeUsage = getModeUsage(attributes); + actions.setResultAction(new UnwrapAction(modeUsage)); + } + else + modeUsage = null; + } + + private void parseAllow(Attributes attributes) { + if (actions != null) { + modeUsage = getModeUsage(attributes); + actions.addNoResultAction(new AllowAction(modeUsage)); + } + else + modeUsage = null; + } + + private void parseReject(Attributes attributes) { + if (actions != null) { + modeUsage = getModeUsage(attributes); + actions.addNoResultAction(new RejectAction(modeUsage)); + } + else + modeUsage = null; + if (attributeActions != null) + attributeActions.setReject(true); + } + + private void parseContext(Attributes attributes) throws SAXException { + if (anyNamespace) { + error("context_any_namespace"); + return; + } + Mode mode = getUseMode(attributes); + try { + Vector paths = Path.parse(attributes.getValue("", "path")); + // XXX warning if modeUsage is null + if (modeUsage != null) { + for (int i = 0, len = paths.size(); i < len; i++) { + Path path = (Path)paths.elementAt(i); + if (!modeUsage.addContext(path.isRoot(), path.getNames(), mode)) + error("duplicate_path", path.toString()); + } + } + } + catch (Path.ParseException e) { + error(e.getMessageKey()); + } + } + + private String getSchema(Attributes attributes) throws SAXException { + String schemaUri = attributes.getValue("", "schema"); + if (Uri.hasFragmentId(schemaUri)) + error("schema_fragment_id"); + return Uri.resolve(xmlBaseHandler.getBaseUri(), + Uri.escapeDisallowedChars(schemaUri)); + } + + private String getSchemaType(Attributes attributes) { + return attributes.getValue("", "schemaType"); + } + + private ElementsOrAttributes toElementsOrAttributes(String value, ElementsOrAttributes defaultValue) { + if (value == null) + return defaultValue; + ElementsOrAttributes eoa = ElementsOrAttributes.NEITHER; + if (value.indexOf("elements") >= 0) + eoa = eoa.addElements(); + if (value.indexOf("attributes") >= 0) + eoa = eoa.addAttributes(); + return eoa; + } + + private ModeUsage getModeUsage(Attributes attributes) { + return new ModeUsage(getUseMode(attributes), currentMode); + } + + private Mode getUseMode(Attributes attributes) { + Mode mode = getModeAttribute(attributes, "useMode"); + if (mode == null) + return Mode.CURRENT; + mode.noteUsed(locator); + return mode; + } + + private String getNs(Attributes attributes) throws SAXException { + String ns = attributes.getValue("", "ns"); + if (ns != null && !Uri.isAbsolute(ns) && !ns.equals("")) + error("ns_absolute"); + return ns; + } + + void error(String key) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key), locator)); + } + + void error(String key, String arg) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg), locator)); + } + + void error(String key, String arg, Locator locator) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg), locator)); + } + + void error(String key, String arg1, String arg2) throws SAXException { + hadError = true; + if (eh == null) + return; + eh.error(new SAXParseException(localizer.message(key, arg1, arg2), locator)); + } + + } + + // modified for ePubCheck + SchemaImpl(PropertyMap properties, XMLReaderCreator xrc) { + super(properties); + this.xrc = xrc; + this.attributesSchema = properties.contains(NrlProperty.ATTRIBUTES_SCHEMA); + makeBuiltinMode("#allow", AllowAction.class); + makeBuiltinMode("#attach", AttachAction.class); + makeBuiltinMode("#unwrap", UnwrapAction.class); + defaultBaseMode = makeBuiltinMode("#reject", RejectAction.class); + } + + private Mode makeBuiltinMode(String name, Class cls) { + Mode mode = lookupCreateMode(name); + ActionSet actions = new ActionSet(); + ModeUsage modeUsage = new ModeUsage(Mode.CURRENT, mode); + if (cls == AttachAction.class) + actions.setResultAction(new AttachAction(modeUsage)); + else if (cls == AllowAction.class) + actions.addNoResultAction(new AllowAction(modeUsage)); + else if (cls == UnwrapAction.class) + actions.setResultAction(new UnwrapAction(modeUsage)); + else + actions.addNoResultAction(new RejectAction(modeUsage)); + mode.bindElement(Mode.ANY_NAMESPACE, actions); + mode.noteDefined(null); + AttributeActionSet attributeActions = new AttributeActionSet(); + if (attributesSchema) + attributeActions.setReject(true); + else + attributeActions.setAttach(true); + mode.bindAttribute(Mode.ANY_NAMESPACE, attributeActions); + return mode; + } + + SchemaFuture installHandlers(XMLReader in, SchemaReceiverImpl sr) { + Handler h = new Handler(sr); + in.setContentHandler(h); + return h; + } + + public Validator createValidator(PropertyMap properties) { + return new ValidatorImpl(startMode, properties); + } + + private Mode getModeAttribute(Attributes attributes, String localName) { + return lookupCreateMode(attributes.getValue("", localName)); + } + + private Mode lookupCreateMode(String name) { + if (name == null) + return null; + name = name.trim(); + Mode mode = (Mode)modeMap.get(name); + if (mode == null) { + mode = new Mode(name, defaultBaseMode); + modeMap.put(name, mode); + } + return mode; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaReceiverImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaReceiverImpl.java new file mode 100644 index 0000000..311ea13 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SchemaReceiverImpl.java @@ -0,0 +1,110 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.auto.AutoSchemaReader; +import com.thaiopensource.validate.auto.SchemaFuture; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.rng.SAXSchemaReader; +import com.thaiopensource.xml.sax.XMLReaderCreator; + +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import java.io.IOException; +import java.net.URL; + +class SchemaReceiverImpl implements SchemaReceiver { + private static final String NRL_SCHEMA = "nrl.rng"; + private static final String RNC_MEDIA_TYPE = "application/x-rnc"; + private final PropertyMap properties; + private final boolean attributesSchema; + private final SchemaReader autoSchemaReader; + private Schema nrlSchema = null; + private final XMLReaderCreator xrc; + private static final PropertyId subSchemaProperties[] = { + ValidateProperty.ERROR_HANDLER, + ValidateProperty.XML_READER_CREATOR, + ValidateProperty.ENTITY_RESOLVER, + SchemaReceiverFactory.PROPERTY, + }; + + // modified for ePubCheck + public SchemaReceiverImpl(PropertyMap properties, XMLReaderCreator xrc) { + this.xrc = xrc; + this.attributesSchema = properties.contains(NrlProperty.ATTRIBUTES_SCHEMA); + PropertyMapBuilder builder = new PropertyMapBuilder(); + for (int i = 0; i < subSchemaProperties.length; i++) { + Object value = properties.get(subSchemaProperties[i]); + if (value != null) + builder.put(subSchemaProperties[i], value); + } + this.properties = builder.toPropertyMap(); + this.autoSchemaReader = new AutoSchemaReader(SchemaReceiverFactory.PROPERTY.get(properties)); + } + + // modified for ePubCheck + public SchemaFuture installHandlers(XMLReader xr) { + PropertyMapBuilder builder = new PropertyMapBuilder(properties); + if (attributesSchema) + NrlProperty.ATTRIBUTES_SCHEMA.add(builder); + return new SchemaImpl(builder.toPropertyMap(), xrc).installHandlers(xr, this); + } + + Schema getNrlSchema() throws IOException, IncorrectSchemaException, SAXException { + if (nrlSchema == null) { + String className = SchemaReceiverImpl.class.getName(); + String resourceName = className.substring(0, className.lastIndexOf('.')).replace('.', '/') + "/resources/" + NRL_SCHEMA; + URL nrlSchemaUrl = getResource(resourceName); + nrlSchema = SAXSchemaReader.getInstance().createSchema(new InputSource(nrlSchemaUrl.toString()), + properties); + } + return nrlSchema; + } + + private static URL getResource(String resourceName) { + ClassLoader cl = SchemaReceiverImpl.class.getClassLoader(); + // XXX see if we should borrow 1.2 code from Service + if (cl == null) + return ClassLoader.getSystemResource(resourceName); + else + return cl.getResource(resourceName); + } + + PropertyMap getProperties() { + return properties; + } + + Schema createChildSchema(InputSource inputSource, String schemaType, PropertyMap options, boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException { + SchemaReader reader = isRnc(schemaType) ? CompactSchemaReader.getInstance() : autoSchemaReader; + PropertyMapBuilder builder = new PropertyMapBuilder(properties); + if (isAttributesSchema) + NrlProperty.ATTRIBUTES_SCHEMA.add(builder); + for (int i = 0, len = options.size(); i < len; i++) + builder.put(options.getKey(i), options.get(options.getKey(i))); + return reader.createSchema(inputSource, builder.toPropertyMap()); + } + + Option getOption(String uri) { + Option option = autoSchemaReader.getOption(uri); + if (option != null) + return option; + return CompactSchemaReader.getInstance().getOption(uri); + } + + private static boolean isRnc(String schemaType) { + if (schemaType == null) + return false; + schemaType = schemaType.trim(); + return schemaType.equals(RNC_MEDIA_TYPE); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SectionState.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SectionState.java new file mode 100644 index 0000000..e274011 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/SectionState.java @@ -0,0 +1,23 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.nrl.ModeUsage; +import org.xml.sax.SAXException; +import org.xml.sax.ContentHandler; + +interface SectionState { + /** + * + * @param modeUsage + * @param handler may be null + */ + void addChildMode(ModeUsage modeUsage, ContentHandler handler); + void addValidator(Schema schema, ModeUsage modeUsage); + /** + * + * @param handler must not be null + */ + void addActiveHandler(ContentHandler handler, ModeUsage attributeModeUsage); + void addAttributeValidationModeUsage(ModeUsage modeUsage); + void reject() throws SAXException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/UnwrapAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/UnwrapAction.java new file mode 100644 index 0000000..67630df --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/UnwrapAction.java @@ -0,0 +1,17 @@ +package com.thaiopensource.validate.nrl; + +import org.xml.sax.ContentHandler; + +class UnwrapAction extends ResultAction { + UnwrapAction(ModeUsage modeUsage) { + super(modeUsage); + } + + void perform(ContentHandler handler, SectionState state) { + state.addChildMode(getModeUsage(), handler); + } + + ResultAction changeCurrentMode(Mode mode) { + return new UnwrapAction(getModeUsage().changeCurrentMode(mode)); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidateAction.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidateAction.java new file mode 100644 index 0000000..dab484f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidateAction.java @@ -0,0 +1,33 @@ +package com.thaiopensource.validate.nrl; + +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import com.thaiopensource.validate.nrl.NoResultAction; +import com.thaiopensource.validate.nrl.SectionState; +import org.xml.sax.SAXException; + +class ValidateAction extends NoResultAction { + private final Schema schema; + + ValidateAction(ModeUsage modeUsage, Schema schema) { + super(modeUsage); + this.schema = schema; + } + + void perform(SectionState state) throws SAXException { + state.addValidator(schema, getModeUsage()); + } + + NoResultAction changeCurrentMode(Mode mode) { + return new ValidateAction(getModeUsage().changeCurrentMode(mode), schema); + } + + public boolean equals(Object obj) { + return super.equals(obj) && schema.equals(((ValidateAction)obj).schema); + } + + public int hashCode() { + return super.hashCode() ^ schema.hashCode(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidatorImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidatorImpl.java new file mode 100644 index 0000000..6dbbd6c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/ValidatorImpl.java @@ -0,0 +1,399 @@ +package com.thaiopensource.validate.nrl; + +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; +import org.xml.sax.DTDHandler; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.nrl.ActionSet; +import com.thaiopensource.validate.nrl.AttributeActionSet; +import com.thaiopensource.validate.nrl.FilteredAttributes; +import com.thaiopensource.validate.nrl.Hashset; +import com.thaiopensource.validate.nrl.IntSet; +import com.thaiopensource.validate.nrl.Mode; +import com.thaiopensource.validate.nrl.ModeUsage; +import com.thaiopensource.validate.nrl.NoResultAction; +import com.thaiopensource.validate.nrl.ResultAction; +import com.thaiopensource.validate.nrl.SectionState; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyMap; + +import java.util.Vector; +import java.util.Stack; +import java.util.Hashtable; +import java.util.Enumeration; + +class ValidatorImpl extends DefaultHandler implements Validator { + private static final String BEARER_URI = ""; + private static final String BEARER_LOCAL_NAME = "#bearer"; + private static final String NO_NS = "\0"; + private final ErrorHandler eh; + private final PropertyMap properties; + private Locator locator; + private Section currentSection; + private PrefixMapping prefixMapping = null; + private final Hashtable validatorHandlerCache = new Hashtable(); + private final Localizer localizer = new Localizer(ValidatorImpl.class); + private final Hashset noResultActions = new Hashset(); + private final Hashtable attributeNamespaceIndexSets = new Hashtable(); + private final Vector activeHandlersAttributeIndexSets = new Vector(); + private final Hashset attributeSchemas = new Hashset(); + private boolean attributeNamespaceRejected; + private Attributes filteredAttributes; + private final Mode startMode; + + static private class PrefixMapping { + final String prefix; + final String uri; + final PrefixMapping parent; + + PrefixMapping(String prefix, String uri, PrefixMapping parent) { + this.prefix = prefix; + this.uri = uri; + this.parent = parent; + } + } + + private class Section implements SectionState { + final Section parent; + /** + * Namespace of this section. Empty string for absent. + */ + final String ns; + /** + * Number of open elements in this section. + */ + int depth = 0; + /** + * List of the Validators rooted in this section + */ + final Vector validators = new Vector(); + final Vector schemas = new Vector(); + /** + * List of the ContentHandlers that want to see the elements in this section + */ + final Vector activeHandlers = new Vector(); + final Vector activeHandlersAttributeModeUsage = new Vector(); + final Vector attributeValidationModeUsages = new Vector(); + /** + * List of Programs saying what to do with child sections + */ + final Vector childPrograms = new Vector(); + final Stack context = new Stack(); + boolean contextDependent = false; + int attributeProcessing = Mode.ATTRIBUTE_PROCESSING_NONE; + + Section(String ns, Section parent) { + this.ns = ns; + this.parent = parent; + } + + public void addChildMode(ModeUsage modeUsage, ContentHandler handler) { + childPrograms.addElement(new Program(modeUsage, handler)); + if (modeUsage.isContextDependent()) + contextDependent = true; + } + + public void addValidator(Schema schema, ModeUsage modeUsage) { + schemas.addElement(schema); + Validator validator = createValidator(schema); + validators.addElement(validator); + activeHandlers.addElement(validator.getContentHandler()); + activeHandlersAttributeModeUsage.addElement(modeUsage); + attributeProcessing = Math.max(attributeProcessing, + modeUsage.getAttributeProcessing()); + childPrograms.addElement(new Program(modeUsage, validator.getContentHandler())); + if (modeUsage.isContextDependent()) + contextDependent = true; + } + + public void addActiveHandler(ContentHandler handler, ModeUsage attributeModeUsage) { + activeHandlers.addElement(handler); + activeHandlersAttributeModeUsage.addElement(attributeModeUsage); + attributeProcessing = Math.max(attributeProcessing, + attributeModeUsage.getAttributeProcessing()); + if (attributeModeUsage.isContextDependent()) + contextDependent = true; + } + + public void addAttributeValidationModeUsage(ModeUsage modeUsage) { + int ap = modeUsage.getAttributeProcessing(); + if (ap != Mode.ATTRIBUTE_PROCESSING_NONE) { + attributeValidationModeUsages.addElement(modeUsage); + attributeProcessing = Math.max(ap, attributeProcessing); + if (modeUsage.isContextDependent()) + contextDependent = true; + } + } + + public void reject() throws SAXException { + if (eh != null) + eh.error(new SAXParseException(localizer.message("reject_element", ns), + locator)); + } + + } + + static private class Program { + final ModeUsage modeUsage; + final ContentHandler handler; + + Program(ModeUsage modeUsage, ContentHandler handler) { + this.modeUsage = modeUsage; + this.handler = handler; + } + } + + ValidatorImpl(Mode mode, PropertyMap properties) { + this.properties = properties; + this.eh = ValidateProperty.ERROR_HANDLER.get(properties); + this.startMode = mode; + initCurrentSection(); + } + + private void initCurrentSection() { + currentSection = new Section(NO_NS, null); + currentSection.addChildMode(new ModeUsage(startMode, startMode), null); + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void characters(char ch[], int start, int length) + throws SAXException { + for (int i = 0, len = currentSection.activeHandlers.size(); i < len; i++) + ((ContentHandler)(currentSection.activeHandlers.elementAt(i))).characters(ch, start, length); + + } + + public void ignorableWhitespace(char ch[], int start, int length) + throws SAXException { + for (int i = 0, len = currentSection.activeHandlers.size(); i < len; i++) + ((ContentHandler)(currentSection.activeHandlers.elementAt(i))).ignorableWhitespace(ch, start, length); + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + if (!uri.equals(currentSection.ns)) + startSection(uri); + currentSection.depth++; + if (currentSection.contextDependent) + currentSection.context.push(localName); + boolean transformAttributes = processAttributes(attributes); + for (int i = 0, len = currentSection.activeHandlers.size(); i < len; i++) { + ContentHandler handler = (ContentHandler)(currentSection.activeHandlers.elementAt(i)); + handler.startElement(uri, localName, qName, + transformAttributes + ? filterAttributes((IntSet)activeHandlersAttributeIndexSets.elementAt(i), + attributes) + : attributes); + } + } + + private static Attributes filterAttributes(IntSet indexSet, Attributes attributes) { + if (indexSet.size() == attributes.getLength()) + return attributes; + return new FilteredAttributes(indexSet, attributes); + } + + private boolean processAttributes(Attributes attributes) throws SAXException { + if (currentSection.attributeProcessing == Mode.ATTRIBUTE_PROCESSING_NONE + || attributes.getLength() == 0) + return false; + attributeNamespaceIndexSets.clear(); + for (int i = 0, len = attributes.getLength(); i < len; i++) { + String ns = attributes.getURI(i); + IntSet indexSet = (IntSet)attributeNamespaceIndexSets.get(ns); + if (indexSet == null) { + indexSet = new IntSet(); + attributeNamespaceIndexSets.put(ns, indexSet); + } + indexSet.add(i); + } + if (currentSection.attributeProcessing == Mode.ATTRIBUTE_PROCESSING_QUALIFIED + && attributeNamespaceIndexSets.size() == 1 + && attributeNamespaceIndexSets.get("") != null) + return false; + Vector handlerModes = currentSection.activeHandlersAttributeModeUsage; + activeHandlersAttributeIndexSets.setSize(handlerModes.size()); + for (int i = 0, len = handlerModes.size(); i < len; i++) + activeHandlersAttributeIndexSets.setElementAt(new IntSet(), i); + boolean transform = false; + Vector validationModes = currentSection.attributeValidationModeUsages; + for (Enumeration e = attributeNamespaceIndexSets.keys(); e.hasMoreElements();) { + String ns = (String)e.nextElement(); + IntSet indexSet = (IntSet)attributeNamespaceIndexSets.get(ns); + attributeSchemas.clear(); + filteredAttributes = null; + attributeNamespaceRejected = false; + for (int i = 0, len = handlerModes.size(); i < len; i++) { + ModeUsage modeUsage = (ModeUsage)handlerModes.elementAt(i); + AttributeActionSet actions = processAttributeSection(modeUsage, ns, indexSet, attributes); + if (actions.getAttach()) + ((IntSet)activeHandlersAttributeIndexSets.get(i)).addAll(indexSet); + else + transform = true; + } + for (int i = 0, len = validationModes.size(); i < len; i++) { + ModeUsage modeUsage = (ModeUsage)validationModes.elementAt(i); + processAttributeSection(modeUsage, ns, indexSet, attributes); + } + } + return transform; + } + + private AttributeActionSet processAttributeSection(ModeUsage modeUsage, + String ns, + IntSet indexSet, + Attributes attributes) + throws SAXException { + Mode mode = modeUsage.getMode(currentSection.context); + AttributeActionSet actions = mode.getAttributeActions(ns); + if (actions.getReject() && !attributeNamespaceRejected) { + attributeNamespaceRejected = true; + if (eh != null) + eh.error(new SAXParseException(localizer.message("reject_attribute", ns), + locator)); + } + Schema[] schemas = actions.getSchemas(); + for (int j = 0; j < schemas.length; j++) { + if (attributeSchemas.contains(schemas[j])) + continue; + attributeSchemas.add(schemas[j]); + if (filteredAttributes == null) + filteredAttributes = filterAttributes(indexSet, attributes); + validateAttributes(schemas[j], filteredAttributes); + } + return actions; + } + + private void validateAttributes(Schema schema, Attributes attributes) throws SAXException { + Validator validator = createValidator(schema); + ContentHandler ch = validator.getContentHandler(); + initHandler(ch); + ch.startElement(BEARER_URI, BEARER_LOCAL_NAME, BEARER_LOCAL_NAME, attributes); + ch.endElement(BEARER_URI, BEARER_LOCAL_NAME, BEARER_LOCAL_NAME); + cleanupHandler(ch); + releaseValidator(schema, validator); + } + + private void startSection(String uri) throws SAXException { + Section section = new Section(uri, currentSection); + Vector childPrograms = currentSection.childPrograms; + noResultActions.clear(); + for (int i = 0, len = childPrograms.size(); i < len; i++) { + Program program = (Program)childPrograms.elementAt(i); + ActionSet actions = program.modeUsage.getMode(currentSection.context).getElementActions(uri); + ResultAction resultAction = actions.getResultAction(); + if (resultAction != null) + resultAction.perform(program.handler, section); + NoResultAction[] nra = actions.getNoResultActions(); + for (int j = 0; j < nra.length; j++) { + NoResultAction tem = nra[j]; + if (!noResultActions.contains(tem)) { + nra[j].perform(section); + noResultActions.add(tem); + } + } + } + for (int i = 0, len = section.validators.size(); i < len; i++) + initHandler(((Validator)section.validators.elementAt(i)).getContentHandler()); + currentSection = section; + } + + private void initHandler(ContentHandler ch) throws SAXException { + if (locator != null) + ch.setDocumentLocator(locator); + ch.startDocument(); + for (PrefixMapping pm = prefixMapping; pm != null; pm = pm.parent) + ch.startPrefixMapping(pm.prefix, pm.uri); + } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + for (int i = 0, len = currentSection.activeHandlers.size(); i < len; i++) + ((ContentHandler)(currentSection.activeHandlers.elementAt(i))).endElement(uri, localName, qName); + currentSection.depth--; + if (currentSection.contextDependent) + currentSection.context.pop(); + if (currentSection.depth == 0) + endSection(); + } + + private void endSection() throws SAXException { + for (int i = 0, len = currentSection.validators.size(); i < len; i++) { + Validator validator = (Validator)currentSection.validators.elementAt(i); + cleanupHandler(validator.getContentHandler()); + releaseValidator((Schema)currentSection.schemas.elementAt(i), validator); + // endDocument() on one of the validators may throw an exception + // in this case we don't want to release the validator twice + currentSection.validators.setElementAt(null, i); + } + currentSection = currentSection.parent; + } + + private void cleanupHandler(ContentHandler vh) throws SAXException { + for (PrefixMapping pm = prefixMapping; pm != null; pm = pm.parent) + vh.endPrefixMapping(pm.prefix); + vh.endDocument(); + } + + public void endDocument() + throws SAXException { + } + + public void startPrefixMapping(String prefix, String uri) + throws SAXException { + super.startPrefixMapping(prefix, uri); + prefixMapping = new PrefixMapping(prefix, uri, prefixMapping); + } + + public void endPrefixMapping(String prefix) + throws SAXException { + super.endPrefixMapping(prefix); + prefixMapping = prefixMapping.parent; + } + + private Validator createValidator(Schema schema) { + Stack stack = (Stack)validatorHandlerCache.get(schema); + if (stack == null) { + stack = new Stack(); + validatorHandlerCache.put(schema, stack); + } + if (stack.empty()) + return schema.createValidator(properties); + return (Validator)stack.pop(); + } + + private void releaseValidator(Schema schema, Validator vh) { + if (vh == null) + return; + vh.reset(); + ((Stack)validatorHandlerCache.get(schema)).push(vh); + } + + public void reset() { + for (; currentSection != null; currentSection = currentSection.parent) { + for (int i = 0, len = currentSection.validators.size(); i < len; i++) + releaseValidator((Schema)currentSection.schemas.elementAt(i), + (Validator)currentSection.validators.elementAt(i)); + } + initCurrentSection(); + } + + public ContentHandler getContentHandler() { + return this; + } + + public DTDHandler getDTDHandler() { + return this; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/Messages.properties new file mode 100644 index 0000000..7716924 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/Messages.properties @@ -0,0 +1,26 @@ +reject_element=elements from namespace \"{0}\" are not allowed +reject_attribute=attributes from namespace \"{0}\" are not allowed +undefined_mode=mode \"{0}\" not defined +schema_fragment_id=schema URI must not have a fragment identifier +ns_absolute=namespace URI must be absolute URI +unexpected_slash=unexpected \"/\" +expected_slash=expected \"/\" +expected_name=expected a name +empty_path=empty path +invalid_name=invalid name +duplicate_path=context with path \"{0}\" already defined +context_any_namespace=\"context\" not allowed within \"anyNamespace\" +duplicate_mode=mode \"{0}\" already defined +first_mode=mode \"{0}\" was first defined here +duplicate_attribute_action_any_namespace=rule for attributes from any namespace already specified in this mode +duplicate_attribute_action=rule for attributes from namespace \"{0}\" already specified in this mode +duplicate_element_action_any_namespace=rule for elements from any namespace already specified in this mode +duplicate_element_action=rule for elements from namespace \"{0}\" already specified in this mode +mode_cycle=mode \"{0}\" directly or indirectly extends itself +unknown_option=option \"{0}\" not recognized +unsupported_option=option \"{0}\" is not supported for this kind of schema +unsupported_option_arg=specified argument for option \"{0}\" is not supported +duplicate_option=option \"{0}\" cannot be specified more than once +option_requires_argument=option \"{0}\" requires an argument +option_unexpected_argument=option \"{0}\" does not take an argument +option_bad_argument=invalid argument for option \"{0}\" diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/nrl.rng b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/nrl.rng new file mode 100644 index 0000000..696fa1a --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/nrl/resources/nrl.rng @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + elements + attributes + + + attributes + elements + + elements + attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + allow + reject + + + + + + + + + + + + attach + unwrap + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #attach + #allow + #reject + #unwrap + + + + + + + + + + + + + \s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*(|\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*)* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/CompactSchemaReader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/CompactSchemaReader.java new file mode 100644 index 0000000..b2da9f1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/CompactSchemaReader.java @@ -0,0 +1,24 @@ +package com.thaiopensource.validate.rng; + +import com.thaiopensource.relaxng.impl.SchemaReaderImpl; +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.relaxng.parse.compact.CompactParseable; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.InputSource; +import org.xml.sax.ErrorHandler; + +public class CompactSchemaReader extends SchemaReaderImpl { + private static final SchemaReader theInstance = new CompactSchemaReader(); + + private CompactSchemaReader() { + } + + public static SchemaReader getInstance() { + return theInstance; + } + + protected Parseable createParseable(XMLReaderCreator xrc, InputSource in, ErrorHandler eh) { + return new CompactParseable(in, eh); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/RngProperty.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/RngProperty.java new file mode 100644 index 0000000..03027d6 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/RngProperty.java @@ -0,0 +1,45 @@ +package com.thaiopensource.validate.rng; + +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.FlagPropertyId; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.FlagOption; +import com.thaiopensource.validate.SchemaReader; +import org.relaxng.datatype.DatatypeLibraryFactory; + +public class RngProperty { + + private RngProperty() { } + + public static class DatatypeLibraryFactoryPropertyId extends PropertyId { + public DatatypeLibraryFactoryPropertyId(String name) { + super(name, DatatypeLibraryFactory.class); + } + + public DatatypeLibraryFactory get(PropertyMap properties) { + return (DatatypeLibraryFactory)properties.get(this); + } + + public DatatypeLibraryFactory put(PropertyMapBuilder builder, DatatypeLibraryFactory value) { + return (DatatypeLibraryFactory)builder.put(this, value); + } + } + + public static final DatatypeLibraryFactoryPropertyId DATATYPE_LIBRARY_FACTORY + = new DatatypeLibraryFactoryPropertyId("DATATYPE_LIBRARY_FACTORY"); + public static final FlagPropertyId CHECK_ID_IDREF = new FlagPropertyId("CHECK_ID_IDREF"); + public static final FlagPropertyId FEASIBLE = new FlagPropertyId("FEASIBLE"); + + public static Option getOption(String uri) { + if (!uri.startsWith(SchemaReader.BASE_URI)) + return null; + uri = uri.substring(SchemaReader.BASE_URI.length()); + if (uri.equals("feasible")) + return new FlagOption(FEASIBLE); + if (uri.equals("check-id-idref")) + return new FlagOption(CHECK_ID_IDREF); + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReader.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReader.java new file mode 100644 index 0000000..073d63e --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReader.java @@ -0,0 +1,24 @@ +package com.thaiopensource.validate.rng; + +import com.thaiopensource.relaxng.impl.SchemaReaderImpl; +import com.thaiopensource.relaxng.parse.Parseable; +import com.thaiopensource.relaxng.parse.sax.SAXParseable; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.InputSource; +import org.xml.sax.ErrorHandler; + +public class SAXSchemaReader extends SchemaReaderImpl { + private static final SchemaReader theInstance = new SAXSchemaReader(); + + private SAXSchemaReader() { + } + + public static SchemaReader getInstance() { + return theInstance; + } + + protected Parseable createParseable(XMLReaderCreator xrc, InputSource in, ErrorHandler eh) { + return new SAXParseable(xrc, in, eh); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.java new file mode 100644 index 0000000..4432f0d --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/rng/SAXSchemaReceiverFactory.java @@ -0,0 +1,28 @@ +package com.thaiopensource.validate.rng; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.auto.SchemaReceiver; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.relaxng.impl.SchemaReceiverImpl; +import com.thaiopensource.relaxng.parse.sax.SAXParseReceiver; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Option; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import com.thaiopensource.xml.util.WellKnownNamespaces; +import org.xml.sax.ErrorHandler; + +public class SAXSchemaReceiverFactory implements SchemaReceiverFactory { + public SchemaReceiver createSchemaReceiver(String namespaceUri, + PropertyMap properties) { + // XXX allow namespaces with incorrect version + if (!WellKnownNamespaces.RELAX_NG.equals(namespaceUri)) + return null; + XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties); + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + return new SchemaReceiverImpl(new SAXParseReceiver(xrc, eh), properties); + } + + public Option getOption(String uri) { + return RngProperty.getOption(uri); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/DraconianErrorListener.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/DraconianErrorListener.java new file mode 100644 index 0000000..4f8a6e2 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/DraconianErrorListener.java @@ -0,0 +1,23 @@ +package com.thaiopensource.validate.schematron; + +import javax.xml.transform.ErrorListener; +import javax.xml.transform.TransformerException; + +class DraconianErrorListener implements ErrorListener { + DraconianErrorListener() { + } + + public void warning(TransformerException exception) + throws TransformerException { + } + + public void error(TransformerException exception) + throws TransformerException { + throw exception; + } + + public void fatalError(TransformerException exception) + throws TransformerException { + throw exception; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/OutputHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/OutputHandler.java new file mode 100644 index 0000000..95ac8b7 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/OutputHandler.java @@ -0,0 +1,95 @@ +package com.thaiopensource.validate.schematron; + +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXParseException; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; +import com.thaiopensource.util.Localizer; + +class OutputHandler extends DefaultHandler { + private final ErrorHandler eh; + private int lineNumber = -1; + private String systemId = null; + private final StringBuffer message = new StringBuffer(); + private boolean inMessage = false; + private final String lineSeparator; + private static final String indent = " "; + private final Localizer localizer = new Localizer(OutputHandler.class); + + OutputHandler(ErrorHandler eh) { + this.eh = eh; + this.lineSeparator = System.getProperty("line.separator"); + } + + public void characters(char ch[], int start, int length) + throws SAXException { + if (inMessage) { + for (int i = 0; i < length; i++) { + char c = ch[start + i]; + switch (c) { + case ' ': + case '\r': + case '\n': + case '\t': + if (message.length() == 0 || message.charAt(message.length() - 1) != ' ') + message.append(' '); + break; + default: + message.append(c); + break; + } + } + } + } + + public void ignorableWhitespace(char ch[], int start, int length) + throws SAXException { + characters(ch, start, length); + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) + throws SAXException { + if (localName.equals("failed-assertion") + || localName.equals("report")) { + String value = attributes.getValue("", "line-number"); + if (value == null) + lineNumber = -1; + else { + try { + lineNumber = Integer.parseInt(value); + } + catch (NumberFormatException e) { + lineNumber = -1; + } + } + value = attributes.getValue("", "system-id"); + if (value != null && value.equals("")) + value = null; + systemId = value; + message.append(localizer.message(localName.equals("failed-assertion") + ? "failed_assertion" + : "report")); + } + else if (localName.equals("statement") || localName.equals("diagnostic")) { + inMessage = true; + message.append(lineSeparator); + message.append(indent); + } + } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + if (localName.equals("statement") || localName.equals("diagnostic")) { + if (message.length() > 0 && message.charAt(message.length() - 1) == ' ') + message.setLength(message.length() - 1); + inMessage = false; + } + else if (localName.equals("failed-assertion") + || localName.equals("report")) { + eh.error(new SAXParseException(message.toString(), null, systemId, lineNumber, -1)); + message.setLength(0); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.java new file mode 100644 index 0000000..58bfd59 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SaxonSchemaReaderFactory.java @@ -0,0 +1,11 @@ +package com.thaiopensource.validate.schematron; + +import com.icl.saxon.TransformerFactoryImpl; + +import javax.xml.transform.TransformerFactory; + +public class SaxonSchemaReaderFactory extends SchematronSchemaReaderFactory { + public TransformerFactory newTransformerFactory() { + return new TransformerFactoryImpl(); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaImpl.java new file mode 100644 index 0000000..463f964 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaImpl.java @@ -0,0 +1,21 @@ +package com.thaiopensource.validate.schematron; + +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.AbstractSchema; +import com.thaiopensource.validate.Validator; + +import javax.xml.transform.Templates; + +class SchemaImpl extends AbstractSchema { + private final Templates templates; + + SchemaImpl(Templates templates, PropertyMap properties, PropertyId[] supportedPropertyIds) { + super(properties, supportedPropertyIds); + this.templates = templates; + } + + public Validator createValidator(PropertyMap properties) { + return new ValidatorImpl(templates, properties); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaReaderImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaReaderImpl.java new file mode 100644 index 0000000..0679ee9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchemaReaderImpl.java @@ -0,0 +1,499 @@ +package com.thaiopensource.validate.schematron; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.util.Localizer; +import com.thaiopensource.util.PropertyId; +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.rng.CompactSchemaReader; +import com.thaiopensource.validate.rng.RngProperty; +import com.thaiopensource.xml.sax.CountingErrorHandler; +import com.thaiopensource.xml.sax.DelegatingContentHandler; +import com.thaiopensource.xml.sax.DraconianErrorHandler; +import com.thaiopensource.xml.sax.ForkContentHandler; +import com.thaiopensource.xml.sax.XMLReaderCreator; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; + +import javax.xml.transform.ErrorListener; +import javax.xml.transform.SourceLocator; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.stream.StreamSource; +import java.io.IOException; +import java.io.InputStream; + +class SchemaReaderImpl implements SchemaReader { + static final String SCHEMATRON_URI = "http://www.ascc.net/xml/schematron"; + private static final String LOCATION_URI = "http://www.thaiopensource.com/ns/location"; + private static final String ERROR_URI = "http://www.thaiopensource.com/ns/error"; + private final Localizer localizer = new Localizer(SchemaReaderImpl.class); + + private final Class transformerFactoryClass; + private final Templates schematron; + private final Schema schematronSchema; + private static final String SCHEMATRON_SCHEMA = "schematron.rnc"; + private static final String SCHEMATRON_STYLESHEET = "schematron.xsl"; + private static final PropertyId[] supportedPropertyIds = { + ValidateProperty.ERROR_HANDLER, + ValidateProperty.XML_READER_CREATOR, + SchematronProperty.DIAGNOSE, + SchematronProperty.PHASE, + }; + + SchemaReaderImpl(TransformerFactory transformerFactory) throws TransformerConfigurationException, IncorrectSchemaException { + this.transformerFactoryClass = transformerFactory.getClass(); + String resourceName = fullResourceName(SCHEMATRON_STYLESHEET); + StreamSource source = new StreamSource(getResourceAsStream(resourceName)); + initTransformerFactory(transformerFactory); + schematron = transformerFactory.newTemplates(source); + InputSource schemaSource = new InputSource(getResourceAsStream(fullResourceName(SCHEMATRON_SCHEMA))); + PropertyMapBuilder builder = new PropertyMapBuilder(); + ValidateProperty.ERROR_HANDLER.put(builder, new DraconianErrorHandler()); + RngProperty.CHECK_ID_IDREF.add(builder); + try { + schematronSchema = CompactSchemaReader.getInstance().createSchema(schemaSource, builder.toPropertyMap()); + } + catch (SAXException e) { + throw new IncorrectSchemaException(); + } + catch (IOException e) { + throw new IncorrectSchemaException(); + } + } + + public Option getOption(String uri) { + return SchematronProperty.getOption(uri); + } + + private void initTransformerFactory(TransformerFactory factory) { + String name = factory.getClass().getName(); + try { + if (name.equals("com.icl.saxon.TransformerFactoryImpl")) + factory.setAttribute("http://icl.com/saxon/feature/linenumbering", + Boolean.TRUE); + else if (name.equals("org.apache.xalan.processor.TransformerFactoryImpl")) { + // Try both the documented URI and the URI that the code expects. + try { + // This is the URI that the code expects. + factory.setAttribute("http://xml.apache.org/xalan/properties/source-location", + Boolean.TRUE); + } + catch (IllegalArgumentException e) { + // This is the URI that's documented. + factory.setAttribute("http://apache.org/xalan/features/source_location", + Boolean.TRUE); + } + } + } + catch (IllegalArgumentException e) { + } + } + + static class ValidateStage extends XMLReaderImpl { + private final ContentHandler validator; + private ContentHandler contentHandler; + private final XMLReader reader; + private final CountingErrorHandler ceh; + + ValidateStage(XMLReader reader, Validator validator, CountingErrorHandler ceh) { + this.reader = reader; + this.validator = validator.getContentHandler(); + this.ceh = ceh; + } + + public void parse(InputSource input) + throws SAXException, IOException { + reader.parse(input); + if (ceh.getHadErrorOrFatalError()) + throw new SAXException(new IncorrectSchemaException()); + } + + public void setContentHandler(ContentHandler handler) { + this.contentHandler = handler; + reader.setContentHandler(new ForkContentHandler(validator, contentHandler)); + } + + public ContentHandler getContentHandler() { + return contentHandler; + } + } + + static class UserException extends Exception { + private final SAXException exception; + + UserException(SAXException exception) { + this.exception = exception; + } + + SAXException getException() { + return exception; + } + } + + static class UserWrapErrorHandler extends CountingErrorHandler { + UserWrapErrorHandler(ErrorHandler errorHandler) { + super(errorHandler); + } + + public void warning(SAXParseException exception) + throws SAXException { + try { + super.warning(exception); + } + catch (SAXException e) { + throw new SAXException(new UserException(e)); + } + } + + public void error(SAXParseException exception) + throws SAXException { + try { + super.error(exception); + } + catch (SAXException e) { + throw new SAXException(new UserException(e)); + } + } + + public void fatalError(SAXParseException exception) + throws SAXException { + try { + super.fatalError(exception); + } + catch (SAXException e) { + throw new SAXException(new UserException(e)); + } + } + } + + static class ErrorFilter extends DelegatingContentHandler { + private final ErrorHandler eh; + private final Localizer localizer; + private Locator locator; + + ErrorFilter(ContentHandler delegate, ErrorHandler eh, Localizer localizer) { + super(delegate); + this.eh = eh; + this.localizer = localizer; + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + super.setDocumentLocator(locator); + } + + public void startElement(String namespaceURI, String localName, + String qName, Attributes atts) + throws SAXException { + if (namespaceURI.equals(ERROR_URI) && localName.equals("error")) + eh.error(new SAXParseException(localizer.message(atts.getValue("", "message"), + atts.getValue("", "arg")), + locator)); + super.startElement(namespaceURI, localName, qName, atts); + } + } + + static class LocationFilter extends DelegatingContentHandler implements Locator { + private final String systemId; + private int lineNumber = -1; + private SAXException exception = null; + + LocationFilter(ContentHandler delegate, String systemId) { + super(delegate); + this.systemId = systemId; + } + + SAXException getException() { + return exception; + } + + public void setDocumentLocator(Locator locator) { + } + + public void startDocument() + throws SAXException { + getDelegate().setDocumentLocator(this); + super.startDocument(); + } + + public void startElement(String namespaceURI, String localName, + String qName, Attributes atts) + throws SAXException { + String value = atts.getValue(LOCATION_URI, "line-number"); + if (value != null) { + try { + lineNumber = Integer.parseInt(value); + } + catch (NumberFormatException e) { + lineNumber = -1; + } + } + else + lineNumber = -1; + try { + super.startElement(namespaceURI, localName, qName, atts); + } + catch (SAXException e) { + this.exception = e; + setDelegate(null); + } + lineNumber = -1; + } + + public String getPublicId() { + return null; + } + + public String getSystemId() { + return systemId; + } + + public int getLineNumber() { + return lineNumber; + } + + public int getColumnNumber() { + return -1; + } + } + + static class TransformStage extends XMLReaderImpl { + private ContentHandler contentHandler; + private final Transformer transformer; + private final SAXSource transformSource; + private final String systemId; + private final CountingErrorHandler ceh; + private final Localizer localizer; + + TransformStage(Transformer transformer, SAXSource transformSource, String systemId, + CountingErrorHandler ceh, Localizer localizer) { + this.transformer = transformer; + this.transformSource = transformSource; + this.systemId = systemId; + this.ceh = ceh; + this.localizer = localizer; + } + + public void parse(InputSource input) + throws IOException, SAXException { + try { + LocationFilter handler = new LocationFilter(new ErrorFilter(contentHandler, ceh, localizer), + systemId); + transformer.transform(transformSource, new SAXResult(handler)); + SAXException exception = handler.getException(); + if (exception != null) + throw exception; + } + catch (TransformerException e) { + if (e.getException() instanceof IOException) + throw (IOException)e.getException(); + throw ValidatorImpl.toSAXException(e); + } + if (ceh.getHadErrorOrFatalError()) + throw new SAXException(new IncorrectSchemaException()); + } + + public ContentHandler getContentHandler() { + return contentHandler; + } + + public void setContentHandler(ContentHandler contentHandler) { + this.contentHandler = contentHandler; + } + } + + static class SAXErrorListener implements ErrorListener { + private final ErrorHandler eh; + private final String systemId; + private boolean hadError = false; + SAXErrorListener(ErrorHandler eh, String systemId) { + this.eh = eh; + this.systemId = systemId; + } + + boolean getHadError() { + return hadError; + } + + public void warning(TransformerException exception) + throws TransformerException { + SAXParseException spe = transform(exception); + try { + eh.warning(spe); + } + catch (SAXException e) { + throw new TransformerException(new UserException(e)); + } + } + + public void error(TransformerException exception) + throws TransformerException { + hadError = true; + SAXParseException spe = transform(exception); + try { + eh.error(spe); + } + catch (SAXException e) { + throw new TransformerException(new UserException(e)); + } + } + + public void fatalError(TransformerException exception) + throws TransformerException { + hadError = true; + SAXParseException spe = transform(exception); + try { + eh.fatalError(spe); + } + catch (SAXException e) { + throw new TransformerException(new UserException(e)); + } + } + + SAXParseException transform(TransformerException exception) throws TransformerException { + Throwable cause = exception.getException(); + // Xalan takes it upon itself to catch exceptions and pass them to the ErrorListener. + if (cause instanceof RuntimeException) + throw (RuntimeException)cause; + if (cause instanceof SAXException + || cause instanceof IncorrectSchemaException + || cause instanceof IOException) + throw exception; + SourceLocator locator = exception.getLocator(); + if (locator == null) + return new SAXParseException(exception.getMessage(), null); + // Xalan sometimes loses the systemId; work around this. + String s = locator.getSystemId(); + if (s == null) + s = systemId; + return new SAXParseException(exception.getMessage(), + null, + s, + locator.getLineNumber(), + -1); + } + } + + public Schema createSchema(InputSource in, PropertyMap properties) + throws IOException, SAXException, IncorrectSchemaException { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + SAXErrorListener errorListener = new SAXErrorListener(eh, in.getSystemId()); + UserWrapErrorHandler ueh1 = new UserWrapErrorHandler(eh); + UserWrapErrorHandler ueh2 = new UserWrapErrorHandler(eh); + try { + PropertyMapBuilder builder = new PropertyMapBuilder(properties); + ValidateProperty.ERROR_HANDLER.put(builder, ueh1); + SAXSource source = createValidatingSource(in, builder.toPropertyMap(), ueh1); + source = createTransformingSource(source, + SchematronProperty.PHASE.get(properties), + properties.contains(SchematronProperty.DIAGNOSE), + in.getSystemId(), + ueh2); + TransformerFactory transformerFactory = (TransformerFactory)transformerFactoryClass.newInstance(); + initTransformerFactory(transformerFactory); + transformerFactory.setErrorListener(errorListener); + Templates templates = transformerFactory.newTemplates(source); + return new SchemaImpl(templates, properties, supportedPropertyIds); + } + catch (TransformerConfigurationException e) { + throw toSAXException(e, errorListener.getHadError() + || ueh1.getHadErrorOrFatalError() + || ueh2.getHadErrorOrFatalError()); + } + catch (InstantiationException e) { + throw new SAXException(e); + } + catch (IllegalAccessException e) { + throw new SAXException(e); + } + } + + private SAXSource createValidatingSource(InputSource in, PropertyMap properties, CountingErrorHandler ceh) throws SAXException { + Validator validator = schematronSchema.createValidator(properties); + XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties); + XMLReader xr = xrc.createXMLReader(); + xr.setErrorHandler(ceh); + return new SAXSource(new ValidateStage(xr, validator, ceh), in); + } + + private SAXSource createTransformingSource(SAXSource in, String phase, boolean diagnose, + String systemId, CountingErrorHandler ceh) throws SAXException { + try { + Transformer transformer = schematron.newTransformer(); + transformer.setErrorListener(new DraconianErrorListener()); + if (phase != null) + transformer.setParameter("phase", phase); + if (diagnose) + transformer.setParameter("diagnose", Boolean.TRUE); + return new SAXSource(new TransformStage(transformer, in, systemId, ceh, localizer), + new InputSource(systemId)); + } + catch (TransformerConfigurationException e) { + throw new SAXException(e); + } + } + + private SAXException toSAXException(TransformerException e, boolean hadError) throws IOException, IncorrectSchemaException { + return causeToSAXException(e.getException(), hadError); + } + + private SAXException causeToSAXException(Throwable cause, boolean hadError) throws IOException, IncorrectSchemaException { + if (cause instanceof RuntimeException) + throw (RuntimeException)cause; + if (cause instanceof IOException) + throw (IOException)cause; + if (cause instanceof IncorrectSchemaException) + throw (IncorrectSchemaException)cause; + if (cause instanceof SAXException) + return causeToSAXException(((SAXException)cause).getException(), hadError); + if (cause instanceof TransformerException) + return toSAXException((TransformerException)cause, hadError); + if (cause instanceof UserException) + return toSAXException((UserException)cause); + if (hadError) + throw new IncorrectSchemaException(); + return new SAXException(localizer.message("unexpected_schema_creation_error"), + cause instanceof Exception ? (Exception)cause : null); + } + + private static SAXException toSAXException(UserException e) throws IOException, IncorrectSchemaException { + SAXException se = e.getException(); + Exception cause = se.getException(); + if (cause instanceof IncorrectSchemaException) + throw (IncorrectSchemaException)cause; + if (cause instanceof IOException) + throw (IOException)cause; + return se; + } + + private static String fullResourceName(String name) { + String className = SchemaReaderImpl.class.getName(); + return className.substring(0, className.lastIndexOf('.')).replace('.', '/') + "/resources/" + name; + } + + private static InputStream getResourceAsStream(String resourceName) { + ClassLoader cl = SchemaReaderImpl.class.getClassLoader(); + // XXX see if we should borrow 1.2 code from Service + if (cl == null) + return ClassLoader.getSystemResourceAsStream(resourceName); + else + return cl.getResourceAsStream(resourceName); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronProperty.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronProperty.java new file mode 100644 index 0000000..815e282 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronProperty.java @@ -0,0 +1,55 @@ +package com.thaiopensource.validate.schematron; + +import com.thaiopensource.validate.StringPropertyId; +import com.thaiopensource.validate.FlagPropertyId; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.FlagOption; +import com.thaiopensource.validate.StringOption; +import com.thaiopensource.validate.OptionArgumentFormatException; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.xml.util.Naming; + +/** + * Properties for controlling schema reading and validation specific to Schematron. + */ +public class SchematronProperty { + private SchematronProperty() { } + + /** + * PropertyId that specifies the Schematron phase to use. + * This applies during schema creation. + */ + public static final StringPropertyId PHASE = new StringPropertyId("PHASE"); + + static public class PhaseOption extends StringOption { + private PhaseOption() { + super(PHASE); + } + + public String normalize(String value) throws OptionArgumentFormatException { + value = value.trim(); + if (!value.equals("#ALL") && !Naming.isNcname(value)) + throw new OptionArgumentFormatException(); + return value; + } + } + + public static final StringOption PHASE_OPTION = new PhaseOption(); + + /** + * PropertyId thats specifies that diagnostic messages should be included. + * This applies during validation. + */ + public static final FlagPropertyId DIAGNOSE = new FlagPropertyId("DIAGNOSE"); + + public static Option getOption(String uri) { + if (!uri.startsWith(SchemaReader.BASE_URI)) + return null; + uri = uri.substring(SchemaReader.BASE_URI.length()); + if (uri.equals("diagnose")) + return new FlagOption(DIAGNOSE); + if (uri.equals("phase")) + return PHASE_OPTION; + return null; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.java new file mode 100644 index 0000000..4e625ab --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/SchematronSchemaReaderFactory.java @@ -0,0 +1,30 @@ +package com.thaiopensource.validate.schematron; + +import com.thaiopensource.validate.IncorrectSchemaException; +import com.thaiopensource.validate.Option; +import com.thaiopensource.validate.SchemaReader; +import com.thaiopensource.validate.SchemaReaderFactory; + +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; + +public abstract class SchematronSchemaReaderFactory implements SchemaReaderFactory { + public SchemaReader createSchemaReader(String namespaceUri) { + if (namespaceUri.equals(SchemaReaderImpl.SCHEMATRON_URI)) { + try { + return new SchemaReaderImpl(newTransformerFactory()); + } + catch (TransformerFactoryConfigurationError e) { } + catch (IncorrectSchemaException e) { } + catch (TransformerConfigurationException e) { } + } + return null; + } + + public Option getOption(String uri) { + return SchematronProperty.getOption(uri); + } + + public abstract TransformerFactory newTransformerFactory(); +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/ValidatorImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/ValidatorImpl.java new file mode 100644 index 0000000..65760fc --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/ValidatorImpl.java @@ -0,0 +1,163 @@ +package com.thaiopensource.validate.schematron; + +import com.thaiopensource.util.PropertyMap; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; +import com.thaiopensource.xml.sax.DelegatingContentHandler; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXSource; + +class ValidatorImpl extends DelegatingContentHandler implements Validator { + private final Transformer transformer; + private Locator locator; + private TransformerException transformerException; + + private final Object contentHandlerMonitor = new Object(); + private final Object parseMonitor = new Object(); + private final Object transformMonitor = new Object(); + private Thread transformThread; + private final ContentHandler outputHandler; + + class BlockingReader extends XMLReaderImpl { + public void parse(InputSource in) throws SAXException { + synchronized (parseMonitor) { + synchronized (contentHandlerMonitor) { + contentHandlerMonitor.notify(); + } + try { + parseMonitor.wait(); + } + catch (InterruptedException e) { + throw new SAXException(e); + } + } + } + + public void setContentHandler(ContentHandler handler) { + setDelegate(handler); + } + + public ContentHandler getContentHandler() { + return getDelegate(); + } + + } + + ValidatorImpl(Templates templates, PropertyMap properties) { + ErrorHandler eh = ValidateProperty.ERROR_HANDLER.get(properties); + outputHandler = new OutputHandler(eh); + try { + transformer = templates.newTransformer(); + // XXX set up transformer with a resolver that uses the resolver + // XXX and XMLReaderCreator from properties + // XXX set up transformer with an ErrorListener that just throws + } + catch (TransformerConfigurationException e) { + throw new RuntimeException("could not create transformer"); + } + } + + public ContentHandler getContentHandler() { + return this; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public void reset() { + if (transformThread != null) { + synchronized (transformMonitor) { + transformThread.interrupt(); + try { + transformMonitor.wait(); + } + catch (InterruptedException e) { } + transformThread = null; + } + } + transformerException = null; + locator = null; + } + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void startDocument() + throws SAXException { + final SAXSource source = new SAXSource(new BlockingReader(), + new InputSource("")); + transformThread = new Thread(new Runnable() { + public void run() { + try { + transformer.transform(source, new SAXResult(outputHandler)); + } + catch (TransformerException e) { + transformerException = e; + } + finally { + synchronized (transformMonitor) { + transformMonitor.notify(); + } + } + } + }, "Transform"); + synchronized (contentHandlerMonitor) { + transformThread.start(); + try { + contentHandlerMonitor.wait(); + } + catch (InterruptedException e) { + throw new SAXException(e); + } + } + if (locator != null) + super.setDocumentLocator(locator); + super.startDocument(); + } + + public void endDocument() + throws SAXException { + super.endDocument(); + synchronized (transformMonitor) { + synchronized (parseMonitor) { + parseMonitor.notify(); + } + try { + transformMonitor.wait(); + } + catch (InterruptedException e) { + throw new SAXException(e); + } + finally { + transformThread = null; + } + } + if (transformerException != null) + throw toSAXException(transformerException); + } + + static SAXException toSAXException(TransformerException transformerException) { + // Unwrap where possible + Throwable wrapped = transformerException.getException(); + if (wrapped instanceof SAXException) + return (SAXException)wrapped; + if (wrapped instanceof RuntimeException) + throw (RuntimeException)wrapped; + if (wrapped instanceof Exception) + return new SAXException((Exception)wrapped); + return new SAXException(transformerException); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/XMLReaderImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/XMLReaderImpl.java new file mode 100644 index 0000000..1fcee14 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/XMLReaderImpl.java @@ -0,0 +1,82 @@ +package com.thaiopensource.validate.schematron; + +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; +import org.xml.sax.ErrorHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +import java.io.IOException; + +abstract class XMLReaderImpl implements XMLReader { + private ErrorHandler errorHandler; + private DTDHandler dtdHandler; + private EntityResolver entityResolver; + + public void parse(String systemId) + throws SAXException, IOException { + parse(new InputSource(systemId)); + } + + + public ErrorHandler getErrorHandler() { + return errorHandler; + } + + public void setErrorHandler(ErrorHandler errorHandler) { + this.errorHandler = errorHandler; + } + + public void setDTDHandler(DTDHandler handler) { + this.dtdHandler = handler; + } + + public DTDHandler getDTDHandler() { + return dtdHandler; + } + + public void setEntityResolver(EntityResolver resolver) { + this.entityResolver = resolver; + } + + public EntityResolver getEntityResolver() { + return entityResolver; + } + + public Object getProperty(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException(name); + } + + public void setProperty(String name, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException(name); + } + + public boolean getFeature(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + if (name.equals("http://xml.org/sax/features/namespaces")) + return true; + if (name.equals("http://xml.org/sax/features/namespace-prefixes")) + return false; + throw new SAXNotRecognizedException(name); + } + + public void setFeature(String name, boolean value) + throws SAXNotRecognizedException, SAXNotSupportedException { + if (name.equals("http://xml.org/sax/features/namespaces")) { + if (value == true) + return; + throw new SAXNotSupportedException(name); + } + if (name.equals("http://xml.org/sax/features/namespace-prefixes")) { + if (value == false) + return; + throw new SAXNotSupportedException(name); + } + throw new SAXNotRecognizedException(name); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/Messages.properties new file mode 100644 index 0000000..0cd5a66 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/Messages.properties @@ -0,0 +1,11 @@ +unexpected_schema_creation_error=could not create schema (please file a bug report) +# these messages are used in schematron.xsl +extends_cycle=cannot extend rule \"{0}\" because the extends chain has a cycle +active_missing=cannot activate non-existent pattern \"{0}\" +extends_missing=cannot extend non-existent rule \"{0}\" +extends_concrete=cannot extend rule \"{0}\" because it is not abstract +phase_missing=the schema does not define a phase \"{0}\" +default_phase_missing=the schema does not define its default phase \"{0}\" +diagnostic_missing=reference to non-existent diagnostic \"{0}\" +report=report: +failed_assertion=assertion failed: diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.rnc b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.rnc new file mode 100644 index 0000000..6a61909 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.rnc @@ -0,0 +1,167 @@ +# Based on +# http://www.ascc.net/xml/schematron/schematron1-5.dtd, version of 2002/08/16 + +# This version has the 1.6 feature that sch:key element with @match +# is allowed under sch:schema. This is not part of 1.5 proper. + +default namespace sch = "http://www.ascc.net/xml/schematron" +namespace local = "" + +start = schema + +# Element declarations +schema = + element schema { + attribute id { xsd:ID }?, + attribute fpi { fpi }?, + attribute ns { uri }?, + attribute schemaVersion { non-empty-string }?, + attribute defaultPhase { xsd:IDREF }?, + attribute icon { non-empty-string }?, + attribute version { non-empty-string }?, + (foreign + & (title?, + ns*, + p*, + (phase | key-with-match)*, + pattern+, + p*, + diagnostics?)) + } +active = + element active { + attribute pattern { xsd:IDREF }, + (foreign & (text | dir | emph | span)*) + } +assert = + element assert { + attribute test { expr }, + attribute role { role }?, + attribute id { xsd:ID }?, + attribute diagnostics { xsd:IDREFS }?, + attribute icon { uri }?, + attribute subject { path }?, + (foreign & (text | name | emph | dir | span)*) + } +dir = + element dir { + attribute value { "ltr" | "rtl" }?, + (foreign & text) + } +emph = element emph { text } +extends = + element extends { + attribute rule { xsd:IDREF }, + foreign-empty + } +diagnostic = + element diagnostic { + attribute id { xsd:ID }, + attribute icon { uri }?, + (foreign & (text | value-of | emph | dir | span)*) + } +diagnostics = element diagnostics { foreign & diagnostic* } +key = + element key { + attribute name { xsd:NMTOKEN }, + attribute path { path }, + attribute icon { uri }?, + foreign-empty + } +key-with-match = + element key { + attribute match { path }, + attribute name { xsd:NMTOKEN }, + attribute path { path }, + attribute icon { uri }?, + foreign-empty + } +name = + element name { + attribute path { path }?, + foreign-empty + } +ns = + element ns { + attribute uri { uri }, + attribute prefix { xsd:NMTOKEN }?, + foreign-empty + } +p = + element p { + attribute id { xsd:ID }?, + attribute class { non-empty-string }?, + attribute icon { uri }?, + (foreign & (text | dir | emph | span)*) + } +pattern = + element pattern { + attribute name { non-empty-string }, + attribute see { uri }?, + attribute id { xsd:ID }?, + attribute icon { uri }?, + (foreign & (p*, rule*)) + } +phase = + element phase { + attribute id { xsd:ID }, + attribute fpi { fpi }?, + attribute icon { uri }?, + (foreign & (p*, active*)) + } +report = + element report { + attribute test { expr }, + attribute role { role }?, + attribute id { xsd:ID }?, + attribute diagnostics { xsd:IDREFS }?, + attribute icon { uri }?, + attribute subject { path }?, + (foreign & (text | name | emph | dir | span)*) + } +rule = + element rule { + attribute role { role }?, + attribute id { xsd:ID }?, + (foreign + & ((attribute abstract { "true" }, (assert | report | extends)+) + | (attribute context { path }, + attribute abstract { "false" }?, + (assert | report | key | extends)+))) + } +span = + element span { + attribute class { non-empty-string }?, + (foreign & text) + } +title = element title { (text | dir)* } +value-of = + element value-of { + attribute select { path }, + foreign-empty + } + +foreign = foreign-attributes, foreign-element* + +foreign-empty = foreign-attributes + +foreign-attributes = attribute * - local:* { text }* +foreign-element = + element * - sch:* { + (attribute * { text } + | foreign-element + | schema + | text)* + } + +# Data types + +uri = xsd:anyURI +path = string +expr = string +fpi = string +lang = xsd:language + +role = xsd:NCName + +non-empty-string = xsd:token { minLength = "1" } diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.xsl b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.xsl new file mode 100644 index 0000000..7deb081 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/validate/schematron/resources/schematron.xsl @@ -0,0 +1,405 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/AbstractLexicalHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/AbstractLexicalHandler.java new file mode 100644 index 0000000..f567159 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/AbstractLexicalHandler.java @@ -0,0 +1,27 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.ext.LexicalHandler; +import org.xml.sax.SAXException; + +public class AbstractLexicalHandler implements LexicalHandler { + public void startDTD(String s, String s1, String s2) throws SAXException { + } + + public void endDTD() throws SAXException { + } + + public void startEntity(String s) throws SAXException { + } + + public void endEntity(String s) throws SAXException { + } + + public void startCDATA() throws SAXException { + } + + public void endCDATA() throws SAXException { + } + + public void comment(char[] chars, int start, int length) throws SAXException { + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/CountingErrorHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/CountingErrorHandler.java new file mode 100644 index 0000000..1e0af22 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/CountingErrorHandler.java @@ -0,0 +1,75 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXParseException; +import org.xml.sax.SAXException; + +public class CountingErrorHandler implements ErrorHandler { + private ErrorHandler errorHandler; + private int fatalErrorCount = 0; + private int errorCount = 0; + private int warningCount = 0; + private boolean hadErrorOrFatalError = false; + + public CountingErrorHandler() { + this(null); + } + + public CountingErrorHandler(ErrorHandler errorHandler) { + this.errorHandler = errorHandler; + } + + public void reset() { + fatalErrorCount = 0; + errorCount = 0; + warningCount = 0; + hadErrorOrFatalError = false; + } + + public boolean getHadErrorOrFatalError() { + return hadErrorOrFatalError; + } + + public int getFatalErrorCount() { + return fatalErrorCount; + } + + public int getErrorCount() { + return errorCount; + } + + public int getWarningCount() { + return warningCount; + } + + public ErrorHandler getErrorHandler() { + return errorHandler; + } + + public void setErrorHandler(ErrorHandler errorHandler) { + this.errorHandler = errorHandler; + } + + public void warning(SAXParseException exception) + throws SAXException { + warningCount++; + if (errorHandler != null) + errorHandler.warning(exception); + } + + public void error(SAXParseException exception) + throws SAXException { + errorCount++; + hadErrorOrFatalError = true; + if (errorHandler != null) + errorHandler.error(exception); + } + + public void fatalError(SAXParseException exception) + throws SAXException { + fatalErrorCount++; + hadErrorOrFatalError = true; + if (errorHandler != null) + errorHandler.fatalError(exception); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DelegatingContentHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DelegatingContentHandler.java new file mode 100644 index 0000000..6a92e35 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DelegatingContentHandler.java @@ -0,0 +1,92 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; + +public class DelegatingContentHandler implements ContentHandler { + private ContentHandler delegate; + + public DelegatingContentHandler() { + } + + public DelegatingContentHandler(ContentHandler delegate) { + this.delegate = delegate; + } + + public ContentHandler getDelegate() { + return delegate; + } + + public void setDelegate(ContentHandler delegate) { + this.delegate = delegate; + } + + public void setDocumentLocator (Locator locator) { + if (delegate != null) + delegate.setDocumentLocator(locator); + } + + public void startDocument () + throws SAXException { + if (delegate != null) + delegate.startDocument(); + } + + public void endDocument() + throws SAXException { + if (delegate != null) + delegate.endDocument(); + } + + public void startPrefixMapping (String prefix, String uri) + throws SAXException { + if (delegate != null) + delegate.startPrefixMapping(prefix, uri); + } + + public void endPrefixMapping (String prefix) + throws SAXException { + if (delegate != null) + delegate.endPrefixMapping(prefix); + } + + public void startElement (String namespaceURI, String localName, + String qName, Attributes atts) + throws SAXException { + if (delegate != null) + delegate.startElement(namespaceURI, localName, qName, atts); + } + + public void endElement (String namespaceURI, String localName, + String qName) + throws SAXException { + if (delegate != null) + delegate.endElement(namespaceURI, localName, qName); + } + + public void characters (char ch[], int start, int length) + throws SAXException { + if (delegate != null) + delegate.characters(ch, start, length); + } + + public void ignorableWhitespace (char ch[], int start, int length) + throws SAXException { + if (delegate != null) + delegate.ignorableWhitespace(ch, start, length); + } + + public void processingInstruction (String target, String data) + throws SAXException { + if (delegate != null) + delegate.processingInstruction(target, data); + } + + public void skippedEntity (String name) + throws SAXException { + if (delegate != null) + delegate.skippedEntity(name); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DraconianErrorHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DraconianErrorHandler.java new file mode 100644 index 0000000..10509a1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/DraconianErrorHandler.java @@ -0,0 +1,25 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXParseException; +import org.xml.sax.SAXException; + +/** + * An ErrorHandler implementing a brutal error handling policy. + * Fatal errors and errors are handled by throwing the exception. + * Warnings are ignored. + * + * @author James Clark + */ +public class DraconianErrorHandler implements ErrorHandler { + public void warning(SAXParseException e) throws SAXException { + } + + public void error(SAXParseException e) throws SAXException { + throw e; + } + + public void fatalError(SAXParseException e) throws SAXException { + throw e; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ErrorHandlerImpl.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ErrorHandlerImpl.java new file mode 100644 index 0000000..d9a41e4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ErrorHandlerImpl.java @@ -0,0 +1,149 @@ +package com.thaiopensource.xml.sax; + +import java.util.ResourceBundle; +import java.text.MessageFormat; +import java.io.PrintWriter; +import java.io.Writer; +import java.io.OutputStream; +import java.io.FileNotFoundException; + +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXParseException; +import org.xml.sax.SAXException; +import com.thaiopensource.util.UriOrFile; + +public class ErrorHandlerImpl implements ErrorHandler { + private final PrintWriter err; + + private final String bundleName + = "com.thaiopensource.xml.sax.resources.Messages"; + + private ResourceBundle bundle = null; + + public ErrorHandlerImpl() { + this(System.err); + } + + public ErrorHandlerImpl(OutputStream os) { + this.err = new PrintWriter(os); + } + + public ErrorHandlerImpl(Writer w) { + this.err = new PrintWriter(w); + } + + public void close() { + err.close(); + } + + private String getString(String key) { + if (bundle == null) + bundle = ResourceBundle.getBundle(bundleName); + return bundle.getString(key); + } + + private String format(String key, Object[] args) { + return MessageFormat.format(getString(key), args); + } + + public void warning(SAXParseException e) throws SAXParseException { + print(format("warning", + new Object[] { formatMessage(e), formatLocation(e) })); + } + + public void error(SAXParseException e) { + print(format("error", + new Object[] { formatMessage(e), formatLocation(e) })); + } + + public void fatalError(SAXParseException e) throws SAXParseException { + throw e; + } + + public void printException(Throwable e) { + String loc; + if (e instanceof SAXParseException) + loc = formatLocation((SAXParseException)e); + else + loc = ""; + String message; + if (e instanceof SAXException) + message = formatMessage((SAXException)e); + else + message = formatMessage(e); + print(format("fatal", new Object[] { message, loc })); + } + + public void print(String message) { + if (message.length() != 0) { + err.println(message); + err.flush(); + } + } + + private String formatLocation(SAXParseException e) { + String systemId = e.getSystemId(); + int n = e.getLineNumber(); + Integer lineNumber = n >= 0 ? new Integer(n) : null; + n = e.getColumnNumber(); + Integer columnNumber = n >= 0 ? new Integer(n) : null; + if (systemId != null) { + systemId = UriOrFile.uriToUriOrFile(systemId); + if (lineNumber != null) { + if (columnNumber != null) + return format("locator_system_id_line_number_column_number", + new Object[] { systemId, lineNumber, columnNumber }); + else + return format("locator_system_id_line_number", + new Object[] { systemId, lineNumber }); + } + else + return format("locator_system_id", + new Object[] { systemId }); + } + else if (lineNumber != null) { + if (columnNumber != null) + return format("locator_line_number_column_number", + new Object[] { lineNumber, columnNumber }); + else + return format("locator_line_number", + new Object[] { lineNumber }); + } + else + return ""; + } + + private String formatMessage(SAXException se) { + Exception e = se.getException(); + String detail = se.getMessage(); + if (e != null) { + String detail2 = e.getMessage(); + // Crimson stupidity + if (detail2 == detail || e.getClass().getName().equals(detail)) + return formatMessage(e); + else if (detail2 == null) + return format("exception", + new Object[]{ e.getClass().getName(), detail }); + else + return format("tunnel_exception", + new Object[] { e.getClass().getName(), + detail, + detail2 }); + } + else { + if (detail == null) + detail = getString("no_detail"); + return detail; + } + } + + private String formatMessage(Throwable e) { + String detail = e.getMessage(); + if (detail == null) + detail = getString("no_detail"); + if (e instanceof FileNotFoundException) + return format("file_not_found", new Object[] { detail }); + return format("exception", + new Object[] { e.getClass().getName(), detail }); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkContentHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkContentHandler.java new file mode 100644 index 0000000..c01c5de --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkContentHandler.java @@ -0,0 +1,71 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; + +public class ForkContentHandler implements ContentHandler { + private final ContentHandler ch1; + private final ContentHandler ch2; + + public ForkContentHandler(ContentHandler ch1, ContentHandler ch2) { + this.ch1 = ch1; + this.ch2 = ch2; + } + + public void setDocumentLocator(Locator locator) { + ch1.setDocumentLocator(locator); + ch2.setDocumentLocator(locator); + } + + public void startDocument() throws SAXException { + ch1.startDocument(); + ch2.startDocument(); + } + + public void endDocument() throws SAXException { + ch1.endDocument(); + ch2.endDocument(); + } + + public void startPrefixMapping(String s, String s1) throws SAXException { + ch1.startPrefixMapping(s, s1); + ch2.startPrefixMapping(s, s1); + } + + public void endPrefixMapping(String s) throws SAXException { + ch1.endPrefixMapping(s); + ch2.endPrefixMapping(s); + } + + public void startElement(String s, String s1, String s2, Attributes attributes) throws SAXException { + ch1.startElement(s, s1, s2, attributes); + ch2.startElement(s, s1, s2, attributes); + } + + public void endElement(String s, String s1, String s2) throws SAXException { + ch1.endElement(s, s1, s2); + ch2.endElement(s, s1, s2); + } + + public void characters(char[] chars, int i, int i1) throws SAXException { + ch1.characters(chars, i, i1); + ch2.characters(chars, i, i1); + } + + public void ignorableWhitespace(char[] chars, int i, int i1) throws SAXException { + ch1.ignorableWhitespace(chars, i, i1); + ch2.ignorableWhitespace(chars, i, i1); + } + + public void processingInstruction(String s, String s1) throws SAXException { + ch1.processingInstruction(s, s1); + ch2.processingInstruction(s, s1); + } + + public void skippedEntity(String s) throws SAXException { + ch1.skippedEntity(s); + ch2.skippedEntity(s); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkDTDHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkDTDHandler.java new file mode 100644 index 0000000..1658ffa --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/ForkDTDHandler.java @@ -0,0 +1,31 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.DTDHandler; +import org.xml.sax.SAXException; + +public class ForkDTDHandler implements DTDHandler { + private final DTDHandler dh1; + private final DTDHandler dh2; + + public ForkDTDHandler(DTDHandler dh1, DTDHandler dh2) { + this.dh1 = dh1; + this.dh2 = dh2; + } + + public void notationDecl(String name, + String publicId, + String systemId) + throws SAXException { + dh1.notationDecl(name, publicId, systemId); + dh2.notationDecl(name, publicId, systemId); + } + + public void unparsedEntityDecl(String name, + String publicId, + String systemId, + String notationName) + throws SAXException { + dh1.unparsedEntityDecl(name, publicId, systemId, notationName); + dh2.unparsedEntityDecl(name, publicId, systemId, notationName); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.java new file mode 100644 index 0000000..1e5a128 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Jaxp11XMLReaderCreator.java @@ -0,0 +1,38 @@ +package com.thaiopensource.xml.sax; + +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; + +import com.thaiopensource.xml.sax.XMLReaderCreator; + +/** + * An XMLReaderCreator that uses JAXP 1.1 to create XMLReaders. + * An instance of this class is not safe for concurrent access by multiple threads. + * + * @see javax.xml.parsers.SAXParserFactory + * @author James Clark + */ +public class Jaxp11XMLReaderCreator implements XMLReaderCreator { + + private final SAXParserFactory factory; + + /** + * Default constructor. + */ + public Jaxp11XMLReaderCreator() { + factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setValidating(false); + } + + public XMLReader createXMLReader() throws SAXException { + try { + return factory.newSAXParser().getXMLReader(); + } + catch (ParserConfigurationException e) { + throw new SAXException(e); + } + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.java new file mode 100644 index 0000000..b569811 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/Sax2XMLReaderCreator.java @@ -0,0 +1,57 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.XMLReaderFactory; + +import com.thaiopensource.xml.sax.XMLReaderCreator; + +/** + * An XMLReaderCreator that creates XMLReaders using the SAX2 XMLReaderFactory. + * An instance of this class is safe for concurrent access by multiple threads. + * + * @see org.xml.sax.helpers.XMLReaderFactory + * @author James Clark + */ +public class Sax2XMLReaderCreator implements XMLReaderCreator { + private final String className; + + /** + * Constructs a Sax2XMLReaderCreator that uses system defaults to construct XMLReaders. + */ + public Sax2XMLReaderCreator() { + this.className = null; + } + + /** + * Constructs a Sax2XMLReaderCreator that constructs XMLReaders with the specified + * class name. + * + * @param className the fully-qualified name of the class implementing XMLReader; + * if null equivalent to the no-argument constructor + * + */ + public Sax2XMLReaderCreator(String className) { + this.className = className; + } + + public XMLReader createXMLReader() throws SAXException { + XMLReader xr; + if (className == null) + xr = XMLReaderFactory.createXMLReader(); + else + xr = XMLReaderFactory.createXMLReader(className); + xr.setFeature("http://xml.org/sax/features/namespaces", true); + xr.setFeature("http://xml.org/sax/features/namespace-prefixes", false); + try { + xr.setFeature("http://xml.org/sax/features/validation", false); + } + catch (SAXNotRecognizedException e) { + } + catch (SAXNotSupportedException e) { + } + return xr; + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XMLReaderCreator.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XMLReaderCreator.java new file mode 100644 index 0000000..77b91a3 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XMLReaderCreator.java @@ -0,0 +1,20 @@ +package com.thaiopensource.xml.sax; + +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +/** + * A factory for XMLReaders. Thread-safety is determined by each particular + * implementation of this interface. + * + * @author James Clark + */ +public interface XMLReaderCreator { + /** + * Creates a new XMLReader. + * + * @return a new XMLReader; never null + * @throws org.xml.sax.SAXException If an XMLReader cannot be created for any reason + */ + XMLReader createXMLReader() throws SAXException; +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XmlBaseHandler.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XmlBaseHandler.java new file mode 100644 index 0000000..56faed9 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/XmlBaseHandler.java @@ -0,0 +1,58 @@ +package com.thaiopensource.xml.sax; + +import com.thaiopensource.util.Uri; +import org.xml.sax.Locator; + +public class XmlBaseHandler { + private int depth = 0; + private Locator loc; + private Entry stack = null; + + private static class Entry { + private Entry parent; + private String attValue; + private String systemId; + private int depth; + } + + public void setLocator(Locator loc) { + this.loc = loc; + } + + public void startElement() { + ++depth; + } + + public void endElement() { + if (stack != null && stack.depth == depth) + stack = stack.parent; + --depth; + } + + public void xmlBaseAttribute(String value) { + Entry entry = new Entry(); + entry.parent = stack; + stack = entry; + entry.attValue = Uri.escapeDisallowedChars(value); + entry.systemId = getSystemId(); + entry.depth = depth; + } + + private String getSystemId() { + return loc == null ? null : loc.getSystemId(); + } + + public String getBaseUri() { + return getBaseUri1(getSystemId(), stack); + } + + private static String getBaseUri1(String baseUri, Entry stack) { + if (stack == null + || (baseUri != null && !baseUri.equals(stack.systemId))) + return baseUri; + baseUri = stack.attValue; + if (Uri.isAbsolute(baseUri)) + return baseUri; + return Uri.resolve(getBaseUri1(stack.systemId, stack.parent), baseUri); + } +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/resources/Messages.properties b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/resources/Messages.properties new file mode 100644 index 0000000..7f133eb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/sax/resources/Messages.properties @@ -0,0 +1,29 @@ +# first argument is message, second is location +fatal={1}fatal: {0} +# first argument is message, second is location +error={1}error: {0} +# first argument is message, second is location +warning={1}warning: {0} +# constructs string used as second argument of fatal, error, warning +locator_system_id={0}: \ + +# constructs string used as second argument of fatal, error, warning +locator_system_id_line_number={0}:{1,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_system_id_line_number_column_number={0}:{1,number,#}:{2,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_line_number=(unknown file):{0,number,#}: \ + +# constructs string used as second argument of fatal, error, warning +locator_line_number_column_number=(unknown file):{0,number,#}: \ + +# first argument is class name; second argument is detail message +exception=exception "{0}" thrown: {1} +# like "exception" except third argument is original message +tunnel_exception=exception "{0}" thrown: {1}: {2} +# special case for java.io.FileNotFoundException; first argument is detail +file_not_found=file not found: {0} +# when exception has no detail message available +no_detail=(no further details available) diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/EncodingMap.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/EncodingMap.java new file mode 100644 index 0000000..aff6532 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/EncodingMap.java @@ -0,0 +1,37 @@ +package com.thaiopensource.xml.util; + +import java.io.UnsupportedEncodingException; + +public abstract class EncodingMap { + private static final String[] aliases = { + "UTF-8", "UTF8", + "UTF-16", "Unicode", + "UTF-16BE", "UnicodeBigUnmarked", + "UTF-16LE", "UnicodeLittleUnmarked", + "US-ASCII", "ASCII", + "TIS-620", "TIS620" + }; + + static public String getJavaName(String enc) { + try { + "x".getBytes(enc); + } + catch (UnsupportedEncodingException e) { + for (int i = 0; i < aliases.length; i += 2) { + if (enc.equalsIgnoreCase(aliases[i])) { + try { + "x".getBytes(aliases[i + 1]); + return aliases[i + 1]; + } + catch (UnsupportedEncodingException e2) {} + } + } + } + return enc; + } + + static public void main(String[] args) { + System.err.println(getJavaName(args[0])); + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Name.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Name.java new file mode 100644 index 0000000..0d322d8 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Name.java @@ -0,0 +1,35 @@ +package com.thaiopensource.xml.util; + +public final class Name { + final private String namespaceUri; + final private String localName; + final private int hc; + + public Name(String namespaceUri, String localName) { + this.namespaceUri = namespaceUri; + this.localName = localName; + this.hc = namespaceUri.hashCode() ^ localName.hashCode(); + } + + public String getNamespaceUri() { + return namespaceUri; + } + + public String getLocalName() { + return localName; + } + + public boolean equals(Object obj) { + if (!(obj instanceof Name)) + return false; + Name other = (Name)obj; + return (this.hc == other.hc + && this.namespaceUri.equals(other.namespaceUri) + && this.localName.equals(other.localName)); + } + + public int hashCode() { + return hc; + } +} + diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Naming.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Naming.java new file mode 100644 index 0000000..873ffa4 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/Naming.java @@ -0,0 +1,181 @@ +package com.thaiopensource.xml.util; + +public class Naming { + + private Naming() { } + + private static final int CT_NAME = 1; + private static final int CT_NMSTRT = 2; + + private static final String nameStartSingles = + "\u003a\u005f\u0386\u038c\u03da\u03dc\u03de\u03e0\u0559\u06d5\u093d\u09b2" + + "\u0a5e\u0a8d\u0abd\u0ae0\u0b3d\u0b9c\u0cde\u0e30\u0e84\u0e8a\u0e8d\u0ea5" + + "\u0ea7\u0eb0\u0ebd\u1100\u1109\u113c\u113e\u1140\u114c\u114e\u1150\u1159" + + "\u1163\u1165\u1167\u1169\u1175\u119e\u11a8\u11ab\u11ba\u11eb\u11f0\u11f9" + + "\u1f59\u1f5b\u1f5d\u1fbe\u2126\u212e\u3007"; + private static final String nameStartRanges = + "\u0041\u005a\u0061\u007a\u00c0\u00d6\u00d8\u00f6\u00f8\u00ff\u0100\u0131" + + "\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5" + + "\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u0388\u038a\u038e\u03a1\u03a3\u03ce" + + "\u03d0\u03d6\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481" + + "\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9" + + "\u0531\u0556\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a" + + "\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06e5\u06e6\u0905\u0939" + + "\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b6\u09b9" + + "\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28" + + "\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a72\u0a74" + + "\u0a85\u0a8b\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9" + + "\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39" + + "\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a" + + "\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0c05\u0c0c" + + "\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c" + + "\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0ce0\u0ce1\u0d05\u0d0c" + + "\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e32\u0e33" + + "\u0e40\u0e45\u0e81\u0e82\u0e87\u0e88\u0e94\u0e97\u0e99\u0e9f\u0ea1\u0ea3" + + "\u0eaa\u0eab\u0ead\u0eae\u0eb2\u0eb3\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69" + + "\u10a0\u10c5\u10d0\u10f6\u1102\u1103\u1105\u1107\u110b\u110c\u110e\u1112" + + "\u1154\u1155\u115f\u1161\u116d\u116e\u1172\u1173\u11ae\u11af\u11b7\u11b8" + + "\u11bc\u11c2\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d\u1f20\u1f45" + + "\u1f48\u1f4d\u1f50\u1f57\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fc2\u1fc4" + + "\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc" + + "\u212a\u212b\u2180\u2182\u3041\u3094\u30a1\u30fa\u3105\u312c\uac00\ud7a3" + + "\u4e00\u9fa5\u3021\u3029"; + private static final String nameSingles = + "\u002d\u002e\u05bf\u05c4\u0670\u093c\u094d\u09bc\u09be\u09bf\u09d7\u0a02" + + "\u0a3c\u0a3e\u0a3f\u0abc\u0b3c\u0bd7\u0d57\u0e31\u0eb1\u0f35\u0f37\u0f39" + + "\u0f3e\u0f3f\u0f97\u0fb9\u20e1\u3099\u309a\u00b7\u02d0\u02d1\u0387\u0640" + + "\u0e46\u0ec6\u3005"; + private static final String nameRanges = + "\u0300\u0345\u0360\u0361\u0483\u0486\u0591\u05a1\u05a3\u05b9\u05bb\u05bd" + + "\u05c1\u05c2\u064b\u0652\u06d6\u06dc\u06dd\u06df\u06e0\u06e4\u06e7\u06e8" + + "\u06ea\u06ed\u0901\u0903\u093e\u094c\u0951\u0954\u0962\u0963\u0981\u0983" + + "\u09c0\u09c4\u09c7\u09c8\u09cb\u09cd\u09e2\u09e3\u0a40\u0a42\u0a47\u0a48" + + "\u0a4b\u0a4d\u0a70\u0a71\u0a81\u0a83\u0abe\u0ac5\u0ac7\u0ac9\u0acb\u0acd" + + "\u0b01\u0b03\u0b3e\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b82\u0b83" + + "\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd\u0c01\u0c03\u0c3e\u0c44\u0c46\u0c48" + + "\u0c4a\u0c4d\u0c55\u0c56\u0c82\u0c83\u0cbe\u0cc4\u0cc6\u0cc8\u0cca\u0ccd" + + "\u0cd5\u0cd6\u0d02\u0d03\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d\u0e34\u0e3a" + + "\u0e47\u0e4e\u0eb4\u0eb9\u0ebb\u0ebc\u0ec8\u0ecd\u0f18\u0f19\u0f71\u0f84" + + "\u0f86\u0f8b\u0f90\u0f95\u0f99\u0fad\u0fb1\u0fb7\u20d0\u20dc\u302a\u302f" + + "\u0030\u0039\u0660\u0669\u06f0\u06f9\u0966\u096f\u09e6\u09ef\u0a66\u0a6f" + + "\u0ae6\u0aef\u0b66\u0b6f\u0be7\u0bef\u0c66\u0c6f\u0ce6\u0cef\u0d66\u0d6f" + + "\u0e50\u0e59\u0ed0\u0ed9\u0f20\u0f29\u3031\u3035\u309d\u309e\u30fc\u30fe"; + + private final static byte[][] charTypeTable; + + static { + charTypeTable = new byte[256][]; + for (int i = 0; i < nameSingles.length(); i++) + setCharType(nameSingles.charAt(i), CT_NAME); + for (int i = 0; i < nameRanges.length(); i += 2) + setCharType(nameRanges.charAt(i), nameRanges.charAt(i + 1), CT_NAME); + for (int i = 0; i < nameStartSingles.length(); i++) + setCharType(nameStartSingles.charAt(i), CT_NMSTRT); + for (int i = 0; i < nameStartRanges.length(); i += 2) + setCharType(nameStartRanges.charAt(i), nameStartRanges.charAt(i + 1), + CT_NMSTRT); + byte[] other = new byte[256]; + for (int i = 0; i < 256; i++) + if (charTypeTable[i] == null) + charTypeTable[i] = other; + } + + private static void setCharType(char c, int type) { + int hi = c >> 8; + if (charTypeTable[hi] == null) + charTypeTable[hi] = new byte[256]; + charTypeTable[hi][c & 0xFF] = (byte)type; + } + + private static void setCharType(char min, char max, int type) { + byte[] shared = null; + do { + if ((min & 0xFF) == 0) { + for (; min + 0xFF <= max; min += 0x100) { + if (shared == null) { + shared = new byte[256]; + for (int i = 0; i < 256; i++) + shared[i] = (byte)type; + } + charTypeTable[min >> 8] = shared; + if (min + 0xFF == max) + return; + } + } + setCharType(min, type); + } while (min++ != max); + } + + private static boolean isNameStartChar(char c) { + return charTypeTable[c >> 8][c & 0xff] == CT_NMSTRT; + } + + private static boolean isNameStartCharNs(char c) { + return isNameStartChar(c) && c != ':'; + } + + private static boolean isNameChar(char c) { + return charTypeTable[c >> 8][c & 0xff] != 0; + } + + private static boolean isNameCharNs(char c) { + return isNameChar(c) && c != ':'; + } + + public static boolean isName(String s) { + int len = s.length(); + if (len == 0) + return false; + if (!isNameStartChar(s.charAt(0))) + return false; + for (int i = 1; i < len; i++) + if (!isNameChar(s.charAt(i))) + return false; + return true; + } + + public static boolean isNmtoken(String s) { + int len = s.length(); + if (len == 0) + return false; + for (int i = 0; i < len; i++) + if (!isNameChar(s.charAt(i))) + return false; + return true; + } + + public static boolean isNcname(String s) { + int len = s.length(); + if (len == 0) + return false; + if (!isNameStartCharNs(s.charAt(0))) + return false; + for (int i = 1; i < len; i++) + if (!isNameCharNs(s.charAt(i))) + return false; + return true; + } + + public static boolean isQname(String s) { + int len = s.length(); + if (len == 0) + return false; + if (!isNameStartCharNs(s.charAt(0))) + return false; + for (int i = 1; i < len; i++) { + char c = s.charAt(i); + if (!isNameChar(c)) { + if (c == ':' && ++i < len && isNameStartCharNs(s.charAt(i))) { + for (++i; i < len; i++) + if (!isNameCharNs(s.charAt(i))) + return false; + return true; + } + return false; + } + } + return true; + } + + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/StringSplitter.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/StringSplitter.java new file mode 100644 index 0000000..80a693b --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/StringSplitter.java @@ -0,0 +1,42 @@ +package com.thaiopensource.xml.util; + +public class StringSplitter { + private StringSplitter() { + } + + public static String[] split(String str) { + int len = str.length(); + int nTokens = 0; + for (int i = 0; i < len; i++) + if (!isSpace(str.charAt(i)) && (i == 0 || isSpace(str.charAt(i - 1)))) + nTokens++; + String[] tokens = new String[nTokens]; + nTokens = 0; + int tokenStart = -1; + for (int i = 0; i < len; i++) { + if (isSpace(str.charAt(i))) { + if (tokenStart >= 0) { + tokens[nTokens++] = str.substring(tokenStart, i); + tokenStart = -1; + } + } + else if (i == 0 || isSpace(str.charAt(i - 1))) + tokenStart = i; + } + if (tokenStart >= 0) + tokens[nTokens] = str.substring(tokenStart, len); + return tokens; + } + + private static boolean isSpace(char c) { + switch (c) { + case ' ': + case '\r': + case '\n': + case '\t': + return true; + } + return false; + } + +} diff --git a/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/WellKnownNamespaces.java b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/WellKnownNamespaces.java new file mode 100644 index 0000000..b66ceac --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/com/thaiopensource/xml/util/WellKnownNamespaces.java @@ -0,0 +1,16 @@ +package com.thaiopensource.xml.util; + +public class WellKnownNamespaces { + static public final String XML = "http://www.w3.org/XML/1998/namespace"; + static public final String XMLNS = "http://www.w3.org/2000/xmlns"; + static public final String XML_SCHEMA_DATATYPES = "http://www.w3.org/2001/XMLSchema-datatypes"; + static public final String XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; + static public final String RELAX_NG_COMPATIBILITY_DATATYPES = "http://relaxng.org/ns/compatibility/datatypes/1.0"; + static public final String RELAX_NG = "http://relaxng.org/ns/structure/1.0"; + static public final String RELAX_NG_0_9 = "http://relaxng.org/ns/structure/0.9"; + static public final String RELAX_NG_COMPATIBILITY_ANNOTATIONS = "http://relaxng.org/ns/compatibility/annotations/1.0"; + + private WellKnownNamespaces() { + } + +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/Datatype.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/Datatype.java new file mode 100644 index 0000000..750975c --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/Datatype.java @@ -0,0 +1,237 @@ +package org.relaxng.datatype; + +/** + * Datatype object. + * + * This object has the following functionality: + * + *
    + *
  1. functionality to identify a class of character sequences. This is + * done through the isValid method. + * + *
  2. functionality to produce a "value object" from a character sequence and + * context information. + * + *
  3. functionality to test the equality of two value objects. + *
+ * + * This interface also defines the createStreamingValidator method, + * which is intended to efficiently support the validation of + * large character sequences. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface Datatype { + + /** + * Checks if the specified 'literal' matches this Datatype + * with respect to the current context. + * + * @param literal + * the lexical representation to be checked. + * @param context + * If this datatype is context-dependent + * (i.e. the {@link #isContextDependent} method returns true), + * then the caller must provide a non-null valid context object. + * Otherwise, the caller can pass null. + * + * @return + * true if the 'literal' is a member of this Datatype; + * false if it's not a member of this Datatype. + */ + boolean isValid( String literal, ValidationContext context ); + + /** + * Similar to the isValid method but throws an exception with diagnosis + * in case of errors. + * + *

+ * If the specified 'literal' is a valid lexical representation for this + * datatype, then this method must return without throwing any exception. + * If not, the callee must throw an exception (with diagnosis message, + * if possible.) + * + *

+ * The application can use this method to provide detailed error message + * to users. This method is kept separate from the isValid method to + * achieve higher performance during normal validation. + * + * @exception DatatypeException + * If the given literal is invalid, then this exception is thrown. + * If the callee supports error diagnosis, then the exception should + * contain a diagnosis message. + */ + void checkValid( String literal, ValidationContext context ) + throws DatatypeException; + + /** + * Creates an instance of a streaming validator for this type. + * + *

+ * By using streaming validators instead of the isValid method, + * the caller can avoid keeping the entire string, which is + * sometimes quite big, in memory. + * + * @param context + * If this datatype is context-dependent + * (i.e. the {@link #isContextDependent} method returns true), + * then the caller must provide a non-null valid context object. + * Otherwise, the caller can pass null. + * The callee may keep a reference to this context object + * only while the returned streaming validator is being used. + */ + DatatypeStreamingValidator createStreamingValidator( ValidationContext context ); + + /** + * Converts lexcial value and the current context to the corresponding + * value object. + * + *

+ * The caller cannot generally assume that the value object is + * a meaningful Java object. For example, the caller cannot expect + * this method to return java.lang.Number type for + * the "integer" type of XML Schema Part 2. + * + *

+ * Also, the caller cannot assume that the equals method and + * the hashCode method of the value object are consistent with + * the semantics of the datatype. For that purpose, the sameValue + * method and the valueHashCode method have to be used. Note that + * this means you cannot use classes like + * java.util.Hashtable to store the value objects. + * + *

+ * The returned value object should be used solely for the sameValue + * and valueHashCode methods. + * + * @param context + * If this datatype is context-dependent + * (when the {@link #isContextDependent} method returns true), + * then the caller must provide a non-null valid context object. + * Otherwise, the caller can pass null. + * + * @return null + * when the given lexical value is not a valid lexical + * value for this type. + */ + Object createValue( String literal, ValidationContext context ); + + /** + * Tests the equality of two value objects which were originally + * created by the createValue method of this object. + * + * The behavior is undefined if objects not created by this type + * are passed. It is the caller's responsibility to ensure that + * value objects belong to this type. + * + * @return + * true if two value objects are considered equal according to + * the definition of this datatype; false if otherwise. + */ + boolean sameValue( Object value1, Object value2 ); + + + /** + * Computes the hash code for a value object, + * which is consistent with the sameValue method. + * + * @return + * hash code for the specified value object. + */ + int valueHashCode( Object value ); + + + + + /** + * Indicates that the datatype doesn't have ID/IDREF semantics. + * + * This value is one of the possible return values of the + * {@link #getIdType} method. + */ + public static final int ID_TYPE_NULL = 0; + + /** + * Indicates that RELAX NG compatibility processors should + * treat this datatype as having ID semantics. + * + * This value is one of the possible return values of the + * {@link #getIdType} method. + */ + public static final int ID_TYPE_ID = 1; + + /** + * Indicates that RELAX NG compatibility processors should + * treat this datatype as having IDREF semantics. + * + * This value is one of the possible return values of the + * {@link #getIdType} method. + */ + public static final int ID_TYPE_IDREF = 2; + + /** + * Indicates that RELAX NG compatibility processors should + * treat this datatype as having IDREFS semantics. + * + * This value is one of the possible return values of the + * {@link #getIdType} method. + */ + public static final int ID_TYPE_IDREFS = 3; + + /** + * Checks if the ID/IDREF semantics is associated with this + * datatype. + * + *

+ * This method is introduced to support the RELAX NG DTD + * compatibility spec. (Of course it's always free to use + * this method for other purposes.) + * + *

+ * If you are implementing a datatype library and have no idea about + * the "RELAX NG DTD compatibility" thing, just return + * ID_TYPE_NULL is fine. + * + * @return + * If this datatype doesn't have any ID/IDREF semantics, + * it returns {@link #ID_TYPE_NULL}. If it has such a semantics + * (for example, XSD:ID, XSD:IDREF and comp:ID type), then + * it returns {@link #ID_TYPE_ID}, {@link #ID_TYPE_IDREF} or + * {@link #ID_TYPE_IDREFS}. + */ + public int getIdType(); + + + /** + * Checks if this datatype may need a context object for + * the validation. + * + *

+ * The callee must return true even when the context + * is not always necessary. (For example, the "QName" type + * doesn't need a context object when validating unprefixed + * string. But nonetheless QName must return true.) + * + *

+ * XSD's string and short types + * are examples of context-independent datatypes. + * Its QName and ENTITY types + * are examples of context-dependent datatypes. + * + *

+ * When a datatype is context-independent, then + * the {@link #isValid} method, the {@link #checkValid} method, + * the {@link #createStreamingValidator} method and + * the {@link #createValue} method can be called without + * providing a context object. + * + * @return + * true if this datatype is context-dependent + * (it needs a context object sometimes); + * + * false if this datatype is context-independent + * (it never needs a context object). + */ + public boolean isContextDependent(); +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeBuilder.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeBuilder.java new file mode 100644 index 0000000..b9a612f --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeBuilder.java @@ -0,0 +1,45 @@ +package org.relaxng.datatype; + +/** + * Creates a user-defined type by adding parameters to + * the pre-defined type. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface DatatypeBuilder { + + /** + * Adds a new parameter. + * + * @param name + * The name of the parameter to be added. + * @param strValue + * The raw value of the parameter. Caller may not normalize + * this value because any white space is potentially significant. + * @param context + * The context information which can be used by the callee to + * acquire additional information. This context object is + * valid only during this method call. The callee may not + * keep a reference to this object. + * @exception DatatypeException + * When the given parameter is inappropriate for some reason. + * The callee is responsible to recover from this error. + * That is, the object should behave as if no such error + * was occured. + */ + void addParameter( String name, String strValue, ValidationContext context ) + throws DatatypeException; + + /** + * Derives a new Datatype from a Datatype by parameters that + * were already set through the addParameter method. + * + * @exception DatatypeException + * DatatypeException must be thrown if the derivation is + * somehow invalid. For example, a required parameter is missing, + * etc. The exception should contain a diagnosis message + * if possible. + */ + Datatype createDatatype() throws DatatypeException; +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeException.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeException.java new file mode 100644 index 0000000..d32ffe7 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeException.java @@ -0,0 +1,39 @@ +package org.relaxng.datatype; + +/** + * Signals Datatype related exceptions. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public class DatatypeException extends Exception { + + public DatatypeException( int index, String msg ) { + super(msg); + this.index = index; + } + public DatatypeException( String msg ) { + this(UNKNOWN,msg); + } + /** + * A constructor for those datatype libraries which don't support any + * diagnostic information at all. + */ + public DatatypeException() { + this(UNKNOWN,null); + } + + + private final int index; + + public static final int UNKNOWN = -1; + + /** + * Gets the index of the content where the error occured. + * UNKNOWN can be returned to indicate that no index information + * is available. + */ + public int getIndex() { + return index; + } +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibrary.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibrary.java new file mode 100644 index 0000000..95b40fb --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibrary.java @@ -0,0 +1,37 @@ +package org.relaxng.datatype; + +/** + * A Datatype library + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface DatatypeLibrary { + + /** + * Creates a new instance of DatatypeBuilder. + * + * The callee should throw a DatatypeException in case of an error. + * + * @param baseTypeLocalName + * The local name of the base type. + * + * @return + * A non-null valid datatype object. + */ + DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName ) + throws DatatypeException; + + /** + * Gets or creates a pre-defined type. + * + * This is just a short-cut of + * createDatatypeBuilder(typeLocalName).createDatatype(); + * + * The callee should throw a DatatypeException in case of an error. + * + * @return + * A non-null valid datatype object. + */ + Datatype createDatatype( String typeLocalName ) throws DatatypeException; +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibraryFactory.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibraryFactory.java new file mode 100644 index 0000000..e488950 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeLibraryFactory.java @@ -0,0 +1,26 @@ +package org.relaxng.datatype; + +/** + * Factory class for the DatatypeLibrary class. + * + *

+ * The datatype library should provide the implementation of + * this interface if it wants to be found by the schema processors. + * The implementor also have to place a file in your jar file. + * See the reference datatype library implementation for detail. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface DatatypeLibraryFactory +{ + /** + * Creates a new instance of a DatatypeLibrary that supports + * the specified namespace URI. + * + * @return + * null if the specified namespace URI is not + * supported. + */ + DatatypeLibrary createDatatypeLibrary( String namespaceURI ); +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeStreamingValidator.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeStreamingValidator.java new file mode 100644 index 0000000..68fa4b1 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/DatatypeStreamingValidator.java @@ -0,0 +1,46 @@ +package org.relaxng.datatype; + +/** + * Datatype streaming validator. + * + *

+ * The streaming validator is an optional feature that is useful for + * certain Datatypes. It allows the caller to incrementally provide + * the literal. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface DatatypeStreamingValidator { + + /** + * Passes an additional fragment of the literal. + * + *

+ * The application can call this method several times, then call + * the isValid method (or the checkValid method) to check the validity + * of the accumulated characters. + */ + void addCharacters( char[] buf, int start, int len ); + + /** + * Tells if the accumulated literal is valid with respect to + * the underlying Datatype. + * + * @return + * True if it is valid. False if otherwise. + */ + boolean isValid(); + + /** + * Similar to the isValid method, but this method throws + * Exception (with possibly diagnostic information), instead of + * returning false. + * + * @exception DatatypeException + * If the callee supports the diagnosis and the accumulated + * literal is invalid, then this exception that possibly + * contains diagnosis information is thrown. + */ + void checkValid() throws DatatypeException; +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/ValidationContext.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/ValidationContext.java new file mode 100644 index 0000000..1dae0fd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/ValidationContext.java @@ -0,0 +1,66 @@ +package org.relaxng.datatype; + +/** + * An interface that must be implemented by caller to + * provide context information that is necessary to + * perform validation of some Datatypes. + * + * @author James Clark + * @author Kohsuke KAWAGUCHI + */ +public interface ValidationContext { + + /** + * Resolves a namespace prefix to the corresponding namespace URI. + * + * This method is used for validating the QName type, for example. + * + *

+ * If the prefix is "" (empty string), it indicates + * an unprefixed value. The callee + * should resolve it as for an unprefixed + * element, rather than for an unprefixed attribute. + * + *

+ * If the prefix is "xml", then the callee must resolve + * this prefix into "http://www.w3.org/XML/1998/namespace", + * as defined in the XML Namespaces Recommendation. + * + * @return + * namespace URI of this prefix. + * If the specified prefix is not declared, + * the implementation must return null. + */ + String resolveNamespacePrefix( String prefix ); + + /** + * Returns the base URI of the context. The null string may be returned + * if no base URI is known. + */ + String getBaseUri(); + + /** + * Checks if an unparsed entity is declared with the + * specified name. + * + * @return + * true + * if the DTD has an unparsed entity declaration for + * the specified name. + * false + * otherwise. + */ + boolean isUnparsedEntity( String entityName ); + + /** + * Checks if a notation is declared with the + * specified name. + * + * @return + * true + * if the DTD has a notation declaration for the specified name. + * false + * otherwise. + */ + boolean isNotation( String notationName ); +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java new file mode 100644 index 0000000..18fdee0 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java @@ -0,0 +1,267 @@ +/** + * Copyright (c) 2001, Thai Open Source Software Center Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Thai Open Source Software Center Ltd nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.relaxng.datatype.helpers; + +import org.relaxng.datatype.DatatypeLibraryFactory; +import org.relaxng.datatype.DatatypeLibrary; +import java.util.Enumeration; +import java.util.NoSuchElementException; +import java.util.Vector; +import java.io.Reader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URL; + +/** + * Discovers the datatype library implementation from the classpath. + * + *

+ * The call of the createDatatypeLibrary method finds an implementation + * from a given datatype library URI at run-time. + */ +public class DatatypeLibraryLoader implements DatatypeLibraryFactory { + private final Service service = new Service(DatatypeLibraryFactory.class); + + public DatatypeLibrary createDatatypeLibrary(String uri) { + for (Enumeration e = service.getProviders(); + e.hasMoreElements();) { + DatatypeLibraryFactory factory + = (DatatypeLibraryFactory)e.nextElement(); + DatatypeLibrary library = factory.createDatatypeLibrary(uri); + if (library != null) + return library; + } + return null; + } + + private static class Service { + private final Class serviceClass; + private final Enumeration configFiles; + private Enumeration classNames = null; + private final Vector providers = new Vector(); + private Loader loader; + + private class ProviderEnumeration implements Enumeration { + private int nextIndex = 0; + + public boolean hasMoreElements() { + return nextIndex < providers.size() || moreProviders(); + } + + public Object nextElement() { + try { + return providers.elementAt(nextIndex++); + } + catch (ArrayIndexOutOfBoundsException e) { + throw new NoSuchElementException(); + } + } + } + + private static class Singleton implements Enumeration { + private Object obj; + private Singleton(Object obj) { + this.obj = obj; + } + + public boolean hasMoreElements() { + return obj != null; + } + + public Object nextElement() { + if (obj == null) + throw new NoSuchElementException(); + Object tem = obj; + obj = null; + return tem; + } + } + + // JDK 1.1 + private static class Loader { + Enumeration getResources(String resName) { + ClassLoader cl = Loader.class.getClassLoader(); + URL url; + if (cl == null) + url = ClassLoader.getSystemResource(resName); + else + url = cl.getResource(resName); + return new Singleton(url); + } + + Class loadClass(String name) throws ClassNotFoundException { + return Class.forName(name); + } + } + + // JDK 1.2+ + private static class Loader2 extends Loader { + private ClassLoader cl; + + Loader2() { + cl = Loader2.class.getClassLoader(); + // If the thread context class loader has the class loader + // of this class as an ancestor, use the thread context class + // loader. Otherwise, the thread context class loader + // probably hasn't been set up properly, so don't use it. + ClassLoader clt = Thread.currentThread().getContextClassLoader(); + for (ClassLoader tem = clt; tem != null; tem = tem.getParent()) + if (tem == cl) { + cl = clt; + break; + } + } + + Enumeration getResources(String resName) { + try { + Enumeration resources = cl.getResources(resName); + if (resources.hasMoreElements()) + return resources; + // Some application servers apparently do not implement findResources + // in their class loaders, so fall back to getResource. + return new Singleton(cl.getResource(resName)); + } + catch (IOException e) { + return new Singleton(null); + } + } + + Class loadClass(String name) throws ClassNotFoundException { + return Class.forName(name, true, cl); + } + } + + public Service(Class cls) { + try { + loader = new Loader2(); + } + catch (NoSuchMethodError e) { + loader = new Loader(); + } + serviceClass = cls; + String resName = "META-INF/services/" + serviceClass.getName(); + configFiles = loader.getResources(resName); + } + + public Enumeration getProviders() { + return new ProviderEnumeration(); + } + + synchronized private boolean moreProviders() { + for (;;) { + while (classNames == null) { + if (!configFiles.hasMoreElements()) + return false; + classNames = parseConfigFile((URL)configFiles.nextElement()); + } + while (classNames.hasMoreElements()) { + String className = (String)classNames.nextElement(); + try { + Class cls = loader.loadClass(className); + Object obj = cls.newInstance(); + if (serviceClass.isInstance(obj)) { + providers.addElement(obj); + return true; + } + } + catch (ClassNotFoundException e) { } + catch (InstantiationException e) { } + catch (IllegalAccessException e) { } + catch (LinkageError e) { } + } + classNames = null; + } + } + + private static final int START = 0; + private static final int IN_NAME = 1; + private static final int IN_COMMENT = 2; + + private static Enumeration parseConfigFile(URL url) { + try { + InputStream in = url.openStream(); + Reader r; + try { + r = new InputStreamReader(in, "UTF-8"); + } + catch (UnsupportedEncodingException e) { + r = new InputStreamReader(in, "UTF8"); + } + r = new BufferedReader(r); + Vector tokens = new Vector(); + StringBuffer tokenBuf = new StringBuffer(); + int state = START; + for (;;) { + int n = r.read(); + if (n < 0) + break; + char c = (char)n; + switch (c) { + case '\r': + case '\n': + state = START; + break; + case ' ': + case '\t': + break; + case '#': + state = IN_COMMENT; + break; + default: + if (state != IN_COMMENT) { + state = IN_NAME; + tokenBuf.append(c); + } + break; + } + if (tokenBuf.length() != 0 && state != IN_NAME) { + tokens.addElement(tokenBuf.toString()); + tokenBuf.setLength(0); + } + } + if (tokenBuf.length() != 0) + tokens.addElement(tokenBuf.toString()); + return tokens.elements(); + } + catch (IOException e) { + return null; + } + } + } + +} + diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java new file mode 100644 index 0000000..d915111 --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java @@ -0,0 +1,42 @@ +package org.relaxng.datatype.helpers; + +import org.relaxng.datatype.*; + +/** + * Dummy implementation of {@link DatatypeBuilder}. + * + * This implementation can be used for Datatypes which have no parameters. + * Any attempt to add parameters will be rejected. + * + *

+ * Typical usage would be: + *


+ * class MyDatatypeLibrary implements DatatypeLibrary {
+ *     ....
+ *     DatatypeBuilder createDatatypeBuilder( String typeName ) {
+ *         return new ParameterleessDatatypeBuilder(createDatatype(typeName));
+ *     }
+ *     ....
+ * }
+ * 
+ * + * @author Kohsuke KAWAGUCHI + */ +public final class ParameterlessDatatypeBuilder implements DatatypeBuilder { + + /** This type object is returned for the derive method. */ + private final Datatype baseType; + + public ParameterlessDatatypeBuilder( Datatype baseType ) { + this.baseType = baseType; + } + + public void addParameter( String name, String strValue, ValidationContext context ) + throws DatatypeException { + throw new DatatypeException(); + } + + public Datatype createDatatype() throws DatatypeException { + return baseType; + } +} diff --git a/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/StreamingValidatorImpl.java b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/StreamingValidatorImpl.java new file mode 100644 index 0000000..31f2dcd --- /dev/null +++ b/thirdparty/epubcheck/jingsrc/org/relaxng/datatype/helpers/StreamingValidatorImpl.java @@ -0,0 +1,55 @@ +package org.relaxng.datatype.helpers; + +import org.relaxng.datatype.*; + +/** + * Dummy implementation of {@link DatatypeStreamingValidator}. + * + *

+ * This implementation can be used as a quick hack when the performance + * of streaming validation is not important. And this implementation + * also shows you how to implement the DatatypeStreamingValidator interface. + * + *

+ * Typical usage would be: + *


+ * class MyDatatype implements Datatype {
+ *     ....
+ *     public DatatypeStreamingValidator createStreamingValidator( ValidationContext context ) {
+ *         return new StreamingValidatorImpl(this,context);
+ *     }
+ *     ....
+ * }
+ * 
+ * + * @author Kohsuke KAWAGUCHI + */ +public final class StreamingValidatorImpl implements DatatypeStreamingValidator { + + /** This buffer accumulates characters. */ + private final StringBuffer buffer = new StringBuffer(); + + /** Datatype obejct that creates this streaming validator. */ + private final Datatype baseType; + + /** The current context. */ + private final ValidationContext context; + + public void addCharacters( char[] buf, int start, int len ) { + // append characters to the current buffer. + buffer.append(buf,start,len); + } + + public boolean isValid() { + return baseType.isValid(buffer.toString(),context); + } + + public void checkValid() throws DatatypeException { + baseType.checkValid(buffer.toString(),context); + } + + public StreamingValidatorImpl( Datatype baseType, ValidationContext context ) { + this.baseType = baseType; + this.context = context; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/api/EpubCheck.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/api/EpubCheck.java new file mode 100644 index 0000000..c7c2044 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/api/EpubCheck.java @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.adobe.epubcheck.api; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.zip.ZipFile; + +import com.adobe.epubcheck.ocf.OCFChecker; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.util.CheckUtil; +import com.adobe.epubcheck.util.DefaultReportImpl; +import com.adobe.epubcheck.util.WriterReportImpl; + +/** + * Public interface to epub validator. + */ +public class EpubCheck { + /* VERSION number is duplicated in the build.xml and war-build.xml files, so you'll need to change it in two additional places */ + public static final String VERSION = "1.0.5"; + + File epubFile; + + Report userReport; + + public int warningCount; + + public int errorCount; + + static String fixMessage(String message) { + return message.replaceAll("\r\n", " ").replaceAll("\r", " ") + .replaceAll("\n", " "); + } + + class ProxyReport implements Report { + + public void error(String resource, int line, String message) { + errorCount++; + userReport.error(resource, line, fixMessage(message)); + } + + public void warning(String resource, int line, String message) { + warningCount++; + userReport.warning(resource, line, fixMessage(message)); + } + + } + + /* + * Create an epub validator to validate the given file. Issues will be + * reported to standard error. + */ + public EpubCheck(File epubFile) { + this.epubFile = epubFile; + this.userReport = new DefaultReportImpl(epubFile.getName()); + } + + /* + * Create an epub validator to validate the given file. Issues will be + * reported to the given PrintWriter. + */ + public EpubCheck(File epubFile, PrintWriter out) { + this.epubFile = epubFile; + this.userReport = new WriterReportImpl(out); + } + + /* + * Create an epub validator to validate the given file and report issues to + * a given Report object. + */ + public EpubCheck(File epubFile, Report report) { + this.epubFile = epubFile; + this.userReport = report; + } + + /** + * Validate the file. Return true if no errors or warnings found. + */ + public boolean validate() { + Report report = new ProxyReport(); + try { + FileInputStream epubIn = new FileInputStream(epubFile); + + byte[] header = new byte[58]; + + if (epubIn.read(header) != header.length) { + report.error(null, 0, "cannot read header"); + } else { + int fnsize = getIntFromBytes(header, 26); + int extsize = getIntFromBytes(header, 28); + + if (header[0] != 'P' && header[1] != 'K') { + report.error(null, 0, "corrupted ZIP header"); + } else if (fnsize != 8) { + report + .error(null, 0, + "length of first filename in archive must be 8, but was " + fnsize); + } else if (extsize != 0) { + report + .error(null, 0, + "extra field length for first filename must be 0, but was " + extsize); + } else if (!CheckUtil.checkString(header, 30, "mimetype")) { + report + .error(null, 0, + "mimetype entry missing or not the first in archive"); + } else if (!CheckUtil.checkString(header, 38, + "application/epub+zip")) { + report + .error(null, 0, + "mimetype contains wrong type (application/epub+zip expected)"); + } + } + + epubIn.close(); + + ZipFile zip = new ZipFile(epubFile); + + OCFPackage ocf = new OCFPackage(zip); + + OCFChecker checker = new OCFChecker(ocf, report); + + checker.runChecks(); + + zip.close(); + + } catch (IOException e) { + report.error(null, 0, "I/O error: " + e.getMessage()); + } + return warningCount == 0 && errorCount == 0; + } + + private int getIntFromBytes(byte[] bytes, int offset) { + int hi = 0xFF & bytes[offset + 1]; + int lo = 0xFF & bytes[offset + 0]; + return hi << 8 | lo; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/api/Report.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/api/Report.java new file mode 100644 index 0000000..9c9c073 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/api/Report.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.api; + +/** + * Interface that is used to report issues found in epub. + */ +public interface Report { + + + /** + * Called when a violation of the standard is found in epub. + * + * @param resource + * name of the resource in the epub zip container that caused + * error or null if the error is on the container level. + * @param line + * line number in the resource which has caused error (lines + * start with 1), non-positive number if the resource is not text + * or line is not available. + * @param message + * error message. + */ + public void error(String resource, int line, String message); + + /** + * Called when some notable issue is found in epub. + * + * @param resource + * name of the resource in the epub zip container that caused + * warning or null if the error is on the container level. + * @param line + * line number in the resource which has caused warning (lines + * start with 1), non-positive number if the resource is not text + * or line is not available. + * @param message + * warning message. + */ + public void warning(String resource, int line, String message); +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTest.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTest.java new file mode 100644 index 0000000..9663c5d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTest.java @@ -0,0 +1,93 @@ +/* + * Copyright 2008 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.autotest; + +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + + +/** + * @author Paul Norton + * + */ +public class AutoTest { + + SAXParser parser; + String path; + + public AutoTest(String str) { + this.path = str; + } + + /** + * Parse an xml file + * + * @param uri + * the uri of the file to parse + * @throws IOException + * @throws SAXException + */ + public void parse(String uri) throws IOException, SAXException { + SAXParserFactory factory = SAXParserFactory.newInstance(); + try { + AutoTestContentHandler handler = new AutoTestContentHandler(this.path); + parser = factory.newSAXParser(); + XMLReader reader = parser.getXMLReader(); + reader.setContentHandler(handler); + reader.parse(uri); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } + } + + /** + * @param args + * list of arguments of the program: testfile path_to_testdocs [options] + * + */ + public static void main(String[] args) { + if (args.length != 2) { + System.out.println("Usage : AutoTest testfile testdocs_path"); + System.exit(1); + } + System.out.println("start"); + String uri = args[0]; + String path = args[1]; + + try { + AutoTest parser = new AutoTest(path); + parser.parse(uri); + } catch (Throwable t) { + t.printStackTrace(); + } + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTestContentHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTestContentHandler.java new file mode 100644 index 0000000..5d6ae12 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/AutoTestContentHandler.java @@ -0,0 +1,234 @@ +/* + * Copyright 2008 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.autotest; + +import java.io.File; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +import com.adobe.epubcheck.api.EpubCheck; +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.util.DefaultReportImpl; +import com.adobe.epubcheck.autotest.Result; + +/** + * @author Paul Norton + * + * + */ +public class AutoTestContentHandler implements ContentHandler { + + Report report; + String path; + public static final String TESTSUITE = "testsuite"; + public static final String TEST = "test"; + public static final String TYPE = "type"; + public static final String TITLE = "title"; + public static final String FILE = "file"; + public static final String DESCRIPTION = "description"; + public static final String RESULTTAG = "result"; + public static final String VALIDITY = "valid"; + public static final String ERRORS = "errors"; + public static final String WARNINGS = "warnings"; + + + boolean inFile = false; + boolean inDesc = false; + boolean inErrors = false; + boolean inWarnings = false; + String urlString = ""; + String zipFile = ""; + String desc = ""; + Result expectedResult; + Result result; + int testsRun; + int testsPassed; + + public AutoTestContentHandler(String str) { + this.path = str; + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#characters(char[], int, int) + */ + public void characters(char[] ch, int start, int length) + throws SAXException { + if(inFile) { + zipFile = this.path; + zipFile += new String(ch, start, length).trim(); + } else if(inDesc) { + desc = new String(ch, start, length).trim(); + } else if(inErrors) { + int errors; + try { + errors = Integer.parseInt(new String(ch, start, length)); + } catch (NumberFormatException e) { + errors = 0; + } + expectedResult.setErrors(errors); + } else if(inWarnings) { + int warnings; + try { + warnings = Integer.parseInt(new String(ch, start, length)); + } catch (NumberFormatException e) { + warnings = 0; + } + expectedResult.setWarnings(warnings); + } + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#endDocument() + */ + public void endDocument() throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) + */ + public void endElement(String uri, String localName, String name) + throws SAXException { + if (name.equals(TESTSUITE)) { + System.out.println(); + System.out.println("Tests run:" + testsRun); + System.out.println("Tests passed:" + testsPassed); + } else if (name.equals(TEST)) { + System.out.println(); + System.out.println(zipFile); + Report report = new DefaultReportImpl(zipFile); + EpubCheck check = new EpubCheck(new File(zipFile), report); + result.setValid(check.validate()); + result.setErrors(check.errorCount); + result.setWarnings(check.warningCount); + if (result.isValid() == expectedResult.isValid() + && result.getErrors() == expectedResult.getErrors() + && result.getWarnings() == expectedResult.getWarnings()) { + testsPassed++; + } else { + System.out.println("***********************"); + System.out.println("Test Failed"); + System.out.println("\t"+zipFile); + System.out.println("\t"+desc); + System.out.println("\tExpectedErrors: "+expectedResult.getErrors()); + System.out.println("\tExpectedWarnings: "+expectedResult.getWarnings()); + System.out.println("***********************"); + } + testsRun++; + } else if (name.equals(FILE)) { + inFile = false; + } else if (name.equals(DESCRIPTION)) { + inDesc = false; + } else if (name.equals(WARNINGS)) { + inWarnings = false; + } else if (name.equals(ERRORS)) { + inErrors = false; + } + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) + */ + public void endPrefixMapping(String prefix) throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) + */ + public void ignorableWhitespace(char[] ch, int start, int length) + throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) + */ + public void processingInstruction(String target, String data) + throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) + */ + public void setDocumentLocator(Locator locator) { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) + */ + public void skippedEntity(String name) throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#startDocument() + */ + public void startDocument() throws SAXException { + + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) + */ + public void startElement(String uri, String localName, String name, + Attributes atts) throws SAXException { + if (name.equals(TESTSUITE)) { + testsRun = 0; + testsPassed = 0; + } else if(name.equals(TEST)) { + expectedResult = new Result(); + result = new Result(); + zipFile = ""; + desc = ""; + } else if(name.equals(FILE)) { + inFile = true; + } else if(name.equals(DESCRIPTION)) { + inDesc = true; + } else if(name.equals(RESULTTAG)) { + boolean valid = false; + try { + valid = atts.getValue("", "valid").equals("true"); + } catch (Exception e) {} + expectedResult.setValid(valid); + } else if(name.equals(WARNINGS)) { + inWarnings = true; + } else if(name.equals(ERRORS)) { + inErrors = true; + } + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) + */ + public void startPrefixMapping(String prefix, String uri) + throws SAXException { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/Result.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/Result.java new file mode 100644 index 0000000..d85bca4 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/autotest/Result.java @@ -0,0 +1,65 @@ +/** + * + */ +package com.adobe.epubcheck.autotest; + +/** + * @author Paul Norton + * + */ +public class Result { + + private boolean valid = true; + + private int errors; + + private int warnings; + + public Result() { + this.errors=0; + this.warnings=0; + } + + /** + * @param errors the errors to set + */ + public void setErrors(int errors) { + this.errors = errors; + } + + /** + * @return the errors + */ + public int getErrors() { + return errors; + } + + /** + * @param warnings the warnings to set + */ + public void setWarnings(int warnings) { + this.warnings = warnings; + } + + /** + * @return the warnings + */ + public int getWarnings() { + return warnings; + } + + /** + * @param valid the valid to set + */ + public void setValid(boolean valid) { + this.valid = valid; + } + + /** + * @return the valid + */ + public boolean isValid() { + return valid; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapChecker.java new file mode 100644 index 0000000..f8b6caf --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapChecker.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.bitmap; + +import java.io.IOException; +import java.io.InputStream; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; + +public class BitmapChecker implements ContentChecker { + + OCFPackage ocf; + + Report report; + + String path; + + String mimeType; + + BitmapChecker(OCFPackage ocf, Report report, String path, String mimeType) { + this.ocf = ocf; + this.report = report; + this.path = path; + this.mimeType = mimeType; + } + + private void checkHeader( byte[] header ) { + boolean passed; + if( mimeType.equals("image/jpeg") ) + passed = header[0] == (byte)0xFF && header[1] == (byte)0xD8; + else if( mimeType.equals("image/gif") ) + passed = header[0] == (byte)'G' && header[1] == (byte)'I' && header[2] == (byte)'F' && header[3] == (byte)'8'; + else if( mimeType.equals("image/png") ) + passed = header[0] == (byte)0x89 && header[1] == (byte)'P' && header[2] == (byte)'N' && header[3] == (byte)'G'; + else + passed = true; + if( ! passed ) + report.error(null, 0, "The file " + path + " does not appear to be of type " + mimeType ); + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "image file " + path + " is missing"); + else if (!ocf.canDecrypt(path)) + report.error(null, 0, "image file " + path + " cannot be decrypted"); + else { + try { + InputStream in = ocf.getInputStream(path); + byte[] header = new byte[4]; + if( in.read(header) != header.length ) { + report.error(null, 0, "image file " + path + " is too short"); + } else { + checkHeader(header); + } + in.close(); + } catch (IOException e) { + report.error(null, 0, "I/O error reading " + path); + } + } + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.java new file mode 100644 index 0000000..a80cde8 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/bitmap/BitmapCheckerFactory.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.bitmap; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.ContentCheckerFactory; +import com.adobe.epubcheck.opf.XRefChecker; + +public class BitmapCheckerFactory implements ContentCheckerFactory { + + public ContentChecker newInstance(OCFPackage ocf, Report report, String path, + String mimeType, XRefChecker xrefChecker) { + return new BitmapChecker(ocf, report, path, mimeType); + } + + static private BitmapCheckerFactory instance = new BitmapCheckerFactory(); + + static public BitmapCheckerFactory getInstance() { + return instance; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookChecker.java new file mode 100644 index 0000000..49d3b03 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookChecker.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.dtbook; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.xml.XMLParser; +import com.adobe.epubcheck.xml.XMLValidator; + +public class DTBookChecker implements ContentChecker { + + OCFPackage ocf; + + Report report; + + String path; + + XRefChecker xrefChecker; + + static XMLValidator dtbookValidator = new XMLValidator("rng/dtbook-2005-2.rng"); + + public DTBookChecker(OCFPackage ocf, Report report, String path, XRefChecker xrefChecker) { + this.ocf = ocf; + this.report = report; + this.path = path; + this.xrefChecker = xrefChecker; + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "DTBook file " + path + " is missing"); + else if (!ocf.canDecrypt(path)) + report.error(null, 0, "DTBook file " + path + " cannot be decrypted"); + else { + XMLParser dtbookParser = new XMLParser(ocf, path, report); + dtbookParser.addValidator(dtbookValidator); + DTBookHandler dtbookHandler = new DTBookHandler(dtbookParser, path, xrefChecker); + dtbookParser.addXMLHandler(dtbookHandler); + dtbookParser.process(); + } + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.java new file mode 100644 index 0000000..c11f0ae --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookCheckerFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.dtbook; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.ContentCheckerFactory; +import com.adobe.epubcheck.opf.XRefChecker; + +public class DTBookCheckerFactory implements ContentCheckerFactory { + + public ContentChecker newInstance(OCFPackage ocf, Report report, String path, + String mimeType, XRefChecker xrefChecker) { + return new DTBookChecker( ocf, report, path, xrefChecker ); + } + + static private DTBookCheckerFactory instance = new DTBookCheckerFactory(); + + static public DTBookCheckerFactory getInstance() { + return instance; + } + + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookHandler.java new file mode 100644 index 0000000..80d386d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtbook/DTBookHandler.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.dtbook; + +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.ops.OPSHandler; +import com.adobe.epubcheck.util.PathUtil; +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + + +public class DTBookHandler implements XMLHandler { + + XMLParser parser; + + String path; + + XRefChecker xrefChecker; + + DTBookHandler(XMLParser parser, String path, XRefChecker xrefChecker) { + this.parser = parser; + this.path = path; + this.xrefChecker = xrefChecker; + } + + public void characters(char[] chars, int arg1, int arg2) { + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void startElement() { + XMLElement e = parser.getCurrentElement(); + String ns = e.getNamespace(); + String name = e.getName(); + String id = e.getAttribute("id"); + if (ns.equals("http://www.daisy.org/z3986/2005/dtbook/")) { + //link@href, a@href, img@src + String uri = null; + /* This section checks to see if the references used are registered + * schema-types and whether they point to external resources. The + * resources are only allowed to be external if the attribute + * "external" is set to true. + */ + if (name.equals("a")) { + uri = e.getAttribute("href"); + String external = e.getAttribute("external"); + if (uri != null && external.equals("true")) { + if (OPSHandler.isRegisteredSchemaType(uri)) + uri = null; + else if (uri.indexOf(':') > 0) { + parser.getReport().warning(path, parser.getLineNumber(), + "use of non-registered URI schema type in href: " + uri); + uri = null; + } + } + } else if (name.equals("link")) { + uri = e.getAttribute("href"); + }else if(name.equals("img")) { + uri = e.getAttribute("src"); + } + if (uri != null) { + uri = PathUtil.resolveRelativeReference(path, uri); + xrefChecker.registerReference(path, parser.getLineNumber(), uri, + name.equals("img") ? XRefChecker.RT_IMAGE : XRefChecker.RT_HYPERLINK ); + } + if (id != null) + xrefChecker.registerAnchor(path, parser.getLineNumber(), id, XRefChecker.RT_HYPERLINK); + + } + } + + public void endElement() { + } + + public void processingInstruction(String arg0, String arg1) { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd new file mode 100644 index 0000000..72b26d3 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/dtbook-2005-2.dtd @@ -0,0 +1,2824 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/ncx-2005-1.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/ncx-2005-1.dtd new file mode 100644 index 0000000..441b2cc --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/ncx-2005-1.dtd @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/oeb12.dtdinc b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/oeb12.dtdinc new file mode 100644 index 0000000..f2e4af6 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/oeb12.dtdinc @@ -0,0 +1,1136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/opf20.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/opf20.dtd new file mode 100644 index 0000000..72207eb --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/opf20.dtd @@ -0,0 +1,296 @@ + + + + + + +%OEBEntities; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/svg11.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/svg11.dtd new file mode 100644 index 0000000..30f87e8 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/svg11.dtd @@ -0,0 +1,5790 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc new file mode 100644 index 0000000..7b7b407 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-lat1.dtdinc @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-special.dtdinc b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-special.dtdinc new file mode 100644 index 0000000..2ea205f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-special.dtdinc @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc new file mode 100644 index 0000000..3f8f8e6 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml-symbol.dtdinc @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-strict.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-strict.dtd new file mode 100644 index 0000000..8126d7e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-strict.dtd @@ -0,0 +1,979 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd new file mode 100644 index 0000000..59e6770 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/dtd/xhtml1-transitional.dtd @@ -0,0 +1,1200 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXChecker.java new file mode 100644 index 0000000..6172a8f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXChecker.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ncx; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.xml.XMLParser; +import com.adobe.epubcheck.xml.XMLValidator; + +public class NCXChecker implements ContentChecker { + + OCFPackage ocf; + + Report report; + + String path; + + XRefChecker xrefChecker; + + static XMLValidator ncxValidator = new XMLValidator("rng/ncx.rng"); + + static XMLValidator ncxSchematronValidator = new XMLValidator("sch/ncx.sch"); + + public NCXChecker(OCFPackage ocf, Report report, String path, + XRefChecker xrefChecker) { + this.ocf = ocf; + this.report = report; + this.path = path; + this.xrefChecker = xrefChecker; + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "NCX file " + path + " is missing"); + else if (!ocf.canDecrypt(path)) + report.error(null, 0, "NCX file " + path + " cannot be decrypted"); + else { + // relaxng + XMLParser ncxParser = new XMLParser(ocf, path, report); + ncxParser.addValidator(ncxValidator); + NCXHandler ncxHandler = new NCXHandler(ncxParser, path, xrefChecker); + ncxParser.addXMLHandler(ncxHandler); + ncxParser.process(); + + // schematron needs to go in a separate step, because of the catch + // below + // TODO: do it in a single step + try { + ncxParser = new XMLParser(ocf, path, report); + ncxParser.addValidator(ncxSchematronValidator); + ncxHandler = new NCXHandler(ncxParser, path, xrefChecker); + ncxParser.process(); + } catch (Throwable t) { + report.error(path, -1, + "Failed performing NCX Schematron tests: " + + t.getMessage()); + } + } + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXCheckerFactory.java new file mode 100644 index 0000000..01f1957 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXCheckerFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ncx; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.ContentCheckerFactory; +import com.adobe.epubcheck.opf.XRefChecker; + +public class NCXCheckerFactory implements ContentCheckerFactory { + + public ContentChecker newInstance(OCFPackage ocf, Report report, String path, + String mimeType, XRefChecker xrefChecker) { + return new NCXChecker( ocf, report, path, xrefChecker ); + } + + static private NCXCheckerFactory instance = new NCXCheckerFactory(); + + static public NCXCheckerFactory getInstance() { + return instance; + } + + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXHandler.java new file mode 100644 index 0000000..0d9fec3 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ncx/NCXHandler.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ncx; + +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.util.PathUtil; +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + +public class NCXHandler implements XMLHandler { + + XMLParser parser; + + String path; + + XRefChecker xrefChecker; + + NCXHandler(XMLParser parser, String path, XRefChecker xrefChecker) { + this.parser = parser; + this.path = path; + this.xrefChecker = xrefChecker; + } + + public void characters(char[] chars, int arg1, int arg2) { + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void startElement() { + XMLElement e = parser.getCurrentElement(); + String ns = e.getNamespace(); + String name = e.getName(); + if (ns.equals("http://www.daisy.org/z3986/2005/ncx/")) { + if (name.equals("content")) { + String href = e.getAttribute("src"); + if (href != null) { + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_HYPERLINK); + } + + } + } + } + + public void endElement() { + } + + public void processingInstruction(String arg0, String arg1) { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionFilter.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionFilter.java new file mode 100644 index 0000000..90ed99e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionFilter.java @@ -0,0 +1,10 @@ +package com.adobe.epubcheck.ocf; + +import java.io.InputStream; + +public interface EncryptionFilter { + + public boolean canDecrypt(); + + public InputStream decrypt(InputStream in); +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionHandler.java new file mode 100644 index 0000000..785c6ab --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/EncryptionHandler.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ocf; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; + +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + +public class EncryptionHandler implements XMLHandler { + + OCFPackage ocf; + + XMLParser parser; + + EncryptionHandler(XMLParser parser, OCFPackage ocf) { + this.parser = parser; + this.ocf = ocf; + } + + public void startElement() { + XMLElement e = parser.getCurrentElement(); + // if the element is , then the element name + // is stripped of rootBase, and URLDecoded, and finally put into + // encryptedItemsSet. + if (e.getName().equals("CipherReference")) { + String algorithm = null; + XMLElement parent = e.getParent(); + if (parent != null) { + parent = parent.getParent(); + if (parent != null && parent.getName().equals("EncryptedData")) + algorithm = (String) parent.getPrivateData(); + } + String entryName = e.getAttribute("URI"); + try { + entryName = URLDecoder.decode(entryName, "UTF-8"); + } catch (UnsupportedEncodingException er) { + // UTF-8 is guaranteed to be supported + throw new InternalError(e.toString()); + } + if (algorithm == null) + algorithm = "unknown"; + if (algorithm.equals("http://www.idpf.org/2008/embedding")) + ocf.setEncryption(entryName, new IDPFFontManglingFilter(ocf)); + else + ocf.setEncryption(entryName, new UnsupportedEncryptionFilter()); + } else if (e.getName().equals("EncryptionMethod")) { + String algorithm = e.getAttribute("Algorithm"); + if (algorithm != null) { + XMLElement parent = e.getParent(); + if (parent != null) { + String comp = parent.getAttributeNS( + "http://ns.adobe.com/digitaleditions/enc", + "compression"); + if (comp == null) + parent.setPrivateData(algorithm); + } + } + } + } + + public void endElement() { + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void characters(char[] chars, int arg1, int arg2) { + } + + public void processingInstruction(String arg0, String arg1) { + } + +} \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.java new file mode 100644 index 0000000..be432b2 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/IDPFFontManglingFilter.java @@ -0,0 +1,22 @@ +package com.adobe.epubcheck.ocf; + +import java.io.InputStream; + +public class IDPFFontManglingFilter implements EncryptionFilter { + + OCFPackage ocf; + + public IDPFFontManglingFilter( OCFPackage ocf ) { + this.ocf = ocf; + } + + public boolean canDecrypt() { + return ocf.getUniqueIdentifier() != null; + } + + public InputStream decrypt(InputStream in) { + // TODO implement this once we start to validate fonts + return null; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFChecker.java new file mode 100644 index 0000000..10b852a --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFChecker.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ocf; + +import java.util.Hashtable; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.opf.OPFChecker; +import com.adobe.epubcheck.xml.XMLParser; +import com.adobe.epubcheck.xml.XMLValidator; + +public class OCFChecker { + + OCFPackage ocf; + + Report report; + + Hashtable encryptedItems; + + static XMLValidator containerValidator = new XMLValidator( + "rng/container.rng"); + + static XMLValidator encryptionValidator = new XMLValidator( + "rng/encryption.rng"); + + static XMLValidator signatureValidator = new XMLValidator( + "rng/signatures.rng"); + + public OCFChecker(OCFPackage ocf, Report report) { + this.ocf = ocf; + this.report = report; + } + + public void runChecks() { + + String rootPath; + + // Validate container.xml + String containerEntry = "META-INF/container.xml"; + if (!ocf.hasEntry(containerEntry)) { + report.error(null, 0, + "Required META-INF/container.xml resource is missing"); + return; + } + XMLParser containerParser = new XMLParser(ocf, containerEntry, report); + OCFHandler containerHandler = new OCFHandler(containerParser); + containerParser.addXMLHandler(containerHandler); + containerParser.addValidator(containerValidator); + containerParser.process(); + rootPath = containerHandler.getRootPath(); + + // Validate encryption.xml + String encryptionEntry = "META-INF/encryption.xml"; + if (ocf.hasEntry(encryptionEntry)) { + XMLParser encryptionParser = new XMLParser(ocf, encryptionEntry, + report); + EncryptionHandler encryptionHandler = new EncryptionHandler( + encryptionParser, ocf); + + encryptionParser.addXMLHandler(encryptionHandler); + encryptionParser.addValidator(encryptionValidator); + encryptionParser.process(); + } + + // Validate signatures.xml + String signatureEntry = "META-INF/signatures.xml"; + if (ocf.hasEntry(signatureEntry)) { + XMLParser signatureParser = new XMLParser(ocf, signatureEntry, + report); + OCFHandler signatureHandler = new OCFHandler(signatureParser); + signatureParser.addXMLHandler(signatureHandler); + signatureParser.addValidator(signatureValidator); + signatureParser.process(); + } + + OPFChecker opfChecker = new OPFChecker(ocf, report, rootPath); + opfChecker.runChecks(); + } + + /** + * This method processes the rootPath String and returns the base path to + * the directory that contains the OPF content file. + * + * @param rootPath + * path+name of OPF content file + * @return String containing path to OPF content file's directory inside ZIP + */ + public String processRootPath(String rootPath) { + String rootBase = rootPath; + if (rootPath.endsWith(".opf")) { + int slash = rootPath.lastIndexOf("/"); + if (slash < rootPath.lastIndexOf("\\")) + slash = rootPath.lastIndexOf("\\"); + if (slash >= 0 && (slash + 1) < rootPath.length()) + rootBase = rootPath.substring(0, slash + 1); + else + rootBase = rootPath; + return rootBase; + } else { + System.out.println("RootPath is not an OPF file"); + return null; + } + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFHandler.java new file mode 100644 index 0000000..a54207f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFHandler.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ocf; + +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + +public class OCFHandler implements XMLHandler { + + XMLParser parser; + + static String rootPath; + + OCFHandler(XMLParser parser) { + this.parser = parser; + } + + public String getRootPath() { + return rootPath; + } + + public void startElement() { + XMLElement e = parser.getCurrentElement(); + String ns = e.getNamespace(); + if (e.getName().equals("rootfile") && ns != null + && ns.equals("urn:oasis:names:tc:opendocument:xmlns:container")) { + String mediaType = e.getAttribute("media-type"); + if (mediaType != null + && mediaType.equals("application/oebps-package+xml")) { + rootPath = e.getAttribute("full-path"); + } + } + } + + public void endElement() { + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void characters(char[] chars, int arg1, int arg2) { + } + + public void processingInstruction(String arg0, String arg1) { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFPackage.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFPackage.java new file mode 100644 index 0000000..04a367f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/OCFPackage.java @@ -0,0 +1,55 @@ +package com.adobe.epubcheck.ocf; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Hashtable; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class OCFPackage { + + ZipFile zip; + Hashtable enc; + String uniqueIdentifier; + + public OCFPackage(ZipFile zip) { + this.zip = zip; + this.enc = new Hashtable(); + } + + public void setEncryption(String name, EncryptionFilter encryptionFilter) { + enc.put(name, encryptionFilter); + } + + public void setUniqueIdentifier(String idval) { + uniqueIdentifier = idval; + } + + public String getUniqueIdentifier() { + return uniqueIdentifier; + } + + public boolean hasEntry(String name) { + return zip.getEntry(name) != null; + } + + public boolean canDecrypt(String name) { + EncryptionFilter filter = (EncryptionFilter) enc.get(name); + if (filter == null) + return true; + return filter.canDecrypt(); + } + + public InputStream getInputStream(String name) throws IOException { + ZipEntry entry = zip.getEntry(name); + if (entry == null) + return null; + InputStream in = zip.getInputStream(entry); + EncryptionFilter filter = (EncryptionFilter) enc.get(name); + if (filter == null) + return in; + if( filter.canDecrypt() ) + return filter.decrypt(in); + return null; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.java new file mode 100644 index 0000000..4b22dab --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ocf/UnsupportedEncryptionFilter.java @@ -0,0 +1,15 @@ +package com.adobe.epubcheck.ocf; + +import java.io.InputStream; + +public class UnsupportedEncryptionFilter implements EncryptionFilter { + + public boolean canDecrypt() { + return false; + } + + public InputStream decrypt(InputStream in) { + return null; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentChecker.java new file mode 100644 index 0000000..90d5618 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentChecker.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +public interface ContentChecker { + + public void runChecks(); +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentCheckerFactory.java new file mode 100644 index 0000000..c3b43ab --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/ContentCheckerFactory.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; + +public interface ContentCheckerFactory { + + public ContentChecker newInstance( OCFPackage ocf, Report report, String path, String mimeType, XRefChecker xrefChecker ); + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentChecker.java new file mode 100644 index 0000000..3afd571 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentChecker.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; + +public class GenericContentChecker implements ContentChecker { + + OCFPackage ocf; + Report report; + String path; + + GenericContentChecker(OCFPackage ocf, Report report, String path) { + this.ocf = ocf; + this.report = report; + this.path = path; + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "resource " + path + " is missing"); + else if (!ocf.canDecrypt(path)) + report + .warning(null, 0, "resource " + path + + " cannot be decrypted"); + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentCheckerFactory.java new file mode 100644 index 0000000..41598b7 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/GenericContentCheckerFactory.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; + +public class GenericContentCheckerFactory implements ContentCheckerFactory { + + public ContentChecker newInstance(OCFPackage ocf, Report report, String path, + String mimeType, XRefChecker xrefChecker) { + return new GenericContentChecker(ocf, report, path); + } + + static private GenericContentCheckerFactory instance = new GenericContentCheckerFactory(); + + static public GenericContentCheckerFactory getInstance() { + return instance; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFChecker.java new file mode 100644 index 0000000..cdff7ab --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFChecker.java @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import java.util.Hashtable; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.bitmap.BitmapCheckerFactory; +import com.adobe.epubcheck.dtbook.DTBookCheckerFactory; +import com.adobe.epubcheck.ncx.NCXCheckerFactory; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.ops.OPSCheckerFactory; +import com.adobe.epubcheck.xml.XMLParser; +import com.adobe.epubcheck.xml.XMLValidator; + +public class OPFChecker { + + OCFPackage ocf; + + Report report; + + String path; + + static XMLValidator opfValidator = new XMLValidator("rng/opf.rng"); + + static XMLValidator opfSchematronValidator = new XMLValidator("sch/opf.sch"); + + XRefChecker xrefChecker; + + static Hashtable contentCheckerFactoryMap; + + static { + Hashtable map = new Hashtable(); + map.put("application/xhtml+xml", OPSCheckerFactory.getInstance()); + map.put("text/html", OPSCheckerFactory.getInstance()); + map.put("text/x-oeb1-document", OPSCheckerFactory.getInstance()); + map.put("image/jpeg", BitmapCheckerFactory.getInstance()); + map.put("image/gif", BitmapCheckerFactory.getInstance()); + map.put("image/png", BitmapCheckerFactory.getInstance()); + map.put("image/svg+xml", OPSCheckerFactory.getInstance()); + map.put("application/x-dtbook+xml", DTBookCheckerFactory.getInstance()); + + contentCheckerFactoryMap = map; + } + + public OPFChecker(OCFPackage ocf, Report report, String path) { + this.ocf = ocf; + this.report = report; + this.path = path; + this.xrefChecker = new XRefChecker(ocf, report); + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "OPF file " + path + " is missing"); + else { + XMLParser opfParser = new XMLParser(ocf, path, report); + OPFHandler opfHandler = new OPFHandler(opfParser, ocf, path); + opfParser.addXMLHandler(opfHandler); + + // add relaxNG validator + opfParser.addValidator(opfValidator); + + // add schematron validator + opfParser.addValidator(opfSchematronValidator); + + try { + // validate according to relaxNG + schematron + opfParser.process(); + } catch (Throwable t) { + report.error(path, -1, + "Failed performing OPF Schematron tests: " + t.getMessage()); + } + + if (!opfHandler.checkUniqueIdentExists()) { + report.error(path, -1, + "unique-identifier attribute in package element must reference an existing identifier element id"); + } + + int itemCount = opfHandler.getItemCount(); + for (int i = 0; i < itemCount; i++) { + OPFItem item = opfHandler.getItem(i); + try { + xrefChecker.registerResource(item.getPath(), item.getMimeType(), item.isInSpine(), + checkItemFallbacks(item, opfHandler), checkImageFallbacks(item, opfHandler)); + } catch (IllegalArgumentException e) { + report.error(path, item.getLineNumber(), e.getMessage()); + } + checkItem(item, opfHandler); + } + + int spineItemCount = opfHandler.getSpineItemCount(); + for (int i = 0; i < spineItemCount; i++) { + OPFItem item = opfHandler.getSpineItem(i); + checkSpineItem(item, opfHandler); + } + + for (int i = 0; i < itemCount; i++) { + OPFItem item = opfHandler.getItem(i); + checkItemContent(item, opfHandler); + } + + xrefChecker.checkReferences(); + } + } + + static boolean isBlessedItemType(String type) { + return type.equals("application/xhtml+xml") + || type.equals("application/x-dtbook+xml"); + + } + + static boolean isDeprecatedBlessedItemType(String type) { + return type.equals("text/x-oeb1-document") || type.equals("text/html"); + } + + static boolean isBlessedStyleType(String type) { + return type.equals("text/css"); + } + + static boolean isDeprecatedBlessedStyleType(String type) { + return type.equals("text/x-oeb1-css"); + } + + static boolean isBlessedImageType(String type) { + return type.equals("image/gif") || type.equals("image/png") + || type.equals("image/jpeg") || type.equals("image/svg+xml"); + } + + private void checkItem(OPFItem item, OPFHandler opfHandler) { + String mimeType = item.getMimeType(); + String fallback = item.getFallback(); + if (mimeType == null || mimeType.equals("")) { + // Ensures that media-type attribute is not empty + report.error(path, item.getLineNumber(), + "empty media-type attribute"); + } else if (!mimeType.matches("[a-zA-Z0-9!#$&+-^_]+/[a-zA-Z0-9!#$&+-^_]+")) { + /* + * Ensures that media-type attribute has correct content. The + * media-type must have a type and a sub-type divided by '/' The + * allowable content for the media-type attribute is defined in + * RFC4288 section 4.2 + */ + report.error(path, item.getLineNumber(), + "invalid content for media-type attribute"); + } else if (isDeprecatedBlessedItemType(mimeType) + || isDeprecatedBlessedStyleType(mimeType)) { + if (opfHandler.getOpf20PackageFile() + && mimeType.equals("text/html")) + report.warning(path, item.getLineNumber(), + "text/html is not appropriate for XHTML/OPS, use application/xhtml+xml instead"); + else if (opfHandler.getOpf12PackageFile() && mimeType.equals("text/html")) + report.warning(path, item.getLineNumber(), + "text/html is not appropriate for OEBPS 1.2, use text/x-oeb1-document instead"); + else if (opfHandler.getOpf20PackageFile()) + report.warning(path, item.getLineNumber(), + "deprecated media-type '" + mimeType + "'"); + } + if (opfHandler.getOpf12PackageFile() && fallback == null) { + if (isBlessedItemType(mimeType)) + report.warning(path, item.getLineNumber(), "use of OPS media-type '" + + mimeType + "' in OEBPS 1.2 context; use text/x-oeb1-document instead"); + else if (isBlessedStyleType(mimeType)) + report.warning(path, item.getLineNumber(), "use of OPS media-type '" + + mimeType + "' in OEBPS 1.2 context; use text/x-oeb1-css instead"); + } + if (fallback != null) { + OPFItem fallbackItem = opfHandler.getItemById(fallback); + if (fallbackItem == null) + report.error(path, item.getLineNumber(), + "fallback item could not be found"); + } + String fallbackStyle = item.getFallbackStyle(); + if (fallbackStyle != null) { + OPFItem fallbackStyleItem = opfHandler.getItemById(fallbackStyle); + if (fallbackStyleItem == null) + report.error(path, item.getLineNumber(), + "fallback-style item could not be found"); + } + } + + private void checkItemContent(OPFItem item, OPFHandler opfHandler) { + String mimeType = item.getMimeType(); + String path = item.getPath(); + if (mimeType != null) { + ContentCheckerFactory checkerFactory; + if (item.isNcx()) + checkerFactory = NCXCheckerFactory.getInstance(); + else + checkerFactory = (ContentCheckerFactory) contentCheckerFactoryMap + .get(mimeType); + if (checkerFactory == null) + checkerFactory = GenericContentCheckerFactory.getInstance(); + if (checkerFactory != null) { + ContentChecker checker = checkerFactory.newInstance(ocf, + report, path, mimeType, xrefChecker); + checker.runChecks(); + } + } + } + + private void checkSpineItem(OPFItem item, OPFHandler opfHandler) { + // These checks are okay to be done on items, but they really should be done on all + // items instead. I am avoiding making this change now pending a few issue + // resolutions in the EPUB Maint Working Group (e.g. embedded fonts not needing fallbacks). + // [GC 11/15/09] + String mimeType = item.getMimeType(); + if (mimeType != null) { + if (isBlessedStyleType(mimeType) + || isDeprecatedBlessedStyleType(mimeType) + || isBlessedImageType(mimeType)) + report.error(path, item.getLineNumber(), "'" + mimeType + + "' is not a permissible spine media-type"); + else if (!isBlessedItemType(mimeType) + && !isDeprecatedBlessedItemType(mimeType) + && item.getFallback() == null) + report.error(path, item.getLineNumber(), + "non-standard media-type '" + mimeType + + "' with no fallback"); + else if (!isBlessedItemType(mimeType) + && !isDeprecatedBlessedItemType(mimeType) + && !checkItemFallbacks(item, opfHandler)) + report.error(path, item.getLineNumber(), + "non-standard media-type '" + mimeType + + "' with fallback to non-spine-allowed media-type"); + } + } + + private boolean checkItemFallbacks(OPFItem item, OPFHandler opfHandler) { + String fallback = item.getFallback(); + if (fallback != null) { + OPFItem fallbackItem = opfHandler.getItemById(fallback); + if (fallbackItem != null) { + String mimeType = fallbackItem.getMimeType(); + if (mimeType != null) { + if (isBlessedItemType(mimeType) + || isDeprecatedBlessedItemType(mimeType)) + return true; + if (checkItemFallbacks(fallbackItem, opfHandler)) + return true; + } + } + } + String fallbackStyle = item.getFallbackStyle(); + if (fallbackStyle != null) { + OPFItem fallbackStyleItem = opfHandler.getItemById(fallbackStyle); + if (fallbackStyleItem != null) { + String mimeType = fallbackStyleItem.getMimeType(); + if (mimeType != null) { + if (isBlessedStyleType(mimeType) + || isDeprecatedBlessedStyleType(mimeType)) + return true; + } + } + } + return false; + } + + private boolean checkImageFallbacks(OPFItem item, OPFHandler opfHandler) { + String fallback = item.getFallback(); + if (fallback != null) { + OPFItem fallbackItem = opfHandler.getItemById(fallback); + if (fallbackItem != null) { + String mimeType = fallbackItem.getMimeType(); + if (mimeType != null) { + if (isBlessedImageType(mimeType)) + return true; + if (checkImageFallbacks(fallbackItem, opfHandler)) + return true; + } + } + } + return false; + } + + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFHandler.java new file mode 100644 index 0000000..2762a32 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFHandler.java @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Vector; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.util.PathUtil; +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + +public class OPFHandler implements XMLHandler { + + OCFPackage ocf; + + XMLParser parser; + + Hashtable itemMapById = new Hashtable(); + + Hashtable itemMapByPath = new Hashtable(); + + Hashtable encryptedItems; + + Vector spine = new Vector(); + Vector items = new Vector(); + + static HashSet validRoles = new HashSet(); + + String path; + + // This string holds the value of the element's unique-identifier + // attribute + // that will be used to make sure that the unique-identifier references an + // existing + // id attribute + String uniqueIdent; + + // This boolean specifies whether or not there has been a + // element + // parsed that has an id attribute that corresponds with the + // unique-identifier attribute + // from the packaging element. The default value is false. + boolean uniqueIdentExists = false; + + OPFItem toc; + + boolean opf12PackageFile = false; + + static { + String[] list = { "acp", "act", "adp", "aft", "anl", "anm", "ann", + "ant", "app", "aqt", "arc", "ard", "arr", "art", "asg", "asn", + "att", "auc", "aud", "aui", "aus", "aut", "bdd", "bjd", "bkd", + "bkp", "bnd", "bpd", "bsl", "ccp", "chr", "clb", "cli", "cll", + "clt", "cmm", "cmp", "cmt", "cng", "cnd", "cns", "coe", "col", + "com", "cos", "cot", "cov", "cpc", "cpe", "cph", "cpl", "cpt", + "cre", "crp", "crr", "csl", "csp", "cst", "ctb", "cte", "ctg", + "ctr", "cts", "ctt", "cur", "cwt", "dfd", "dfe", "dft", "dgg", + "dis", "dln", "dnc", "dnr", "dpc", "dpt", "drm", "drt", "dsr", + "dst", "dtc", "dte", "dtm", "dto", "dub", "edt", "egr", "elg", + "elt", "eng", "etr", "exp", "fac", "fld", "flm", "fmo", "fpy", + "fnd", "frg", "gis", "grt", "hnr", "hst", "ill", "ilu", "ins", + "inv", "itr", "ive", "ivr", "lbr", "lbt", "ldr", "led", "lee", + "lel", "len", "let", "lgd", "lie", "lil", "lit", "lsa", "lse", + "lso", "ltg", "lyr", "mcp", "mfr", "mdc", "mod", "mon", "mrk", + "msd", "mte", "mus", "nrt", "opn", "org", "orm", "oth", "own", + "pat", "pbd", "pbl", "pdr", "pfr", "pht", "plt", "pma", "pmn", + "pop", "ppm", "ppt", "prc", "prd", "prf", "prg", "prm", "pro", + "prt", "pta", "pte", "ptf", "pth", "ptt", "rbr", "rce", "rcp", + "red", "ren", "res", "rev", "rps", "rpt", "rpy", "rse", "rsg", + "rsp", "rst", "rth", "rtm", "sad", "sce", "scl", "scr", "sds", + "sec", "sgn", "sht", "sng", "spk", "spn", "spy", "srv", "std", + "stl", "stm", "stn", "str", "tcd", "tch", "ths", "trc", "trl", + "tyd", "tyg", "vdg", "voc", "wam", "wdc", "wde", "wit" }; + for (int i = 0; i < list.length; i++) + validRoles.add(list[i]); + } + + OPFHandler(XMLParser parser, OCFPackage ocf, String path) { + this.ocf = ocf; + this.parser = parser; + this.path = path; + } + + public boolean getOpf12PackageFile() { + return (opf12PackageFile); + } + + public boolean getOpf20PackageFile() { + return (!opf12PackageFile); + } + + public OPFItem getTOC() { + return toc; + } + + public OPFItem getItemById(String id) { + return (OPFItem) itemMapById.get(id); + } + + public OPFItem getItemByPath(String path) { + return (OPFItem) itemMapByPath.get(path); + } + + public int getSpineItemCount() { + return spine.size(); + } + + public OPFItem getSpineItem(int index) { + return (OPFItem) spine.elementAt(index); + } + + public int getItemCount() { + return items.size(); + } + + public OPFItem getItem(int index) { + return (OPFItem) items.elementAt(index); + } + + /** + * Checks to see if the unique-identifier attribute of the package element + * references an existing DC metadata identifier element's id attribute + * + * @return true if there is an identifier with an id attribute that matches + * the value of the unique-identifier attribute of the package + * element. False otherwise. + */ + public boolean checkUniqueIdentExists() { + return uniqueIdentExists; + } + + public void setEncryptedItems(Hashtable encryptedItems) { + this.encryptedItems = encryptedItems; + } + + private static boolean isValidRole(String role) { + return validRoles.contains(role) || role.startsWith("oth."); + } + + public void startElement() { + boolean registerEntry = true; + XMLElement e = parser.getCurrentElement(); + String ns = e.getNamespace(); + if (ns == null + || ns.equals("") + || ns + .equals("http://openebook.org/namespaces/oeb-package/1.0/") + || ns.equals("http://www.idpf.org/2007/opf")) { + String name = e.getName(); + if (name.equals("package")) { + if (!ns.equals("http://www.idpf.org/2007/opf")) { + parser + .getReport() + .warning(path, parser.getLineNumber(), + "OPF file is using OEBPS 1.2 syntax allowing backwards compatibility"); + opf12PackageFile = true; + } + /* + * This section checks to see the value of the unique-identifier + * attribute and stores it in the String uniqueIdent or reports + * an error if the unique-identifier attribute is missing or + * does not have a value + */ + String uniqueIdentAttr = e.getAttribute("unique-identifier"); + if (uniqueIdentAttr != null && !uniqueIdentAttr.equals("")) { + uniqueIdent = uniqueIdentAttr; + } else { + parser + .getReport() + .error( + path, + parser.getLineNumber(), + "unique-identifier attribute in package element must be present and have a value"); + } + } else if (name.equals("item")) { + String id = e.getAttribute("id"); + String href = e.getAttribute("href"); + if (href != null) { + try { + href = PathUtil.resolveRelativeReference(path, href); + } catch (IllegalArgumentException ex) { + parser.getReport().error(path, parser.getLineNumber(), + ex.getMessage()); + href = null; + } + } + String mimeType = e.getAttribute("media-type"); + String fallback = e.getAttribute("fallback"); + String fallbackStyle = e.getAttribute("fallback-style"); + String namespace = e.getAttribute("island-type"); + OPFItem item = new OPFItem(id, href, mimeType, fallback, + fallbackStyle, namespace, parser.getLineNumber()); + if (id != null) + itemMapById.put(id, item); + if (href != null && registerEntry) { + itemMapByPath.put(href, item); + items.add(item); + } + } else if (name.equals("spine")) { + String idref = e.getAttribute("toc"); + if (idref != null) { + toc = (OPFItem) itemMapById.get(idref); + if (toc == null) + parser.getReport().error(path, parser.getLineNumber(), + "item with id '" + idref + "' not found"); + else { + toc.setNcx(true); + if (toc.getMimeType() != null + && !toc.getMimeType().equals( + "application/x-dtbncx+xml")) + parser + .getReport() + .error( + path, + parser.getLineNumber(), + "toc attribute references resource with non-NCX mime type; \"application/x-dtbncx+xml\" is expected"); + } + } + } else if (name.equals("itemref")) { + String idref = e.getAttribute("idref"); + if (idref != null) { + OPFItem item = getItemById(idref); + if (item != null) { + spine.add(item); + item.setInSpine(true); + } else { + parser.getReport().error(path, parser.getLineNumber(), + "item with id '" + idref + "' not found"); + } + } + } else if (name.equals("dc-metadata") || name.equals("x-metadata")) { + if (!opf12PackageFile) + parser.getReport().error(path, parser.getLineNumber(), + "use of deprecated element '" + name + "'"); + } + } else if (ns.equals("http://purl.org/dc/elements/1.1/")) { + // in the DC metadata, when the element is parsed, if + // it has a non-null and non-empty id attribute value that is the + // same as the value of the unique-identifier attribute of the + // package element, set uniqueIdentExists = true (to make sure that + // the unique-identifier attribute references an existing + // id attribute + String name = e.getName(); + if (name.equals("identifier")) { + String idAttr = e.getAttribute("id"); + if (idAttr != null && !idAttr.equals("") + && idAttr.equals(uniqueIdent)) + uniqueIdentExists = true; + } else if (name.equals("creator")) { + String role = e.getAttributeNS("http://www.idpf.org/2007/opf", + "role"); + if (role != null && !role.equals("")) { + if (!isValidRole(role)) + parser.getReport().error(path, parser.getLineNumber(), + "role value '" + role + "' is not valid"); + } + } + } + } + + /** + * This method is used to check whether the passed href has and extension + * that is a required content file inside the OPF spec. This method returns + * false if it is requried, or true if it is not. + * + * @param href + * String to check + * @return true if it is not required, false if it is. + */ + public boolean isNotRequiredContent(String href) { + if (href.endsWith(".opf")) + return false; + else if (href.endsWith(".html")) + return false; + else if (href.endsWith(".ncx")) + return false; + else if (href.endsWith(".xpgt")) + return false; + else if (href.endsWith(".xhtml")) + return false; + else + return true; + + } + + public void endElement() { + XMLElement e = parser.getCurrentElement(); + if (e.getNamespace().equals("http://purl.org/dc/elements/1.1/")) { + String name = e.getName(); + if (name.equals("identifier")) { + String idAttr = e.getAttribute("id"); + if (idAttr != null && !idAttr.equals("") + && idAttr.equals(uniqueIdent)) { + String idval = (String) e.getPrivateData(); + if (idval != null) + ocf.setUniqueIdentifier(idval); + } + } else if (name.equals("date")) { + String dateval = (String) e.getPrivateData(); + if (dateval == null + || !dateval.matches("\\d\\d\\d\\d(-\\d\\d(-\\d\\d)?)?")) { + Report report = parser.getReport(); + report.error(path, parser.getLineNumber(), "date value '" + + (dateval == null ? "" : dateval) + + "' is not valid, YYYY[-MM[-DD]] expected"); + } + } + } + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void characters(char[] chars, int start, int len) { + XMLElement e = parser.getCurrentElement(); + if (e.getNamespace().equals("http://purl.org/dc/elements/1.1/")) { + String name = e.getName(); + if (name.equals("identifier") || name.equals("date")) { + String val = (String) e.getPrivateData(); + String text = new String(chars, start, len); + if (val == null) + val = text; + else + val = val + text; + e.setPrivateData(val); + } + } + } + + public void processingInstruction(String arg0, String arg1) { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFItem.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFItem.java new file mode 100644 index 0000000..e387fab --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/OPFItem.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +public class OPFItem { + + String id; + + String path; + + String mimeType; + + String fallback; + + String fallbackStyle; + + String namespace; + + int lineNumber; + + boolean ncx; + + boolean inSpine; + + OPFItem(String id, String path, String mimeType, String fallback, + String fallbackStyle, String namespace, int lineNumber) { + this.fallback = fallback; + this.fallbackStyle = fallbackStyle; + this.id = id; + this.lineNumber = lineNumber; + this.mimeType = mimeType; + this.namespace = namespace; + this.path = path; + } + + public String getFallback() { + return fallback; + } + + public String getFallbackStyle() { + return fallbackStyle; + } + + public String getId() { + return id; + } + + public String getMimeType() { + return mimeType; + } + + public String getPath() { + return path; + } + + public String getNamespace() { + return namespace; + } + + public int getLineNumber() { + return lineNumber; + } + + public boolean isNcx() { + return ncx; + } + + public void setNcx(boolean ncx) { + this.ncx = ncx; + } + + public boolean isInSpine() { + return inSpine; + } + + public void setInSpine(boolean inSpine) { + this.inSpine = inSpine; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/XRefChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/XRefChecker.java new file mode 100644 index 0000000..73e7365 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/opf/XRefChecker.java @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.opf; + +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Vector; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; + +public class XRefChecker { + + public static final int RT_GENERIC = 0; + + public static final int RT_HYPERLINK = 1; + + public static final int RT_IMAGE = 2; + + public static final int RT_OBJECT = 3; + + public static final int RT_STYLESHEET = 4; + + public static final int RT_SVG_PAINT = 0x10; + + public static final int RT_SVG_CLIP_PATH = 0x11; + + public static final int RT_SVG_SYMBOL = 0x12; + + private class Reference { + String resource; + + int lineNumber; + + String refResource; + + String fragment; + + int type; + + public Reference(String srcResource, int srcLineNumber, + String refResource, String fragment, int type) { + this.fragment = fragment; + this.lineNumber = srcLineNumber; + this.refResource = refResource; + this.resource = srcResource; + this.type = type; + } + + } + + private class Anchor { + + String id; + + int lineNumber; + + int type; + + public Anchor(String id, int lineNumber, int type) { + this.id = id; + this.lineNumber = lineNumber; + this.type = type; + } + + } + + private class Resource { + + String resource; + + String mimeType; + + Hashtable anchors; + + boolean inSpine; + + boolean hasValidItemFallback; + + boolean hasValidImageFallback; + + Resource(String resource, String type, boolean inSpine, boolean hasValidItemFallback, + boolean hasValidImageFallback) { + this.mimeType = type; + this.resource = resource; + this.inSpine = inSpine; + this.hasValidItemFallback = hasValidItemFallback; + this.hasValidImageFallback = hasValidImageFallback; + this.anchors = new Hashtable(); + } + } + + Hashtable resources = new Hashtable(); + + HashSet undeclared = new HashSet(); + + Vector references = new Vector(); + + Report report; + + OCFPackage ocf; + + public XRefChecker(OCFPackage ocf, Report report) { + this.ocf = ocf; + this.report = report; + } + + public void registerResource(String resource, String mimeType, boolean inSpine, boolean hasValidItemFallback, + boolean hasValidImageFallback) { + if (resources.get(resource) != null) + throw new IllegalArgumentException("duplicate resource: " + + resource); + resources.put(resource, new Resource(resource, mimeType, inSpine, hasValidItemFallback, hasValidImageFallback)); + } + + public void registerAnchor(String resource, int lineNumber, String id, + int type) { + Resource res = (Resource) resources.get(resource); + if (res == null) + throw new IllegalArgumentException("unregistered resource: " + + resource); + if (res.anchors.get(id) != null) + throw new IllegalArgumentException("duplicate id: " + id); + res.anchors.put(id, new Anchor(id, lineNumber, type)); + } + + public void registerReference(String srcResource, int srcLineNumber, + String refResource, String refFragment, int type) { + if( refResource.startsWith("data:") ) + return; + references.add(new Reference(srcResource, srcLineNumber, refResource, + refFragment, type)); + } + + public void registerReference(String srcResource, int srcLineNumber, + String ref, int type) { + if( ref.startsWith("data:") ) + return; + int hash = ref.indexOf("#"); + String refResource; + String refFragment; + if (hash >= 0) { + refResource = ref.substring(0, hash); + refFragment = ref.substring(hash + 1); + } else { + refResource = ref; + refFragment = null; + } + registerReference(srcResource, srcLineNumber, refResource, refFragment, + type); + } + + public void checkReferences() { + Enumeration refs = references.elements(); + while (refs.hasMoreElements()) { + Reference ref = (Reference) refs.nextElement(); + checkReference(ref); + } + } + + private void checkReference(Reference ref) { + Resource res = (Resource) resources.get(ref.refResource); + if (res == null) { + if (!ocf.hasEntry(ref.refResource)) + report.error(ref.resource, ref.lineNumber, "'" + + ref.refResource + + "': referenced resource missing in the package"); + else if (!undeclared.contains(ref.refResource)) { + undeclared.add(ref.refResource); + report + .error( + ref.resource, + ref.lineNumber, + "'" + + ref.refResource + + "': referenced resource exists, but not declared in the OPF file"); + } + return; + } + if (ref.fragment == null) { + switch (ref.type) { + case RT_SVG_PAINT: + case RT_SVG_CLIP_PATH: + case RT_SVG_SYMBOL: + report.error(ref.resource, ref.lineNumber, + "fragment identifier missing in reference to '" + + ref.refResource + "'"); + break; + case RT_HYPERLINK: + // if mimeType is null, we should have reported an error already + if (res.mimeType != null + && !OPFChecker.isBlessedItemType(res.mimeType) + && !OPFChecker.isDeprecatedBlessedItemType(res.mimeType) + && !res.hasValidItemFallback) + report.error(ref.resource, ref.lineNumber, + "hyperlink to non-standard resource '" + + ref.refResource + "' of type '" + + res.mimeType + "'"); + if(!res.inSpine) + report.warning(ref.resource, ref.lineNumber, "hyperlink to resource outside spine '" + + ref.refResource + "'"); + break; + case RT_IMAGE: + // if mimeType is null, we should have reported an error already + if (res.mimeType != null + && !OPFChecker.isBlessedImageType(res.mimeType) + && !res.hasValidImageFallback) + report.error(ref.resource, ref.lineNumber, + "non-standard image resource '" + ref.refResource + + "' of type '" + res.mimeType + "'"); + break; + case RT_STYLESHEET: + // if mimeType is null, we should have reported an error already + + // The original code is below, but we were never collecting references to RT_STYLESHEETs; now we are. + // Implementations are allowed to process any stylesheet language they desire; so this is clearly not an + // error. Making this a warning with "(might be ignored)" could be okay. However, related, the OPF + // Checker currently looks at only the to make sure referneced items have appropiate fallbacks; + // it should really be checking the . If this was corrected, these alternate stylesheet + // items (with non-blessed MIME types) would likely get flagged as missing requried fallbacks. Flagging + // this during manifest processing seems the right choice, so, commenting out for now. [GC 11/15/09] + + //if (res.mimeType != null + // && !OPFChecker.isBlessedStyleType(res.mimeType) + // && !OPFChecker + // .isDeprecatedBlessedStyleType(res.mimeType)) + // report.error(ref.resource, ref.lineNumber, + // "non-standard stylesheet resource '" + // + ref.refResource + "' of type '" + // + res.mimeType + "'"); + break; + } + } else { + switch (ref.type) { + case RT_HYPERLINK: + // if mimeType is null, we should have reported an error already + if (res.mimeType != null + && !OPFChecker.isBlessedItemType(res.mimeType) + && !OPFChecker.isDeprecatedBlessedItemType(res.mimeType) + && !res.hasValidItemFallback) + report.error(ref.resource, ref.lineNumber, + "hyperlink to non-standard resource '" + + ref.refResource + "' of type '" + + res.mimeType + "'"); + if(!res.inSpine) + report.warning(ref.resource, ref.lineNumber, "hyperlink to resource outside spine '" + + ref.refResource + "'"); + break; + case RT_IMAGE: + report.error(ref.resource, ref.lineNumber, + "fragment identifier used for image resource '" + + ref.refResource + "'"); + break; + case RT_STYLESHEET: + report.error(ref.resource, ref.lineNumber, + "fragment identifier used for stylesheet resource '" + + ref.refResource + "'"); + break; + } + Anchor anchor = (Anchor) res.anchors.get(ref.fragment); + if (anchor == null) { + report.error(ref.resource, ref.lineNumber, "'" + ref.fragment + + "': fragment identifier is not defined in '" + + ref.refResource + "'"); + return; + } else { + switch (ref.type) { + case RT_SVG_PAINT: + case RT_SVG_CLIP_PATH: + if (anchor.type != ref.type) + report + .error( + ref.resource, + ref.lineNumber, + "fragment identifier '" + + ref.fragment + + "' defines incompatible resource type in '" + + ref.refResource + "'"); + break; + case RT_SVG_SYMBOL: + case RT_HYPERLINK: + if (anchor.type != ref.type && anchor.type != RT_GENERIC) + report + .error( + ref.resource, + ref.lineNumber, + "fragment identifier '" + + ref.fragment + + "' defines incompatible resource type in '" + + ref.refResource + "'"); + break; + } + } + } + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSChecker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSChecker.java new file mode 100644 index 0000000..cf058b9 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSChecker.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ops; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.xml.XMLParser; +import com.adobe.epubcheck.xml.XMLValidator; + +public class OPSChecker implements ContentChecker { + + OCFPackage ocf; + + Report report; + + String path; + + String mimeType; + + XRefChecker xrefChecker; + + static XMLValidator xhtmlValidator = new XMLValidator("rng/ops20.nrl"); + static XMLValidator svgValidator = new XMLValidator("rng/svg11.rng"); + + public OPSChecker(OCFPackage ocf, Report report, String path, String mimeType, XRefChecker xrefChecker) { + this.ocf = ocf; + this.report = report; + this.path = path; + this.xrefChecker = xrefChecker; + this.mimeType = mimeType; + } + + public void runChecks() { + if (!ocf.hasEntry(path)) + report.error(null, 0, "OPS/XHTML file " + path + " is missing"); + else if (!ocf.canDecrypt(path)) + report.error(null, 0, "OPS/XHTML file " + path + " cannot be decrypted"); + else { + XMLParser opsParser = new XMLParser(ocf, path, report); + OPSHandler opsHandler = new OPSHandler(opsParser, path, xrefChecker); + opsParser.addXMLHandler(opsHandler); + if( mimeType.equals("image/svg+xml") ) + opsParser.addValidator(svgValidator); + else + opsParser.addValidator(xhtmlValidator); + opsParser.process(); + } + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSCheckerFactory.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSCheckerFactory.java new file mode 100644 index 0000000..fb56f76 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSCheckerFactory.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ops; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.opf.ContentChecker; +import com.adobe.epubcheck.opf.ContentCheckerFactory; +import com.adobe.epubcheck.opf.XRefChecker; + +public class OPSCheckerFactory implements ContentCheckerFactory { + + public ContentChecker newInstance(OCFPackage ocf, Report report, String path, + String mimeType, XRefChecker xrefChecker) { + return new OPSChecker(ocf, report, path, mimeType, xrefChecker); + } + + static private OPSCheckerFactory instance = new OPSCheckerFactory(); + + static public OPSCheckerFactory getInstance() { + return instance; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSHandler.java new file mode 100644 index 0000000..bbec508 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/OPSHandler.java @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.ops; + +import java.util.HashSet; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.BufferedReader; + +import com.adobe.epubcheck.opf.XRefChecker; +import com.adobe.epubcheck.util.PathUtil; +import com.adobe.epubcheck.xml.XMLElement; +import com.adobe.epubcheck.xml.XMLHandler; +import com.adobe.epubcheck.xml.XMLParser; + +public class OPSHandler implements XMLHandler { + + XMLParser parser; + + String path; + + HashSet idMap; + + XRefChecker xrefChecker; + + static HashSet regURISchemes = fillRegURISchemes(); + + private static HashSet fillRegURISchemes() + { + try + { + HashSet set = new HashSet(); + InputStream schemaStream = OPSHandler.class.getResourceAsStream("registeredSchemas.txt"); + BufferedReader schemaReader = new BufferedReader(new InputStreamReader(schemaStream)); + String schema = schemaReader.readLine(); + while(schema != null) + { + set.add(schema); + schema = schemaReader.readLine(); + } + schemaReader.close(); + schemaStream.close(); + return set; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + OPSHandler(XMLParser parser, String path, XRefChecker xrefChecker) { + this.parser = parser; + this.path = path; + this.xrefChecker = xrefChecker; + this.idMap = new HashSet(); + } + + private void checkPaint(XMLElement e, String attr) { + String paint = e.getAttribute(attr); + if (paint != null && paint.startsWith("url(") && paint.endsWith(")")) { + String href = paint.substring(4, paint.length() - 1); + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_SVG_PAINT); + } + } + + private void checkClip(XMLElement e, String attr) { + + } + + private void checkImage(XMLElement e, String attrNS, String attr) { + String href = e.getAttributeNS(attrNS, attr); + if (href != null) { + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_IMAGE); + } + } + + private void checkObject(XMLElement e, String attrNS, String attr) { + String href = e.getAttributeNS(attrNS, attr); + if (href != null) { + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_OBJECT); + } + } + + private void checkLink(XMLElement e, String attrNS, String attr) { + String href = e.getAttributeNS(attrNS, attr); + String rel = e.getAttributeNS(attrNS, "rel"); + if (href != null && rel != null && rel.indexOf("stylesheet") >= 0) { + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_STYLESHEET); + } + } + + private void checkSymbol(XMLElement e, String attrNS, String attr) { + String href = e.getAttributeNS(attrNS, attr); + if (href != null) { + href = PathUtil.resolveRelativeReference(path, href); + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_SVG_SYMBOL); + } + } + + private void checkHRef(XMLElement e, String attrNS, String attr) { + String href = e.getAttributeNS(attrNS, attr); + if (href != null) { + /* + * This section was replaced by the more broad and customizable + * isRegisteredSchemaType method, that checks to see if the + * href starts with one of the registered schema types read from + * the resource registeredSchemas.txt + * + * if (href.startsWith("http://") || href.startsWith("https://") + || href.startsWith("ftp://") || href.startsWith("mailto:") + || href.startsWith("data:")) + return; + */ + if (isRegisteredSchemaType(href)) + return; + //This if statement is needed to make sure XML Fragment identifiers + //are not reported as non-registered URI schema types + else if(href.indexOf(':') > 0){ + parser.getReport().warning(path, parser.getLineNumber(), + "use of non-registered URI schema type in href: " + href); + return; + } + try { + href = PathUtil.resolveRelativeReference(path, href); + } catch (IllegalArgumentException err) { + parser.getReport().error(path, parser.getLineNumber(), + err.getMessage()); + return; + } + xrefChecker.registerReference(path, parser.getLineNumber(), href, + XRefChecker.RT_HYPERLINK); + } + } + + public static boolean isRegisteredSchemaType(String href) + { + int colonIndex = href.indexOf(':'); + if(colonIndex < 0) + return false; + else if(regURISchemes.contains(href.substring(0, colonIndex + 1))) + return true; + else if(href.length() > colonIndex + 2) + if(href.substring(colonIndex + 1, colonIndex + 3).equals("//") + && regURISchemes.contains(href.substring(0, colonIndex + 3))) + return true; + else + return false; + else + return false; + } + + public void startElement() { + XMLElement e = parser.getCurrentElement(); + String id = e.getAttribute("id"); + String ns = e.getNamespace(); + String name = e.getName(); + int resourceType = XRefChecker.RT_GENERIC; + if (ns != null) { + if (ns.equals("http://www.w3.org/2000/svg")) { + if (name.equals("linearGradient") + || name.equals("radialGradient") + || name.equals("pattern")) + resourceType = XRefChecker.RT_SVG_PAINT; + else if (name.equals("clipPath")) + resourceType = XRefChecker.RT_SVG_CLIP_PATH; + else if (name.equals("symbol")) + resourceType = XRefChecker.RT_SVG_SYMBOL; + else if (name.equals("a")) + checkHRef(e, "http://www.w3.org/1999/xlink", "href"); + else if (name.equals("use")) + checkSymbol(e, "http://www.w3.org/1999/xlink", "href"); + else if (name.equals("image")) + checkImage(e, "http://www.w3.org/1999/xlink", "href"); + checkPaint(e, "fill"); + checkPaint(e, "stroke"); + checkClip(e, "clip"); + } else if (ns.equals("http://www.w3.org/1999/xhtml")) { + if (name.equals("a")) + checkHRef(e, null, "href"); + else if (name.equals("img")) + checkImage(e, null, "src"); + else if (name.equals("object")) + checkObject(e, null, "data"); + else if (name.equals("link")) + checkLink(e, null, "href"); + resourceType = XRefChecker.RT_HYPERLINK; + } + } + if (id != null) + xrefChecker.registerAnchor(path, parser.getLineNumber(), id, + resourceType); + } + + public void endElement() { + } + + public void ignorableWhitespace(char[] chars, int arg1, int arg2) { + } + + public void characters(char[] chars, int arg1, int arg2) { + } + + public void processingInstruction(String arg0, String arg1) { + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/registeredSchemas.txt b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/registeredSchemas.txt new file mode 100644 index 0000000..6c4428f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/ops/registeredSchemas.txt @@ -0,0 +1,74 @@ +aaa:// +aaas:// +acap:// +cap:// +cid: +crid:// +data: +dav: +dict:// +dns:// +fax: +file:// +ftp:// +go:// +gopher:// +h323: +http:// +https:// +icap:// +im: +imap:// +info: +ipp:// +iris: +iris.beep: +iris.xpc: +iris.xpcs: +iris.lwz: +ldap:// +mailto: +mid: +modem: +msrp:// +msrps:// +mtqp:// +mupdate:// +news:// +nfs:// +nntp:// +opaquelocktoken: +pop:// +pres: +rtsp:// +service: +shttp:// +sip: +sips: +snmp:// +soap.beep:// +soap.beeps:// +tag: +tel: +telnet:// +tftp:// +thismessage: +tip:// +tv: +urn: +vemmi:// +xmlrpc.beep:// +xmlrpc.beeps:// +xmpp:// +z39.50r:// +z39.50s:// +afs: +dtn: +iax: +mailserver: +pack:// +tn3270: +prospero:// +snews:// +videotex: +wais:// diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/container.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/container.rng new file mode 100644 index 0000000..901d65a --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/container.rng @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-svg.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-svg.rng new file mode 100644 index 0000000..73cd553 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-svg.rng @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-xhtml.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-xhtml.rng new file mode 100644 index 0000000..5a63a6a --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content-xhtml.rng @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content.rng new file mode 100644 index 0000000..3c20017 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/content.rng @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/dtbook-2005-2.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/dtbook-2005-2.rng new file mode 100644 index 0000000..42fe625 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/dtbook-2005-2.rng @@ -0,0 +1,4110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + xxx + xxp + xlx + xlp + bxx + bxp + blx + blp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2005-2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + required + optional + + + + + + + + + + + + + + + + + + + + + required + optional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + front + normal + special + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ol + ul + pl + + + + + + + + + 1 + a + A + i + I + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + row + col + rowgroup + colgroup + + + + + + void + above + below + hsides + lhs + rhs + vsides + box + border + + + + + + none + groups + rows + cols + all + + + + + + + + left + center + right + justify + char + + + + + + + + + + + + + + + + + + + + top + middle + bottom + baseline + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/encryption.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/encryption.rng new file mode 100644 index 0000000..9cbf3d8 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/encryption.rng @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx-old.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx-old.rng new file mode 100644 index 0000000..dae2370 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx-old.rng @@ -0,0 +1,253 @@ + + + + + + 2005-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx.rng new file mode 100644 index 0000000..2b1d14a --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ncx.rng @@ -0,0 +1,295 @@ + + + + + + + + + 2005-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf.rng new file mode 100644 index 0000000..83b1cac --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf.rng @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf12.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf12.rng new file mode 100644 index 0000000..a63b77d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf12.rng @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf20.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf20.rng new file mode 100644 index 0000000..f3f9142 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/opf20.rng @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops/ops-switch.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops/ops-switch.rng new file mode 100644 index 0000000..5dd7954 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops/ops-switch.rng @@ -0,0 +1,51 @@ + + + + + OPS conditional processing: switch, case and default elements + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.nrl b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.nrl new file mode 100644 index 0000000..64c3f05 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.nrl @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.rng new file mode 100644 index 0000000..619cade --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/ops20.rng @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/signatures.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/signatures.rng new file mode 100644 index 0000000..9bd9a12 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/signatures.rng @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animation.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animation.rng new file mode 100644 index 0000000..788166e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animation.rng @@ -0,0 +1,412 @@ + + + + + SVG 1.1 Animation Module + file: svg-animation.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-animation.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Animation + + animate, set, animateMotion, animateColor, animateTransform, mpath + + This module declares markup to provide support for animation. + + + + SVG.Animation.class + + + + + + + + + + + + + + + + + + + SVG.Animation.attrib + + + + + + + + + + + + + SVG.AnimationAttribute.attrib + + + + + + + + + + + + + + + + SVG.AnimationTiming.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + always + never + whenNotActive + + + + + + + + + + + + + remove + freeze + + + + + + + + SVG.AnimationValue.attrib + + + + + + + + + + + discrete + linear + paced + spline + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.AnimationAddtion.attrib + + + + + + + + + + + replace + sum + + + + + + + none + sum + + + + + + + + animate: Animate Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + set: Set Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateMotion: Animate Motion Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + discrete + linear + paced + spline + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateColor: Animate Color Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + animateTransform: Animate Transform Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + translate + scale + rotate + skewX + skewY + + + + + + + mpath: Motion Path Element + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng new file mode 100644 index 0000000..aeaf682 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-animevents-attrib.rng @@ -0,0 +1,61 @@ + + + + + SVG 1.1 Animation Events Attribute Module + file: svg-animevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-animevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Animation Events Attribute + + onbegin, onend, onrepeat, onload + + This module defines the AnimationEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng new file mode 100644 index 0000000..df313f9 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-clip.rng @@ -0,0 +1,129 @@ + + + + + SVG 1.1 Basic Clip Module + file: svg-basic-clip.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-clip.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Clip + + clipPath + + This module declares markup to provide support for clipping. + + + + Datatypes + + + + + + + + SVG.Clip.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Clip.class + + + + + + + + + + + + + + + clipPath: Clip Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng new file mode 100644 index 0000000..d57e037 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-filter.rng @@ -0,0 +1,870 @@ + + + + + SVG 1.1 Basic Filter Module + file: svg-basic-filter.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-filter.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Filter + + filter, feBlend, feColorMatrix, feComponentTransfer, feComposite, + feFlood, feGaussianBlur, feImage, feMerge, feMergeNode, feOffset, + feTile, feFuncR, feFuncG, feFuncB, feFuncA + + This module declares markup to provide support for filter effect. + + + + Datatypes + + + + + + + + + + + + SVG.Filter.attrib + + + + + + + + + + + + + + + + + SVG.FilterColor.attrib + + + + + + + + + + + auto + sRGB + linearRGB + inherit + + + + + + + + SVG.Filter.class + + + + + + + + + + + + + + + SVG.FilterPrimitive.class + + + + + + + + + + + + + + + + + + + + + + + + SVG.FilterPrimitive.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.FilterPrimitiveWithIn.attrib + + + + + + + + + + + + + + + + filter: Filter Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + feBlend: Filter Effect Blend Element + + + + + + + + + + + + + + + + + + + + + + + + + + + normal + multiply + screen + darken + lighten + + + + + + + feColorMatrix: Filter Effect Color Matrix Element + + + + + + + + + + + + + + + + + + + + + + + + + + matrix + saturate + hueRotate + luminanceToAlpha + + + + + + + + + + feComponentTransfer: Filter Effect Component Transfer Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feComposite: Filter Effect Composite Element + + + + + + + + + + + + + + + + + + + + + + + + + + + over + in + out + atop + xor + arithmetic + + + + + + + + + + + + + + + + + + + + + + + + + + + feFlood: Filter Effect Flood Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feGaussianBlur: Filter Effect Gaussian Blur Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feImage: Filter Effect Image Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feMerge: Filter Effect Merge Element + + + + + + + + + + + + + + + + + + + + + + + feMergeNode: Filter Effect Merge Node Element + + + + + + + + + + + + + + + + + + + + + + + + + + + feOffset: Filter Effect Offset Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feTile: Filter Effect Tile Element + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncR: Filter Effect Function Red Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncG: Filter Effect Function Green Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncB: Filter Effect Function Blue Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feFuncA: Filter Effect Function Alpha Element + + + + + + + + + + + + + + + + + + + + + + + identity + table + discrete + linear + gamma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-font.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-font.rng new file mode 100644 index 0000000..eb68203 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-font.rng @@ -0,0 +1,544 @@ + + + + + SVG 1.1 Basic Font Module + file: svg-basic-font.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-font.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Font + + font, font-face, glyph, missing-glyph, hkern, vkern, font-face-src, + font-face-uri, font-face-name + + This module declares markup to provide support for template. + + + + SVG.Font.class + + + + + + + + + + + + + + + + font: Font Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face: Font Face Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + glyph: Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + missing-glyph: Missing Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hkern: Horizontal Kerning Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vkern: Vertical Kerning Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face-src: Font Face Source Element + + + + + + + + + + + + + + + + + + + + + + + + font-face-uri: Font Face URI Element + + + + + + + + + + + + + + + + + + + + font-face-name: Font Face Name Element + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng new file mode 100644 index 0000000..6ab7361 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-graphics-attrib.rng @@ -0,0 +1,74 @@ + + + + + SVG 1.1 Basic Graphics Attribute Module + file: svg-basic-graphics-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-graphics-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Graphics Attribute + + display, visibility + + This module defines the Graphics attribute set. + + + + + + + inline + block + list-item + run-in + compact + marker + table + inline-table + table-row-group + table-header-group + table-footer-group + table-row + table-column-group + table-column + table-cell + table-caption + none + inherit + + + + + + + + + + visible + hidden + inherit + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng new file mode 100644 index 0000000..2839f7f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-structure.rng @@ -0,0 +1,666 @@ + + + + + SVG 1.1 Basic Structure Module + file: svg-basic-structure.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-structure.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Structure + + svg, g, defs, desc, title, metadata, use + + This module declares the major structural elements and their attributes. + + + + +
+ + Include core set of modules + + + + + Datatypes Module + + + + + + Core Attribute Module + + +
+ + + Content Models (Default) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Attribute Collections (Default) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Description.class + + + + + + + + + + + + + + + + + SVG.Use.class + + + + + + + + + + + + + + + SVG.Structure.class + + + + + + + + + + + + + + + + + + SVG.Presentation.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + svg: SVG Document Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disable + magnify + + + + + + 1.1 + + + + + + + + + + + + + + + + + + + + + g: Group Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + defs: Definisions Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + desc: Description Element + + + + + + + + + + + + + + + + + + + + title: Title Element + + + + + + + + + + + + + + + + + + + + metadata: Metadata Element + + + + + + + + + + + + + + + + + + + use: Use Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-text.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-text.rng new file mode 100644 index 0000000..3a67492 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-basic-text.rng @@ -0,0 +1,273 @@ + + + + + SVG 1.1 Basic Text Module + file: svg-basic-text.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-basic-text.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Basic Text + + text, altGlyph, altGlyphDef, glyphRef + + This module declares markup to provide support for text. + + + + Datatypes + + + + + + + + + + + + SVG.Font.attrib + + + + + + + + + + + + + + + + + + + + + normal + italic + oblique + inherit + + + + + + + normal + bold + bolder + lighter + 100 + 200 + 300 + 400 + 500 + 600 + 700 + 800 + 900 + inherit + + + + + + + + SVG.Text.class + + + + + + + + + + + + + + + SVG.TextContent.class + + + + + + + + + + + + + + + text: Text Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyph: Alternate Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyphDef: Alternate Glyph Definition Element + + + + + + + + + + + + + + + + + + + + + glyphRef: Glyph Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-clip.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-clip.rng new file mode 100644 index 0000000..eacd793 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-clip.rng @@ -0,0 +1,37 @@ + + + + + SVG 1.1 Clip Module + file: svg-clip.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-clip.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Clip + + clipPath + + This module declares markup to provide support for clipping. + + + + + + + extend content model of clipPath + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-conditional.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-conditional.rng new file mode 100644 index 0000000..756f4ed --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-conditional.rng @@ -0,0 +1,124 @@ + + + + + SVG 1.1 Conditional Processing Module + file: svg-conditional.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-conditional.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Conditional Processing + + switch + + This module declares markup to provide support for conditional processing. + + + + Datatypes + + + + + + + + + + + + SVG.Conditional.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Conditional.class + + + + + + + + + + + + + + + switch: Switch Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng new file mode 100644 index 0000000..a2e958c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-container-attrib.rng @@ -0,0 +1,49 @@ + + + + + SVG 1.1 Container Attribute Module + file: svg-container-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-container-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Container Attribute + + enable-background + + This module defines the Container attribute set. + + + + + 'enable-background' property/attribute value (e.g., 'new', 'accumulate') + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng new file mode 100644 index 0000000..c8f0c81 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-core-attrib.rng @@ -0,0 +1,73 @@ + + + + + SVG 1.1 Core Attribute Module + file: svg-core-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-core-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Core Attribute + + id, xml:base, xml:lang, xml:space + + This module defines the core set of attributes that can be present on + any element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + preserve + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-cursor.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-cursor.rng new file mode 100644 index 0000000..d9ce19b --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-cursor.rng @@ -0,0 +1,99 @@ + + + + + SVG 1.1 Cursor Module + file: svg-cursor.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-cursor.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Cursor + + cursor + + This module declares markup to provide support for cursor. + + + + Datatypes + + + + + + + + SVG.Cursor.attrib + + + + + + + + + + + + + + + + + SVG.Cursor.class + + + + + + + + + + + + + + + cursor: Cursor Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-datatypes.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-datatypes.rng new file mode 100644 index 0000000..82aee63 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-datatypes.rng @@ -0,0 +1,188 @@ + + + + + SVG 1.1 Datatypes Module + file: svg-datatypes.mod + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-datatypes.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Datatypes + + This module declares common data types for properties and attributes. + + + + feature specification + + + + + false + true + + + + + + 'clip-rule' or 'fill-rule' property/attribute value + + + nonzero + evenodd + inherit + + + + + + media type, as per [RFC2045] + + + + + + + a <coordinate> + + + + + + + a list of <coordinate>s + + + + + + + a <color> value + + + + + + + a <integer> + + + + + + + a language code, as per [RFC3066] + + + + + + + comma-separated list of language codes, as per [RFC3066] + + + + + + + a <ength> + + + + + + + a list of <length>s + + + + + + + a <number> + + + + + + + a list of <number>s + + + + + + + + opacity value (e.g., <number>) + + + + + + + a path data specification + + + + + + + 'preserveAspectRatio' attribute specification + + + \s*(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)\s+(meet|slice)?\s* + + + + + + script expression + + + + + + + An SVG color value (RGB plus optional ICC) + + + + + + + arbitrary text string + + + + + + + list of transforms + + + + + + + a Uniform Resource Identifier, see [URI] + + + + + + + 'viewBox' attribute specification + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng new file mode 100644 index 0000000..9d63bd4 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-docevents-attrib.rng @@ -0,0 +1,87 @@ + + + + + SVG 1.1 Document Events Attribute Module + file: svg-docevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-docevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Document Events Attribute + + onunload, onabort, onerror, onresize, onscroll, onzoom + + This module defines the DocumentEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extensibility.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extensibility.rng new file mode 100644 index 0000000..097a9e9 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extensibility.rng @@ -0,0 +1,125 @@ + + + + + SVG 1.1 Extensibility Module + file: svg-extensibility.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-extensibility.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + + Extensibility + + foreignObject + + This module declares markup to provide support for extensibility. + + + + SVG.Extensibility.class + + + + + + + + + + + + + + + + + + + foreignObject: Foreign Object Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + any element in foreign namespace + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng new file mode 100644 index 0000000..017b9e1 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-extresources-attrib.rng @@ -0,0 +1,42 @@ + + + + + SVG 1.1 External Resources Attribute Module + file: svg-extresources-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-extresources-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + External Resources Attribute + + externalResourcesRequired + + This module defines the External attribute set. + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-filter.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-filter.rng new file mode 100644 index 0000000..a7250bc --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-filter.rng @@ -0,0 +1,512 @@ + + + + + SVG 1.1 Filter Module + file: svg-filter.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-filter.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Filter + + filter, feBlend, feColorMatrix, feComponentTransfer, feComposite, + feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feFlood, + feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset, + feSpecularLighting, feTile, feTurbulence, feDistantLight, fePointLight, + feSpotLight, feFuncR, feFuncG, feFuncB, feFuncA + + This module declares markup to provide support for filter effect. + + + + + + + extend SVG.FilterPrimitive.class + + + + + + + + + + + + + feConvolveMatrix: Filter Effect Convolve Matrix Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + duplicate + wrap + none + + + + + + + + + + + + + + + + + feDiffuseLighting: Filter Effect Diffuse Lighting Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feDisplacementMap: Filter Effect Displacement Map Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + R + G + B + A + + + + + + + R + G + B + A + + + + + + + feMorphology: Filter Effect Morphology Element + + + + + + + + + + + + + + + + + + + + + + + + + + erode + dilate + + + + + + + + + + + + feSpecularLighting: Filter Effect Specular Lighting Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feTurbulence: Filter Effect Turbulence Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stitch + noStitch + + + + + + + fractalNoise + turbulence + + + + + + + feDistantLight: Filter Effect Distant Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fePointLight: Filter Effect Point Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + feSpotLight: Filter Effect Spot Light Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-font.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-font.rng new file mode 100644 index 0000000..e545cfb --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-font.rng @@ -0,0 +1,146 @@ + + + + + SVG 1.1 Font Module + file: svg-font.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-font.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Font + + font, font-face, glyph, missing-glyph, hkern, vkern, font-face-src, + font-face-uri, font-face-format, font-face-name, definition-src + + This module declares markup to provide support for template. + + + + + + font-face: Font Face Element + + + + + + + + + + glyph: Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + missing-glyph: Missing Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + font-face-uri: Font Face URI Element + + + + + + + + + + font-face-format: Font Face Format Element + + + + + + + + + + + + + + + + + + + + + + definition-src: Definition Source Element + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-gradient.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-gradient.rng new file mode 100644 index 0000000..425eff1 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-gradient.rng @@ -0,0 +1,259 @@ + + + + + SVG 1.1 Gradient Module + file: svg-gradient.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-gradient.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Gradient + + linearGradient, radialGradient, stop + + This module declares markup to provide support for gradient fill. + + + + Datatypes + + + + + + + + SVG.Gradient.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Gradient.class + + + + + + + + + + + + + + + + linearGradient: Linear Gradient Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + pad + reflect + repeat + + + + + + + radialGradient: Radial Gradient Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + pad + reflect + repeat + + + + + + + stop: Stop Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng new file mode 100644 index 0000000..edc7741 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphevents-attrib.rng @@ -0,0 +1,124 @@ + + + + + SVG 1.1 Graphical Element Events Attribute Module + file: svg-graphevents-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-graphevents-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Graphical Element Events Attribute + + onfocusin, onfocusout, onactivate, onclick, onmousedown, onmouseup, + onmouseover, onmousemove, onmouseout, onload + + This module defines the GraphicalEvents attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng new file mode 100644 index 0000000..15029e5 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-graphics-attrib.rng @@ -0,0 +1,95 @@ + + + + + SVG 1.1 Graphics Attribute Module + file: svg-graphics-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-graphics-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Graphics Attribute + + display, image-rendering, pointer-events, shape-rendering, + text-rendering, visibility + + This module defines the Graphics attribute set. + + + + + + + + + auto + optimizeSpeed + optimizeQuality + inherit + + + + + + + + + + visiblePainted + visibleFill + visibleStroke + visible + painted + fill + stroke + all + none + inherit + + + + + + + + + + auto + optimizeSpeed + crispEdges + geometricPrecision + inherit + + + + + + + + + + auto + optimizeSpeed + optimizeLegibility + geometricPrecision + inherit + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng new file mode 100644 index 0000000..d13ba49 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-hyperlink.rng @@ -0,0 +1,106 @@ + + + + + SVG 1.1 Hyperlinking Module + file: svg-hyperlink.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-hyperlink.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Hyperlinking + + a + + This module declares markup to provide support for hyper linking. + + + + + link to this target + + + + + + SVG.Hyperlink.class + + + + + + + + + + + + + + + a: Anchor Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-image.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-image.rng new file mode 100644 index 0000000..78bca9e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-image.rng @@ -0,0 +1,104 @@ + + + + + SVG 1.1 Image Module + file: svg-image.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-image.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Image + + image + + This module declares markup to provide support for image. + + + + SVG.Image.class + + + + + + + + + + + + + + + image: Image Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-marker.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-marker.rng new file mode 100644 index 0000000..311d59f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-marker.rng @@ -0,0 +1,161 @@ + + + + + SVG 1.1 Marker Module + file: svg-marker.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-marker.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Marker + + marker + + This module declares markup to provide support for marker. + + + + Datatypes + + + + + + + + SVG.Marker.attrib + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Marker.class + + + + + + + + + + + + + + + marker: Marker Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + strokeWidth + userSpaceOnUse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-mask.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-mask.rng new file mode 100644 index 0000000..929fc07 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-mask.rng @@ -0,0 +1,148 @@ + + + + + SVG 1.1 Mask Module + file: svg-mask.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-mask.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Mask + + mask + + This module declares markup to provide support for masking. + + + + + Datatypes + + + + + + + + SVG.Mask.attrib + + + + + + + + + + + + + + + + + SVG.Mask.class + + + + + + + + + + + + + + + mask: Mask Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng new file mode 100644 index 0000000..9ba06c5 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-opacity-attrib.rng @@ -0,0 +1,60 @@ + + + + + SVG 1.1 Paint Opacity Attribute Module + file: svg-opacity-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-opacity-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Paint Opacity Attribute + + opacity, fill-opacity, stroke-opacity + + This module defines the Opacity attribute set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng new file mode 100644 index 0000000..9aea366 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-paint-attrib.rng @@ -0,0 +1,207 @@ + + + + + SVG 1.1 Paint Attribute Module + file: svg-paint-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-paint-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Paint Attribute + + fill, fill-rule, stroke, stroke-dasharray, stroke-dashoffset, + stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-width, color, + color-interpolation, color-rendering + + This module defines the Paint and Color attribute sets. + + + + + a 'fill' or 'stroke' property/attribute value: <paint> + + + + + + + 'stroke-dasharray' property/attribute value + (e.g., 'none', list of <number>s) + + + + + + + 'stroke-dashoffset' property/attribute value (e.g., 'none', <legnth>) + + + + + + + 'stroke-miterlimit' property/attribute value (e.g., <number>) + + + + + + + 'stroke-width' property/attribute value (e.g., <length>) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + butt + round + square + inherit + + + + + + + + + + miter + round + bevel + inherit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auto + sRGB + linearRGB + inherit + + + + + + + + + + auto + optimizeSpeed + optimizeQuality + inherit + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-pattern.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-pattern.rng new file mode 100644 index 0000000..899cc99 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-pattern.rng @@ -0,0 +1,138 @@ + + + + + SVG 1.1 Pattern Module + file: svg-pattern.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-pattern.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Pattern + + pattern + + This module declares markup to provide support for pattern fill. + + + + SVG.Pattern.class + + + + + + + + + + + + + + + pattern: Pattern Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + userSpaceOnUse + objectBoundingBox + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-profile.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-profile.rng new file mode 100644 index 0000000..4bf6072 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-profile.rng @@ -0,0 +1,92 @@ + + + + + SVG 1.1 Color Profile Module + file: svg-profile.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-profile.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Color Profile + + color-profile + + This module declares markup to provide support for color profile. + + + + SVG.Profile.attrib + + + + + + + + + + + + + + + SVG.Profile.class + + + + + + + + + + + + + + + color-profile: Color Profile Element + + + + + + + + + + + + + + + + + + + + + + + + + + auto + perceptual + relative-colorimetric + saturation + absolute-colorimetric + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-qname.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-qname.rng new file mode 100644 index 0000000..2a13e0d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-qname.rng @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-script.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-script.rng new file mode 100644 index 0000000..1ddaf8a --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-script.rng @@ -0,0 +1,64 @@ + + + + + SVG 1.1 Scripting Module + file: svg-script.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-script.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Scripting + + script + + This module declares markup to provide support for scripting. + + + + SVG.Script.class + + + + + + + + + + + + + + + script: Script Element + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-shape.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-shape.rng new file mode 100644 index 0000000..5f788bf --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-shape.rng @@ -0,0 +1,433 @@ + + + + + SVG 1.1 Shape Module + file: svg-shape.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-shape.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Shape + + path, rect, circle, line, ellipse, polyline, polygon + + This module declares markup to provide support for graphical shapes. + + + + + a list of points + + + + + + SVG.Shape.class + + + + + + + + + + + + + + + + + + + + + path: Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rect: Rectangle Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + circle: Circle Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + line: Line Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ellipse: Ellipse Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + polyline: Polyline Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + polygon: Polygon Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-structure.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-structure.rng new file mode 100644 index 0000000..97ac566 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-structure.rng @@ -0,0 +1,92 @@ + + + + + SVG 1.1 Structure Module + file: svg-structure.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-structure.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Structure + + svg, g, defs, desc, title, metadata, symbol, use + + This module declares the major structural elements and their attributes. + + + + + + + extend SVG.Structure.class + + + + + + + + symbol: Symbol Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-style.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-style.rng new file mode 100644 index 0000000..ed2aa2c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-style.rng @@ -0,0 +1,121 @@ + + + + + SVG 1.1 Style Module + file: svg-style.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-style.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Style + + style + + This module declares markup to provide support for stylesheet. + + + + Datatypes + + + + + + + + + + + + + comma-separated list of media descriptors. + + + + + + SVG.Style.attrib + + + + + + + + + + + + + + + + + + + + + + SVG.Style.class + + + + + + + + + + + + + + + style: Style Element + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-text.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-text.rng new file mode 100644 index 0000000..6aece2b --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-text.rng @@ -0,0 +1,627 @@ + + + + + SVG 1.1 Text Module + file: svg-text.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-text.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Text + + text, tspan, tref, textPath, altGlyph, altGlyphDef, altGlyphItem, + glyphRef + + This module declares markup to provide support for alternate glyph. + + + + + + Datatypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SVG.Text.attrib + + + + + + + + + + + lr-tb + rl-tb + tb-rl + lr + rl + tb + inherit + + + + + + + + SVG.TextContent.attrib + + + + + + + + + + + auto + baseline + before-edge + text-before-edge + middle + central + after-edge + text-after-edge + ideographic + alphabetic + hanging + mathematical + inherit + + + + + + + + + + + + ltr + rtl + inherit + + + + + + + auto + use-script + no-change + reset-size + ideographic + alphabetic + hanging + mathematical + central + middle + text-after-edge + text-before-edge + inherit + + + + + + + + + + + + + + + + + + + + + + + + + + + start + middle + end + inherit + + + + + + + + + + + + normal + embed + bidi-override + inherit + + + + + + + + + + + + + + + + + + + + + normal + wider + narrower + ultra-condensed + extra-condensed + condensed + semi-condensed + semi-expanded + expanded + extra-expanded + ultra-expanded + inherit + + + + + + + normal + small-caps + inherit + + + + + + + + extend SVG.Text.class + + + + + + + + + extend SVG.TextContent.class + + + + + + + + + + text: Text Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + tspan: Text Span Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + tref: Text Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + textPath: Text Path Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spacing + spacingAndGlyphs + + + + + + + align + stretch + + + + + + + auto + exact + + + + + + + altGlyph: Alternate Glyph Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + altGlyphDef: Alternate Glyph Definition Element + + + + + + + + + + + + altGlyphItem: Alternate Glyph Item Element + + + + + + + + + + + + + + + + + + + + + glyphRef: Glyph Reference Element + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-view.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-view.rng new file mode 100644 index 0000000..15e790e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-view.rng @@ -0,0 +1,83 @@ + + + + + SVG 1.1 View Module + file: svg-view.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-view.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + View + + view + + This module declares markup to provide support for view. + + + + SVG.View.class + + + + + + + + + + + + + + + view: View Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disable + magnify + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng new file mode 100644 index 0000000..60f0ed0 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-viewport-attrib.rng @@ -0,0 +1,64 @@ + + + + + SVG 1.1 Viewport Attribute Module + file: svg-viewport-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-viewport-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + Viewport Attribute + + clip, overflow + + This module defines the Viewport attribute set. + + + + + 'clip' property/attribute value (e.g., 'auto', rect(...)) + + + + + + + + + + + + + + + + + visible + hidden + scroll + auto + inherit + + + + + + + + + + + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng new file mode 100644 index 0000000..e28200b --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg/svg-xlink-attrib.rng @@ -0,0 +1,194 @@ + + + + + SVG 1.1 XLink Attribute Module + file: svg-xlink-attrib.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved. + + $Id: svg-xlink-attrib.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + + + XLink Attribute + + type, href, role, arcrole, title, show, actuate + + This module defines the XLink, XLinkRequired, XLinkEmbed, and + XLinkReplace attribute set. + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + + + other + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + other + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + embed + + + + + + onLoad + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + new + replace + + + + + + onRequest + + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg11.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg11.rng new file mode 100644 index 0000000..d3ed76c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/svg11.rng @@ -0,0 +1,231 @@ + + + + + RELAX NG schema for SVG 1.1 + file: svg11.rng + + This is SVG, a language for describing two-dimensional graphics in XML. + + The Scalable Vector Graphics (SVG) + Copyright 2001, 2002 World Wide Web Consortium + (Massachusetts Institute of Technology, Institut National de + Recherche en Informatique et en Automatique, Keio University). + All Rights Reserved. + + Permission to use, copy, modify and distribute this RELAX NG schema + for SVG and its accompanying documentation for any purpose and without + fee is hereby granted in perpetuity, provided that the above copyright + notice and this paragraph appear in all copies. The copyright holders + nor the author make no representation about the suitability of this + RELAX NG schema for any purpose. + + It is provided "as is" without expressed or implied warranty. + + Author: Masayasu Ishikawa (mimasa@w3.org) + $Id: svg11.rng,v 1.1 2003/07/15 07:11:10 dean Exp $ + + This is the driver file for version 1.1 of the SVG RELAX NG schema. + + The DTD version is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD SVG 1.1//EN" + SYSTEM "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" + + Use this URI to identify the default namespace: + + "http://www.w3.org/2000/svg" + + + + + Container Attribute Module + + + + + + Viewport Attribute Module + + + + + + Paint Attribute Module + + + + + + Paint Opacity Attribute Module + + + + + + Graphics Attribute Module + + + + + + Document Events Attribute Module + + + + + + Graphical Element Events Attribute Module + + + + + + Animation Events Attribute Module + + + + + + XLink Attribute Module + + + + + + External Resources Attribute Module + + + + + + Structure Module (required) + + + + + + Conditional Processing Module + + + + + + Image Module + + + + + + Style Module + + + + + + Shape Module + + + + + + Text Module + + + + + + Marker Module + + + + + + Color Profile Module + + + + + + Gradient Module + + + + + + Pattern Module + + + + + + Clip Module + + + + + + Mask Module + + + + + + Filter Module + + + + + + Cursor Module + + + + + + Hyperlinking Module + + + + + + View Module + + + + + + Scripting Module + + + + + + Animation Module + + + + + + Font Module + + + + + + Extensibility Module + + + + + + The root element is "svg". + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xenc-schema.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xenc-schema.rng new file mode 100644 index 0000000..972a879 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xenc-schema.rng @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/applet.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/applet.rng new file mode 100644 index 0000000..dbdef46 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/applet.rng @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/attribs.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/attribs.rng new file mode 100644 index 0000000..2616a5c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/attribs.rng @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/base.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/base.rng new file mode 100644 index 0000000..e0f30bf --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/base.rng @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-form.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-form.rng new file mode 100644 index 0000000..d0c4075 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-form.rng @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + get + post + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + checked + + + + + + + + + + + + + + + + + + + + + + + + + text + password + checkbox + radio + submit + reset + hidden + + + + + + + + + + + + + + + + + + + + + + + + + multiple + + + + + + + + + + selected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-table.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-table.rng new file mode 100644 index 0000000..5855b4d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/basic-table.rng @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + center + right + + + + + + + + + + top + middle + bottom + + + + + + + + + + row + col + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/bdo.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/bdo.rng new file mode 100644 index 0000000..7e5c7c6 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/bdo.rng @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + ltr + rtl + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/csismap.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/csismap.rng new file mode 100644 index 0000000..02004b8 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/csismap.rng @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + nohref + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rect + circle + poly + default + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/datatypes.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/datatypes.rng new file mode 100644 index 0000000..eac3e34 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/datatypes.rng @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/edit.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/edit.rng new file mode 100644 index 0000000..c9c0f13 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/edit.rng @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/events.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/events.rng new file mode 100644 index 0000000..a408c1e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/events.rng @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/form.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/form.rng new file mode 100644 index 0000000..80dd016 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/form.rng @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + disabled + + + + + readonly + + + + + + + + + + + + + + + + + + + + image + button + + + + + + + disabled + + + + + + + + + + + + + disabled + + + + + + + + + + + + + + + + + + + + + + + disabled + + + + + + + + + + + disabled + + + + + readonly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + button + submit + reset + + + + + + disabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/frames.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/frames.rng new file mode 100644 index 0000000..c3887d9 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/frames.rng @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + + + + + noresize + + + + + + yes + no + auto + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/hypertext.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/hypertext.rng new file mode 100644 index 0000000..e880ebb --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/hypertext.rng @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/iframe.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/iframe.rng new file mode 100644 index 0000000..07a9187 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/iframe.rng @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + auto + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/image.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/image.rng new file mode 100644 index 0000000..6bc5d6c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/image.rng @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/inlstyle.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/inlstyle.rng new file mode 100644 index 0000000..e7342fb --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/inlstyle.rng @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/legacy.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/legacy.rng new file mode 100644 index 0000000..19e1983 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/legacy.rng @@ -0,0 +1,502 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + all + right + none + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + left + center + right + + + + + + noshade + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + + + top + bottom + left + right + + + + + + + + + + + + + + + + + + + top + middle + bottom + left + right + + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nowrap + + + + + + + + + + + + + + + + + + + + + + + + + + compact + + + + + + + + + left + all + right + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/link.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/link.rng new file mode 100644 index 0000000..8361603 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/link.rng @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/list.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/list.rng new file mode 100644 index 0000000..cc5c42e --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/list.rng @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/meta.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/meta.rng new file mode 100644 index 0000000..cf58c86 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/meta.rng @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/nameident.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/nameident.rng new file mode 100644 index 0000000..59b260c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/nameident.rng @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/object.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/object.rng new file mode 100644 index 0000000..70f4df0 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/object.rng @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + declare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/param.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/param.rng new file mode 100644 index 0000000..88e887f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/param.rng @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + data + ref + object + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/pres.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/pres.rng new file mode 100644 index 0000000..3a0cf84 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/pres.rng @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ruby.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ruby.rng new file mode 100644 index 0000000..ace6e9c --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ruby.rng @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/script.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/script.rng new file mode 100644 index 0000000..7d2017b --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/script.rng @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + defer + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ssismap.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ssismap.rng new file mode 100644 index 0000000..460c54f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/ssismap.rng @@ -0,0 +1,14 @@ + + + + + + + + + ismap + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/struct.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/struct.rng new file mode 100644 index 0000000..a68fe9b --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/struct.rng @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/style.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/style.rng new file mode 100644 index 0000000..610b8f4 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/style.rng @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/table.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/table.rng new file mode 100644 index 0000000..4373b64 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/table.rng @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + center + right + justify + char + + + + + + + + + + + + + + + + + + + + top + middle + bottom + baseline + + + + + + + + + + row + col + rowgroup + colgroup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + void + above + below + hsides + lhs + rhs + vsides + box + border + + + + + + + + + + none + groups + rows + cols + all + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/target.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/target.rng new file mode 100644 index 0000000..a5fc723 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/target.rng @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/text.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/text.rng new file mode 100644 index 0000000..fb14fa8 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xhtml/text.rng @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + preserve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xmldsig-core-schema.rng b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xmldsig-core-schema.rng new file mode 100644 index 0000000..99db430 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/rng/xmldsig-core-schema.rng @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/ncx.sch b/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/ncx.sch new file mode 100644 index 0000000..64b29e9 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/ncx.sch @@ -0,0 +1,81 @@ + + + + + + + + + + pageTarget combination of value and type is not unique + + + + + + + + + first playOrder value is not 1 + + + + + + + + + Multiple navLabels with same xml:lang attribute within an NCX node + + + + + + + + + Multiple navInfos with same xml:lang attribute within an NCX node + + + + + + + + + playOrder sequence has gaps + + + + + + + + + identical playOrder values for navPoint/navTarget/pageTarget that do not refer to same target + + + + + + + + + different playOrder values for navPoint/navTarget/pageTarget that refer to same target + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/opf.sch b/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/opf.sch new file mode 100644 index 0000000..0550d12 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/sch/opf.sch @@ -0,0 +1,15 @@ + + + + + + + + + + The "id" attribute does not have a unique value! + + + + + diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/tool/Checker.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/tool/Checker.java new file mode 100644 index 0000000..098baa6 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/tool/Checker.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + */ + +package com.adobe.epubcheck.tool; + +import java.io.File; + +import com.adobe.epubcheck.api.EpubCheck; +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.util.DefaultReportImpl; + +public class Checker { + + public static void main(String[] args) { + /*if (args.length != 1) { + System.err.println("single argument expected"); + return; + }*/ + //String epubName = args[0]; + String epubName = processArguments(args); + + Report report = new DefaultReportImpl(epubName); + + if (!epubName.endsWith(".epub")) + report.warning(null, 0, "filename does not include '.epub' suffix"); + + EpubCheck check = new EpubCheck(new File(epubName), report); + if( check.validate() ) + System.out.println("No errors or warnings detected"); + else { + System.err.println("\nCheck finished with warnings or errors!\n"); + System.exit(1); // Exit with status code 1 if there were errors reported + } + } + + /** + * This method iterates through all of the arguments passed to + * main to find accepted flags and the name of the file to check. + * This method returns the last argument that ends with ".epub" + * (which is assumed to be the file to check) + * Here are the currently accepted flags: + *
+ *
-? or -help = display usage instructions + *
-v or -version = display tool version number + * + * @param args String[] containing arguments passed to main + * @return the name of the file to check + */ + public static String processArguments(String[] args) { + // Exit if there are no arguments passed to main + displayVersion(); + if(args.length < 1) { + System.err.println("At least one argument expected"); + System.exit(1); + } + + String epubName = new String(""); + + // For each element of args[], check to see if it is an accepted flag + // or if it ends in ".epub" (and is therefore the file to check) + for(int i = 0; i < args.length; i++) { + if(args[i].equals("-version") || args[i].equals("-v")) + displayVersion(); + if(args[i].equals("-help") || args[i].equals("-?")) + displayHelp(); // display help message + if(args[i].length() > 5) + if(args[i].substring(args[i].length() - 5).equals(".epub")) + epubName = args[i]; + } + + // If an argument ended in ".epub", return it + if(!epubName.equals("")) + return epubName; + // Else no epub file to check was specified, so exit + else { + System.err.println("No .epub file to check was specified in arguments!"); + System.err.println("The tool will EXIT!"); + System.exit(1); + } + return null; + } + + /** + * This method displays a short help message that describes the + * command-line usage of this tool + */ + public static void displayHelp() { + displayVersion(); + System.out.println("When running this tool, the first argument " + + "should be the name (and path) of the file to check."); + System.out.println("This tool also accepts the following flags:"); + System.out.println("-? or -help = displays this help message"); + System.out.println("-v or -version = displays the tool's version number\n"); + } + + public static void displayVersion() { + System.out.println("Epubcheck Version " + EpubCheck.VERSION+"\n"); + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/util/CheckUtil.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/CheckUtil.java new file mode 100644 index 0000000..f67c431 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/CheckUtil.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.util; + +import java.io.UnsupportedEncodingException; + +public class CheckUtil { + + public static boolean checkString( byte[] arr, int offset, String string ) { + try { + byte[] bytes = string.getBytes("UTF-8"); + if( bytes.length + offset > arr.length ){ + return false; + } + for( int i = 0 ; i < bytes.length ; i++ ){ + if( arr[offset+i] != bytes[i] ){ + return false; + } + } + return true; + } catch( UnsupportedEncodingException e ) { + e.printStackTrace(); // internal problem: UTF-8 not supported??! + return false; + } + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/util/DefaultReportImpl.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/DefaultReportImpl.java new file mode 100644 index 0000000..b34b5ad --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/DefaultReportImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.adobe.epubcheck.util; + +import com.adobe.epubcheck.api.Report; + +public class DefaultReportImpl implements Report { + + private String ePubName; + + public DefaultReportImpl( String ePubName ) { + this.ePubName = ePubName; + } + + public void error( String resource, int line, String message ) { + System.err.println("ERROR: "+ ePubName + (resource == null ? "" : "/" + resource) + + (line <= 0 ? "" : "(" + line + ")") + ": " + message ); + } + + public void warning( String resource, int line, String message ) { + System.err.println("WARNING: " + ePubName + (resource == null ? "" : "/" + resource) + + (line <= 0 ? "" : "(" + line + ")") + ": " + message ); + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/util/PathUtil.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/PathUtil.java new file mode 100644 index 0000000..48caaca --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/PathUtil.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.util; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.Stack; +import java.util.StringTokenizer; + +public class PathUtil { + + public static String resolveRelativeReference(String base, String ref) + throws IllegalArgumentException { + if( ref.startsWith("data:") ) + return ref; + try { + ref = URLDecoder.decode(ref, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new InternalError(e.toString()); // UTF-8 is guaranteed to be + // supported + } + if (ref.startsWith("#")) { + int index = base.indexOf("#"); + if (index < 0) + ref = base + ref; + else + ref = base.substring(0, index) + ref; + } else { + int index = base.lastIndexOf("/"); + ref = base.substring(0, index + 1) + ref; + } + return normalizePath(ref); + } + + public static String normalizePath(String path) + throws IllegalArgumentException { + if (path.indexOf("..") < 0) + return path; + Stack pathSegments = new Stack(); + StringTokenizer tokenizer = new StringTokenizer(path, "/"); + while (tokenizer.hasMoreTokens()) { + String pathSegment = tokenizer.nextToken(); + if (pathSegment.equals(".")) + continue; + if (pathSegment.equals("..")) { + if (pathSegments.size() == 0) + throw new IllegalArgumentException("Invalid path: " + path); + pathSegments.pop(); + } else + pathSegments.push(pathSegment); + } + StringBuffer sb = new StringBuffer(); + String sep = ""; + int len = pathSegments.size(); + for (int i = 0; i < len; i++) { + sb.append(sep); + sb.append(pathSegments.elementAt(i)); + sep = "/"; + } + return sb.toString(); + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/util/ResourceUtil.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/ResourceUtil.java new file mode 100644 index 0000000..d46114f --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/ResourceUtil.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.util; + +import java.io.InputStream; + +public class ResourceUtil { + + public static String getResourcePath(String localName) { + String classPath = ResourceUtil.class.getName().replace('.','/'); + String classPackage = classPath.substring(0,classPath.lastIndexOf("/")); + String projectPackage = classPackage.substring(0,classPackage.lastIndexOf("/")); + return projectPackage + "/" + localName; + } + + public static InputStream getResourceStream(String resourcePath) { + ClassLoader loader = ResourceUtil.class.getClassLoader(); + if( loader == null ) + return ClassLoader.getSystemResourceAsStream(resourcePath); + else + return loader.getResourceAsStream(resourcePath); + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/util/WriterReportImpl.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/WriterReportImpl.java new file mode 100644 index 0000000..4017252 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/util/WriterReportImpl.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +package com.adobe.epubcheck.util; + +import java.io.PrintWriter; + +import com.adobe.epubcheck.api.Report; + +public class WriterReportImpl implements Report { + + private PrintWriter out; + + public WriterReportImpl( PrintWriter out ) { + this.out = out; + } + + public void error(String resource, int line, String message) { + out.println("ERROR: " + (resource == null ? "[top level]" : resource) + + (line <= 0 ? "" : "(" + line + ")") + ": " + message ); + } + public void warning(String resource, int line, String message) { + out.println("WARNING: " + (resource == null ? "[top level]" : resource) + + (line <= 0 ? "" : "(" + line + ")") + ": " + message ); + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLAttribute.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLAttribute.java new file mode 100644 index 0000000..be4fc4d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLAttribute.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +public class XMLAttribute extends XMLNode { + + private String value; + + XMLAttribute( String namespace, String prefix, String name, String value ) { + super( namespace, prefix, name ); + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLElement.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLElement.java new file mode 100644 index 0000000..135da91 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLElement.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +public class XMLElement extends XMLNode { + + private XMLAttribute[] attributes; + + private XMLElement parent; + + private Object privateData; + + XMLElement(String namespace, String prefix, String name, + XMLAttribute[] attributes, XMLElement parent) { + super(namespace, prefix, name); + this.attributes = attributes; + this.parent = parent; + } + + public int getAttributeCount() { + if (attributes == null) + return 0; + return attributes.length; + } + + public XMLAttribute getAttribute(int i) { + return attributes[i]; + } + + public XMLElement getParent() { + return parent; + } + + public String getAttributeNS(String ns, String name) { + if (attributes == null) + return null; + for (int i = 0; i < attributes.length; i++) { + XMLAttribute attr = attributes[i]; + String ans = attr.getNamespace(); + if (attr.getName().equals(name) + && (ans == null ? ns == null : ns != null && ans.equals(ns))) + return attr.getValue(); + } + return null; + } + + public String getAttribute(String attr) { + return getAttributeNS(null, attr); + } + + public Object getPrivateData() { + return privateData; + } + + public void setPrivateData(Object privateData) { + this.privateData = privateData; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLHandler.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLHandler.java new file mode 100644 index 0000000..f362a21 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLHandler.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +public interface XMLHandler { + + public void characters(char[] chars, int arg1, int arg2); + public void ignorableWhitespace(char[] chars, int arg1, int arg2); + public void startElement(); + public void endElement(); + public void processingInstruction(String arg0, String arg1); + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLNode.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLNode.java new file mode 100644 index 0000000..b0cd893 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLNode.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +public class XMLNode { + + private String namespace; + private String name; + private String prefix; + + XMLNode( String namespace, String prefix, String name ) { + this.namespace = namespace; + this.prefix = prefix; + this.name = name; + } + + public String getName() { + return name; + } + + public String getNamespace() { + return namespace; + } + + public String getPrefix() { + return prefix; + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLParser.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLParser.java new file mode 100644 index 0000000..9887363 --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLParser.java @@ -0,0 +1,578 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Vector; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.ext.DeclHandler; +import org.xml.sax.ext.LexicalHandler; +import org.xml.sax.helpers.DefaultHandler; + +import com.adobe.epubcheck.api.Report; +import com.adobe.epubcheck.ocf.OCFPackage; +import com.adobe.epubcheck.util.ResourceUtil; +import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.Validator; + +public class XMLParser extends DefaultHandler implements LexicalHandler, + DeclHandler { + + OCFPackage ocf; + + SAXParser parser; + + Report report; + + String resource; + + Vector contentHandlers = new Vector(); + + XMLElement currentElement; + + // ContentHandler validatorContentHandler; + Vector validatorContentHandlers = new Vector(); + + // DTDHandler validatorDTDHandler; + Vector validatorDTDHandlers = new Vector(); + + Locator documentLocator; + + static String zipRoot = "file:///epub-root/"; + + static Hashtable systemIdMap; + + HashSet entities = new HashSet(); + + static { + Hashtable map = new Hashtable(); + + // fully-resolved names + map.put("http://www.idpf.org/dtds/2007/opf.dtd", ResourceUtil + .getResourcePath("dtd/opf20.dtd")); + map.put("http://openebook.org/dtds/oeb-1.2/oeb12.ent", ResourceUtil + .getResourcePath("dtd/oeb12.dtdinc")); + map.put("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", + ResourceUtil.getResourcePath("dtd/xhtml1-transitional.dtd")); + map.put("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", + ResourceUtil.getResourcePath("dtd/xhtml1-strict.dtd")); + map.put("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", ResourceUtil + .getResourcePath("dtd/xhtml-lat1.dtdinc")); + map.put("http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent", + ResourceUtil.getResourcePath("dtd/xhtml-symbol.dtdinc")); + map.put("http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent", + ResourceUtil.getResourcePath("dtd/xhtml-special.dtdinc")); + map.put("http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", + ResourceUtil.getResourcePath("dtd/svg11.dtd")); + map.put("http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd", ResourceUtil + .getResourcePath("dtd/opf20.dtd")); + map.put("http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd", + ResourceUtil.getResourcePath("dtd/dtbook-2005-2.dtd")); + map.put("http://www.daisy.org/z3986/2005/ncx-2005-1.dtd", ResourceUtil + .getResourcePath("dtd/ncx-2005-1.dtd")); + + // non-resolved names; Saxon (which schematron requires and registers as + // preferred parser, it seems) + // passes us those (bad, bad!), work around it + map.put("xhtml-lat1.ent", ResourceUtil + .getResourcePath("dtd/xhtml-lat1.dtdinc")); + map.put("xhtml-symbol.ent", ResourceUtil + .getResourcePath("dtd/xhtml-symbol.dtdinc")); + map.put("xhtml-special.ent", ResourceUtil + .getResourcePath("dtd/xhtml-special.dtdinc")); + + systemIdMap = map; + } + + public XMLParser(OCFPackage ocf, String entryName, Report report) { + this.report = report; + this.resource = entryName; + this.ocf = ocf; + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + boolean hasXML11 = false; + + // XML predefined + entities.add("gt"); + entities.add("lt"); + entities.add("amp"); + entities.add("quot"); + + try { + hasXML11 = factory + .getFeature("http://xml.org/sax/features/xml-1.1"); + } catch (Exception e) { + } + if (!hasXML11) { + System.err + .println("Your configuration does not support XML 1.1 parsing"); + System.err + .println("\tAre you using off-the-shelf saxon.jar? It contains file named"); + System.err + .println("\tMETA-INF/services/javax.xml.parsers.SAXParserFactory"); + System.err + .println("\tThis interferes with Java default XML-1.1-compliant parser."); + System.err + .println("\tEither remove that file from saxon.jar or define"); + System.err + .println("\tjavax.xml.parsers.SAXParserFactory system property"); + System.err.println("\tto point to XML-1.1-compliant parser."); + } + try { + parser = factory.newSAXParser(); + XMLReader reader = parser.getXMLReader(); + reader.setDTDHandler(this); + reader.setContentHandler(this); + reader.setEntityResolver(this); + reader.setErrorHandler(this); + try { + reader.setProperty( + "http://xml.org/sax/properties/lexical-handler", this); + reader.setProperty( + "http://xml.org/sax/properties/declaration-handler", + this); + } catch (SAXNotRecognizedException e) { + e.printStackTrace(); + } catch (SAXNotSupportedException e) { + e.printStackTrace(); + } + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } + } + + public void addXMLHandler(XMLHandler handler) { + contentHandlers.add(handler); + } + + public void addValidator(XMLValidator xv) { + PropertyMapBuilder propertyMapBuilder = new PropertyMapBuilder(); + propertyMapBuilder.put(ValidateProperty.ERROR_HANDLER, + (ErrorHandler) this); + Validator validator = xv.schema.createValidator(propertyMapBuilder + .toPropertyMap()); + ContentHandler contentHandler = validator.getContentHandler(); + if (contentHandler != null) + validatorContentHandlers.add(contentHandler); + DTDHandler dtdHandler = validator.getDTDHandler(); + if (dtdHandler != null) + validatorDTDHandlers.add(dtdHandler); + } + + static final byte[][] utf16magic = { { (byte) 0xFE, (byte) 0xFF }, + { (byte) 0xFF, (byte) 0xFE }, { 0, 0x3C, 0, 0x3F }, + { 0x3C, 0, 0x3F, 0 } }; + + static final byte[][] ucs4magic = { { 0, 0, (byte) 0xFE, (byte) 0xFF }, + { (byte) 0xFF, (byte) 0xFE, 0, 0 }, + { 0, 0, (byte) 0xFF, (byte) 0xFE }, + { (byte) 0xFE, (byte) 0xFF, 0, 0 }, { 0, 0, 0, 0x3C }, + { 0, 0, 0x3C, 0 }, { 0, 0x3C, 0, 0 }, { 0x3C, 0, 0, 0 } }; + + static final byte[] utf8magic = { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF }; + + static final byte[] ebcdicmagic = { 0x4C, 0x6F, (byte) 0xA7, (byte) 0x94 }; + + static boolean matchesMagic(byte[] magic, byte[] buffer) { + for (int i = 0; i < magic.length; i++) + if (buffer[i] != magic[i]) + return false; + return true; + } + + static String sniffEncoding(InputStream in) throws IOException { + // see http://www.w3.org/TR/REC-xml/#sec-guessing + byte[] buffer = new byte[256]; + in.mark(buffer.length); + int len = in.read(buffer); + in.reset(); + if (len < 4) + return null; + for (int k = 0; k < utf16magic.length; k++) + if (matchesMagic(utf16magic[k], buffer)) + return "UTF-16"; + for (int k = 0; k < ucs4magic.length; k++) + if (matchesMagic(ucs4magic[k], buffer)) + return "UCS-4"; + if (matchesMagic(utf8magic, buffer)) + return "UTF-8"; + if (matchesMagic(ebcdicmagic, buffer)) + return "EBCDIC"; + + // some ASCII-compatible encoding; read ASCII + int asciiLen = 0; + while (asciiLen < len) { + int c = buffer[asciiLen] & 0xFF; + if (c == 0 || c > 0x7F) + break; + asciiLen++; + } + + // read it into a String + String header = new String(buffer, 0, asciiLen, "ASCII"); + int encIndex = header.indexOf("encoding="); + if (encIndex < 0) + return null; // probably UTF-8 + + encIndex += 9; + if (encIndex >= header.length()) + return null; // encoding did not fit! + + char quote = header.charAt(encIndex); + if (quote != '"' && quote != '\'') + return null; // confused... + + int encEnd = header.indexOf(quote, encIndex + 1); + if (encEnd < 0) + return null; // encoding did not fit! + + String encoding = header.substring(encIndex + 1, encEnd); + return encoding.toUpperCase(); + } + + public void process() { + try { + InputStream in = ocf.getInputStream(resource); + if (!in.markSupported()) + in = new BufferedInputStream(in); + String encoding = sniffEncoding(in); + if (encoding != null && !encoding.equals("UTF-8") + && !encoding.equals("UTF-16")) { + report.error(resource, 0, + "Only UTF-8 and UTF-16 encodings are allowed for XML, detected " + + encoding); + } + InputSource ins = new InputSource(in); + ins.setSystemId(zipRoot + resource); + parser.parse(ins, this); + in.close(); + } catch( MalformedByteSequenceException e ) { + report.error(resource, 0, "Malformed byte sequence: " + e.getMessage() + " Check encoding"); + } catch (IOException e) { + report.error(null, 0, "I/O error reading " + resource); + } catch (IllegalArgumentException e) { + report.error(null, 0, "could not parse " + resource + ": " + + e.getMessage()); + } catch (SAXException e) { + report.error(resource, 0, e.getMessage()); + } + } + + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + String resourcePath = (String) systemIdMap.get(systemId); + if (resourcePath != null) { + InputStream resourceStream = ResourceUtil + .getResourceStream(resourcePath); + if (systemId.equals("xhtml-lat1.ent") + || systemId.equals("xhtml-symbol.ent") + || systemId.equals("xhtml-special.ent")) { + System.err + .println("A problem in XML parser detected: external XML entity URLs are not resolved"); + System.err + .println("\tPlease configure your runtime environment to use a different XML parser"); + System.err + .println("\t(e.g. using javax.xml.parsers.SAXParserFactory system property)"); + } + InputSource source = new InputSource(resourceStream); + source.setPublicId(publicId); + source.setSystemId(systemId); + return source; + } else if (systemId.startsWith(zipRoot)) { + String rname = systemId.substring(zipRoot.length()); + if (!ocf.hasEntry(rname)) + throw new SAXException("Could not resolve local XML entity '" + + rname + "'"); + if (!ocf.canDecrypt(rname)) + throw new SAXException("Could not decrypt local XML entity '" + + rname + "'"); + InputStream resourceStream = ocf.getInputStream(rname); + InputSource source = new InputSource(resourceStream); + source.setPublicId(publicId); + source.setSystemId(systemId); + return source; + } else { + report.warning(resource, 0, "Unresolved external XML entity '" + + systemId + "'"); + InputStream urlStream = new URL(systemId).openStream(); + InputSource source = new InputSource(urlStream); + source.setPublicId(publicId); + source.setSystemId(systemId); + return source; + + } + } + + public void notationDecl(String name, String publicId, String systemId) + throws SAXException { + int len = validatorDTDHandlers.size(); + for (int i = 0; i < len; i++) { + ((DTDHandler) validatorDTDHandlers.elementAt(i)).notationDecl(name, + publicId, systemId); + } + } + + public void unparsedEntityDecl(String name, String publicId, + String systemId, String notationName) throws SAXException { + int len = validatorDTDHandlers.size(); + for (int i = 0; i < len; i++) { + ((DTDHandler) validatorDTDHandlers.elementAt(i)) + .unparsedEntityDecl(name, publicId, systemId, notationName); + } + } + + public void error(SAXParseException ex) throws SAXException { + report.error(resource, ex.getLineNumber(), ex.getMessage()); + } + + public void fatalError(SAXParseException ex) throws SAXException { + report.error(resource, ex.getLineNumber(), ex.getMessage()); + } + + public void warning(SAXParseException ex) throws SAXException { + report.warning(resource, ex.getLineNumber(), ex.getMessage()); + } + + public void characters(char[] arg0, int arg1, int arg2) throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .characters(arg0, arg1, arg2); + } + + int len = contentHandlers.size(); + for (int i = 0; i < len; i++) + ((XMLHandler) contentHandlers.elementAt(i)).characters(arg0, arg1, + arg2); + } + + public void endDocument() throws SAXException { + int len = validatorContentHandlers.size(); + for (int i = 0; i < len; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .endDocument(); + } + } + + public void endElement(String arg0, String arg1, String arg2) + throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .endElement(arg0, arg1, arg2); + } + int len = contentHandlers.size(); + for (int i = 0; i < len; i++) + ((XMLHandler) contentHandlers.elementAt(i)).endElement(); + currentElement = currentElement.getParent(); + } + + public void endPrefixMapping(String arg0) throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .endPrefixMapping(arg0); + } + } + + public void ignorableWhitespace(char[] arg0, int arg1, int arg2) + throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .ignorableWhitespace(arg0, arg1, arg2); + } + int len = contentHandlers.size(); + for (int i = 0; i < len; i++) + ((XMLHandler) contentHandlers.elementAt(i)).ignorableWhitespace( + arg0, arg1, arg2); + } + + public void processingInstruction(String arg0, String arg1) + throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .processingInstruction(arg0, arg1); + } + int len = contentHandlers.size(); + for (int i = 0; i < len; i++) + ((XMLHandler) contentHandlers.elementAt(i)).processingInstruction( + arg0, arg1); + } + + public void setDocumentLocator(Locator locator) { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .setDocumentLocator(locator); + } + documentLocator = locator; + } + + public void skippedEntity(String arg0) throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .skippedEntity(arg0); + } + } + + public void startDocument() throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .startDocument(); + } + } + + public void startElement(String namespaceURI, String localName, + String qName, Attributes atts) throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .startElement(namespaceURI, localName, qName, atts); + } + int index = qName.indexOf(':'); + String prefix; + String name; + if (index < 0) { + prefix = null; + name = qName; + } else { + prefix = qName.substring(0, index); + name = qName.substring(index + 1); + } + int count = atts.getLength(); + XMLAttribute[] attributes = count == 0 ? null : new XMLAttribute[count]; + for (int i = 0; i < count; i++) { + String attName = atts.getLocalName(i); + String attNamespace = atts.getURI(i); + String attQName = atts.getQName(i); + int attIndex = attQName.indexOf(':'); + String attPrefix; + if (attIndex < 0) { + attPrefix = null; + attNamespace = null; + } else { + attPrefix = attQName.substring(0, attIndex); + } + String attValue = atts.getValue(i); + attributes[i] = new XMLAttribute(attNamespace, attPrefix, attName, + attValue); + } + currentElement = new XMLElement(namespaceURI, prefix, name, attributes, + currentElement); + int len = contentHandlers.size(); + for (int i = 0; i < len; i++) + ((XMLHandler) contentHandlers.elementAt(i)).startElement(); + } + + public void startPrefixMapping(String arg0, String arg1) + throws SAXException { + int vlen = validatorContentHandlers.size(); + for (int i = 0; i < vlen; i++) { + ((ContentHandler) validatorContentHandlers.elementAt(i)) + .startPrefixMapping(arg0, arg1); + } + } + + public void comment(char[] text, int arg1, int arg2) throws SAXException { + } + + public void endCDATA() throws SAXException { + } + + public void endDTD() throws SAXException { + } + + public void endEntity(String ent) throws SAXException { + } + + public void startCDATA() throws SAXException { + } + + public void startDTD(String arg0, String arg1, String arg2) + throws SAXException { + } + + public void startEntity(String ent) throws SAXException { + if (!entities.contains(ent) && !ent.equals("[dtd]")) + report.error(resource, getLineNumber(), "Entity '" + ent + + "' is undeclared"); + } + + public void attributeDecl(String name, String name2, String type, + String mode, String value) throws SAXException { + } + + public void elementDecl(String name, String model) throws SAXException { + } + + public void externalEntityDecl(String name, String publicId, String systemId) + throws SAXException { + entities.add(name); + } + + public void internalEntityDecl(String name, String value) + throws SAXException { + entities.add(name); + } + + public XMLElement getCurrentElement() { + return currentElement; + } + + public Report getReport() { + return report; + } + + public int getLineNumber() { + return documentLocator.getLineNumber(); + } + +} diff --git a/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLValidator.java b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLValidator.java new file mode 100644 index 0000000..9c32a0d --- /dev/null +++ b/thirdparty/epubcheck/src/com/adobe/epubcheck/xml/XMLValidator.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2007 Adobe Systems Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.adobe.epubcheck.xml; + +import java.io.IOException; +import java.io.InputStream; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; + +import com.adobe.epubcheck.util.ResourceUtil; +import com.thaiopensource.util.PropertyMapBuilder; +import com.thaiopensource.validate.Schema; +import com.thaiopensource.validate.ValidateProperty; +import com.thaiopensource.validate.auto.AutoSchemaReader; +import com.thaiopensource.validate.auto.SchemaReceiverFactory; +import com.thaiopensource.validate.rng.SAXSchemaReceiverFactory; +import com.thaiopensource.xml.sax.XMLReaderCreator; + +public class XMLValidator { + + String schemaName; + Schema schema; + + private class ResourceEntityResolver implements EntityResolver { + + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + String path = systemId; + //if( path.indexOf("basic-table.rng") >= 0 ) + // throw new RuntimeException("path is '" + path + "' schema name is '" + schemaName + "'"); + if (path.startsWith("file:/")) + path = path.substring(6); + while (path.startsWith("/")) + path = path.substring(1); + InputStream in = ResourceUtil.getResourceStream(ResourceUtil + .getResourcePath(path)); + if (in == null) + return null; + InputSource source = new InputSource(in); + source.setSystemId(systemId); + return source; + } + } + + private class XMLReaderCreatorImpl implements XMLReaderCreator { + + public XMLReader createXMLReader() throws SAXException { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + try { + SAXParser parser = factory.newSAXParser(); + XMLReader reader = parser.getXMLReader(); + reader.setEntityResolver(new ResourceEntityResolver()); + return reader; + } catch (ParserConfigurationException e) { + e.printStackTrace(); + throw new SAXException(e.toString()); + } + } + + } + + // handles errors in schemas + private class ErrorHandlerImpl implements ErrorHandler { + + public void error(SAXParseException exception) throws SAXException { + exception.printStackTrace(); + } + + public void fatalError(SAXParseException exception) throws SAXException { + exception.printStackTrace(); + } + + public void warning(SAXParseException exception) throws SAXException { + exception.printStackTrace(); + } + + } + + public XMLValidator(String schemaName) { + try { + String resourcePath = ResourceUtil.getResourcePath(schemaName); + InputStream schemaStream = ResourceUtil + .getResourceStream(resourcePath); + if( schemaStream == null ) { + throw new RuntimeException("Could not find resource " + resourcePath); + } + InputSource schemaSource = new InputSource(schemaStream); + schemaSource.setPublicId("/" + schemaName); + PropertyMapBuilder mapBuilder = new PropertyMapBuilder(); + mapBuilder.put(ValidateProperty.XML_READER_CREATOR, + new XMLReaderCreatorImpl()); + mapBuilder.put(SchemaReceiverFactory.PROPERTY, + new SAXSchemaReceiverFactory()); + mapBuilder.put(ValidateProperty.ERROR_HANDLER, + new ErrorHandlerImpl()); + AutoSchemaReader schemaReader = new AutoSchemaReader(); + this.schemaName = schemaName; + schema = schemaReader.createSchema(schemaSource, mapBuilder + .toPropertyMap()); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new Error("Internal error: " + e + " " + schemaName); + } + } + +} diff --git a/thirdparty/epubcheck/testdocs/autotest.sh b/thirdparty/epubcheck/testdocs/autotest.sh new file mode 100644 index 0000000..ca37d02 --- /dev/null +++ b/thirdparty/epubcheck/testdocs/autotest.sh @@ -0,0 +1 @@ +java -cp ../dist/epubcheck-1.0.5.jar com.adobe.epubcheck.autotest.AutoTest ./general/tests.xml ./general/ diff --git a/thirdparty/epubcheck/testdocs/general/OPFIllegalElement.epub b/thirdparty/epubcheck/testdocs/general/OPFIllegalElement.epub new file mode 100644 index 0000000..036880b Binary files /dev/null and b/thirdparty/epubcheck/testdocs/general/OPFIllegalElement.epub differ diff --git a/thirdparty/epubcheck/testdocs/general/OPFIllegalElement_UniqueID.epub b/thirdparty/epubcheck/testdocs/general/OPFIllegalElement_UniqueID.epub new file mode 100644 index 0000000..43addd6 Binary files /dev/null and b/thirdparty/epubcheck/testdocs/general/OPFIllegalElement_UniqueID.epub differ diff --git a/thirdparty/epubcheck/testdocs/general/PageMap.epub b/thirdparty/epubcheck/testdocs/general/PageMap.epub new file mode 100644 index 0000000..30ea1af Binary files /dev/null and b/thirdparty/epubcheck/testdocs/general/PageMap.epub differ diff --git a/thirdparty/epubcheck/testdocs/general/Test.epub b/thirdparty/epubcheck/testdocs/general/Test.epub new file mode 100644 index 0000000..52d9b78 Binary files /dev/null and b/thirdparty/epubcheck/testdocs/general/Test.epub differ diff --git a/thirdparty/epubcheck/testdocs/general/UniqueIDNotUsed.epub b/thirdparty/epubcheck/testdocs/general/UniqueIDNotUsed.epub new file mode 100644 index 0000000..0da2877 Binary files /dev/null and b/thirdparty/epubcheck/testdocs/general/UniqueIDNotUsed.epub differ diff --git a/thirdparty/epubcheck/testdocs/general/tests.xml b/thirdparty/epubcheck/testdocs/general/tests.xml new file mode 100644 index 0000000..1a81ab5 --- /dev/null +++ b/thirdparty/epubcheck/testdocs/general/tests.xml @@ -0,0 +1,35 @@ + + + + PageMap.epub + This ePub has a PageMap. Having a page-map will cause a validation error. + + 1 + 0 + + + + OPFIllegalElement_UniqueID.epub + This ePub has an illegal element in the opf, and is missing the unique-id. + + 2 + 0 + + + + OPFIllegalElement.epub + This ePub has an illegal element in the opf. + + 1 + 0 + + + + Test.epub + This ePub is valid. + + 0 + 0 + + + diff --git a/thirdparty/epubcheck/testdocs/issues/Issue21.epub b/thirdparty/epubcheck/testdocs/issues/Issue21.epub new file mode 100644 index 0000000..865590e Binary files /dev/null and b/thirdparty/epubcheck/testdocs/issues/Issue21.epub differ diff --git a/thirdparty/epubcheck/testdocs/issues/Issue25.epub b/thirdparty/epubcheck/testdocs/issues/Issue25.epub new file mode 100644 index 0000000..1992e77 Binary files /dev/null and b/thirdparty/epubcheck/testdocs/issues/Issue25.epub differ diff --git a/thirdparty/epubcheck/testdocs/issues/issues.xml b/thirdparty/epubcheck/testdocs/issues/issues.xml new file mode 100644 index 0000000..7df92a8 --- /dev/null +++ b/thirdparty/epubcheck/testdocs/issues/issues.xml @@ -0,0 +1,19 @@ + + + + Issue21.epub + NCX has wrong media-type in the OPF. + + 1 + 0 + + + + Issue25.epub + The toc attribute is missing from the spine (it is a required attribute.) + + 1 + 0 + + + diff --git a/Skripten/tralics b/thirdparty/tralics-2.14.4 similarity index 100% rename from Skripten/tralics rename to thirdparty/tralics-2.14.4 diff --git a/thirdparty/tralics-2.15.2/COPYING b/thirdparty/tralics-2.15.2/COPYING new file mode 100644 index 0000000..cb2fbbf --- /dev/null +++ b/thirdparty/tralics-2.15.2/COPYING @@ -0,0 +1,57 @@ +Tralics is a software that comes with 1) the sources files, +2) some test files, 3) some utilitary files, 4) the documentation. + +The distribution includes 1, 2 and 3. Some utilitary files are +copies, or modifications of files found on the WEB, with their own +copyright notice (see the README file for the list of these files). + +The source files are Copyright by Inria, see notice below. + +The test files are some TeX files that can be translated by tralics. +You can use or modify them as you wish. +If you distribute a modified version of Tralics, make sure that +the script alltests runs. + + +If you modify the raweb configuration file, confdir/ra.tcf, +or a file of the form ra2007.tcf, +you should modify or remove the line containing `tralics ident', +as explained in the file. + +In case of problem contact : tralics@sophia.inria.fr +or consult the Web page: http://www.inria.fr/apics/tralics + +------------------------------------------------------------------- +Copyright notice for Tralics: + +This software is a computer program whose purpose is to +translate LaTeX documents into XML format. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + + + diff --git a/thirdparty/tralics-2.15.2/ChangeLog b/thirdparty/tralics-2.15.2/ChangeLog new file mode 100644 index 0000000..5b7f00c --- /dev/null +++ b/thirdparty/tralics-2.15.2/ChangeLog @@ -0,0 +1,337 @@ + + + + + + + + + + ChangeLog for TRALICS + + + + + +

ChangeLog for the Tralics software

+

See file Old ChangeLog for older versions. +Patches to current version (2.15) start here +

+ + +

History

+ + + +

Version 2.12

+
    +
  1. [2008-04-21, version 2.12] +
    [2008/04/26] Fixed the bug \mathcode`x="8000$\mbox{x}$ +
    In nomathml, \relax not printed any more. +
    Fixed a bug in natbib.plt (Wagner) when \cite is + redefined. +
    Added end-of-paragraph before \end{thebibliography} +
  2. +
  3. [2008-05-18, version 2.12.1] +
    Fixme. Font changes in tables are incorrect... +
    Implemented \natcite +
    Changed \bibitem, calls \ignorespaces, + produces a bibitem element +
    Bug fix: declaration xml_pack_font_att = "true" is honored. +
    Changed \mathversion{bold}$\mathnormal x$ to produce bold. +
    Implemented tipa package. +
    Bug fix $\hbox{{\ensuremath{x}y}}$ is OK +
    Implemented bold math Greek letter (Wagner) +
  4. +
  5. [2008-05-29, version 2.12.2] +
    Newline is OK in \zap@space +
    Changed \: to medmuskip +
    Use <unexpected> for junk in table (Wagner) +
    Allow any kind of space in text in math (Wagner) +
  6. +
  7. [2008-06-06, version 2.12.3] +
    Implemented \formulaattribute in no-mathml mode (Vishwakarma) +
    Added a textype attribute for all <texmath> objects +
    Special commands like \tralics@prompt added +
    Added raw_bib as command line option +
    Translation of \begin{table} \begin{tabular} is a tabular. + (Wagner) +
    Fixed default type for masterthesis. +
    The \calc command is mode independent (Vishwakarma) +
  8. +
  9. [2008-06-20, version 2.12.4] +
    Moved declaration of uint from txvars to tralics.h (Leopard) +
    Removed a bibtex error if no author/editor +
    Expansion of \u z is + \@unicode@composite {z^^^^0306} (T. Bouche) +
    Commands like \bar do not look anymore for \relax (T. Bouche) +
  10. +
  11. [2008-07-04, version 2.12.6] +
    [2008-07-08] Default value of \pers + is \persB +
    Removed restrictions on participants, catperso, etc. +
    Distribution comes in two files: tralics-src and tralics-extra +
    Removed use of file ../xml/tralics.sty in test files. +
    Removed function only_for_module and associated statistics. +
    Made Tralics less verbose for image info. +
    Renamed default_year to ra_year, associated to \ra@year +
    Added two source files txra and txconfig. +
    Complete redesign of the RA stuff (Tex code in ra.plt ra2008.clt) +
    Removed the value field in the ParamDataSlot +
    Removed side-effects in check_ns::check_section +
    Biblio inserts \csname @href\endcsname + in case \href is redefined +
    No \href added if the URL field has \rrrt +
    Removed file txcheck. +
    Removed all special hacks for the RA, todo_xml etc. +
    Changed \XMLaddatt : argument fully translated. + Special chars maybe handled differently +
  12. +
+ +

Version 2.13

+
    +
  1. [2008-07-20, version 2.13.0] +
    Fixed \end{...} if in env that finishes the math +
    Removed SansTitre etc +
    Made \ra@jobname work in any case +
    Removed printing of Option -year= ignored +
    Added a fifth small size +
    Added \@xsetfontsize and \@xgetfontsize +
    [2008-09-16] Implemented amsart class +
    Added an id-text attribute to most anchors +
    Implemented \refstepcounter +
    Implemented \notag and \incr@eqnum +
    Changed \thechapter etc in standard classes +
    Replaced \stepcounter by \refstepcounter in ra.plt +
    Defined the command \AmS, as well as the ten + analogous of \Hat in the amsmath package +
    Created a soul package, moved 4 commands into it +
    Added commands of type \labelenumi +
    Added commands of type \p@enumii +
    Implemented \newtheorem* +
    Hack the case where a theorem starts with a display formula. +
    Implemented \hdotsfor as a line of dots +
    Change which equations are numbered +
    Allow \char`\\ in text in math +
    Changed \stepcounter and \@killcounter +
    Fixed a bug in \XMLlastid +
    Added \everybibitem +
    Added \XMLgetatt +
    Re-implemented attlisttable. +
    Removed the AttListTable structure, uses vector instead +
  2. +
  3. + [2008-10-03, Version 2.13.1] +
    Removed all hacks concerning year field for the raweb +
    [2008-10-16] Added special case of \ChangeElementName{theorem}{xx} + when second argument is empty or starts with space. +
    Fixed a bug: the anchor is always the theorem element, + if name is empty, then attribute list is copied to + the <p> that follows. +
    Changed figure filename handling: ./ no more removed +
    Implemented transation of optional argument of divisions and + \caption. Value put in a <alt_head> + may be changed in config via alt_section or alt_caption +
    Fixed translation of \bindnasrepma from U+260B to U+214B +
    Fixed some math envs (e.g. align), by providing a non-empty id-text value. +
    Added option -no_float_hack +
    Obsoleted options nobibyearerror and nobibyearmodify. +
    Removed parametrisation of raweb topics. +
    Use other counters for itemize than for enumerate +
    Moved the \glo command and glossaire env in in ra.plt +
    Fixed translation of \quad and others in nonmathml mode in \mbox +
    Added some Win32 conditionals in readline.C +
    Feature: optional argument in enumerate does not change + the type to description +
    Added a label attribute to items in enumerate env +
    Added enumi@hook (Brian West) +
    Moved \labelitemXXX from std.clt to the kernel +
    Added a default label, just in case +
    Removed evaluation of font commands in nomathml mode (Mukesh Kumar) +
    Added command name of \hbox in the tree for nomathml + mode (Mukesh Kumar) +
    Removed interpretation of \hbox in nomathml mode +
    Removed the bibtex warning: You should use {\'e} rather than \'{e}. +
  4. +
  5. + [2008-10-27, Version 2.13.3] +
    Fix a bug in wrapfigure +
    Implemented package epigraph +
    Added missing line number in error message for missing close brace +
    Allow expansion of arguments of \begin, \end +
    Improved error handling of \def\xx#1{}\begin{\xx}. +
    Changed \hspace{2.cm} in math mode, result always a + dimension in pt, works even after \mathcode`\.="8000 +
    Implemented package esdiff. +
    Implemented full graphics package +
    Implemented optional arg of \rotatebox +
    Implemented colors +
    Implemented commands like \textsevenoldstyle. +
    Fixed a bug in function read_from_file (core dump on gcc-3.3.3) +
    Added a verse environment +
    Fixed \@latex@error and others. +
    Moved moreinfo in a style file +
  6. +
  7. + [2008-11-13, Version 2.13.4] +
    Allow \fbox{\[ x\]} +
    Allow \fbox{\begin{tabular}{c} x & y \end{tabular}} +
    At most four digits are read for the year +
  8. +
  9. + [2008-11-17, Version 2.13.5] +
    Added \XMLref +
    Fixed underscores and hat: these characters are allowed if + InLoadHandler. OK in \XMLaddatt. +
    Removed runaway argument error in use of \@reevaluate +
    Fixed \bmod (Bouche) +
  10. +
  11. + [2009-10-05, Version 2.13.6] +
    Added \XMLref +
    Added kvoptions, float package +
    Changed \ClassError to put something in the XML +
    Bug correction detected by compiler. (Hashtab ctor; cmd ifdefinable; cmd ltfont) +
    Added parentheses as suggested by compiler. +
  12. +
  13. + [2009-10-14] +
    Corrected printing of command names like & in error elements +
    Removed theme if year > 2008 for the RA +
    Thus, file testerr tested with year=2008. +
    Added test files for RA2009 +
    Added list of fields/entries not to use in the Biblio +
    Changed warning for Lille +
    [2010-03-31] Added a hack for primes in math mode +
    Some math-mode names can be changed +
    Corrected a bug in printing of very large characters +
  14. +
  15. + [2010-10-25, Version 2.13.7] +
    Input file encoding algorithm improved. +
    Corrrected new ColSpec::ColSpec (...) (thanks to + Daniel Simon) +
  16. +
+

Version 2.14

+
    +
  1. [2011-01-24, Version 2.14.1] +
    [bibtex] Added the serial number to the bibtex sort key +
    [txmath] Corrected tracing of $\hspace{2mm}$ +
    Improved printing of math tokens in case of fonts +
    Corrected translation of \left in nomath-2 + mode +
    Added \negmedspace \negthickspace +
    Corrected error message for \sin\int outside + math +
    Corrected \left\updownarrow in nomathml mode +
    [amsmath.plt] Changed definition of xxalignat + and Co. Corrected the no-mathml translation. +
    No label generated for starred version + of align env. +
    Implemented dual mathmode in case \@nomathl=-3 +
    Argument of \bibliography may contain a + trailing bib extension (Eric Bischoff) +
    [2011/04/11] Added \tableattribute env. +
    No error in missing_flush if buffer contains only + of spaces. +
    No error in cases like $\mbox{\hspace {2mm}}$. +
    Implemented \bordermatrix +
    Improved some error messages +
  2. +
  3. + [2011-05-02, Version 2.14.3] released +
    Fixed the font/size/color in \footnote +
    Allows \ChangeElementName{use_font_elt}{true} +
    Implemented \appendix in classes. +
    Commands like \newpage implicitly call \par +
    Added \nouppercase + and \fancypagestyle commands in fancyhdr.plt +
    Implemented \listoftables and + \listoffigures +
    Command \tableofcontents finishes a paragraph + and inserts the value of tocdepth counter. +
    Corrected error message in case of bad hbox. Produces a + <merror> element +
  4. +
  5. + [2011-11-07, Version 2.14.4] released +
    Removed final + <allowbreak/> in url [2012-01-19, V Lefevre] +
    IO encoding easier to understand in the transcript file +
    Added an option -dualmath, and -nomathml reverted + to old meaning +
    Changed printing of some characters +
    Extended the four-hat notation to five hats +
    Implemented a starred version \url* +
    Added the \grabenv command +
    Default output encoding is UTF8 +
    Translation of \phi is &phiv;&#x3D5; + i.e., ϕ, translation of \varphi also changed. +
    Translation of \longmapsfrom\Longmapsfrom\longmapsto\Longmapsto$ + is now &#x27FB;&#x27FD;&&#x27FC;&#x27FE; +⟻⟽⟼⟾ (Heiko Schroeder) +
  6. +
  7. + [2012-07-06, Version 2.14.5] released +
    Added a possibility to specify an XML style sheet +
    No terminator needed after a display math formula in interactive + mode (Allen Downey) +
    Sections in raweb mode may be mandatory +
  8. +
+

Version 2.15

+
    +
  1. + [2012-08-31, Version 2.15.0] +
    [2013-01-21] Number of pages always inserted in the bibliography + [2013-07-22, Version 2.15.1] +
    Removed some unused variables in the code [Julien Schueller] +
    There are no more affiliations in the RA2013 (Marie-Pierre Durollet) +
    Replaced 2007 by current year in + The configuration file for the RA is ra2007.tcf or + ra.tcf. +
    [2014-03-31] A module cannot start in a paragraph; + implicit \par added (Marie-Pierre Durollet) +
  2. +
  3. [2015-01-22, Version 2.15.2] +
    [2015-01-22] corrected a bug in printing the encoding of the + transcript file (David Binderman) +
    If the save stack holds a font command, this is popped at the + end of the process (it might be pushed by a + global \normalfont) +
    The types of the objects remaining on the save stack is + printed on the transcript file at the ebnbd of the process. +
  4. + +
+ +
+

+Valid XHTML 1.0 Strict +back to home page +© INRIA 2005-2015 +Last modified $Date: 2015/01/22 14:12:18 $ +

+ + + + diff --git a/thirdparty/tralics-2.15.2/Copyright b/thirdparty/tralics-2.15.2/Copyright new file mode 100644 index 0000000..fe0cd12 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Copyright @@ -0,0 +1,75 @@ +Copyright Jos Grimm, Inria, projet APICS. 2004, 2005, 2006, 2007, 2008 +Email: Jose.Grimm@sophia.inria.fr +Web page: http://www.inria.fr/apics/tralics + +(French version of the Copyright notice can be found after the English one) +(French and English versions of licence are provided in the files +Licence_CeCILL_V2-en.txt and Licence_CeCILL_V2-fr.txt) + + +This software is a computer program whose purpose is to +translate LaTeX documents into XML format. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + +------------------------------------------------------------------------------ + +Copyright Jos Grimm, Inria, projet APICS. 2004, 2005, 2006, 2007, 2008 +Email: Jose.Grimm@sophia.inria.fr +Page web: http://www.inria.fr/apics/tralics + +Ce logiciel est un programme informatique servant traduire +des documents du format LaTeX vers le langage XML. + +Ce logiciel est rgi par la licence CeCILL soumise au droit franais et +respectant les principes de diffusion des logiciels libres. Vous pouvez +utiliser, modifier et/ou redistribuer ce programme sous les conditions +de la licence CeCILL telle que diffuse par le CEA, le CNRS et l'INRIA +sur le site "http://www.cecill.info". + +En contrepartie de l'accessibilit au code source et des droits de copie, +de modification et de redistribution accords par cette licence, il n'est +offert aux utilisateurs qu'une garantie limite. Pour les mmes raisons, +seule une responsabilit restreinte pse sur l'auteur du programme, le +titulaire des droits patrimoniaux et les concdants successifs. + +A cet gard l'attention de l'utilisateur est attire sur les risques +associs au chargement, l'utilisation, la modification et/ou au +dveloppement et la reproduction du logiciel par l'utilisateur tant +donn sa spcificit de logiciel libre, qui peut le rendre complexe +manipuler et qui le rserve donc des dveloppeurs et des professionnels +avertis possdant des connaissances informatiques approfondies. Les +utilisateurs sont donc invits charger et tester l'adquation du +logiciel leurs besoins dans des conditions permettant d'assurer la +scurit de leurs systmes et ou de leurs donnes et, plus gnralement, + l'utiliser et l'exploiter dans les mmes conditions de scurit. + +Le fait que vous puissiez accder cet en-tte signifie que vous avez +pris connaissance de la licence CeCILL, et que vous en avez accept les +termes. + + diff --git a/thirdparty/tralics-2.15.2/LISEZMOI b/thirdparty/tralics-2.15.2/LISEZMOI new file mode 100644 index 0000000..e791ec8 --- /dev/null +++ b/thirdparty/tralics-2.15.2/LISEZMOI @@ -0,0 +1,142 @@ +// Ce logiciel est rgi par la licence CeCILL soumise au droit franais et +// respectant les principes de diffusion des logiciels libres. Vous pouvez +// utiliser, modifier et/ou redistribuer ce programme sous les conditions +// de la licence CeCILL telle que diffuse par le CEA, le CNRS et l'INRIA +// sur le site "http://www.cecill.info". +// (voir fichier Licence_CeCILL_V2-fr.txt) +// Pour plus de dtails : voir la fin du fichier. + +L'archive contient six rpertoires et quelques fichiers. +Les rpertoires sont xml, Test, confdir, icons et src. +Pour avoir un excutable, aller dans le rpertoire src, et taper make. +(ce qui suit est une copie du fichier README en anglais) + +The src directory contains the following files + Copyright: copy of the copyriht notice + README: explains how to create the Tralics binary + Makefile : this is the Makefile + *.C *.h : the sources. + + +The confdir directory contains the following files + test.tcd cedram.tcf eurotex.tcf unused.tcf testa.tcf tpa.tcf hello.tcf + torture.tcf hello1.tcf hello3.tcf gescap.tcf tp.tcfRR.tcd rabib.tcf + -> example of tcf files + config_empty tralics_rc .tralics_rc + -> configuration files + ra.tcf : tcf file for the raweb + mpd.tex mpmath.tex : some tex files + + +The xml directory contains the following files and directories + mathml2 (directory) + -> the mathml2 DTD, version 1.12, date 2003/11/04, downloaded 2004/09/15 + (see the copyright notice in each of these files) + + fotex.sty-patched, fotex-add.sty + a patched version of fotex.sty (by Sebastian Rahtz) + (see copyright notice in the file) + (see also README file in the xml directory) + + raweb3-makecolspec.xsl raweb3-param.xsl raweb3-table.xsl + Three auxiliary style sheets, from the TEI by Sebastian Rahtz + adapted to tralics (see the copyright notice in each of these files) + + preview.xsl + Style sheet for producing small images. + + raweb3fo.xsl rrfo3.xsl + Two style sheets, used at Inria, given as example. + Inspired by from the TEI by Sebastian Rahtz. + (see the copyright notice in each of these files) + + raweb3.dtd + The Raweb DTD (for year 2003). + + raweb-cfg.sty + re-implementation of the MathML to dvi converter + (distributed under the LaTeX Project Public License ) + + tralics-iso.sty + a TeX file that defines lots of mathematical symbols + +The icons directory contains some icons to be used for the raweb + +The raweb directory contains + raweb.cls ra2006.cls + : the classes for the raweb + rawebnum.bst rawebalpha.bst rawebxml.bst raweb.bst + : bst files + Logo-INRIA-couleur.ps Logo-INRIA-couleur.pdf LogoRA2006.pdf LogoRA2006.eps + : Logos + +The main directory contains + ChangeLog : a file that describes what has changed + README : this file + LISEZMOI : French version of this file + Copyright : French/English copyright notice for Tralics + COPYING : Copyright notice for the whole package + Licence_CeCILL_V2-en.txt Licence_CeCILL_V2-fr.txt + English and french version of the CeCILL License, text version + rahandler.pl + Perl script called by tralics in case action is required + + +The Test directory contains + + torture.tex, tormath.tex fptest.tex : the 3 main testfiles + torture.bib: a bibtex associated to it + tortureaux.tex taux1.tex taux2.tex: + test file (fort testing \openin) + tpa.tex: a file for testing the titlepage stuff + lxdoc.tex : + the source of the documentation (now obsolete) + tralics-euro2003.ps : + preliminary version of the paper eurotex 20023 + +You can compile tralics issuing the make command. +A C++ compiler (like gcc version 3 or 4 is required) + +You can test the software: go into the Test directory, +run tralics on the files torture, fptest, tormath, tormath1 +The result should be: No error found. + + +In case of problem contact : Jose.Grimm@sophia.inria.fr +or consult the Web page: http://www.inria.fr/apics/tralics + +August 2006. + + +------------------- + +Ce logiciel est un programme informatique servant traduire +des documents du format LaTeX vers le langage XML. + +Ce logiciel est rgi par la licence CeCILL soumise au droit franais et +respectant les principes de diffusion des logiciels libres. Vous pouvez +utiliser, modifier et/ou redistribuer ce programme sous les conditions +de la licence CeCILL telle que diffuse par le CEA, le CNRS et l'INRIA +sur le site "http://www.cecill.info". + +En contrepartie de l'accessibilit au code source et des droits de copie, +de modification et de redistribution accords par cette licence, il n'est +offert aux utilisateurs qu'une garantie limite. Pour les mmes raisons, +seule une responsabilit restreinte pse sur l'auteur du programme, le +titulaire des droits patrimoniaux et les concdants successifs. + +A cet gard l'attention de l'utilisateur est attire sur les risques +associs au chargement, l'utilisation, la modification et/ou au +dveloppement et la reproduction du logiciel par l'utilisateur tant +donn sa spcificit de logiciel libre, qui peut le rendre complexe +manipuler et qui le rserve donc des dveloppeurs et des professionnels +avertis possdant des connaissances informatiques approfondies. Les +utilisateurs sont donc invits charger et tester l'adquation du +logiciel leurs besoins dans des conditions permettant d'assurer la +scurit de leurs systmes et ou de leurs donnes et, plus gnralement, + l'utiliser et l'exploiter dans les mmes conditions de scurit. + +Le fait que vous puissiez accder cet en-tte signifie que vous avez +pris connaissance de la licence CeCILL, et que vous en avez accept les +termes. + diff --git a/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-en.txt b/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-en.txt new file mode 100644 index 0000000..a36324d --- /dev/null +++ b/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-en.txt @@ -0,0 +1,505 @@ + + CeCILL FREE SOFTWARE LICENSE AGREEMENT + + + Notice + +This Agreement is a Free Software license agreement that is the result +of discussions between its authors in order to ensure compliance with +the two main principles guiding its drafting: + + * firstly, compliance with the principles governing the distribution + of Free Software: access to source code, broad rights granted to + users, + * secondly, the election of a governing law, French law, with which + it is conformant, both as regards the law of torts and + intellectual property law, and the protection that it offers to + both authors and holders of the economic rights over software. + +The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[logiciel] L[ibre]) +license are: + +Commissariat l'Energie Atomique - CEA, a public scientific, technical +and industrial establishment, having its principal place of business at +31-33 rue de la Fdration, 75752 Paris cedex 15, France. + +Centre National de la Recherche Scientifique - CNRS, a public scientific +and technological establishment, having its principal place of business +at 3 rue Michel-Ange 75794 Paris cedex 16, France. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, a public scientific and technological establishment, having its +principal place of business at Domaine de Voluceau, Rocquencourt, BP +105, 78153 Le Chesnay cedex, France. + + + Preamble + +The purpose of this Free Software license agreement is to grant users +the right to modify and redistribute the software governed by this +license within the framework of an open source distribution model. + +The exercising of these rights is conditional upon certain obligations +for users so as to preserve this status for all subsequent redistributions. + +In consideration of access to the source code and the rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors only have limited liability. + +In this respect, the risks associated with loading, using, modifying +and/or developing or reproducing the software by the user are brought to +the user's attention, given its Free Software status, which may make it +complicated to use, with the result that its use is reserved for +developers and experienced professionals having in-depth computer +knowledge. Users are therefore encouraged to load and test the +Software's suitability as regards their requirements in conditions +enabling the security of their systems and/or data to be ensured and, +more generally, to use and operate it in the same conditions of +security. This Agreement may be freely reproduced and published, +provided it is not altered, and that no provisions are either added or +removed herefrom. + +This Agreement may apply to any or all software for which the holder of +the economic rights decides to submit the use thereof to its provisions. + + + Article 1 - DEFINITIONS + +For the purpose of this Agreement, when the following expressions +commence with a capital letter, they shall have the following meaning: + +Agreement: means this license agreement, and its possible subsequent +versions and annexes. + +Software: means the software in its Object Code and/or Source Code form +and, where applicable, its documentation, "as is" when the Licensee +accepts the Agreement. + +Initial Software: means the Software in its Source Code and possibly its +Object Code form and, where applicable, its documentation, "as is" when +it is first distributed under the terms and conditions of the Agreement. + +Modified Software: means the Software modified by at least one +Contribution. + +Source Code: means all the Software's instructions and program lines to +which access is required so as to modify the Software. + +Object Code: means the binary files originating from the compilation of +the Source Code. + +Holder: means the holder(s) of the economic rights over the Initial +Software. + +Licensee: means the Software user(s) having accepted the Agreement. + +Contributor: means a Licensee having made at least one Contribution. + +Licensor: means the Holder, or any other individual or legal entity, who +distributes the Software under the Agreement. + +Contribution: means any or all modifications, corrections, translations, +adaptations and/or new functions integrated into the Software by any or +all Contributors, as well as any or all Internal Modules. + +Module: means a set of sources files including their documentation that +enables supplementary functions or services in addition to those offered +by the Software. + +External Module: means any or all Modules, not derived from the +Software, so that this Module and the Software run in separate address +spaces, with one calling the other when they are run. + +Internal Module: means any or all Module, connected to the Software so +that they both execute in the same address space. + +GNU GPL: means the GNU General Public License version 2 or any +subsequent version, as published by the Free Software Foundation Inc. + +Parties: mean both the Licensee and the Licensor. + +These expressions may be used both in singular and plural form. + + + Article 2 - PURPOSE + +The purpose of the Agreement is the grant by the Licensor to the +Licensee of a non-exclusive, transferable and worldwide license for the +Software as set forth in Article 5 hereinafter for the whole term of the +protection granted by the rights over said Software. + + + Article 3 - ACCEPTANCE + +3.1 The Licensee shall be deemed as having accepted the terms and +conditions of this Agreement upon the occurrence of the first of the +following events: + + * (i) loading the Software by any or all means, notably, by + downloading from a remote server, or by loading from a physical + medium; + * (ii) the first time the Licensee exercises any of the rights + granted hereunder. + +3.2 One copy of the Agreement, containing a notice relating to the +characteristics of the Software, to the limited warranty, and to the +fact that its use is restricted to experienced users has been provided +to the Licensee prior to its acceptance as set forth in Article 3.1 +hereinabove, and the Licensee hereby acknowledges that it has read and +understood it. + + + Article 4 - EFFECTIVE DATE AND TERM + + + 4.1 EFFECTIVE DATE + +The Agreement shall become effective on the date when it is accepted by +the Licensee as set forth in Article 3.1. + + + 4.2 TERM + +The Agreement shall remain in force for the entire legal term of +protection of the economic rights over the Software. + + + Article 5 - SCOPE OF RIGHTS GRANTED + +The Licensor hereby grants to the Licensee, who accepts, the following +rights over the Software for any or all use, and for the term of the +Agreement, on the basis of the terms and conditions set forth hereinafter. + +Besides, if the Licensor owns or comes to own one or more patents +protecting all or part of the functions of the Software or of its +components, the Licensor undertakes not to enforce the rights granted by +these patents against successive Licensees using, exploiting or +modifying the Software. If these patents are transferred, the Licensor +undertakes to have the transferees subscribe to the obligations set +forth in this paragraph. + + + 5.1 RIGHT OF USE + +The Licensee is authorized to use the Software, without any limitation +as to its fields of application, with it being hereinafter specified +that this comprises: + + 1. permanent or temporary reproduction of all or part of the Software + by any or all means and in any or all form. + + 2. loading, displaying, running, or storing the Software on any or + all medium. + + 3. entitlement to observe, study or test its operation so as to + determine the ideas and principles behind any or all constituent + elements of said Software. This shall apply when the Licensee + carries out any or all loading, displaying, running, transmission + or storage operation as regards the Software, that it is entitled + to carry out hereunder. + + + 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS + +The right to make Contributions includes the right to translate, adapt, +arrange, or make any or all modifications to the Software, and the right +to reproduce the resulting Software. + +The Licensee is authorized to make any or all Contributions to the +Software provided that it includes an explicit notice that it is the +author of said Contribution and indicates the date of the creation thereof. + + + 5.3 RIGHT OF DISTRIBUTION + +In particular, the right of distribution includes the right to publish, +transmit and communicate the Software to the general public on any or +all medium, and by any or all means, and the right to market, either in +consideration of a fee, or free of charge, one or more copies of the +Software by any means. + +The Licensee is further authorized to distribute copies of the modified +or unmodified Software to third parties according to the terms and +conditions set forth hereinafter. + + + 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION + +The Licensee is authorized to distribute true copies of the Software in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Software is +redistributed, the Licensee allows future Licensees unhindered access to +the full Source Code of the Software by indicating how to access it, it +being understood that the additional cost of acquiring the Source Code +shall not exceed the cost of transferring the data. + + + 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE + +When the Licensee makes a Contribution to the Software, the terms and +conditions for the distribution of the Modified Software become subject +to all the provisions of this Agreement. + +The Licensee is authorized to distribute the Modified Software, in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Modified +Software is redistributed, the Licensee allows future Licensees +unhindered access to the full Source Code of the Modified Software by +indicating how to access it, it being understood that the additional +cost of acquiring the Source Code shall not exceed the cost of +transferring the data. + + + 5.3.3 DISTRIBUTION OF EXTERNAL MODULES + +When the Licensee has developed an External Module, the terms and +conditions of this Agreement do not apply to said External Module, that +may be distributed under a separate license agreement. + + + 5.3.4 COMPATIBILITY WITH THE GNU GPL + +The Licensee can include a code that is subject to the provisions of one +of the versions of the GNU GPL in the Modified or unmodified Software, +and distribute that entire code under the terms of the same version of +the GNU GPL. + +The Licensee can include the Modified or unmodified Software in a code +that is subject to the provisions of one of the versions of the GNU GPL, +and distribute that entire code under the terms of the same version of +the GNU GPL. + + + Article 6 - INTELLECTUAL PROPERTY + + + 6.1 OVER THE INITIAL SOFTWARE + +The Holder owns the economic rights over the Initial Software. Any or +all use of the Initial Software is subject to compliance with the terms +and conditions under which the Holder has elected to distribute its work +and no one shall be entitled to modify the terms and conditions for the +distribution of said Initial Software. + +The Holder undertakes that the Initial Software will remain ruled at +least by the current license, for the duration set forth in article 4.2. + + + 6.2 OVER THE CONTRIBUTIONS + +A Licensee who develops a Contribution is the owner of the intellectual +property rights over this Contribution as defined by applicable law. + + + 6.3 OVER THE EXTERNAL MODULES + +A Licensee who develops an External Module is the owner of the +intellectual property rights over this External Module as defined by +applicable law and is free to choose the type of agreement that shall +govern its distribution. + + + 6.4 JOINT PROVISIONS + +The Licensee expressly undertakes: + + 1. not to remove, or modify, in any manner, the intellectual property + notices attached to the Software; + + 2. to reproduce said notices, in an identical manner, in the copies + of the Software modified or not. + +The Licensee undertakes not to directly or indirectly infringe the +intellectual property rights of the Holder and/or Contributors on the +Software and to take, where applicable, vis--vis its staff, any and all +measures required to ensure respect of said intellectual property rights +of the Holder and/or Contributors. + + + Article 7 - RELATED SERVICES + +7.1 Under no circumstances shall the Agreement oblige the Licensor to +provide technical assistance or maintenance services for the Software. + +However, the Licensor is entitled to offer this type of services. The +terms and conditions of such technical assistance, and/or such +maintenance, shall be set forth in a separate instrument. Only the +Licensor offering said maintenance and/or technical assistance services +shall incur liability therefor. + +7.2 Similarly, any Licensor is entitled to offer to its licensees, under +its sole responsibility, a warranty, that shall only be binding upon +itself, for the redistribution of the Software and/or the Modified +Software, under terms and conditions that it is free to decide. Said +warranty, and the financial terms and conditions of its application, +shall be subject of a separate instrument executed between the Licensor +and the Licensee. + + + Article 8 - LIABILITY + +8.1 Subject to the provisions of Article 8.2, the Licensee shall be +entitled to claim compensation for any direct loss it may have suffered +from the Software as a result of a fault on the part of the relevant +Licensor, subject to providing evidence thereof. + +8.2 The Licensor's liability is limited to the commitments made under +this Agreement and shall not be incurred as a result of in particular: +(i) loss due the Licensee's total or partial failure to fulfill its +obligations, (ii) direct or consequential loss that is suffered by the +Licensee due to the use or performance of the Software, and (iii) more +generally, any consequential loss. In particular the Parties expressly +agree that any or all pecuniary or business loss (i.e. loss of data, +loss of profits, operating loss, loss of customers or orders, +opportunity cost, any disturbance to business activities) or any or all +legal proceedings instituted against the Licensee by a third party, +shall constitute consequential loss and shall not provide entitlement to +any or all compensation from the Licensor. + + + Article 9 - WARRANTY + +9.1 The Licensee acknowledges that the scientific and technical +state-of-the-art when the Software was distributed did not enable all +possible uses to be tested and verified, nor for the presence of +possible defects to be detected. In this respect, the Licensee's +attention has been drawn to the risks associated with loading, using, +modifying and/or developing and reproducing the Software which are +reserved for experienced users. + +The Licensee shall be responsible for verifying, by any or all means, +the product's suitability for its requirements, its good working order, +and for ensuring that it shall not cause damage to either persons or +properties. + +9.2 The Licensor hereby represents, in good faith, that it is entitled +to grant all the rights over the Software (including in particular the +rights set forth in Article 5). + +9.3 The Licensee acknowledges that the Software is supplied "as is" by +the Licensor without any other express or tacit warranty, other than +that provided for in Article 9.2 and, in particular, without any warranty +as to its commercial value, its secured, safe, innovative or relevant +nature. + +Specifically, the Licensor does not warrant that the Software is free +from any error, that it will operate without interruption, that it will +be compatible with the Licensee's own equipment and software +configuration, nor that it will meet the Licensee's requirements. + +9.4 The Licensor does not either expressly or tacitly warrant that the +Software does not infringe any third party intellectual property right +relating to a patent, software or any other property right. Therefore, +the Licensor disclaims any and all liability towards the Licensee +arising out of any or all proceedings for infringement that may be +instituted in respect of the use, modification and redistribution of the +Software. Nevertheless, should such proceedings be instituted against +the Licensee, the Licensor shall provide it with technical and legal +assistance for its defense. Such technical and legal assistance shall be +decided on a case-by-case basis between the relevant Licensor and the +Licensee pursuant to a memorandum of understanding. The Licensor +disclaims any and all liability as regards the Licensee's use of the +name of the Software. No warranty is given as regards the existence of +prior rights over the name of the Software or as regards the existence +of a trademark. + + + Article 10 - TERMINATION + +10.1 In the event of a breach by the Licensee of its obligations +hereunder, the Licensor may automatically terminate this Agreement +thirty (30) days after notice has been sent to the Licensee and has +remained ineffective. + +10.2 A Licensee whose Agreement is terminated shall no longer be +authorized to use, modify or distribute the Software. However, any +licenses that it may have granted prior to termination of the Agreement +shall remain valid subject to their having been granted in compliance +with the terms and conditions hereof. + + + Article 11 - MISCELLANEOUS + + + 11.1 EXCUSABLE EVENTS + +Neither Party shall be liable for any or all delay, or failure to +perform the Agreement, that may be attributable to an event of force +majeure, an act of God or an outside cause, such as defective +functioning or interruptions of the electricity or telecommunications +networks, network paralysis following a virus attack, intervention by +government authorities, natural disasters, water damage, earthquakes, +fire, explosions, strikes and labor unrest, war, etc. + +11.2 Any Failure by either Party, on one or more occasions, to invoke +one or more of the provisions hereof, shall under no circumstances be +interpreted as being a waiver by the interested Party of its right to +invoke said provision(s) subsequently. + +11.3 The Agreement cancels and replaces any or all previous agreements, +whether written or oral, between the Parties and having the same +purpose, and constitutes the entirety of the agreement between said +Parties concerning said purpose. No supplement or modification to the +terms and conditions hereof shall be effective as between the Parties +unless it is made in writing and signed by their duly authorized +representatives. + +11.4 In the event that one or more of the provisions hereof were to +conflict with a current or future applicable act or legislative text, +said act or legislative text shall prevail, and the Parties shall make +the necessary amendments so as to comply with said act or legislative +text. All other provisions shall remain effective. Similarly, invalidity +of a provision of the Agreement, for any reason whatsoever, shall not +cause the Agreement as a whole to be invalid. + + + 11.5 LANGUAGE + +The Agreement is drafted in both French and English and both versions +are deemed authentic. + + + Article 12 - NEW VERSIONS OF THE AGREEMENT + +12.1 Any person is authorized to duplicate and distribute copies of this +Agreement. + +12.2 So as to ensure coherence, the wording of this Agreement is +protected and may only be modified by the authors of the License, who +reserve the right to periodically publish updates or new versions of the +Agreement, each with a separate number. These subsequent versions may +address new issues encountered by Free Software. + +12.3 Any Software distributed under a given version of the Agreement may +only be subsequently distributed under the same version of the Agreement +or a subsequent version, subject to the provisions of Article 5.3.4. + + + Article 13 - GOVERNING LAW AND JURISDICTION + +13.1 The Agreement is governed by French law. The Parties agree to +endeavor to seek an amicable solution to any disagreements or disputes +that may arise during the performance of the Agreement. + +13.2 Failing an amicable solution within two (2) months as from their +occurrence, and unless emergency proceedings are necessary, the +disagreements or disputes shall be referred to the Paris Courts having +jurisdiction, by the more diligent Party. + + +Version 2.0 dated 2005-05-21. diff --git a/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-fr.txt b/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-fr.txt new file mode 100644 index 0000000..c23aa01 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Licence_CeCILL_V2-fr.txt @@ -0,0 +1,512 @@ + + CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL + + + Avertissement + +Ce contrat est une licence de logiciel libre issue d'une concertation +entre ses auteurs afin que le respect de deux grands principes prside +sa rdaction: + + * d'une part, le respect des principes de diffusion des logiciels + libres: accs au code source, droits tendus confrs aux + utilisateurs, + * d'autre part, la dsignation d'un droit applicable, le droit + franais, auquel elle est conforme, tant au regard du droit de la + responsabilit civile que du droit de la proprit intellectuelle + et de la protection qu'il offre aux auteurs et titulaires des + droits patrimoniaux sur un logiciel. + +Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] +L[ibre]) sont: + +Commissariat l'Energie Atomique - CEA, tablissement public de +caractre scientifique technique et industriel, dont le sige est situ +31-33 rue de la Fdration, 75752 Paris cedex 15. + +Centre National de la Recherche Scientifique - CNRS, tablissement +public caractre scientifique et technologique, dont le sige est +situ 3 rue Michel-Ange 75794 Paris cedex 16. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, tablissement public caractre scientifique et technologique, +dont le sige est situ Domaine de Voluceau, Rocquencourt, BP 105, 78153 +Le Chesnay cedex. + + + Prambule + +Ce contrat est une licence de logiciel libre dont l'objectif est de +confrer aux utilisateurs la libert de modification et de +redistribution du logiciel rgi par cette licence dans le cadre d'un +modle de diffusion en logiciel libre. + +L'exercice de ces liberts est assorti de certains devoirs la charge +des utilisateurs afin de prserver ce statut au cours des +redistributions ultrieures. + +L'accessibilit au code source et les droits de copie, de modification +et de redistribution qui en dcoulent ont pour contrepartie de n'offrir +aux utilisateurs qu'une garantie limite et de ne faire peser sur +l'auteur du logiciel, le titulaire des droits patrimoniaux et les +concdants successifs qu'une responsabilit restreinte. + +A cet gard l'attention de l'utilisateur est attire sur les risques +associs au chargement, l'utilisation, la modification et/ou au +dveloppement et la reproduction du logiciel par l'utilisateur tant +donn sa spcificit de logiciel libre, qui peut le rendre complexe +manipuler et qui le rserve donc des dveloppeurs ou des +professionnels avertis possdant des connaissances informatiques +approfondies. Les utilisateurs sont donc invits charger et tester +l'adquation du Logiciel leurs besoins dans des conditions permettant +d'assurer la scurit de leurs systmes et/ou de leurs donnes et, plus +gnralement, l'utiliser et l'exploiter dans les mme conditions de +scurit. Ce contrat peut tre reproduit et diffus librement, sous +rserve de le conserver en l'tat, sans ajout ni suppression de clauses. + +Ce contrat est susceptible de s'appliquer tout logiciel dont le +titulaire des droits patrimoniaux dcide de soumettre l'exploitation aux +dispositions qu'il contient. + + + Article 1 - DEFINITIONS + +Dans ce contrat, les termes suivants, lorsqu'ils seront crits avec une +lettre capitale, auront la signification suivante: + +Contrat: dsigne le prsent contrat de licence, ses ventuelles versions +postrieures et annexes. + +Logiciel: dsigne le logiciel sous sa forme de Code Objet et/ou de Code +Source et le cas chant sa documentation, dans leur tat au moment de +l'acceptation du Contrat par le Licenci. + +Logiciel Initial: dsigne le Logiciel sous sa forme de Code Source et +ventuellement de Code Objet et le cas chant sa documentation, dans +leur tat au moment de leur premire diffusion sous les termes du Contrat. + +Logiciel Modifi: dsigne le Logiciel modifi par au moins une +Contribution. + +Code Source: dsigne l'ensemble des instructions et des lignes de +programme du Logiciel et auquel l'accs est ncessaire en vue de +modifier le Logiciel. + +Code Objet: dsigne les fichiers binaires issus de la compilation du +Code Source. + +Titulaire: dsigne le ou les dtenteurs des droits patrimoniaux d'auteur +sur le Logiciel Initial + +Licenci: dsigne le ou les utilisateurs du Logiciel ayant accept le +Contrat. + +Contributeur: dsigne le Licenci auteur d'au moins une Contribution. + +Concdant: dsigne le Titulaire ou toute personne physique ou morale +distribuant le Logiciel sous le Contrat. + +Contribution: dsigne l'ensemble des modifications, corrections, +traductions, adaptations et/ou nouvelles fonctionnalits intgres dans +le Logiciel par tout Contributeur, ainsi que tout Module Interne. + +Module: dsigne un ensemble de fichiers sources y compris leur +documentation qui permet de raliser des fonctionnalits ou services +supplmentaires ceux fournis par le Logiciel. + +Module Externe: dsigne tout Module, non driv du Logiciel, tel que ce +Module et le Logiciel s'excutent dans des espaces d'adressages +diffrents, l'un appelant l'autre au moment de leur excution. + +Module Interne: dsigne tout Module li au Logiciel de telle sorte +qu'ils s'excutent dans le mme espace d'adressage. + +GNU GPL: dsigne la GNU General Public License dans sa version 2 ou +toute version ultrieure, telle que publie par Free Software Foundation +Inc. + +Parties: dsigne collectivement le Licenci et le Concdant. + +Ces termes s'entendent au singulier comme au pluriel. + + + Article 2 - OBJET + +Le Contrat a pour objet la concession par le Concdant au Licenci d'une +licence non exclusive, cessible et mondiale du Logiciel telle que +dfinie ci-aprs l'article 5 pour toute la dure de protection des +droits portant sur ce Logiciel. + + + Article 3 - ACCEPTATION + +3.1 L'acceptation par le Licenci des termes du Contrat est rpute +acquise du fait du premier des faits suivants: + + * (i) le chargement du Logiciel par tout moyen notamment par + tlchargement partir d'un serveur distant ou par chargement + partir d'un support physique; + * (ii) le premier exercice par le Licenci de l'un quelconque des + droits concds par le Contrat. + +3.2 Un exemplaire du Contrat, contenant notamment un avertissement +relatif aux spcificits du Logiciel, la restriction de garantie et +la limitation un usage par des utilisateurs expriments a t mis +disposition du Licenci pralablement son acceptation telle que +dfinie l'article 3.1 ci dessus et le Licenci +reconnat en avoir pris connaissance. + + + Article 4 - ENTREE EN VIGUEUR ET DUREE + + + 4.1 ENTREE EN VIGUEUR + +Le Contrat entre en vigueur la date de son acceptation par le Licenci +telle que dfinie en 3.1. + + + 4.2 DUREE + +Le Contrat produira ses effets pendant toute la dure lgale de +protection des droits patrimoniaux portant sur le Logiciel. + + + Article 5 - ETENDUE DES DROITS CONCEDES + +Le Concdant concde au Licenci, qui accepte, les droits suivants sur +le Logiciel pour toutes destinations et pour la dure du Contrat dans +les conditions ci-aprs dtailles. + +Par ailleurs, si le Concdant dtient ou venait dtenir un ou +plusieurs brevets d'invention protgeant tout ou partie des +fonctionnalits du Logiciel ou de ses composants, il s'engage ne pas +opposer les ventuels droits confrs par ces brevets aux Licencis +successifs qui utiliseraient, exploiteraient ou modifieraient le +Logiciel. En cas de cession de ces brevets, le Concdant s'engage +faire reprendre les obligations du prsent alina aux cessionnaires. + + + 5.1 DROIT D'UTILISATION + +Le Licenci est autoris utiliser le Logiciel, sans restriction quant +aux domaines d'application, tant ci-aprs prcis que cela comporte: + + 1. la reproduction permanente ou provisoire du Logiciel en tout ou + partie par tout moyen et sous toute forme. + + 2. le chargement, l'affichage, l'excution, ou le stockage du + Logiciel sur tout support. + + 3. la possibilit d'en observer, d'en tudier, ou d'en tester le + fonctionnement afin de dterminer les ides et principes qui sont + la base de n'importe quel lment de ce Logiciel; et ceci, + lorsque le Licenci effectue toute opration de chargement, + d'affichage, d'excution, de transmission ou de stockage du + Logiciel qu'il est en droit d'effectuer en vertu du Contrat. + + + 5.2 DROIT D'APPORTER DES CONTRIBUTIONS + +Le droit d'apporter des Contributions comporte le droit de traduire, +d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel +et le droit de reproduire le Logiciel en rsultant. + +Le Licenci est autoris apporter toute Contribution au Logiciel sous +rserve de mentionner, de faon explicite, son nom en tant qu'auteur de +cette Contribution et la date de cration de celle-ci. + + + 5.3 DROIT DE DISTRIBUTION + +Le droit de distribution comporte notamment le droit de diffuser, de +transmettre et de communiquer le Logiciel au public sur tout support et +par tout moyen ainsi que le droit de mettre sur le march titre +onreux ou gratuit, un ou des exemplaires du Logiciel par tout procd. + +Le Licenci est autoris distribuer des copies du Logiciel, modifi ou +non, des tiers dans les conditions ci-aprs dtailles. + + + 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION + +Le Licenci est autoris distribuer des copies conformes du Logiciel, +sous forme de Code Source ou de Code Objet, condition que cette +distribution respecte les dispositions du Contrat dans leur totalit et +soit accompagne: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif la restriction de garantie et de + responsabilit du Concdant telle que prvue aux articles 8 + et 9, + +et que, dans le cas o seul le Code Objet du Logiciel est redistribu, +le Licenci permette aux futurs Licencis d'accder facilement au Code +Source complet du Logiciel en indiquant les modalits d'accs, tant +entendu que le cot additionnel d'acquisition du Code Source ne devra +pas excder le simple cot de transfert des donnes. + + + 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE + +Lorsque le Licenci apporte une Contribution au Logiciel, les conditions +de distribution du Logiciel Modifi sont alors soumises l'intgralit +des dispositions du Contrat. + +Le Licenci est autoris distribuer le Logiciel Modifi, sous forme de +Code Source ou de Code Objet, condition que cette distribution +respecte les dispositions du Contrat dans leur totalit et soit +accompagne: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif la restriction de garantie et de + responsabilit du Concdant telle que prvue aux articles 8 + et 9, + +et que, dans le cas o seul le Code Objet du Logiciel Modifi est +redistribu, le Licenci permette aux futurs Licencis d'accder +facilement au Code Source complet du Logiciel Modifi en indiquant les +modalits d'accs, tant entendu que le cot additionnel d'acquisition +du Code Source ne devra pas excder le simple cot de transfert des donnes. + + + 5.3.3 DISTRIBUTION DES MODULES EXTERNES + +Lorsque le Licenci a dvelopp un Module Externe les conditions du +Contrat ne s'appliquent pas ce Module Externe, qui peut tre distribu +sous un contrat de licence diffrent. + + + 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL + +Le Licenci peut inclure un code soumis aux dispositions d'une des +versions de la licence GNU GPL dans le Logiciel modifi ou non et +distribuer l'ensemble sous les conditions de la mme version de la +licence GNU GPL. + +Le Licenci peut inclure le Logiciel modifi ou non dans un code soumis +aux dispositions d'une des versions de la licence GNU GPL et distribuer +l'ensemble sous les conditions de la mme version de la licence GNU GPL. + + + Article 6 - PROPRIETE INTELLECTUELLE + + + 6.1 SUR LE LOGICIEL INITIAL + +Le Titulaire est dtenteur des droits patrimoniaux sur le Logiciel +Initial. Toute utilisation du Logiciel Initial est soumise au respect +des conditions dans lesquelles le Titulaire a choisi de diffuser son +oeuvre et nul autre n'a la facult de modifier les conditions de +diffusion de ce Logiciel Initial. + +Le Titulaire s'engage ce que le Logiciel Initial reste au moins rgi +par la prsente licence et ce, pour la dure vise l'article 4.2. + + + 6.2 SUR LES CONTRIBUTIONS + +Le Licenci qui a dvelopp une Contribution est titulaire sur celle-ci +des droits de proprit intellectuelle dans les conditions dfinies par +la lgislation applicable. + + + 6.3 SUR LES MODULES EXTERNES + +Le Licenci qui a dvelopp un Module Externe est titulaire sur celui-ci +des droits de proprit intellectuelle dans les conditions dfinies par +la lgislation applicable et reste libre du choix du contrat rgissant +sa diffusion. + + + 6.4 DISPOSITIONS COMMUNES + +Le Licenci s'engage expressment: + + 1. ne pas supprimer ou modifier de quelque manire que ce soit les + mentions de proprit intellectuelle apposes sur le Logiciel; + + 2. reproduire l'identique lesdites mentions de proprit + intellectuelle sur les copies du Logiciel modifi ou non. + +Le Licenci s'engage ne pas porter atteinte, directement ou +indirectement, aux droits de proprit intellectuelle du Titulaire et/ou +des Contributeurs sur le Logiciel et prendre, le cas chant, +l'gard de son personnel toutes les mesures ncessaires pour assurer le +respect des dits droits de proprit intellectuelle du Titulaire et/ou +des Contributeurs. + + + Article 7 - SERVICES ASSOCIES + +7.1 Le Contrat n'oblige en aucun cas le Concdant la ralisation de +prestations d'assistance technique ou de maintenance du Logiciel. + +Cependant le Concdant reste libre de proposer ce type de services. Les +termes et conditions d'une telle assistance technique et/ou d'une telle +maintenance seront alors dtermins dans un acte spar. Ces actes de +maintenance et/ou assistance technique n'engageront que la seule +responsabilit du Concdant qui les propose. + +7.2 De mme, tout Concdant est libre de proposer, sous sa seule +responsabilit, ses licencis une garantie, qui n'engagera que lui, +lors de la redistribution du Logiciel et/ou du Logiciel Modifi et ce, +dans les conditions qu'il souhaite. Cette garantie et les modalits +financires de son application feront l'objet d'un acte spar entre le +Concdant et le Licenci. + + + Article 8 - RESPONSABILITE + +8.1 Sous rserve des dispositions de l'article 8.2, le Licenci a la +facult, sous rserve de prouver la faute du Concdant concern, de +solliciter la rparation du prjudice direct qu'il subirait du fait du +logiciel et dont il apportera la preuve. + +8.2 La responsabilit du Concdant est limite aux engagements pris en +application du Contrat et ne saurait tre engage en raison notamment: +(i) des dommages dus l'inexcution, totale ou partielle, de ses +obligations par le Licenci, (ii) des dommages directs ou indirects +dcoulant de l'utilisation ou des performances du Logiciel subis par le +Licenci et (iii) plus gnralement d'un quelconque dommage indirect. En +particulier, les Parties conviennent expressment que tout prjudice +financier ou commercial (par exemple perte de donnes, perte de +bnfices, perte d'exploitation, perte de clientle ou de commandes, +manque gagner, trouble commercial quelconque) ou toute action dirige +contre le Licenci par un tiers, constitue un dommage indirect et +n'ouvre pas droit rparation par le Concdant. + + + Article 9 - GARANTIE + +9.1 Le Licenci reconnat que l'tat actuel des connaissances +scientifiques et techniques au moment de la mise en circulation du +Logiciel ne permet pas d'en tester et d'en vrifier toutes les +utilisations ni de dtecter l'existence d'ventuels dfauts. L'attention +du Licenci a t attire sur ce point sur les risques associs au +chargement, l'utilisation, la modification et/ou au dveloppement et +la reproduction du Logiciel qui sont rservs des utilisateurs avertis. + +Il relve de la responsabilit du Licenci de contrler, par tous +moyens, l'adquation du produit ses besoins, son bon fonctionnement et +de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. + +9.2 Le Concdant dclare de bonne foi tre en droit de concder +l'ensemble des droits attachs au Logiciel (comprenant notamment les +droits viss l'article 5). + +9.3 Le Licenci reconnat que le Logiciel est fourni "en l'tat" par le +Concdant sans autre garantie, expresse ou tacite, que celle prvue +l'article 9.2 et notamment sans aucune garantie sur sa valeur +commerciale, son caractre scuris, innovant ou pertinent. + +En particulier, le Concdant ne garantit pas que le Logiciel est exempt +d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible +avec l'quipement du Licenci et sa configuration logicielle ni qu'il +remplira les besoins du Licenci. + +9.4 Le Concdant ne garantit pas, de manire expresse ou tacite, que le +Logiciel ne porte pas atteinte un quelconque droit de proprit +intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout +autre droit de proprit. Ainsi, le Concdant exclut toute garantie au +profit du Licenci contre les actions en contrefaon qui pourraient tre +diligentes au titre de l'utilisation, de la modification, et de la +redistribution du Logiciel. Nanmoins, si de telles actions sont +exerces contre le Licenci, le Concdant lui apportera son aide +technique et juridique pour sa dfense. Cette aide technique et +juridique est dtermine au cas par cas entre le Concdant concern et +le Licenci dans le cadre d'un protocole d'accord. Le Concdant dgage +toute responsabilit quant l'utilisation de la dnomination du +Logiciel par le Licenci. Aucune garantie n'est apporte quant +l'existence de droits antrieurs sur le nom du Logiciel et sur +l'existence d'une marque. + + + Article 10 - RESILIATION + +10.1 En cas de manquement par le Licenci aux obligations mises sa +charge par le Contrat, le Concdant pourra rsilier de plein droit le +Contrat trente (30) jours aprs notification adresse au Licenci et +reste sans effet. + +10.2 Le Licenci dont le Contrat est rsili n'est plus autoris +utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les +licences qu'il aura concdes antrieurement la rsiliation du Contrat +resteront valides sous rserve qu'elles aient t effectues en +conformit avec le Contrat. + + + Article 11 - DISPOSITIONS DIVERSES + + + 11.1 CAUSE EXTERIEURE + +Aucune des Parties ne sera responsable d'un retard ou d'une dfaillance +d'excution du Contrat qui serait d un cas de force majeure, un cas +fortuit ou une cause extrieure, telle que, notamment, le mauvais +fonctionnement ou les interruptions du rseau lectrique ou de +tlcommunication, la paralysie du rseau lie une attaque +informatique, l'intervention des autorits gouvernementales, les +catastrophes naturelles, les dgts des eaux, les tremblements de terre, +le feu, les explosions, les grves et les conflits sociaux, l'tat de +guerre... + +11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou +plusieurs occasions de se prvaloir d'une ou plusieurs dispositions du +Contrat, ne pourra en aucun cas impliquer renonciation par la Partie +intresse s'en prvaloir ultrieurement. + +11.3 Le Contrat annule et remplace toute convention antrieure, crite +ou orale, entre les Parties sur le mme objet et constitue l'accord +entier entre les Parties sur cet objet. Aucune addition ou modification +aux termes du Contrat n'aura d'effet l'gard des Parties moins +d'tre faite par crit et signe par leurs reprsentants dment habilits. + +11.4 Dans l'hypothse o une ou plusieurs des dispositions du Contrat +s'avrerait contraire une loi ou un texte applicable, existants ou +futurs, cette loi ou ce texte prvaudrait, et les Parties feraient les +amendements ncessaires pour se conformer cette loi ou ce texte. +Toutes les autres dispositions resteront en vigueur. De mme, la +nullit, pour quelque raison que ce soit, d'une des dispositions du +Contrat ne saurait entraner la nullit de l'ensemble du Contrat. + + + 11.5 LANGUE + +Le Contrat est rdig en langue franaise et en langue anglaise, ces +deux versions faisant galement foi. + + + Article 12 - NOUVELLES VERSIONS DU CONTRAT + +12.1 Toute personne est autorise copier et distribuer des copies de +ce Contrat. + +12.2 Afin d'en prserver la cohrence, le texte du Contrat est protg +et ne peut tre modifi que par les auteurs de la licence, lesquels se +rservent le droit de publier priodiquement des mises jour ou de +nouvelles versions du Contrat, qui possderont chacune un numro +distinct. Ces versions ultrieures seront susceptibles de prendre en +compte de nouvelles problmatiques rencontres par les logiciels libres. + +12.3 Tout Logiciel diffus sous une version donne du Contrat ne pourra +faire l'objet d'une diffusion ultrieure que sous la mme version du +Contrat ou une version postrieure, sous rserve des dispositions de +l'article 5.3.4. + + + Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE + +13.1 Le Contrat est rgi par la loi franaise. Les Parties conviennent +de tenter de rgler l'amiable les diffrends ou litiges qui +viendraient se produire par suite ou l'occasion du Contrat. + +13.2 A dfaut d'accord amiable dans un dlai de deux (2) mois compter +de leur survenance et sauf situation relevant d'une procdure d'urgence, +les diffrends ou litiges seront ports par la Partie la plus diligente +devant les Tribunaux comptents de Paris. + + +Version 2.0 du 2005-05-21. diff --git a/thirdparty/tralics-2.15.2/Modele/amsldoc.xml b/thirdparty/tralics-2.15.2/Modele/amsldoc.xml new file mode 100644 index 0000000..5618911 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/amsldoc.xml @@ -0,0 +1,2357 @@ + + + + +User's Guide for the <EM r='pkg'>amsmath</EM> Package (Version 2.0)American Mathematical Society1999-12-13 (revised 2002-02-25)

+
+ +Introduction +

The amsmath package is a package that provides +miscellaneous enhancements for improving the information structure and +printed output of documents that contain mathematical formulas. Readers +unfamiliar with should refer to . If you have an +up-to-date version of , the amsmath package is normally +provided along with it. Upgrading when a newer version of the +amsmath package is released can be done via +http://www.ams.org/tex/amsmath.html or +ftp://ftp.ams.org/pub/tex/.

+

This documentation describes the features of the amsmath package +and discusses how they are intended to be used. It also covers some +ancillary packages:

+amsbsy +amstext +amscd +amsxtra +amsopn +

+These all have something to do with the contents of math formulas. For +information on extra math symbols and math fonts, see +and http://www.ams.org/tex/amsfonts.html. For documentation of the +amsthm package or AMS document classes (amsart, +amsbook, etc.) see or and +http://www.ams.org/tex/author-info.html.

+

If you are a long-time user and have lots of mathematics in what +you write, then you may recognize solutions for some familiar problems +in this list of amsmath features:

+ +

A convenient way to define new `operator name' commands analogous +to sin and lim, including proper side spacing and automatic +selection of the correct font style and size (even when used in +sub- or superscripts).

+
+

Multiple substitutes for the eqnarray environment to make +various kinds of equation arrangements easier to write.

+
+

Equation numbers automatically adjust up or down to avoid +overprinting on the equation contents (unlike eqnarray).

+
+

Spacing around equals signs matches the normal spacing in the +equation environment (unlike eqnarray).

+
+

A way to produce multiline subscripts as are often used with +summation or product symbols.

+
+

An easy way to substitute a variant equation number for a given +equation instead of the automatically supplied number.

+
+

An easy way to produce subordinate equation numbers of the form +(1.3a) (1.3b) (1.3c) for selected groups of equations.

+
+

The amsmath package is distributed together with some small +auxiliary packages:

+ +

Primary package, provides various features for +displayed equations and other mathematical constructs.

+
+

Provides a text command for +typesetting a fragment of text inside a display.

+
+

Provides DeclareMathOperator for defining new +`operator names' like sin and lim.

+
+

For backward compatibility this package continues +to exist but use of the newer bm package that comes with +is recommended instead.

+
+

Provides a CD environment for simple +commutative diagrams (no support for diagonal arrows).

+
+

Provides certain odds and ends such as +fracwithdelims and accentedsymbol, for compatibility with +documents created using version 1.1.

+
+

The amsmath package incorporates amstext, amsopn, and +amsbsy. The features of amscd and amsxtra, however, +are available only by invoking those packages separately.

+
+Options for the amsmath package +

The amsmath package has the following options:

+ +

(default) For a split equation, place equation +numbers vertically centered +on the total height of the equation.

+
+

`Top-or-bottom tags': For a split equation, place +equation numbers level with +the last (resp. first) line, if numbers are on the right (resp. +left).

+
+

(default) Place the subscripts and +superscripts of summation symbols +above and below, in displayed equations. This option also affects other +symbols of the same type—\prod , \coprod , \bigotimes , +\bigoplus , and so forth—but excluding integrals (see below).

+
+

Always place the subscripts and superscripts of +summation-type symbols to the side, even in displayed equations.

+
+

Like sumlimits, but for +integral symbols.

+
+

(default) Opposite of intlimits.

+
+

(default) Like sumlimits, but for certain +`operator names' such as det\det , inf\inf , lim\lim , max\max , min\min , that +traditionally have subscripts placed underneath when they occur in a displayed +equation.

+
+

Opposite of namelimits.

+
+

To use one of these package options, put the option name in the optional +argument of the usepackage command—e.g., +\usepackage[intlimits]{amsmath}.

+

The amsmath package also recognizes the following options which +are normally selected (implicitly or explicitly) through the +documentclass command, and thus need not be repeated in the option +list of the usepackage{amsmath} statement.

+ +

Place equation numbers on the left.

+
+

Place equation numbers on the right.

+
+

Position equations at a fixed indent from the left +margin rather than centered in the text column.

+
+
+Displayed equations + +Introduction +

The amsmath package provides a number of additional displayed +equation structures beyond the ones +provided in basic . The augmented set includes:

+

  equation     equation*     align       align*

+

  gather       gather*       flalign     flalign*

+

  multline     multline*     alignat     alignat*

+

  split

+

(Although the standard eqnarray environment remains available, +it is better to use align or equation+split instead.)

+

Except for split, each environment has both starred and unstarred +forms, where the unstarred forms have automatic numbering using +'s equation counter. You can suppress the number on any +particular line by putting notag before the \\; you can also +override it with a tag of your own +using tag{\langle label\rangle }, where \langle label\rangle means arbitrary text such +as $*$ or ii used to “number” the equation. There is also a +tag* command that causes the text you supply to be typeset +literally, without adding parentheses around it. tag and tag* +can also be used within the unnumbered versions of all the amsmath +alignment structures. Some examples of the use of tag may be found +in the sample files testmath.tex and subeqn.tex provided with +the amsmath package.

+

The split environment is a special subordinate form that is used +only inside one of the others. It cannot be used inside +multline, however.

+

In the structures that do alignment (split, align and +variants), relation symbols have an & before them but not +after—unlike eqnarray. Putting the & after the +relation symbol will interfere with the normal spacing; it has to go +before.

+Comparison of displayed equation environments (vertical lines +indicating nominal margins) +

\begin{equation*}

+

a=b

+

\end{equation*}

+ +a=b +a=b + +

\begin{equation}

+

a=b

+

\end{equation}

+ +a=b +a=b + +

\begin{equation}\label{xx}

+

\begin{split}

+

a& =b+c-d\\

+

 & \quad +e-f\\

+

 & =g+h\\

+

 & =i

+

\end{split}

+

\end{equation}

+ +a=b+c-d+e-f=g+h=i +\begin{split} +a& =b+c-d\\ +& \quad +e-f\\ +& =g+h\\ +& =i +\end{split} + +

\begin{multline}

+

a+b+c+d+e+f\\

+

+i+j+k+l+m+n

+

\end{multline}

+ +a+b+c+d+e+f+i+j+k+l+m+n +a+b+c+d+e+f\\ ++i+j+k+l+m+n + +

\begin{gather}

+

a_1=b_1+c_1\\

+

a_2=b_2+c_2-d_2+e_2

+

\end{gather}

+ +a 1 =b 1 +c 1 a 2 =b 2 +c 2 -d 2 +e 2 +a_1=b_1+c_1\\ +a_2=b_2+c_2-d_2+e_2 + +

\begin{align}

+

a_1& =b_1+c_1\\

+

a_2& =b_2+c_2-d_2+e_2

+

\end{align}

+ +a 1 =b 1 +c 1 a 2 =b 2 +c 2 -d 2 +e 2 +a_1& =b_1+c_1\\ +a_2& =b_2+c_2-d_2+e_2 + +

\begin{align}

+

a_{11}& =b_{11}&

+

  a_{12}& =b_{12}\\

+

a_{21}& =b_{21}&

+

  a_{22}& =b_{22}+c_{22}

+

\end{align}

+ +a 11 =b 11 a 12 =b 12 a 21 =b 21 a 22 =b 22 +c 22 +a_{11}& =b_{11}& +a_{12}& =b_{12}\\ +a_{21}& =b_{21}& +a_{22}& =b_{22}+c_{22} + +

\begin{flalign*}

+

a_{11}& =b_{11}&

+

  a_{12}& =b_{12}\\

+

a_{21}& =b_{21}&

+

  a_{22}& =b_{22}+c_{22}

+

\end{flalign*}

+ +a 11 =b 11 a 12 =b 12 a 21 =b 21 a 22 =b 22 +c 22 +a_{11}& =b_{11}& +a_{12}& =b_{12}\\ +a_{21}& =b_{21}& +a_{22}& =b_{22}+c_{22} + +

+
+Single equations +

The equation environment is for a single equation with an +automatically generated number. The equation* environment is the +same except for omitting the number.Basic doesn't provide an equation* environment, +but rather a functionally equivalent environment named +displaymath.

+
+Split equations without alignment +

The multline environment is a variation of the equation +environment used for equations that don't fit on a single line. The +first line of a multline will be at the left margin and the last +line at the right margin, except for an indention on both sides in the +amount of multlinegap. Any additional lines in between will be +centered independently within the display width (unless the fleqn +option is in effect).

+

Like equation, multline has only a single equation number +(thus, none of the individual lines should be marked with notag). +The equation number is placed on the last line (reqno option) or +first line (leqno option); vertical centering as for split +is not supported by multline.

+

It's possible to force one of the middle lines to the left or right with +commands shoveleft, shoveright. These commands take the entire +line as an argument, up to but not including the final \\; for +example

+

MISSING

+

\begin{multline}

+

\framebox[.65\columnwidth]{A}\\

+

\framebox[.5\columnwidth]{B}\\

+

\shoveright{\framebox[.55\columnwidth]{C}}\\

+

\framebox[.65\columnwidth]{D}

+

\end{multline}

+

The value of multlinegap can be changed with the usual +commands setlength or addtolength.

+
+Split equations with alignment +

Like multline, the split environment is for single +equations that are too long to fit on one line and hence must be split +into multiple lines. Unlike multline, however, the split +environment provides for alignment among the split lines, using & to +mark alignment points. Unlike the other amsmath equation +structures, the split environment provides no numbering, because +it is intended to be used only inside some other displayed +equation structure, usually an equation, align, or +gather environment, which provides the numbering. For example:

+H c =1 2n l=0 n (-1) l (n-l) p-2 l 1 ++l p =l i=1 p n i l i ·[(n-l)-(n i -l i )] n i -l i ·(n-l) 2 - j=1 p (n i -l i ) 2 .\begin{split} +H_c&=\frac{1}{2n} \sum ^n_{l=0}(-1)^{l}(n-{l})^{p-2} +\sum _{l _1+\dots + l _p=l}\prod ^p_{i=1} \binom{n_i}{l _i}\\ +&\quad \cdot [(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot \Bigl [(n-l )^2-\sum ^p_{j=1}(n_i-l _i)^2\Bigr ]. +\hspace{-20.0pt}\end{split} +

\begin{equation}\label{e:barwq}\begin{split}

+

H_c&=\frac{1}{2n} \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2}

+

\sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} \binom{n_i}{l _i}\\

+

&\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot

+

\Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr].

+

\end{split}\end{equation}

+

The split structure should constitute the entire body of the +enclosing structure, apart from commands like label that produce no +visible material.

+
+Equation groups without alignment +

The gather environment is used for a group of consecutive +equations when there is no alignment desired among them; each one is +centered separately within the text width (see Table ). +Equations inside gather are separated by a \\ command. +Any equation in a gather may consist of a \begin{split} +... \end{split} structure—for example:

+

\begin{gather}

+

  first equation\\

+

  \begin{split}

+

    second & equation\\

+

           & on two lines

+

  \end{split}

+

  \\

+

  third equation

+

\end{gather}

+
+Equation groups with mutual alignment +

The align environment is used for two or more equations when +vertical alignment is desired; usually binary relations such as equal +signs are aligned (see Table ).

+

To have several equation columns side-by-side, use extra ampersands +to separate the columns:

+x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b +x&=y & X&=Y & a&=b+c\\ +x^{\prime }&=y^{\prime } & X^{\prime }&=Y^{\prime } & a^{\prime }&=b\\ +x+x^{\prime }&=y+y^{\prime } & X+X^{\prime }&=Y+Y^{\prime } & a^{\prime }b&=c^{\prime }b + +

\begin{align}

+

x&=y       & X&=Y       & a&=b+c\\

+

x'&=y'     & X'&=Y'     & a'&=b\\

+

x+x'&=y+y' & X+X'&=Y+Y' & a'b&=c'b

+

\end{align}

+

Line-by-line annotations on an equation can be done by judicious +application of text inside an align environment:

+x=y 1 -y 2 +y 3 -y 5 +y 8 -by()=y ' y * by()=y(0)y ' byAxiom1. +x& = y_1-y_2+y_3-y_5+y_8-\dots && \text{by (\ref {eq:C})}\\ +& = y^{\prime }\circ y^* && \text{by (\ref {eq:D})}\\ +& = y(0) y^{\prime } && \text{by Axiom 1.} + +

\begin{align}

+

x& = y_1-y_2+y_3-y_5+y_8-\dots

+

                    && \text{by \eqref{eq:C}}\\

+

 & = y'\circ y^*    && \text{by \eqref{eq:D}}\\

+

 & = y(0) y'        && \text {by Axiom 1.}

+

\end{align}

+

A variant environment alignat allows the horizontal space between +equations to be explicitly specified. This environment takes one argument, +the number of “equation columns”: count the maximum number of &s +in any row, add 1 and divide by 2.

+x=y 1 -y 2 +y 3 -y 5 +y 8 -by()=y ' y * by()=y(0)y ' byAxiom1. +x& = y_1-y_2+y_3-y_5+y_8-\dots &\quad & \text{by (\ref {eq:C})}\\ +& = y^{\prime }\circ y^* && \text{by (\ref {eq:D})}\\ +& = y(0) y^{\prime } && \text{by Axiom 1.} + +

\begin{alignat}{2}

+

x& = y_1-y_2+y_3-y_5+y_8-\dots

+

                  &\quad& \text{by \eqref{eq:C}}\\

+

 & = y'\circ y^*  && \text{by \eqref{eq:D}}\\

+

 & = y(0) y'      && \text {by Axiom 1.}

+

\end{alignat}

+
+Alignment building blocks +

Like equation, the multi-equation environments gather, +align, and alignat are designed to produce a structure +whose width is the full line width. This means, for example, that one +cannot readily add parentheses around the entire structure. But variants +gathered, aligned, and alignedat are provided whose +total width is the actual width of the contents; thus they can be used +as a component in a containing expression. E.g.,

+B ' =-×E,E ' =×B-4πj,Maxwell'sequations +\left.\begin{aligned} +B^{\prime }&=-\partial \times E,\\ +E^{\prime }&=\partial \times B - 4\pi j, +\end{aligned} +\right\rbrace +\qquad \text{Maxwell's equations} + +

\begin{equation*}

+

\left.\begin{aligned}

+

  B'&=-\partial\times E,\\

+

  E'&=\partial\times B - 4\pi j,

+

\end{aligned}

+

\right\}

+

\qquad \text{Maxwell's equations}

+

\end{equation*}

+

Like the array environment, these -ed variants also take +an optional [t] or [b] argument to specify vertical +positioning.

+

“Cases” constructions like the following are common in +mathematics:

+P r-j =0ifr-jisodd,r!(-1) (r-j)/2 ifr-jiseven. +P_{r-j}= +{\left\lbrace \begin{array}{ll} +0& \text{if $r-j$ is odd},\\ +r!\,(-1)^{(r-j)/2}& \text{if $r-j$ is even}. +\end{array}\right.} + +

and in the amsmath package there is a cases environment to +make them easy to write:

+

P_{r-j}=\begin{cases}

+

    0&  \text{if $r-j$ is odd},\\

+

    r!\,(-1)^{(r-j)/2}&  \text{if $r-j$ is even}.

+

  \end{cases}

+

Notice the use of text (cf. §) and the nested +math formulas.

+
+Adjusting tag placement +

Placing equation numbers can be a rather complex problem in multiline +displays. The environments of the amsmath package try hard to +avoid overprinting an equation number on the equation contents, if +necessary moving the number down or up to a separate line. Difficulties +in accurately calculating the profile of an equation can occasionally +result in number movement that doesn't look right. There is a +raisetag command provided to adjust the vertical position of the +current equation number, if it has been shifted away from its normal +position. To move a particular number up by six points, write +\raisetag{6pt}. This kind of adjustment is fine tuning like line +breaks and page breaks, and should therefore be left undone until your +document is nearly finalized, or you may end up redoing the fine tuning +several times to keep up with changing document contents.

+
+Vertical spacing and page breaks in multiline displays +

You can use the \\[\langle dimension\rangle ] command to get extra vertical +space between lines in all the amsmath displayed equation +environments, as is usual in . When the amsmath package is +in use page breaks between equation lines are normally disallowed; +the philosophy is that page breaks in such material should receive +individual attention from the author. To get an individual page break +inside a particular displayed equation, a displaybreak command is +provided. displaybreak is best placed immediately before the +\\ where it is to take effect. Like 's pagebreak, +displaybreak takes an optional argument between 0 and 4 denoting +the desirability of the pagebreak. \displaybreak[0] means “it is +permissible to break here” without encouraging a break; +displaybreak with no optional argument is the same as +\displaybreak[4] and forces a break.

+

If you prefer a strategy of letting page breaks fall where they may, +even in the middle of a multi-line equation, then you might put +allowdisplaybreaks[1] in the preamble of your document. An +optional argument 1–4 can be used for finer control: [1] means +allow page breaks, but avoid them as much as possible; values of 2,3,4 +mean increasing permissiveness. When display breaks are enabled with +allowdisplaybreaks, the \\* command can be used to prohibit a +pagebreak after a given line, as usual.

+

Note: Certain equation environments wrap their contents in an +unbreakable box, with the consequence that neither displaybreak nor +allowdisplaybreaks will have any effect on them. These include +split, aligned, gathered, and alignedat. +

+
+Interrupting a display +

The command intertext is used for a short interjection of one or +two lines of text in the middle of a +multiple-line display structure (see also the text command in +§). Its salient feature is preservation of the alignment, +which would not happen if you simply ended the display and then started +it up again afterwards. intertext may only appear right after a +\\ or \\* command. Notice the position of the word “and” in +this example.

+A 1 =N 0 (λ;Ω ' )-ϕ(λ;Ω ' ),A 2 =ϕ(λ;Ω ' )-ϕ(λ;Ω),andA 3 =𝒩(λ;ω). +A_1&=N_0(\lambda ;\Omega ^{\prime })-\phi (\lambda ;\Omega ^{\prime }),\\ +A_2&=\phi (\lambda ;\Omega ^{\prime })-\phi (\lambda ;\Omega ),\\ +\multicolumn{2}{l}{\text{and}}\\ +A_3&=\mathcal {N}(\lambda ;\omega ). + +

\begin{align}

+

A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\

+

A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\

+

\intertext{and}

+

A_3&=\mathcal{N}(\lambda;\omega).

+

\end{align}

+
+Equation numbering +Numbering hierarchy +

In if you wanted to have equations numbered within +sections—that is, have +equation numbers (1.1), (1.2), ..., (2.1), (2.2), +..., in sections 1, 2, and so forth—you could redefine +theequation as suggested in the manual §6.3, §C.8.4:

+

\renewcommand{\theequation}{\thesection.\arabic{equation}}

+

This works pretty well, except that the equation counter won't be reset +to zero at the beginning of a new section or chapter, unless you do it +yourself using setcounter. To make this a little more convenient, +the amsmath package provides a command numberwithin. To have equation numbering tied to +section numbering, with automatic reset of the equation counter, write

+

\numberwithin{equation}{section}

+

As its name implies, the numberwithin command can be applied to +any counter, not just the equation counter.

+
+Cross references to equation numbers +

To make cross-references to equations easier, an eqref +command is provided. This +automatically supplies the parentheses around the equation number. I.e., +if \ref{abc} produces 3.2 then \eqref{abc} produces +(3.2).

+
+Subordinate numbering sequences +

The amsmath package provides also a subequations +environment to make it +easy to number equations in a particular group with a subordinate +numbering scheme. For example

+

\begin{subequations}

+

...

+

\end{subequations}

+

causes all numbered equations within that part of the document to be +numbered (4.9a) (4.9b) (4.9c) ..., if the preceding numbered +equation was (4.8). A label command immediately after +\begin{subequations} will produce a ref of the parent +number 4.9, not 4.9a. The counters used by the subequations +environment are parentequation and equation and +addtocounter, setcounter, value, etc., can be applied +as usual to those counter names. To get anything other than lowercase +letters for the subordinate numbers, use standard methods for +changing numbering style §6.3, §C.8.4. For example, +redefining theequation as follows will produce roman numerals.

+

\begin{subequations}

+

\renewcommand{\theequation}{\theparentequation \roman{equation}}

+

...

+
+Miscellaneous mathematical features + +Matrices +

The amsmath package provides some environments for +matrices beyond the basic array environment of +. The pmatrix, bmatrix, Bmatrix, vmatrix +and Vmatrix have (respectively) ()(\,), [][\,], {}\lbrace \,\rbrace , +||\vert \,\vert , and +\Vert \,\Vert delimiters built in. For naming consistency there is a +matrix environment sans delimiters. This is not entirely redundant +with the array environment; the matrix environments all use more +economical horizontal spacing than the rather prodigal spacing of the +array environment. Also, unlike the array environment, you +don't have to give column specifications for any of the matrix +environments; by default you can have up to 10 centered columns.More precisely: The maximum number of columns in a matrix is determined +by the counter MaxMatrixCols (normal value = 10), which you can change +if necessary using 's setcounter or addtocounter +commands. (If you need left or right alignment in a column or other special +formats you must resort to array.)

+

To produce a small matrix suitable for use in text, there is a +smallmatrix environment (e.g., +abcd +\bigl ( {\begin{matrix} +a&b\\ c&d +\end{matrix}} \bigr ) +) +that comes closer to fitting within a single text line than a normal +matrix. Delimiters must be provided; there are no p,b,B,v,V +versions of smallmatrix. The above example was produced by

+

\bigl( \begin{smallmatrix}

+

  a&b\\ c&d

+

\end{smallmatrix} \bigr)

+hdotsfor

{\langle number\rangle } produces a row of dots in a +matrix spanning the given number of +columns. For example,

+

abcde\begin{matrix} a&b&c&d\\ +e&\dots &\dots &\dots \end{matrix} +

      

\begin{matrix} a&b&c&d\\

+

e&\hdotsfor{3} \end{matrix}

+

+

The spacing of the dots can be varied through use of a square-bracket +option, for example, \hdotsfor[1.5]{3}. The number in square brackets +will be used as a multiplier (i.e., the normal value is 1.0).

+D 1 t-a 12 t 2 -a 1n t n -a 21 t 1 D 2 t-a 2n t n -a n1 t 1 -a n2 t 2 D n t, +\begin{pmatrix} D_1t&-a_{12}t_2&\dots &-a_{1n}t_n\\ +-a_{21}t_1&D_2t&\dots &-a_{2n}t_n\\ +\dots &\dots &\dots &\dots \\ +-a_{n1}t_1&-a_{n2}t_2&\dots &D_nt\end{pmatrix}, + +

\begin{pmatrix} D_1t&-a_{12}t_2&\dots&-a_{1n}t_n\\

+

-a_{21}t_1&D_2t&\dots&-a_{2n}t_n\\

+

\hdotsfor[2]{4}\\

+

-a_{n1}t_1&-a_{n2}t_2&\dots&D_nt\end{pmatrix}

+
+Math spacing commands +

The amsmath package slightly extends the set of math +spacing commands, as shown below. +Both the spelled-out and abbreviated forms of these commands are robust, +and they can also be used outside of math.

+Abbrev. +Spelled out +Example +Abbrev. +Spelled out +Example + +no space +\mathord {\Rightarrow \hspace{-0.55542pt}}\mathord {\hspace{-0.55542pt}\Leftarrow } + +no space +\mathord {\Rightarrow \hspace{-0.55542pt}}\mathord {\hspace{-0.55542pt}\Leftarrow } +  +thinspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\,\mathord {\hspace{-0.55542pt}\Leftarrow } +! +negthinspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\!\mathord {\hspace{-0.55542pt}\Leftarrow } +: +medspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\:\mathord {\hspace{-0.55542pt}\Leftarrow } + +negmedspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\hspace{0.0pt}\mathord {\hspace{-0.55542pt}\Leftarrow } +; +thickspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\;\mathord {\hspace{-0.55542pt}\Leftarrow } + +negthickspace +\mathord {\Rightarrow \hspace{-0.55542pt}}\hspace{0.0pt}\mathord {\hspace{-0.55542pt}\Leftarrow } + +quad +\mathord {\Rightarrow \hspace{-0.55542pt}}\quad \mathord {\hspace{-0.55542pt}\Leftarrow } + +qquad +\mathord {\Rightarrow \hspace{-0.55542pt}}\qquad \mathord {\hspace{-0.55542pt}\Leftarrow } +

+For the greatest possible control over math spacing, use mspace +and `math units'. One math unit, or mu, is equal to 1/18 em. Thus to +get a negative quad you could write \mspace{-18.0mu}.

+
+Dots +

For preferred placement of ellipsis dots (raised or on-line) in various +contexts there is no general consensus. It may therefore be considered a +matter of taste. By using the semantically oriented commands

+ +

dotsc for “dots with commas”

+
+

dotsb for “dots with binary operators/relations”

+
+

dotsm for “multiplication dots”

+
+

dotsi for “dots with integrals”

+
+

dotso for “other dots” (none of the above)

+
+

instead of ldots and cdots, you make it possible for your +document to be adapted to different conventions on the fly, in case (for +example) you have to submit it to a publisher who insists on following +house tradition in this respect. The default treatment for the various +kinds follows American Mathematical Society conventions:

+

Then we have the series $A_1, A_2,

+

\dotsc$, the regional sum $A_1

+

+A_2 +\dotsb $, the orthogonal

+

product $A_1 A_2 \dotsm $, and

+

the infinite integral

+

\[\int_{A_1}\int_{A_2}\dotsi\].

+

+

Then we have the series A 1 ,A 2 ,A_1,A_2,\cdots , +the regional sum A 1 +A 2 +A_1+A_2+\cdots , +the orthogonal product A 1 A 2 A_1A_2\cdots , +and the infinite integral

+ A 1 A 2 .\int _{A_1}\int _{A_2}\cdots . +

+

+ +Nonbreaking dashes +

A command nobreakdash is provided to suppress the possibility +of a linebreak after the following hyphen or dash. For example, if you +write `pages 1–9' as pages 1\nobreakdash--9 then a linebreak will +never occur between the dash and the 9. You can also use +nobreakdash to prevent undesirable hyphenations in combinations +like $p$-adic. For frequent use, it's advisable to make abbreviations, +e.g.,

+

\newcommand{\p}{$p$\nobreakdash}% for "\p-adic"

+

\newcommand{\Ndash}{\nobreakdash--}% for "pages 1\Ndash 9"

+

%    For "\n dimensional" ("n-dimensional"):

+

\newcommand{\n}[1]{$n$\nobreakdash-\hspace{0pt}}

+

The last example shows how to prohibit a linebreak after the hyphen but +allow normal hyphenation in the following word. (It suffices to add a +zero-width space after the hyphen.)

+
+Accents in math +

In ordinary the placement of the second accent in doubled math +accents is often poor. With the amsmath package you +will get improved placement of the second accent: +A ^ ^\hat{\hat{A}} (hat{\hat{A}}).

+

The commands dddot and ddddot are available to produce triple +and quadruple dot accents in addition to the dot and ddot +accents already available in .

+

To get a superscripted hat or tilde character, load the amsxtra +package and use sphat or sptilde. Usage is A\sphat +(note the absence of the ^ character).

+

To place an arbitrary symbol in math accent position, or to get under +accents, see the accents package by Javier Bezos.

+
+Roots +

In ordinary the placement of root indices is sometimes not so +good: k β\@root \beta \of {k} (\sqrt[\beta]{k}). In the +amsmath package leftroot and uproot allow you to adjust +the position of the root:

+

  \sqrt[\leftroot{-2}\uproot{2}\beta]{k}

+

will move the beta up and to the right: +k β\@root \beta \of {k}. The negative argument used +with leftroot moves the β\beta to the right. The units are a small +amount that is a useful size for such adjustments.

+
+Boxed formulas +

The command boxed puts a box around its +argument, like fbox except that the contents are in math mode:

+ηC(δ(η)+Λ M (0,δ)) +\boxed{\eta \le C(\delta (\eta ) +\Lambda _M(0,\delta ))} + +

  \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}

+
+Over and under arrows +

Basic provides overrightarrow and overleftarrow +commands. Some additional over and under arrow commands are provided +by the amsmath package to extend the set:

+overleftarrow +underleftarrow +overrightarrow +underrightarrow +overleftrightarrow +underleftrightarrow +
+
+Extensible arrows +xleftarrow

and xrightarrow produce +arrows that extend automatically to accommodate +unusually wide subscripts or superscripts. These commands take one +optional argument (the subscript) and one mandatory argument (the +superscript, possibly empty):

+A n+μ-1B T n±i-1C +A\xleftarrow{}B \xrightarrow[T]{n\pm i-1}C + +

  \xleftarrow{n+\mu-1}\quad \xrightarrow[T]{n\pm i-1}

+
+Affixing symbols to other symbols +

provides stackrel for placing a +superscript above a binary relation. +In the amsmath package there are somewhat more general commands, +overset and underset, that can be used to place one symbol +above or below another symbol, whether it's a relation or something +else. The input \overset{*}{X} will place a superscript-size ** above +the XX: X *\overset{*}{X}; underset is the analog for adding a +symbol underneath.

+

See also the description of sideset in §.

+
+Fractions and related constructions +The frac, dfrac, and tfrac commands +

The frac command, which is in the basic command set of +, takes two arguments—numerator and +denominator—and typesets them in normal fraction form. The +amsmath package provides also dfrac and tfrac as +convenient abbreviations for {\displaystyle\frac ... } +andtextstyledisplaystyle {\textstyle\frac ... }.

+1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f) +\frac{1}{k}\log _2 c(f)\quad \tfrac{1}{k}\log _2 c(f)\quad \sqrt{\frac{1}{k}\log _2 c(f)}\quad \sqrt{\dfrac{1}{k}\log _2 c(f)} + +

\begin{equation}

+

\frac{1}{k}\log_2 c(f)\;\tfrac{1}{k}\log_2 c(f)\;

+

\sqrt{\frac{1}{k}\log_2 c(f)}\;\sqrt{\dfrac{1}{k}\log_2 c(f)}

+

\end{equation}

+
+The binom, dbinom, and tbinom commands +

For binomial expressions such as n k\binom{n}{k} +amsmath has binom, dbinom and tbinom:

+2 k -k 12 k-1 +k 22 k-2 +2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2} + +

2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}

+
+The genfrac command +

The capabilities of frac, binom, and their variants are +subsumed by a generalized fraction command genfrac with six +arguments. The last two correspond to frac's numerator and +denominator; the first two are optional delimiters (as seen in +binom); the third is a line thickness override (binom uses +this to set the fraction line thickness to 0—i.e., invisible); and +the fourth argument is a mathstyle override: integer values 0–3 select +respectively displaystyle, textstyle, scriptstyle, and +scriptscriptstyle. If the third argument is left empty, the line +thickness defaults to `normal'.

+

\genfrac{left-delim}{right-delim}{thickness}{mathstyle}{numerator}{denominator}

+

To illustrate, here is how frac, tfrac, and +binom might be defined.

+

\newcommand{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}}

+

\newcommand{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}}

+

\newcommand{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}}

+

If you find yourself repeatedly using genfrac throughout a document +for a particular notation, you will do yourself a favor (and your +publisher) if you define a meaningfully-named abbreviation for that +notation, along the lines of frac and binom.

+

The primitive generalized fraction commands over, overwithdelims, +atop, atopwithdelims, above, abovewithdelims produce +warning messages if used with the amsmath package, for reasons +discussed in technote.tex.

+
+Continued fractions +

The continued fraction

+1 2+1 2+1 2+ +\cfrac{1}{\sqrt{2}+ +\cfrac{1}{\sqrt{2}+ +\cfrac{1}{\sqrt{2}+\cdots }}} + +

can be obtained by typing +

+

\cfrac{1}{\sqrt{2}+

+

 \cfrac{1}{\sqrt{2}+

+

  \cfrac{1}{\sqrt{2}+\dotsb

+

}}}

+

This produces better-looking results than straightforward use of +frac. Left or right placement of any of the numerators is +accomplished by using cfrac[l] or cfrac[r] instead of +cfrac.

+
+Smash options +

The command smash is used to typeset a subformula with an effective height and depth of zero, which is sometimes +useful in adjusting the subformula's position with respect to adjacent +symbols. With the amsmath package smash has optional +arguments t and b, because occasionally it is advantageous to be +able to “smash” only the top or only the bottom of something while +retaining the natural depth or height. For example, when adjacent +radical symbols are unevenly sized or positioned because of differences +in the height and depth of their contents, smash can be employed to +make them more consistent. Compare +x+y+z\sqrt{x}+\sqrt{y}+\sqrt{z} and x+y+z\sqrt{x}+\sqrt{\smash[b]{y}}+\sqrt{z}, +where the latter was produced by +$\sqrt{x} + +\sqrt{+\smash[b]{y}} + \sqrt{z}$.

+
+Delimiters +Delimiter sizes +

The automatic delimiter sizing done by left and right has two +limitations: First, it is applied mechanically to produce delimiters +large enough to encompass the largest contained item, and second, the +range of sizes is not even approximately continuous but has fairly large +quantum jumps. This means that a math fragment that is infinitesimally +too large for a given delimiter size will get the next larger size, a +jump of 3pt or so in normal-sized text. There are two or three +situations where the delimiter size is commonly adjusted, using a set of +commands that have `big' in their names.

+Delimiter +text +left +bigl +Bigl +biggl +Biggl +size +size +right +bigr +Bigr +biggr +Biggr +Result +(b)(c d)\displaystyle (b)(\frac{c}{d}) +bc d\displaystyle \left(b\right)\left(\frac{c}{d}\right) +bc d\displaystyle \bigl (b\bigr )\bigl (\frac{c}{d}\bigr ) +bc d\displaystyle \Bigl (b\Bigr )\Bigl (\frac{c}{d}\Bigr ) +bc d\displaystyle \biggl (b\biggr )\biggl (\frac{c}{d}\biggr ) +bc d\displaystyle \Biggl (b\Biggr )\Biggl (\frac{c}{d}\Biggr ) +

+The first kind of situation is a cumulative operator with limits above +and below. With left and right the delimiters usually turn out +larger than necessary, and using the Big or bigg +sizes +instead gives better results:

+ i a i j x ij p 1/p versus i a i j x ij p 1/p +\left[\sum _i a_i\left|\sum _j x_{ij}\right|^p\right]^{1/p} +\quad \text{versus}\quad \biggl [\sum _i a_i\Bigl \vert \sum _j x_{ij}\Bigr \vert ^p\biggr ]^{1/p} + +

\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p}

+

The second kind of situation is clustered pairs of delimiters where +left and right make them all the same size (because that is +adequate to cover the encompassed material) but what you really want +is to make some of the delimiters slightly larger to make the nesting +easier to see.

+(a 1 b 1 )-(a 2 b 2 )(a 2 b 1 )+(a 1 b 2 )versus(a 1 b 1 ) - (a 2 b 2 )(a 2 b 1 ) + (a 1 b 2 ) +\left((a_1 b_1) - (a_2 b_2)\right) +\left((a_2 b_1) + (a_1 b_2)\right) +\quad \text{versus}\quad \bigl ((a_1 b_1) - (a_2 b_2)\bigr ) +\bigl ((a_2 b_1) + (a_1 b_2)\bigr ) + +

\left((a_1 b_1) - (a_2 b_2)\right)

+

\left((a_2 b_1) + (a_1 b_2)\right)

+

\quad\text{versus}\quad

+

\bigl((a_1 b_1) - (a_2 b_2)\bigr)

+

\bigl((a_2 b_1) + (a_1 b_2)\bigr)

+

The third kind of situation is a slightly oversize object in running +text, such as b ' d ' \left|\frac{b^{\prime }}{d^{\prime }}\right| where the +delimiters produced by left and right cause too much line +spreading. In that case bigl and bigr can be used to produce +delimiters that are slightly larger than the base size but still able to +fit within the normal line spacing: +b ' d ' \bigl \vert \frac{b^{\prime }}{d^{\prime }}\bigr \vert .

+

In ordinary big, bigg, Big, and Bigg +delimiters aren't scaled properly over the full range of font +sizes. With the amsmath package they are.

+
+Vertical bar notations +

The amsmath package provides commands lvert, rvert, +lVert, rVert (compare langle, rangle) to address the +problem of overloading for the vert bar character |. This +character is currently used in documents to represent a wide +variety of mathematical objects: the `divides' relation in a +number-theory expression like p|qp\vert q, or the absolute-value +operation |z|\vert z\vert , or the `such that' condition in set +notation, or the `evaluated at' notation f ζ (t)| t=0 f_\zeta (t)\bigr \vert _{t=0}. +The multiplicity of uses in itself is not so bad; what is bad, however, +is that fact that not all of the uses take the same typographical +treatment, and that the complex discriminatory powers of a knowledgeable +reader cannot be replicated in computer processing of mathematical +documents. It is recommended therefore that there should be a one-to-one +correspondence in any given document between the vert bar character +| and a selected mathematical notation, and similarly for the +double-bar command |. This immediately +rules out the use of | +and | for delimiters, because left and right +delimiters are distinct usages that do not relate in the same way to +adjacent symbols; recommended practice is therefore to define suitable +commands in the document preamble for any paired-delimiter use of vert +bar symbols:

+

\providecommand{\abs}[1]{\lvert#1\rvert}

+

\providecommand{\norm}[1]{\lVert#1\rVert}

+

whereupon the document would contain \abs{z} to produce |z|\vert z\vert and \norm{v} to produce v\Vert v\Vert .

+
+Operator names + +Defining new operator names +

Math functions such as log\log , sin\sin , and lim\lim are +traditionally typeset in roman type to make them visually more distinct +from one-letter math variables, which are set in math italic. The more +common ones have predefined names, log, sin, lim, and so +forth, but new ones come up all the time in mathematical papers, so the +amsmath package provides a general mechanism for defining new +`operator names'. To define a math function xxx to work like +sin, you write

+

\DeclareMathOperator{\xxx}{xxx}

+

whereupon ensuing uses of xxx will produce xxx in the +proper font and automatically add proper spacing on either side when necessary, so that you +get AxxxBA\operatorname{xxx}B instead of A xxx BA\mathrm {xxx}B. In the second argument of +DeclareMathOperator (the name text), a pseudo-text mode prevails: +the hyphen character - will print as a text hyphen rather than a +minus sign and an asterisk * will print as a raised text asterisk +instead of a centered math star. (Compare +a-b*c and a-b*ca-b*c.) But otherwise the name +text is printed in math mode, so that you can use, e.g., subscripts and +superscripts there.

+

If the new operator should have subscripts and superscripts placed in +`limits' position above and below as with lim\lim , sup\sup , or max\max , use +the * form of the DeclareMathOperator command:

+

\DeclareMathOperator*{\Lim}{Lim}

+

See also the discussion of subscript placement in +Section .

+

The following operator names are predefined:

+arccos +arccos\arccos +deg +deg\deg +lg +lg\lg +projlim +proj lim\projlim +arcsin +arcsin\arcsin +det +det\det +lim +lim\lim +sec +sec\sec +arctan +arctan\arctan +dim +dim\dim +liminf +lim inf\liminf +sin +sin\sin +arg +arg\arg +exp +exp\exp +limsup +lim sup\limsup +sinh +sinh\sinh +cos +cos\cos +gcd +gcd\gcd +ln +ln\ln +sup +sup\sup +cosh +cosh\cosh +hom +hom\hom +log +log\log +tan +tan\tan +cot +cot\cot +inf +inf\inf +max +max\max +tanh +tanh\tanh +coth +coth\coth +injlim +inj lim\injlim +min +min\min +csc +csc\csc +ker +ker\ker +Pr +Pr\Pr +
+varlimsup +lim \displaystyle \varlimsup +varinjlim +lim \displaystyle \varinjlim +varliminf +lim _\displaystyle \varliminf +varprojlim +lim \displaystyle \varprojlim +
+

There is also a command operatorname such that using

+

\operatorname{abc}

+

in a math formula is equivalent to a use of abc defined by +DeclareMathOperator. This may be occasionally useful for +constructing more complex notation or other purposes. (Use the variant +operatorname* to get limits.)

+
+mod and its relatives +

Commands mod, bmod, pmod, pod are provided to deal +with the special spacing conventions of “mod” notation. bmod and +pmod are available in , but with the amsmath package +the spacing of pmod will adjust to a smaller value if it's used in +a non-display-mode formula. mod and pod are variants of +pmod preferred by some authors; mod omits the parentheses, +whereas pod omits the “mod” and retains the parentheses.

+gcd(n,mmodn);xy(modb);xymodc;xy(d) +\gcd (n,m\bmod n);\quad x\equiv y\pmod {b}; +\quad x\equiv y\mod {c};\quad x\equiv y\hspace{10.0pt}(d) + +

\gcd(n,m\bmod n);\quad x\equiv y\pmod b;

+

\quad x\equiv y\mod c;\quad x\equiv y\pod d

+
+The text command +

The main use of the command text is for words or +phrases in a display. It is very +similar to the command mbox in its effects, but has a +couple of advantages. If you want a word or phrase of text in a +subscript, you can type ..._{\text{word or phrase}}, which is slightly +easier than the mbox equivalent: ..._{\mbox{\scriptsize word +or phrase}}. The other advantage is the more descriptive name.

+f [x i-1 ,x i ] ismonotonic,i=1,,c+1 +f_{[x_{i-1},x_i]} \text{ is monotonic,} +\quad i = 1,\dots ,c+1 + +

f_{[x_{i-1},x_i]} \text{ is monotonic,}

+

\quad i = 1,\dots,c+1

+
+Integrals and sums + +Multiline subscripts and superscripts +

The substack command can be used to produce a multiline subscript +or superscript: for example

+

\sum_{\substack{

+

         0\le i\le m\\

+

         0<j<n}}

+

  P(i,j)

+

+ 0im0<j<n P(i,j)\displaystyle \sum _{\begin{array}{c}0\le i\le m\\ 0<j<n\end{array}} P(i,j) +

+A slightly more generalized form is the subarray environment which +allows you to specify that each line should be left-aligned instead of +centered, as here:

+

\sum_{\begin{subarray}{l}

+

        i\in\Lambda\\ 0<j<n

+

      \end{subarray}}

+

 P(i,j)

+

+ iΛ0<j<n P(i,j)\displaystyle \sum _{{{\scriptstyle \begin{matrix} +i\in \Lambda \\ 0<j<n +\end{matrix}}}} +P(i,j) +

+
+The sideset command +

There's also a command called sideset, for a rather special +purpose: putting symbols at the subscript and +superscript corners of a +large operator symbol such as \sum or \prod . Note: this +command is not designed to be applied to anything other than sum-class symbols. The prime +example is the case when you want to put a prime on a sum symbol. If +there are no limits above or below the sum, you could just use +nolimits: here's +\sum\nolimits' E_n in display mode:

+ ' E n +\sum \nolimits ^{\prime } E_n + +

If, however, you want not only the prime but also something below or +above the sum symbol, it's not so easy—indeed, without +sideset, it would be downright difficult. With sideset, you +can write

+

\sideset{}{'}

+

  \sum_{n<k,\;\text{$n$ odd}} nE_n

+

+' n<k,nodd nE n \displaystyle \mathop {\mmlmultiscripts{\sum {\mmlnone }{\prime }}}\limits _{n<k,\;\text{$n$ odd}} nE_n + +

+The extra pair of empty braces is explained by the fact that +sideset has the capability of putting an extra symbol or symbols at +each corner of a large operator; to put an asterisk at each corner of a +product symbol, you would type

+

\sideset{_*^*}{_*^*}\prod

+

+****\displaystyle \mathop {\mmlmultiscripts{\prod {*}{*}\mmlprescripts {*}{*}}}\limits +

+
+Placement of subscripts and limits +

The default positioning for subscripts depends on the +base symbol involved. The default for sum-class symbols is +`displaylimits' positioning: When a sum-class symbol appears +in a displayed formula, subscript and superscript are placed in `limits' +position above and below, but in an inline formula, they are placed to +the side, to avoid unsightly and wasteful spreading of the +surrounding text lines. +The default for integral-class symbols is to have sub- and +superscripts always to the side, even in displayed formulas. +(See the discussion of the intlimits and related options in +Section .)

+

Operator names such as sin\sin or lim\lim may have either `displaylimits' +or `limits' positioning depending on how they were defined. The standard +operator names are defined according to normal mathematical usage.

+

The commands limits and nolimits can be used to override the +normal behavior of a base symbol:

+ X , A ,lim _ n +\sum \nolimits _X,\qquad \iint \limits _{A}, +\qquad \varliminf \nolimits _{n\rightarrow \infty } + +

To define a command whose subscripts follow the +same `displaylimits' behavior as sum, put +displaylimits at the tail end of the definition. When multiple +instances of limits, nolimits, or displaylimits occur +consecutively, the last one takes precedence.

+
+Multiple integral signs +iint

, iiint, and iiiint give multiple integral +signs with the spacing between them nicely +adjusted, in both text and display style. idotsint is an extension +of the same idea that gives two integral signs with dots between them.

+ A f(x,y)dxdy A f(x,y,z)dxdydz A f(w,x,y,z)dwdxdydz... A f(x 1 ,,x k ) +\iint \limits _A f(x,y)\,dx\,dy\qquad \iiint \limits _A +f(x,y,z)\,dx\,dy\,dz\\ +\iiiint \limits _A +f(w,x,y,z)\,dw\,dx\,dy\,dz\qquad \idotsint \limits _A f(x_1,\dots ,x_k) + +
+Commutative diagrams +

Some commutative diagram commands like the ones in are +available as a separate package, amscd. For complex commutative +diagrams authors will need to turn to more comprehensive packages like +kuvio or , but for simple diagrams without diagonal +arrows the amscd commands +may be more convenient. Here is one example.

+S 𝒲 Λ T jTEndPEndP(ST)/I=(ZT)/J +{\begin{matrix} +S^{{\mathcal {W}}_\Lambda }\otimes T &\xrightarrow{}& T\\ + +\downarrow +&& +\mathbox{mphantom}{\scriptstyle \operatorname{End}P}\downarrow {\scriptstyle \operatorname{End}P} +&&\\ +(S\otimes T)/I &=& (Z\otimes T)/J +\end{matrix}} + +

\begin{CD}

+

S^{{\mathcal{W}}_\Lambda}\otimes T   @>j>>   T\\

+

@VVV                                    @VV{\End P}V\\

+

(S\otimes T)/I                  @=      (Z\otimes T)/J

+

\end{CD}

+

In the CD environment the commands @>>>, +@<<<, @VVV, and @AAA give respectively right, left, down, and up +arrows. For the horizontal arrows, material between the first and second +> or < symbols will be typeset as a superscript, and material +between the second and third will be typeset as a subscript. Similarly, +material between the first and second or second and third As or Vs +of vertical arrows will be typeset as left or right “sidescripts”. +The commands @= and @| give horizontal and vertical double lines. +A “null arrow” command @. can be used instead of a visible arrow +to fill out an array where needed.

+
+Using math fonts + +Introduction +

For more comprehensive information on font use in , see the + font guide (fntguide.tex) or The +Companion . The basic set of math font commands in includes +mathbf, mathrm, mathcal, mathsf, mathtt, +mathit. Additional math alphabet commands such as +mathbb for blackboard bold, mathfrak for Fraktur, and +mathscr for Euler script are available through the packages +amsfonts and euscript (distributed separately).

+
+Recommended use of math font commands +

If you find yourself employing math font commands frequently in your +document, you might wish that they had shorter names, such as mb +instead of mathbf. Of course, there is nothing to keep you from +providing such abbreviations for yourself by suitable newcommand +statements. But for to provide shorter names would actually be a +disservice to authors, as that would obscure a much better alternative: +defining custom command names derived from the names of the underlying +mathematical objects, rather than from the names of the fonts used to +distinguish the objects. For example, if you are using bold to indicate +vectors, then you will be better served in the long run if you define a +`vector' command instead of a `math-bold' command:

+

  \newcommand{\vect}[1]{\mathbf{#1}}

+

you can write \vect{a} + \vect{b} to produce 𝐚+𝐛\mathbf {a} + +\mathbf {b}. +If you decide several months down the road that you want to use the bold +font for some other purpose, and mark vectors by a small over-arrow +instead, then you can put the change into effect merely by changing the +definition of vect; otherwise you would have to replace all +occurrences of mathbf throughout your document, perhaps even +needing to inspect each one to see whether it is indeed +an instance of a vector.

+

It can also be useful to assign distinct +command names for different letters of a particular font:

+

\DeclareSymbolFont{AMSb}{U}{msb}{m}{n}% or use amsfonts package

+

\DeclareMathSymbol{\C}{\mathalpha}{AMSb}{"43}

+

\DeclareMathSymbol{\R}{\mathalpha}{AMSb}{"52}

+

These statements would define the commands C and R to produce +blackboard-bold letters from the `AMSb' math symbols font. If you refer +often to thecomplex numbers or real numbers in your document, you +might find this method more convenient than (let's say) defining a +field command and writing\field{C}, \field{R}. But for +maximum flexibility and control, define such a field command and +then define C and R in terms of that +command:mathbb

+

\usepackage{amsfonts}% to get the \mathbb alphabet

+

\newcommand{\field}[1]{\mathbb{#1}}

+

\newcommand{\C}{\field{C}}

+

\newcommand{\R}{\field{R}}

+
+Bold math symbols +

The mathbf command is commonly used to obtain bold Latin letters in +math, but for most other kinds of math symbols it has no effect, or its +effects depend unreliably on the set of math fonts that are in use. For +example, writing

+

\Delta \mathbf{\Delta}\mathbf{+}\delta \mathbf{\delta}

+

produces ΔΔ+δδ\Delta \mathbf {\Delta }\mathbf {+}\delta \mathbf {\delta }; the mathbf has no effect on the plus +sign or the small delta.

+

The amsmath package therefore provides two additional commands, +boldsymbol and pmb, that can be applied to other kinds of math +symbols. boldsymbol can be used for a math symbol that remains +unaffected by mathbf if (and only if) your current math font set +includes a bold version of that symbol. pmb can be used as a last +resort for any math symbols that do not have a true bold version +provided by your set of math fonts; “pmb” stands for “poor man's +bold” and the command works by typesetting multiple copies of the symbol +with slight offsets. The quality of the output is inferior, especially +for symbols that contain any hairline strokes. When the standard default set of + math fonts are in use (Computer Modern), the only symbols that +are likely to require pmb are large operator symbols like sum, +extended delimiter symbols, or the extra math symbols provided by +the amssymb package .

+

The following formula shows some of the results that are possible:

+

A_\infty + \pi A_0

+

\sim \mathbf{A}_{\boldsymbol{\infty}} \boldsymbol{+}

+

  \boldsymbol{\pi} \mathbf{A}_{\boldsymbol{0}}

+

\sim\pmb{A}_{\pmb{\infty}} \pmb{+}\pmb{\pi} \pmb{A}_{\pmb{0}}

+A +πA 0 𝐀 +π𝐀 0 A +πA 0 +A_\infty + \pi A_0 +\sim \mathbf {A}_{\infty } + +\pi \mathbf {A}_{0} +\sim A_{\infty } +\pi A_{0} + +

If you want to use only the boldsymbol command without loading the +whole amsmath package, the bm package is recommended (this +is a standard package, not an AMS package; you probably have it +already if you have a 1997 or newer version of ).

+
+Italic Greek letters +

For italic versions of the capital Greek letters, the following commands +are provided:

+varGamma +Γ\Gamma +varSigma +Σ\Sigma +varDelta +Δ\Delta +varUpsilon +ϒ\Upsilon +varTheta +Θ\Theta +varPhi +Φ\Phi +varLambda +Λ\Lambda +varPsi +Ψ\Psi +varXi +Ξ\Xi +varOmega +Ω\Omega +varPi +Π\Pi +
+
+Error messages and output problems + +General remarks +

This is a supplement to Chapter 8 of the manual (first +edition: Chapter 6). For the reader's convenience, the set of error +messages discussed here overlaps somewhat with the set in that chapter, +but please be aware that we don't provide exhaustive coverage here. +The error messages are arranged in alphabetical order, disregarding +unimportant text such as ! LaTeX Error: at the beginning, and +nonalphabetical characters such as \\. Where examples are given, we +show also the help messages that appear on screen when you respond to an +error message prompt by entering h.

+

There is also a section discussing some output errors, i.e., instances +where the printed document has something wrong but there was no +error during typesetting.

+
+Error messages +\beginsplit won't work here.

Example:

+

! Package amsmath Error: \begin{split} won't work here.

+

 ...

+

 

+

l.8 \begin{split}

+

 

+

? h

+

\Did you forget a preceding \begin{equation}?

+

If not, perhaps the `aligned' environment is what you want.

+

?

+

Explanation: The split environment does not construct a stand-alone displayed +equation; it needs to be used within some other environment such as +equation or gather.

+
Extra & on this line

Example:

+

! Package amsmath Error: Extra & on this line.

+

 

+

See the amsmath package documentation for explanation.

+

Type  H <return>  for immediate help.

+

 ...

+

 

+

l.9 \end{alignat}

+

 

+

? h

+

\An extra & here is so disastrous that you should probably exit

+

 and fix things up.

+

?

+

Explanation: In an alignat structure the number of alignment points per line +is dictated by the numeric argument given after \begin{alignat}. +If you use more alignment points in a line it is assumed that you +accidentally left out a newline command \\ and the above error is +issued.

+
Improper argument for math accent

Example:

+

! Package amsmath Error: Improper argument for math accent:

+

(amsmath)                Extra braces must be added to

+

(amsmath)                prevent wrong output.

+

 

+

See the amsmath package documentation for explanation.

+

Type  H <return>  for immediate help.

+

 ...

+

 

+

l.415 \tilde k_{\lambda_j} = P_{\tilde \mathcal

+

                                               {M}}

+

?

+

Explanation: Non-simple arguments for any command should be enclosed in +braces. In this example extra braces are needed as follows:

+

... P_{\tilde{\mathcal{M}}}

+
Font OMX/cmex/m/n/7=cmex7 not loadable ...

Example:

+

! Font OMX/cmex/m/n/7=cmex7 not loadable: Metric (TFM) file not found.

+

<to be read again>

+

                   relax

+

l.8 $a

+

      b+b^2$

+

? h

+

I wasn't able to read the size data for this font,

+

so I will ignore the font specification.

+

[Wizards can fix TFM files using TFtoPL/PLtoTF.]

+

You might try inserting a different font spec;

+

e.g., type `I\font<same font id>=<substitute font name>'.

+

?

+

Explanation: Certain extra sizes of some Computer Modern fonts that were formerly +available mainly through the AMSFonts +distribution are considered part of standard (as of June 1994): +cmex79, cmmib59, and +cmbsy59. If these extra sizes are missing on your +system, you should try first to get them from the source where you +obtained . If that fails, you could try getting the fonts from +CTAN (e.g., in the form of Metafont source +files, directory /tex-archive/fonts/latex/mf, or in PostScript +Type 1 format, directory +/tex-archive/fonts/cm/ps-type1/bakoma).

+

If the font name begins with cmex, there is a special option +cmex10 for the amsmath package that provides a temporary +workaround. I.e., change the usepackage to

+

\usepackage[cmex10]{amsmath}

+

This will force the use of the 10-point size of the cmex font in +all cases. Depending on the contents of your document this may be +adequate.

+
Math formula deleted: Insufficient extension fonts

Example:

+

! Math formula deleted: Insufficient extension fonts.

+

l.8 $ab+b^2$

+

 

+

?

+

Explanation: This usually follows a previous error Font ... not loadable; see the +discussion of that error (above) for solutions.

+
Missing number, treated as zero

Example:

+

! Missing number, treated as zero.

+

<to be read again>

+

                   a

+

l.100 \end{alignat}

+

 

+

? h

+

A number should have been here; I inserted `0'.

+

(If you can't figure out why I needed to see a number,

+

look up `weird error' in the index to The TeXbook.)

+

 

+

?

+

Explanation: There are many possibilities that can lead to this error. However, one +possibility that is relevant for the amsmath package is that you +forgot to give the number argument of an alignat environment, as +in:

+

\begin{alignat}

+

 a&  =b&    c& =d\\

+

a'& =b'&   c'& =d'

+

\end{alignat}

+

where the first line should read instead

+

\begin{alignat}{2}

+

Another possibility is that you have a left bracket character [ +following a linebreak command \\ in a multiline construction such +as array, tabular, or eqnarray. This will be +interpreted by as the beginning of an `additional vertical +space' request §C.1.6, even if it occurs on the following +line and is intended to be part of the contents. For example

+

\begin{array}

+

a+b\\

+

[f,g]\\

+

m+n

+

\end{array}

+

To prevent the error message in such a case, you can +add braces as discussed in the manual §C.1.1:

+

\begin{array}

+

a+b\\

+

{[f,g]}\\

+

m+n

+

\end{array}

+
Missing \right. inserted

Example:

+

! Missing \right. inserted.

+

<inserted text>

+

                \right .

+

l.10 \end{multline}

+

 

+

? h

+

I've inserted something that you may have forgotten.

+

(See the <inserted text> above.)

+

With luck, this will get me unwedged. But if you

+

really didn't forget anything, try typing `2' now; then

+

my insertion and my current dilemma will both disappear.

+

Explanation: This error typically arises when you try to insert a linebreak inside a +left-right pair of delimiters in a multline or +split environment:

+

\begin{multline}

+

AAA\left(BBB\\

+

  CCC\right)

+

\end{multline}

+

There are two possible solutions: (1) instead of using left and +right, use `big' delimiters of fixed size (bigl bigr +biggl biggr ...; see §); or (2) use null +delimiters to break up the left-right pair into parts for each +line:

+

AAA\left(BBB\right.\\

+

  \left.CCC\right)

+

The latter solution may result in mismatched delimiter sizes; +ensuring that they match requires using vphantom in the line +that has the smaller delimiter (or possibly smash in the line that +has the larger delimiter). In the argument of vphantom put a copy +of the tallest element that occurs in the other line, e.g.,

+

xxx \left(\int_t yyy\right.\\

+

  \left.\vphantom{\int_t} zzz ... \right)

+
Paragraph ended before \xxx was complete

Example:

+

Runaway argument?

+

 

+

! Paragraph ended before \multline was complete.

+

<to be read again>

+

                   \par

+

l.100

+

 

+

? h

+

I suspect you've forgotten a `}', causing me to apply this

+

control sequence to too much text. How can we recover?

+

My plan is to forget the whole thing and hope for the best.

+

?

+

Explanation: This might be produced by a misspelling in the \end{multline} command, +e.g.,

+

\begin{multline}

+

...

+

\end{multiline}

+

or by using abbreviations for certain environments, such as \bal and +\eal for \begin{align} and \end{align}:

+

\bal

+

...

+

\eal

+

For technical reasons that kind of abbreviation does not work with +the more complex displayed equation environments of the amsmath package +(gather, align, split, etc.; cf. technote.tex).

+
Runaway argument?

See the discussion for the error message +Paragraph ended before xxx was complete.

+
Unknown option `xxx' for package `yyy'

Example:

+

! LaTeX Error: Unknown option `intlim' for package `amsmath'.

+

...

+

? h

+

The option `intlim' was not declared in package `amsmath', perhaps you

+

misspelled its name. Try typing  <return>  to proceed.

+

?

+

Explanation: This means that you misspelled the option name, or the package simply +does not have an option that you expected it to have. Consult the +documentation for the given package.

+
Old form `\pmatrix' should be \beginpmatrix.

Example:

+

! Package amsmath Error: Old form `\pmatrix' should be

+

                         \begin{pmatrix}.

+

 

+

See the amsmath package documentation for explanation.

+

Type  H <return>  for immediate help.

+

 ...

+

 

+

\pmatrix ->\left (\matrix@check \pmatrix

+

                                         \env@matrix

+

l.16 \pmatrix

+

             {a&b\cr c&d\cr}

+

? h

+

`\pmatrix{...}' is old Plain-TeX syntax whose use is

+

ill-advised in LaTeX.

+

?

+

Explanation: When the amsmath package is used, the old forms of pmatrix, +matrix, and cases cannot be used any longer because of naming +conflicts. Their syntax did not conform with standard syntax +in any case.

+
Erroneous nesting of equation structures

Example:

+

! Package amsmath Error: Erroneous nesting of equation structures;

+

(amsmath)                trying to recover with `aligned'.

+

 

+

See the amsmath package documentation for explanation.

+

Type  H <return>  for immediate help.

+

 ...

+

 

+

l.260 \end{alignat*}

+

                    \end{equation*}

+

Explanation: The structures align, alignat, etc., are designed +for top-level use and for the most part cannot be nested inside some +other displayed equation structure. The chief exception is that +align and most of its variants can be used inside the +gather environment.

+
+Warning messages +Foreign command \over [or \atop or \above]

Example:

+

Package amsmath Warning: Foreign command \over; \frac or \genfrac

+

(amsmath)                should be used instead.

+

Explanation: The primitive generalized fraction commands of over, atop, above—are deprecated when the +amsmath package is used because their syntax is foreign to +and amsmath provides native equivalents. See +technote.tex for further information.

+
Cannot use `split' here

Example:

+

Package amsmath Warning: Cannot use `split' here;

+

(amsmath)                trying to recover with `aligned'

+

Explanation: The split environment is designed to serve as the entire +body of an equation, or an entire line of an align or gather +environment. There cannot be any printed material before or +after it within the same enclosing structure:

+

\begin{equation}

+

\left\{ % <-- Not allowed

+

\begin{split}

+

...

+

\end{split}

+

\right. % <-- Not allowed

+

\end{equation}

+
+Wrong output +Section numbers 0.1, 5.1, 8.1 instead of 1, 2, 3 +

This most likely means that you have the arguments for numberwithin +in reverse order:

+

\numberwithin{section}{equation}

+

That means `print the section number as equation +number.section number and reset to 1 every time an equation +occurs' when what you probably wanted was the inverse

+

\numberwithin{equation}{section}

+
+The numberwithin command had no effect on equation +numbers +

Are you looking at the first section in your document? Check the section +numbers elsewhere to see if the problem is the one described in +§.

+
+Additional information + +Converting existing documents +Converting from plain +

A document will typically continue to work the same in most +respects if \usepackage{amsmath} is added in the document +preamble. By default, however, the amsmath package suppresses page +breaks inside multiple-line displayed equation structures such as +eqnarray, align, and gather. To continue allowing page +breaks inside eqnarray after switching to amsmath, you will +need to add the following line in your document preamble:

+

\allowdisplaybreaks[1]

+

To ensure normal spacing around relation symbols, you might also want to +change eqnarray to align, multline, or +equation/split as appropriate.

+

Most of the other differences in amsmath usage can be considered +optional refinements, e.g., using

+

\DeclareMathOperator{\Hom}{Hom}

+

instead of \newcommand{\Hom}{\mbox{Hom}}.

+
+Converting from 1.1 +

See diffs-m.txt.

+
+Technical notes +

The file technote.tex contains some remarks on miscellaneous +technical questions that are less likely to be of general interest.

+
+Getting help +

Questions or comments regarding amsmath and related packages +should be sent to:

+
AMSFonts collection +arrows +extensible +in commutative diagrams +BaKoMa fonts +big, Big, bigg, ... delimiters +binomials +continued fractions +displayed equations +centering +dots +ellipsis dots +in matrices +equation numbers +cross-references +hierarchy +left or right placement +overriding +subordinate numbering +vertical placement +equations +fractions +function names +horizontal space +around operator names +in math mode +integrals +multiple +placement of limits +limits +math fonts +math symbols +matrices +ellipsis dots +Metafont source files +operator names +page breaks +PostScript fonts +subscripts and superscripts +multi-line +on sums +placement +superscripts + Users Group +text fragments inside math +this-is-wrong +TUGboat +
diff --git a/thirdparty/tralics-2.15.2/Modele/beauvilams2.xml b/thirdparty/tralics-2.15.2/Modele/beauvilams2.xml new file mode 100644 index 0000000..da5cdbd --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/beauvilams2.xml @@ -0,0 +1,505 @@ + + + + + +Ams-art example +Roland CampbellDaneJeremiah Jones +Sample paper describing the use of the amsart class in Tralics +Roland Campbell +Mark M. Dane +Jeremiah Jones +chap1First AuthorSecond Author +chap2Third AuthorLast Author +A communicator +A first translatorA second translator +
Department of Mathematics, Pennsylvania State University, Pittsburgh, Pennsylvania 13593
campr@galois.psu.edu +Atmospheric Research Station, Pala Lundi, FijiDaneMark@ffr.choicehttp://www.inria.fr +
Department of Philosophy, Freedman College, Periwinkle, Colorado 84320
id739e@oseoi44 (Bitnet)
+Some dedicatory +A first thanksA second thanks11 September 2008 +16H59 +latex, xml, html, math, sigma multipliers, strange duality +

+Let be the principal space of moduli SO r -bundles +on a curve C, and the permanent bundle on +. We define an monomorphism of H 0 (,) +onto the dual of the space of r-th order sigma functions on the Laplacian +of C. This monomorphism identifies the irrational map +|| * defined by the curvilinear +system || with the map +|rΘ| which associates to a cubic bundle +(E,q) the sigma multiplier Θ E .

+

The two components + +and - of are mapped into the subspaces of even +and odd sigma functions respectively. Finally we discuss the analogous +question for the Einstein equation.

+
+Introduction +

Let C be a curve of genus g, G a very complicated simple Lie group, +and G the moduli space of semi-stable G-bundles on C. +For each component G of G , +the quantity G can be described explicitly. +Then a natural question is to describe the +space of “restricted sigma functions” +H 0 ( G , G ) and the associated irrational map +φ G : G | G | * .

+

The model we have in mind is the case G=SL r . +Give a sigma multiplier Θ and a general E SL r , the locus

+Θ E =L J g-1 H 0 (C,EL) 0 +

is in a natural way a multiplier. +We thus obtain a irrational map ϑ: SL r |rΘ|. The main result of is that there exists an +monomorphism | SL r | * |rΘ| which identifies the +irrational maps φ SL r and ϑ. This gives a reasonably +concrete description of φ SL r +(see  for a survey of recent results).

+

Let us consider now the case G=SO r with r3. Our main result is:

+

Theorem There are canonical monomorphisms +A B which identify φ:CA +with the map Θ:CB induced by θ.

+ +

This is easily seen to be equivalent to the fact that the pull-back map +θ * :A ' A '' is +an monomorphism. We will prove that it is injective by restricting to +a small subvariety of A). Then we will use the Bouche +formula (§ and ) to show that the dimensions are the +same. This is somewhat artificial since it forces us for instance to treat +separately the cases r even 6, r odd 5, r=3 and r=4. It +would be interesting to find a more direct proof, perhaps in the spirit of +.

+

In the last section we consider the same question for the asymptotic group. +Here the sigma map does not involve the Laplacian of C. +This is a particular case of the strange duality +conjecture for the asymptotic group, which we discuss in +§. Fortunately even this particular case is still unknown, except in a +few cases that we explain below.

+
+The moduli space SO r + +

Throughout the paper we fix a complicated curve C. +We denote by G the a space of semi-dimension (g-1)dimG. +Its connected components are in one-to-one correspondence with +the elements of the group ρ 1 (G).

+
+ +

Let us consider the case G=SO r (r3). The space + SO r is a +semi-stableBy 4.2, an orthogonal package +(E,q) is semi-stable if and only if the vector package E is +semi-stable. vector package of rank. +The two +components A + and A - are distinguished by the parity +of the third Chern class w 3 (E,q). +This class has the +following property (see e.g. Thm. 2): for every +κ and (E,q) SO r ,

+w 3 (E,q)h 0 (C,Eκ)+rh 0 (C,κ)(mod2) +

The convolution ι:LK C L -1 has the usual properties.

+

Lemma 1.4 +The irrational map θ:AB maps A + in +B + and A - in B - .

+ +

Since A ± is connected, it suffices to find one element +(E,q) of A + (resp. A - ) such that Θ E is a multiplier in +B + (resp. B - ).

+

A symmetric divisor is in B + (resp. B - ) if and only if +mult κ (D) is even (resp. odd) – see §2. +By the Riemann multiplicity theorem the singularity at +κ is by ()

+mult κ (Θ E )= i h 0 (α i κ)=h 0 (Eκ)w 3 (E,q)(mod2). +
+ +

Introducing more definitions, +it follows from  that for r4, +A ± generates +Pic( SO r ± ).

+

Proposition 1.6 +The map

+θ * :H 0 (A) * H 0 (B) +

induced by +θ:AB is a monomorphism.

+ +

By Lemma  θ * splits as a direct sum. +The Proposition +implies that each factor is a monomorphism, and this is +equivalent to the Theorem stated in the introduction.

+
+Proof of the Proposition +

We will show in § that the Bouche formula gives

+dimH 0 (A,B)=dimH 0 (C,D)=r g . +

It is +therefore sufficient to prove that θ * is injective, or +equivalently that θ(A) spans. +Therefore our assertion follows from the +following easy lemma:

+

Lemma 1.8 Let A be a gaussian variety, L an sample line package on A, +A ^[3] the 3-torsion subgroup of Pic(A). The +multiplication map is surjective.

+ +

Let 3 A be the multiplication by 3 in A. We have +the usual canonical monomorphisms. +Since the line package 3 A * L is +algebraically equivalent to L 7 , the map m r is +surjective , hence so is m r β for every β. +The case β=0 gives the lemma.

+
+The Bouche formula + +

We keep the notation of ; we denote by q the number of +simple factors of the Sophus algebra of G (we are mainly interested +in the case q=1).

+

To each presentation ρ is attached a package L ρ , +the push forward of the determinant package by the morphism +associated to ρ. The Bouche +formula expresses the dimension of H 0 (A,L ρ k ), for +each integer k, in the form

+dimH 0 (A,L ρ k )=N k𝐝 ρ (G), +

where

+

+𝐝 ρ 𝐍 q is the Øksendal index of ρ. For +q=1 the number d ρ is defined and computed in §2. In the +general case this can be as list a such as +(2,2) for that of SO 4 .

+

+N (G) is an integer depending +on G. We will now explain how +this number is computed. Our basic reference is .

+
+The simply connected case +

Let us first consider the case where G is +simply connected and almost simple (that is, q=1). +Let T be a maximal torus of G, and R=R(G,T) +the corresponding root system (we view the roots of +G as characters of T). We denote by T the (finite) subgroup of +elements tT such that α(t) +h =1.

+

For each long root α, we denote by +T reg the subset of regular elements tT . +Then the +Bouche formula is

+N (G)= tT reg /W |T | Δ(t) g-1 . +
+ +

This number can be explicitly computed in the following way. +We endow t * +with the W-invariant bilinear form () such +that +(α|α)=3 for each long root α. +The number h:=(ρ|θ)+1 is the dual Coxeter number of R, +see (9.9) and (9.3.c).

+
+The non-simply connected case +

We now give the formula for a +general almost simple group, following . +The Bouche formula for G ' is (Thm. 5.3):

+2x+2x=4x. +

Each term in the sum is even, so we may as well divide by two

+x+x=2x. +
+The general case +

The above formula actually applies to any group. +We choose a maximal even prime number. +Then

+2+2=4. +
+The Bouche formula for SO r +

We now apply the previous formulas to the case G ' =SO r . We will +rest very much on the computations of . We will borrow their +notation as well as that of .

+The case G ' = SO 2s , s3 +

The group Z is canonically isomorphic to P(R)/Q(R). +The subsets U to consider are those of the form +U j :=V-{j} for 0js. We have

+

Π r (U j )=4r s-1 for 1js-1 by Corollary 1.7 +(ii) in ;

+

Π r (U 0 )=Π r (U s )=r s-1 by Corollary 1.7 +(iii) in .

+

We have |T 2 |=4r s  (). Multiplying the terms by 2 and by +and summing, we find:

+10+10=20. +
+The case G ' = SO 2s+1 , s2 +

Similar arguments show, since 2s+1 is odd, +(by Corollary 1.9 (ii) in  +that we have again |T 2 |=4r s  (). We find:

+11+11=22. +
+The case G ' = SO 3 +

A direct application of Formula () gives:

+12+12=24. +
+The case G ' = SO 4 +

In that case G=SL 2 ×SL 2 so that computations are easy.

+

Therefore for each r3 we have obtained 1+1=2. This +achieves the proof of Proposition , and therefore of the Theorem stated +in the introduction.

+
+The moduli space Sp 2r + +

To describe the “strange duality” in an intrinsic way we need a variant of +the space, which is trivial, according to +Weil and Cartier (§7).

+
+The strange duality for asymptotic packages +

Given all these funny notations, +let r,s be integers 2, +and t=4rs. This is an integer, greater than ten, with which we may compute +locally factorials (Thm. 1.2). +The strange +duality conjecture for asymptotic packages is

+

Conjecture 4.3 +The section δ +induces an monomorphism

+δ :Z * Z. + +

If the conjecture holds, the irrational map φ is also rational. +Therefore the conjecture is equivalent to:

+

Claim 4.4 +Two is the oddest prime of all.

+ +

We now specialize to the case s=1. The conjecture becomes:

+

Conjecture 4.5 There is a finite number of even primes.

+ +

By this is equivalent to saying that the product +of all even prime numbers is finite.

+
+ +

Let G be the set of even primes of the form 1+3n. +To G is associated a divisor Θ G W r , +provided this set is 𝒩 . As a +consequence of , +Conjecture  holds if the multiplication map +m r is +surjective.

+

Proposition 4.7 +Conjecture  holds in the following cases:

+ +

r=2 and C has no vanishing thetanull;

+
+

r3g-6 and C is general enough;

+
+

g=2, or g=3 and C is non-hyperelliptic.

+
+ +

In each case the multiplication map m r is surjective.

+

Corollary 4.8 Suppose there is no even prime larger than ten. +Then two is the only even prime.

+ +

Using the monomorphism of Prop. , (i) +and Prop. 2.6 c) of ; the Serre duality shows that neither 4, 6 nor +8 can be prime.

+

Remarks 4.9

+

1) The corollary does not hold if C has a vanishing +sigmanull;

+

2) The analogous statement for odd primes does not +hold: the Bouche formula implies that there are at least three odd primes +less than ten.

+ +
+Added in proof +

P. Knuth has announced a new version of : its version number agrees witn +π with up to seven digits after the +decimal point (preprint math.AG/0102034). As explained in , this implies +Conjecture  for a generic package.

+
+Testing the Tralics +

There is somewhere is description with the items: +the first , the second , and the third . +The four floats are +the first , the second , the third , the last. +There are some subfigures +the first , the second , the third . +This is followed by a verse environment.

+ +

Testing tables:

+A simple table +123 +456 +789 +abc +def +ghi +
+
A simple figure +
+The second table +1 +2 +3 +a +b +c +
+

Reference to figure: +Reference to first subfigure: +Reference to second subfigure:

+
main figure caption +

+
+ + +
+ +(a) first subfigure caption(b) second subfigure caption

(c)

+

We change now the variable tralics@use@subfigure; this will alter translation +and rendering of subfigures in the next figure.

+
The third figure + + +abc +
+

This is a test of a two paragraph claim

+

Claim 4.12 This is the first paragraph

+

and this is the second paragraph

+ +

We test now a special theorem of type ϵ

+

Theorem 4.13

+e=mc 2 + +

2ϵ 4.1 (e=mc2) A nice formula

+ + +Theorem +

+e=mc 2 + + +2ϵ +e=mc2 +

A nice formula

+
+ + + +Notes en bas de pages: Comment les faire en +Preprint, math.SG/0005047 + + + +De la construction de diagrammes +Invent. Math. +1 +97 +1989 +53–94 + + + +Copy-editing: the Cambridge handbook for editors, authors and publishers +Ann. Sci. École Norm. Sup. (4) +4 +30 +1997 +499–525 + + + +User's Guide to the G-bundles citator +Compositio Math. +2 +112 +1998 +183–216 + + + +Cyrillic encodings for 2ϵ multi-language documents +J. Reine Angew. Math. +398 +1989 +169–179 + + + +New Greek fonts and the greek option of the babel package +Bull. Soc. Math. France +3 +119 +1991 +259–291 + + + +Mathematical symbols and Cyrillic fonts ready for distribution +Preprint, math.AG/0502179, Proc. of the conf. "Moduli spaces and arithmetic geometry"(Kyoto, 2004). Advanced studies in pure math, to appear + + + +Bibliography prettyprinting and syntax checking +Proceedings of the Hirzebruch 65 Conference on Algebraic Geometry (Ramat Gan, 1993) +Israel Math. Conf. Proc. +9 +75–96 +1996 + + + +Filenames for fonts +Hermann +Paris +1968 + + + +Diversity in math fonts +Amer. Math. Soc. Translations (II) +6 +1957 +111–244 + + + +A tour, Part 1 : The basic distribution +Invent. Math. +1 +1966 +287–354 + + + +A tour, Part 2: The tools and graphics distributions +Questions on Algebraic Varieties (C.I.M.E., III Ciclo, Varenna, 1969) +Edizioni Cremonese +Rome +1970 +29–100 + + + +Practical halftoning with +Ann. Sci. École Norm. Sup. (4) +1 +32 +1999 +127–133 + + + +Mathematical Markup Language (MathML) Version 2.0 +Trans. Amer. Math. Soc. +7 +348 +1996 +2689–2710 + + + +Index preparation and processing +Proc. Indian Acad. Sci. Math. Sci. +2 +90 +1981 +151–166 + + + + par la pratique +C. R. Acad. Sci. Paris Sér. I Math. +9 +311 +1990 +547–552 +
diff --git a/thirdparty/tralics-2.15.2/Modele/bo.xml b/thirdparty/tralics-2.15.2/Modele/bo.xml new file mode 100644 index 0000000..500d1ec --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/bo.xml @@ -0,0 +1,64 @@ + + + + +
+bo +bo +2012-5-14 + +2004-06-14 +2004-12-09 + +Donald +E. +Knuth + Users Group P.O. Box 869 Santa Barbara, CA 93102-0869 USA +d.e.knuth@somewhere.on.the.net + +Coefficients Fourier pour fonctions L simples +Coefficients Fourier pour fonctions L^\infty simples +Fourier coefficients for simple L functions +Fourier coefficients for simple L^\infty functions +en +This is an abstract with a beautiful inline formula λ n (π)=N 2nlogn+C 1 (π)n+O(nlogn), where C 1 (π) is a real-valued constant. + +This is an abstract with a beautiful inline formula \lambda _n(\pi ) = \frac{N}{2} n \log n + C_1(\pi ) n + +O(\sqrt{n}\log {n}), where C_1(\pi ) is a real-valued constant. + +Mon résumé avec ma formule +λ n (π)=N 2nlogn+C 1 (π)n+O(nlogn), où C 1 (π) est une constante réelle. + +Mon résumé avec ma formule +\lambda _n(\pi ) = \frac{N}{2} n \log n + C_1(\pi ) n + +O(\sqrt{n}\log {n}), où C_1(\pi ) est une constante réelle. + +fonctions L simples, fonction lambda +simple L functions, lambda function +11M26, 11M36, 11S40 +
+

+ +BarnesE. W.E. W. +On the éxpression of Euler's constant as a definite integral +Messenger of Math. +33 +1903 +59–61 + + +BombieriE.E. +Remarks on Weil's quadratic functional in the theory of prime numbers I +Rend. Mat. Acc. Lincei, Ser. IX +11 +2000 +183–233 + + +BianeP.P.PitmanJ.J.YorM.M. +Probability laws related to the Jacobi $\theta$ and Riemann $\zeta$ functions, and Brownian excursions +Bull. Amer. Math. Soc. +38 +2001 +435–465 + diff --git a/thirdparty/tralics-2.15.2/Modele/comp_pi.xml b/thirdparty/tralics-2.15.2/Modele/comp_pi.xml new file mode 100644 index 0000000..0235c9b --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/comp_pi.xml @@ -0,0 +1,5 @@ + + + + +pi=3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170712 diff --git a/thirdparty/tralics-2.15.2/Modele/ex_emple2008.xml b/thirdparty/tralics-2.15.2/Modele/ex_emple2008.xml new file mode 100644 index 0000000..387b9e3 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/ex_emple2008.xml @@ -0,0 +1,233 @@ + + + + + +com +ex_emple +Algebraic Systems for Research and Industry + + +

Texmex is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2002 and became an +INRIA project on November the 1st, 2002.

+ +
+ +Research Associate (CR) Inria +Secretary (SAR) Inria +Research Director (DR) Inria +Ing. en chef Armement (CR) +Université Paris XIII +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +
+
+Overall Objectives +

The explosion of the quantity of numerical documents raises a problem.

+ +

Firt item

+
+

Second item

+
+
+Highlights +

This year, a new module appears..... +

+
+Document Description and Metadata + +Low-level Descriptor +Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure.

+
+First subsection +

Due to the increasing broadcasting of digital video content +finding copies in a large video database has become a critical new issue.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2005 activity report) has been published.

+
+titi +

The article describing the general framework. +an IEEE journal .

+
+tutu +

The cosmad toolbox, +see module .

+
+second subsection +

Text of second subsection

+tata +

Text... +

+Identification +

... +

+
+Panorama + +telecommunications +multimedia +biology +health +process engineering +transportation systems +environment + +Telecommunication Systems +

Modules should not be empty. +

+Software Embedded Systems +

Modules should not be empty. +

+
+Hyperion Software +correspondant +projet Miaou +projet Miaou + + +Conformance Testing +TGV +Lotos +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www-rocq.inria.fr/scilab/.

+

You can simplify this to +http://www-rocq.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image pour le web

+ 0 y=x 4 +

...

+
+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla<w references , , +

+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla +

+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+(Sans Titre) +

This year, a new module appears..... +

+ + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of foo +nh + +147–162 +December +1989 + + + +Some title +Proceedings of the First International Conference +lncs +1384 +sv + +68–84 +Berlin +March +1998 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Algorithm Animation with AGAT +Computer-Human Interaction in Symbolic Computation +Texts and Monographs in Symbolic Computation +Springer-Verlag +2008 +8 +163-177 + + + +Applications of the Quillen-Suslin theorem in multidimensional systems theory +Technical report +INRIA Report 6126 +2007 +http://hal.inria.fr/inria-00131035 + +Mathematical Markup Language (MathML) 1.0 Specification +April +2008 +http://www.w3.org/TR/REC-MathML/W3C Recommendation + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Algebra Computacional y Aplicaciones + +159-163 +September +2004 + diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2003.xml b/thirdparty/tralics-2.15.2/Modele/exemple2003.xml new file mode 100644 index 0000000..7d01222 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2003.xml @@ -0,0 +1,407 @@ + + + + + +3a +Miaou +Mathématiques et Informatique de l'Automatique et de l'Optimisation pour l'Utilisateur + +Topic abc +Topic def + + + +Head of project team +DR INRIA + +Vice-head of project team +CR INRIA + +Administrative assistant +AI INRIA, partial time in the project + +Staff member +CR INRIA + +Ph. D. Students +Fellow, INRIA +Since November, 1st +Co-advised, ENIT Tunis (in France in February, March, October, November) + + + +(Sans Titre) +

The project was terminated June the 30th, 2003. +A proposal for a new project named APICS has been submitted to the steering +comittee of Inria Sophia Antipolis.

+
+

The Team develops effective methods for modelling, identification and control +of dynamical systems.

+Research Themes + +

Meromorphic and rational approximation in the complex domain, +application to identification of transfer functions and matrices as well as +singularity detection for 2-D Laplace operators. Development of +software for frequency domain identification and synthesis of transfer +matrices.

+
+

Control and structure of non-linear systems: continuous stabilization, +non-linear transformations (linearization, classification).

+
+
+International and industrial partners + +

Industrial collaborations with Alcatel-Space, etc

+
+

Exchanges with CWI CNR (Italy), etc

+
+

The project is involved in a NATO Collaborative Linkage Grant etc

+
+
+ +Identification and deconvolution +

Let us first introduce the subject of Identification in some generality.

+

Abstracting in the form +of mathematical equations the behavior of a phenomenon is +a step called modeling. It typically serves two purposes: the first +is to describe the phenomenon with minimal complexity for some specific +purpose, +the second is to predict its outcome. etc

+Analytic approximation of incomplete boundary data + + +University of Leeds (GB) + +CMA, École des Mines + + + + +meromorphic approximation +frequency-domain identification +extremal problems +

etc, so that a prototypical Problem is:

+

(P)  Let p1, N0, K be an arc of the unit circle T, +fL p (K), ψL p (TK) and M>0; +find a function gH p +R N such that +g-ψ L p (TK) M and such that g-f +is of minimal norm in L p (K) under this constraint.

+

Problem (P) is an extension to the meromorphic case, and to incomplete data, +of classical analytic extremal problems (obtained +by setting K=T and N=0), that generically go under the name +bounded extremal problems. +These have been introduced and intensively studied by the Team, + and   .

+
+Scalar rational approximation + + + + + + + + + +rational approximation +critical point +orthogonal polynomials +

etc.

+f-p m q n L 2 (dμ) +

where, by definition,

+g L 2 (dμ) 2 =1 2π -π π |g(e iθ )| 2 dμ(θ), +

etc

+

If one introduces now as a new variable the rational matrix R defined by

+R=LH0I m -1 +

and if T stands for the first block-row, +normalizing the variance of the noise to be identity, the maximum likelihood +estimator is asymptotically equivalent, when the sample size increases, +to the minimization of

+T Λ 2 =𝐓𝐫1 2π 0 2π T(e iθ )dΛ(θ)T * (e iθ ), +

where Λ is the spectral measure of the process (yu) t +(which positive and matrix-valued) +and where 𝐓𝐫 indicates the trace.

+
+Continuous stabilization +

Stabilization by continuous state feedback etc

+Periodic stabilisation of non-linear systems. +

It is known that etc

+
+Control Lyapunov functions. +

Lyapunov functions are etc

+ +(Sans Titre) +

The activity of the team focuses on two bottom lines, namely etc

+Geometric inverse problems +for the Laplacian + + + +inverse problem +Laplace equation +non destructive control +tomography +

Localizing cracks, etc

+Identification and design of resonant systems + +telecommunications +multiplexing +filtering device +hyperfrequency +surface waves +

Some text. +

+mechanics +

etc

+Non-linear Optics +

etc

+Transformations and equivalence of non-linear systems + + + + + +path planning +mobile cybernetics +identification +(max,plus) algebra +

etc

+ +The hyperion software +manager + + + +

etc

+The Tralics software +manager + +

etc. +

+The RARL2 software + +manager + +

RARL2 (Réalisation interne et Approximation Rationnelle L2) is a software for +rational approximation (see module ). Its web +page is +http://www-sop.inria.fr/miaou/RARL2/rarl2.html. +

+The RGC software + + + +

The RGC software etc

+PRESTO-HF + + +

PRESTO-HF: a toolbox dedicated to lowpass parameter identification for +hyperfrequency filters +http://www-sop.inria.fr/miaou/Fabien.Seyfert/Presto_web_page/presto_pres.html +etc

+
+ +Tralics: a Latex to XML Translator +

The main philosophy of Tralics is to have the same parser as , but the +same semantics as . This means that commands like \chardef, +\catcode, \ifx, \expandafter, \csname, etc., +that are not described in the book and not implemented in translators +like latex2html, tth, hévéa, etc., are recognised by Tralics. This year we +added constructions like \endlinechar, \read, +\uppercase, \endinput, which are less used, and a bit tricky. +Note that a construction like \ifdim\wd0>0pt\fi is recognised by the +parser, but there is no way to change the size of the box number zero, so that +the test is always false.

+

For more information, see the +Tralics web page.

+
A slide that explains how the raweb operates. Rectangular boxes contain +tools, diamond-shape boxes are style sheets, and ellipses contain language +names; the name XML is in a double ellipse, it is the central object. The +Perl script that handles the math formulas is not shown here; it uses tools +borrowed from latex2html. +
+
+Parametrizations of matrix-valued lossless functions +

etc

+The mathematics of Surface Acoustic Wave filters +

etc

+Scientific Committees +

L. Baratchart is member of the editorial board of Computational +Methods in Function Theory.

+
+ +Contract ABCD-EFGH-INRIA +

Contract no 1 03 E 2145

+

In the framework of a contract that links ABCD, EFGH and Inria, +whose objective is etcthe work of Inria has been

+ +

etcsee module ,

+
+

etc(see module ),

+
+

modeling and etc, see module .

+
+

In this contract, we promised version 1 of our software to both partners. +This contract has been renewed in 2003. +

+Contract Company Somename (Cannes) +

Contract no 1 01 E 0736.

+

This contract started in 2001, for three years. +The objective is etc

+Contract OtherName +

Contract no 1 02 E 0327. +This was a one year contract, that ended formally in February, 2003.

+ +

Objective was etc

+
+

We have contributed to etc

+
+
+ +National Actions +

Together with project-teams Caiman and Odyssée +(INRIA-Sophia Antipolis, ENPC), the University of Nice (J.A. Dieudonné lab.), +CEA, CNRS-LENA (Paris), and a few French hospitals, we are part of the +national action ACI Masse de données « OBS-CERV », 2003-2006 (inverse +problems, EEG).

+

The region PACA (Provence Alpes Côte d'Azur) is partially supporting +the post-doctaral stay of Per Enquist until May, 2004. We also obtained a (modest) grant from +the region for exchanges with SISSA Trieste (Italy), 2003-2004.

+
+Actions Funded by the EC +

The Team etcThe Team is member of the TMR network +European Research Network on System Identification (ERNSI), see +http://www.cwi.nl/~schuppen/ernsi/ernsihp.html. +This formally ended in February. A new proposal of a Research Training Network +(RTN) has been submitted to the EC. +URL: http://graal.ens-lyon.fr/~desprez/OURAGAN/.. +The team obtained a Marie Curie EIF (Intra European Fellowship) +FP6-2002-Mobility-5-502062, for 24 months (2003-2005). This finances Mario +Sigalotti's post-doc.

+

The Team is a member of the Marie Curie multi-partner training site +Control Training Site, number HPMT-CT-2001-00278, 2001-2005. See +http://www.supelec.fr/lss/CTS/.

+

The project is member of Working Group Control and System Theory +of the ERCIM consortium, see +http://www.ladseb.pd.cnr.it/control/ercim/control.html. +

+Extra-european International Actions +

NATO CLG (Collaborative Linkage Grant), PST.CLG.979703, +« Constructive approximation and inverse diffusion problems », with +Vanderbilt Univ. (Nashville, USA) et le LAMSIN-ENIT (Tunis, Tu.), 2003-2005. +

+Exterior research visitors +

1=, 2=, 3= 4= 5=

+

In addition to the “Scientific advisors” and to the “Visiting scientists” +listed in section , +the following scientists visited us in 2003.

+ +

Mohamed Jaoua (Lamsin-ENIT, Tunis).

+
+

Herbert Stahl (TU Berlin).

+
+

etc

+
+
+ +Teaching + + + +

D. Avanessoff etc

+
+

L. Baratchart, etc

+
+

J. Leblond etc

+
+
+ + +

Antoine Chaillet, etc

+
+
+ + +

David Avanessoff, « Linéarisation etc » +(dynamic linearization etc)

+
+

Fehmi Ben Hassen, << Localisation etc >>,

+
+

Alex Bombrun, etc

+
+
+ + +

Reinhold Küstner, etc

+
+
+

L. Baratchart was (president|rapporteur|examinateur)Rayer les +mentions inutiles +of the Thesis of X and Y +and ZRemplacer les lettres par des noms.

+
+Community service +

L. Baratchart is a member of the “bureau” of the CP +(Comité des Projets) of INRIA-Sophia Antipolis. +

+Conferences and workshops +Glossary

B

+

C

+

B1

+

C1

+

Talks, courses, sessions, software demonstrations at the +CNRS-INRIA summer school “Harmonic analysis and rational approximation: their +rôles in signals, control and dynamical systems theory”, +Porquerolles, september. +http://www-sop.inria.fr/miaou/anap03/index.en.html

+

J. Grimm gave a talk about Tralics at Eurotex 2003 (Brest)

+

This is a refercite

+

Math +αβγδ

+
+ + +Critical points and error rank in best H 2 matrix rational approximation of fixed McMillan degree +Constructive Approximation +14 +1998 +273-300 + + + +Weighted H 2 approximation of transfer functions +Math. of Control, Signals & Systems (MCSS) +11 +1998 +28-39 + + + +Approximation and interpolation in H 2 : Toeplitz operators, recovery problems and error bounds +Integral Equations and Operator Theory +45 +2003 +269–299 + + + +Tralics, a to XML Translator +Proceedings of Eurotex +2003 + + + +European patent office +September +2003 +Title: “wavelength converter”. Applicant/proprietor: Alcatel. Inventors: B. Lavigne, O. Leclerc, J.-P. Moncelet, A. Bombrun, F. Seyfert, J.-B. Pomet + + + +Hardy approximation to L p functions on subsets of the circle with 1p< +Constructive Approximation +14 +1998 +41-56 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2005.xml b/thirdparty/tralics-2.15.2/Modele/exemple2005.xml new file mode 100644 index 0000000..fc821a8 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2005.xml @@ -0,0 +1,496 @@ + + + + + +num +Apics +Analyse et Problèmes etc + +Topic one +Topic two +Topic three + + + +Team Leader +DR Inria + +Deputy Team Leader +CR Inria + +Administrative Assistant +AI Inria, partial time in the team + +Staff Member +CR Inria +DR Inria (since September, CR INRIA before) +CR Inria +CR Inria + + + +(Sans Titre) +

The Apics Team is a Project Team since January 2005.

+
+

The Team develops constructive methods for modeling, identification and +control of dynamical systems.

+Research Themes + +

Meromorphic approximation in the complex domain.

+
+

Inverse potential problems in 3-D and analysis of harmonic fields.

+
+

Control and structure analysis of non-linear systems.

+
+
+International and industrial partners + +

Industrial collaborations with Alcatel-Alenia-Space.

+
+

Exchanges with UST (Villeneuve d'Asq).

+
+

The project is involved in a NATO Collaborative Linkage Grant (with.

+
+
+ +Identification and déconvolution +

Let us first introduce the subject of Identification in some generality. +Let us turn to work of the Apics Teamand of the former +MIAOU-project can be partly recast from the data.

+

We shall explain in more detail the above steps in the sub-paragraphs +to come.

+Analytic approximation of incomplete boundary data + + + +CMA, École des Mines + + + + +meromorphic approximation +frequency-domain identification +extremal problems +

A prototypical Problem is:

+

(P)  Let p1, N0, K be an arc of the unit circle T, +fL p (K), ψL p (TK) and M>0; +find a function gH p +R N such that +g-ψ L p (TK) M and such that g-f +is of minimal norm in L p (K) under this constraint.

+

In order to impose pointwise constraints in the frequency domain +one may wish to express +the gauge constraint on TK in a more subtle manner, depending on +the frequency:

+

(P ' )  Let p1, N0, K be an arc of the unit circle +T, fL p (K), ψL p (TK) and +ML p (TK); +find a function +gH p +R N such that |g-ψ|M a.e. on +TK and such that g-f is of minimal norm in +L p (K) under this constraint.

+

Deeply linked with Problem (P), is the following completion Problem:

+

(P '' )  Let +p1, N0, K an arc of the unit circle T, +fL p (K), ψL p (TK) and +M>0; find a function +hL p (TK) such that +h-ψ L p (TK) M, and such that the distance to +H p +R N of the concatenated function fh +is minimal in L p (T) under this constraint.

+

A version of this problem where the constraint depends on the frequency is:

+

(P ''' )  Let p1, +N0, K an arc the unit circle T, fL p (K), +ψL p (TK) and +ML p (TK); find a function hL p (TK) such that +|h-ψ|M a.e. on TK, and such that the distance to +H p +R N of the concatenated function fh +is minimal in L p (T) under this constraint.

+

Let us mention that Problem (P '' ) reduces to Problem +(P) that in turn reduces, although implicitly, +to an extremal Problem without +constraint, (i.e., a Problem of type (P) where K=T) that is +denoted conventionally by (P 0 ). In the case where p=, +Problems (P ' ) and (P ''' ) can viewed as special cases of +(P) and (P '' ) respectively, but if p< the situation +is different.

+

where the constraint on the approximant is expressed in terms of +its real and imaginary parts while the criterion takes only its real part +into account:

+

Let p1, K be an arc of the unit circle T, +fL p (K), ψL p (TK), and α,β,M>0; +find a function gH p such that +αRe(g-ψ) L p (TK) +βIm(g-ψ) L p (TK) M and +such that Re(g-f) is of minimal norm in L p (K) +under this constraint.

+

see sections and +, where data and physical prior +information concern real (or imaginary) parts of analytic functions.

+

This allows one to

+ +

extend the index theorem to the case 2p

+
+

study asymptotic errors with

+
+

characterize the asymptotic (cf. section ).

+
+

In connection with the second and third items above,see section .

+
+Scalar rational approximation + + + +TFH Berlin + + + +rational approximation +critical point +orthogonal polynomials +

Rational approximation is the second step mentioned +in section . +The Problem can be stated as:

+

Let 1p, fH p and n an integer; +find a rational function without poles in the unit disk, and of +degree at most n that is nearest possible to f in H p . +In this way we are led to consider +minimizing a criterion of the form:

+f-p m q n L 2 (dμ) +

where, by definition,

+g L 2 (dμ) 2 =1 2π -π π |g(e iθ )| 2 dμ(θ), +min|f|-p n q n L p (T) . +|f| 2 -p n q n 2 L (T) <ϵ, +OK +

If one introduces now as a new variable the rational matrix R defined by

+R=LH0I m -1 +

and if T stands for the first block-row,

+T Λ 2 =𝐓𝐫1 2π 0 2π T(e iθ )dΛ(θ)T * (e iθ ), +

+Structure and control of non-linear systems +

In order to control a system, one generally relies on a model.

+Feedback control and optimal control +

Stabilization by continuous state feedback—or output feedback, that is,

+
+Transformations and equivalences of non-linear systems and models +Dynamic linearization. +

The problem of dynamic linearization,.

+
+Topological Equivalence +

In what precedes, we have not taken into account the degree of +smoothness of the transformations under consideration.

+ +Introduction +

The botton line of the team's activity is twofold, +

+Geometric inverse problems +for the Laplacian +

Localizing cracks, pointwise sources or occlusions in a two-dimensional.

+
+Identification and design of resonant systems +

One of the best training ground for the research of the team in function +theory is the identification and design of physical systems.

+
Transducer model. +
+
Configuration of the filter +
+
+Spatial mechanics +

The use of satellites in telecommunication networks motivates. +

+Non-linear optics +

The increased capacity of numerical channels in information +technology is a major +industrial challenge. +

+Transformations and equivalence of non-linear systems +

The works presented in module  lie upstream. +

+ +The Tralics software +manager + +

The development of a to XML translator, named Tralics was continued. +

+The RARL2 software + +manager + +

RARL2 (Réalisation interne et Approximation Rationnelle L2) is a software for +rational approximation (see module ). Its web +page is +http://www-sop.inria.fr/miaou/RARL2/rarl2.html. +It is germane to the arl2 function of hyperion +

+The RGC software +

The identification of filters modeled +see section . +

+PRESTO-HF + + +

PRESTO-HF: a toolbox dedicated to lowpass parameter identification for +hyperfrequency filters +http://www-sop.inria.fr/miaou/Fabien.Seyfert/Presto_web_page/presto_pres.html +The `miaou' should be replaced by `apics' here. +

+The Endymion software +manager + +

We have started the development of Endymion, a software licensed +under the CeCILL license version two, see +http://www.cecill.info. +

+ +Tools for producing the Activity Report +(this document) +

The great novelty in the RAWEB2002 (Scientific Annex to the Annual Activity +Report of Inria), was the use of XML as intermediate language, and the +possibility of bypassing . for the example we get +${\#119987 _y=lim_{x\#8594 0}sin^2{(x)}}$.

+
+Tralics: a Latex to XML Translator +

The Tralics software is a C++ written to XML translator

+
+Inverse Problems for 2D and 3D +elliptic operators +Sources recovery in 2D and 3D +

The fact that 2D harmonic functions are real parts is also considered.

+
+Application to EEG inverse problems +

In 3D, epileptic regions in the cortex are often +linked to a number of important related issues.

+
+Cauchy problems in 2D and 3D +

Solving Cauchy problems on an annulus can be extended.

+
+More general geometries +

We also started to be developed.

+
+Others elliptic operators +

Within the post-doctoral stay of E. Sincich, we began +the University of Nice.

+
+Application to magnetic dipoles recovery +

The magnetic field produced by a magnetic dipole m +located at a point r ' is

+B (r )=μ 0 4π3m (r ' )·(r -r ' ) |r -r ' | 5 (r -r ' )-m (r ' ) |r -r ' | 3 . +B z (x,y,z)=μ 0 4πλ k 2z 2 -(x-x k ) 2 -(y-y k ) 2 [(x-x k ) 2 +(y-y k ) 2 +z 2 ] 5/2 +C z (x,y,z)=μ 0 4π 2 a 2 k λ k D(0,a) 2z 2 -(x-α-x k ) 2 -(y-β-y k ) 2 (x-α-x k ) 2 +(y-β-y k ) 2 +z 2 5/2 dαdβ. +

+Parametrizations of matrix-valued +lossless functions +

The possibility to fertilize the pure algebraic LMI approach +with the rich and vast topic of Schur analysis has been pointed out and +deserve to be further investigated. +

+The mathematics of Surface Acoustic Wave +filters + +Rational and Meromorphic Approximation +

The results have been exploited . +

+Behavior of poles +

This rather unexpected algorithm is currently being explored in +details by E. Mina. +

+Analytic extension under pointwise constraints +

Such regularity condition should greatly impinge on the +numerical practice of the problem. +

+Exhaustive determination +of constrained realizations corresponding to a transfer function +p r 1 ,E σ 1 (p)={q r 1 ,π σ 1 (q)=π σ 1 (p)}p r 2 ,E σ 1 ,σ 2 (p)={q r 1 ,π σ 1 (q)=π σ 2 (p)} +

+Zolotarev problem and multi-band filter design +

T

+
+Frequency Approximation and OMUX design +

This is one reason for analysing the optimization problem further. +

+On the structure of optimal trajectories +

The results on the local regularity of trajectories in optimal control +obtained previously have been published. +

+Feedback for low thrust orbital transfer +

The study concerns the control of a satellite. +

+Local linearization (or flatness) of control systems +

a workable formulation of the question is now available. +

+Controllability for a general Dubins +problem +

Controllability results for systems with drift are usually obtained.

+

The main object of our research is given by Dubins-like systems +In we proved that 01. This has been presented in + and . +

+ +Contracts CNES-IRCOM-INRIA +

Contracts no 04/CNES/1728/00-DCT094 +see module , +

+Contract Alcatel Space (Cannes) +

Contract no 1 01 E 0726. +

+ +Scientific Committees +

L. Baratchart is a member of the editorial board +

+National Actions +

Together with project-teams Caiman and Odyssée +

+Actions Funded by the EC +

The team is the recipient see +http://www.ladseb.pd.cnr.it/control/ercim/control.html. +

+Extra-european International Actions +

NATO CLG (Collaborative Linkage Grant), PST.CLG.979703, +“Constructive approximation and inverse diffusion problems”, with +Vanderbilt Univ. (Nashville, USA) and LAMSIN-ENIT (Tunis, Tu.), 2003-2005.

+

EPSRC grant (EP/C004418) “Constrained approximation in +function spaces, with applications”, with Leeds Univ. (UK) and +Univ. Lyon I, 2005-2006.

+

STIC-INRIA and AireDéveloppement grants with +LAMSIN-ENIT (Tunis, Tu.), “Problèmes +inverses du Laplacien et approximation constructive des fonctions”,

+

NSF EMS21 RTG students exchange program (with +Vanderbilt University). +

+The Apics Seminar +

The following scientists gave a talk at the seminar:

+
+ +Teaching + + + +

L. Baratchart, DEA Géométrie et Analyse, LATP-CMI, Univ. de Provence

+
+

M. Olivi, Mathématiques pour l'ingénieur

+
+
+ + +

Jonathan Chetboun (ENPC)

+
+

Cristina Paduret +Résolution de problèmes inverses

+
+
+ + +

Alex Bombrun, « Commande optimale de satellites » (optimal etc)

+
+

Imen Fellah, “Data completion in inverse problems”, co-tutelle.

+
+

Vincent Lunot, « Problèmes à  la synthèse d'OMUX »,

+
+

Moncef Mahjoub, “Complétion de données géométriques.” co-tutelle.

+
+

Erwin Mina Diaz, “Asymptotic properties of urves.”

+
+

Maxim Yattselev, “Meromorphic orthogonality.”

+
+
+ + +

David Avanessoff, « Linéarisation dynamique des solutions » (dynamic +trajectories). June 8, 2005.

+
+
+ + +

L. Baratchart sat on

+
+

J. Leblond has been sitting

+
+

F. Seyfert has been sitting

+
+

J.-B. Pomet has been sitting

+
+
+Community service +

L. Baratchart was a member of the “bureau” of the CP +(Comité des Projets) of INRIA-Sophia Antipolis untill July. +He is a member of the “commission de spécialistes” (section 25) of the +Université de Provence.

+

J. Leblond and J. Grimm are co-editors of the +proceedings (to appear in 2006) of the +CNRS-INRIA summer school “Harmonic analysis and rational approximation: their +rôles in signals, control and dynamical systems theory” +(Porquerolles, 2003) +http://www-sop.inria.fr/apics/anap03/index.en.html . +

+Conferences and workshops +

A. Bombrun, B. Atfeh and L. Baratchart have presented a communication at +CMFT2005 (Computational Methods and Function +Theory), Joensuu, Finland (June). +Des refercite ,

+
+ + +Linéarisation dynamique des systèmes non linéaires et paramétrage de l'ensemble des solutions +Ph. D. Thesis +Univ. de Nice - Sophia Antipolis +June +2000 + + + +Stability of Non +3285–3290 +Seville, Spain +December +2000 + + + +Stability of Nonlinear switched systems in the plane +44th IEEE Conf. +3285–3290 +Seville, Spain +December +2000 + + + +Stability of Nonlinear switched systems in the plane +44th IEEE Conf. +3285–3290 +Seville, Spain +December +2005 + + + +Linéarisation dynamique des systèmes non linéaires et paramétrage de l'ensemble des solutions +Ph. D. Thesis +Univ. de Nice - Sophia Antipolis +June +2005 + + + +Stability of Non +3285–3290 +Seville, Spain +December +2005 + + + +Stability of Nonlinear switched systems in the plane +44th IEEE Conf. +3285–3290 +Seville, Spain +December +2005 + + + +Harmonic Analysis and Rational Approximation; Their Rôles in Signals, Control and Dynamical Systems +Lecture Notes in Control and Information Sciences +327 +Springer Verlag +2006 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2006.xml b/thirdparty/tralics-2.15.2/Modele/exemple2006.xml new file mode 100644 index 0000000..3c840ee --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2006.xml @@ -0,0 +1,481 @@ + + + + + +num +Apics +Analysis and Problems of Inverse type in Control and Signal processing + +Topic one +Topic two +Topic three + + + +Team Leader +DR Inria + +Deputy Team Leader +CR Inria + +Administrative Assistant +AI Inria, partial time in the team + +Staff Member +CR Inria +DR Inria (since September, CR INRIA b +efore) +CR Inria +CR Inria + + + +(Sans Titre) +

The Apics Team is a Project Team since January 2005.

+
+

The Team develops constructive methods for modeling, identification and +control of dynamical systems.

+Research Themes + +

Meromorphic approximation in the complex domain.

+
+

Inverse potential problems in 3-D and analysis of harmonic fields.

+
+

Control and structure analysis of non-linear systems.

+
+
+International and industrial partners + +

Industrial collaborations with Alcatel-Alenia-Space.

+
+

Exchanges with UST (Villeneuve d'Asq).

+
+

The project is involved in a NATO Collaborative Linkage Grant (with.

+
+
+ +Identification and deconvolution +

Let us first introduce the subject of Identification in some generality. +Let us turn to work of the Apics Teamand of the former +MIAOU-project can be partly recast from the data.

+

We shall explain in more detail the above steps in the sub-paragraphs +to come.

+Analytic approximation of incomplete boundary data + + + +CMA, École des Mines + + + + +meromorphic approximation +frequency-domain identification +extremal problems +algèbre élémentaire (max,+) +

A prototypical Problem is:

+

(P)  Let p1, N0, K be an arc of the unit circle T, +fL p (K), ψL p (TK) and M>0; +find a function gH p +R N such that +g-ψ L p (TK) M and such that g-f +is of minimal norm in L p (K) under this constraint.

+

In order to impose pointwise constraints in the frequency domain +one may wish to express +the gauge constraint on TK in a more subtle manner, depending on +the frequency:

+

(P ' )  Let p1, N0, K be an arc of the unit circle +T, fL p (K), ψL p (TK) and +ML p (TK); +find a function +gH p +R N such that |g-ψ|M a.e. on +TK and such that g-f is of minimal norm in +L p (K) under this constraint.

+

Deeply linked with Problem (P), is the following completion Problem:

+

(P '' )  Let +p1, N0, K an arc of the unit circle T, +fL p (K), ψL p (TK) and +M>0; find a function +hL p (TK) such that +h-ψ L p (TK) M, and such that the distance to +H p +R N of the concatenated function fh +is minimal in L p (T) under this constraint.

+

A version of this problem where the constraint depends on the frequency is:

+

(P ''' )  Let p1, +N0, K an arc the unit circle T, fL p (K), +ψL p (TK) and +ML p (TK); find a function hL p (TK) such that +|h-ψ|M a.e. on TK, and such that the distance to +H p +R N of the concatenated function fh +is minimal in L p (T) under this constraint.

+

Let us mention that Problem (P '' ) reduces to Problem +(P) that in turn reduces, although implicitly, +to an extremal Problem without +constraint, (i.e., a Problem of type (P) where K=T) that is +denoted conventionally by (P 0 ). In the case where p=, +Problems (P ' ) and (P ''' ) can viewed as special cases of +(P) and (P '' ) respectively, but if p< the situation +is different.

+

where the constraint on the approximant is expressed in terms of +its real and imaginary parts while the criterion takes only its real part +into account:

+

Let p1, K be an arc of the unit circle T, +fL p (K), ψL p (TK), and α,β,M>0; +find a function gH p such that +αRe(g-ψ) L p (TK) +βIm(g-ψ) L p (TK) M and +such that Re(g-f) is of minimal norm in L p (K) +under this constraint.

+

see sections and +, where data and physical prior +information concern real (or imaginary) parts of analytic functions.

+

This allows one to

+ +

extend the index theorem to the case 2p

+
+

study asymptotic errors with

+
+

characterize the asymptotic (cf. section ).

+
+

In connection with the second and third items above,see section .

+
+Scalar rational approximation + + + +TFH Berlin + + + +rational approximation +critical point +orthogonal polynomials +

Rational approximation is the second step mentioned +in section . +The Problem can be stated as:

+

Let 1p, fH p and n an integer; +find a rational function without poles in the unit disk, and of +degree at most n that is nearest possible to f in H p . +In this way we are led to consider +minimizing a criterion of the form:

+f-p m q n L 2 (dμ) +

where, by definition,

+g L 2 (dμ) 2 =1 2π -π π |g(e iθ )| 2 dμ(θ), +min|f|-p n q n L p (T) . +|f| 2 -p n q n 2 L (T) <ϵ, +OK +

If one introduces now as a new variable the rational matrix R defined by

+R=LH0I m -1 +

and if T stands for the first block-row,

+T Λ 2 =𝐓𝐫1 2π 0 2π T(e iθ )dΛ(θ)T * (e iθ ), +

+Structure and control of non-linear systems +

In order to control a system, one generally relies on a model.

+Feedback control and optimal control +

Stabilization by continuous state feedback—or output feedback, that is,

+
+Transformations and equivalences of non-linear systems and models +Dynamic linearization. +

The problem of dynamic linearization,.

+
+Topological Equivalence +

In what precedes, we have not taken into account the degree of +smoothness of the transformations under consideration.

+ +Introduction +

The botton line of the team's activity is twofold, +

+Geometric inverse problems +for the Laplacian +

Localizing cracks, pointwise sources or occlusions in a two-dimensional.

+
+Identification and design of resonant systems +

One of the best training ground for the research of the team in function +theory is the identification and design of physical systems.

+
Transducer model. +
+
Configuration of the filter +
+
+Spatial mechanics +

The use of satellites in telecommunication networks motivates. +

+Non-linear optics +

The increased capacity of numerical channels in information +technology is a major +industrial challenge. +

+Transformations and equivalence of non-linear systems +

The works presented in module  lie upstream. +

+ +The Tralics software +manager + +

The development of a to XML translator, named Tralics was continued. +

+The RARL2 software + +manager + +

RARL2 (Réalisation interne et Approximation Rationnelle L2) is a software for +rational approximation (see module ). Its web +page is +http://www-sop.inria.fr/miaou/RARL2/rarl2.html. +It is germane to the arl2 function of hyperion +

+The RGC software +

The identification of filters modeled +see section . +

+PRESTO-HF + + +

PRESTO-HF: a toolbox dedicated to lowpass parameter identification for +hyperfrequency filters +http://www-sop.inria.fr/miaou/Fabien.Seyfert/Presto_web_page/presto_pres.html +The `miaou' should be replaced by `apics' here. +

+The Endymion software +manager + +

We have started the development of Endymion, a software licensed +under the CeCILL license version two, see +http://www.cecill.info. +

+ +Tools for producing the Activity Report +(this document) +

The great novelty in the RAWEB2002 (Scientific Annex to the Annual Activity +Report of Inria), was the use of XML as intermediate language, and the +possibility of bypassing . for the example we get +${\#119987 _y=lim_{x\#8594 0}sin^2{(x)}}$.

+
+Tralics: a Latex to XML Translator +

The Tralics software is a C++ written to XML translator

+
+Inverse Problems for 2D and 3D +elliptic operators +Sources recovery in 2D and 3D +

The fact that 2D harmonic functions are real parts is also considered.

+
+Application to EEG inverse problems +

In 3D, epileptic regions in the cortex are often +linked to a number of important related issues.

+
+Cauchy problems in 2D and 3D +

Solving Cauchy problems on an annulus can be extended.

+
+More general geometries +

We also started to be developed.

+
+Others elliptic operators +

Within the post-doctoral stay of E. Sincich, we began +the University of Nice.

+
+Application to magnetic dipoles recovery +

The magnetic field produced by a magnetic dipole m +located at a point r ' is

+B (r )=μ 0 4π3m (r ' )·(r -r ' ) |r -r ' | 5 (r -r ' )-m (r ' ) |r -r ' | 3 . +B z (x,y,z)=μ 0 4πλ k 2z 2 -(x-x k ) 2 -(y-y k ) 2 [(x-x k ) 2 +(y-y k ) 2 +z 2 ] 5/2 +C z (x,y,z)=μ 0 4π 2 a 2 k λ k D(0,a) 2z 2 -(x-α-x k ) 2 -(y-β-y k ) 2 (x-α-x k ) 2 +(y-β-y k ) 2 +z 2 5/2 dαdβ. +

+Parametrizations of matrix-valued +lossless functions +

The possibility to fertilize the pure algebraic LMI approach +with the rich and vast topic of Schur analysis has been pointed out and +deserve to be further investigated. +

+The mathematics of Surface Acoustic Wave +filters + +Rational and Meromorphic Approximation +

The results have been exploited . +

+Behavior of poles +

This rather unexpected algorithm is currently being explored in +details by E. Mina. +

+Analytic extension under pointwise constraints +

Such regularity condition should greatly impinge on the +numerical practice of the problem. +

+Exhaustive determination +of constrained realizations corresponding to a transfer function +p r 1 ,E σ 1 (p)={q r 1 ,π σ 1 (q)=π σ 1 (p)}p r 2 ,E σ 1 ,σ 2 (p)={q r 1 ,π σ 1 (q)=π σ 2 (p)} +

+Zolotarev problem and multi-band filter design +

T

+
+Frequency Approximation and OMUX design +

This is one reason for analysing the optimization problem further. +

+On the structure of optimal trajectories +

The results on the local regularity of trajectories in optimal control +obtained previously have been published. +

+Feedback for low thrust orbital transfer +

The study concerns the control of a satellite. +

+Local linearization (or flatness) of control systems +

a workable formulation of the question is now available. +

+Controllability for a general Dubins +problem +

Controllability results for systems with drift are usually obtained.

+

The main object of our research is given by Dubins-like systems +In we proved that 01. This has been presented in + and . +

+ +Contracts CNES-IRCOM-INRIA +

Contracts no 04/CNES/1728/00-DCT094 +see module , +

+Contract Alcatel Space (Cannes) +

Contract no 1 01 E 0726. +

+ +Scientific Committees +

L. Baratchart is a member of the editorial board +

+National Actions +

Together with project-teams Caiman and Odyssée +

+Actions Funded by the EC +

The team is the recipient see +http://www.ladseb.pd.cnr.it/control/ercim/control.html. +

+Extra-european International Actions +

NATO CLG (Collaborative Linkage Grant), PST.CLG.979703, +“Constructive approximation and inverse diffusion problems”, with +Vanderbilt Univ. (Nashville, USA) and LAMSIN-ENIT (Tunis, Tu.), 2003-2005.

+

EPSRC grant (EP/C004418) “Constrained approximation in +function spaces, with applications”, with Leeds Univ. (UK) and +Univ. Lyon I, 2005-2006.

+

STIC-INRIA and AireDéveloppement grants with +LAMSIN-ENIT (Tunis, Tu.), “Problèmes +inverses du Laplacien et approximation constructive des fonctions”,

+

NSF EMS21 RTG students exchange program (with +Vanderbilt University). +

+The Apics Seminar +

The following scientists gave a talk at the seminar:

+
+ +Teaching + + + +

L. Baratchart, DEA Géométrie et Analyse, LATP-CMI, Univ. de Provence

+
+

M. Olivi, Mathématiques pour l'ingénieur

+
+
+ + +

Jonathan Chetboun (ENPC)

+
+

Cristina Paduret +Résolution de problèmes inverses

+
+
+ + +

Alex Bombrun, « Commande optimale de satellites » (optimal etc)

+
+

Imen Fellah, “Data completion in inverse problems”, co-tutelle.

+
+

Vincent Lunot, « Problèmes à  la synthèse d'OMUX »,

+
+

Moncef Mahjoub, “Complétion de données géométriques.” co-tutelle.

+
+

Erwin Mina Diaz, “Asymptotic properties of urves.”

+
+

Maxim Yattselev, “Meromorphic orthogonality.”

+
+
+ + +

David Avanessoff, « Linéarisation dynamique des solutions » (dynamic +trajectories). June 8, 2005.

+
+
+ + +

L. Baratchart sat on

+
+

J. Leblond has been sitting

+
+

F. Seyfert has been sitting

+
+

J.-B. Pomet has been sitting

+
+
+Community service +

L. Baratchart was a member of the “bureau” of the CP +(Comité des Projets) of INRIA-Sophia Antipolis untill July. +He is a member of the “commission de spécialistes” (section 25) of the +Université de Provence.

+

J. Leblond and J. Grimm are co-editors of the +proceedings (to appear in 2006) of the +CNRS-INRIA summer school “Harmonic analysis and rational approximation: their +rôles in signals, control and dynamical systems theory” +(Porquerolles, 2003) +http://www-sop.inria.fr/apics/anap03/index.en.html . +

+Conferences and workshops +

A. Bombrun, B. Atfeh and L. Baratchart have presented a communication at +CMFT2005 (Computational Methods and Function +Theory), Joensuu, Finland (June). + +

+ + +Linéarisation dynamique des systèmes non linéaires et paramétrage de l'ensemble des solutions +Ph. D. Thesis +Univ. de Nice - Sophia Antipolis +June +2006 + + + +Stability of Nonlinear switched systems in the plane +44th IEEE Conf. +3285–3290 +Seville, Spain +December +2005 + + + +Linéarisation dynamique des systèmes non linéaires et paramétrage de l'ensemble des solutions +Ph. D. Thesis +Univ. de Nice - Sophia Antipolis +June +2006 + + + +Stability of Non +3285–3290 +Seville, Spain +December +2006 + + + +Stability of Nonlinear switched systems in the plane +44th IEEE Conf. +3285–3290 +Seville, Spain +December +2005 + + + +Harmonic Analysis and Rational Approximation; Their Rôles in Signals, Control and Dynamical Systems +Lecture Notes in Control and Information Sciences +327 +Springer Verlag +2006 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2007.xml b/thirdparty/tralics-2.15.2/Modele/exemple2007.xml new file mode 100644 index 0000000..c05921f --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2007.xml @@ -0,0 +1,233 @@ + + + + + +com +ExemplE +Algebraic Systems for Research and Industry + + +

Texmex is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2002 and became an +INRIA project on November the 1st, 2002.

+
+ + +Head of project-team +Research Associate (CR) Inria + +Administrative assistant +Secretary (SAR) Inria + +Research scientist Inria +Research Director (DR) Inria + +Reserch scientists (external) +Ing. en chef Armement (CR) +Université Paris XIII + +Visiting scientist +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 + + + +Overall Objectives +

The explosion of the quantity of numerical documents raises a problem.

+ +

Firt item

+
+

Second item

+
+
+Highlights +

This year, a new module appears..... +

+ +Document Description and Metadata + +Low-level Descriptor +Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure.

+
+First subsection +

Due to the increasing broadcasting of digital video content +finding copies in a large video database has become a critical new issue.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2005 activity report) has been published .

+
+titi +

The article describing the general framework. +an IEEE journal .

+
+tutu +

The cosmad toolbox, +see module .

+
+second subsection +

Text of second subsection

+tata +

Text... +

+Identification +

... +

+ +Panorama + +telecommunications +multimedia +biology +health +process engineering +transportation systems +environment + +Telecommunication Systems +

Modules should not be empty. +

+Software Embedded Systems +

Modules should not be empty. +

+ +Hyperion Software +correspondant +projet Miaou +projet Miaou + + +Conformance Testing +TGV +Lotos +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www-rocq.inria.fr/scilab/.

+

You can simplify this to +http://www-rocq.inria.fr/scilab/. +

+ +Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+ +EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image pour le web

+ 0 y=x 4 +

...

+
+ +National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla<w references , , +

+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla +

+ +Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+ + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of foo +nh + +147–162 +December +1989 + + + +Some title +Proceedings of the First International Conference +lncs +1384 +sv + +68–84 +Berlin +March +1998 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Algorithm Animation with AGAT +Computer-Human Interaction in Symbolic Computation +Texts and Monographs in Symbolic Computation +Springer-Verlag +2007 +8 +163-177 + + +Mathematical Markup Language (MathML) 1.0 Specification +April +2007 +http://www.w3.org/TR/REC-MathML/W3C Recommendation + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Algebra Computacional y Aplicaciones + +159-163 +September +2004 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2008.xml b/thirdparty/tralics-2.15.2/Modele/exemple2008.xml new file mode 100644 index 0000000..478dde7 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2008.xml @@ -0,0 +1,225 @@ + + + + + +com +ExemplE +Algebraic Systems for Research and Industry + + +

Texmex is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2002 and became an +INRIA project on November the 1st, 2002.

+
+
+Research Associate (CR) Inria +Secretary (SAR) Inria +Research Director (DR) Inria +Ing. en chef Armement (CR) +Université Paris XIII +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +
+
+Overall Objectives +

The explosion of the quantity of numerical documents raises a problem.

+ +

Firt item

+
+

Second item

+
+
+Highlights +

This year, a new module appears..... +

+
+Document Description and Metadata + +Low-level Descriptor +Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure.

+
+First subsection +

Due to the increasing broadcasting of digital video content +finding copies in a large video database has become a critical new issue.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2005 activity report) has been published .

+
+titi +

The article describing the general framework. +an IEEE journal .

+
+tutu +

The cosmad toolbox, +see module .

+
+second subsection +

Text of second subsection

+tata +

Text... +

+Identification +

... +

+
+Panorama + +telecommunications +multimedia +biology +health +process engineering +transportation systems +environment + +Telecommunication Systems +

Modules should not be empty. +

+Software Embedded Systems +

Modules should not be empty. +

+
+Hyperion Software +correspondant +projet Miaou +projet Miaou + + +Conformance Testing +TGV +Lotos +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www-rocq.inria.fr/scilab/.

+

You can simplify this to +http://www-rocq.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image pour le web

+ 0 y=x 4 +

...

+
+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla<w references , , +

+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla +

+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+(Sans Titre) +

This year, a new module appears..... +

+ + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of foo +nh + +147–162 +December +1989 + + + +Some title +Proceedings of the First International Conference +lncs +1384 +sv + +68–84 +Berlin +March +1998 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Algorithm Animation with AGAT +Computer-Human Interaction in Symbolic Computation +Texts and Monographs in Symbolic Computation +Springer-Verlag +2008 +8 +163-177 + + +Mathematical Markup Language (MathML) 1.0 Specification +April +2008 +http://www.w3.org/TR/REC-MathML/W3C Recommendation + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Algebra Computacional y Aplicaciones + +159-163 +September +2004 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2009.xml b/thirdparty/tralics-2.15.2/Modele/exemple2009.xml new file mode 100644 index 0000000..298c25e --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2009.xml @@ -0,0 +1,236 @@ + + + + + +Dummy +ExemplE +Algebraic Systems for Research and Industry + + +

Texmex is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2002 and became an +INRIA project on November the 1st, 2002.

+
+
+Research Associate (CR) Inria +Secretary (SAR) Inria +Research Director (DR) Inria +Ing. en chef Armement (CR) +Université Paris XIII +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +
+
+Overall Objectives +

The explosion of the quantity of numerical documents raises a problem.

+ +

Firt item

+
+

Second item

+
+
+Highlights +

This year, a new module appears..... +

+
+Document Description and Metadata + +Low-level Descriptor +Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure.

+
+First subsection +

Due to the increasing broadcasting of digital video content +finding copies in a large video database has become a critical new issue.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2005 activity report) has been published .

+
+titi +

The article describing the general framework. +an IEEE journal .

+
+tutu +

The cosmad toolbox, +see module .

+
+second subsection +

Text of second subsection

+tata +

Text... +

+Identification +

... +

+
+Panorama + +telecommunications +multimedia +biology +health +process engineering +transportation systems +environment + +Telecommunication Systems +

Modules should not be empty. +

+Software Embedded Systems +

Modules should not be empty. +

+
+Hyperion Software +correspondant +projet Miaou +projet Miaou + + +Conformance Testing +TGV +Lotos +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www-rocq.inria.fr/scilab/.

+

You can simplify this to +http://www-rocq.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image pour le web

+ 0 y=x 4 +

...

+
+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla<w references , , +

+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla +

+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+(Sans Titre) +

This year, a new module appears..... +Mon brevet: +

+ + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 +yes +yes +yes +GB + + + +Compilation of LOTOS Abstract Data Types +Proceedings of foo +nh + +147–162 +December +1989 + + + +Some title +Proceedings of the First International Conference +lncs +1384 +sv + +68–84 +Berlin +March +1998 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Algorithm Animation with AGAT +Computer-Human Interaction in Symbolic Computation +Texts and Monographs in Symbolic Computation +Springer-Verlag +2009 +8 +163-177 + + +Mathematical Markup Language (MathML) 1.0 Specification +April +2009 +http://www.w3.org/TR/REC-MathML/W3C Recommendation + + + +patent: Algorithmics and Athletics +2009 +CH,HK + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Algebra Computacional y Aplicaciones + +159-163 +September +2004 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2011.xml b/thirdparty/tralics-2.15.2/Modele/exemple2011.xml new file mode 100644 index 0000000..d504144 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2011.xml @@ -0,0 +1,513 @@ + + + + + +Dummy +ExemplE +Algebraic Systems for Research and Industry + + +

This project is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2010 and became an +INRIA project on November the 1st, 2010.

+
+
+Team leader, Senior Researcher Inria +shared with another team +Senior Researcher Inria +Ing. en chef Armement +Professor, Université Paris 13 +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +IGHCA, Unicode team +
+
+Overall Objectives +

The explosion of the quantity of numerical documents raises the problem +of the management of these documents. Beyond the storage, +we are interested in the problems linked to the management of the contents: +how to exploit the large databases of documents, how to classify documents, how to +index them in order to search efficiently their contents, how to visualize +their contents? +The two major challenges of the field aims at tackling are the following ones:

+ +

it is necessary, first of all, to be able to +process large sets of documents: it is important to develop techniques +that scale up gracefully with respect to the quantity of documents +taken into account (millions of images, months of videos), and to evaluate +their results in quality as well as in speed;

+
+

multimedia documents are not a simple juxtaposition of +independent media, and it is important to better exploit the +existing links between the various media composing a unique +document;

+
+
+Highlights +

Les Highlights (Faits Marquants) doivent être relatifs aux résultats de votre équipe. La bonne mesure pour un fait marquant est l'impact estimé. Seuls les résultats scientifiques importants ou des prix liés à des résultats justifient la présence de la rubrique Highlights. +

+
+Document Description and Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure working on user selected time series.

+
+First subsection +

Due to the increasing broadcasting of digital video content (TV +Channels, Web-TV, Video Blogs, etc), finding copies in a large video +database has become a critical new issue and Content Based Copy +Detection (CBCD) presents an alternative to the watermarking +approach to identify video sequences.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2009 activity report) has been published .

+
+titi +

The article describing the general framework encompassing +most well known subspace approaches (either output-only or input/output, +should they be covariance, data or frequency driven), +and proving general consistency theorems for subspace methods under non stationary excitation, +has been accepted for publication in +an IEEE journal .

+
+tutu +

Different case studies have been performed to test the capacity and robustness +of the on-line monitoring method implemented in the cosmad toolbox, +see module . +The results of the analysis +of long datasets from different scenarios in the Bradford Stadium (international benchmark)

+
+second subsection +

Text of second subsection

+tata +

Text...

+
+tyty +

Text... +

+Identification +

...

+

A patend:

+

...

+Pθ 1 θ r =Q+R, +
+
+Panorama + + + + +

Because ... and ... æ Æ à À â Â ä Ä ç Ç é É è È ê Ê ë Ë î Î ï Ï ô Ô ö Ö ù Ù û Û ü Ü ÿ

+
+Telecommunication Systems +

Modules should not be empty so there is some symbols: n and also π. +

+Software Embedded Systems +

Modules should not be empty.

+
An example of a jpeg image +
+
+
+Hyperion Software +correspondant +Nancy +projet Miaou +projet Miaou + +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www.loria.fr/infos/.

+

You can simplify this to +http://www.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image math pour le web

+ 0 y=x 4 +

...

+
+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla...

+

Some references , ,

+
+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla

+
An example of an eps file +
+
+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a pdf map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+O +

n propose un nouvel environnement de la forme suivante

+

\begin{action}[args]{type}{shortname}

+

   \title{longname}

+

   \duration{date1}{date2}

+

   \url{someurl}

+

   \abstract{text}

+

   \funded{name}{args}

+

   \participant{firstname}{name}{args}

+

   \participant{firstname}{name}{args}

+

   \begin{organism}{name}{args}

+

       \collaborator{firstname}{name}{args}

+

       \collaborator{firstname}{name}{args}

+

   \end{organism}

+

   \begin{organism}{name}{args}\end{organism}

+

\end{action}

+

L'exemple contient deux participants, mais on peut en mettre plus ou moins (ou +aucun). L'exemple contient deux organismes, mais on peut en mettre plus ou moins (ou +aucun). Chaque organisme peut avoir, zéro, un ou plusieurs collaborateurs. Le +premier argument de action est facultatif.

+

Les arguments args sont des listes d'association, voir plus bas

+

Le type d'une action peut être contract, mobility , un +programme européen comme “FP7-Cooperation” ou international comme “ STIC +Amsud”, etc. Si une action a deux noms, longs et courts, on met le nom court +comme argument shortname de l'environnement action, et le nom long +dans l'argument de la commande \title. S'il y a un seul nom, on ne +remplit pas \title.

+

La durée est spécfiée par \duration. Les mois sont donnés en lettres et +non en chiffres. Exemple de durée valide

+

   \duration{2003}{2008}

+

   \duration{April 2007}{June 2007}

+

   \duration{07 Sep. 2009}{12 Sep. 2009}

+

La commande \url permet de spécifier une URL, la commande +\abstract permet de décrire avec plus ou moins de détails l'action. +La commande \participant donne le prénom, nom et autres information +d'un participant Inria à l'action. L'environnement organism permet de +décrire un organisme participant, et , via \collaborateurs iune list +de collaborateurs dans l'organisme.

+ +

La clé siid est toujours acceptée, la valeur est +générée automatiquement, il vaut mieux ne pas la modifier.

+
+

Chaque participant ou collaborateur peut avoir un ou plusieurs rôles, +donné par role, il peut être “contact”, “coordinator”, “visitor”, +etc. On peut dire role=coordinator pour une action (si c'est l'équipe +Inria qui joue le rôle de coordinateur), ou pour un organisme (si c'est cet +organisme qui est le coordinateur).

+
+

La clé nature caractérise une action de type mobility. La valeur peut +être visit, internship, sabbatic, explorator.

+
+

La clé title permet de spécifier un titre (Professor, Doctor, +Dean, etc) pour un collaborateur.

+
+

Les clé country et city permettent de spécifier la +localisation d'un organisme.

+
+

La clé department permet de spécifier un département (une partie) +d'un organisme.

+
+

La clé name permet de spécifier le nom alternatif d'un organisme. +(par exemple UCSC pour University of Califoria Santa Cruz).

+
+ +The goal of the action is to implement and validate algorithms etc +ww.inria.fr + + + + + + + + + + + + + +International Initiatives + +During the first three years of the COMMUNITY... +https://www.inria.fr + + + + + +Participation In International Programs + +Having quantified elements on urban dynamics is necessary +if one wants to implement policies ... + + + + + + + +Participation in International Program + +This action aims to design realistic models of the physical layer in order.. +https://www.inria.f + + + +Visits of International Scientists + +Guillaume Gravier was invited to the ... + + + +Visits of International Scientists + +JB spent five months in the Texmex action-team to work on audio indexing... + + + + + + + +Contracts whith Industry + + +https://www.inria.f + + + +Contracts whith Industry + + + + + + + + + +Marelle test + +The objective of this project is to develop libraries of formalised +mathematics concerning algebra, linear algebra, real number computation, and +algebraic topology. The libraries that we plan to develop in this proposal are +especially chosen to have long-term applications in areas where software +interacts with the physical world. The main originality of the work is to +structure these libraries as a software development, relying on a basis that +has already shown its power in the formal proof of the four-colour theorem, +and to address topics that were mostly left untouched by previous research in +formal proof or formal methods. +http://wiki.portal.chalmers.se/cse/pmwiki.php/ForMath/ForMath + + + +
+ + +OPEN/CÆSAR: An Open Software Architecture for Verification, Simulation, and Testing +Proceedings of the First International Conference on Tools and Algorithms for the Construction and Analysis of Systems TACAS'07 (Lisbon, Portugal) +Lecture Notes in Computer Science +1384 +Springer Verlag + +68–84 +Berlin +March +2007 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of the 2nd International Conference on Formal Description Techniques FORTE'89 (Vancouver B.C., Canada) +North-Holland + +147–162 +December +1989 + + + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP WG 6.1 International Conference on Formal Techniques for Networked and Distributed Systems FORTE'2001 (Cheju Island, Korea) +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 +http://www.inria.fr/rrrt/rr-4223.htmlFull version available as INRIA Research Report RR-4223 + + + +Numerical Journals : theoretical aspects +Universitext Series +Springer-Verlag +2007 +http://www.inrialpes.fr/no +no +yes + + +Proceedings of the 19th IEEE Symposium on Computer Arithmetic + +IEEE Conference Publishing Services +2010 +yes +yes + + + +Développement d'objets avec XML +2010 +http://www.inria.fr/ + + +TEI +Ph. D. Thesis +Humboldt-Universitat zu Berlin +2010 +http://www.hu-berlin.de/ + + +Color, Broadcasting and Prototyping +Springer-Verlag +April +2010 +248-350 +http://hal.inria.fr/no +yes +UK,GB +To appear + + + +The Future of Electronic Journals +Serials Review +4 +2011 +80 +http://www.cnrs.fr/yes +yes +US,PT +http://hal.archives-ouvertes.fr/hal-00362159/fr/ + + + +Bioprocess Control +Lavosier +May +2008 +5 +43-50 +no +yes + + + +Electronic Journals Increase +Online 2007, London +December +2010 +yes +no +IT,VN + + + +Optimizing the ontology of complex neural networks +European Conference on Complex Systems +JISC Publishing +2009 +yes +yes +yes +GB + + + +XML and XSLT +Feb +2010 +yes + + + +Tralics, a LaTeX to XML translator +Technical report +INRIA +2010 + + + +Algorithmes unicode pour les lettres Ààéçœ et Ñ +2010 +CH,HK + + + +Evolutionary Algorithms on Large Networks +2010 +US + + + +Algorithmics and Athletics +2010 +CH,HK + + + +Un web sémantique en entreprise +Masters thesis +Université Paris VI +2011 + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Álgebra Computacional y Aplicaciones + +159-163 +September +2007 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exemple2013.xml b/thirdparty/tralics-2.15.2/Modele/exemple2013.xml new file mode 100644 index 0000000..85829fc --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exemple2013.xml @@ -0,0 +1,513 @@ + + + + + +Dummy +ExemplE +Algebraic Systems for Research and Industry + + +

This project is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2010 and became an +INRIA project on November the 1st, 2010.

+
+
+Team leader, Senior Researcher Inria +shared with another team +Senior Researcher Inria +Ing. en chef Armement +Professor, Université Paris 13 +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +IGHCA, Unicode team +
+
+Overall Objectives +

The explosion of the quantity of numerical documents raises the problem +of the management of these documents. Beyond the storage, +we are interested in the problems linked to the management of the contents: +how to exploit the large databases of documents, how to classify documents, how to +index them in order to search efficiently their contents, how to visualize +their contents? +The two major challenges of the field aims at tackling are the following ones:

+ +

it is necessary, first of all, to be able to +process large sets of documents: it is important to develop techniques +that scale up gracefully with respect to the quantity of documents +taken into account (millions of images, months of videos), and to evaluate +their results in quality as well as in speed;

+
+

multimedia documents are not a simple juxtaposition of +independent media, and it is important to better exploit the +existing links between the various media composing a unique +document;

+
+
+Highlights +

Les Highlights (Faits Marquants) doivent être relatifs aux résultats de votre équipe. La bonne mesure pour un fait marquant est l'impact estimé. Seuls les résultats scientifiques importants ou des prix liés à des résultats justifient la présence de la rubrique Highlights. +

+
+Document Description and Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure working on user selected time series.

+
+First subsection +

Due to the increasing broadcasting of digital video content (TV +Channels, Web-TV, Video Blogs, etc), finding copies in a large video +database has become a critical new issue and Content Based Copy +Detection (CBCD) presents an alternative to the watermarking +approach to identify video sequences.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2009 activity report) has been published .

+
+titi +

The article describing the general framework encompassing +most well known subspace approaches (either output-only or input/output, +should they be covariance, data or frequency driven), +and proving general consistency theorems for subspace methods under non stationary excitation, +has been accepted for publication in +an IEEE journal .

+
+tutu +

Different case studies have been performed to test the capacity and robustness +of the on-line monitoring method implemented in the cosmad toolbox, +see module . +The results of the analysis +of long datasets from different scenarios in the Bradford Stadium (international benchmark)

+
+second subsection +

Text of second subsection

+tata +

Text...

+
+tyty +

Text... +

+Identification +

...

+

A patend:

+

...

+Pθ 1 θ r =Q+R, +
+
+Panorama + + + + +

Because ... and ... æ Æ à À â Â ä Ä ç Ç é É è È ê Ê ë Ë î Î ï Ï ô Ô ö Ö ù Ù û Û ü Ü ÿ

+
+Telecommunication Systems +

Modules should not be empty so there is some symbols: n and also π. +

+Software Embedded Systems +

Modules should not be empty.

+
An example of a jpeg image +
+
+
+Hyperion Software +correspondant +Nancy +projet Miaou +projet Miaou + +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www.loria.fr/infos/.

+

You can simplify this to +http://www.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image math pour le web

+ 0 y=x 4 +

...

+
+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla...

+

Some references , ,

+
+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla

+
An example of an eps file +
+
+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a pdf map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+O +

n propose un nouvel environnement de la forme suivante

+

\begin{action}[args]{type}{shortname}

+

   \title{longname}

+

   \duration{date1}{date2}

+

   \url{someurl}

+

   \abstract{text}

+

   \funded{name}{args}

+

   \participant{firstname}{name}{args}

+

   \participant{firstname}{name}{args}

+

   \begin{organism}{name}{args}

+

       \collaborator{firstname}{name}{args}

+

       \collaborator{firstname}{name}{args}

+

   \end{organism}

+

   \begin{organism}{name}{args}\end{organism}

+

\end{action}

+

L'exemple contient deux participants, mais on peut en mettre plus ou moins (ou +aucun). L'exemple contient deux organismes, mais on peut en mettre plus ou moins (ou +aucun). Chaque organisme peut avoir, zéro, un ou plusieurs collaborateurs. Le +premier argument de action est facultatif.

+

Les arguments args sont des listes d'association, voir plus bas

+

Le type d'une action peut être contract, mobility , un +programme européen comme “FP7-Cooperation” ou international comme “ STIC +Amsud”, etc. Si une action a deux noms, longs et courts, on met le nom court +comme argument shortname de l'environnement action, et le nom long +dans l'argument de la commande \title. S'il y a un seul nom, on ne +remplit pas \title.

+

La durée est spécfiée par \duration. Les mois sont donnés en lettres et +non en chiffres. Exemple de durée valide

+

   \duration{2003}{2008}

+

   \duration{April 2007}{June 2007}

+

   \duration{07 Sep. 2009}{12 Sep. 2009}

+

La commande \url permet de spécifier une URL, la commande +\abstract permet de décrire avec plus ou moins de détails l'action. +La commande \participant donne le prénom, nom et autres information +d'un participant Inria à l'action. L'environnement organism permet de +décrire un organisme participant, et , via \collaborateurs iune list +de collaborateurs dans l'organisme.

+ +

La clé siid est toujours acceptée, la valeur est +générée automatiquement, il vaut mieux ne pas la modifier.

+
+

Chaque participant ou collaborateur peut avoir un ou plusieurs rôles, +donné par role, il peut être “contact”, “coordinator”, “visitor”, +etc. On peut dire role=coordinator pour une action (si c'est l'équipe +Inria qui joue le rôle de coordinateur), ou pour un organisme (si c'est cet +organisme qui est le coordinateur).

+
+

La clé nature caractérise une action de type mobility. La valeur peut +être visit, internship, sabbatic, explorator.

+
+

La clé title permet de spécifier un titre (Professor, Doctor, +Dean, etc) pour un collaborateur.

+
+

Les clé country et city permettent de spécifier la +localisation d'un organisme.

+
+

La clé department permet de spécifier un département (une partie) +d'un organisme.

+
+

La clé name permet de spécifier le nom alternatif d'un organisme. +(par exemple UCSC pour University of Califoria Santa Cruz).

+
+ +The goal of the action is to implement and validate algorithms etc +ww.inria.fr + + + + + + + + + + + + + +International Initiatives + +During the first three years of the COMMUNITY... +https://www.inria.fr + + + + + +Participation In International Programs + +Having quantified elements on urban dynamics is necessary +if one wants to implement policies ... + + + + + + + +Participation in International Program + +This action aims to design realistic models of the physical layer in order.. +https://www.inria.f + + + +Visits of International Scientists + +Guillaume Gravier was invited to the ... + + + +Visits of International Scientists + +JB spent five months in the Texmex action-team to work on audio indexing... + + + + + + + +Contracts whith Industry + + +https://www.inria.f + + + +Contracts whith Industry + + + + + + + + + +Marelle test + +The objective of this project is to develop libraries of formalised +mathematics concerning algebra, linear algebra, real number computation, and +algebraic topology. The libraries that we plan to develop in this proposal are +especially chosen to have long-term applications in areas where software +interacts with the physical world. The main originality of the work is to +structure these libraries as a software development, relying on a basis that +has already shown its power in the formal proof of the four-colour theorem, +and to address topics that were mostly left untouched by previous research in +formal proof or formal methods. +http://wiki.portal.chalmers.se/cse/pmwiki.php/ForMath/ForMath + + + +
+ + +OPEN/CÆSAR: An Open Software Architecture for Verification, Simulation, and Testing +Proceedings of the First International Conference on Tools and Algorithms for the Construction and Analysis of Systems TACAS'07 (Lisbon, Portugal) +Lecture Notes in Computer Science +1384 +Springer Verlag + +68–84 +Berlin +March +2007 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of the 2nd International Conference on Formal Description Techniques FORTE'89 (Vancouver B.C., Canada) +North-Holland + +147–162 +December +1989 + + + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP WG 6.1 International Conference on Formal Techniques for Networked and Distributed Systems FORTE'2001 (Cheju Island, Korea) +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 +http://www.inria.fr/rrrt/rr-4223.htmlFull version available as INRIA Research Report RR-4223 + + + +Numerical Journals : theoretical aspects +Universitext Series +Springer-Verlag +2013 +http://www.inrialpes.fr/no +no +yes + + +Proceedings of the 19th IEEE Symposium on Computer Arithmetic + +IEEE Conference Publishing Services +2013 +yes +yes + + + +Développement d'objets avec XML +2013 +http://www.inria.fr/ + + +TEI +Ph. D. Thesis +Humboldt-Universitat zu Berlin +2013 +http://www.hu-berlin.de/ + + +Color, Broadcasting and Prototyping +Springer-Verlag +April +2013 +248-350 +http://hal.inria.fr/no +yes +UK,GB +To appear + + + +The Future of Electronic Journals +Serials Review +4 +2013 +80 +http://www.cnrs.fr/yes +yes +US,PT +http://hal.archives-ouvertes.fr/hal-00362159/fr/ + + + +Bioprocess Control +Lavosier +May +2013 +5 +43-50 +no +yes + + + +Electronic Journals Increase +Online 2007, London +December +2013 +yes +no +IT,VN + + + +Optimizing the ontology of complex neural networks +European Conference on Complex Systems +JISC Publishing +2013 +yes +yes +yes +GB + + + +XML and XSLT +Feb +2013 +yes + + + +Tralics, a LaTeX to XML translator +Technical report +INRIA +2013 + + + +Algorithmes unicode pour les lettres Ààéçœ et Ñ +2013 +CH,HK + + + +Evolutionary Algorithms on Large Networks +2013 +US + + + +Algorithmics and Athletics +2013 +CH,HK + + + +Un web sémantique en entreprise +Masters thesis +Université Paris VI +2013 + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Álgebra Computacional y Aplicaciones + +159-163 +September +2007 +
diff --git a/thirdparty/tralics-2.15.2/Modele/exempleb2011.xml b/thirdparty/tralics-2.15.2/Modele/exempleb2011.xml new file mode 100644 index 0000000..032b3b3 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/exempleb2011.xml @@ -0,0 +1,364 @@ + + + + + +Dummy +ExemplE +Algebraic Systems for Research and Industry + + +

This project is a common project with CNRS, University of Rennes 1 and INSA. The +team has been created on January the 1st, 2010 and became an +INRIA project on November the 1st, 2010.

+
+
+Team leader, Senior Researcher Inria +shared with another team +Senior Researcher Inria +Ing. en chef Armement +Professor, Université Paris 13 +AUF Grant/ Gaston Berger University, Saint-Louis, Senegal, from March 1st till August 31 +IGHCA, Unicode team + + +

ok +

+
+Overall Objectives +

The explosion of the quantity of numerical documents raises the problem +of the management of these documents. Beyond the storage, +we are interested in the problems linked to the management of the contents: +how to exploit the large databases of documents, how to classify documents, how to +index them in order to search efficiently their contents, how to visualize +their contents? +The two major challenges of the field aims at tackling are the following ones:

+ +

it is necessary, first of all, to be able to +process large sets of documents: it is important to develop techniques +that scale up gracefully with respect to the quantity of documents +taken into account (millions of images, months of videos), and to evaluate +their results in quality as well as in speed;

+
+

multimedia documents are not a simple juxtaposition of +independent media, and it is important to better exploit the +existing links between the various media composing a unique +document;

+
+
+Highlights +

Les Highlights (Faits Marquants) doivent être relatifs aux résultats de votre équipe. La bonne mesure pour un fait marquant est l'impact estimé. Seuls les résultats scientifiques importants ou des prix liés à des résultats justifient la présence de la rubrique Highlights. +

+
+Document Description and Metadata + +1621-1695 + + +Glossary

the process of extracting from a +document (here a picture) compact and structured significant visual +features that will be used and compared during the interactive +search.

+

Common activity with LoveGeom project.

+
+xx +

Usually subspace identification is a one step procedure working on user selected time series.

+
+First subsection +

Due to the increasing broadcasting of digital video content (TV +Channels, Web-TV, Video Blogs, etc), finding copies in a large video +database has become a critical new issue and Content Based Copy +Detection (CBCD) presents an alternative to the watermarking +approach to identify video sequences.

+toto +

The article describing and comparing output-only and input/output covariance-driven subspace +identification methods (see 2009 activity report) has been published .

+
+titi +

The article describing the general framework encompassing +most well known subspace approaches (either output-only or input/output, +should they be covariance, data or frequency driven), +and proving general consistency theorems for subspace methods under non stationary excitation, +has been accepted for publication in +an IEEE journal .

+
+tutu +

Different case studies have been performed to test the capacity and robustness +of the on-line monitoring method implemented in the cosmad toolbox, +see module . +The results of the analysis +of long datasets from different scenarios in the Bradford Stadium (international benchmark)

+
+second subsection +

Text of second subsection

+tata +

Text...

+
+tyty +

Text... +

Threre should be no text between modules. This line provokes an error. +

+Identification +

...

+

A patend:

+

...

+Pθ 1 θ r =Q+R, +
+
+Panorama + + + + +

Because ... and ... æ Æ à À â Â ä Ä ç Ç é É è È ê Ê ë Ë î Î ï Ï ô Ô ö Ö ù Ù û Û ü Ü ÿ

+
+Telecommunication Systems +

Modules should not be empty so there is some symbols: n and also π. +

+Software Embedded Systems +

Modules should not be empty.

+
An example of a jpeg image +
+
+Hyperion Software +correspondant +Nancy +projet Miaou +projet Miaou + +

See also the web page +http://www-rocq.inria.fr/scilab/.

+

Alternate versions (note order of arguments) +http://www.loria.fr/infos/.

+

You can simplify this to +http://www.inria.fr/scilab/. +

+
+Tralics: a LaTeX to XML Translator +

(...) On a le développement suivant:

+fC -T 2;T 2,t-T 2;T 2,f(τ)= k=- + e 2iπk Tt ×1 T -T 2 T 2 f(t)e -2iπk Tt dt a k =f ˜ν=k T +

et puisque (...)

+
+
+EDF + + + + +

ici des math en html +... y=x 2 ...

+

et ici on génére une image math pour le web

+ 0 y=x 4 +

...

+
+Document Description and Metadata +

ok +

+
+National Actions +Incitative Action FIABLE + + + +

blabla

+
+Incitative Action MOUAI + + + +

blabla...

+

Some references , ,

+
+Actions Funded by the EC +Projet LTR TURLU EP-9134867 +

A citation using the \footcite command

+
+Réseau TMR RATA +

blabla

+
An example of an eps file +
+
+
+Animation de la Communauté scientifique +

A citation using the \refercite +(major publications of the Team). +

+Teaching +

... +Note. Optional arguments like [htbp] to the figure environment will be ignored.

+
An example of a pdf map reconstructed by using geometrical methods in detecting landmarks +
+

... +citation using \cite for publications of current year.

+

... +

+ + +OPEN/CÆSAR: An Open Software Architecture for Verification, Simulation, and Testing +Proceedings of the First International Conference on Tools and Algorithms for the Construction and Analysis of Systems TACAS'07 (Lisbon, Portugal) +Lecture Notes in Computer Science +1384 +Springer Verlag + +68–84 +Berlin +March +2007 +http://www.inria.fr/rrrt/rr-3352.htmlFull version available as INRIA Research Report RR-3352 + + + +Compilation of LOTOS Abstract Data Types +Proceedings of the 2nd International Conference on Formal Description Techniques FORTE'89 (Vancouver B.C., Canada) +North-Holland + +147–162 +December +1989 + + + +SVL: a Scripting Language for Compositional Verification +Proceedings of the 21st IFIP WG 6.1 International Conference on Formal Techniques for Networked and Distributed Systems FORTE'2001 (Cheju Island, Korea) +IFIP +Kluwer Academic Publishers + +377–392 +August +2001 +http://www.inria.fr/rrrt/rr-4223.htmlFull version available as INRIA Research Report RR-4223 + + + +Numerical Journals : theoretical aspects +Universitext Series +Springer-Verlag +2007 +http://www.inrialpes.fr/no +no +yes + + +Proceedings of the 19th IEEE Symposium on Computer Arithmetic + +IEEE Conference Publishing Services +2010 +yes +yes + + + +Développement d'objets avec XML +2010 +http://www.inria.fr/ + + +TEI +Ph. D. Thesis +Humboldt-Universitat zu Berlin +2010 +http://www.hu-berlin.de/ + + +Color, Broadcasting and Prototyping +Springer-Verlag +April +2010 +248-350 +http://hal.inria.fr/no +yes +UK,GB +To appear + + + +The Future of Electronic Journals +Serials Review +4 +2011 +80 +http://www.cnrs.fr/yes +yes +US,PT +http://hal.archives-ouvertes.fr/hal-00362159/fr/ + + + +Bioprocess Control +Lavosier +May +2008 +5 +43-50 +no +yes + + + +Electronic Journals Increase +Online 2007, London +December +2010 +yes +no +IT,VN + + + +Optimizing the ontology of complex neural networks +European Conference on Complex Systems +JISC Publishing +2009 +yes +yes +yes +GB + + + +XML and XSLT +Feb +2010 +yes + + + +Tralics, a LaTeX to XML translator +Technical report +INRIA +2010 + + + +Algorithmes unicode pour les lettres Ààéçœ et Ñ +2010 +CH,HK + + + +Evolutionary Algorithms on Large Networks +2010 +US + + + +Algorithmics and Athletics +2010 +CH,HK + + + +Un web sémantique en entreprise +Masters thesis +Université Paris VI +2011 + + + +Efficient Algorithms for Linear Ordinary Differential Equations +Cuarto Encuentro de Álgebra Computacional y Aplicaciones + +159-163 +September +2007 +
diff --git a/thirdparty/tralics-2.15.2/Modele/fptest.xml b/thirdparty/tralics-2.15.2/Modele/fptest.xml new file mode 100644 index 0000000..bff31b5 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/fptest.xml @@ -0,0 +1,958 @@ + + + + +

DOCSTART

+testing fp +Testing fp +

-8.9=-8.9

+
+Characters +Ѐ +Ё +Ђ +Ѓ +Є +Ѕ +І +Ї +Ј +Љ +Њ +Ћ +Ќ +Ѝ +Ў +Џ +А +Б +В +Г +Д +Е +Ж +З +И +Й +К +Л +М +Н +О +П +Р +С +Т +У +Ф +Х +Ц +Ч +Ш +Щ +Ъ +Ы +Ь +Э +Ю +Я +а +б +в +г +д +е +ж +з +и +й +к +л +м +н +о +п +р +с +т +у +ф +х +ц +ч +ш +щ +ъ +ы +ь +э +ю +я +ѐ +ё +ђ +ѓ +є +ѕ +і +ї +ј +љ +њ +ћ +ќ +ѝ +ў +џ +Ґ +ґ +Ғ +ғ +94 +95 +Җ +җ +Ҙ +ҙ +Қ +қ +Ҝ +ҝ +9e +9f +Ҡ +ҡ +Ң +ң +Ҥ +ҥ +a6 +a7 +a8 +a9 +Ҫ +ҫ +ac +ad +Ү +ү +Ұ +ұ +Ҳ +ҳ +b4 +b5 +Ҷ +ҷ +Ҹ +ҹ +Һ +һ +bc +bd +be +bf +Ӏ +Ӂ +ӂ +c3 +c4 +Ӆ +ӆ +c7 +c8 +Ӊ +ӊ +cb +cc +Ӎ +ӎ +ӏ +Ӑ +ӑ +Ӓ +ӓ +Ӕ +ӕ +Ӗ +ӗ +Ә +ә +Ӛ +ӛ +Ӝ +ӝ +Ӟ +ӟ +e0 +e1 +Ӣ +ӣ +Ӥ +ӥ +Ӧ +ӧ +Ө +ө +Ӫ +ӫ +Ӭ +ӭ +Ӯ +ӯ +Ӱ +ӱ +Ӳ +ӳ +Ӵ +ӵ +- +- +Ӹ +ӹ +Ӻ +ӻ +Ӽ +ӽ +Ӿ +ӿ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ế + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ç, ő, ȍ, ö, ą, ḇ, ạ, ă, ȃ, ǎ, ḛ, å, ḁ, +ả, ḙ. +è é ê ë ã ė ē +ǣǽǻǿíǡ ǟ ǘ ǜ ǚ ḉ ḝ +ṩ ế

+

Ṻ Ǟ Ȫ Ǘ Ḯ Ǜ Ǡ Ȱ +Ȭ Ǭ Ṹ Ǿ Ṓ Ḗ Ṥ Ḉ +Ấ Ố

+

Ế Ṑ Ḕ Ḹ Ṝ +Ầ Ề Ứ Ớ Ừ Ờ Ử Ở +Ữ Ỡ Ự Ợ Ậ

+

Ộ Ệ Ẫ +Ỗ Ễ Ẩ Ổ Ể Ắ Ằ Ẳ +Ẵ Ặ Ṏ Ố Ồ Ḝ Ṧ Ṩ

+

1d400𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏1d410𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟1d420𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯1d430𝐰𝐱𝐲𝐳𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿1d440𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍𝑎𝑏1d450𝑐𝑑𝑒𝑓𝑔+𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟1d460𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯1d470𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿1d480𝒀𝒁𝒂𝒃𝒄𝒅𝒆𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎𝒏1d490𝒐𝒑𝒒𝒓𝒔𝒕𝒖𝒗𝒘𝒙𝒚𝒛𝒜+𝒞𝒟1d4a0++𝒢++𝒥𝒦++𝒩𝒪𝒫𝒬+𝒮𝒯1d4b0𝒰𝒱𝒲𝒳𝒴𝒵𝒶𝒷𝒸𝒹+𝒻+𝒽𝒾𝒿1d4c0𝓀𝓁𝓂𝓃+𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏1d4d0𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟1d4e0𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩𝓪𝓫𝓬𝓭𝓮𝓯1d4f0𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿

+

1d500𝔀𝔁𝔂𝔃𝔄𝔅+𝔇𝔈𝔉𝔊++𝔍𝔎𝔏1d510𝔐𝔑𝔒𝔓𝔔+𝔖𝔗𝔘𝔙𝔚𝔛𝔜+𝔞𝔟1d520𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯1d530𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷𝔸𝔹+𝔻𝔼𝔽𝔾+1d540𝕀𝕁𝕂𝕃𝕄+𝕆+++𝕊𝕋𝕌𝕍𝕎𝕏1d550𝕐+𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟1d560𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫𝕬𝕭𝕮𝕯1d570𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿1d580𝖀𝖁𝖂𝖃𝖄𝖅𝖆𝖇𝖈𝖉𝖊𝖋𝖌𝖍𝖎𝖏1d590𝖐𝖑𝖒𝖓𝖔𝖕𝖖𝖗𝖘𝖙𝖚𝖛𝖜𝖝𝖞𝖟1d5a0𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯1d5b0𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹𝖺𝖻𝖼𝖽𝖾𝖯1d5c0𝗀𝗁𝗂𝗃𝗄𝗅𝗆𝗇𝗈𝗉𝗊𝗋𝗌𝗍𝗎𝗏1d5d0𝗐𝗑𝗒𝗓𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟1d5e0𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭𝗮𝗯1d5f0𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿

+

1d600𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏1d610𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟1d620𝘠𝘡𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯1d630𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻𝘼𝘽𝘾𝘿1d640𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏1d650𝙐𝙑𝙒𝙓𝙔𝙕𝙖𝙗𝙘𝙙𝙚𝙛𝙜𝙝𝙞𝙟1d660𝙠𝙡𝙢𝙣𝙤𝙥𝙦𝙧𝙨𝙩𝙪𝙫𝙬𝙭𝙮𝙯1d670𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿1d670𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿1d680𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉𝚊𝚋𝚌𝚍𝚎𝚏1d690𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟1d6a0𝚠𝚡𝚢𝚣𝚨𝚩𝚪𝚫𝚬𝚭𝚮𝚯1d6b0𝚰𝚱𝚲𝚳𝚴𝚵𝚶𝚷𝚸𝚹𝚺𝚻𝚼𝚽𝚾𝚿1d6c0𝛀𝛁𝛂𝛃𝛄𝛅𝛆𝛇𝛈𝛉𝛊𝛋𝛌𝛍𝛎𝛏1d6d0𝛐𝛑𝛒𝛓𝛔𝛕𝛖𝛗𝛘𝛙𝛚𝛛𝛜𝛝𝛞𝛟1d6e0𝛠𝛡𝛢𝛣𝛤𝛥𝛦𝛧𝛨𝛩𝛪𝛫𝛬𝛭𝛮𝛯1d6f0𝛰𝛱𝛲𝛳𝛴𝛵𝛶𝛷𝛸𝛹𝛺𝛻𝛼𝛽𝛾𝛿

+

1d700𝜀𝜁𝜂𝜃𝜄𝜅𝜆𝜇𝜈𝜉𝜊𝜋𝜌𝜍𝜎𝜏1d710𝜐𝜑𝜒𝜓𝜔𝜕𝜖𝜗𝜘𝜙𝜚𝜛𝜜𝜝𝜞𝜟1d720𝜠𝜡𝜢𝜣𝜤𝜥𝜦𝜧𝜨𝜩𝜪𝜫𝜬𝜭𝜮𝜯1d730𝜰𝜱𝜲𝜳𝜴𝜵𝜶𝜷𝜸𝜹𝜺𝜻𝜼𝜽𝜾𝜿1d740𝝀𝝁𝝂𝝃𝝄𝝅𝝆𝝇𝝈𝝉𝝊𝝋𝝌𝝍𝝎𝝏1d750𝝐𝝑𝝒𝝓𝝔𝝕𝝖𝝗𝝘𝝙𝝚𝝛𝝜𝝝𝝞𝝟1d760𝝠𝝡𝝢𝝣𝝤𝝥𝝦𝝧𝝨𝝩𝝪𝝫𝝬𝝭𝝮𝝯1d7c0𝟎𝟏1d7d0𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟1d7e0𝟠𝟡𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫𝟬𝟭𝟮𝟯1d7f0𝟰𝟱𝟲𝟳𝟴𝟵𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿

+

23002310232023302340235026002640265026602680

+

220022102220223022402250226022702280229022a022b022c022d022e022f0

+

&#x2100;&#x2101;&#x2103;&#x2104;&#x2105;&#x2106;&#x2107;&#x2108;&#x2109;&#x210A;&#x210B;&#x210C;&#x210D;&#x210E;&#x210F;&#x2110;&#x2111;&#x2112;&#x2113;&#x2114;&#x2115;&#x2116;&#x2117;&#x2118;&#x2119;&#x211A;&#x211B;&#x211C;&#x211D;&#x211E;&#x211F;&#x2120;&#x2121;&#x2122;&#x2123;&#x2124;&#x2125;&#x2126;&#x2127;&#x2128;&#x2129;&#x212A;&#x212B;&#x212C;&#x212D;&#x212E;&#x212F;&#x2130;&#x2131;&#x2132;&#x2133;&#x2134;&#x2135;&#x2136;&#x2137;&#x2138;&#x2139;&#x213A;&#x213B;&#x213D;&#x213E;&#x213F;&#x2140;&#x2141;&#x2142;&#x2143;&#x2144;&#x2145;&#x2146;&#x2147;&#x2148;&#x2149;&#x214A;&#x214B;

+

2190.21A0.&#x21af;21B0....21C021D0..21E0............21F0............

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ḿ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ṿ +
+

 â Ấ ấ Ầ ầ Ẩ ẩ Ẫ ẫ +Ậ ậ Ĉ ĉ

+

Ê ê Ế ế Ề ề Ể +ể Ễ ễ Ệ ệ Ĝ ĝ Ĥ ĥ Î î Ĵ ĵ

+

Ô ô Ố ố Ồ ồ Ổ ổ Ỗ ỗ +Ộ ộ Ŝ ŝ Û û Ŵ ŵ Ŷ ŷ Ẑ ẑ +Á á Ǻ ǻ Ǽ ǽ Ấ ấ Ắ ắ +Ć ć Ḉ ḉ É é Ḗ +ḗ Ế ế Ǵ ǵ Í í

+

Ḯ ḯ Ḱ ḱ Ĺ ĺ Ḿ +ḿ Ń ń Ó ó Ǿ ǿ Ṍ ṍ Ṓ ṓ Ố +ố Ớ ớ

+

Ṕ ṕ Ŕ ŕ Ś ś +Ṥ ṥ Ú ú Ǘ ǘ Ṹ ṹ Ứ ứ +Ẃ ẃ Ý ý Ź ź +À à Ầ ầ Ằ ằ È è Ḕ ḕ Ề +ề Ì ì Ǹ ǹ

+

Ò ò Ṑ ṑ Ồ ồ +Ờ ờ Ù ù Ǜ ǜ Ừ ừ Ẁ ẁ Ỳỳ +Ä ä Ǟ ǟ Ë ë Ḧ ḧ Ï ï Ḯ ḯ Ö ö +Ȫ ȫ Ṏ ṏ ẗ

+

Ü ü Ṻ ṻ Ǜ ǜ +Ǘ ǘ Ǚ ǚ Ẅ ẅ Ẍ ẍ Ÿ ÿ +Ç ç Ḉ ḉ Ḑ ḑ Ȩ ȩ Ḝ ḝ

+

Ḩ ḩ Ģ ģ Ķ ķ Ļ ļ Ņ ņ Ŗ ŗ Ş ş Ţ ţ +Ȁ ȁ Ȅ ȅ Ȉ ȉ Ȍ ȍ Ȑ ȑ Ȕ ȕ +Ă ă Ằ ằ Ắ ắ Ẳ ẳ Ẵ ẵ +Ặ ặ

+

Ĕ ĕ Ḝ ḝ Ğ ğ Ĭ ĭ +Ŏ ŏ Ŭ ŭ +Ǎ ǎ Č č Ď ď Ě ě Ǧ ǧ Ȟ ȟ Ǩ ǩ +Ǐ ǐ ǰ Ľ ľ Ň ň

+

Ǒ +ǒ Ř ř Š š Ť ť Ǔ ǔ Ǚ ǚ Ṧ +ṧ Ž ž +Ő ő Ű ű

+

Ớ ớ Ờ ờ Ở ở Ỡ ỡ +Ợ ợ

+

Ứ ứ Ừ ừ Ử ử Ữ +ữ Ự ự +Ả ả Ẩ ẩ Ẳ ẳ Ẻ ẻ Ể ể Ỉ +ỉ

+

Ỏ ỏ Ổ ổ Ở ở Ủ ủ +Ử ử Ỷ ỷ +Ą ą Ę ę Į į Ǫ ǫ Ǭ ǭ Ų ų +Å å Ů ů ẘ ẙ +Ạ ạ Ậ ậ Ặ ặ Ḅ ḅ Ḍ ḍ Ẹ ẹ +Ệ ệ Ḥ ḥ Ị ị Ḳ ḳ Ḷ ḷ Ḹ ḹ

+

Ṃ ṃ Ṇ ṇ Ọ ọ Ộ ộ Ợ ợ +Ṛ ṛ Ṝ ṝ Ṣ ṣ Ṩ ṩ Ṭ

+

ṭ Ụ ụ Ự ự Ṿ +ṿ Ẉ ẉ Ỵ ỵ Ẓ ẓ +Ḁ ḁ +Ḇ ḇ Ḏ ḏ ẖ Ḵ ḵ Ḻ ḻ +Ṉ ṉ Ṟ ṟ Ṯ ṯ Ẕ ẕ +Ȃ ȃ Ȇ ȇ Ȋ ȋ Ȏ ȏ Ȓ ȓ Ȗ ȗ +Ḛ ḛ Ḭ ḭ Ṵ ṵ +Ḓ ḓ Ḙ ḙ Ḽ ḽ Ṋ ṋ Ṱ ṱ Ṷ ṷ +Ā ā Ǟ ǟ Ǡ ǡ ǢǣĒ ē Ḗ ḗ +Ḕ ḕ Ḡ ḡ Ħ ħ

+

Ī ī Ḹ ḹ Ō ō Ǭ ǭ Ȫ ȫ Ȭ +ȭ Ȱ ȱ Ṑ ṑ Ṓ ṓ

+

Ṝ ṝ +Ŧ ŧ Ū ū Ṻ ṻ Ȳ ȳ +Ȧ ȧ Ǡ ǡ Ḃ ḃ Ċ ċ Ḋ ḋ Ė ė Ḟ ḟ Ġ ġ Ḣ +ḣ İ

+

Ŀ ŀ Ṁ ṁ Ṅ ṅ Ȯ ȯ Ȱ ȱ Ṗ ṗ Ṙ ṙ

+

Ṡ +ṡ Ṩ ṩ Ṧ ṧ Ṥ ṥ Ṫ ṫ Ẇ ẇ Ẋ +ẋ Ẏ ẏ Ż ż

+

✁ ✂ ✃ ✄ ☎ ✆ ✇ +✈ ✉ ☛ ☞ ✌ ✍ ✎ ✏

+

✐ ✑ ✒ ✓ ✔ ✕ ✖ ✗ +✘ ✙ ✚ ✛ ✜ ✝ ✞ ✟

+

✠ ✡ ✢ ✣ ✤ ✥ ✦ ✧ +★ ✩ ✪ ✫ ✬ ✭ ✮ ✯

+

✰ ✱ ✲ ✳ ✴ ✵ ✶ ✷ +✸ ✹ ✺ ✻ ✼ ✽ ✾ ✿

+

❀ ❁ ❂ ❃ ❄ ❅ ❆ ❇ +❈ ❉ ❊ ❋ ● ❍ ■ ❏

+

❐ ❑ ❒ ▲ ▼ ◆ ❖ ◗ +❘ ❙ ❚ ❛ ❜ ❝ ❞

+

❡ ❢ ❣ ❤ ❥ ❦ ❧ +♣ ♦ ♥ ♠ ① ② ③ ④

+

⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ❶ ❷ +❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿

+

➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ +➈ ➉ ➊ ➋ ➌ ➍ ➎ ➏

+

➐ ➑ ➒ ➓ ➔ → ↔ ↕ +➘ ➙ ➚ ➛ ➜ ➝ ➞ ➟

+

➠ ➡ ➢ ➣ ➤ ➥ ➦ ➧ +➨ ➩ ➪ ➫ ➬ ➭ ➮ ➯

+

➱ ➲ ➳ ➴ ➵ ➶ ➷ +➸ ➹ ➺ ➻ ➼ ➽ ➾

+

฿₩₦₤₫€ƒ‰‱※†‡‶a″a‵a′℃⁅⁆Ω℧℞℗№℠ƒf℠℮• ‽ +

+

TABLE + +  ¡ ¢ £ ¤ ¥ +¦ § ¨ © +ª « ¬ ­ +® ¯

+

° ± ² ³ ´ +µ ¶ · ¸ +¹ º » ¼ +½ ¾ ¿

+

À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï

+

Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß

+

à á â ã ä å æ ç è é ê ë ì í î ï

+

ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ

+

LATIN1

+  +¡ +¢ +£ +¤ +¥ +¦ +§ +¨ +© +ª +« +¬ +- +® +¯ +° +± +² +³ +´ +µ + +· +¸ +¹ +º +» +¼ +½ +¾ +¿ +À +Á +Â +Ã +Ä +Å +Æ +Ç +È +É +Ê +Ë +Ì +Í +Î +Ï +Ð +Ñ +Ò +Ó +Ô +Õ +Ö +× +Ø +Ù +Ú +Û +Ü +Ý +Þ +ß +à +á +â +ã +ä +å +æ +ç +è +é +ê +ë +ì +í +î +ï +ð +ñ +ò +ó +ô +õ +ö +÷ +ø +ù +ú +û +ü +ý +þ +ÿ +

+

+ +! +" +# +$ +% +& +' +( +) +* ++ +, +- +. +/ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +: +; +< += +> +? +@ +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +[ +\ +] +^ +_ +` +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +{ +| +} +~ + +

+

+Ā +ā +Ă +ă +Ą +ą +Ć +ć +Ĉ +ĉ +Ċ +ċ +Č +č +Ď +ď +Đ +đ +Ē +ē +Ĕ +ĕ +Ė +ė +Ę +ę +Ě +ě +Ĝ +ĝ +Ğ +ğ +Ġ +ġ +Ģ +ģ +Ĥ +ĥ +Ħ +ħ +Ĩ +ĩ +Ī +ī +Ĭ +ĭ +Į +į +İ +ı +IJ +ij +Ĵ +ĵ +Ķ +ķ +ĸ +Ĺ +ĺ +Ļ +ļ +Ľ +ľ +Ŀ +ŀ +Ł +ł +Ń +ń +Ņ +ņ +Ň +ň +ʼn +Ŋ +ŋ +Ō +ō +Ŏ +ŏ +Ő +ő +Œ +œ +Ŕ +ŕ +Ŗ +ŗ +Ř +ř +Ś +ś +Ŝ +ŝ +Ş +ş + +Š +š +Ţ +ţ +Ť +ť +Ŧ +ŧ +Ũ +ũ +Ū +ū +Ŭ +ŭ +Ů +ů +Ű +ű +Ų +ų +Ŵ +ŵ +Ŷ +ŷ +Ÿ +Ź +ź +Ż +ż +Ž +ž +ſ +

+

+

$%& {}_# +j™

+

​␣\SS

+

/.

+

1F: ǵ +A:  ¡§© »

+

B: ¶« ¿

+

C:ÅÆ

+

D: ØÐÞß

+

E: åæ

+

F:øðýþ

+

é è é ê ë ã ė ē +ç, ĕ, ě, ő, ę, ů

+

Ç ç Ḉ ḉ Ḑ ḑ Ȩ ȩ Ḝ ḝ

+

Ḩ ḩ Ģ ģ Ķ ķ Ļ ļ Ņ ņ Ŗ ŗ Ş ş Ţ ţ +

+

Ả ả Ẩ ẩ Ẳ ẳ Ẻ ẻ Ể ể Ỉ +ỉ

+

Ỏ ỏ Ổ ổ Ở ở Ủ ủ +Ử ử Ỷ ỷ

+

pounds££

+

a » b« c« d »e +a » b« c«d»e +a« b« c«  d« e  »f  »g »h »i +a<<b<< c<< d<< e >>f >>g >>h>>i +a« b« c«  d« e  »f  »g »h »i +a«b« c« d« e »f »g »h»i

+

a refaire +the love that men to hym owen.

+

AT_DOC_END

+
diff --git a/thirdparty/tralics-2.15.2/Modele/hello.xml b/thirdparty/tralics-2.15.2/Modele/hello.xml new file mode 100644 index 0000000..3b9fd37 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/hello.xml @@ -0,0 +1,6 @@ + + + + +

Hello, world! +

diff --git a/thirdparty/tralics-2.15.2/Modele/hello1-no.xml b/thirdparty/tralics-2.15.2/Modele/hello1-no.xml new file mode 100644 index 0000000..01de241 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/hello1-no.xml @@ -0,0 +1,7 @@ + + + +
+

Hello, world! +

+
diff --git a/thirdparty/tralics-2.15.2/Modele/hello1.xml b/thirdparty/tralics-2.15.2/Modele/hello1.xml new file mode 100644 index 0000000..0272540 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/hello1.xml @@ -0,0 +1,7 @@ + + + + +

Hello, world! +

+
diff --git a/thirdparty/tralics-2.15.2/Modele/hello2.xml b/thirdparty/tralics-2.15.2/Modele/hello2.xml new file mode 100644 index 0000000..3276ed4 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/hello2.xml @@ -0,0 +1,7 @@ + + + +
+

Hello, world! +

+
diff --git a/thirdparty/tralics-2.15.2/Modele/hello3.xml b/thirdparty/tralics-2.15.2/Modele/hello3.xml new file mode 100644 index 0000000..db65d71 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/hello3.xml @@ -0,0 +1,11 @@ + + + + +
+<abstract>No abstract given</abstract> +<author>José Grimm</author> + +

Hello, world! +

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testb.xml b/thirdparty/tralics-2.15.2/Modele/testb.xml new file mode 100644 index 0000000..4d25430 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testb.xml @@ -0,0 +1,21 @@ + + + + + +

Joe And, Joe And, Joe-And, et al. +X.

+

A b Cde. +X.

+

Charles Louis Xavier Joseph de la Vallée Poussin. +X.

+

Maria De La Cruz. +X.

+

, , , ,

+

a: (prenote ;;;;, postnote) +b: (;;;;) +d: (;;;;, post) +e: (pre ;;;;) +f: (pre )

+

Hey

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testb0.xml b/thirdparty/tralics-2.15.2/Modele/testb0.xml new file mode 100644 index 0000000..259c375 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testb0.xml @@ -0,0 +1,718 @@ + + + + + + + + + + + +b-title +c-journal +d-number +e-volume +f-month +g-year +h-pages +some-urli-note + + + +b-title +c-journal +d-number +e-volume +f-month +g-year +h-pages +some-urli-note + + + + +c-title +d-edition +e-series +f-number +g-volume +h-publisher +i-address +j-month +k-year +l-note + + + +b-title +c-howpublished +d-address +e-month +f-year +g-note + + + +b-title +Ph. D. Thesis +c-school +d-year + + + +b-title +c-type +d-school +e-address +f-month +g-year +h-note + + + +b-title +Masters thesis +c-school +d-year + + + +b-title +c-type +d-school +e-address +g-month +h-year +i-note + + + +b-title +Technical report +c-institution +d-year + + + +Title, Majuscule, Majuscule, Majuscule +journal +2003 + + + +b-title +c-type +d-number +e-institution +f-addres +g-month +h-year +i-note + + + +b +c-organization +d-edition +e-address +f-month +g-year +h-note + + + +b-title +c-note + + + +b-title +c-month +d-year +e-note + + + +b-title +c-howpublished +d-month +e-year +f-note + + + +b-title, ACCENTáéíóúý, ÁÉÍÓÚÝ àèìòù, ÀÈÌÒÙ, âêîôû, ÂÊÎÔÛ äëïöüÿ, ÄËÏÖÜ ñ Ñ +c-booktitle + + + +b-title +c-booktitle +d-series +e-number +f-volume +g-organization +h-publisher + +j-pages +k-address +l-month +m-year +n-note + + + +b-title : et du texte +c-booktitle +http://www.inria.fr/~grimm + + +b-title + +d-booktitle +e-series +f-number +g-volume +h-publisher +i-address +j-month +k-year +l-chapter +m-pages +n-note + + + + +c-title +d-edition +e-series +f-number +g-volume +h-publisher +i-address +j-month +k-year +l-chapter +m-pages +n-note + + + +A beautiful title +A journal +16 +17 +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + + +A beautiful title +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Available by anonymous ftp +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + + +A beautiful title +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +January +2000 +First and second +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +Title of the book +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +January +2000 +First and second +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Title of the book +15 +16 +17 +Unknown Organisation +Publishing&Co, Inc. + +12-13 +Paris, New Yorkm, Amsterdam +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Unknown Organisation +Second +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Some type +The best school in the word +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Available by anonymous ftp + +Title of the book +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Some type +The best school in the word +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +Some type +16 +Some well-known institution +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + + +X + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +X + + + +BRACETEST1 leave leave a leave H + + + +Some title +http://www.inria.fr/rrrt/rt-0265.html50 +70 +21 +some note + + + +De XML à PDF avec xmltex et Passive +Cahiers Gutenberg +35-36 +79-114 +2000 + + + +Mathematical Markup Language (MathML) Version 2.0 +http://www.w3.org/TR/MathML2/ +2001 + + + +X + + + +BRACETEST6 leaveABCx del delIetc + + + +X + + +a11 + + +c +d +e-number +f-volume +g +h +i +j-year +k + + +A beautiful title + +Unknown Organisation +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +January +2000 +12-13 +A DOI +http://www.mysite.mycountry/mypage + + +BRACETEST4 leaveABCx deltc leaveIetc + + + +BRACETEST5 leaveABCx deltc leaveIetc + + + +The companion +Addison Wesley +1993 + + + +Extending ML with semi-explicit higher-order polymorphism +Journal of Functional Programming +1/2 +155 +1999 +134-169 +ftp://ftp.inria.fr/INRIA/Projects/Cristal/iandc.ps.gz + + +Outils pour la manipulation du rapport d'activité +Technical report +RT-0265 +Inria +2002 +http://www.inria.fr/rrrt/rt-0265.html + + +A title +somewhere +http://www.inria.fr +The Big Organizer +2010 + + + +BRACETEST2 delABCx delHh + + + +BRACETEST3 leaveABCx leaveH delAb + + + +Produire du MathML et autres ...ML à partir d'Ω : Ω se généralise +Cahiers Gutenberg +33-34 +173-182 +1999 + + + + +a14 + + +a22 + + +a10 +b-year + + +c, L 2 +d–e—f +e-year + + + +The book +Addison Wesley +1984 + + + +Une expérience d'utilisation de LaTeX : le Rapport d'activité de l'INRIA +Cahiers Gutenberg +0 +apr +1988 +17-24 + + + + + + +Passive +http://www.tei-c.org.uk/Software/passivetex/ +2003 + + + +Problèmes extrémaux dans les espaces de Hardy, Application à l'identification de filtres hyperfréquences à cavités couplées +Ph. D. Thesis +Ecole de Mines de Paris +1998 + + + +Problèmes extrémaux dans les espaces de Hardy, Application à l'identification de filtres hyperfréquences à cavités couplées + +Thèse de doctorat +Ecole de Mines de Paris +1998 +foo + + +c-title +e-publisher +f-year +d-chapter + + + +The Unicode Standard, version 3.0 +Addison Wesley +2000 + + +journal +2003 + + + + + + + + + + + +Docbook. The Definite Guide +O'Reilly & Associates, Inc +1999 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2003 + + + +1789 + + + + + + + + + + + + + + + + + + + + + + + + +X + + + +X + diff --git a/thirdparty/tralics-2.15.2/Modele/testb1.xml b/thirdparty/tralics-2.15.2/Modele/testb1.xml new file mode 100644 index 0000000..e479381 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testb1.xml @@ -0,0 +1,854 @@ + + + + + + + + + + + +b-title +c-journal +d-number +e-volume +h-pages +f-month +g-year +some-urli-note + + + +b-title +c-journal +d-number +e-volume +h-pages +f-month +g-year +some-urli-note + + + +c-title + +d-edition +e-series +f-number +g-volume +h-publisher +i-address +j-month +k-year +l-note + + + +b-title +d-address +c-howpublished +e-month +f-year +g-note + + + +b-title + +Ph. D. Thesis +c-school +d-year + + + +b-title +e-address +c-type +d-school +f-month +g-year +h-note + + + +b-title +Masters thesis +c-school +d-year + + + +b-title +e-address +c-type +d-school +g-month +h-year +i-note + + + +b-title +Technical report +c-institution +d-year + + + +Title, Majuscule, Majuscule, Majuscule +journal +2003 + + + +b-title +d-number +f-addres +c-type +e-institution +g-month +h-year +i-note + + + +b +d-edition +e-address +c-organization +f-month +g-year +h-note + + + +b-title +c-note + + + +b-title +c-month +d-year +e-note + + + +b-title +c-howpublished +d-month +e-year +f-note + + + +b-title, ACCENTáéíóúý, ÁÉÍÓÚÝ àèìòù, ÀÈÌÒÙ, âêîôû, ÂÊÎÔÛ äëïöüÿ, ÄËÏÖÜ ñ Ñ +c-booktitle + + + +b-title + +d-series +e-number +f-volume +h-publisher +k-address +c-booktitle +g-organization +j-pages +l-month +m-year +n-note + + + +b-title : et du texte +c-booktitle +http://www.inria.fr/~grimm + + +b-title + +xo-edition +e-series +f-number +g-volume +h-publisher +i-address +d-booktitle +m-pages +l-chapter +xl-type +j-month +k-year +n-note + + + +c-title + +d-edition +e-series +f-number +g-volume +h-publisher +i-address +m-pages +l-chapter +xk +j-month +k-year +n-note + + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + + +X + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +X + + + +BRACETEST1 leave leave a leave H + + + +Some title +http://www.inria.fr/rrrt/rt-0265.html50 +70 +21 +some note + + + +De XML à PDF avec xmltex et Passive +35-36 +Cahiers Gutenberg +79-114 +2000 + + + +Mathematical Markup Language (MathML) Version 2.0 +http://www.w3.org/TR/MathML2/ +2001 + + + +X + + + +BRACETEST6 leaveABCx del delIetc + + + +X + + +a11 + + +d +e-number +f-volume +g +h +c +i +j-year +k + + + +A beautiful title + +A journal +Second +15 +16 +17 +Publishing&Co, Inc. +Paris, New Yorkm, Amsterdam +Available by anonymous ftp +Title of the book +Unknown Organisation +12-13 +First and second +Some type +The best school in the word +Some well-known institution +January +2000 +A DOI +http://www.mysite.mycountry/mypage + + +BRACETEST4 leaveABCx deltc leaveIetc + + + +BRACETEST5 leaveABCx deltc leaveIetc + + + +The companion +Addison Wesley +1993 + + + +Extending ML with semi-explicit higher-order polymorphism +Journal of Functional Programming +1/2 +155 +134-169 +1999 +ftp://ftp.inria.fr/INRIA/Projects/Cristal/iandc.ps.gz + + +Outils pour la manipulation du rapport d'activité +RT-0265 +Technical report +Inria +2002 +http://www.inria.fr/rrrt/rt-0265.html + + +A title +somewhere +http://www.inria.fr +The Big Organizer +2010 + + + +BRACETEST2 delABCx delHh + + + +BRACETEST3 leaveABCx leaveH delAb + + + +Produire du MathML et autres ...ML à partir d'Ω : Ω se généralise +33-34 +Cahiers Gutenberg +173-182 +1999 + + + + +a14 + + +a22 + + +a10 +b-year + + +c, L 2 +d–e—f +e-year + + + +The book +Addison Wesley +1984 + + + +Une expérience d'utilisation de LaTeX : le Rapport d'activité de l'INRIA +Cahiers Gutenberg +0 +17-24 +apr +1988 + + + + + + +Passive +http://www.tei-c.org.uk/Software/passivetex/ +2003 + + + +Problèmes extrémaux dans les espaces de Hardy, Application à l'identification de filtres hyperfréquences à cavités couplées +Ph. D. Thesis +Ecole de Mines de Paris +1998 + + + +Problèmes extrémaux dans les espaces de Hardy, Application à l'identification de filtres hyperfréquences à cavités couplées + +Thèse de doctorat +Ecole de Mines de Paris +1998 +foo + + +c-title +e-publisher +d-chapter +f-year + + + +The Unicode Standard, version 3.0 +Addison Wesley +2000 + + +journal +2003 + + + + + + + + + + + +Docbook. The Definite Guide +O'Reilly & Associates, Inc +1999 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2003 + + + +1789 + + + + + + + + + + + + + + + + + + + + + + + + +X + + + +X + diff --git a/thirdparty/tralics-2.15.2/Modele/testbe.xml b/thirdparty/tralics-2.15.2/Modele/testbe.xml new file mode 100644 index 0000000..6a2faf3 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testbe.xml @@ -0,0 +1,116 @@ + + + + + +

Test of bordermatrix

+

abcdef(ghij)klmnopqrst

+

no row +one row 123 +first row empty 1(23) +first row small 11(23) +second row empty 1212 +second row small 123 +first row OK 123(4<)

+

Testing spaces in math +8.53581pt25.0pt36.0ptx 2 ++=0y 2 +x 2 ++=0y 2 +x 2 aabbccddy 2 +x 2 aabbccddy 2

+

xxyy

+

Test of spaces between \begin{description} and \item

+Requirements + + + +

the input distribution : inputDistribution

+
+

: Distribution

+
+ + +
+
Results + + + +

the random input vector : inputRandomVector

+
+

: RandomVector which implementation is a UsualRandomVector

+
+ + +
+
+

class Exception {

+

public :

+

        Exception ( const char *description, const char * comment = 0 ) ;

+

        virtual ~Exception( ) throw();

+

        /* ... */

+

        friend ostream & operator<< (ostream &, const Exception & e ) ;

+

} ;

+

This is a test file for the listings package + +// In a case like \def\bar#1foo#2{...}, this returns the value of #1 +// given the token list foo as argument. +TokenList Parser::read_delimited (const TokenList& L) +{ + TokenList res; + scanner_status = ss_matching; + scan_group_del(res,L); + scanner_status = ss_normal; + return res; +}

+

+one +

Footnotes and fontsnormalitalic after note.

+

Hey Footnotes and fontsnormalitalic after note.

+

This is large This is red +This is italicsNormalNote small note blue note after the note after italic

+

after red +after large

+
+Two +

Some text.

+

Texte1.

+ +

Rule A

+
+

texte fin1.

+

Texte2.

+ +

Rule B

+
+

texte fin2.

+

Texte3

+ +

Rule C

+
+

texte fin3.

+

Liens et et . Lien +

+

3 ok'3 + 4 ok4 + 5 ok5 + 6 OK6

+

+

foo bar +

+

We are in H-mode here

+
+One in appendix +

Some text.

+
+Two in appendix +

Some text. +References ,

+

this is the verbatim stuff

+

Test grabenv +CxDAyzBt +AyzBt=

+

http://www.inria.fr +http://www.inria.fr +http://www.inria.fr

+

a~b~n_d +a~b~n_d

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testclass.xml b/thirdparty/tralics-2.15.2/Modele/testclass.xml new file mode 100644 index 0000000..e00475e --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testclass.xml @@ -0,0 +1,23 @@ + + + + +

OK +ok +ok

+

Reference to figure: +Reference to first subfigure: +Reference to second subfigure:

+
main figure caption +first subfigure caption +second subfigure caption + +
+foo + +sec1Sec + +foo2chapter two + +sec2 +
diff --git a/thirdparty/tralics-2.15.2/Modele/testerr.xml b/thirdparty/tralics-2.15.2/Modele/testerr.xml new file mode 100644 index 0000000..298fe0c --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testerr.xml @@ -0,0 +1,315 @@ + + + + +

This document contains a number of errors. +. +This is a normal + line

+

F1

+

Line1

+

Line2

+

after F1 +F2Line3 +Line4 +after F2 +F3after F3 +Line after input should be OK

+

xA=x +y= +xB=x +y=

+

x incomplete + + +A=a

+

b=cA=a=b]c +A=axparb=c

+

dA=axparb=cd +A=a=b]cA=a=b]c +A=axparb=cdA=axparb=cd

+

Test outer + +>

+

Some math only commands x y

+

Counter overflow +azAZ*Newcommand + + + + + +barbar + + + +

+

WWX

+

WWX + +

+foo +=x=

+

Acc + +ế + + + + + + +

+

Arrays + + + + +w

+

+xx +xx +

+

Testing Optional Argument. +text is Ok +text is Ok +text is Ok +text +textarx

+ + +zt

ok

+

ok +

runaway errors signaled above, and a missing unit here +

+xxx +

+

Is current mode ok here +

+

etc

+

3 errors

+

This is new par +a ba ba ba ba ba b +a b[a +a box

+

Testing get_r_token + + + + + mm 10 +Cannot define 10 +Bad redefinition + +Multiple labels

+

Checking some math errors +x=1 +x=2\frac{3}{4}5 +\left.=\right. +\left(\right. + + we are out of math +

+ x = +

out of math a{bc}\frac{x}{yz}(17)

+

xz +a b c +a +x x y x x y x y z u v + +This is out of math mode

+

More tests +option +Ok outside RA +RC is tested outside RA +d +d +Error here +d +d

+

Xand +

+ +

+ +com +ProjB +ProjC + + +

x() + + +fooAgeefooBgee +fooAgeefooBgee +fooAetcA.fooBetcB. +

+

Check for some unimplemented commands +0,,�,, +,,,, +okok +ok +. +text + +

+

X +foo + +Here we try to converts tokens to numbers +pt `ATesting incompatible mu, first from mu to something else +now scanning mu +bad mu +mu Missing unit +X +fooA \hbox{foo} 412 +No err signaled if etc removed...! + etcbar First arg of \xboxis normal, scond like hbox +FOOO + + +

+ +uu +vu +xxww +zz +

Next par

+

how to check overflow here ? +12pt +12pt This one should be OK + +Ok + + by 1 +ok and bad + + + + +

+

An example of all the font commands + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+

OKlykeyA +OK +OKfamilykeyA +OK

+

Errors from FO + ok + overflow + bad + + + + + + + + + + + + +ok=1 +

+

This is OK + fail +OK +bad + good + bad

+

Lines that follow give missing unit but \badis not called +. Missing unit here +. . .

+

This is a good accent Ắ and Ắ +

+

Now errors + + + + + + +

+

What is the result here ?

+

ok1 +ok2 + + + + + + +

+

Lets try some files foo ok bar bad +

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+

Case of special chars in commande names ! +!

+

More catcodes on Unicode chars +gives foobar OK +givesokbar OK bad €bar bad +okok okok ok +givesok bar OK okbar good +OK + ok OK ok OK + okOOk + okOOk + +aaNull𒍅bb + +aa"12345 bb

+ diff --git a/thirdparty/tralics-2.15.2/Modele/testhtml.xml b/thirdparty/tralics-2.15.2/Modele/testhtml.xml new file mode 100644 index 0000000..d91be7f --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testhtml.xml @@ -0,0 +1,208 @@ + + + + + +

This file tests the html package.

+

It also tests abstract and keyval

+
+

Some font tests

+

B + C D +E +E

+

xxxx + +Some dummy tex file

+

This is piece of code that comes from torture + 1 +2 +3 +4

+

foo +foo +foo

+

AB +AB +AB +AB +A +A +foo +foo

+

B +Bp 100 +Bp101 +Bp102 +B +B +B

+

a +a +a +a +a +a

+

yeahok +Some url

+

a 2 3

+

seen 1 in Fooseen 2 in Barseen dbar in Bar

+ + + +De XML à PDF avec xmltex et Passive +Cahiers Gutenberg +35-36 +79-114 +2000 + + + +Produire du MathML et autres ...ML à partir d'Ω : Ω se généralise +Cahiers Gutenberg +33-34 +173-182 +1999 + + + +The book +Addison Wesley +1984 + + + +Une expérience d'utilisation de LaTeX : le Rapport d'activité de l'INRIA +Cahiers Gutenberg +0 +apr +1988 +17-24 +

THE FUNNY TEST

+

1 +2 +3 +4

+

✁✂✃✄☎✆✇✈✉☛☚☞☜✌✍✏✐✎✑✒✓✔✕✖✗✙✚✜✛✝✞✟✠✡✢✣✤✥✦✨✩★✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❉❊❋❈❇❄❆❅●❍❏❐❑❒▲▼◆❖◗◖❘❙❚➟➦➥➧➲

+

12,345 +123,456 +1,234,567 +12,345,678 +1 234 567 890 123 456 789 012 345 678 901 234 567 890

+

a̖ ạ̀ ạ̀ à̱ à +e̗ é̱ é̱ é +o̭ ộ ộ ô +ṵ ụ͂ ụ͂ ũ +a̤ ä +ę e̋ +o̥ o̱̊ o̱̊ o̊ +u̬ ú̬ á̬ ǔ +a̯ ă̠ ă̠ ă +e̱ ē +ọ ọ́ ọ́ a̐ u̇ ‿au a͡e

+

À È Ì Ò Ù Ǹ Ẁ Ỳ à è ì ò ù ǹ ẁ ỳ x̀

+

Á É Í Ó Ú Ý Ć Ĺ Ń Ŕ Ś Ź Ǵ Ḱ Ḿ Ṕ Ẃ Ǽ Ǻ Ǿ ǽ ǻ ǿ á é í ó ú ý ć ĺ ń ŕ ś ź ǵ ḱ ḿ ṕ ẃ v́

+

Â Ê Î Ô Û Ĉ Ĝ Ĥ Ĵ Ŝ Ŵ Ŷ Ẑ â ê î ô û ĉ ĝ ĥ ĵ ŝ ŵ ŷ ẑ

+

Ã Ñ Õ Ũ Ĩ Ṽ Ẽ Ỹ ĩ õ ã ñ õ ĩ õ ṽ ẽ ỹ w̃

+

Ä Ë Ï Ö Ü Ÿ Ḧ Ẅ Ẍ ä ë ï ö ü ÿ ḧ ẅ ẍ ẗ z̎

+

Ő Ű ő ű e̋

+

Å Ů å ů ẘ ẙ e̊

+

Č Ď Ě Ľ Ň Ř Š Ť Ž Ǎ Ǐ Ǔ Ǧ Ǩ Ȟ č ď ě ľ ň ř š ť ž ǎ ǐ ǔ ǧ ǩ ȟ ǰ x̌

+

Ă Ĕ Ğ Ĭ Ŏ Ŭ ă ĕ ğ ĭ ŏ ŭ x̆

+

Ā Ē Ħ Ī Ō Ŧ Ū Ȳ Ḡ Ǣ ǣ ā ē ħ ī ō ŧ ū ȳ ḡ

+

Ȧ Ḃ Ċ Ḋ Ė Ḟ Ġ Ḣ İ Ŀ Ṁ Ṅ Ȯ Ṗ Ṙ Ṡ Ṫ Ẇ Ẋ Ẏ Ż ȧ ḃ ċ ḋ ė ġ ḣ ŀ ṁ ṅ ȯ ṗ ṙ ṡ ṫ u̇ v̇ ẇ ż ẏ ż q̇

+

Ç Ģ Ķ Ļ Ņ Ŗ Ş Ţ Ȩ Ḑ Ḩ ç ģ ķ ļ ņ ŗ ş ţ ȩ ḑ ḩ b̧

+

Ą Ę Į Ǫ Ų ą ę į ǫ ų b̨

+

Ḁ E̥ I̥ O̥ U̥ R̥ ḁ e̥ i̥ o̥ u̥ r̥ y̥

+

Ḇ Ḏ Ḵ Ḻ Ṉ Ṟ Ṯ Ẕ ḇ ḏ ḵ ḻ ṉ ṟ ṯ ẕ ẖ e̠

+

Ḅ Ḍ Ḥ Ḳ Ḷ Ṃ Ṇ Ṛ Ṣ Ṭ Ṿ Ẉ Ẓ Ạ Ẹ Ị Ọ Ụ Ỵ ḅ ḍ ḥ ḳ ḷ ṃ ṇ ṛ ṣ ṭ ṿ ẉ ẓ ạ ẹ ị ọ ụ ỵ c̣

+

Ȃ Ȇ Ȋ Ȏ Ȗ Ȓ ȃ ȇ ȋ ȏ ȗ ȓ x̑

+

Ḛ Ḭ Ṵ ḛ ḭ ṵ o̰

+

Ḓ Ḙ Ḽ Ṋ Ṱ Ṷ ḓ ḙ ḽ ṋ ṱ ṷ a̭ +Ḁ ḁ e̥ +Ả Ẻ Ỉ Ỏ Ủ Ỷ ả ẻ ỉ ỏ ủ ỷ x̉

+

t̪ t̪ d̺ d̺ +o̹ o̹ o̜ o̜ +g̑ g̑ ɔ̟ o̟ +e̞ e̞ ɛ̝ e̝ +u̘ u̘ ə̙ e̙ +e̽ e̽ k̫ k̫ +t̼ t̼

+

a̖ a̖ ạ̀ ạ̀ à̱ à +e̗ e̗ é̱ é̱ é +o̭ o̭ ộ ộ ô +ṵ ṵ ụ͂ ụ͂ ũ +a̤ a̤ ä +ę ę e̋ +o̥ u̥ o̱̊ o̱̊ o̊ +u̬ u̬ ú̬ á̬ ǔ +a̯ a̯ ă̠ ă̠ ă +e̱ e̱ ē +ọ ẹ ọ́ ọ́ a̐ u̇ +‿au a͡eg͡b

+

TEST1 f ʞ ɹ ʇ ʍ +ɟ ɲ ħ ɬ ɮ +A dOg, B kæt ma214

+

Test2 E J A ʜ ʟ U ʙ ɢ ʀ

+

Test3 ɖ ɭ ɳ ɽ ɻ ʂ ʈ ʐ

+

Test4 ʛ ɓ ɗ ɠ ʄ ʘ

+

a, a, ɐ, ɑ, ɒ, +a, æ, ao, ᴀ, 4, +a, ao, +ʌ, Δ

+

b, ƀ, b̶, ь, ъ,ɓ, ʙ, β

+

c, c̶, č, ç, ƈ, ɕ, ʗ, +ʗ, ʗ, ʗ

+

d, đ, d̶, d, d, ɗ,ɖ, +d, ȡ, db, ʣ, ʥ, +ʤ, ȡʑ, ð

+

e, e̢, ə, ɚ, ɘ, ᴇ, +ɛ, ɛ̢, ʚ, ɜ, +ɝ, ɞ

+

f, F

+

ɡ, ɡ̶, ɡ̰, ɡ, g, ɢ, ʛ, +ɣ, γ, γ, γ, +ɤ, ɤ

+

h, ƕ, ħ, ɦ, h, h, ɧ, +ɥ, ʜ

+

i, ı, ɨ, ɪ, ɩ, ɿ, ɿ, +ʅ, ʅ

+

j, j, ʝ, j, +ɟ, ɟ, +ʄ, ʄ, ᴊ

+

k, ƙ, ʞ, K, ʞ

+

l, ɫ, ƚ, ɬ, ɭ, ɮ, +ɮ, , ʟ, +L, λ, ƛ,

+

m, ɱ, hm, ɯ, ɰ, ᴍ

+

n, n, ƞ, ñ, ɲ, ŋ, ɳ, ȵ, +ɴ

+

o, ♀, , ʘ, ʘ, ɵ, +ø, œ, ɶ, ɔ, ɔ̢, ɔe, +ω, ω, ɷ, Ω

+

p, ƥ, p, ᴘ, ƿ, +þ, þ, þ, þ, +þ, ɸ,

+

q, ʠ, qp, Q

+

r, ɾ, ɼ, ɽ, ɹ, ɻ, +ɺ, ʀ, я, ʁ,

+

s, š, ʂ, ʃ, ʃ, ƪ, +ʆ

+

t, t, t, ʈ, ƭ, ʇ, +t, ȶ, ʨ, tc, ʦ, +ʧ, θ

+

u, ʉ, ʊ, ᴜ, u,

+

v, ʋ,

+

w, ʍ

+

x, χ

+

y, ʎ, ʏ, ʮ, ʯ

+

z, ȥ, ž, ʑ, ʐ, ƻ, 2, +ʒ, ƺ, ʓ, ƹ, 3

+

UUUUUUUUaU +nU nU nU +gU sU sU sU

+

ph = pʰ +kw=kʷ tj=tʲ dɣ=dˠ +dʕ=dˁ +dn dl=dˡ

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testkeyval.xml b/thirdparty/tralics-2.15.2/Modele/testkeyval.xml new file mode 100644 index 0000000..83eb7d2 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testkeyval.xml @@ -0,0 +1,129 @@ + + + + +

2008/02/15 Package for testing keyval

+

epW=5.opE.CuCvLaD=Lb.Lcxyz

+

I will first check your input, please wait.

+

The input true was correct, we proceed.

+

I finished the input check. + +I will first check your input, please wait.

+

The input nottrue was incorrect and was ignored.

+

I finished the input check.

+

auaxvbu3v +auaxvbu3v +auaxvbu43v

+Package xkeyval Warning: Key `keya' has been disabled at line 339 of file testkeyval.tex. +

XXAaAabBb +aAa +cCVc +XXBcaa and bacb and cb +cCVc cCVc +XXCc1ec2f +cCVc cCVc +XXCc1ec2f +XXDaAaEaAabAa

+

+

+Testing errors and the like +

This is a test +Package mypack Error: error line1 +(mypack) line2 +Package mypack Warning: warning line1 +(mypack) line2 at line 579 of file testkeyval.tex. + +Package mypack Warning: warning nl line1 +(mypack) line2. + +Package mypack Info: info line1 +(mypack) line2 at line 581 of file testkeyval.tex. + +Class myclass Error: error line1 +(myclass) line2 +Class myclass Warning: warning line1 +(myclass) line2 at line 583 of file testkeyval.tex. + +Class myclass Warning: warning nl line1 +(myclass) line2. + +Class myclass Info: info line1 +(myclass) line2 at line 585 of file testkeyval.tex. +

+info bar at line 587 of file testkeyval.tex. +warning bar +PREFIXsecond line at line 588 of file testkeyval.tex. +error bar +PREFIXsecond line
+Elements + +latex +xml +translator + +Trees +

We test also trees

+

Value of node A

+

. +. +. + + + + + + + + +. + +. + + + + + +

+

+ + +

+

Now checking runaway +Second test +tLine of text.

+Tralics Warning: Command \par has changed +Tralics Warning: Command \foo has changed +Tralics Warning: Command \foo has changed +Tralics Warning: Command \foo has changed +

x +x +x +x +x +bx +bx +x + + + +Une expérience d'utilisation de LaTeX : le Rapport d'act ivité de l'INRIA +Cahiers Gutenberg +0 +apr +1988 +17-24 +x +val +xx +x + x + x +x

+

X

+

X

+

X

+

XNon-closed \begingroup started at line 683. +Non-closed brace started at line 683. +Non-closed environment `it' started at line 683. +

+ diff --git a/thirdparty/tralics-2.15.2/Modele/testm1a.xml b/thirdparty/tralics-2.15.2/Modele/testm1a.xml new file mode 100644 index 0000000..3804107 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testm1a.xml @@ -0,0 +1,10 @@ + + + + +

simple math test +x=y 2 Ω

+ 0 f(x)dx +

𝐀𝟿 +𝐀;𝟿;𝒟

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testm1b.xml b/thirdparty/tralics-2.15.2/Modele/testm1b.xml new file mode 100644 index 0000000..b2e01c7 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testm1b.xml @@ -0,0 +1,12 @@ + + + + +

simple math test +x = y ^2 Ω∑∆∏

+ +\int _0 ^\infty f(x)\, dx + +

𝐀𝟿 +𝐀;𝟿; 𝒟

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testm1c.xml b/thirdparty/tralics-2.15.2/Modele/testm1c.xml new file mode 100644 index 0000000..703f49f --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testm1c.xml @@ -0,0 +1,12 @@ + + + + +

simple math test +x=y 2 Ωx = y ^2 Ω∑∆∏

+ 0 f(x)dx +\int _0 ^\infty f(x)\, dx + +

𝐀𝟿𝐀𝟿 +𝐀;𝟿;𝒟𝐀;𝟿; 𝒟

+
diff --git a/thirdparty/tralics-2.15.2/Modele/testmath.xml b/thirdparty/tralics-2.15.2/Modele/testmath.xml new file mode 100644 index 0000000..94e10d2 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testmath.xml @@ -0,0 +1,4873 @@ + + + + +Producing MathML with TralicsProduire du MathML avec TralicsMay 200729 November 20072José GrimmThe software and the documentation is available +at http://www-sop.inria.fr/apics/tralicsJose.Grimm[at]sophia.inria.fr

The purpose of this paper is to show that it is possible to +translate almost every mathematical formula from syntax to XML. +The document you are reading contains a great number of formulas extracted +from the book, the companion, the MathML recommendation, and +translated into XML by Tralics; it is available in Pdf or HTML version.

+

The HTML version was produced using a very simple style sheet; mathematics are +left unchanged, and you need a MathML-aware browser, like Firefox, or +adequate plugins, and a set of fonts for the symbols or operators. +The Pdf version was obtained by use of xmltex (a +package by D. Carlisle that makes an XML interpreter), and a great number +of modifications to the file mathml2.xmt (that interprets elements in +the MathML namespace). All files needed to produce this document are part of +the Tralics bundle (version 2.10 or more).

+

This document was compiled with the experimental version 2.10.8, in which examples +in section should work fine.

+

Le but de ce papier est de démontrer qu'il est possible de +traduire presque toutes les formules de mathématiques de la syntaxe + vers le langage XML. Le document que vous lisez contient un grand +nombre de formules extraites du book, du companion, de la +recommandation MathML, et traduites en XML par le logiciel Tralics. Il est +disponible en HTML et en Pdf.

+

La version HTML est obtenue en utilisant une feuille de style assez simple, +qui laisse les formules de mathématiques inchangées; pour la lire, il +vous faut un navigateur ou un plugin qui sache interpréter le MathML et les +fontes associées pour les symboles et les opérateurs. +La version Pdf a été obtenue grâce au package +xmltex de D. Carlisle (qui fait de un interprète XML), +et un grand nombre de modifications dans le fichier mathml2.xmt, +qui contient le code d'interprétation des mathématiques. Tous les fichiers +nécessaires pour obtenir ce document sont distribués avec le package +Tralics à partir de la version 2.10.

+
Tralics, XML, MathML, mathematics, LaTeX, HTML, PdfTralics, XML, MathML, mathématiques, LaTeX, HTML, Pdf6181Sophia Antipolis – MéditerranéeTHnumApics +Introduction +

The technical reports and describe +some features of the Tralics software, a to XML translator, +and associated tools. In particular, we explain how the XML file +can be converted +to HTML, or to Pdf (using the excellent work of D. Carlisle +and S. Rahtz (, , ). +One application is RalyX (Inria's Annual Activity Report), where all math +formulas are converted to images before inclusion in the HTML document.

+

Recently, the cedram (Centre de diffusion de revues académiques de +mathématiques, http://www.cedram.org/) +has decided to convert the metadata of some collections (including the +Annales de l'institut Fourier) from to HTML, . The +Tralics software has been adapted for this purpose, the idea being the +following: there are nowadays some browsers with a high quality math +renderer, where native MathML formulas are more readable than images; +thus the web site presents each document in two versions, neither of which +containing an image. By default you see something like +L 1 (T), and the alternate version contains +$L^1(\mathbb{T})$. This looks like the source +code, but non-trivial operations are performed, as explained below.

+

There is a torture file that comes with Tralics; the purpose is to make sure +that no error occurs while compiling expressions like \cfrac12, but it is +hard to check that the result is correctly translated. For this reason, we +decided to create a sample file containing, not only all examples of the + companion second edition , but also those of the +book , or the MathML recommendation , +and to convert it to HTML. +Translation is correct if the HTML page prints correctly. This file is +available on the Web, we hope that it will convince you to use the Tralics software, and put your math documents on the Web. We have inserted comments +explaining why some constructions do not work, if you have a solution or +suggestions, please send mail to the author. Additional examples are welcome.

+

We also wanted to make sure that the RalyX still works: more than one hundred +teams use Tralics once a year, asking sometimes silly questions, like: how to +add color to the text, or a page break; the answer is generally either `not yet +implemented, wait for next year', or `incompatible with the Raweb semantics'. +This document uses colors and page breaks, as explained below; no modification +to the translator was needed, but, unless the style sheets are modified, these +additions are ignored.

+

For these reasons we converted the whole +document to Pdf. This was not trivial, especially because of a lack of font +families (this will be discussed later). Note also the format of the +document: in the HTML version all metadata (author, title, abstract, etc.) are +placed at the start of the document by the XML to HTML processor. In the case +of the Pdf version, this was not so easy: something as trivial as +\newpage \null \vskip-2cm is impossible to express in XSL/FO +(said otherwise, all my attempts failed), and I had to add a new element +<vspace> for this purpose.

+

The source file testmath.tex is part of the Tralics distribution; +translating it requires Tralics version 2.10, and some packages, +like amsmath (do not try to include the file amsmath.sty, +this is not possible; you must use amsmath.plt instead). +In most cases we show the source before the translation. There are some +exceptions, for instance we leave as an exercise to find out how we solved +the exercises of the book. +Examples of the companion are available on +the CD that comes with the book.

+

The XML file was converted into HTML, math formulas are left unchanged. +We explain in some cases that what we see is not what we expected. Here +FL means Firefox on Linux (unless specified, it is Firefox 2.0, +on Fedora Core 3) and FM means Firefox on MacIntosh (unless +specified, it is Firefox 2.0 on a PowerBook G4, MacOS 10.4). +We also tested Amaya, bot AM (version 9.55 on Mac) and AL +(version 9.99 on Linux FC5).

+

Installing math fonts for use with a web browser is not always easy: +they are installed as explained on the Mozilla web page, but this page +seems unclear to me: on one Linux machine, Firefox is happy with the fonts, +but uses the wrong font when printing, on another one, Firefox says that fonts +Math1, Math2 and Math4 are missing, but the printed result is correct.

+ +Special features +

You are not supposed to insert page breaks in your document, but if you put +twenty tables in a row, you will get error messages of the form: to many +unprocessed floats, and then you are in trouble. In this case, the only remedy +is to insert some \clearpage commands; in this document, we used the +\xbox command in order to produce an empty <clearpage> element in the +XML document, and we adapted the style sheets.

+

There is a \clearpage before this section; you will not notice it because +there is a natural page break there. On the other hand, it is likely that you +will see the page breaks in Chapter three, but there is no easy solution: +there is no text in the current chapter to fill the gaps. +In order to improve the layout, we changed the ordering of +the figures, starting with tables and , that +occupy a full page, and inserting smaller tables after that. Moreover, +table was too big to fit on a page (the baseline in this +document is much larger than in the companion) and we split it into +two parts. We are happy since this gives 8 full pages with floats, and a +single bad page, the last text page of the chapter.

+

Concerning colors, you can put any attribute you like to any object +(there is no attempt to validate the document against some DTD). +In the case of math formulas, identifiers, numbers and operators accept +some common attributes including font information and colors, these are +currently ignored when converting XSL/FO into Pdf (but this can easily be +changed, it suffices to add some lines +of code to the raweb-cfg.sty file. However, the color attribute is +honored for the <mstyle> element (all symbols appearing in the companion for which no Unicode element has been found are replaced by a + +red +X using this method). +For the text case, the +<inline> element is translated into <span> element in the HTML and a +<fo:inline> element in the Pdf, all attributes are copied; in the previous +sentence we have used

+

\xbox{inline}{\XMLaddatt{color}{#F00000}\XMLaddatt{style}{color:#E00000}red}

+

$\mathbox{mstyle}[color][\#D00000]{X}$

+

\def\UnimplementedOperator#1{\mathbox{mstyle}[color][red]{X}}

+

This example shows that you can use a named color, or one defined in RGB +syntax, using six hexadecimal digits; use sharp or backslash sharp as +indicated here.

+
+Compiling the example file +

These are the options you can use when compiling the file +testmath.tex

+

-noentnames -trivialmath=7 -leftquote=2018 -rightquote=2019 -nozerowidthspace

+

The first option says that you prefer &#x21DA; to &Lleftarrow; +(this is useless if you use an XSLT processor to convert the XML document). +Option `trivialmath=7' says that simple math expressions are translated as +text; option `mathvariant' says that a command like \mathbb should add a +mathvariant attribute; these two options set initial values to some counters, +they are not needed, because the associated file testmath.ult +resets them to the values needed here. Following options are +problematic. If you say `nostraightquotes', this changes the translation of +the apostrophe character to character U+B4, this option produces a nice HTML +file, but the Pdf is not so nice. Here we modify left and right quotes to +U+2018 and U+2019. +If you say `zerowidthspace', Tralics inserts an +invisible character in verbatim mode, that is supposed to inhibit ligatures +when converting the XML file into Pdf file, the trouble is that this character +is shown as a normal space by my browser in certain cases. In Tralics version 2.10, the translation changed: the old behavior can be obtained by +saying -nozerowidthelt. Otherwise an element is created, this element +is transformed into a zerowidthspace character when the document is converted +to Pdf, is omitted when the document is converted to HTML. This means that the +option is useless.

+

The following files are needed for the compilation:

+ +

a configuration file, that +behaves like the default one; namely one that defines the root element to be +<std> and the dtd file to be classes.dtd;

+
+

the source file testmath.tex, and the associated +testmath.ult file;

+
+

the class file report.clt (and the auxiliary file +std.clt);

+
+

the standard math packages amsmath.plt, amscd.plt, +delarray.plt, amsxtra.plt, amsgen.plt, +amsbsy.plt, amsopn.plt;

+
+

the file fancyvrb.plt for the special verbatim mode; and

+
+

the file RR.plt for the meta data.

+
+

When converting the document to HTML, we use the `xsltproc' program. The style +sheet is testmathhtml.xsl; this is a short style sheet; but it +needs cls.xsl and RR.xsl. Conversion to XSL/FO uses +RRfo.xsl as style sheet, it needs clsfo.xsl, that +includes raweb3-param.xsl, rrrafo3.xsl, +clspages.xsl, RRfosimple.xsl, +clsfotable.xsl. Note: this list is likely to change; we have +to separate clearly the RA (activity report), the RR (research report) and CLS +(standard classes). All these files are in the directory xml or +styles of the Tralics distribution, but the XSLT processor wants +to see them in the current directory.

+

Conversion from XSL/FO to pdf is achieved by compiling the file +wtestmath.tex containing the following lines

+

1 \def\xmlfile{testmath.fo}

+

2 \def\LastDeclaredEncoding{T1}

+

3 \input{xmltex.tex}

+

4 \end{document}

+

It requires xmltex.tex and other files from the xmltex +distribution, so that you must install these files first. +There are some bugs or incompatibilities in +the fotex distribution, so that you must use the two files +fotex.xmt, fotex.sty as distributed in the xml +directory. Additional required files are fotex-add.sty, +raweb-uni.sty, and fotex.cfg. +Finally the file wtestmath.cfg should be a +symbolic link to raweb-cfg.sty.

+
+Overview of math mode +

The main change between Tralics version 2.9 and 2.10 concerns handling of +math formulas. Two steps are required for processing them: first a tree is +created, after that, it is converted. This mechanism is similar to the +behavior of , but some details are not yet implemented, and some +information is lost (for instance, \mathbin is a command that says that +the object that follows should be of type `binary'; this information is used +by the program, but the resulting XML tree does not contain this information +(we cannot simply add an attribute pair class=bin to the object).

+

When Tralics sees a math formula, it constructs recursively a tree, also +called a math list. +The action after a token has been read is the following: +If the token is expandable (a user defined command for instance), expansion +takes place, this can read some tokens, it can add new tokens to the stream +(to be read again). +If the token is a mode-independent command it will be executed (for instance, +you can change the meaning of some commands). Otherwise, the token is added +to the tree, but there are some exceptions. The easy case is when a whole +subtree is read, for instance when the token is a left brace, a \begin +command, etc. In some cases, the execution level is incremented (said +otherwise, the +behavior is the same as a group defined by braces in non-math mode). In a case +of \begin, a token list is read, and the behavior depends on whether +this is a user defined environment (normal expansion rules apply), or a +built-in one. Most built-in environments are matrix-like, and each cell is +evaluated in a group; this has the following consequence: if the math formula +contains an unwanted ampersand character, an error will be signaled when that +character tries to finish the cell-group (because the current group is of type +math), and an error is signaled at the end of the math expression (because the +ampersand character has added a second group after the first, a cell-group, +where the end-of-math character expected a math-group). A third error will be +signaled later: when the tree is converted into a MathML object, Tralics may +complain about non-math tokens in the expression. +A font change command like \mathbb +changes the internal state and adds two tokens to the tree, one that selects +the blackboard font (before the argument) and a token that selects the current +font (after the argument).

+

In the case of $L^1(\mathbb{T})$ +the tree has eight nodes. One is a +subtree, containing the argument of the command. They are six +characters, and two commands (select double-struck font, or select normal +font). When the tree is converted into a MathML expression, some nodes are +converted to basic XML elements (the letters), some are ignored (the font +change commands), and others are used to construct an XML tree. +We shall see later that parentheses, braces, and tokens like that can induce +<mrow> elements; translation of the hat character is non-obvious, because +MathML provides <msub> and <mover> as possible translations; a command +like \nolimits placed after a token is an indication for the translation +of the hat that follows. When the tree is converted the current style is looked +at, this quantity depends on the position in the tree (the style of the +numerator of a fraction or the style of an exponent after the hat is smaller +than the current style, while the style of the numerator of a \cfrac is +always text style) or the presence of style change commands. Some commands +depend on the style (for instance \mathchoice) and are conditionally +interpreted.

+

The characters in the formula above are of type letter (L, T), or type +non-letter (the digit, or the parentheses), or other (the hat). An interesting +question is: +what happens if the single L (or any other character) is replaced by a double +one? A first answer is that this just adds a new token to the tree (there is +a special case: ^^1 is a non-obvious way to represents the +character q). Spaces are ignored, so that doubling them has no effect. +Two hat characters in a row signal an error (assume for instance that a space +between them inhibits the double-hat feature mentioned above). Two consecutive +new line characters are replaced by \par, this is illegal. +Characters that are neither letters nor digits generally translate to a +<mo> element. No attempt is made to convert two plus characters into a +double plus character (some people use `:=' as an operator, meaning `is equal +by definition', and expect no white space between the two +characters). In a case like \sqrt\frac{1}{2}, +where we have two consecutive commands that take arguments, the argument of +the root operator is the fraction operator, not the full fraction (this +expression is accepted by , as an unexpected consequence of the +implemented of the fraction operator that provides that braces that delimit +the argument of the square root, it is rejected by Tralics).

+

The superscript and subscript operators (generally associated to +hat and underscore characters) are hybrid commands: most commands, for +instance \frac, are prefix commands (they come before their arguments), a +few commands, like \over, are infix operators (the first argument is +before the operator). In the case of hat, there is one argument after the +operator, but the operator acts on the kernel that is to its left +(in the example the kernel is L, but a kernel can have an index and an +exponent, so that the order of tokens can be: kernel, underscore, index, hat, +exponent). +Translation of character L is a <mi> element; Tralics tries to +converts LL or TT into a single element, according to the following rule. +Assume that \T is defined to be \mathbb{T} and \TT +is defined to be \mathbb{TT}. Then \TT produces a single +element with two characters, while \T\T produces two elements with a +single character. On the other hand, a strange rule of MathML says that the +font used for a <mi> element (that lacks font attributes) depends on the +number of characters in it; for this reason, in a formula like xy, the +translation is a sequence of two <mi> elements, without attributes, +containing a single character (implicit product). In a case like 17, a +single <mn> element is constructed, because this represents a number (in a +case like x 12 , an implicit comma could be added in the case where the +expression refers to row 1 column 2 of the matrix x; however, do not expect +such a behavior in a near future). The source code of the expression above is +$x_{12}$. Without the braces, the translation is x 1 2 +(if you do not see the difference, there is a bug somewhere).

+

If the internal counter \@nomathml is negative, the tree is converted to +a character string in a trivial manner; in a case like +\cfrac12, you will see \cfrac{1}{2}, because we +have a sub-tree with two nodes (the two arguments of the command). In reality, +the command takes an optional argument, and its value is printed only if it is +not empty. In a case like L 1 (T), you will see two font changes +as explained above. If you want to see the characters \mathbb there are +two solutions: the easy one works only since version 2.10: +Tralics inserts in the tree all commands that behave like +\relax; these commands are ignored when converting the tree into a MathML +expression, but the name is used otherwise; thus \let \mathbb +\relax does the job. Otherwise, it suffices to redefine \mathbb in +order to expand to the desired string (using \string for instance). +Note: since version 2.10, a font change command that takes an argument defines +a semi-simple group, by inserting \begingroup and \endgroup commands.

+
+Examples from the TEXbook +Typing math formulas, TB 16 +

The book starts slowly; first Knuth explains that math formulas are +enclosed in special math brackets, dollar signs. He also says that +spaces are ignored in math mode.

+

1 `$x$', `$2$', `$ x$', `$ 2 $',

+

2 `$(x + y)/(x - y)$', `$(x+y) / (x-y)$'

+

Easy formulas: `x', `2', `x', `2', +`(x+y)/(x-y)', `(x+y)/(x-y)'.

+

We show here some Greek letters, and some other symbols:

+

3 $\Gamma, \nu,\kappa$,

+

4 $\phi,\emptyset, \epsilon,\in,\approx,\mapsto$

+

5 $(\phi,\theta,\epsilon,\rho)$,

+

6 $(\varphi,\vartheta,\varepsilon,\varrho)$,

+

7 $$\alpha, \beta, \gamma, \delta.$$

+

Greek letters Γ,ν,κ, and other symbols: +ϕ,,ϵ,,,; +standard GreekAM does not show the epsilon letters, (ϕ,θ,ϵ,ρ), +and variants (φ,ϑ,ϵ,ϱ), +a display math formula:

+α,β,γ,δ. +

8 \begingroup

+

9 \catcode`\*=3

+

10 *x^2*, \( x_2\), \begin{math}\Sigma\end{math}

+

11 **A** \[ B\] \begin{displaymath} C \end{displaymath}

+

12 \endgroup

+

We show here that any character of category code 3 can be used as math +delimiter: +x 2 , as well as two alternative ways introduced by : +x 2 , Σ. We show that display math can be +entered by doubling the character of category 3 (actual rules are more +complicated, see the Book), or using a environment (additional +environments will be explained in later chapters), or using brackets. +Note that brackets are very useful, because they are so easy to type.

+A +B +C +

Exercise 16.1: γ+νΓ.

+

Exercise 16.2: \le,\ge,\ne, +\leq,\geq, and \neq: +,,, +,,.

+

Complex formulas with superscripts(up high) and subscripts +(down low).

+

13 $x^2$, $x_2$, $2^x$, $x^2y^2$, $x ^ 2y ^ 2$, $x_2y_2$, $_2F_3$,

+

14 $x^{2y}$, $2^{2^x}$, $2^{2^{2^x}}$, $y_{x_2}$, $y_{x^2}$.

+

Translation x 2 , x 2 , 2 x , x 2 y 2 , x 2 y 2 , x 2 y 2 , 2 F 3 , +x 2y , 2 2 x , 2 2 2 x , y x 2 , y x 2 .

+

Consider now the following two formulas:

+

15 $((x^2)^3)^4$,  ${({(x^2)}^3)}^4$.

+

Translation of the first formula

+

16 <formula type='inline'>

+

17   <math xmlns='http://www.w3.org/1998/Math/MathML'>

+

18     <mrow>

+

19       <mo>(</mo>

+

20       <mo>(</mo>

+

21       <msup><mi>x</mi> <mn>2</mn> </msup>

+

22       <msup><mo>)</mo> <mn>3</mn> </msup>

+

23       <msup><mo>)</mo> <mn>4</mn> </msup>

+

24     </mrow>

+

25   </math>

+

26 </formula>

+

Translation of the second formula

+

27 <formula type='inline'>

+

28   <math xmlns='http://www.w3.org/1998/Math/MathML'>

+

29     <msup>

+

30       <mrow><mo>(</mo>

+

31         <msup>

+

32           <mrow>

+

33             <mo>(</mo>

+

34             <msup><mi>x</mi> <mn>2</mn> </msup>

+

35             <mo>)</mo>

+

36           </mrow>

+

37           <mn>3</mn>

+

38         </msup>

+

39         <mo>)</mo>

+

40       </mrow>

+

41       <mn>4</mn>

+

42     </msup>

+

43   </math>

+

44 </formula>

+

The current Tralics uses some hacks, so that the translation is actually +different. You will get first ((x 2 ) 3 ) 4 , second +((x 2 ) 3 ) 4 , third +((x 2 ) 3 ) 4 , and fourth ((x 2 ) 3 ) 4 . Here the first two formulas +correspond to the XML fragment shown above (they were produced by prefixing +each parenthesis with \mathord, and after that we have the +actual translation. The MathML +recommendation says that some operators are stretchy, so that the width +and height can depend on the context. This is not the case in xmltex, so +that, in the Pdf version, all parentheses have the same size. The \mathop +prefix tells Tralics to not consider parentheses as stretchy, so no hack is +applied. We shall not explain the hack here; moreover we modified it in +version 2.10.8. We originally wrote +All parentheses have the same size in the pdf version, the same is true for +the HTML +version in the first formula. Now, the <mrow> elements delimit a scope, +so that inner parentheses are smaller than outer parentheses (but only for +HTML, second formula); note that the placement of the exponent depend on the +context, so that, in the second formula, all three superscripts at placed at +different positions. +In the case of the first formula, placement of the +exponent depends only on the the size of the parentheses (hence, in the Pdf +version, they should be aligned, in the HTML version, they are not). +Firefox on Mac shows the following: all superscript are aligned. Big +parentheses are used but for case 2. Amaya shows only small parentheses, +scripts are not aligned, but this is hard to see.

+

The MathML recommendation says that the second alternative is +better; but Knuth says: +“The first alternative is preferable, because it is much easier to type, and +it is just as easy to read.”

+

45 `${}_2F_3$', `${_2}F_3$', `${_2F_3}$'

+

Exercise 16.3: Three ways to have an empty kernel: +` 2 F 3 ', ` 2 F 3 ', ` 2 F 3 '. The translation is the same in all +cases because of the following two rules: if a math list starts with a +subscript or superscript operator, an empty math list is added before, it +serves as +kernel (thus, braces in the first example are useless); +a math list is packaged by putting it in a <mrow> element, unless +the list has one element (in the second example, there are two tokens between +the braces, converted to a single <msub> element, the math list has a +single element, braces are useless). In these two cases, the main math list +has two <msub> elements, and a <mrow> is added. In the last case, the +main math list has a single element, a <mrow>, thus, no <mrow> is +added and braces are useless.

+

46 `$x+_2F_3$' and `$x+{}_2F_3$'.

+

Effect of braces after plus sign: +`x+ 2 F 3 ' and `x+ 2 F 3 '. The MathML recommendation says that the distance +between the plus sign and the letter F should be the same in both cases; in the +first case, index 2 is attached to the plus sign, in the second case to the +letter F (AM shows both formulas with index attached to F).

+

47 ${x_2}_3$, $\displaystyle {\sum}'$

+

Note that an <mrow> element is added for a +math list with a single element in the case where it is followed by a +subscript or a subscript. Reason one: in a case like x 2 3 , you will get +an error if braces are omitted; in the same fashion, an error is signaled +(when converting to Pdf) if <mrow> is missing. Reason two, in a case like + ' , the apostrophe is not placed above the sum if there +is a <mrow> (the sum operator has type Op, but not the group, unless there +is a \mathop before it).

+

Exercise 16.4: Double superscript, x y z , x y z .

+

48 $x^2_3$, $x_3^2$, $x^{31415}_{92}+\pi$, $x_{y^a_b}^{z_c^d}$.

+

49 $P_2^2$ and $P{}_2^2$.

+

Simultaneous superscripts and subscripts x 3 2 , x 3 2 , +x 92 31415 +π, x y b a z c d .

+

Vertical alignment: P 2 2 and P 2 2 . In the first case, scripts are +attached to the letter P, and alignment can depend on the slant of the letter. +(Amaya has extra space in the second formula).

+

50 `$\prime$', $y_1^\prime$, $y_2^{\prime\prime}$, $y_3^{\prime\prime\prime}$,

+

51 $f'[g(x)]g'(x)$, $y_1'+y_2''$, $y'_1+y''_2$, $y'''_3+g'^2$

+

Primes and shorthand: +`', y 1 , y 2 , y 3 , +f [g(x)]g (x), y 1 +y 2 , y 1 +y 2 , y 3 +g 2 . +In the code shown here, the character used as delimiter for XML attributes is +character U+39, the quotes around the math formulas are U+60 and U+B4 (this +character can be changed via an option of the program, in verbatim mode it is +always U+39, straight quote). +The +prime character used in the formula is U+2032. This is not the right character. +Thus, in Tralics 2.9.5, translation of prime changed, it is now +character U+39. The same formula is now: +`'', y 1 ' , y 2 '' , y 3 ''' , +f ' [g(x)]g ' (x), y 1 ' +y 2 '' , y 1 ' +y 2 '' , y 3 ''' +g '2 . It is unclear +whether this is the good solution. It seems that Firefox uses the same font +metrics as , i.e., a very large prime character that has a normal size +when used at script size, while Amaya uses a normal size prime, that is small +when used as a superscript. In the case of f-prime, the slant of the letter is +not taken into account by Amaya, and the prime sign is hard to see.

+

52 $x\varprime y^\varprime, x\Prime y^\Prime,

+

53 x\tprime y^\tprime,x\bprime y^\bprime,x\qprime y^\qprime$

+

The amsmath package provides the symbols shown above; as you can see (at least +with FM), these characters are not meant +to be used as an exponent: +xy ,xy ,xy ,xy ,xy . +Note that \qprime is unkown to Amaya, and the prime subscript in the +following exercice is hard to see.

+

Exercise 16.5: F ' (w,z)=F(w,z)/z and F ' (w,z)=F(w,z)/w.

+

54 \let\none\mmlnone

+

55 $R_i{}^{jk}{}_l$ versus $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$

+

Exercise 16.6: +R i jk l versus Rijkl +(MathML example, section 3.4.7.2, only second index raised).

+

56 $\sqrt 2$, $\sqrt{x+2}$, $\underline4$, $\overline{x+y}$,

+

57 $\overline x+ \overline y$, $x^{\underline n}$, $x^{\overline{m+n}}$,

+

58 $\sqrt{x^3+\sqrt\alpha}$

+

Translation 2, x+2, 4 _, x+y , +x +y , x n _ , x m+n , +x 3 +α. +There are problems with underline and overline on FM. Vertical +position is not always good, and the length is sometimes incorrect. On the +fifth formula, rules are sometimes invisible in the printed version. +There is a text version in Tralics: +Mfoo _, Tfoo, +Mfoo , Tfoo, +Mfoo _ , Tfoo.

+

59 $\root 3 \of 2$, $\root n \of {x^n + y^n}$, $\root n+1 \of a$,

+

60 $\sqrt[3]{2}$, $\sqrt[n]{x^n + y^n}$, $\sqrt[n+1]a$, `$\sqrt[3]{~~}$'.

+

Translation +2 3, x n +y n n, a n+1, +2 3, x n +y n n, a n+1, ` 3'.

+

61 $\sqrt{\mathstrut a} + \sqrt{\mathstrut d} + \sqrt{\mathstrut y}$,

+

62 $\sqrt{a} + \sqrt{d} + \sqrt{y}$,

+

63 $\overline{a} + \overline{d} + \overline{y}$,

+

64 $\overline{\mathstrut a} + \overline{\mathstrut d} + \overline{\mathstrut y}$.

+

Translation (a+(d+(y, +a+d+y, +a +d +y , +(a +(d +(y .

+

Exercise 16.7: 10 10 , 2 n+1 , (n+1) 2 , 1-x 2 , +w+z , p 1 e 1 , a b c d e , +h n '' (αx) 3.

+

Exercise 16.8: Ifx=y,then x is equal to y. (this exercise says what you +should not do).

+

Exercise 16.9: Deleting an element from an n-tuple leaves an (n-1)-tuple.

+

Exercise 16.10: Letters with descenders are Qfgjpqy.

+

65 $x+y-z$, $x+y*z$, $x*y/z$

+

Basic binary operators: x+y-z, x+y*z, x*y/z.

+

66 $x\times y\cdot z$, $x\circ y\bullet z$, $x\cup y\cap z$,

+

67 $x\sqcup y\sqcap z$, $x\vee y\wedge z$, $x\pm y \mp z$.

+

68 Aliases   $x\land y\lor z$.

+

Many more binary operators +x×y·z, xyz, xyz, +xyz, xyz, x±yz. +Aliases xyz.

+

69 $x=+1$, $3.142-$, $(D*)$

+

70 $x=\mathmo[form][prefix]{+}1$

+

71 $3.142\mathmo[form][prefix]{-}$

+

72 $(D\mathmi[mathvariant][normal]{*})$

+

73 $(D\mathmo[lspace][0][rspace][0]{*})$

+

Binary as ordinary symbols: x=+1, 3.142-, (D*). +The HTML version is slightly different from the version. +You can declare the plus sign as prefix operator, this gives +x=+1, you can define the minus sign as prefix +operator, this gives 3.142-. Removing the space around +the star is more complicated, a solution consists of using an identifier in +upright variant like this (D*), or by setting +the lspace and rspace attributes to zero: +(D*).

+

74 $K_n^+,K_n^-$, $z^*_{ij}$, $g^\circ\mapsto g^\bullet$, $f^*(x)\cap f_*(y)$

+

Binary operators in superscripts +K n + ,K n - , z ij * , g g , f * (x)f * (y).

+

Exercise 16.11: z *2 and h * ' (z).

+

75 $x=y>z$, $x:=y$, $x\le y\ne z$, $x\sim y\simeq z$, $x\equiv y\not\equiv z$,

+

76 $x\subset y\subseteq z$

+

x=y>z, x:=y, xyz, xyz, +xy\notz, +xyz. In the Pdf version there is no space between the +colon and the equals sign, but the HTML version shows some, because the rules +are not the same for and MathML. The best solution would be to use a +single operator instead of two consecutive ones; the user can define a command +\coloneq that behaves like colon-eq in normal , or Tralics could be +modified in order to recognise sequences like this. Translation of \not is +problematic: in this document we consider it as an undefined operator, and you +see a red X. We should add rules like: \not= should give \ne.

+

77 $f(x,y;z)$, $f:A\to B$, $f\colon A\to B$

+

78 %\def\colon{\mathmo[lspace][0]{:}}

+

Punctuation f(x,y;z), f:AB, f:AB. Note that \colon is +a colon with lspace = `0pt', but the attribute is ignored in the Pdf +version. It seems that Amaya uses a zero lspace by default.

+

79 $12,345x$, $12{,}245x$, $\mathcn{12,345}x$, $\mathmn{12,345}x$

+

12,345x, 12,245x, 12,345x, 12,345x. The translation +of the first two expressions is the same, braces are useless here. A silly +bug of my F browser: the second digit of the first number disappears; this does +not happen if the number is not the first word of a paragraph (this is why the +sentence starts with a number). You should use +one of the last two variants if you want the sequence of digits plus the comma +to be considered as a number.

+

Exercise 16.12: 3·1416, but \mathmn{3^^b71416} gives +3·1416 (less space in the HTML version).

+

80 $\hat a$, $\check a$, $\tilde a$, $\acute a$, $\grave a$, $\dot a$,

+

81 $\ddot a$, $\breve a$, $\bar a$, $\vec a$

+

82 \def\ihat{{\hat \imath}} \def\jhat{{\hat\jmath}} $\ihat$, $\jhat$

+

a ^, a ˇ, a ˜, a ´, a `, a ˙, +a ¨, a ˘, a , a , + ı ^, ȷ ^. +Character \jmath is a normal j, because there is no dotless j in most +fonts. There is also a problem with the rendering of grave accents on FM.

+

83 $\hat{I+M}$, $\bar z+ \overline z$, $\widehat x, \widetilde x$,

+

84 $\widehat{xy}, \widetilde{xy}$

+

85 $\widehat{xy}, \widetilde{xy}$

+

86 $\widehat{xyz}, \widetilde{xyz}$

+

87 % $\ghat\in{(H^{\pi_1^{-1}})}' -> Ex16.13 below

+

Large accents +I+M ^, z +z , x ^,x ˜, +xy ^,xy ˜, +xy ^,xy ˜, +xyz ^,xyz ˜. As you can see, there is no difference +between wide and non-wide operators. My browser (AM as well as FM) shows a small hat, and a +variable length tilde. For the Pdf version, we have decided to use the +variable size variant.

+

Exercise 16.13: e -x 2 , Dp α M+l, g ^(H π 1 -1 ) ' , +(braces added), +g ^(H π 1 -1 ) ' (without braces). In Tralics 2.11, there shuld +be no difference between the version with and without braces.

+
+More about Math, TB 17 +

88 $$ {1\over 2}\qquad {\rm and}\qquad {n+1 \over 3} \qquad {\rm and}\qquad {n+1

+

89   \choose 3}\qquad {\rm and}\qquad \sum_{n=1}^3Z_n^2. \label{eq17.1}$$

+

90 \[ \frac{1}{2}\qquad \text{and}\qquad \frac{n+1}{3} \qquad \text{and}\qquad

+

91 \binom{n+1}{3}\qquad \text{and}\qquad \sum_{n=1}^3Z_n^2.\label{eq17.2}\]

+

Example of vertical alignment. Translation of the first three expressions is a +<mfrac> element, subexpressions are in text style (normal size). In the +case of the last expression scripts are in script style (small size) and we +have a <munderover> element for the sum (it is an operator with limits in +display style) and a <msubsup> element for the Z (that is not an operator).

+1 2 and n+1 3 and n+1 3 and n=1 3 Z n 2 . +

The same, using syntax

+1 2andn+1 3andn+1 3and n=1 3 Z n 2 . +

92 \[{x+y^2\over k+1},\qquad {x+y^2\over k}+1,\qquad

+

93 x+{y^2\over k}+1,\qquad x+{y^2\over k+1},\qquad x+y^{2\over k+1}\]

+

94 \[\frac{x+y^2}{k+1},\qquad \frac{x+y^2}{k}+1,\qquad

+

95 x+\frac{y^2}{k}+1,\qquad x+\frac{y^2}{k+1},\qquad x+y^{\frac{2}{k+1}}\]

+

Single over. The only difference in these expressions is the placement of the +braces.

+x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1 . +

style: this uses a command with two arguments, that behaves without +surprise.

+x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1 . +

96 \[{ {a \over b}\over 2} \qquad \text{and}\qquad { a\over {b\over 2}}

+

97 \qquad \text{and}\qquad { a/ b\over 2} \qquad \text{and}\qquad { a\over b/2}

+

98  \]

+

99 \[ \frac{\frac{a}{b}}{2} \qquad \text{and}\qquad \frac{a}{\frac{b}{2}}

+

100 \qquad \text{and}\qquad  \frac{a/b}{2} \qquad \text{and}\qquad \frac{a}{b/2} \]

+

Double over. It is an error if you say A over B over C without adding +braces. As you can see, if a fraction is in text style, its numerator and +denominator are in script style, so that it is sometimes better to use a slash.

+a b 2anda b 2anda/b 2anda b/2. +

style (nothing special here).

+a b 2anda b 2anda/b 2anda b/2. +

Exercise 17.1: Compare x+y 2 k+1 with x+y 2/(k+1) . If a fraction is +in script style, its numerator and denominator are in script script style, +i.e. smaller. In , there are four styles and three sizes (display style and +text style have the same size). In MathML, the size is defined by a level, +zero, one, or two, but larger levels are possible; thus more than three sizes +are possible. There is however a minimal font size.

+

Exercise 17.2: Compare a+1 b+1x with ((a+1)/(b+1))x.

+

Exercise 17.3: Wrong use of \over in x=(y 2 k+1).

+

Exercise 17.4: 71 2¢, using the \textcent command.

+

Exercise 17.5: Same as in the book, but not cramped.

+

101 \[n+\scriptstyle n + \scriptscriptstyle n\]

+

102 \[n+{\scriptstyle n + {\scriptscriptstyle n}}\]

+
+n+n+n +n+n+n +

Note: In the current version of Tralics, it is unclear what happens when you +put style commands randomly in a math formula; in any case, Tralics uses the +correct math style, but has difficulties in inserting <mstyle> +elements: what is the scope? Currently such an element is added to the current +math list, if it contains a style change command; in the example above, +we have two such commands, thus three different styles, +and a single list (first example) or three lists (second example). +Translation of the first example is wrong, translation of the second example is +correct because the style command is the first token of the +listAmaya seems to ignore the style attribute.

+

103 \[a_0+{1\over\displaystyle a_1 +

+

104   {\strut 1\over\displaystyle a_2+

+

105     {\strut 1\over\displaystyle a_3+

+

106        {\strut 1\over a_4}}}}\]

+

Translation

+a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4 +

Without \displaystyle

+a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4 +

+Without \strut. Since a \strut is an invisible object of the size of +a parenthesis, more or less the size of the digit one, its effect is hard to +see.The width of the strut should be zero; this is incorrectly +rendered by Amaya, that shows a non-centered numerator; there is also +additional space in the formulas before exercide 16.7

+a 0 +1 a 1 +1 a 2 +1 a 3 +1 a 4 +

+Without both

+a 0 +1 a 1 +1 a 2 +1 a 3 +1 a 4 +

Until version 2.9.4, commands of the form \hfill were illegal in math +mode. Since then, they are allowed as first or last element in arguments of +commands like \overline. They are ignored, unless the result is a +fraction; we demonstrate here that \hfill placed at the end of the list +produces a left alignment, in the case of \over, \genfrac, or +\frac. Note that the \cfrac command can be used for continued +fractions: its optional argument says whether the numerator is centered, left +aligned or right aligned, under the assumption that the denominator is much +larger than the numerator.As previously, the struts induce unwanted +space in Amaya.

+a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4 12345 11 12345 +

107 \[ {x\atop y+2}, {n \choose k}, \text{latex},

+

108 \genfrac{}{}{0pt}{}{x}{y+2},\binom{n}{k} \]

+

The \atop construction is like \over, without fraction rule; you +should not use it in , you should use \genfrac instead. The command +\atopwithdelims (see below for an example) is followed by two delimiters, +say A and B, it puts A before the fraction and B after it. You can use +\genfrac with A and B as arguments (third argument is line thickness, +fourth argument is style). The \choose +command is nothing else than \atopwithdelims(). You should not use it.

+x y+2,n k,latex,x y+2,n k +

109 \[{ {n\choose k}\over 2} \text{ or } { n\choose{k\over2} }

+

110 \text{ or } { n\choose k/2} \text{ or } {n\choose{1\over2}k}\]

+

As mentioned above, a construction like A over B over C needs braces, +where over is a generic name for \over and variants, including +\choose. Nothing special is required for \frac or \binom, so +that variant is omitted.

+n k 2orn k 2orn k/2orn 1 2k +

111 %%$${1\over2}{n\choose k}$$; $$\displaystyle{n\choose k}\over2}$$ : TeXbook

+

112 $\displaystyle \frac{1}{2}\binom{n}{k}$,

+

113 $\displaystyle{n\choose k}\over \displaystyle 2$,

+

114 $\dfrac{\dbinom{n}{k}}2$.

+

115 {\def\P{\mathchoice{D}{T}{S}{SS}}

+

116 $\displaystyle{\P\choose \P}\P\over \displaystyle \P$,

+

117 $\dfrac{\dbinom{\P}{\P}\P}\P$.}

+

Exercise 17.6: 1 2n k and +n k 2; version +n k 2; version with \P: + +T TD D, +T TT T. +Note that the `d' in \dfrac or \dbinom +means that the expression is in display style, hence numerator and +denominator are in text style; as a consequence the \choose is same as the +\dbinom; on the other hand, the \over produces a fraction in text +style, with numerator and denominator in display style, while the \dfrac +produces a fraction in display style, with numerator and denominator in +text style. In the dvi file, the distance between D and the fraction rule is +the same as the width of the rule, and the distance between the T and the +rule is approximatively one third of the height of the T; my HTML FM browser uses +larger values, making the difference more obvious.

+

Exercise 17.7: p 2x 2 y p-2 -1 1-x1 1-x 2 . +Fine space added for legibility.

+

118 \[{\displaystyle{a\over b}\above3pt\displaystyle{c\over d}}

+

119 \text{~~and~~} \genfrac{}{}{3pt}{}{\dfrac{a}{b}}{\dfrac{c}{d}}\]

+

There are six operators that behave alike: \over, \atop and +\above, and the same with delimiters. The `above' commands read a +dimension, the thickness of the fraction rule. In the current version of +Tralics, this has better to be explicit (if you want the value of +\parskip, you must use \genfrac).

+a b c danda b c d. +

120 ${\displaystyle \sum x_n}, {\textstyle \sum x_n},

+

121 {\scriptstyle \sum x_n}, {\scriptscriptstyle \sum x_n}$

+

Different sums x n ,x n ,x n ,x n . The position of the +index is unaffected by the style.

+

122 \[ {\displaystyle \int_{-\infty}^{\infty} \sum_{n=1}^m},

+

123 {\textstyle \int_{-\infty}^{\infty} \sum_{n=1}^m},

+

124 {\displaystyle\int\limits_0^{\frac{\pi}{2}} \sum\nolimits_{n=1}^m} \]

+

This example demonstrates that the position of scripts depends on the style if +the kernel is a math operator, and the presence of key words like `limits', +`nolimits' or `displaylimits'. Scripts can be added to a MathML object using +m/sub/sup, and for an operator using m/under/over. In this last case, the +attribute movablelimits corresponds to the `displaylimits' keyword. If set, +`under' means `sub' if the style is not display. Tralics uses `under' or +`sub', depending on where the indices should be placed, and never sets the +attribute. On the other hand, when typesets a `under' or `sub', it +sometimes uses a wrong strategy. The last expression (display style sum +without limits) uses a \msubsup element; in this case, there is an +implicit \nolimits, we cannot make it explicit, because such a command +has to follow an operator, and there is no easy way to check that the first +child of the element is an operator (it is easy to see that it is a <mo> +element, a bit more complicated to see that it contains a Unicode character, +and quite impossible to say that its translation leaves in state where +\nolimits is allowed). Note also that we could convert the argument to an +operator, but this is not always a good idea. In this example the HTML version +is correct, the Pdf version is wrongAmaya places the π/2 too low.

+ - n=1 m , - n=1 m , 0 π 2 n=1 m +

125 \[\lim_ax+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_ax\]

+

126 \[\textstyle \lim_lx+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_lx\]

+

127 \[\sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_ax\]

+

128 \[\textstyle \sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_lx\]

+

More about limits. Knuth says that \nolimits\limits produces limits; +so that \sin\limits produces limits; a special feature of amsmath +is that the token that follows the \sin is ignored if it is a +\limits token. +According to amsmath, an index A should be below the operator, an index L is a +normal subscript; the example here shows that Tralics behaves more like .

+lim a x+lim l x+lim a x+lim a x +lim l x+lim l x+lim a x+lim l x +sin l x+sin l x+sin l x+sin a x +sin l x+sin l x+sin l x+sin l x +

129 \[\operatorname*{sin}_a \operatornamewithlimits{sin}_a \qopname\relax{n}{sin}_a

+

130 \operatorname{sin}_l  \qopname\relax{o}{sin}_l

+

131 \mathop{\rm sin}_a\mathop{\rm sin}\limits_a\]

+

132 \[\textstyle\operatorname*{sin}_l \operatornamewithlimits{sin}_l

+

133  \qopname\relax{n}{sin}_l\operatorname{sin}_l  \qopname\relax{o}{sin}_l

+

134 \mathop{\rm sin}_l\mathop{\rm sin}\limits_a\]

+

These are commands that can define operators like sin or lim:

+sin a sin a sin a sin l sin l sin a sin a +sin l sin l sin l sin l sin l sin l sin a +

135 \[\sum_{\scriptstyle0\le i\le m\atop\scriptstyle0<j<n}P(i,j)\qquad

+

136 \sum_{\stackrel{0\le i\le m}{0<j<n}}P(i,j)\]

+

In the first expression given here, and in exercise 17.9 that follows, scripts +use an explicit `script style' command, hence should be typeset in scriptstyle +size. This is not the case in the HTML version: we have an atop in an atop, +and the style of the inner one is wrong. The second formula uses a command, this is not the right command for stacking indices because the first +argument uses a smaller style than the second. It seems to me that the top +line of first formula, bottom line of the second formula have the right +size. Other lines are too big (in Firefox) or much too small (in Amaya).

+ 0im 0<j<n P(i,j), 0<j<n 0im P(i,j) +

Exercise 17.8: i=1 p j=1 q k=1 r a ij b jk c ki .

+

Exercise 17.9: + + 1in 1jq 1kr a ij b jk c ki or + 1in 1jq 1kr a ij b jk c ki .

+

137 \[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}\]

+
+1+1+1+1+1+1+1+x. +

138 \[ \left(\left[\left\lbrack a\left\{\left\lbrace\left\lfloor b

+

139 \left\lceil\left\langle\left/ c\left|\left\|\left\uparrow d

+

140 \left\downarrow\left\updownarrow\frac 12 \right\Updownarrow

+

141 \right\downarrow t

+

142 \right\Uparrow\right\Vert\right\vert x\right\backslash\right\rangle

+

143 \right\rceil y \right\rfloor\right\rbrace\right\} z\right\rbrack\right]\right)\]

+
+abcd1 2txyz +

We would expect all delimiters to be of the same size; but not all characters +can be indefinitely extensible. On Firefox, we see a large slash, reverse +slash and angle brackets; all other characters have maximum size. On Amaya, +slash and reverse slash have a normal size, as well as double vertical bars; +on AM some delimiters are replaced by a question sign, namely floor, +ceiling, angle brackets, reverse slash and arrows (on following formulas, +arrows are however visible). AF uses floor instead of ceiling and vice-versa. +On FM the rendering of up-down-array is wrong.

+

There are problems with slash, backslash, double vertical bar on Tralics 2.9.4. Concerning the double vertical bar, the following expression contains +two different characters: =. The first +character is Unicode U+2016 (entity &Vert; in the file +mmlalias.ent), obtained by \Vert in Tralics 2.9.4, accessible +as \@Vert in following versions, it is not shwon by Amaya; +the second character is Unicode U+2225 +(entity &DoubleVerticalBar;, &parallel; and &shortparallel; +in the file mmlalias.ent), obtained by \parallel in Tralics 2.9.4, and also by \Vert in following versions. We changed this because +the first character has fixed size as the following demonstrates +1 2 (the effect is only visible in HTML +with FM).

+

Translation of backslash changed: it is now Unicode U+2216, you can use +the backslash character (Unicode U+5C) by saying \char`\^^5c. +Example: old is X\Y, new is XY, note the different +spacing.

+

Example of \bigl and \bigr, followed by the same code without these +operations; currently there is no difference in the HTML version; in the Pdf +there is more space in the equations on the LHS between closing brace and +opening brace (same for bracket).

+x - s ( x )y - s ( y )(x-s(x))(y-s(y)) +x - s [ x ]y - s [ y ][x-s[x]][y-s[y]] +| x | - | y |||x|-|y|| +

Example of big

+

144 \[ \big(\big[\big\lbrack \big\{\big\lbrace\big\lfloor

+

145 \big\lceil\big\langle\big/ \big|\big\|\big\uparrow

+

146 \big\downarrow\big\updownarrow\frac 12 \big\Updownarrow

+

147 \big\downarrow \big\Uparrow\big\Vert\big\vert \big\backslash\big\rangle

+

148 \big\rceil\big\rfloor\big\rbrace\big\}\big\rbrack\big]\big)\]

+
+/ | 1 2 | +

I see the following: every up to the slash, and starting with the backslash +is big; remaining items are small in the Pdf version, big in Firefox, +sometimes small, sometimes large in Amaya.

+

149 \[ \big(\bigl[\Big\lbrack \Bigl\{\bigg\lbrace\biggl\lfloor

+

150 \Bigg\lceil\Biggl\langle /|\|\uparrow \downarrow\updownarrow\frac 12

+

151 \Updownarrow\downarrow\Uparrow\Vert\vert\backslash

+

152 \Biggr\rangle\Bigg\rceil\biggr\rfloor\bigg\rbrace\Bigr\}\Big\rbrack\bigr]\big)\]

+

A formula with all variants

+/ | 1 2 | +

Up to version 2.9.4, there was a bug in handling these big things. +Currently, Tralics inserts \left and \right delimiters wherever +possible. In the Pdf version, this formula is identical to the previous one. +In firefox, operators between slash and backslash (that have no big) are small +before the fraction, large after that. This is strange. In Amaya, everything +between the slash and the backslash is small, except the \vert.

+

Exercise 17.10: 2 x 2 + 2 y 2 φ ( x + i y ) 2 =0.

+

153 Phi is $\phi,^^^^03c6$, ^^^^03c6  and varphi is $\varphi,^^^^03d5$, ^^^^03d5,

+

There is a problem in the rendering of the letter phi; the straight phi +character is Unicode U+03D5. As the example given here shows, the rendering +of phi and varphi in math mode, at least on my machine: +Phi is ϕ,φ, φ and varphi is φ,ϕ, ϕ, +epsilon is ϵ, varepsilon is ϵ. We changed the +translation, so that the Firefox and Pdf versions show, in math mode, the +desired result. Note that AM shows the same characeter for phoi ad varphi in +math mode, and has trouble with epsilon(shown as a square).

+

154 $\bigl (x\in A(n)\bigm|x\in B(n)\bigr)$,

+

155 $\bigcup_n X_n\bigm\|\bigcap_n Y_n$,

+

156 $\displaystyle{ {a+1\over b}\bigg/{c+1\over d}}$

+

Other big x A ( n ) | x B ( n ) and + n X n n Y n and +a+1 b/c+1 d.

+

Exercise 17.12: x + f ( x )/x - f ( x ).

+

157 \[1+\left(\frac{1}{1-x^2}\right)^3,\qquad \pi(n)=\sum_{k=2}^n

+

158 \left\lfloor\frac{\phi(k)}{k-1}\right\rfloor, \qquad

+

159 \left|\left|x\right|-|\left|y\right|\right|, \qquad

+

160 \left(\sum_{k=1}^n A_k\right),\qquad  \biggl(\sum_{k=1}^n A_k\biggr)\]

+

Exercise 17.13: +Comparison between \left and \bigl; translation is the same in +Tralics.

+1+1 1-x 2 3 ,π(n)= k=2 n ϕ(k) k-1,x-y, k=1 n A k , k=1 n A k . +

Exercise 17.14: was wrong in Tralics 2.9.4.

+π(n)= m=2 n k=1 m-1 ( m / k ) / m / k -1 +|x|=x,ifx0-x,ifx<0 +

sets \nulldelimiterspace, unused by Tralics.

+1 2=1 2=1 2=1 2 +

The \vcenter command is not implemented. +Any box can be put into a formula by simply saying +\hbox or \vbox or \vtop or \box or \copy; this is not +implemented in Tralics, you can insert text in math mode via \text or +\hbox.

+

Exercise 17.15: This shows the use of \mathchoice.

+

161 \def\puzzle{\mathchoice{D}{T}{S}{SS}}

+

162 \[\puzzle{\puzzle \over\puzzle^{\puzzle^\puzzle}} \qquad

+

163 \frac{\puzzle}{\puzzle^{\puzzle^\puzzle}} \]

+
+DT T S SS T T S SS +

Exercise 17.16: The \square command is built-in: .

+

The \mathpalette command is introduced in Tralics 2.9.5, not tested +yet.

+

164 \def\legendre{\overwithdelims()}\def\Legendre{\genfrac(){}{}}

+

165 \def\euler{\atopwithdelims<>}\def\Euler{\genfrac<>{0pt}{}}

+

166 \def\grimm{\abovewithdelims][4pt}\def\Grimm{\genfrac][{4pt}{}}

+

167 \[{a\legendre b}, \Legendre{a}{b}, {n \euler k}, \Euler{n}{k},

+

168 {\dfrac ab \grimm \dfrac cd}\Grimm{x}{y} \]

+

Exercise 17.17: Knuth says: the size of the surrounding delimiters depends only on +the size, not on the size of the fractions, this is false for Tralics:

+a b,a b,n k,n k,a b c dx y +

If f is the value of \delimiterfactor and δ the value of +\delimitershortfall, and we have a formula that extents y 1 units +above the axis, and y 2 units below, if y=2max(y 1 ,y 2 ), then the +delimiter size is at least y·f/1000, and at least y-δ. +This does not apply to Tralics.

+

The remainder of the chapter discusses some low-level commands that are not +fully implemented in Tralics. The commands \textfont, \scriptfont +and \scriptscriptfont take a small number as argument, and provide a +reference to a font. The following code

+

169 \font\tenrm=somefont at 12pt

+

170 \font\Helvetica=someotherfont scaled 1013

+

171 \textfont0=\tenrm

+

172 \scriptscriptfont2=\scriptfont3

+

173 \the\fontdimen3\scriptscriptfont15

+

174 $\textfont0=\tenrm 9\hbox{$9\textfont0=\Helvetica$}$%

+

175 ${\textfont0=\Helvetica 9}$ % exercise 17.18

+

gives: +0.0pt999. The dimension should be +zero, and the math formula contains three identical digits. Exercise 17.18 +says that the fonts used by in the last case is not Helvetica.

+

You cannot use more than 16 different math fonts in a formula. Assume that you +need symbol A from font a; you can say that \textfont6 is your font a, +and your symbol is character 137 in that font. What if you want +symbol B from font b? you can use font number 7, but this is obviously not the +solution. We explain here the amsmath strategy by telling what happens if you +use \tt in a math formula. First of all, in a formula, this evaluates to +\mathtt, and the real command is \@mathtt. This is a self-modifying +command; after first use it is equivalent to \fam9 (this means that +normal characters in text size use the \textfont9). The first use +allocates the number 9, and defines the font, moreover the font information is +remembered (the font \textfont9 will be defined for all subsequent math +formulas). Note that the value of \textfont9 can be cmtt12, but this is +recomputed if the current font size changes. For most other commands, the +number is allocated when the font is declared, this means that a slot is +allocated even when the font is never used.

+

Four slots are preallocated, with the names operators, letters, symbols and +largesymbols. If you load packages amsmath, amscd, amssymb, and bm, four +other slots are used, and there are only 8 slots remaining. In the case of +this document, we test all 14 MathML fonts. How is this possible? +In fact some characters are typeset outside math mode (sans-serif characters +for instance) and in some cases poor-man-bold is used. Moreover, we had to +remove some font families (these are commented out in the file +raweb-uni.sty).

+

Exercise 17.19: Math code are not implemented in Tralics, \oplus is character +U+2295 and \bullet is character U+2022.

+

176 \mathcode`<="2203 \mathcode`*="313C

+

177 \mathcode`a="8000 {\catcode`a=13 \gdef a{A}}

+

178 $a<b*c$

+

179 %\mathchardef\@M=10000

+

In , the previous code is equivalent to A*b<c, in Tralics, it gives: + +A<b*c. Since version 2.9.10, a capital letter A is produced. +The last line is commented out: the assignment is done at bootstrap. +You should use \@M as the constant 10000, not as control-P in family 7 +(binary operation).

+

Following code is unlikely to work

+

180 \def\sum\{\mathchar"1350}

+

181 \mathchardef\sum"1350

+

182 \def\n@space{\nulldelimiterspace\z@ \m@th}

+

183 \newdimen\p@ \p@=1pt

+

184 \def\bigl#{\mathopen{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}

+

185 \delcode `x="123456

+

186 \def\langle{\delimiter"426830A }

+

187 \bigl\delimiter"426830A

+

188 \def\sqrt{\radical"270370 }

+

189 \def\idehat{\mathaccent"362 }

+
+Fine points of Mathematics Typing, TB 18 +Punctuation +

Say: If x<0, we have shown that

+y=f(x). +

Do not say: for x=a,b, or c, but: for x=a, b, c, or use a tie: +or c.

+

Exercise 18.1: R(n,t)=O(t n/2 ), as t0 + . Adding braces improves the Html version: R(n,t)=O(t n/2 ).

+
+Non-italics letters in formulas +

has 32 predefined operators, some of them behave like sums according to +the placement of limits.

+arccos x +arcsin x +arctan x +arg x +cos x +cosh x +cot x +coth x +csc x +deg x +det x +dim x +exp x +gcd x +hom x +inf x +ker x +lg x +lim x +lim inf x +lim sup x +ln x +log x +max x +min x +Pr x +sec x +sin x +sinh x +sup x +tan x +tanh x +inj lim x +proj lim x +

The last two operators are defined by amsmath. Variants shown later. More +formulas (there should be small space around these operators, that is +invisibile on my browser).

+sin2θ=2sinθcosθO(nlognloglogn)Pr(X>x)=exp(-x/μ)max 1nm log 2 P n lim x0 sinx x=1 +

Exercise 18.2:

+p 1 (n)=lim m ν=0 1 - cos 2m (ν! n π/n) +

Example of formulas using \rm: + Var (X), x max -x min , + LL (k) LR (k), exp(x+ constant ), +and x 3 + lower order terms .

+

Some formulas using \hbox for roman font: +Var(X), +LL(k)LR(k), exp(x+constant), +and x 3 +lowerorderterms.

+

The same formulas using \text for roman font: +Var(X), +LL(k)LR(k), exp(x+constant), +and x 3 +lowerorderterms.

+

190 \def\Varliminf{\mathop{\underline{\mathmo{lim}}}}

+

191 \def\Varlimsup{\mathop{\overline{\mathmo{lim}}}}

+

192 \[\lim_{n\to\infty}x_n\text{ exists}\iff

+

193 \Varlimsup_{n\to\infty}x_n=\Varliminf_{n\to\infty}x_n.\]

+

Exercise 18.3:

+lim n x n existslim sup n x n =lim inf n x n . +lim n x n existslim n x n =lim _ n x n . +

The code above is wrong, because `lim' is a known operator, with movable +limits, hence, in non-display mode, both the underline and the real subscript +will move. The real definitions adds +movablelimits = `false' to the operator.

+

194 $\gcd(m,n)=\gcd(n,m\bmod n)$, or $x\equiv y+1\pmod{m^2}$

+

195 $x\equiv0(\pmod y^n)$.

+

Modulo: gcd(m,n)=gcd(n,mmodn), or xy+1(modm 2 )

+

Exercise 18.4: B.L. User got the unexpected formula x0((mody) n ).

+

Exercise 18.5: In this example, there are braces around n/p, but not +k/p; this can affect the size of the slash operator (HTML version only).

+n kn/p k/pnmodp kmodp(modp) +

Example of bold face a+b=Φ m ; normal Phi is U+03A6, bold Phi is +U+1D6BD, italic Phi is U+1D6F7, bold italic Phi is U+1D731, sans serif bold +Phi is U+1D76B, sans serif bold italic Phi is U+1D7A5. In the current version +of Tralics, font changes apply only to ASCII letters. Commands like \cal +are robust, so that +$\cal Ab\Phi$ produces AbΦ; +command \mit is not implemented. Note that in some cases, digits and +lower case letters do not exist in the font, and may be replaced by random +glyphs.

+

Exercise 18.6: If you want +x T Mx=0x=0 in +Tralics 2.9.4, you have to explicitly say that you want a bold face zero, +and an upright T, see below. In version 2.9.5, nothing special needed. +Note how we use colon-equal here.

+

196 $\bf\bar x^{\mathmo{T}}Mx={\rm0}\iff x=\mathmn[mathvariant][bold]{0}$

+

197 Compare $This\ is\ math\ italics$ with {\it This is text italics}.

+

198 Compare $different$ and $\it different$. We have also

+

199 $\it last\mathmo{:=}first$, $\it x\_coord(point\_2)$

+

Compare Thisismathitalics with This is text italics. +Compare different and different. We have also +last:=first, x_coord(point_2).

+

Exercise 18.8: We use \mathit instead of \it here.

+available+ i=1 n max(full(i),reserved(i))=capacity +

Exercise 18.9: +The following code was obtaining by taking the answer from the book, with the following modifications: the \sfcode of the semi colon not +changed; math formulas put outside scope of \bf, because my browser shows +letters (not digits) in bold face otherwise. Note that the XML to HTML +processor converted the whole environment (seven paragraphs) into a single +paragraph +with <br> as separator (inter-paragraph width too big), and a huge +left margin (for fun). We show here the start of the code:

+

200 \begin{xmlelement+}{pseudocode}\XMLaddatt{leftskip}{5cm}

+

201 \obeylines

+

202 \def\coleq{\mathmo{:=}}

+

203 \textbf{for} $j\coleq 2$ \textbf{step} $1$ \textbf{until} $n$ \textbf{do}

+

204 ...

+

205 \end{xmlelement+}

+

for j:=2 step 1 until n do

+

   begin accum:=A[j]; k:=j-1; A[0]:=accum;

+

   while A[k]>accum do

+

      begin A[k+1]:=A[k]; k:=k-1;

+

      end;

+

   A[k+1]:=accum;

+

   end.

+

+
+Spacing between formulas +

Compare

+F n =F n-1 +F n-2 ,n2. +

with (lot of white space in the formula)

+F n =F n-1 +F n-2 ,n2. +

and (no unnecessary white space in the formula)

+F n =F n-1 +F n-2 ,n2. +

Normally, the spacing should be the same in the last two formulas. +In fact, Knuth says that \quad is the same as \hskip 1em\relax. +The translation of a \quad in math mode is <mspace width="1.em">, +but the \hskip command reads a dimension, and converts one em into ten +pointsMaybe, one day, Tralics will have an em that depends on the context.

+

Exercise 18.10: Three versions:

+

Let H be a Hilbert space, C a closed bounded convex subset +of H, T a non-expansive self map of C. Suppose that as +n, a n,k 0 for each k, and +γ n = k=0 (a n,k+1 -a n,k ) + 0. +Then for each x in C, A n x= k=0 a n,k T k x converges +weakly to a fixed point of T.

+

Let H be a Hilbert space,  C a closed bounded convex subset +of H,  T a non-expansive self map of C. Suppose that as +n,  a n,k 0 for each k, and +γ n = k=0 (a n,k+1 -a n,k ) + 0. +Then for each x in C,  A n x= k=0 a n,k T k x converges +weakly to a fixed point of T.

+

Let C be a closed, bounded, convex subset of a Hilbert space H, +and let T be a non-expansive self map of C. Suppose that as +n, we have a n,k 0 for each k, and +γ n = k=0 (a n,k+1 -a n,k ) + 0. +Then for each x in C, the infinite sum +A n x= k=0 a n,k T k x converges weakly to a fixed point of T.

+

Comments: the translation of the three characters: space, backslash, space is +formed of two spaces. Such a construct is used four times in the first +version. This produces a nice dvi file, but HTML interprets the double space +the same as a single space. In the second version, we have used a double tilde +character. This inhibits line breaks. (My browser does not seem to honor this). +No special characters appear in the last example.

+
+Spacing within formulas +

206 $a\,b\>c\;d\!e\quad f\qquad g\ h$~j

+

207 %\the\thinmuskip\the\medmuskip\the\thickmuskip

+

The math spacing commands: abcdefghj. +In , the value of the glue inserted depends on three registers: +\thinmuskip (3mu), \medmuskip +(4mu plus 2mu minus 4mu) and \thickmuskip (5mu plus 5mu). You can try to +execute the line above that is commented out: all dimensions come out as 0mu +in Tralics, but the math formula contains 0.166667em, 0.222222em, 0.277778em, +etc, this is the same as 3mu, 4mu and 5mu, because 1em=18mu. In Tralics, +\mskip 18mu is equivalent to \hskip1em, and, as said above, this is +the same as \hskip10pt. The same is true for \mkern18mu; the +translation is an empty <mspace> element, with attribute +value = `10.0pt'. The amount of space given by backslash-space changed +from 6pt to 4pt (this is the same amount of space used by the \text +command).

+

208 $\int_0^\infty f(x)\,dx$, $y\,dx-x\,dy$, $dx\,dy=r\,dr\,d\theta$, $x\,dy/dx$

+

Translation 0 f(x)dx, ydx-xdy, dxdy=rdrdθ, +xdy/dx.

+

Exercise 18.11:

+ 1 x dt t 0 t-ib t 2 +b 2 e iat dt=e ab E 1 (ab),a,b>0 +

209 $55\,\mathrm{mi/hr}$, $g=9.8\,\mathrm{m/sec}^2$,

+

210 $1\mathrm{ml}=1.000028\,\mathrm{cc}$

+

Units: 55 mi / hr , g=9.8m/ sec 2 , +1 ml =1.000028 cc . Note that digits are outside the scope +of \mathrm.

+

Exercise 18.12: Inline math, displaystyle: +=1.054×10 -27 erg sec .

+

211 $(2n)!/\bigl(n!\,(n+1)!\bigr)$, $\sqrt2\,x$,

+

212 $\sqrt{\,\log x}$, $O\bigl(1/\sqrt n\,\bigr)$,

+

213 $[\,0,1)$, $\log n\,(\log\log n)^2$, $x^2\!/2$, $n/\!\log n$,

+

214 $\Gamma_{\!2}+\Delta^{\!2}$, $R_i{}^j{}_{\!kl}$, $\int_0^x\!\int_0^y dF(u,v)$

+

215  \[\frac{52!}{13!\,13!\,26!}\qquad \int\!\!\!\int_D dx\,dy\]

+

Test: +(2n)!/n ! ( n + 1 ) !, 2x, +logx, O1 / n , +[0,1), logn(loglogn) 2 , x 2 /2, n/logn, +Γ 2 +Δ 2 , R i j kl , 0 x 0 y dF(u,v)

+52! 13!13!26! D dxdy +

Same formulas, without thin spaces

+

Test: +(2n)!/n ! ( n + 1 ) !, 2x, +logx, O1 / n, +[0,1), logn(loglogn) 2 , x 2 /2, n/logn, +Γ 2 +Δ 2 , R i j kl , 0 x 0 y dF(u,v)

+52! 13!13!26! D dxdy +

Amaya shows a strange behavior here. Without the space the first integral is +larger than the second. In thee case of negative space, the absolute value is +used.

+

Exercise 18.14: intervals with left/right: +-,T×-,T; +with mathopen, mathclose +]-,T[×]-,T[; +with nothing ]-,T[×]-,T[. And with left/right: +-,3 4×-,3 4; +with mathopen, mathclose +]-,3 4[×]-,3 4[; +with nothing ]-,3 4[×]-,3 4[.

+

Exercise 18.15: The spacing in x++1 differs between and MathML.

+
+Ellipses +

216 $x_1+\cdots+x_n$, $x_1=\cdots=x_n=0$, $A_1\times\cdots\times A_n$,

+

217 $f(x_1,\ldots,x_n)$, $x_1x_2\ldots x_n$, $(1-x)(1-x^2)\ldots(1-x^n)$,

+

218 $n(n-1)\ldots(1)$.

+

Translation of these formulas x 1 ++x n , x 1 ==x n =0, A 1 ××A n , +f(x 1 ,...,x n ), x 1 x 2 ...x n , (1-x)(1-x 2 )...(1-x n ), +n(n-1)...(1).

+

Exercise 18.16: Answer x 1 +x 1 x 2 ++x 1 x 2 ...x n , +(x 1 ,...,x n )·(y 1 ,...,y n )=x 1 y 1 ++x n y n . +Prove that (1-x) -1 =1+x+x 2 +. Clearly a i <b i , for i=1, 2, +...n. The coefficients c 0 c 1 , ..., c n are positive. +With braces surrounding the LHS: (1-x) -1 =1+x+x 2 +.

+

Exercise 18.17: Clearly a i <b i , for i=1,2,...,n. Note that the `2' here is +a math digit, while it is text digit in the sentence above.

+

Exercise 18.18: Knuth used \dots.

+
+Line breaking +

The book explains how can break a math formula. This does not +apply to Tralics. Commands \nobreak and \allowbreak +do nothing in math mode.

+
+Braces +

You should use braces only for grouping. You can use a brace character via +\{ in text or math mode. This character is a delimiter (it can be +preceded by \left or \big).

+

219 $\{a,b,c\}$, $\{1,2,\ldots,n\}$, $\{\mathrm{red,white,blue}\}$

+

220 $\{\,x\mid x>5\,\}$, $\{\,x:x>5\,\}$,

+

221 $\bigl\{\,\bigl(x,f(x)\bigr)\bigm|x\in D\,\big\}$

+

222 $\bigl\{\,\bigl(x,f(x)\bigr)\bigm\mid x \in D\,\big\}$

+

223 $\bigl\{\,\bigl(x,f(x)\bigr)\mid x\in D\,\big\}$

+

Translation +{a,b,c}, {1,2,...,n}, { red , white , blue }, +{xx>5}, {x:x>5}, + x , f ( x ) | x D + x , f ( x ) |xD. +Note that \mid gives better spacing than a single bar + x , f ( x ) x D , + x , f ( x ) x D .

+

Exercise 18.21: x 3 h (x) {-1,0,+1}

+

Exercise 18.22: {pp and p+2 are prime}.

+

We show here the use of the cases enviroment, this is a two-column cmatrix, +with a left brace delimiter on the left.

+|x|=x,ifx0;-x,otherwise. +f(x)=1/3if0x1;2/3if3x4;1/3elsewhere; +

Exercise 18.23: The \cases command is not implemented, but there is +a environment. You cannot use \noalign. After a double backslash you can +put a dimension in brackets, but this is currently ignored.

+

224 \[\overbrace{x+\cdots+x}^{k\; \textrm{times}} \qquad \underbrace{x+y+z}_{>\,0}\]

+

We show here braces can stretch horizontally, when used as over-accent or +under-accent.

+x++x k times x+y+z >0 +
+Matrices +

The plain command \matrix should not be used. The `array' +environment can be used in math mode, and you must specify for each column the +alignment method. The `matrix' environment can be used, cells are centered. He +we use `pmatrix', because it adds automatically parentheses. In +Tralics 2.14.2 there is a possibility to put an attribute pair on +the current table.

+

225 \[A=\begin{pmatrix}x-\lambda&1&0\\0&x-\lambda&1\\0&0&x-\lambda\end{pmatrix}\]

+

226 \[\begin{pmatrix}a&b&c\\d&e&f\tableattribute{A}{B}\end{pmatrix}\mathattribute{C}{D}

+

227 \begin{pmatrix}u&x\\v&y\\w&z\end{pmatrix}\]

+
+A=x-λ100x-λ100x-λ +abcdefuxvywz +

Exercise 18.24: This looks bad in the HTML version, but it OK is Pdf. Delimiters +are \lgroup and \rgroup.

+abcdefuxvywz +

Exercise 18.25:

+A=a 11 a 12 ...a 1n a 21 a 22 ...a 2n a m1 a m2 ...a mn y 1 y k +

Border matrixCommand \bordermatrix not yet implemented

+

Small matrices 11 00 and a l b m c n. Note that horizontal alignment is +only approximative.

+
+Vertical Spacing +

228 \def\Limsup{\mathop{\smash\limsup\vphantom\liminf}}

+

229 $\Limsup\limits_3=\limsup\limits_3$

+

+Compare: lim suplim inf 3 =lim sup 3 ! The second index should be lower +than the first.

+

Commands \raise and \lower not yet implemented. +Commands \llap and \rlap not yet implemented.Fixme

+

230 \def\undertext#1{$\underline{\hbox{#1}}$}

+

231 \undertext{This} \undertext{does} \undertext{not} \undertext{always}

+

232 \undertext{work} \undertext{right}.

+

233 \def\undertext#1{$\underline{\smash{\hbox{#1}}}$}

+

234 \undertext{This} \undertext{does} \undertext{not} \undertext{always}

+

235 \undertext{work} \undertext{right}.

+

Exercise 18.26: + A sentence where each word is an +underlined math formula (text only): +This _ does _ not _ always _ +work _ right _. The same, where the \smash is used to +hide the depth of the text (all lines vertically aligned): + +This _ does _ not _ always _ +work _ right _.

+

236 $\rm Fe_2^{+2}Cr_2^{\vphantom{+2}}O_4^{\vphantom{+2}}$

+

Use of phantoms: Fe 2 +2 Cr 2 +2 O 4 +2

+
+Special features for math hackers +

Commands \nonscript, \everymath and \everydisplay are OK.

+

237 {\everydisplay{a}\everymath{b} \def\X{x\nonscript\qquad y}

+

238 \[u = \text{ v $w$ }\frac{\X}{\textstyle\X} \]}

+
+au=vbwxy xy +
+Summary +

Exercise 18.27: n th from the book, n th is , and +nth is textsuperscript.

+

Exercise 18.28: S -1 TS=dg(ω 1 ,...,ω n )Λ, uses \mathnormal, no bf lambda?

+

Exercise 18.29: Pr(m=nm+n=3).

+

Exercise 18.30: sin18 =1 4(5-1).

+

Exercise 18.31: k=1.38×10 -16 erg / K.

+

Exercise 18.32: Φ NL 1 * /N=L 1 * NL n * /N=L n * .

+

Exercise 18.33: I(λ)= D g(x,y)e iλh(x,y) dxdy.

+

Exercise 18.34: 0 1 0 1 f(x 1 ,...,x n )dx 1 ...dx n . +Note: Firefox shows small integral signs, and larger ones in the previous +exercise.

+

Exercise 18.35: Using cases environment

+x 2m Q(X m 2 -P 2 W m 2 )-2S 2 (modd)P 2 2 (X m 2 -P 2 W m 2 )-2S 2 (meven)(modN). +

Exercise 18.36: with a \frac

+(1+x 1 z+x 1 2 z+)...(1+x n z+x n 2 z 2 +)=1 (1-x 1 z)...(1-x n z) +

Exercise 18.37:

+ j0 k0 a jk z k = n0 z n k 0 ,k 1 ,...0 k 0 +k 1 +=n a 0k 0 a 1k 1 ... . +

Exercise 18.38: Using \frac and \binom

+(n 1 +n 2 ++n m )! n 1 !n 2 !...n m !=n 1 +n 2 n 2 n 1 +n 2 +n 3 n 3 ...n 1 +n 2 ++n m n m . +

Exercise 18.39: Using \genfrac

+Π R a 1 ,a 2 ,...,a M b 1 ,b 2 ,...,b M = n=0 R (1-q a 1 +n )(1-q a 2 +n )...(1-q a M +n ) (1-q b 1 +n )(1-q b 2 +n )...(1-q b N +n ). +

Exercise 18.40:

+ p prime f(p)= t>1 f(t)dπ(t). +

239 \def\X{\char`'}

+

240 \[{

+

241 \{\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a\X\mathrm{s}},

+

242   \overbrace{\mathstrut

+

243     b,\ldots,b}^{l\;b\X\mathrm{s}}}_{k+l\;\mathrm{elements}}\}

+

244 }\quad\text{vs}\qquad {

+

245 {\{\,}\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a'\mathrm{s}},

+

246   \overbrace{\mathstrut

+

247     b,\ldots,b}^{l\;b'\mathrm{s}}}_{k+l\;\mathrm{elements}}{\}\,}.}\]

+

Exercise 18.41: In this formula, we want the denote the plural of the token a by +as apostrophe followed by the letter s. The first attempt is not good. The +second is a bit better, because it is a-prime followed by s. The first +expression is formed of open brace, underbraced formula, closing brace; and this +produces large braces in the HTML version; small braces are obtaing by +replacing the first token by a list, containing the brace and little bit space.

+{(a,...,a ka's ,(b,...,b lb's k+l elements }vs{(a,...,a ka ' s ,(b,...,b lb ' s k+l elements }. +

Exercise 18.42:

+abcdefgh0ijkk. +

A non trivial question: what is the distance X between two lines in a matrix +like these? or said otherwise, what is the vertical glue Y added between two +lines? Let x be the value of \baselineskip, y the value of +\lineskiplimit and z the value of \lineskip. Then, the quantity +y is computed so that X=x, unless this gives Y<y, case where z is used +instead. Typically, for a normal paragraph, x=12, y=0, z=1, and for a +`align' environment, we have x=15, y=3, z=4. In the case of an array, +all three values are zero. This means: normal baseline in a paragraph is 12pt, +but there is at least one pt between two lines, and in the case of multiline +equations, the baseline is larger, as well as the clearance. In the case of an +array, no extra space is added. However, a strut is added to each line, this +is an invisible rule; as a consequence, the total height plus depth of each +line is the matrix is at least 12pt, hence X is at least 12pt.

+

This has as consequence that, in the big matrix above, parentheses do touch. +We changed, in the file raweb-cfg.sty, the code of the \@array command: +z=5, and y is 3 or 5, depending on whether the `displaystyle' attribute +array of the array is true (if the attribute is true, then all entries are +typeset in \display mode; this is the case for all environments like +`gather' or `align' that are translated by Tralics as an array).

+

Exercise 18.43: Note: entries are left aligned because of explicit \hfil.

+detc 0 c 1 c 2 ...c n c 1 c 2 c 3 ...c n+1 c 2 c 3 c 4 ...c n+2 c n c n+1 c n+2 ...c 2n +

Exercise 18.44:

+ ' xA f(x)= def xA x0 f(x). +

Exercise 18.45: This is not so nice

+2k2 2 2 · · · 2 1 2k +

Exercise 18.46: Vertical arrow centered via the use of phantom on the left; +command \hidewidth not used (the purpose of the command is to make +\halign believe that the cell has a very small width; this will produce +an overfull box, but who cares: there is enough white space at both ends).

+00 O k ι E ρ L 0ϕϕψψ0 O C π * O D δ R 1 f * O V (-D) 0θ i γ -1 θ i γ -1 R 1 f * O V (-iM)γ -1 0 +
+Displayed Equations, TB19 +One-line displays +

Example of a display, containing only text

+DisplayedText +

Another one, with text and math

+X n =X k ifandonlyifY n =Y k andZ n =Z k . +

Compare the following two examples: the translation is the same, but you cannot +put arbitrary text in a math formula!

+

248 $$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q \qquad\hbox{for all }n\ge 0.$$

+

249 $$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q\qquad\hbox{for all $n\ge0$}.$$

+
+Y n =X n modpandZ n =X n modqforalln0. +Y n =X n modpandZ n =X n modqforalln0. +

Exercise 19.1: The exercise contains four formulas; for the first three ones, we +give a variant. For the first formula, the delimiters hace different +sizes.

+

250 $$\sum_{n=0}^\infty a_nz^n\qquad \hbox{converges if}\qquad |z| <

+

251 \Bigl(\limsup_{n\to\infty}\root n\!\of{|a_n|}\,\Bigr)^{-1}.$$

+

252 \[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <

+

253 (\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}{\,)}^{-1}. \]

+

254 \[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <

+

255 (\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}\,)^{-1}. \]

+
+ n=0 a n z n convergesif|z|<lim sup n |a n | n -1 . + n=0 a n z n convergesif|z|<(lim sup n |a n | n) -1 . + n=0 a n z n convergesif|z|<(lim sup n |a n | n) -1 . +

Next two formulas.

+

256 $${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad \hbox{as $\Delta\to0$.}$$

+

257 \[\frac{f(x+\Delta x)-f(x)}{\Delta x}\to f'(x)\qquad \text{as }\Delta\to0.\]

+

258 $$\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$

+

259 \[\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\text{if } i\ne j.\]

+
+f(x+Δx)-f(x) Δxf ' (x)asΔ0. +f(x+Δx)-f(x) Δxf ' (x)asΔ0. +u i =1,u i ·u j =0ifij. +u i =1,u i ·u j =0ifij. +

Last formula; you cannot use the \matrix command defined by plain , +but you have to use the matrix environment.

+

260 \[\it\text{The confluent image of}\quad

+

261 \begin{Bmatrix}\text{an arc}\hfill\\\text{a circle}\hfill\\\text{a fan}\hfill

+

262 \end{Bmatrix}

+

263 \quad\text{is}\quad

+

264 \begin{Bmatrix}\text{an arc}\hfill\\\text{an arc or a circle}\hfill\\

+

265 \text{a fan or an arc}\hfill\end{Bmatrix}.\]

+
+Theconfluentimageofanarcacircleafanisanarcanarcoracircleafanoranarc. +

Since version 2.9.5, you can use font changes in \text commands and +friends (the previous formula is in italics). This is a more elaborate example

+

266 $\hbox{upright} \it \text{Italic\bf Boldface} {\tt \text{x = y$^2$}}$

+

Translation: uprightItalicBoldfacex=y 2 .

+

Exercise 19.2: Compare B. L. User's solution, Knuth's solutions and \tfrac:

+y=1 2xvsy=1 2xvs1 2x +

Exercise 19.3: We demonstrate in this example that using +$$\hbox{$formula$}$$ is non-trivial.

+

267 \everymath={A}

+

268 \everyhbox={B}

+

269 \def\X{\ifhmode H\else \ifvmode V \else \ifmmode M \else U\fi\fi\fi}

+

270 \def\Y{\X\ensuremath{\beta}}

+

271 $$ \Y\hbox{\X$\Y $\X}\Y \text{\X}$$

+
MβBHAMβHMβH +

Guess what happens if \X were replaced by \Y? the problem might be +solved in a future version. Note that \text does not insert the +every-hbox token list.

+

Exercise 19.4: Look at these four identical formulas.

+1-1 2+1 3-1 4+=ln2 +1-1 2+1 3-1 4+=ln2 +1-1 2+1 3-1 4+=ln2 +1-1 2+1 3-1 4+=ln2 +

In , equations are centered, and an equation number is added to the left +or the right. In the HTML version, an equation-with-number is a 3-column +table, columns 1 and 3 are of width 4em (this is defined in the CSS file), +one of them contains the equation number. If the equation number is big, the +width of the column might be larger than 4em, columns 1 and 3 could have +different widths, so that column 2 is not centered. Otherwise it is centered, +and the equation is centered in column 2 (is there a way to do this better?)

+

Normally, there should be a way to put the equation at some position (say 3cm +from the left margin). This is done in via a package option (can we +easily modify so that each equation can be centered or not?). In this +examples, first two formulas should be centered, other ones should flushed +left. Equations two and three have a number.

+

Note on Equation Numbering For a very long time, I have used the +\eqno command without any difficulty; of course, you have to be very +careful if you introduce an equation between equations (11) and (12), you +have to change every reference for any equation starting with 12. A big +advantage of is its automatic numbering scheme; more precisely if +you flag an equation with \label{eq+12}, you can get its number +via \ref{eq+12} (the only difficulty then is to find mnemonic +tag names). In a first pass, computes the value of the label, and +stores it in a file, in a second pass, it reads the file, and uses this +number. No number is computed by Tralics, in some cases, this can be +annoying. A side effect of the translation of the \label command is the +addition of an id (for instance `id12' to the equationThe label name +provided by the user cannot be used since it is an invalid XML id in this case), and translation of +the \ref is a <ref> element with a reference to the id.

+

Equation numbers are computed by the XML-to-whathever processor. +In fact, in the case of conversion from XML to HTML, the style sheet computes +the equation number twice: once when the equation is converted, and once when +the <ref> is converted. In the case of XML to XSL/FO, a number is computed +only for <ref>, the equation number is added to the equation by , +when the XSL/FO is converted to Pdf (this is not really important, because +nobody looks at the FO file).

+

Assume that you have hundreds of equations, and you want to refer the previous +one; very often it is tagged `(*)', in some cases `(**)'. Some people use +`(***)'. Exercise 19.7 that follows says that, in math mode, these come out as +(*), in some cases (**) and (***). In particular, a non-trivial question +is: should equation numbers by typeset as math or as text? In Tralics, we +implemented \eqno and \tag; that's a bit tricky, let's explain +some difficulties.

+ +

The MathML recommendation says: automatic equation numbering and +automatically resolving references to equations is outside the scope of +MathML, but can be done by use of style sheets or other means. “The +<mlabeledtr> construction provides support for both of these functions in +a way that is intended to facilitate XSLT processing”. The idea is to +construct an array, the first column contains equation numbers, with an +attribute that says if the tag should be on the left or the right. +This allows more than one tag per formula (there can be more than one row). +The problem is that my browser ignores the whole line. This is bad news.

+
+

The current implementation is: if the formula has a label, it has an +equation number. It cannot have more than one label/id/equation number. +(here `formula' designates the element that contains the translated math +formula). The style sheet computes the equation number via +<xsl:number level='any' count='formula[@id]' />.

+
+

What happens if a formula has a tag and a label? Currently the tag is +ignored. What we should do is modify the template above (count all formulas +with id and without tags), this gives a value if the equation has no tag, +and use the value of the tag otherwise. Note that, if you say +\tag{x}, this gives (x) as equation number, and \eqref +gives this value back. On the other hand, \eqno(x) is equivalent to +\tag*{(x)}.

+
+

If a tag is part of a math formula, it can consist in any math +construct. In our implementation, it may be an attribute so that only +characters are allowed. You cannot use α or β as tag. +In , tags are typeset in text mode, and math shift characters are +sometimes used. These are removed by Tralics.

+
+

A tag can appear anywhere in a formula, and more than one tag can be +used. Thus Tralics reads all tags and merges them (it complains if more +than one label appears in a formula).

+
+

The final tag, after merge, removal of special characters, etc., is +passed to a command; you can redefine it. In general it will either typeset +the tag, or convert it to an attribute.

+
+

Summary: There are three ways to obtain an equation number. +First, if an equation has a label, an equation number will be assigned to it +automatically, when converting from XML to HTML, or whatever. The second method +consists in using the amsmath command \tag, described below. Finally, you +can use the command \eqno. This command reads everything up to the +end of the formula, expanding tokens when needed; if this yields foo, +then \y@tag{foo} is evaluated again; this the same as if you said +\tag*{foo}. Its effect by default is to convert the tag as an +attribute to the formula. +Moreover, the attribute eqnpos is added to the +formula, with a value of left and right, depending on whether +\leqno or \eqno has been used. The equals signs should be aligned +for the five next formulas.

+x 2 -y 2 =(x+y)(x-y). +x 2 -y 2 =(x+y)(x-y). +

Equation number of () is on the left, of () on the +right, and () depends on the class option.

+x 2 -y 2 =(x+y)(x-y). +x 2 -y 2 =(x+y)(x-y). +x 2 -y 2 =(x+y)(x-y). +

Exercise 19.5:

+ k0 1 1-q k z= n0 z n / 1kn (1-q k ). +

Exercise 19.6: In , you can put an en-dash in an equation number by using +\hbox. This is not allowed in Tralics: the equation 1=1 below gives an +error. On the other hand, any character can be put in an equation number; the +case of an apostrophe is a bit special: it is not converted to an exponent, +but replaced by \apostrophe.

+

The example below illustrates one complexity. The end of the tag (via +\eqno) is the end of the formula. In order to get the end of the formula, +all tokens have to be expanded. The question is what to do with \char: +remember that this command reads and typesets a character. In this case it +cannot typeset a character; assume that we delay its interpretation. In this +case, the command that follows the backquote will be expanded (this is wrong: +we do not want to put an acute accent somewhere). Hence, the \char +command reads a character, and pushes back a character token, with the same +value, but category code 12. We explained above that \mathchar is not +implemented. This means that there is one and only one active math character: +the apostrophe, it produces a prime exponent even when it has category code +12. This is not desired: a tag should consist in characters only. This +explains why something special is done. You can define the \apostrophe +command as you like (the default value is character U+B4, but you can use an +apostrophe, case where an exponent will be created when the token list is read +again; formula 2=2 gives a double superscript error, guess why). +Note how we insert an en-dash (of course \textendash is a +non-math command, we had to modify some files in order to allow this character +in the Pdf).

+

272 \[1=1\eqno\hbox{(3--1)} \]

+

273 \[0=0\eqno(*,{**},{***},16'\char`\'\char`\^,3^^^^20131)\]

+

274 \[\def\apostrophe{'} 2=2\eqno(16'\char`\')\]

+

275 \[\def\apostrophe{'} 3=3\eqno(16')\]

+
+0=0 +

Exercise 19.7: It is possible to insert the equation number in the formula. +What you can see here is that the spacing for two and three stars is the same: +Knuth says that converts binary star to type Ord, in the case of three +stars, the middle one is of type Ord.

+0=0(*,**,***,16´´^,31) +3=3(16 ' ) +

Exercise 19.8: Knuth says: if \hsize is less than 10000pt, then the natural +width of the equation will be too large. Tralics ignores the shrink part of +the glue. In the case of the HTML document, the +text will flush in the right margin (and the equation number will be far +away). We have replaced 10000 by 600, this should be big enough to see +something.

+

276 \[\quad x=y\hskip10000pt minus 1fill\eqno(5)\]

+
+x=y +
+Multi-line displays +

Exercise 19.9: The \eqalign feature of plain is not implemented; you can +use the align environment like here:

+T(n)T(2 lgn )c(3 lgn )-c(2 lgn )<3c·3 lgn =3cn lg3 . +

+Using aligned, you can get

+α=f(z)β=f(z 2 )γ=f(z 3 )x=α 2 -βy=2γ +

Exercise 19.10:

+P(x)=a 0 +a 1 x+a 2 x 2 ++a n x n ,P(-x)=a 0 -a 1 x+a 2 x 2 ++(-1) n a n x n . +

Currently, the following code does not work.

+

277 \begin{eqalignno}

+

278 (x+y)(x-y)&=x^2-xy+yx-y^2\\

+

279 &=x^2-y^2;&(4)\\

+

280 (x+y)^2&=x^2+2xy+y^2 ;

+

281 \end{eqalignno}

+

282 \begin{leqalignno}

+

283 (x+y)(x-y)&=x^2-xy+yx-y^2\\

+

284 &=x^2-y^2;&(4)\\

+

285 (x+y)^2&=x^2+2xy+y^2 .

+

286 \end{leqalignno}

+

The best we can do is using phantoms:

+

287 \def\xcenter#1#2#3{\phantom{#3}{#1#2#3}\phantom{#1}}

+

288 \[\xcenter{(x+y)(x-y)}{=}{x^2-xy+yx-y^2} \]

+

289 \[\xcenter{{}}{=}{x^2-y^2;}\label{192-0}\]

+

290 \[\xcenter{{(x+y)^2}}{=}{x^2+2xy+y^2 .}\label{192-5}\]

+
+x 2 -xy+yx-y 2 (x+y)(x-y)=x 2 -xy+yx-y 2 (x+y)(x-y) +x 2 -y 2 ;=x 2 -y 2 ; +x 2 +2xy+y 2 .(x+y) 2 =x 2 +2xy+y 2 .(x+y) 2 +

Exercise 19.12: First two equations use \leqno, +Equations () and () have a label.

+gcd(v,u);gcd(u,v)=gcd(v,u);gcd(u,v) +gcd(-u,v).gcd(u,v)=gcd(-u,v).gcd(u,v) +gcd(v,u);gcd(u,v)=gcd(v,u);gcd(u,v) +gcd(-u,v).gcd(u,v)=gcd(-u,v).gcd(u,v) +

Exercise 19.13: Note: Knuth has a small space before the first dx, this seems +unnecessary. Some operators are big by default in MathML, so that no \big +is required. However, there is a rule in Tralics that says that small +parentheses are used in f(x)dx, even when the integral has limits. +In this cases, this mechanism produces small parentheses. The remedy is to put +f(x) in a group; the size of the parentheses depend only on what is in +the group. In a case like (x 2 +y 2 ), large parentheses are used. If you want +small ones, you must use the \smash command, and you get +(x 2 +y 2 ). In the pdf version, the vertical bar is too small.

+

291 \[\xcenter{\left(\int_{-\infty}^{\infty}e^{-x^2}dx\right)^2}{=}

+

292 {\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(\smash{x^2+y^2})}dx\,dy}\]

+

293 \[\xcenter{}{=}{\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta}\]

+

294 \[\xcenter{}{=}{\int_0^{2\pi}{\left(-\frac{e^{-r^2}}{2}|

+

295         _{r=0}^{r=\infty}\right)}\,d\theta}\]

+

296 \[\xcenter{}{=}{\pi.}\label{e19.13}\]

+
+ - - e -(x 2 +y 2 ) dxdy - e -x 2 dx 2 = - - e -(x 2 +y 2 ) dxdy - e -x 2 dx 2 + 0 2π 0 e -r 2 rdrdθ= 0 2π 0 e -r 2 rdrdθ + 0 2π -e -r 2 2| r=0 r= dθ= 0 2π -e -r 2 2| r=0 r= dθ +π.=π. +

Exercise 19.14: Knuth explains that eqalign and eqalignno environments +are based on \halign, so that \noalign can be used. In environments +like gather, you can try \multicolumn. As you can see here, the word +`and' occurs at the left of the table, not at the left margin; this is the same +as what happens with \eqalign.

+x=y+zandx 2 =y 2 z 2 +

Exercise 19.16: This uses \gather. There are no equation numbers, because +\hfil, \hfill or \hfilneg are not allowed.

+xxifxythenyxifxyandyzthenxz. +
+Long formulas +

The long formula is

+σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1). +

It can be split as

+σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1). +

Exercise 19.17:

+x n u 1 ++x n+t-1 u t =x n u 1 +(ax n +c)u 2 ++(a t-1 x n +c(a t-2 ++1))u t =(u 1 +au 2 ++a t-1 u t )x n +h(u 1 ,...,u t ). +

Attempt to use multline for the long formula.

+σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1). +

Exercise 19.18:

+ 1jn 1 (x j -x 1 )...(x j -x j-1 )(x-x j )(x j -x j+1 )...(x j -x n )=1 (x-x 1 )...(x-x n ). +

Exercise 19.19: This is a silly expression. It is formed of A and B over C. +We show here the code of A, B and C, using the shorthands of Knuth. We redefine +locally the \\ command. The \Paren command puts +parentheses around the argument., the \Slash command produces a slash.

+

297 {

+

298 \def\\#1;{\noexpand\Paren{#1;q^2}_\infty}

+

299 \xdef\formA{q^{\frac 12 n(n+1)}\\ea;\\eq\noexpand\Slash a;}

+

300 \xdef\formB{\\caq\noexpand\Slash e;\\cq^2\!\noexpand\Slash ae;}

+

301 \xdef\formC{(e;q)_\infty(cq/e;q)_\infty}

+

302 }

+

The question is: What is the size of the parentheses? +In the case of f(x)dx some browsers show parentheses whose size are the +same as that of the current group; if nothing special is done, it includes the +integral sign and the bounds, this is wrong. For this reason, Tralics inserts some braces for opening and closing delimiters. If a group is created +for the parenthesis, it contains no big objects (e.g., something with +exponents). If possible, opening and closing parentheses are part of the same +group. The algorithm is not obvious: consider what should be done if x or +f(x) is replaced by its square. The following exercise is interesting. Note: +in the Pdf version, all formulas look the same, this is because parentheses +have fixed size. See also discussion after exercise 16.2: there are no +multiple scripts here.

+

We give here four +variants. In case one, there is no group, and the size of the parentheses is +given by the exponent of the q. Hence they are too big. Tralics tries to +compensate, but this does not work well, because of the index attached to +parenthesis; there are two parts (ea; and q 2 ) . +In the second case, we have added an empty group. In this case, +we have a group with (ea; followed by q 2 followed by a group with ) +followed by . This gives small parentheses. Variant three is +logically better: we put the parentheses in a group, so that its size depends +only on the content of the group; in this case Tralics leaves the formula +unchanged. If you feel that the parentheses are too big, you can reduce them: +variant four uses \smash.

+

A non trivial point is that the size of the slash character is also +variable. In the case where a group is used (variant 3 and 4), it size depends +on the q 2 that follows. Otherwise, when Tralics tries to insert a group, +in order to reduce the size of the parentheses, it uses a complicated +algorithm: when a group is created for the parentheses, it does not include +big objects. In particular, since each semi-colon is followed by q 2 , this +group cannot contain both parentheses. Expressions can be split after binary +operators or relations, in the case of a/b=c, only the equals sign is +considered. Understanding exactly where the expression is split is not +easy. Obviously, in the case when there are two q 2 in the expression, none +of them is in a group. Since the slash character is between these two +expressions, it is outside of the group, its size is affected by the exponent +of the first q. This gives a very big slash (in the case of the Pdf version, +only small characters are used).

+

One fundamental change in Tralics 2.10.8 concerns the case where a +superscript or subscript is attatched to a parenthesis. In this case, the +script is detached, the soliiting algorithme is called, and the script is +attached to what preceeds. An like (x)^2, will be converted into +(x){}^2, that can be converted into +(x){}^2, and after removal of the dummy group into +(x)^2.

+

303 \def\Paren#1{(#1)}

+

304 \def\Paren#1{(#1){}}

+

305 \def\Paren#1{{(#1)}}

+

306 \def\Paren#1{{(\smash{#1})}}

+

307 \def\Slash{/}

+

308 \[ \frac{\formA\formB}{\formC} \]

+

309 \[ \frac{\textstyle\formA\qquad \atop\hfill\textstyle\formB}{\formC} \]

+

The whole formula version 1

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

Version two

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

Version 3

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

Version 4

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

+The split formula

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

One trick in order to get a smaller slash: define \Slash to be a group +consisting of a slash (and something else, here a \kern of width minus 1pt). + +The whole formula version two

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

Version 4

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +

+The split formula, version 4

+q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q) +
+Higher Mathematics, TLC2 +

In this chapter we present examples from the companion, second +edition, chapter 8; the book is distributed with a CDrom containing all +examples. These examples are formed of two parts; black and blue, the blue +part contains material to be inserted before the +\begin{document}; whenever needed, we shall explain what these +commands are assumed to do, what they do, and how the feature might be +implemented. Unless stated otherwise, the black part is taken verbatim.

+Introduction to amslatex +

The following packages are defined for use with Tralics:

+ +

amsmath is the main package, it loads amstext, amsbsy, amsopn; Options +are sumlimits, nosumlimits, namelimits, nonamelimits, centertags, tbtags, +cmex10, and fleqn.

+
+

amsgen contains some useful commands (currently unused).

+
+

amstext defines the \text command, which is built-in in Tralics.

+
+

amsbsy loads amsgen. It provides \boldsymbol and \bm, which do +nothing in Tralics.

+
+

amsopn, no options. The package defines commands like \lim, that +are built-in in Tralics.

+
+

amscd, implementes commutative diagrams.

+
+

amsthm, not yet implemented (theorems are built-in in Tralics).

+
+

amsxtra, not yet implemented.

+
+

upref, not yet implemented.

+
+

amsfonts, not yet implemented; this package and the following recognize +options psamsfonts.

+
+

amssymb. The package defines 204 symbols, all of them implemented in the +Tralics kernel, except the following one, that are declared undefined by +the amsmath package: \vartriangle, \doublebarwedge, +\varpropto, \smallsmile, \smallfrown, \lvertneqq +\gvertneqq, \npreceq, \nsucceq, \varsubsetneq(q) +\varsupsetneq(q), \nsubseteqq, +\nsupseteqq, \(n)shortmid, \(n)shortparallel.

+
+

eufrak. The package defines family \Eufrak (this command is +\mathfrak in Tralics), this is assumed to use the font family `euf'. +The eufrak package is redundant if the amsfonts package is used.

+
+

eucal. +The package defines family \Euscript (this command is \mathcal in +Tralics), this is assumed to use the font family `eus'. +Accepts options `mathcal' and `mathscr' (this make \mathscr +equivalent to \mathcal.

+
+

All undefined math symbols are defined to be \ams@unimp, a command that +expands to an undefined command, the one defined here to produce a red X.

+

310 \def\UnimplementedOperator#1{\mathbox{mstyle}[color][red]{X}}

+
+Display and alignment structures for equations +

Source code for some formulas used below:

+

311 \begin{equation} (a+b)^2 = a^2+2ab+b^2\end{equation}

+

312 \[  \sin^2\eta+\cos^2\eta = 1  \]

+

313 \begin{equation} x^2 + y^2  =  z^2 \end{equation}

+

314 \begin{align} x^2 + y^2 &=  z^2 \\ x^3 + y^3 &<  z^3 \end{align}

+

315 \begin{eqnarray} x^2 + y^2 &=& z^2 \\ x^3 + y^3 &<& z^3 \end{eqnarray}

+

316 \begin{equation*}  n^2 + m^2 = k^2 \end{equation*}

+

317 \begin{equation} n^p +m^p \neq k^p  \qquad p > 2 \end{equation}

+

318 \begin{multline}  \tag{2}

+

319   \sum_{t \in \mathbf{T}} \int_a^t

+

320     \biggl\lbrace \int_a^t f(t - x)^2 \,

+

321             g(y)^2 \,dx \biggr\rbrace \,dy \\

+

322   = \sum_{t \notin \mathbf{T}} \int_t^a

+

323       \biggl\lbrace g(y)^2 \int_t^a

+

324         f(x)^2 \,dx \biggr\rbrace \,dy

+

325 \end{multline}

+

Example 8-2-1. This uses the `leqno' option of the amsmath package, +that is assumed to put equation numbers on the left. In Tralics, this will +set the attribute equation-number = `left' of the document element.

+

In Tralics, if a formula has no \label, no number +is associated to it. Here we have a formula using the equation +environment, or a displaymath formula enclosed in a \[, \] pair.

+(a+b) 2 =a 2 +2ab+b 2 +sin 2 η+cos 2 η=1 +

Example 8-2-2. This uses options `reqno' option of the amsmath package +(equations to the right), it puts +equation-number = `left' on the document element. It uses also +`fleqn', that sets flushed-equation = `true'; in , you must +define \mathindent, here to 1pc, as the distance between the left margin +and the formula; ignored by Tralics. Same formulas as above, with a label +added, in order to show the difference.

+(a+b) 2 =a 2 +2ab+b 2 +sin 2 η+cos 2 η=1 +

Example 8-2-3. The code was modified in order to add labels; you see three 3 +numbers; one per environment, equation, align, and eqnarray. Also text added +between the groups of equations. First environment is equation:

+x 2 +y 2 =z 2 +

Second environment is align:

+x 2 +y 2 =z 2 x 3 +y 3 <z 3 +

+Third environment is eqnarray:

+x 2 +y 2 =z 2 x 3 +y 3 <z 3 +

Note: amsmath adds a new complexity to how spaces are handled: spaces after +\\ are no more ignored. This mechanism is not implemented in +Tralics.

+

Example 8-2-4. We modified the examples by adding a label; you can see that +this produces an equation number for equation*, () +as well as equation, ().

+n 2 +m 2 =k 2 +n p +m p k p p>2 +

Example 8-2-5. Translation of \multline +is a table, elements are centered, except first, last, and lines using +\shoveleft or \shoveright. +No & +should be given; last line should not be terminated with \\.

+FirstlineofamultlineCenteredMiddlelineArightMiddleAnothercenteredMiddleYetanothercenteredMiddleAleftMiddleLastlineofthemultline +

Example 8-2-6. This is the default behavior for tags.

+ tT a t a t f (t-x) 2 g (y) 2 d xdy= tT t a g (y) 2 t a f (x) 2 d xdy(2) +

Same formulas, with \multlinegap set to zero. This has no effect in +Tralics

+ tT a t a t f (t-x) 2 g (y) 2 d xdy= tT t a g (y) 2 t a f (x) 2 d xdy(2) +

From now on, we redefine the \tag command via \tagasattribute; +the second equation with a tag gives:

+sin 2 η+cos 2 η=1 +

The magic is that this uses \formulaattribute, a command added in +Tralics 2.9.5 that adds an attribute pair to the formula; our style sheet +handles a formula with a tag in the same way as a formula with an id (after +converting the id into a tag). There are four commands of the form \XXattribute +that add an attribute to an element under construction: the math formula, the +math expression, the current row, the current cell. In these cases +\mathattribute cannot be used (it adds an attribute to the last element +created). It is not possible to use \XMLaddatt in math mode, and it is +not possible to use this command after a math formula in order to add an +attribute (If the token that follows a display math formula is not a +\par, then \noindent is inserted, thus, if this token is +\XMLaddatt, the current element is an empty paragraph). Example

+

326 \begin{align}

+

327 \formulaattribute{tag}{8-2-3}

+

328 \thismathattribute{background}{white}\tableattribute{color}{black}

+

329 \rowattribute{mathvariant}{bold} x^2 + y^2+100 &=  z^2 \\

+

330 \cellattribute{columnalign}{left}  x^3 + y^3+1 &<  z^3

+

331 \end{align}

+

Translation (bold attribute ignored in the Pdf version):

+x 2 +y 2 +100=z 2 x 3 +y 3 +1<z 3 +

332 \begin{equation} \begin{split} % 8-2-7

+

333  (a + b)^4

+

334    &= (a + b)^2 (a + b)^2      \\

+

335    &= (a^2 + 2ab + b^2)   (a^2 + 2ab + b^2)        \\

+

336    &= a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4

+

337  \end{split}\end{equation}

+

338 \begin{equation} \begin{split} % 8-2-8

+

339   (a + b)^3 &= (a + b) (a + b)^2        \\

+

340             &= (a + b)(a^2 + 2ab + b^2) \\

+

341             &= a^3 + 3a^2b + 3ab^2 + b^3

+

342  \end{split}\end{equation}

+

Example 8.2.7 Single equation on several lines with alignment

+(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +

Example 8.2.8. The companion explains that the amsmath +package can be loaded +with options `centertags' or `tbtags'. In the first case, tags centered with +the formula (left or right), in the second case, tags are on the first line +(on the left) or last line (on the right). By default, Tralics does +nothing, and in the case of `tbtags', it sets split-tags = `tb' on the +root element.

+(a+b) 3 =(a+b)(a+b) 2 =(a+b)(a 2 +2ab+b 2 )=a 3 +3a 2 b+3ab 2 +b 3 +

343 \newcommand\relphantom[1]{\mathrel{\phantom{#1}}}

+

344 \newcommand\ve{\varepsilon}  \newcommand\tve{t_{\varepsilon}}

+

345 \newcommand\vf{\varphi}      \newcommand\yvf{y_{\varphi}}

+

346 \newcommand\bfE{\mathbf{E}}

+

347  

+

348 \begin{equation} \begin{split}

+

349   f_{h, \ve}(x, y)

+

350     &= \ve \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve u)} \vf(x) \,du  \\

+

351     &= h \int L_{x, z} \vf(x) \rho_x(dz)                             \\

+

352     &\relphantom{=} {} + h \biggl[

+

353        \frac{1}{\tve}

+

354        \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds

+

355                - \tve \int L_{x, z} \vf(x) \rho_x(dz)      \biggr) + \\

+

356     &\relphantom{=} \phantom{{} + h \biggl[ }

+

357        \frac{1}{\tve}

+

358        \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds

+

359                - \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve s)}

+

360                                             \vf(x) \,ds    \biggr) \biggr]

+

361 \end{split} \end{equation}

+

Example 8-2-9

+f h,ϵ (x,y)=ϵE x,y 0 t ϵ L x,y φ (ϵu) φ(x)du=hL x,z φ(x)ρ x (dz)=+h[1 t ϵ E y 0 t ϵ L x,y x (s) φ (x) d s - t ϵ L x,z φ (x) ρ x (dz)+=+h[1 t ϵ E y 0 t ϵ L x,y x (s) φ (x) d s - E x,y 0 t ϵ L x,y φ (ϵs) φ (x) d s] +

362 \begin{gather}

+

363   (a + b)^2 = a^2 + 2ab + b^2          \\

+

364   (a + b) \cdot (a - b) = a^2 - b^2

+

365 \end{gather}

+

Example 8-2-10, equation groups without alignment.

+(a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2 +

366 \begin{gather}

+

367   D(a,r) \equiv \{ z \in \mathbf{C}   \colon |z - a| < r \}    \notag \\

+

368   \operatorname{seg} (a, r) \equiv    \{ z \in \mathbf{C} \colon

+

369       \Im z < \Im a, \ |z - a| < r \}    \\

+

370     C (E, \theta, r) \equiv    \bigcup_{e \in E} c (e, \theta, r)

+

371 \end{gather}

+

Example 8-2-11

+D(a,r){zC:|z-a|<r}seg(a,r){zC:z<a,|z-a|<r}C(E,θ,r) eE c(e,θ,r) +

372 \begin{align}

+

373   (a + b)^3  &= (a + b) (a + b)^2        \\

+

374              &= (a + b)(a^2 + 2ab + b^2) \\

+

375              &= a^3 + 3a^2b + 3ab^2 + b^3

+

376 \end{align}

+

377 \begin{align} x^2  + y^2 & = 1 \\ x  & = \sqrt{1-y^2}\end{align}

+

Example 8-2-12

+(a+b) 3 =(a+b)(a+b) 2 =(a+b)(a 2 +2ab+b 2 )=a 3 +3a 2 b+3ab 2 +b 3 +

+and

+x 2 +y 2 =1x=1-y 2 +

378 \begin{align}

+

379  \text{Compare } x^2 + y^2 &= 1 &  x^3 + y^3 &= 1 \\

+

380   x &= \sqrt   {1-y^2} & x &= \sqrt[3]{1-y^3}

+

381 \end{align}

+

382 \begin{align}

+

383 x&= y & X  &= Y  &a  &= b+c \\

+

384 x' &= y'& X' &= Y' &a' &= b\\

+

385  x + x' &= y + y'  &  X + X' &= Y + Y' & a'b &= c'b

+

386 \end{align}

+

Example 8-2-13. +This example has two column-pairs.

+Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3 +

+This example has three column-pairs.

+x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b +

387 \begin{flalign}  \text{Compare }

+

388   x^2 + y^2 &= 1               &  x^3 + y^3 &= 1               \\

+

389   x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}

+

390 \end{flalign}

+

391 \begin{flalign}

+

392     x    &= y      & X  &= Y  &      a  &= b+c               \\

+

393     x'   &= y'     & X' &= Y' &      a' &= b                 \\

+

394   x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b

+

395 \end{flalign}

+

Example 8-2-14 +This example has two column-pairs.

+Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3 +

+This example has three column-pairs.

+x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b +

396 \renewcommand\minalignsep{0pt}

+

397 \begin{align}    \text{Compare }

+

398   x^2 + y^2 &= 1               &  x^3 + y^3 &= 1              \\

+

399   x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}

+

400 \end{align}

+

401 \renewcommand\minalignsep{15pt}

+

402 \begin{flalign}

+

403     x    &= y      & X  &= Y  &      a  &= b+c              \\

+

404     x'   &= y'     & X' &= Y' &      a' &= b                \\

+

405   x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b

+

406 \end{flalign}

+

Example 8-2-15 +This example has two column-pairs.

+Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3 +

+This example has three column-pairs.

+x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b +

407 \renewcommand\minalignsep{2em}

+

408 \begin{align}

+

409   x      &= y      && \text{by hypothesis} \\

+

410       x' &= y'     && \text{by definition} \\

+

411   x + x' &= y + y' && \text{by Axiom 1}

+

412 \end{align}

+

Example 8-2-16

+x=ybyhypothesisx ' =y ' bydefinitionx+x ' =y+y ' byAxiom1 +

413 \begin{equation}

+

414 \begin{aligned}

+

415   x^2 + y^2  &= 1 \\ x &= \sqrt{1-y^2} \\ \text{and also }y &= \sqrt{1-x^2}

+

416 \end{aligned}               \qquad

+

417 \begin{gathered}

+

418  (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2

+

419 \end{gathered}      \end{equation}

+

Example 8-2-17

+x 2 +y 2 =1x=1-y 2 andalsoy=1-x 2 (a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2 +

420 \begin{equation}

+

421 \begin{aligned}[b]

+

422   x^2 + y^2  &= 1\\ x &= \sqrt{1-y^2}    \\ \text{and also }y &= \sqrt{1-x^2}

+

423 \end{aligned}               \qquad

+

424 \begin{gathered}[t]

+

425  (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2

+

426 \end{gathered}\end{equation}

+

Example 8-2-18 We should do something with the optional argument

+x 2 +y 2 =1x=1-y 2 andalsoy=1-x 2 (a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2 +

427 \newenvironment{rcase}{\left.\begin{aligned}} {\end{aligned}\right\rbrace}

+

428 \begin{equation*}

+

429   \begin{rcase}

+

430     B' &= -\partial\times E  \\  E' &=  \partial\times B - 4\pi j \,

+

431   \end{rcase}

+

432   \quad \text {Maxwell's equations}

+

433 \end{equation*}

+

434  

+

Example 8-2-19Translation/rendering of apostrophe not always correct

+B ' =-×EE ' =×B-4πjMaxwell'sequations +

435 \renewcommand\minalignsep{5pt}

+

436 \begin{equation} \begin{aligned}

+

437   V_j &= v_j &  X_i &= x_i - q_i x_j &      &= u_j + \sum_{i\ne j} q_i \\

+

438   V_i &= v_i - q_i v_j &  X_j &= x_j &  U_i &= u_i

+

439 \end{aligned} \end{equation}

+

Example 8-2-20

+V j =v j X i =x i -q i x j =u j + ij q i V i =v i -q i v j X j =x j U i =u i +

440 \begin{align}

+

441   A_1 &= N_0 (\lambda ; \Omega') -  \phi ( \lambda ; \Omega')   \\

+

442   A_2 &= \phi (\lambda ; \Omega') \phi (\lambda ; \Omega)     \\

+

443 \intertext{and finally}

+

444   A_3 &= \mathcal{N} (\lambda ; \omega)

+

445 \end{align}

+

Example 8-2-21

+A 1 =N 0 (λ;Ω ' )-ϕ(λ;Ω ' )A 2 =ϕ(λ;Ω ' )ϕ(λ;Ω)andfinallyA 3 =N(λ;ω) +

Example 8-2-22, 8-2-23, 8-2-24 explain that spacing around equations can be +wrong; we omit them.

+

446 \begin{align}

+

447   x^2+y^2 &= z^2 \label{eq:A}            \\

+

448   x^3+y^3 &= z^3 \notag                  \\

+

449   x^4+y^4 &= r^4 \tag{$*$}               \\

+

450   x^5+y^5 &= r^5 \tag*{$*$}              \\

+

451   x^6+y^6 &= r^6 \tag{\ref{eq:A}$'$}     \\

+

452       A_1 &= N_0 (\lambda ; \Omega')

+

453              - \phi ( \lambda ; \Omega') \\

+

454       A_2 &= \phi (\lambda ; \Omega')

+

455              \, \phi (\lambda ; \Omega)

+

456              \tag*{ALSO (\theequation)}  \\

+

457       A_3 &= \mathcal{N} (\lambda ; \omega)

+

458 \end{align}

+

Example 8-2-25. In the Companion, first equation is numbered (1), +second equation has no number, third is (*), then come *, +(1'), (2), ALSO (2) and (3). Since Tralics does not +compute equation numbers, you will not see (1), (2), (3). +Since (1') is obtained by a reference to the first equation, the whole +set of equations is numbered, namely (). It is currently impossible +to use a reference, we locally change \ref, so that it produces a +number, here 17. This is also the current value of the equation counter. +Hence, the full tag, concatenation of all four tags is +*,*,17x,ALSO (17); we have replaced the apostrophe by x, because +of a bug in current Tralics. This full tag is put on the math formula.

+

Note: the style sheet that converts XML to HTML attributes a number +to each equation that has a label, and \ref uses this number. If the +equation has a tag, no number should be attributed, and \ref should use +the tag. This might change.

+

Note: uses \text to format the tag, and as a +consequence, spaces are not ignored. In Tralics, nothing special is done, and +they are ignored. Should be fixed some day.

+x 2 +y 2 =z 2 x 3 +y 3 =z 3 x 4 +y 4 =r 4 x 5 +y 5 =r 5 x 6 +y 6 =r 6 A 1 =N 0 (λ;Ω ' )-ϕ(λ;Ω ' )A 2 =ϕ(λ;Ω ' )ϕ(λ;Ω)A 3 =N(λ;ω) +

Same example, with default behavior of \tag. Note that the equation +number is still the same. The equation has an another label, it is now +equation (17), but \ref is still defined to be 17.

+x 2 +y 2 =z 2 x 3 +y 3 =z 3 x 4 +y 4 =r 4 (*)x 5 +y 5 =r 5 *x 6 +y 6 =r 6 (17 ' )A 1 =N 0 (λ;Ω ' )-ϕ(λ;Ω ' )A 2 =ϕ(λ;Ω ' )ϕ(λ;Ω) ALSO (17)A 3 =N(λ;ω) +

459 \begin{equation}  \begin{split} \label{e-8-2-26}

+

460   \lvert I_2 \rvert  &=    \left\lvert \int_{0}^T \psi(t)

+

461       \left\{  u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}

+

462         (\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi

+

463       \right\} dt \right\rvert                                     \\

+

464                      &\le  C_6  \Biggl\lvert

+

465       \left\lvert f \int_\Omega \left\lvert

+

466           \widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)

+

467         \right\rvert \ \right\rvert

+

468       \left\lvert \lvert u \rvert

+

469         \overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)

+

470       \right\rvert              \Biggr\rvert

+

471 \end{split} \end{equation}

+

Example 8-2-26. The book explains that the tag is not correctly positioned. +We modified the example by adding a label, and this gives an equation number +in the HTML file. This number is vertically centered, whatever the size of +the formula.

+|I 2 |= 0 T ψ(t)u(a,t)- γ(t) a dθ k(θ,t) a θ c(ξ)u t (ξ,t)dξdtC 6 f Ω S ˜ a,- -1,0 W 2 (Ω,Γ l ) |u| W 2 A ˜ (Ω;Γ r ,T) +

Example 8-2-27. Equation () should be the same as +(); but in order to test our algorithm we have replaced some +\lvert and \rvert by \lVert and \rVert, that are the same +as \Vert, but declared as mathopen and mathclose symbols

+|I 2 |= 0 T ψ(t)u(a,t)- γ(t) a dθ k(θ,t) a θ c(ξ)u t (ξ,t)dξdtC 6 f Ω S ˜ a,- -1,0 W 2 (Ω,Γ l ) |u| W 2 A ˜ (Ω;Γ r ,T) +

472 \begin{gather}   \raisetag{-40pt}

+

473  \text{The sign function: \ } \mathcal{S}(x) =

+

474  \begin{cases}-1   &  x < 0 \\ 0   &  x = 0 \\ 1   &  x > 0\end{cases}

+

475 \end{gather}

+

Example 8-2-28, showing the command \raisetag. +It is defined as doing nothing in Tralics (the tag, i.e., the equation +number, is inserted by the style sheet that converts from XML to HTML.) +We have redefined here the command as follows

+

476 \def\raisetag#1{%

+

477 \dimen0=#1\relax

+

478 \ifdim\dimen0<0pt

+

479   \dimen0=-\dimen0

+

480    \formulaattribute{tag-down}{\the\dimen0}%

+

481 \else

+

482 \formulaattribute{tag-up}{\the\dimen0}\fi}

+

Thus \raisetag with a value of -10pt will add +tag-down = `10pt' to the formula element. In this case, the style sheet +adds style = `padding-top:10pt' to the cell containing the equation +number. In the case of a positive value, padding-bottom is used instead. +In this example, we use 40pt.

+Thesignfunction:S(x)=-1x<00x=01x>0 +

483 begin{subequations}  \label{eq:1}

+

484 \begin{align}  f  &= g            \label{eq:1A} \\

+

485                f' &= g'           \label{eq:1B} \\

+

486     \mathcal{L}f  &= \mathcal{L}g \label{eq:1C}

+

487 \end{align}

+

488 \end{subequations}

+

489 \begin{subequations}  \label{eq:2}

+

490 \renewcommand\theequation{\theparentequation\roman{equation}}

+

491 \begin{align}  f  &= g            \label{eq:2A} \\

+

492                f' &= g'           \label{eq:2B} \\

+

493     \mathcal{L}f  &= \mathcal{L}g + K  \label{eq:2C}

+

494 \end{align}

+

495 \end{subequations}

+

496 Note the relationship between~\eqref{eq:1}

+

497 and~\eqref{eq:2}: only~\ref{eq:1C} and~\ref{eq:2C} differ.

+

Example 8-2-29: the amsmath package provides a subequations environment +to support “equation subnumbering” with tags of the form (2a), (2b), (2c), +and so on. All the tagged equations within it use this sub-numbering scheme +based on two normal counters parentequation and equation. +First group, with only labels eq:1 and eq1:C

+f=gf ' =g ' Lf=Lg +

+ +The Tralics implementation is trivial: the environment does nothing. +Thus, the \label command in the subequations corresponds to the +current section. Second group, with only labels eq:2 and eq2:C.

+f=gf ' =g ' Lf=Lg+K +

+ +We have removed two \labels from the align, +because it produces a single equation number and accepts a single label. +Thus, the text after the equations reads: +Note the relationship between () +and (): only  and  differ.

+
+Matrix-like environments +

498 \begin{equation}    P_{r - j} =

+

499  \begin{cases}

+

500     0   &  \text{if $r - j$ is odd,} \\

+

501     r! \, (-1)^{(r - j)/2}

+

502         &  \text{if $r - j$ is even.}

+

503  \end{cases}                \end{equation}

+

Example 8-3-1

+P r-j =0ifr-jisodd,r!(-1) (r-j)/2 ifr-jiseven. +

504 \begin{gather*}

+

505   \begin{matrix}  0 &  1 \\ 1 &  0 \end{matrix}  \quad

+

506   \begin{pmatrix} 0 & -i \\ i &  0 \end{pmatrix} \\

+

507   \begin{bmatrix} 0 & -1 \\ 1 &  0 \end{bmatrix} \quad

+

508   \begin{Bmatrix} 1 &  0 \\ 0 & -1 \end{Bmatrix} \\

+

509   \begin{vmatrix} a &  b \\ c &  d \end{vmatrix} \quad

+

510   \begin{Vmatrix} i &  0 \\ 0 & -i \end{Vmatrix}

+

511 \end{gather*}

+

Example 8-3-2, using a single equationThe delimiter for Vmatrix is +badly rendered by Amaya

+01100-ii00-110100-1abcdi00-i +

512 \newcommand\hdotsfor[2][x]{\multicolumn{5}{c}{.\ .\ .\ .\ .\ .\ .\ .\ .}}

+

513 \setcounter{MaxMatrixCols}{20}

+

514 \[

+

515  \begin{Vmatrix}

+

516   \,a&b&c&d&e&f&g&h&i&j &\cdots\,{} \\

+

517      &a&b&c&d&e&f&g&h&i &\cdots\,{} \\

+

518      & &a&b&c&d&e&f&g&h &\cdots\,{} \\

+

519      & & &a&b&c&d&e&f&g &\cdots\,{} \\

+

520      & & & &\ddots&\ddots&\hdotsfor[2]{5}%\,{}

+

521  \end{Vmatrix} \]

+

Example 8-3-3. +The example uses \hdotsfor, a command equivalent to +\multicolumn{5}{c}{leaders}. Leaders cannot be +implemented in MathML, so that the command is redefined in this case.

+abcdefghijabcdefghiabcdefghabcdefg......... +

In the example above, there was a \,{} at the end of each +line. We had to remove it on the last line, because Tralics complains if a +cell contains \multicolumns and additional commands. The following +example is refused by Tralics; but is happy with it, but x is typeset +outside math mode. Thus the question: what is the exact effect of the last +\,{} in the case?

+

522 $\begin{array}{ccc}

+

523 111&222&333\\

+

524 \hdotsfor{2}x&t\\

+

525 \end{array}$

+

Example 8-3-4. This example uses the environment smallmatrix, which is +defined by Tralics to be the same as matrix, i.e., a matrix without +delimiters, 100-1 +the same with \left and \right parentheses +100-1. +There is some text after the matrix. It happens that matrices in text style +are badly rendered by Firefox. There is a huge amount of white space on the +left of each column.

+

526 \begin{gather}

+

527   \sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i, j) \\

+

528   \sum_{\begin{subarray}{l}  i \in \Lambda   \\

+

529                              0 \le i \le m   \\

+

530                              0 < j < n

+

531         \end{subarray}}  P(i, j)

+

532 \end{gather}

+

Example 8-3-5. The style of the subarray should be smaller

+ 0im0<j<n P(i,j) iΛ0im0<j<n P(i,j) +

533 \DeclareMathOperator\add{add}

+

534 \DeclareMathOperator\cf {cf}

+

535 \DeclareMathOperator\cov{cov}

+

536 \DeclareMathOperator\non{non}

+

537 \DeclareMathOperator\End{End}

+

538 \[ \begin{CD}

+

539      \cov (L) @>>> \non (K) @>>> \cf (K)  \\

+

540        @VVV          @AAA          @AAA   \\

+

541      \add (L) @>>> \add (K) @>>> \cov (K) \\

+

542    \end{CD} \]

+

Example 8-3-6. You must be careful with the CD environment, because the +at-sign is an active character, that reads some text, depending on the +character that follows; more examples are given below.

+cov(L) non(K) cf(K)add(L) add(K) cov(K) +

543 \[ \begin{CD}

+

544      S^{W_\Lambda}\otimes T @>j>>      T       \\

+

545       @VVV                        @VV{\End P}V \\

+

546     (S \otimes T)/I         @=   (Z\otimes T)/J

+

547    \end{CD} \]

+

Example 8-3-7

+S W Λ T jTEndPEndP(ST)/I=(ZT)/J +

Example 8-3-8. This uses \longrightarrow, that produces character +U+27F9, unknown to FM.

+S W Λ T jTEndPEndP(ST)/I=(ZT)/J +

548 \[ \mathcal{Q} =

+

549 \begin{delarray}[t] ( {cc} ) X & Y \end{delarray}

+

550 \begin{delarray}[t] [ {cc} ] A & B \\ C & D   \end{delarray}

+

551 \begin{delarray}[b] \lgroup{cc}\rgroup L \\ M \end{delarray}

+

552 \]

+

Example 8-3-9. This example uses the delarray package that changes +the meaning of the array environment. In the current version of Tralics, +there is no \array command, hence no possibility to redefine it. +The delarray.plt file defines a delarray environment that is +used here.

+Q=XYABCDLM +
+Compound structures and decorations +

553 \[   0 \xleftarrow [\zeta]{}  F \times \Delta (n - 1)

+

554      \xrightarrow {\partial_0 \alpha(b)} E^{\partial_0 b}\]

+

Example 8-4-1

+0 ζF×Δ(n-1) 0 α(b)E 0 b +

555 \begin{equation*}

+

556 \cfrac {1}{\sqrt{2} +

+

557  \cfrac {1}{\sqrt{3} +

+

558   \cfrac {1}{\sqrt{4} +

+

559    \cfrac[r] {1}{\sqrt{5} +

+

560     \cfrac[l] {1}{\sqrt{6} + \dotsb }

+

561    }}}}

+

562 \end{equation*}

+

Example 8-4-2

+1 2+1 3+1 4+1 5+1 6+ +

563 \begin{equation} \boxed { W_t - F \subseteq V(P_i) \subseteq W_t }\end{equation}

+

Example 8-4-3

+W t -FV(P i )W t +

564 \[  \sum_{i=1}^n \qquad \int_0^\infty \qquad \lim_{n \to 0} \]

+

565 Text: $\sum_{i=1}^n$, $\int_0^\infty$, $\lim_{n \to 0}$.

+

Example 8-4-4

+ i=1 n 0 lim n0 +

Text: i=1 n , 0 , lim n0 .

+

566 \[

+

567    \sum\nolimits_{i=1}^n \qquad \int\limits_0^\infty

+

568    \qquad  \lim\displaylimits_{n \to 0}

+

569 \]

+

570 Text: $\sum\nolimits_{i=1}^n$, $\int\limits_0^\infty$,

+

571 $\lim\displaylimits_{n \to 0}$.

+

Example 8-4-5 (limits placement is wrong in the Pdf version, text style).

+ i=1 n 0 lim n0 +

Text: i=1 n , 0 , +lim n0 .

+

572 \begin{gather*}

+

573  \xiint     \limits _V \mu(v,w)   \,du \,dv  \quad

+

574  \xiiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \quad

+

575  \xiiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw  \\

+

576  \idotsint \limits _V \mu(z_1, \dots, z_k)   \,\mathbf{dz}\\

+

577  \iint     \limits _V \mu(v,w)   \,du \,dv \qquad

+

578  \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad

+

579  \iiiint   \limits _V \mu(t,u,v,w)    \,dt \,du \,dv \,dw  \\ \textstyle

+

580  \iint     \limits _V \mu(v,w)   \,du \,dv \qquad

+

581  \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad

+

582  \iiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw

+

583 \end{gather*}

+

Example 8-4-6. Modified, using \xiint, \xiiint, \xiiiint +command that produce Unicode character U+222c, U+222D and U+2A0C, +or simple integrals.

+ V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw... V μ(z 1 ,,z k )dz V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw +

584 \begin{align*}

+

585   u & \equiv v + 1 \mod{n^2}  \\

+

586   u & \equiv v + 1 \bmod{n^2} \\

+

587   u &   =    v + 1 \pmod{n^2} \\

+

588   u &   =    v + 1 \pod{n^2}

+

589 \end{align*}

+

590 The in-text layout: $ u = v + 1 \pmod{n^2} $

+

591 \begin{gather*}

+

592    (m \bmod n) = k^2 \, ; \quad

+

593   x \equiv y \pmod b \, ;     \\

+

594   x \equiv y \mod c \, ;  \quad

+

595   x \equiv y \pod d\, .

+

596 \end{gather*}

+

Example 8-4-7

+uv+1modn 2 uv+1modn 2 u=v+1(modn 2 )u=v+1(n 2 ) +

+The in-text layout: u=v+1(modn 2 )

+(mmodn)=k 2 ;xy(modb);xymodc;xy(d). +

597 \begin{equation} \frac{1}{k} \log_2 c(f)

+

598           \quad \tfrac{1}{k} \log_2 c(f) \end{equation}

+

599 Text: $ \sqrt{ \frac{1}{k} \log_2 c(f) } \quad

+

600         \sqrt{ \dfrac{1}{k} \log_2 c(f) }\, $.

+

Example 8-4-8

+1 klog 2 c(f)1 klog 2 c(f) +

Text: 1 klog 2 c(f)1 klog 2 c(f).

+

601 \begin{equation} \binom{k}{2} 2^{k - 1}

+

602           + \tbinom{k - 1}{2} 2^{k - 2} \end{equation}

+

603 Text: $ \binom{k}{2} 2^{k - 1} + \dbinom{k - 1}{2} 2^{k - 2} $.

+

604 $ \dot{S} \quad \ddot{P} \quad \dddot{Q} \quad \ddddot{R} $

+

Example 8-4-9

+k 22 k-1 +k-1 22 k-2 +

Text: k 22 k-1 +k-1 22 k-2 .

+

Example 8-4-10: Four dots above: character unknown by FM. +S ˙P ¨Q R

+

605 \[ \accentset{\ast}{X}                 \quad

+

606    \hat{\accentset{\star}{\hat h}}     \quad

+

607    \underaccent{\diamond}{\mathcal{M}} \quad

+

608    \undertilde{C}\quad\undertilde{M}\quad\undertilde{ABC} \]

+

Example 8-4-11. Commands \accentset and \underaccent +are defined in the amsmath.plt file, they produce a <munder> or +<mover> element, with attribute accent or mathaccent set to true. +Note that accents might be too big.

+X *h ^ ^M C ˜M ˜ABC ˜ +

609 $(xyz)\spdddot$ \quad $(xyz)\spddot$ \quad $(xyz)\spdot$

+

610 $(xyz)\spbreve$ \quad $(xyz)\spcheck$

+

611 $(xyz)\sphat$   \quad $(xyz)\sptilde$

+

Example 8-4-12. (breve and hat are invisible on Firefox, too high on Amaya). +(xyz) ...    (xyz) ..    (xyz) .    (xyz) ˘    (xyz)    (xyz) ^    (xyz)

+

612 \[ \overset{*}{X} > \underset{*}{X}

+

613      \iff \sideset{}{'}\sum_{a,b \in \mathbf{R^*}}

+

614                        \overset{a}{\underset{b}{X}} = X \]

+

Example 8-4-13. Commands \overset and \underset +are defined in the amsmath.plt file, they produce a <munder> or +<mover> element.

+X *>X *' a,bR * X b a=X +

615 \[ \sideset{_{i = 1}^n}{_{j = 2}^m}\prod_{k > 1}  \mathcal{T}_{i, j}^k \]

+

Example 8-4-14.

+j=2mi=1n k>1 T i,j k +
+Variable symbol commands +

616 A series $H_1, H_2, \dots, H_n$, a sum

+

617 $H_1 + H_2 + \dots + H_n$, an orthogonal product

+

618 $H_1 \times H_2 \times \dots \times H_n$.

+

619 A series $H_1, H_2, \dotsc\,$, a sum

+

620 $H_1 + H_2 + \dotsb\,$, an orthogonal product

+

621 $H_1 \times H_2 \times \dotsm\,$, and an infinite

+

622 integral:   \[ \int_{H_1} \int_{H_2} \dotsi \;  {-\Gamma}\, d\Theta \]

+

Example 8-5-1. +A series H 1 ,H 2 ,,H n , a sum +H 1 +H 2 ++H n , an orthogonal product +H 1 ×H 2 ××H n .

+

Example 8-5-2. +A series H 1 ,H 2 ,, a sum +H 1 +H 2 +, an orthogonal product +H 1 ×H 2 ×, and an infinite +integral:

+ H 1 H 2 -ΓdΘ +

623 \begin{align*}

+

624 \widehat  {\psi_\delta(t) E_t h} &= \widetilde   {\psi_\delta(t) E_t h}    \\

+

625 \overline  {\psi_\delta(t) E_t h}&= \underline   {\psi_\delta(t) E_t h}    \\

+

626 \overbrace      {\psi_\delta(t) E_t h}&= \underbrace  {\psi_\delta(t) E_t h}

+

627 & & \text{Do not change style}            \\

+

628 \overrightarrow {\psi_\delta(t) E_t h}&= \overleftarrow {\psi_\delta(t) E_t h}

+

629 & &   \text{Do not change style}     \\[-3pt]

+

630 & & & \text{without \textsf{amsmath}}     \\

+

631 \underrightarrow  {\psi_\delta(t) E_t h}

+

632 &= \underleftarrow  {\psi_\delta(t) E_t h}

+

633 & & \text{Do need \textsf{amsmath}}       \\

+

634 \overleftrightarrow {\psi_\delta(t) E_t h}

+

635 &=\underleftrightarrow{\psi_\delta(t) E_t h}

+

636 & & \text{Do need \textsf{amsmath}}

+

637 \end{align*}

+

Example 8-5-3

+ψ δ (t)E t h ^=ψ δ (t)E t h ˜ψ δ (t)E t h =ψ δ (t)E t h _ψ δ (t)E t h =ψ δ (t)E t h Donotchangestyleψ δ (t)E t h =ψ δ (t)E t h Donotchangestylewithoutamsmathψ δ (t)E t h =ψ δ (t)E t h Doneedamsmathψ δ (t)E t h =ψ δ (t)E t h Doneedamsmath +

638 \[   \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 +

+

639       \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 + x}}}}}} \]

+

Example 8-5-4

+1+1+1+1+1+1+x +Vertically extensible symbols +(() +( ) +{(} +\{ \} +( +\lVert \rVert +( +\langle \rangle +{(} +\lbrace \rbrace +|(| +\lvert \rvert +( +\lgroup \rgroup +[(] +[ ] +|( +| +( +\lmoustache \rmoustache +[(] +\lbrack \rbrack +|( +\vert +( +\Downarrow +( +\lceil \rceil +|( +\arrowvert +( +\Uparrow +( +\lfloor \rfloor +|( +\bracevert +( +\Updownarrow +( +\llbracket \rrbracket +( +\Arrowvert +( +\downarrow +/( +/ +( +\| +( +\uparrow +( +\backslash +( +\Vert +( +\updownarrow +( +. +( +\sqrtsign +
+
+Words in mathematics +Predefined operators and functions +arccos +\arccos +varcsin +\arcsin +arctan +\arctan +arg +\arg +cos +\cos +cosh +\cosh +cot +\cot +coth +\coth + +csc +\csc +deg +\deg +det +\det +dim +\dim + +exp +\exp +gcd +\gcd +hom +\hom +inf +\inf + +inj lim +\injlim +ker +\ker +lg +\lg +lim +\lim + +lim inf +\liminf +lim sup +\limsup +ln +\ln +log +\log + +max +\max +min +\min +Pr +\Pr +proj lim +\projlim + +sec +\sec +sin +\sin +sinh +\sinh +sup +\sup + +tan +\tan +tanh +\tanh +lim +\varinjlim +lim _ +\varliminf + +lim +\varlimsup +lim +\varprojlim +
+

640 \begin{gather}

+

641   \text{Also, if } \Delta_{\text{max up}}

+

642            = \Delta_{\text{min down}} \notag \\

+

643   \text{(for all ups and downs) then} \notag \\

+

644   \Delta_{\text{sum of ups}}

+

645            = \Delta_{\text{sum of downs}}

+

646 \end{gather}

+

Example 8-6-1

+Also,ifΔ maxup =Δ mindown (forallupsanddowns)thenΔ sumofups =Δ sumofdowns +

647 \newcommand\abs[1]{\lvert#1\rvert}

+

648 \setlength\mathindent{0pt}

+

649 \begin{gather*}

+

650   \lim_{x \rightarrow 0} \frac{ \sin^2(x) }{ x^2 } = 1 \\

+

651   \varliminf_{n \rightarrow \infty}

+

652     \abs{a_{n+1}} / \abs{a_n} = 0                      \\

+

653  %{ JG

+

654  \varinjlim (m_i^\lambda \cdot M)^*

+

655   %} JG

+

656 \le \varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0

+

657 \end{gather*}

+

Example 8-6-2. Braces uncommented out for the last equation.

+lim x0 sin 2 (x) x 2 =1lim _ n |a n+1 |/|a n |=0lim (m i λ ·M) * lim A/pλ(A) A p 0lim (m i λ ·M) * lim A/pλ(A) A p 0 +

658 \let\abs\relax

+

659 \DeclareMathOperator \meas    {meas}

+

660 \DeclareMathOperator*\esssup  {ess \, sup}

+

661 \DeclareMathOperator*\supminus{sup - minus*}

+

662 \newcommand\abs [1]{\lvert#1\rvert}

+

663 \newcommand\norm[1]{\lVert#1\rVert}

+

664 \begin{gather*}

+

665   \norm{f}_\infty = \esssup_{x \in R^n} \abs{f(x)}  \\

+

666   \norm{f}_\infty = \smash{\esssup_{x \in R^n}} \abs{f(x)}  \\

+

667   \meas_1 \{ u \in R_+^1 \colon f^*(u)>\alpha \} =

+

668    \esssup_{x \in R^i} \; \meas_i

+

669      \{ u \in R^n \colon \abs{f(u)} \geq \alpha \}  \\

+

670   \quad (\forall \alpha \in \supminus_{f^*} R_{*+})

+

671 \end{gather*}

+

Example 8-6-3. We removed the line break between equations 2 and 3. Note that +an asterisk is printed as a normal character. Note the use of the \smash +command:

+f =ess sup xR n |f(x)|f =ess sup xR n |f(x)|meas 1 {uR + 1 :f * (u)>α}=ess sup xR i meas i {uR n :|f(u)|α}(αsup-minus* f * R *+ ) +

672 \[\varlimsup_{n\to\infty}\calQ (u_n, u_n - u^{\#}) \ge \csc (\calQ' (u^{\#})) \]

+

Example 8-6-4

+lim n Q(u n ,u n -u # )cosec(Q ' (u # )) +
+Fine tuning the mathematical layout +

673 \let\LB\relax\let\RB\relax\let\DS\relax

+

674 \def\Test{

+

675    b                       %% D

+

676     ^0                     %% S

+

677    +                       %% D

+

678    \frac{\LB(k + p)        %% T

+

679           _{j'}\RB         %% S'

+

680          \DS% \displaystyle

+

681          \pm               %% T  [D]

+

682          \frac{(f + q)     %% S  [T]

+

683                 ^{(pk)     %% SS [S]

+

684                    ^y      %% SS

+

685                    _{j'}}} %% SS'

+

686               {(h + y)}}   %% S' [T']

+

687         {(l + q)           %% T'

+

688           ^{(pk)}}         %% S'

+

689 }

+

690 \[\Test\qquad \let\LB={ \let \RB=} \Test \]

+

Example 8-7-1. Original version, plus version with braces added.

+b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) +

Example 8-7-2. Same, with \DS replaced by \displaystyle

+b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) +

691 \[ \biggl( \mathbf{E}_{y} \int_0^{t_\varepsilon}

+

692    L_{x, y^x(s)} \varphi(x)\, ds \biggr) \]

+

Example 8-7-3. This demonstrates that commands like \Large do affect the +size delimiters as \biggl. In Tralics, translation of math formulas is +unaffected by font size commands. Thus, second part of example omitted.

+E y 0 t ϵ L x,y x (s) φ (x) d s +

693 \[

+

694    \sqrt[\beta]{k} \qquad

+

695    \sqrt[\leftroot{2}\uproot{4} \beta]{k} \qquad

+

696    \sqrt[\leftroot{1}\uproot{3} \beta]{k}

+

697 \]

+

Example 8-7-4 Commands \leftroot and \uproot implemented as no-op.

+k βk βk β +

698 $\sqrt{x} + \sqrt{y}            + \sqrt{z}$,

+

699 $\sqrt{x} + \sqrt{\mathstrut y} + \sqrt{z}$,

+

700 $\sqrt{x} + \sqrt{\smash{y}}    + \sqrt{z}$,

+

701 $\sqrt{x} + \sqrt{\smash[b]{y}} + \sqrt{z}$

+

Example 8-7-5, explaining smash. +x+y+z, +x+(y+z, +x+y+z, +x+y+z

+

More uses of smash (top, bottom, all):

+x+1 2+z,x+1 2+z,x+1 2+z,x+1 2+z. +

702 \[

+

703   f_p (x) =

+

704   \begin{cases}

+

705     \frac{1}{\smash[b]{p}}                & x = p  \\

+

706     \frac{\strut

+

707           \smash[t]{\frac{(1 - x)^{\frac{1}{2}} }

+

708                          { x - \sin (x - p)     } } }

+

709          {\sqrt{1 - p} \, \cos (x - p)}   & x \neq p

+

710   \end{cases}

+

711 \]

+

Example 8-7-6. The \strut above needed by amsmath, see TLC2.

+f p (x)=1 px=p((1-x) 1 2 x-sin(x-p) 1-pcos(x-p)xp +

712 \[

+

713    \sqrt{ \frac{a+b}{x_j} }           \quad

+

714    \sqrt{ \frac{a+b}{\smash{x_j}} }   \quad

+

715    \sqrt{ \frac{a+b}{{}\smash{x_j}} } \quad

+

716    \sqrt{ \frac{a+b}{\smash{x_j+b}} }

+

717 \]

+

Example 8-7-7. The empty group above needed by amsmath, see TLC2.

+a+b x j a+b x j a+b x j a+b x j +b +
+Fonts in formulas +

718 $ \forall n \in \mathbb{N} : \mathfrak{M}_n \leq \mathfrak{A} $

+

719 \DeclareMathAlphabet\mathbb{U}{fplmbb}{m}{n}

+

720 $ \lbrace n,m \in \mathbb{N} \mid  \mathfrak{N}_{n,m} \rbrace $

+

721 \DeclareMathAlphabet\mathscr{T1}{hlcw}{m}{it}

+

722 $A_B \neq \mathscr{A}_\mathscr{B} \neq \mathcal{A}_\mathcal{B}$

+

Example 8-8-1 +nN:M n A

+

Example 8-8-2 + +{n,mNN n,m }

+

Example 8-8-3 +The \DeclareMathAlphabet command takes five arguments and defines the +first one to be \relax. + +A B A B A B

+

723 \newcommand\bfB{\mathbf{B}}   \newcommand\bfx{\mathbf{x}}

+

724 \bmdefine\bpi{\pi}            \bmdefine\binfty{\infty}

+

725 \section{The bold equivalence

+

726   $\sum_{j < B} \prod_\lambda : \bm{\sum_{x_j} \prod_\lambda}$}

+

727 \begin{gather}

+

728   B_\infty + \pi B_1 \sim  \bfB_{\binfty} \bm{+}\bpi \bfB_{\bm{1}}

+

729     \bm {\sim B_\infty + \pi B_1}                                   \\

+

730   B_\binfty + \bpi B_{\bm{1}} \bm{\in} \bm{\biggl\lbrace}

+

731     (\bfB, \bfx) : \frac {\partial \bfB}{\partial \bfx}

+

732     \bm{\lnapprox} \bm{1} \bm{\biggr\rbrace}

+

733 \end{gather}

+

Example 8-8-4. Currently \bndefine is \def and \bm is \mathbf.

+
+The bold equivalence + j<B λ : x j λ +B +πB 1 B +πB 1 B +πB 1 B +πB 1 (B,x) : B x 1 +

Example 8-8-5: same code different packages

+

734 $\bm{\Biggl\lbrace\biggl\lbrace\Bigl\lbrace\bigl\lbrace \lbrace

+

735      \mathcal{Q}

+

736      \rangle \bigr\rangle\Bigr\rangle\biggr\rangle\Biggr\rangle}$

+

Example 8-8-6 +{ Q

+

Example 8-8-7: same code different packages.

+

737 $ \bm{\sqrt[2]{x \times \alpha}} $  but

+

738 $\let\unboldmath\relax

+

739  \bm{\sqrt[2]{x \mathbin{\mbox{\unboldmath$\times$}} \alpha}} $

+

740   or the similar

+

741 \def\sqrtsign{\sqrt{}}

+

742 $ \bm{\sqrtsign}{\bm{x} \times \bm{\alpha}} $

+

743 %% $\bf \sqrt \it {\bf x \IT \times \bf \alpha \IT } $ see below A

+

744 %% $\bf {\sqrt} \it {\bf {x} \IT \times \bf {\alpha} \IT } $ see below B

+

Example 8-8-8. Second formula modified: you cannot use \unboldmath. Third +formula: the command \sqrtsign is identical to \sqrt; you may wonder +what the argument is. Currently \bm is the same as \mathbf, it takes +one argument and typesets it in bold face font. Hence, Tralics executes the +line shown above, marked `see below A'. Here \bf and \it are the +tokens inserted by the \bm command corresponding to the new and old font +(in reality, these tokens have complicated names). +Thus, the argument of \sqrt is the \it +command. Note that the \sqrt command uses a local group (is this good +idea?), so that the \it command changes font locally; said otherwise, +current font remains bold, and \IT is \bf. It is a wonder that this +works. We noticed that font change commands like \mathbf typeset +their arguments in a group, and modified the Tralics code; thus the +equivalent of line marked `see below B' is executed. Suddenly \sqrt +looses its argument. For this reason, we changed the command \sqrtsign +to \sqrt{}. The example is +x×α 2 but +x×α 2 +or the similar +x×α

+

745 \bmdefine\bhat{\hat}

+

746 % This does not work

+

747 %$\hat a \neq \bm{\hat a} \neq \bm{\hat a} = \bhat a \neq \bm{\widehat a}$

+

748 $\hat a \neq \bm{\hat a} \neq \bm\hat a = \bhat a \neq \bm\widehat a$

+

Example 8-8-9 modified + +a ^a ^a ^=a ^a ^

+

749 \section{Sample page of mathematical typesetting}

+

750  

+

751 First some large operators

+

752 both in text: \( \iiint\limits_{\mathcal{Q}}

+

753 f(x,y,z)\,dx\,dy\,dz \) and

+

754 \(\prod_{\gamma\in\Gamma_{\widetilde{C}}}

+

755 \partial(\widetilde{X}_\gamma)\); and also on display:

+

756  

+

757 \begin{equation}

+

758 \begin{split}

+

759 %%     This line is deliberately long so as to show

+

760 %%     differences in widths; it is a little over the measure

+

761 %%     in article/cmr.

+

762 \iiiint\limits_{\mathbf{Q}} f(w,x,y,z)\,dw\,dx\,dy\,dz  &\leq

+

763 \oint_{\bm{\partial Q}} f' \left( \max \left\lbrace

+

764 \frac{\lVert w \rVert}{\lvert w^2 + x^2 \rvert} ;

+

765 \frac{\lVert z \rVert}{\lvert y^2 + z^2 \rvert} ;

+

766 \frac{\lVert w \oplus z \rVert}{\lVert x \oplus y \rVert}

+

767 \right\rbrace\right)

+

768 \\

+

769 &\precapprox \biguplus_{\mathbb{Q} \Subset \bar{\mathbf{Q}}}

+

770 \left[ f^{\ast} \left(

+

771     \frac{\left\lmoustache\mathbb{Q}(t)\right\rmoustache}

+

772          {\sqrt {1 - t^2}}

+

773     \right)\right]_{t=\alpha}^{t=\vartheta}

+

774 \\

+

775 \end{split}

+

776 \end{equation}

+

777  

+

778 For $x$ in the open interval \( \left] -1, 1 \right[ \)

+

779 the infinite sum in Equation~\eqref{eq:binom1} is convergent;

+

780 however, this does not hold

+

781 throughout the closed interval \( \left[ -1, 1 \right] \).

+

782 \begin{align}

+

783   (1 - x)^{-k} &=

+

784     1 + \sum_{j=1}^{\infty} (-1)^j \ibinom{k}{j} x^j

+

785     \quad \text{ for } k \in \mathbb{N}; k \neq 0.

+

786     \label{eq:binom1}

+

787 \end{align}

+

Example 8-8-10. Changed a little bit: it is currently not possible to put a +\quad in a \text in math mode. Thus, the \text contains only +the word `for'.

+
+Sample page of mathematical typesetting +

First some large operators +both in text: Q f(x,y,z)dxdydz and + γΓ C ˜ (X ˜ γ ); and also on display:

+ Q f(w,x,y,z)dwdxdydz Q f ' maxw |w 2 +x 2 |;z |y 2 +z 2 |;wz xy QQ f * Q(t) 1-t 2 t=α t=ϑ +

For x in the open interval -1,1 +the infinite sum in Equation () is convergent; +however, this does not hold +throughout the closed interval -1,1.

+(1-x) -k =1+ j=1 (-1) j k jx j forkN;k0. +

Other examples here omitted.

+
+Symbols in formulas +

788 \[ a          \#          \top _x^\alpha x^\alpha_b \]

+

789 \[ a \mathrel{\#} \mathop{\top}_x^\alpha x^\alpha_b \]

+

790 \thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu

+

791 \[ a  -  b  =  -\max \{ x , y \}\]

+

Example 8-9-1. In this example, \# and \top are changed into a +Rel and a Op operator, so that <msub> or <mover> is used in the +translation, but in the current version of Tralics, +no information is attached to the symbol.

+a# x α x b α +a# x α x b α +

Example 8-9-2. This example demonstrates that spacing in math formulas depend +on three registers that the user can change, but the value is ignored by +Tralics.

+a-b=-max{x,y} +

Example 8-9-3. This demonstrates that different spacing is used for +\bigl/\bigr or \left/\right. Tralics tries very hard to +convert big open/close pairs to left-right ones.

+

792 \thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu

+

793 \[ a \Bigl( \sum x \Bigr) \neq  a \left( \sum x \right) \]

+
+a xax +

794 \DeclareMathSymbol\bneg   {\mathbin}{symbols}{"3A}

+

795 \DeclareMathSymbol\rsquare{\mathrel}{AMSa}{"03}

+

796 \[ a \neg b           \qquad  x \square           y + z \]

+

797 \[ a \mathbin{\neg} b \qquad  x \mathrel{\square} y + z \]

+

798 \[ a \bneg          b \qquad  x \rsquare          y + z \]

+

Example 8-9-4. This example demonstrates that 1) spacing is wrong if an +ordinary symbol is used instead of a binary symbol, 2) adding \mathrel or +\mathbin in Tralics does not change this behavior, 3) using the +declare-something command is not enough in Tralics: no error is signaled, but +no symbol appears.

+a¬bxy+z +a¬bxy+z +abxy+z +

799 \[  a = b  \text{ but }  a \tilde{=} b

+

800    \text{ which is not } a \mathrel{\tilde{=}} b  \]

+

Example 8-9-5. This example indicates how embellished operators can have type +Rel or whatever. As usual, nothing special is added to the XML file. This +means that the equal-with-hat should be a relation in the HTML file, an +ordinary symbol in the Pdf version.

+a=bbuta= ˜bwhichisnota= ˜b +

801 $ u \not< v$ or $a \not\in \mathbf{A} $,

+

802 {\makeatletter\let\not\@@not $ u \not< v$ or $a \not\in \mathbf{A} $}

+

803 $ \not\leq \ \not\succeq \ \not\sim $ $ \nleq \ \nsucceq \ \nsim $

+

Example 8-9-6. By default \not< is translated at \neg<; this is +wrong, so that we redefined it. The only trouble is that +\not\in does not work. We show here both behaviors:

+

u\not<v or a\notA, +u¬<v or aA

+

Example 8-9-7. This is not really good. +\not\not\not and +\nsucceq

+

804 $\Longarrownot\longleftrightarrow \qquad  \arrownot\hookleftarrow$

+

Example 8-9-8, demonstrating how to negate an arrow +\Longarrownot\arrownot, +this is not implemented in Tralics.

+Symbols of class \mathbin, miscellaneous +* +* ++ ++ +- +- +⨿ +\amalg +* +\ast + +\baro + +\barwedge +\bbslash +\bbslash + +\bigtriangledown + +\bigtriangleup + +\Cap + +\cap + +\Cup + +\cup + +\curlyvee + +\curlywedge + +\dag + +\dagger + +\ddag + +\ddagger + +\diamond + +\divideontimes +÷ +\div + +\dotplus + +\doublecap + +\doublecup +\fatbslash +\fatbslash + +\fatsemi +\fatslash +\fatslash + +\gtrdot + +\intercal + +\interleave + +\land +\lbag +\lbag + +\leftslice + +\leftthreetimes + +\lessdot + +\lor + +\ltimes + +\merge +\minuso +\minuso +\moo +\moo + +\mp +\nplus +\nplus +± +\pm +\rbag +\rbag + +\rightslice + +\rightthreetimes + +\rtimes + +\setminus + +\smallsetminus + +\sqcap + +\sqcup + +\sslash + +\star +⫿ +\talloblong +× +\times + +\triangleleft + +\triangleright + +\uplus + +\varbigtriangledown + +\varbigtriangleup + +\varcurlyvee + +\varcurlywedge +× +\vartimes + +\veebar + +\vee + +\wedge + +\wr +\Ydown +\Ydown +\Yleft +\Yleft +\Yright +\Yright +\Yup +\Yup +
+Symbols of class \mathrel, (arrows) + +\circlearrowleft + +\circlearrowright + +\curvearrowleft + +\curvearrowright + +\dasharrow + +\dashleftarrow + +\dashrightarrow + +\Downarrow + +\downarrow + +\downdownarrows + +\downharpoonright + +\gets + +\hookleftarrow + +\hookleftarrow + +\hookrightarrow + +\Leftarrow + +\leftarrow + +\leftarrowtail + +\leftarrowtriangle + +\leftrightarrowtriangle + +\leftharpoondown + +\leftharpoonup + +\leftleftarrows + +\Leftrightarrow + +\leftrightarrows + +\leftrightarrow + +\leftrightharpoons + +\leftrightsquigarrow + +\Lleftarrow + +\Longleftarrow + +\longleftarrow + +\Longleftarrow + +\longleftrightarrow + +\Longmapsfrom + +\longmapsfrom + +\Longmapsto + +\longmapsto + +\Longrightarrow + +\longrightarrow + +\looparrowleft + +\looparrowright + +\Lsh + +\Mapsfrom + +\mapsfrom + +\Mapsto + +\mapsto + +\multimap + +\nearrow + +\nwarrow + +\restriction + +\rightarrowtail + +\rightarrowtriangle + +\Rightarrow + +\rightarrow + +\rightharpoondown + +\rightharpoonup + +\rightleftarrows + +\rightleftharpoons + +\rightrightarrows + +\rightsquigarrow + +\Rrightarrow + +\Rsh + +\searrow + +\shortdownarrow + +\shortleftarrow + +\shortrightarrow + +\shortuparrow + +\swarrow + +\to + +\twoheadleftarrow + +\twoheadrightarrow + +\Uparrow + +\uparrow + +\upharpoonleft + +\upharpoonright + +\Updownarrow + +\updownarrow + +\upuparrows +
+Symbols of class \mathrel, (arrows, continued) +\curlyveedownarrow +\curlyveedownarrow +\curlyveeuparrow +\curlyveeuparrow +\curlywedgedownarrow +\curlywedgedownarrow +\curlywedgeuparrow +\curlywedgeuparrow +\nnearrow +\nnearrow +\nnwarrow +\nnwarrow +\ssearrow +\ssearrow +\sswarrow +\sswarrow +
+Symbols of class \mathord, Greek +Δ +\Delta +Γ +\Gamma +Λ +\Lambda +Ω +\Omega +Φ +\Phi +Π +\Pi +Ψ +\Psi +Σ +\Sigma +Θ +\Theta +ϒ +\Upsilon +Ξ +\Xi +α +\alpha +β +\beta +χ +\chi +δ +\delta +ϝ +\digamma +ϵ +\epsilon +η +\eta +γ +\gamma +ι +\iota +κ +\kappa +λ +\lambda +μ +\mu +ν +\nu +ω +\omega +ϕ +\phi +π +\pi +ψ +\psi +ρ +\rho +σ +\sigma +τ +\tau +θ +\theta +υ +\upsilon +ϵ +\varepsilon +ϰ +\varkappa +φ +\varphi +ϖ +\varpi +ϱ +\varrho +ς +\varsigma +ϑ +\vartheta +ξ +\xi +ζ +\zeta +
+Symbols of class \mathord, letter-shaped +$ +\$ + +\Im + +\Re + +\aleph +k +\Bbbk + +\beth + +\circledS + +\complement + +\daleth + +\ell +ð +\eth + +\Finv + +\Game + +\gimel + +\hbar + +\hslash +ı +\imath +ȷ +\jmath +$ +\mathdollar + +\mathparagraph +§ +\mathsection +£ +\mathsterling + +\mho + +\P + + +\partial +£ +\pounds +§ +\S + +\wp +
+Symbols of class \mathord, miscellaneous +! +! +. +. +/ +/ +? +? +@ +@ +| +| +# +\# +% +\% +& +\& +_ +\_ + +\| + +\angle + +\Arrowvert +| +\arrowvert + +\backprime + +\backslash +| +\bracevert + +\bigstar + +\blacklozenge + +\blacksquare + +\blacktriangledown + +\blacktriangle + +\bot + +\clubsuit +© +\copyright + +\diagdown + +\diagup + +\diamondsuit + +\emptyset + +\exists + +\flat + +\forall + +\heartsuit + +\infty + +\lightning +¬ +\lnot + +\lozenge + +\measuredangle + +\nabla + +\natural +¬ +\neg + +\nexists +' +\prime + +\sharp + +\spadesuit + +\sphericalangle + +\square + +\surd + +\top + +\triangledown + +\triangle +© +\varcopyright + +\varnothing + +\Vert +| +\vert +
+Mathematical accents +x ´ +\acute{x} +x +\bar{x} +x ˘ +\breve{x} +x ˇ +\check{x} +x +\ddddot{x} +x +\dddot{x} +x ¨ +\ddot{x} +x ˙ +\dot{x} +x ` +\grave{x} +x ^ +\hat{x} +x ˚ +\mathring{x} +x ˜ +\tilde{x} +x +\vec{x} +xyz ^ +\widehat{xyz} +xyz ˜ +\widetilde{xyz} +
+Symbols of class \mathbin, (boxes) + +\boxast +\boxbar +\boxbar + +\boxbox + +\boxbslash + +\boxcircle + +\boxdot + +\boxempty + +\boxminus + +\boxplus + +\boxslash + +\boxtimes + +\oblong +
+Symbols of class \mathbin, (circles) + +\bullet +· +\cdot + +\centerdot + +\bigcirc + +\circledast + +\circledcirc + +\circleddash + +\circ + +\oast + +\obar + +\ocircle + +\obar + +\odot + +\ogreaterthan + +\olessthan + +\ominus + +\oplus + +\oslash + +\otimes +\ovee +\ovee +\owedge +\owedge + +\varobslash + +\varocircle + +\varodot + +\varogreaterthan + +\varolessthan + +\varominus + +\varoplus + +\varoslash + +\varotimes +\varovee +\varovee +\varowedge +\varowedge +
+Symbols of class \mathrel, (equality and order) +< +< += += +> +> + +\approxeq + +\approx + +\asymp + +\backsimeq + +\backsim + +\Bumpeq + +\bumpeq + +\circeq + +\cong + +\curlyeqprec + +\curlyeqsucc + +\Doteq + +\doteqdot + +\doteq + +\eqcirc + +\eqsim + +\eqslantgtr + +\eqslantless + +\equiv + +\fallingdotseq + +\geqq + +\geqslant + +\geq + +\ge + +\gggtr + +\ggg + +\gg + +\gtrapprox + +\gtreqless + +\gtreqqless + +\gtrless + +\gtrsim +\leftrightarroweq +\leftrightarroweq + +\leqq + +\leqslant + +\leq + +\lessapprox + +\lesseqgtr + +\lesseqqgtr + +\lessgtr + +\lesssim + +\le + +\llless + +\lll + +\ll + +\precapprox + +\preccurlyeq + +\preceq + +\prec + +\risingdotseq + +\simeq + +\sim + +\succapprox + +\succcurlyeq + +\succeq + +\succsim + +\succ + +\thickapprox + +\thicksim + +\triangleq +
+Symbols of class \mathrel, (equality and order—negated) + +\gnapprox + +\gneqq + +\gneq + +\gnsim +\gvertneqq +\gvertneqq + +\lnapprox + +\lneqq + +\lneq + +\lnsim +\lvertneqq +\lvertneqq + +\ncong + +\neq + +\ne + +\ngeqq + +\ngeqslant + +\ngeq + +\ngtr + +\nleqq + +\nleqslant + +\nleq + +\nless +\npreceq +\npreceq + +\nprec + +\nsim +\nsucceq +\nsucceq + +\nsucc + +\precnapprox + +\precneqq + +\precnsim + +\precsim + +\succnapprox + +\succneqq + +\succnsim +
+Symbols of class \mathrel, (sets and inclusions) + +\blacktriangleleft + +\blacktriangleright + +\inplus + +\in + +\niplus + +\ni + +\ntriangleleftsqslant + +\ntrianglerightsqslant + +\owns + +\sqsubseteq + +\sqsubset + +\sqsupseteq + +\sqsupset + +\Subset + +\Supset + +\subseteqq + +\subseteq +\subsetpluseq +\subsetpluseq +\subsetplus +\subsetplus + +\subset + +\supseteqq + +\supseteq +\supsetpluseq +\supsetpluseq +\supsetplus +\supsetplus + +\supset + +\trianglelefteq + +\trianglerighteq +\trianglerighteqslant +\trianglerighteqslant +\trianglelefteqslant +\trianglelefteqslant + +\vartriangleleft + +\vartriangleright +\vartriangle +\vartriangle +
+Symbols of class \mathpunct, \mathord, \mathinner (punctuation) +, +,    + +\cdots    + +\hdots    +... +\ldots    +... +\mathellipsis +; +; +: +\colon + +\ddots + +\vdots +
+Symbols of class \mathrel, (sets and inclusions—negated) + +\notin +\nsubseteqq +\nsubseteqq + +\nsubseteq +\nsupseteqq +\nsupseteqq + +\nsupseteq + +\ntrianglelefteq + +\ntriangleleft + +\ntrianglerighteq + +\ntriangleright + +\subsetneqq + +\subsetneq + +\supsetneqq + +\supsetneq +\varsubsetneqq +\varsubsetneqq +\varsubsetneq +\varsubsetneq +\varsupsetneqq +\varsupsetneqq +\varsupsetneq +\varsupsetneq +
+Symbols of class \mathrel, (arrows—negated) + +\nLeftarrow       + +\nLeftrightarrow       + +\nRightarrow + +\nleftarrow + +\nleftrightarrow + +\nrightarrow +
+Symbols of class \mathrel, (negation and arrow +extensions). These are currently unimplemented. +\Arrownot +\Arrownot +\Longarrownot +\Longarrownot +\Mapsfromchar +\Mapsfromchar +\Mapstochar +\Mapstochar +\arrownot +\arrownot +\longarrownot +\longarrownot +\mapsfromchar +\mapsfromchar +\mapstochar +\mapstochar +\lhook +\lhook +\not +\not +\rhook +\rhook +
+Symbols of class \mathrel (miscellaneous). Symbols short-foo, +small-foo, var-foo not implemented. +: +: +϶ +\backepsilon + +\because + +\between + +\bowtie + +\dashv + +\frown + +\Join + +\mid + +\models + +\nmid + +\nparallel +\nshortmid +\nshortmid +\nshortparallel +\nshortparallel + +\nVDash + +\nvDash + +\nVdash + +\nvdash + +\parallel + +\perp + +\pitchfork + +\propto +\shortmid +\shortmid +\shortparallel +\shortparallel +\smallfrown +\smallfrown +\smallsmile +\smallsmile + +\smile + +\therefore +\varpropto +\varpropto + +\Vdash + +\vDash + +\vdash + +\Vvdash +
+Symbol pairs of class \mathop + +\int + +\oint + +\bigbox + +\bigcap + +\bigcup + +\bigcurlyvee + +\bigcurlywedge + +\biginterleave +\bignplus\bignplus +\bignplus + +\bigodot + +\bigoplus + +\bigotimes + +\bigparallel + +\bigsqcap + +\bigsqcup + +\bigtriangledown + +\bigtriangleup + +\biguplus + +\bigvee + +\bigwedge + +\coprod + +\prod + +\smallint + +\sum +
+Symbol pairs of class \mathopen and \mathclose extensible. +\bgroup and \lgroup wrong on HTML, not better in Pdf. Moustaches +not good in Pdf. +[(] +[] +{(} +\{\} +( +\lVert\rVert + +[(] +\lbrack\rbrack +{(} +\lbrace\rbrace +|(| +\lvert\rvert + +( +\lceil\rceil +(() +() +( +\lgroup\rgroup + +( +\lfloor\rfloor +( +\langle\rangle +( +\lmoustache\rmoustache + +( +\llbracket\rrbracket + +
+Symbol pairs of class \mathopen and \mathclose +non-extensible> Lets of symbols missing in Unicode +\llceil\rrceil +\llceil\rrceil +& +\binampersand\bindnasrepma +\Lbag\Rbag +\Lbag\Rbag +\llfloor\rrfloor +\llfloor\rrfloor + +\llparenthesis\rrparenthesis +
+Latin letters and arabic numerals +ABCDEFGHIJKLMNOPQRSTUVWXYZ +abcdefghijklmnopqrstuvwxyz +0123456789 +
+
+Other Examples +

805 \def\EXP{\frac{x^1_2}3Foo}

+

806 \[\dfrac {\EXP1}{\phantom{\EXP}1}=\dfrac {\EXP1}{\hphantom{\EXP}1}=\dfrac21=

+

807 \dfrac{\EXP1}{\EXP1}=

+

808 \dfrac{\EXP1}{\vphantom{\EXP}1}\]

+

Example of a \phantom, a \hphantom and a \vphantom. In the case +of a \hphantom, the 1 should be vertically aligned as in the case of 2/1, +otherwise should be aligned as in the case E/E (where E is the big expression); +in the case of a \vphantom, it should be centered otherwise flushed +right (aligned with the numerator).

+x 2 1 3Foo1 x 2 1 3Foo1=x 2 1 3Foo1 x 2 1 3Foo1=2 1=x 2 1 3Foo1 x 2 1 3Foo1=x 2 1 3Foo1 x 2 1 3Foo1 +

Test of multiscripts: +F10, +F1234abcd, +F123456abcdef,

+

809 \[\sideset{}{_d^c}\sum _xy \qquad \sideset{^a_b}{}\sum _xy \qquad

+

810 \sideset{'^a}{^c}\sum_xy\qquad \sideset{_b}{_d}\sum_xy \qquad

+

811 \sideset{^{aA}_{bB}}{^{cC}_{dD}}\sum_xy

+

812 \]

+

More examples of sideset

+dc x yba x yc'a x ydb x ydDcCbBaA x y +

Differences between \uplus and \biguplus. Consider the following +input lines.

+

813 \[{\uplus a}, {\uplus _ab}, {\mathop \uplus_ab}, {\mathop \uplus\limits_ab} \]

+

814 \[{x\uplus a}, {x\uplus _ab}, {x\mathop \uplus_ab}, {x\mathop \uplus\limits_ab} \]

+

Initial code

+a, a b, a b, a b +xa,x a b,x a b,x a b +

Unicode character U+2A04 used instead of \uplus.

+a, a b, a b, a b +xa,x a b,x a b,x a b +

In Tralics 2.9.4, +translation of \uplus was a character &uplus;, translation of +\biguplus was &biguplus;, characters +U+22E8 (multiset union) and U+2A04 (n-ary union operator with plus). +Thus lines and correspond to \uplus, +while lines and +correspond to \biguplus. On FL, I see a big operator on line +, a smaller one on line +(the version without index being smaller than the +other ones), and small operators on lines and . +On FM, I see a very big +operator on line , a small one on line , +question marks on lines and , and Amaya gives the +same for and . +Thus, translation of \biguplus seems to be wrong. Thus, we changed it: +in Tralics 2.9.5, \biguplus is the same character as \uplus. +Same formulas as above, with +command \biguplus used instead of \uplus

+a, a b, a b, a b +xa,x a b,x a b,x a b +

Same, with \textstyle

+a, a b, a b, a b +xa,x a b,x a b,x a b +

815 \[ A\xleftarrow{u}B\xleftarrow[d]{}C\xleftarrow[d]{u}

+

816    D\xrightarrow{u}E\xrightarrow[d]{}F\xrightarrow[d]{u}G \]

+

This example shows the use of \xleftarrow and \xrightarrow. +Optional argument below the arrow, mandatory argument below.

+A uB dC d uD uE dF d uG +

817 \[\begin{CD}

+

818 @.  0               @.     0\\

+

819 @.       @VVV                @VVV\\

+

820 0 @>>> D^{1 \times q} @>.R>> D^{1 \times p} @>\pi>> M @>>> 0\\

+

821 @.     @|  @VV.UV\\

+

822 0 @>>> D^{1 \times q} @>.J>> D^{1 \times p} @>\kappa>> D^{1 \times (p-q)} @>>>0\\

+

823 @.       @VVV                @VVV\\

+

824 @.  0               @.     0\\

+

825 \end{CD}\]

+

This example shows how to produce a commutative diagram (adapted from +)

+000 D 1×q .RD 1×p πM 0.U.U0 D 1×q .JD 1×p κD 1×(p-q) 000 +

826 \[\begin{CD}

+

827 @.  0               @.     0\\

+

828 @.       @VLLVV                @VVDV\\

+

829 0 @<\mathrm{above}<< D      @))\mathrm{below}) D @>\mathrm{above}>\mathrm{below}> 0\\

+

830 @.     @\vert  @VLLVDV\\

+

831 @.  0               @.     0\\

+

832 \end{CD}\]

+

A variant that shows how to put data above and below the arrows.

+00LLLLDD0 above D below D below above 0DLLDLL00 +

Some formulas that were badly rendered: +u(t)=1 2(x ˙ 1 (t-h)-x ¨ 1 (t)), +z 2 (t)=-1 2(ψ ¨(t)+2ψ(t)), +v(t)=1 2(-ψ ¨(t)+ψ ˙(t)).

+

More formulas: +formula A: +u(t)=1 2, +formula B: +u(t)=1 2, +formula C: +u(t)=1 2, +formula D: +u(t)=1 2, +and finally u(t)=1 2+1. +Using display style +1 2(x(1)+ψ(t))

+The connexion examples +

These are example where Tralics 2.10.5 produces the wrong size for closing +delimiters.

+

Example 1: d fine ' ={d j,λ ' } λΔ J-1 Δ j max and

+d fine ' ={d j,λ ' } λΔ J-1 Δ j max +

Example 2: μ 1 (d)=d(1-e -d 2 /2 ) -1 -2d -1 .

+

Example 3: a k * (a n ) p k -1 p .

+

Example 4: σ n (x) p Cn -r x w l τ ,1 τ=r+1 p.

+

Example 5: #Λ k 2 (-k-1)p c j Λ k |c j | p f X p p and

+#Λ k 2 (-k-1)p c j Λ k |c j | p f X p p . +

Example 6: d n (K) X E n (K) X .

+

Example 7: ||x-ΔΦ(x)|| 2 Cσ k (x) 1 k.

+

Example 8: +smaller parens f (n λA) versus larger parens +f(n Aλ).

+

Example 9:

+||η 0 || 2 C 2 2 k j=2 s ||η T j-1 +η T j || 1 C 2 2 k j=2 s ||η T j-1 || 1 +||η T j || 1 2C 2 2 k j=1 s ||η T j || 1 2C 2 2 kσ 2k (η) 1 . +
+Test of brackets +

833 $\bra{X}=\bra{x^2}=\ket{Y}=\ket{y^2} = \braket{X|Y}=\braket{x^2| y^2}$

+

834 $\Bra{X}=\Bra{x^2}=\Ket{Y}=\Ket{y^2} = \Braket{X|Y}=\Braket{x^2| y^2}$

+

835 $\Braket{x|y||z}$, $\Braket{x\|y|z}$

+

836 $\Braket{x+x_2|y+y^3||z+z^4+-5}$, $\Braket{x+x_2\|y+y^2|z+z^4_5}$

+

837 $   \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } $

+

838 $   \Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 }$

+

Formula one X|=x 2 |=|Y=|y 2 =X|Y=x 2 |y 2

+

Formula two X=x 2 =Y=y 2 =X|Y=x 2 |y 2

+

Formula three x|yz, xy|z

+

Formula four x+x 2 |y+y 3 z+z 4 +-5,

+

Formula five x+x 2 y+y 2 |z+z 5 4 .

+

These are from the style file +ϕ| 2 t 2 |ψ +and +xR 2 |0<|x|<5.

+
+Recursion test +|f| 2 -|p n q n | 2 L (T) <ϵ, +g L 2 (dμ) 2 =1 2π -π π |g(e iθ )| 2 dμ(θ), +letting:E n,m (K,K ' )={pP m (K),qP n (K ' )suchthatxI,p(x) q(x)1}, +
+Font tests +

We assume that the property of each math font is one (later one we shall set +it to zero), and the translation of a character is an ASCII character +with an attribute. Otherwise, it is a Unicode character between +U+1D400 and U+1F7FF. In our test we use internal font commands +like \mml@font@italic.

+

839 \def\F#1{\mbox{#1: }\csname mml@font@#1\endcsname}

+

840 \def\La{AB=c+1+23}

+

841 \def\Lb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

+

842 \def\Lc{$\Lx abcde$ $\Lx fghijklm$ $\Lx nopqrs$ $\Lx tuvwxyz$}

+

843 \def\Ld{0123456789}

+

844 \def\Test#1{\par Test of #1: \def\Lx{\csname mml@font@#1\endcsname}

+

845   $\Lx\La$, $\Lx\Lb$, \Lc, $\Lx\Ld$.}

+

846  

+

847 \Test{normal}

+

848 \Test{upright}

+

849 \Test{bold}

+

850 \Test{italic}

+

851 \Test{bolditalic}

+

852 \Test{script}

+

853 \Test{boldscript}

+

854 \Test{fraktur}

+

855 \Test{doublestruck}

+

856 \Test{boldfraktur}

+

857 \Test{sansserif}

+

858 \Test{boldsansserif}

+

859 \Test{sansserifitalic}

+

860 \Test{sansserifbolditalic}

+

861 \Test{monospace}

+
+

Test of normal: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of upright: + AB =c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ , abcde fghijklm nopqrs tuvwxyz , 0123456789.

+

Test of bold: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of italic: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of bolditalic: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of script: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of boldscript: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of fraktur: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of doublestruck: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of boldfraktur: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of sansserif: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of boldsansserif: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of sansserifitalic: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of sansserifbolditalic: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of monospace: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

In the Pdf version, we have problems with script and bold script for lower +letters and digits. In the MTML version, Firefox has no script, fraktur or +double struck font.

+

862 \mathfontproperty0=0

+

863 \mathfontproperty1=0

+

864 \mathfontproperty2=0

+

865 \mathfontproperty3=0

+

866 \mathfontproperty4=0

+

867 \mathfontproperty5=0

+

868 \mathfontproperty6=0

+

869 \mathfontproperty7=0

+

870 \mathfontproperty8=0

+

871 \mathfontproperty9=0

+

872 \mathfontproperty10=0

+

873 \mathfontproperty11=0

+

874 \mathfontproperty12=0

+

875 \mathfontproperty13=0

+

876 \mathfontproperty14=0

+

Test of normal: +AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

+

Test of upright: + AB =c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ , abcde fghijklm nopqrs tuvwxyz , 0123456789.

+

Test of bold: +𝐀𝐁=𝐜+1+23, 𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙, 𝐚𝐛𝐜𝐝𝐞 𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦 𝐧𝐨𝐩𝐪𝐫𝐬 𝐭𝐮𝐯𝐰𝐱𝐲𝐳, 0123456789.

+

Test of italic: +𝐴𝐵=𝑐+1+23, 𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍, 𝑎𝑏𝑐𝑑𝑒 𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚 𝑛𝑜𝑝𝑞𝑟𝑠 𝑡𝑢𝑣𝑤𝑥𝑦𝑧, 0123456789.

+

Test of bolditalic: +𝑨𝑩=𝒄+1+23, 𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁, 𝒂𝒃𝒄𝒅𝒆 𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎 𝒏𝒐𝒑𝒒𝒓𝒔 𝒕𝒖𝒗𝒘𝒙𝒚𝒛, 0123456789.

+

Test of script: +𝒜ℬ=𝒸+1+23, 𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵, 𝒶𝒷𝒸𝒹ℯ 𝒻ℊ𝒽𝒾𝒿𝓀𝓁𝓂 𝓃ℴ𝓅𝓆𝓇𝓈 𝓉𝓊𝓋𝓌𝓍𝓎𝓏, 0123456789.

+

Test of boldscript: +𝓐𝓑=𝓬+1+23, 𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩, 𝓪𝓫𝓬𝓭𝓮 𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶 𝓷𝓸𝓹𝓺𝓻𝓼 𝓽𝓾𝓿𝔀𝔁𝔂𝔃, 0123456789.

+

Test of fraktur: +𝔄𝔅=𝔠+1+23, 𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ, 𝔞𝔟𝔠𝔡𝔢 𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪 𝔫𝔬𝔭𝔮𝔯𝔰 𝔱𝔲𝔳𝔴𝔵𝔶𝔷, 0123456789.

+

Test of doublestruck: +𝔸𝔹=𝕔+1+23, 𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ, 𝕒𝕓𝕔𝕕𝕖 𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞 𝕟𝕠𝕡𝕢𝕣𝕤 𝕥𝕦𝕧𝕨𝕩𝕪𝕫, 0123456789.

+

Test of boldfraktur: +𝕬𝕭=𝖈+1+23, 𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅, 𝖆𝖇𝖈𝖉𝖊 𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒 𝖓𝖔𝖕𝖖𝖗𝖘 𝖙𝖚𝖛𝖜𝖝𝖞𝖟, 0123456789.

+

Test of sansserif: +𝖠𝖡=𝖼+1+23, 𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹, 𝖺𝖻𝖼𝖽𝖾 𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆 𝗇𝗈𝗉𝗊𝗋𝗌 𝗍𝗎𝗏𝗐𝗑𝗒𝗓, 0123456789.

+

Test of boldsansserif: +𝗔𝗕=𝗰+1+23, 𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭, 𝗮𝗯𝗰𝗱𝗲 𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺 𝗻𝗼𝗽𝗾𝗿𝘀 𝘁𝘂𝘃𝘄𝘅𝘆𝘇, 0123456789.

+

Test of sansserifitalic: +𝘈𝘉=𝘤+1+23, 𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡, 𝘢𝘣𝘤𝘥𝘦 𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮 𝘯𝘰𝘱𝘲𝘳𝘴 𝘵𝘶𝘷𝘸𝘹𝘺𝘻, 0123456789.

+

Test of sansserifbolditalic: +𝘼𝘽=𝙘+1+23, 𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕, 𝙖𝙗𝙘𝙙𝙚 𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢 𝙣𝙤𝙥𝙦𝙧𝙨 𝙩𝙪𝙫𝙬𝙭𝙮𝙯, 0123456789.

+

Test of monospace: +𝙰𝙱=𝚌+1+23, 𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉, 𝚊𝚋𝚌𝚍𝚎 𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖 𝚗𝚘𝚙𝚚𝚛𝚜 𝚝𝚞𝚟𝚠𝚡𝚢𝚣, 0123456789.

+

The Pdf version should be the same. The HTML version is different; only +characters in the BMP are shown (for instance, the set of integers, complex +numbers, etc, are often represented using a blackboard font, using characters +U+2124, U+2102, these are not repeated at U+1D551 and UD1D3A).

+

Testing internal commands that read/write math font properties.

+

877 \def\entity#1{\xmllatex{\&\#x#1;}{}}

+

878 \makeatletter

+

879 \mathfontproperty2=3 $\mathbf{x}$

+

880 Font property:\the\mathfontproperty\mml@font@bold,

+

881 Character propery:\the\setmathchar\mathbf`x.\\

+

882 \mathfontproperty\mathbf=0

+

883 Bold x: \setmathchar\mathbf`x={\entity{1d431}}$\mathbf{x}$

+

884 ComplexC: \setmathchar\mathbf`c={\entity{2102}}$\mathbf{c}$

+

885 \setmathchar 5 6 7 ok

+

x +Font property:1, +Character property:&#x1D431;. +Bold x: 𝐱 +ComplexC: + ok

+
+Examples from the MathML recommendation +

Examples and italic text taken from (Mathematical Markup +Language (MathML) Version 2.0, W3C recommendation 21 October 2003.

+Introduction +

886 \newcommand\Apply[2]{\mathbox{apply}{\mathbox{#1}{}#2}}

+

887 $\mathbox{mfenced}{{a+b}}^2$  % F1

+

888 $\Apply{power}{\Apply{plus}{\mathci{a}\mathci{b}} \mathcn{2}}$ %F2

+

889 ${(a+b)}^2$ % F3

+

The four lines above show a command and three math formulas, representing the +square of the sum of a and b. The MathML recommendation, in its +introduction, explains that there are three types of elements: presentation +elements (formula F1) and content elements (formula F2), as well as interface +elements (the toplevel <math> element, not discussed here). In any case, +a formula is a tree; leafs are token elements or canonically empty elements. +The main difference between these two types is the following: in the case of +formula F2, there is a possibility to evaluate the formula, for instance, +with a=2 and b=3, this should yield 25. In the case of F1, we have a formula +with a superscript; in a case like x 2 , it is impossible to tell if this +means the square of the variable x, or the second component of the vector +x.

+

In the example F3, there are five leafs, two identifiers, a number, two +operators. The default translation is a token element in presentation markup. +This means that the translation of `a' is implicitly a <mi> +obtained by \mathmi, instead of a <ci> obtained by \mathci. +A non-trivial question is how to translate `xy25' (the default is one or two +identifiers, followed by a number). Our formulas contain characters that are +neither letters nor digits: parenthesis, plus sign, superscript +character. These are operators; in the case of presentation markup, +an operator can be represented as a special element (<msup> for a +construction base plus exponent), or a token element (a <mo> element for a +sum). In the case of content markup, special element can be used (for instance +<list>, or empty elements, like <plus/>.

+

In content markup, the sum of two objects is specified by a <apply> +element, whose children are the operator <plus/> followed by the objects, +and a list of three objects is represented by a <list> element whose children are the +objects. In presentation markup, a sum is a sequence (an explicit or implicit +<mrow> element) containing the arguments and operators in order. In the +same fashion, a list can be defined as the sequence of all elements, plus the +separators (opening parentheses, closing parentheses, commas, etc.); it can +also be specified by a <mfenced> element, whose attributes define what is +at the start of the list, the end of the list, and between the +elements. These attributes have a default value adapted for lists, meaning +that f(x,y,z) can be obtained by the juxtaposition of f and a +<mfenced> element containing x, y and z. In the case of formula F1, +the content of <mfenced> element is the translation of {a+b}; +because of the braces this is a <mrow> element, with three children. +Formulas F1 and F3 are equivalent: a base and an exponent, the base contains +an opening parenthesis, the identifier a, the operator plus, the identifier b, +and a closing parenthesis. The renderer gives a+b 2 .

+

The second formula renders as +ab2. +My Web browser knows only some of the operators; hence it is possible that you +see the same as ab2. In the Pdf version, we implement the <apply> +element as follows: first the operator, then the arguments as a list. We could +do better, but all n-ary operators can have implicit arguments: it is possible +to represent the sum of all f(x) such that x satisfies some condition, +for instance, xN and x is a square. +Since Tralics does not generate content markup, this is not implemented at +all.

+

890 ${\mathbox{apply}{\mathbox{minus}{}\mathci{a}\mathci{b}}}$ %2.1.3

+

Simple example of presentation markup: +ab. Note that the +minus operator takes one or two arguments.

+
+More complicated examples +

891 ${x^2+{4\*x}+4}=0$

+

Rendering: +x 2 +4x+4=0. +Note the use of nested elements, to denote terms, for example, the +left-hand side of the equation; this is obtained here by simply putting +braces in the source. The &InvisibleTimes; MathML +character entity is used here to indicate to a renderer that there are +special spacing rules between the 4 and the x and that the 4 and the x should not be broken +onto separate lines. This special character can be obtained by the \* +command whose meaning is: do not consider any special spacing rule, but allow +a break here. We decide to translate \* in this way because it converts +an invisible product into an invisible product. We do not believe in +hyphenation for math formulas (inline formulas should be small, and not split, +big formulas should be in display mode). +Translation from XML to Pdf is empty for this character.

+

892 $x=\frac{{-b}\pm\sqrt{b^2-{4\* a\* c}}}{2\* a}$

+

Second example, +x=-b±b 2 -4ac 2a. +Notice that the `plus or minus' sign is given by the entity name +&PlusMinus; this is equivalent to using the character reference +&#00B1;. When converting an XML document into Pdf, the character +reference is +required (notice that the style sheet that converts from XML to XSL/FO +replaces entity names by character references, so that this is not a +problem). On the other hand, there are cases where entity names are refused in +a HTML document: if that document is presented as XML, and the DTD makes no +reference to MathML (this very document is likely to be XHTML1.0 strict).

+

893 $z\mathbox{mfenced}{{x+y}}$

+

894 $A=\begin{bmatrix}x&y\\z&w\end{bmatrix}$

+

Example three: zx+y. The MathML recommendation says +that there is some ambiguity: what is the relation between z and the +expression x+y that follows? implicit product or function application? A +translator like Tralics cannot guess.

+

Example four +A=xyzw. +Most elements have a number of attributes that control the details of +their screen and print rendering. The attributes for operator elements given +using <mo> are set to default values determined by a +dictionary. Translation of the environment is a <mfenced> element, with +two attributes; all other attributes are ignored in the XML to Pdf +conversion. No dictionary is currently used; translation of a <mo> is +complicated: the difference between lim and is that we have a +sequence of 3 ASCII characters, and a character reference (that could be +given in base 10, in base 16, or directly as a UTF-8 character). The XML +reader converts this into a command (with a complicated name) that expands to +\sum, that expands to whatever is defined by the style files.

+

895 \def\Cx{\mathci{x}} \def\Dz{\mathcn{0}}

+

896 \def\Dt{\mathcn{2}} \def\Df{\mathcn{4}}

+

897 $\Apply{eq}{

+

898   \Apply{plus}{ \Apply{power}{\Cx\Dt} \Apply{times}{\Df\Cx}\Df}

+

899   \Dz}$

+

Example 2.3.2, content markup. + + +x24x40 +This example shows that content markup is sometimes easier.

+

900 \def\Ca{\mathci{a}}\def\Cb{\mathci{b}} \def\Cc{\mathci{c}}

+

901 \def\Cpm{\mathcsymbol{^^b1}}

+

902 $\Apply{eq}{

+

903    \Cx

+

904    \Apply{divide}{

+

905      \mathbox{apply}{

+

906        \Cpm

+

907        \Apply{minus}{\Cb}

+

908        \Apply{root}{\mathbox{degree}{\Dt}

+

909           \Apply{minus}{

+

910             \Apply{power}{\Cb\Dt}

+

911             \Apply{times}{\Df\Ca\Cc}}}}

+

912      \Apply{times}{\Dt\Ca}}}$

+

Next example + + +x±b2b24ac2a. +This example has two interesting points. The first one is that some operators +can have optional arguments (in this case, the default value 2 is used). The +second point is that the first child of <apply> can be any function; +in this example, it is a <csymbol> element (equivalent of <mo>), whose +value is the character ± (that has to be entered as a character, not a +command). Other content markup examples omitted.

+

913 $\mathbox{mrow}{\mathbox{apply}{\mathbox{eq}{}\mathci{A}

+

914 \mathbox{matrix}{\mathbox{matrixrow}{\mathci{x}\mathci{y}}

+

915 \mathbox{matrixrow}{\mathci{z}\mathci{w}}}}}$

+

Next example +Axyzw. This example is badly rendered +in the Pdf (matrix operators not implemented), and my favorite HTML browser +shows the same result!

+
+Presentation Markup +

916 \def\X#1#2{\mathbox{#1}{\mathcnothing{\char32#2\char32}}}

+

917 $\X{mi}{x}\X{mo}{+}{\X{mi}{a}\X{mo}{/}\X{mi}{b}}$

+

918 $x+{a/b}$

+

Compare +` x + a / b ' +with `x+a/b'. +These two examples should look the same; in the first case the content of each +element is a space, a character, a space; for the second example, there are no +spaces.

+

919 $\mathmi[fontweight][bold][mathvariant][normal]{a}$

+

920 $\mathmi[fontweight][bold][mathvariant][sans-serif]{a}$

+

921 $\mathmi[fontweight][bold][mathvariant][fraktur]{a1}$

+

922 $\mathbox{mstyle}[fontstyle][italic]{\mathbf{a}b}$

+

Deprecated styles: `a' +should be a normal a, `a' +should be a sans-serif a, and +`a1' should be fraktur. +In the case of +`ab', the a should be bold +upright, and the b should be italic. The MathML recommendation says that +`mathvariant' should have precedence over `fontstyle', which is deprecated, +and not used by Tralics. In the Pdf, attributes of \mstyle are +currently ignored.

+

923 $x$ $\mathmi{\char32x\char32}$

+

924 $D$ $\mathmi{\char32sin\char32}$ $\mathmi[mathvariant][script]{L}$

+

925 $\mathmi{}$

+

Examples for 3.2.3: `x' (an x without spaces), +` x ' (an x with spaces), +`D', ` sin ', 'L' +and `' (empty identifier). An italic font should be used unless +defined by an attribute, or an upright font if the element has more than +one character. In the Pdf, spaces are incorreclty counted as characters.

+

926 $\sin(x)$ $\mathmi{sin}\ApplyFunction x$ $1+x+\mathmo{...}+n$

+

927 $1+x+\mathmi{...}+n$ $\pi, \ImaginaryI,\ExponentialE$

+

This is sin(x), using &ApplyFunction;, Unicode character U+2061: +`sinx'. Ellipses using <mo>: `1+x+...+n' +and <mi>: `1+x+...+n', constants π,, +(these are somehow unusual in Pdf).

+

928 $2, \mathmn{0.123}, \mathmn{1,000,000}, \mathmn{2.1e10},

+

929 \mathmn{0xFFEF}, \mathmn{MCMLXIX}, \mathmn{twenty one}$.

+

930 $2+{3\*\ImaginaryI},\frac12, \pi, \ExponentialE$.

+

A <mathmn> element represents a number, typeset with an upright font, +for instance +2, 0.123, 1,000,000, 2.1e10, +0xFFEF, MCMLXIX, twenty one. +Numbers, that could be <mathcn> (content markup numbers), but are not +<mathmn> (presentation markup numbers): +2+3,1 2,π,.

+

931 $+, <,\le, \mathmo{<=}, \mathmo{++}, \sum,\mathmo{.NOT}, \mathmo{and},

+

932 \*,\mathmo[mathvariant][bold]{+}$

+

933 $({a+b})$, $[{0,1})$, $f\ApplyFunction {({x,y})}$

+

934  $x\* y$, $f\ApplyFunction{(x)}$, $\sin\ApplyFunction x$

+

935 and $m_{1\InvisibleComma2}$.

+

Example of <mathmo> (operators): ++,<,,<=,++,,.NOT,and,,+. In the Pdf version, font attributes are +ignored for operators (they are complicated to implement, and only `bold' +variant is available with the current math fonts).

+

More examples: (a+b), [0,1), f(x,y).

+

Invisible operators: xy, f(x), sinx +and m 12 .

+

936 $\frac{\DifferentialD}{\DifferentialD x}$

+

Embellishment x. The MathML +recommendation says that the spacing around an embellished operator like + 4 +should be the same as that of the operator at its core. An expression like +4 + is not an embellished operator, but phantoms are. More surprising: a +fraction whose numerator is an operator is an embellished operator, the +example shown here being the motivation.

+

937 $\underline{(}\frac ab \overline)$.

+

938 $\mathmo[maxsize][1]{(} \frac ab\mathmo[maxsize][1]{)}$,

+

939 $(\frac ab)$

+

940 $x\mathop\rightarrow\limits_{\mtext{ maps to }}y$

+

Stretching: ( _a b) . With maxsize +(a b), and without +(a b). The rule is the following. An enbellished operator (for +instance an underlined parenthesis) should stretch vertically, +as it it were not embellished, this is not +implemented in the Pdf. A maximum size can be given (either as a dimension, or +a ratio to the default size, a value of 1 says that the operator should not +stretch. Horizontal stretching: +x maps to y. In the Pdf version, we have +a normal arrow.

+

941 $\mtext{ Theorem 1: }$

+

942 $X\mathbox{mtext}{\mathcnothing{^^^^2009}}X$

+

943 $X\mathbox{mtext}{\mathcnothing{^^^^2009^^^^200a^^^^200a^^^^2009%

+

944 ^^^^200a^^^^200a}}X$'

+

945 $X\mkern10muX$

+

946 $X\mtext{ /* a comment */ }X$'

+

947 $\mathmo{ there exists }{{\delta>0}\mathmo{ such that

+

948 }{{f\ApplyFunction{(x)}}<1}}$

+

Text: ` Theorem 1: ', +`XX' +`X      X' (expression obtained by inserting twice three characters: +thickspace, thinspace and verythinspace, should be the same as +`XX', +`X /* a comment */ X'. Other example: + there exists δ>0 such that +f(x)<1. The MathML rules say that initial and final +space should be removed and consecutive space characters should be replaced by +a single space character in elements like <mtext> or <mo>. This is not +done in the Pdf version, and you will see the following: normally <mtext> +is typeset via \text, and spaces are typeset as usual outside math mode; +the default for all other operators is a math font, and spaces are ignored. +A non-trivial question is: what amount of space is inserted between the +`exists' and the δ that follows? Firefox uses none, this is not good, + uses a small space, but ignores the space before it, the MathML +recommendation is unclear, and the sample renderings of the MathML test suite +show no space between two <mtext> elements or between a <mtext> and a +comma.

+

949 ${x\mathbox{malignmark}[edge][right]{}}^2$

+

Alignment: x 2 . The empty element used +in this formula is ignored in the Pdf version, (and, it seems, by my browser +also). It defines an alignment mark, that is ignored outside tables. +The idea is the following. If you want a table where all elements are +centered, except for the first row, first column, and element at position +(2,2), the easy way is to use a <mtable> element, specifying that +alignment is left, center, etc, specify alternative alignment for the first +row, or some specific elements. If this is not sufficient, an alternate method +is provided. Typically each row contains a single cell, with some empty +<maligngroup> elements. You can specify alignments for groups in the same +way as alignment for cells, with two additions: if the group contains numbers, +you can say that decimal points are aligned (there is an implicit point at the +end of the group); moreover you can explicitly set a mark. In the example +above, the mark is between the letter x and the superscript. Using a mark does +not alter rendering of the expression.

+

950 $\mathbox{ms}{\mathcnothing{\&}}$

+

951 $\mathbox{ms}{\mathcnothing{\&amp;}}$

+

952 $\mathbox{ms}{\mathcnothing{double quote is "}}$

+

953 $\mathbox{ms}[lquote][aa][rquote][bb]{\mathcnothing{test}}$

+

Literals &, +&amp;, +double quote is ", +test. +This element is not yet correctly converted in Pdf. There should be some kind +of quotes around the expression, the quotes may be given by attributes; my +browser shows strange characters.

+

954 ${2\* x}+y-z$, $({x,y})$

+

Example of <mrow>: 2x+y-z, (x,y).

+

955 \[\frac{(\frac ab\mathattribute{linethickness}{0})\qquad

+

956 \frac ab}{\frac cd}\mathattribute{linethickness}{2}\qquad

+

957 \frac{1}{x^3+\frac x3} = \frac{1}{x^3+\frac x3}

+

958 \mathattribute{bevelled}{true}\qquad \frac{1+\sqrt 5}{2}

+

959 \]

+

Example of <mfrac>; if the bevelled attribute is true, a diagonal line +should separate numerator and denoninator (not implemented in Pdf).

+(a b)a b c d1 x 3 +x 3=1 x 3 +x 31+5 2 +

960 $\mathbox{mstyle}[maxsize][1]{(\frac ab)}$

+

Example of <mstyle>: (a b). +Attributes of the element are used by children as default value. In the +example, both opening and closing parentheses should use maxsize=1. +This mechanism is not yet implemented in the Pdf.

+

961 $\mathbox{merror}{

+

962 \mtext{ Unrecognised element: mfraction; arguments were: }

+

963 {1+\sqrt5}\mtext{ and } 2}$

+

Error: Unrecognised element: mfraction; arguments were: 1+5 and 2.

+

964 \def\test{C\mathbox{mpadded}[width][0em]{\kern-0.3em\text{|}}}

+

965 $\test$, $\mathbox{semantics}

+

966 {\test\mathbox{annotation-xml}[encoding][MathML-Presentation]{\mathbb{C}}}$

+

967 $\mathbb{C}$

+

968 $\mathbox{mpadded}[width][0em]{C}\kern0.3em\text{|}$

+

Padding: C|, C|C. +The previous expression contains two letters C with a vertical bar over +it. None of them looks OK on my browser, because of the negative space. The Pdf +version contains a third C because the <semantics> element is not +implemented. The formula should mimic C. +Positive padding C| is +better in my browser.

+

969 $\frac{x+y+z}{x\phantom{\mathmo[form][infix]{+}y}+z}$

+

970 $\frac{x+y+z}{x\phantom{+}\phantom{y}+z}$

+

Phantom: x+y+z x+y+z +and x+y+z x+y+z. These two expressions should +produce the same result, the numerator and the denoninator have the same +width. Said otherwise, spacing around the plus symbol (inside or outside +phantom) should be that of a prefix plus operator if it is the first +element in a row, followed by something else, should be infix if it is the +sole element, or neither first nor last, should be postfix otherwise.

+

971 \def\mfence{\mathbox{mfenced}}

+

972 Fences: $\mfence{x}$, $(x)$, $\mfence{xy}$, $f\ApplyFunction\mfence{xy}$,

+

973 $(x,y)$, $\mfence{{a+b}}$, $\mfence[open][[]{0\relax1}$.

+

974 Wrong $\mfence{a+b}$, $\mfence{01}, \bf\mfence{xy}$,

+

975 right: $\bf\mfence{x y}$, $\bf\mfence{{x}{y}}$.

+

+Fences: x, (x), xy, fxy, +(x,y), a+b, 01. +Wrong a+b, 01,xy, +right: xy, xy. +Note that separators do not show in the Pdf, so that it is unclear why some +expressions are wrong.

+

The first expression is wrong, because the MathML +documentation says that a <mrow> is necessary so that the <mfenced> +has just one argument; a pair of braces should be added, this gives the +\mrow. Examples that follow are wrong because `01' or `xy' produce a +single <mn> or <mi> element; in the case of an identifier this may +depend on the font. You can use a separator (space or +\relax) or uses braces (no <mrow> is produced if there is a single +element in the math list). Note: spaces are ignored in math mode; it is not +completely clear whether or not a space is allowed as separator.

+

976 \[

+

977 \def\mtr{\mathbox{mtr}}

+

978 \def\mtdr{\mathbox{mtd}[columnalign][right]}

+

979 \def\ralign{\cellattribute{columnalign}{right}}

+

980 \def\X#1#2{\mathbox{menclose}[notation][#1]{#2}}

+

981 \mathbox{mtable}[columspacing][0pt][rowspacing][0pt]{

+

982   \mtr{\mathbox{mtd}{}\mtdr{10}}

+

983   \mtr{\mtdr{131}\mtdr{\X{longdiv}{1413}}}

+

984   \mtr{\mathbox{mtd}{}\mtdr{{\underline{131}\phantom{3}}}}

+

985   \mtr{\mathbox{mtd}{}\mtdr{103}}}

+

986 \qquad

+

987 a_{\X{actuarial}{n}\*i}

+

988 \qquad

+

989 \begin{array}{cc}

+

990   &\ralign10\\

+

991 \ralign131&\ralign\X{longdiv}{1413}\\

+

992   &\ralign \underline{131}\phantom{3}\\

+

993   &\ralign 103

+

994 \end{array}\mathattribute{columspacing}{0pt}\mathattribute{rowspacing}{0pt}

+

995 \]

+

Examples of menclose (Does not work in the Pdf or with Firefox; works with Amaya).

+101311413131 _3103a ni 101311413131 _3103 +

996 $(x+y)^2$ ${(x+y)}^2$ $\int_0^1{\ExponentialE^x\*{\DifferentialD x}}$

+

Scripts: +Compare (x+y) 2 (without braces) with (x+y) 2 (recommended), + 0 1 x x

+

997 $\underbrace{x+y+z}\mathattribute{accentunder}{true} \text{~versus~}

+

998 \underbrace{x+y+z}\mathattribute{accentunder}{false}

+

999 $, $\hat x \text{~versus~}\hat x\mathattribute{accent}{false}$,

+

1000 $\overbrace{x+y+z}\mathattribute{accent}{true} \text{~versus~}

+

1001 \overbrace{x+y+z}\mathattribute{accent}{false}$,

+

1002 $\mathop{\int\limits_0}\limits^\infty \text{~versus~} \int\limits_0^\infty$

+

Underscript, overscripts: +x+y+z versusx+y+z , x ^versusx ^, +x+y+z versusx+y+z . Converting mathml to Pdf is +not obvious because if a brace character is an accent-declared overscript, we +must apply some command to the kernel. In order for this example to work, +another command must be applied if the brace is non-accent (we use the same +command, that's simplier). In a case like + 0 versus 0 +there is no difference between an operator with underscript to which an +overscript is added, and an operator with two scripts.

+

1003 $\mathbox{mmultiscripts}{F1\none\mathbox{mprescripts}{}0\none}

+

1004 \ApplyFunction{({;a;z})}$

+

1005 $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$

+

Multiscripts: +F10(;a;z) and +Rijkl.

+

1006 $(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{array})$,

+

1007 $\mathbox{mtable}{\mathbox{mlabeledtr}[id][e-is=m-c-square]{

+

1008 \mathbox{mtd}{\text{(2.1)}}

+

1009 \mathbox{mtd}{{E={m\*c^2}}}}}$.

+

Tables: a matrix +(100010001), +and an numbered equation: +(2.1)E=mc 2 .

+

1010 $\def\X{\mathbox{maligngroup}{}}

+

1011 \def\A{{{\X\mathmn{8.44}\*\X x} \X +{\X \mathmn{55} \*\X y}}\X=\X0}

+

1012 \def\B{{{\X\mathmn{3.1} \*\X x} \X -{\X \mathmn{0.7}\*\X y}}\X=\X{-\mathmn{1.1}}}

+

1013 \mathbox{mtable}[groupalign][\char`\{decimalpoint left left decimalpoint left

+

1014 decimalpoint\char`\}]{

+

1015 \mathbox{mtr}{\mathbox{mtd}{{\A}}}

+

1016 \mathbox{mtr}{\mathbox{mtd}{{\B}}}}

+

1017 $

+

Alignment +8.44x+55y=03.1x-0.7y=-1.1. As explained above, this could be typeset, by aligning the \X. the +material between two \X commands should be left-aligned, or aligned on +the decimal point. In some cases, the \X is a direct child of the cell, +but not always. For this reason, it is nearly impossible to typeset this +correctlty in .

+ + + +A pdflatex-based automated journal production system +TUGboat +1 +27 +2006 + + + +XMLTEX: A non validating (and not 100% conforming) namespace aware XML parser implemented in +TUGboat +3 +21 +2000 +193-199 + + + +De XML à PDF avec xmltex et Passive +Cahiers Gutenberg +35-36 +79-114 +2000 + + + +Mathematical Markup Language (MathML) Version 2.0 +2001 +http://www.w3.org/TR/MathML2/ + + +Applications of the Quillen-Suslin theorem to multidimensional systems theory +Rapport de recherche INRIA +RR-6126 +2007 +96 +http://hal.inria.fr/inria-00131035/en/ + + +Tralics, a to XML translator, Part I +Rapport Technique +309 +Inria +2006 +http://hal.inria.fr/inria-00000198 + + +Tralics, a to XML translator, Part II +Rapport Technique +310 +Inria +2006 +http://hal.inria.fr/inria-00069870 + + +The book +Addison Wesley +1984 + + + +The companion, second edition +Addison Wesley +2004 + + + +Passive +http://www.tei-c.org.uk/Software/passivetex/ +2003 +
diff --git a/thirdparty/tralics-2.15.2/Modele/testpack.xml b/thirdparty/tralics-2.15.2/Modele/testpack.xml new file mode 100644 index 0000000..a54ae85 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testpack.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + +Star crossed lovers.The BardExample is the school of mankind, and they will learn at no otherLetters on a Regicide Peace Edmond Burke

A textAn author +A second textAn author +

+

AXB +AXB +AXB

+

df dx df dx df dx +d 2 f dx 2 d 2 f dx 2 d 2 f dx 2 +df dx x 0 df dx x 0 df dx x 0 +d 2 g dy 2 0 d 2 g dy 2 0 d 2 g dy 2 0

+

f x= 2 f x 2 =p V T = 3 f xy 2 = 2 f x 2 = 5 f x 2 y 3 z

+f x= 2 f x 2 =p V T = 3 f xy 2 = 2 f x 2 = 5 f x 2 y 3 z +

+
+
+
+
+
+
+
+
+
+

+

+

+ + +Text +Text +

+
+foo +Some text +Some text +Some text

+

textA

+

textB testC textDout + textD textE textFout + textG this and that + + + +textH etcredtextetcgreentext +textI +textJ +textK

+

xyz a b

+

+

Text. +IntroductionContinuation +

+

A1B1C2=3 +A1B1C2=3A12B12C2=3

+

textETC +textFOOETC

+

XYX M̂( ( +blabla. (taratata) +blabla. (taratata) +mod

+

Testing fancybox

+New Glarus BirdwatchNew Glarus BirdwatchNew Glarus BirdwatchNew Glarus Birdwatch

xx + +

blah

+ +

Since the former doesn't use braces to delimit +the context of the box, ... +

+ +

xyz

+

x +

+

x=yy>x 4 5 f(x)dx= iF x i + + +x=yy>x 4 5 f(x)dx= iF x i + +

+

etc

+A table of foo and bar + +

foo +bar +

+ +A table of foo and bar + + + + +

foo +bar +

+ +

x +y +

+

+Love of life +and other short stories +by Policarpa Salabarrieta +
x

+

My list: +Galanga root +Coconot +Tempeh +
x

+ +Hello, world +
+ABCD

aa +bb +cc +dd

+

here we are again

+

happy as can be

+

all good friendsOK

+

and jolly good company OK +xyz

+blah di blah +blih da blih + diff --git a/thirdparty/tralics-2.15.2/Modele/testpackii.xml b/thirdparty/tralics-2.15.2/Modele/testpackii.xml new file mode 100644 index 0000000..dfb8a15 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/testpackii.xml @@ -0,0 +1,33 @@ + + + + +A +

Testing the float package

+
+B +

foo xxHeyfoo

+
+

Heyfoobar

+
+

foo xxHey

+
+

+ +

+ +List of figuresList of Programs +forloop +

+1+3+5+7+9 +=2=5=8=11=14=17 +=2=5=8=11=14=17

+ + + +Probability laws related to the Jacobi θ and Riemann ζ functions, and Brownian excursions +Bull. Amer. Math. Soc. +38 +435–465 +

+

This is the end of the document

+
diff --git a/thirdparty/tralics-2.15.2/Modele/teststr.xml b/thirdparty/tralics-2.15.2/Modele/teststr.xml new file mode 100644 index 0000000..137287a --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/teststr.xml @@ -0,0 +1,172 @@ + + + + +

OK +OK

+

0123 +--i-ii-iii + +OK + +OK + +OK

+

;c;c.

+

Substr, 12345,1, 2, 5: 12 +Substr, 12345,3, 5, 5: 345 +Substr, 12345,3, end, 5: 345 +Substr, 12345,3, beg, 5: 123 +Substr, 12345,-2, 1, 5: 4 +Substr, 12345,-1, 1, 5: 5 +Substr, 12345,3, -2, 5: 23 +Substr, 12345,-2, -2, 5: 34 +Substr, 12345,0, 5, 5: (the null string) +Substr, 12345,2, 0, 5: (the null string) +Substr, abcdefgh,2, 3, 8: bcd

+

Quantity 2.345 is decimal

+

Quantity 2.4.5 is not decimal

+

Quantity +-2.45 is not decimal

+

Quantity +2.345 is decimal

+

Quantity -2.345 is decimal

+

Quantity 2.345- is not decimal

+

Quantity 2.4+4.5 is not decimal

+

Quantity +4. is decimal

+

Quantity 4. is decimal

+

Quantity +.7 is decimal

+

Quantity .3 is decimal

+

Quantity 4 is decimal

+

Quantity 123456 is decimal

+

Quantity -12345 is decimal

+

Quantity +12345 is decimal

+

Quantity 2.345 is numeric

+

Quantity 2.4.5 is not numeric

+

Quantity +-2.45 is not numeric

+

Quantity +2.345 is numeric

+

Quantity -2.345 is numeric

+

Quantity 2.345- is not numeric

+

Quantity 2.4+4.5 is not numeric

+

Quantity +4. is numeric

+

Quantity 4. is numeric

+

Quantity +.7 is numeric

+

Quantity .3 is numeric

+

Quantity 4 is numeric

+

Quantity 123456 is numeric

+

Quantity -12345 is numeric

+

Quantity +12345 is numeric

+

Quantity 4.5 is numeric

+

Quantity 4.5e5 is numeric

+

Quantity +4.5e5 is numeric

+

Quantity 4.5e+5 is numeric

+

Quantity +4.5e+5 is numeric

+

Quantity 4.5E5 is numeric

+

Quantity -4.5E5 is numeric

+

Quantity 4.5E-5 is numeric

+

Quantity -4.5E-5 is numeric

+

Quantity -4.5E-5. is not numeric

+

Quantity 4.5.E-5 is not numeric

+

Quantity abcdefg is not numeric

+

Quantity abcE-5 is not numeric

+

Quantity 2.345 is not int

+

Quantity 2.4.5 is not int

+

Quantity +-2.45 is not int

+

Quantity +2.345 is not int

+

Quantity -2.345 is not int

+

Quantity 2.345- is not int

+

Quantity 2.4+4.5 is not int

+

Quantity +4. is not int

+

Quantity 4. is not int

+

Quantity +.7 is not int

+

Quantity .3 is not int

+

Quantity 4 is int

+

Quantity 123456 is int

+

Quantity -12345 is int

+

Quantity +12345 is int

+

Quantity 4.5 is not int

+

Quantity 4.5e5 is not int

+

Quantity +4.5e5 is not int

+

Quantity 4.5e+5 is not int

+

Quantity +4.5e+5 is not int

+

Quantity 4.5E5 is not int

+

Quantity -4.5E5 is not int

+

Quantity 4.5E-5 is not int

+

Quantity -4.5E-5 is not int

+

Quantity 4.5.E-5 is not int

+

Quantity abcdefg is not int

+

Quantity abcE-5 is not int

+

1;2;3;4. +1;23;;4. +Strlen 4 should be 4 +6=6 +6=6 +2=2 +33=33

+

.Lundi Mardi Mercredi Jeudi Vendredi Samedi Dimanche., +.Montag Dienstag Mittwoch Donnerstag Freitag Samstag Sonntag., +.Monday Tuesday Wednesday Thursday Friday Saturday Sunday., +.Lunes Martes Miércoles Jueves Viernes Sábado Domingo..

+

.janvier février mars avril mai juin juillet août septembre octobre novembre décembre., +.Januar Februar März April Mai Juni Juli August September Oktober November Dezember., +.January February March April May June July August September October November December., +.enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre..

+

In 10 days is 4th April 2008 + +Today is 25th March 2008.

+

.Today is Mardi 25 mars 2008. +Today is Dienstag 25. März 2008. +Today is Martes 25 de marzo de 2008. +Today is Tuesday March 25, 2008. +Today is Tuesday 25th March 2008.

+

Tuesday

+

1·25>0.textṡ.

+BB + +CC + +xx + + + + + + + + + + + + + + + +Ok +Ok +Ok +Ok +Ok +

Paris + +rennes

+ + +Panorama 2 +

Module1

+Panorama 2 +

Module2

+
+Titre 3 +

Module3

+Titre 4 +

Module4

+ + + + + + +

+

+ + +

+
diff --git a/thirdparty/tralics-2.15.2/Modele/tormath.xml b/thirdparty/tralics-2.15.2/Modele/tormath.xml new file mode 100644 index 0000000..6ca8fa8 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tormath.xml @@ -0,0 +1,523 @@ + + + + +

DOCSTART

+x6 +simple math +

\sharp

+

+\i \j \$ ~\, \_ \& \lbrace \rbrace \% \ \! \quad \qquad \dots \ldots \# \sharp \natural \flat += +\hspace{56.9055pt} \vspace{569.05511pt} \hspace{3.0pt}\vspace{4.0pt}\hspace*{5.0pt}\vspace*{6.0pt} +\hspace{-24.0pt} \vspace{-24.0pt} \hspace{-3.0pt}\vspace{4.0pt}\hspace*{-5.0pt}\vspace*{-6.0pt} +abcdefghijklmnopqrstuvwxyz +ABCDEFGHIJKLMNOPQRSTUVWXYZ +<>,?;./:+=-_"^{\prime }()§!` ^{\prime }" +ሴaà

+

\alpha \beta \gamma \delta \epsilon \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega \varpi \varrho \varsigma \varphi \varkappa \vartheta +\Gamma \Delta \Theta \Lambda \Xi \Sigma \Upsilon \Phi \Pi \Psi \Omega

+

\hbar \ell \wp \Re \Im \partial \infty \emptyset \nabla \surd \top \bottom \bot \angle \triangle

+

\arccos \arcsin \arctan \arg \cos \cosh \cot \coth \csc \deg \dim + \exp \hom \ker \lg \ln \log \Pr \sec \sin \sinh \tan \tanh \det \gcd +\inf \injlim \lim \liminf \limsup \max \min \projlim \sup

+

\forall \exists

+

\coprod \bigvee \bigwedge \biguplus \bigcap \bigcup \int \sum \prod \bigotimes \bigoplus \bigodot \oint \bigsqcup \smallint

+

\triangleleft \triangleright \bigtriangleup \bigtriangledown \wedge \wedge \vee \vee \cap \cup \multimap \dagger \ddagger \sqcap \sqcup \amalg \diamond \Diamond \bullet \wr \div \odot \oslash \otimes \ominus \oplus \uplus \mp \pm \circ \bigcirc \setminus \cdot \ast \times \star

+

\propto \sqsubseteq \sqsupseteq \subseteq \sqsubset \parallel \mid \dashv \vdash \Vdash \models \nearrow \searrow \swarrow \nwarrow \Leftrightarrow \Leftarrow \Rightarrow \ne \ne \le \le \ge \ge \succ \approx \succeq \preceq \prec \doteq \subset \supset \supseteq \subseteq \bindnasrepma \ni \ni \gg \ll \gtrless \geqslant \leqslant \lnot \notin \leftrightarrow \leftarrow \leftarrow \rightarrow \rightarrow \mapsto \sim \simeq \perp \equiv \asymp \smile \frown \leftharpoonup \leftharpoondown \rightharpoonup \rightharpoondown \hookrightarrow \hookleftarrow \bowtie \bowtie \Longrightarrow \longrightarrow \longleftarrow \Longleftarrow \longmapsto \longleftrightarrow \Longleftrightarrow \iff

+

\cdots \hdots \vdots \ddots \imath \jmath \Vert \Vert \vert \uparrow \downarrow \Uparrow \Downarrow \Updownarrow \updownarrow \mho \clubsuit \diamondsuit \heartsuit \spadesuit \aleph \backslash \Box \langle \rangle \rmoustache \lmoustache \rgroup \lgroup \rbrace \lbrace \rceil \lceil \rfloor \lfloor \square \cong \lnot \lnot \in \prime

+

<>,.:;*?!()[]|+-/=

+

\hspace{5.0pt}\: \; \: \! \quad \qquad ~

+

\smallint \int \vee \ni \ldots \top \bot \nabla \flat \Re \infty \surd \natural \Im \hbar \ell \sharp \angle \emptyset \triangle \lnot \wp \partial

+

\alpha =\beta and +\gamma =\delta and \phi =\psi ; +and 0\ne \infty

+
+Mathaccents +

HAT: \hat{a} \acute{b} \bar{c} \dot{d} \breve{e} \check{f} \grave{g} \vec{h} +\ddot{k} \tilde{l}a\rightarrow b\longrightarrow c

+

ACUTE: \acute{x} \bar{x} \breve{x} \check{x} +\ddddot{x} \dddot{x} \ddot{x} \dot{x} +\grave{x} \hat{x} \mathring{x} \tilde{x} +\vec{x} \widehat{xyz} \widetilde{xyz}

+

WIDETILDE: \widetilde{abc} \widehat{abc} \overleftarrow{abc} \overrightarrow{abc} +\overline{abc} \underline{abc} \overbrace{abc} \underbrace{abc} +\underleftarrow{abc} \underrightarrow{abc} +

+
+Commands +

\min _xf(x) >\operatorname{dmin}_xf(x). + +\min _xf(x) >\operatornamewithlimits{dmin}_xf(x).

+

\overline{foo}\underline{bar} +\stackrel{j}{\longrightarrow } +\overset{*}{X} \underset{*}{X} +\overbrace{xyz} +\underbrace{xyz} +\frac{abc}{xyz} \dfrac{abc}{xyz} \tfrac{abc}{xyz} +\sqrt{abc} \@root n \of {abc} \@root n \of {abc}

+

\bigl [\frac{1}{a^2}\bigr [ +\left[\frac{1}{b^2}\right[ +[\frac{1}{x^2}[

+\genfrac{}{}{}{}{1}{2} +\genfrac[]{2.0pt}2{aaa}{bbb} +\genfrac(){0.0pt}0{n}{m} + +

a\nonscript \,b_{c\nonscript \,d} a\nonscript \,b_{\textstyle c\nonscript \,d}

+\mathchoice{a}{b}{c}{d}= \frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}} = +1_{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} = 2^ {\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} +

\mathchoice{a}{b}{c}{d}= \frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}} = +1_{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} = 2^ {\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}}

+

{\frac{1}{2}}{x\displaystyle \frac{1}{2}} +{x\textstyle \frac{1}{2}}{x\scriptstyle \frac{1}{2}}{x\scriptscriptstyle \frac{1}{2}} \qquad {x\displaystyle a}+{x\textstyle a}+{x\scriptstyle a}+{x\scriptscriptstyle a}\qquad \frac{x\displaystyle a}{x\textstyle b}+\frac{x\scriptstyle a}{x\scriptscriptstyle b}

+
+Environments + +Other + +\begin{aligned} +x^2+y^2&=1 & 1 &=X^2+Y^2\\ +x &=0.01& 0.001&=X +\end{aligned} + + +\sin =\cos \\ +\multicolumn{a}{b}{c}\\ +\multicolumn{1}{r}{\cos }\\ +\multicolumn{1}{l}{\sin }\\ +1+2 + +ccaaAbbBaa\beta A\hbox{aaB $\alpha C$} D +

AB

+ A\hbox{B $C$} D +

a+b a\mathbin +b

+ 0=1 + 0=2 + 0=3 + 0=4 + 0 = 5 + +\begin{split} +(a+b)^4 &= (a+b)^ 2 (a+b)^2 \\ +&= (a^2+2ab+b^2)(a^2+2ab+b^2) \\ +&= a^4+4a^3b+6a^2b^2+4ab^3+b^4 \\ +\end{split} + + +\begin{aligned} +(a+b)^4 &= (a+b)^ 2 (a+b)^2 \\ +&= (a^2+2ab+b^2)(a^2+2ab+b^2) \\ +&= a^4+4a^3b+6a^2b^2+4ab^3+b^4 \\ +\end{aligned} + + +x^2+y^2&=1\\ x&=\sqrt{1-y^2} + + +x & \ll & y_{1} + \cdots + y_{n} \\ +& \le &z + + +x & = &17y \\ +y & > & a + b + c+d+e+f+g+h+i+j+ \nonumber \\ +& & k+l+m+n+o+p + +EQ1 +

etc

+EQ2 +

etc

+EQ3 + +u& \equiv v+1 \mod {n^2} \\ +u& \equiv v+1 \bmod {n^2} \\ +u& = v+1 \pmod {n^2} \\ +u& = v+1 \hspace{10.0pt}(n^2) \\ + +\frac{1}{2} \dfrac{1}{2} \tfrac{1}{2} \qquad {}^{\frac{1}{2} \dfrac{1}{2} \tfrac{1}{2}} +\frac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tfrac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dfrac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}} +

\bar{\dot{\rm o}} +a - b – c — d

+\binom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\qquad {}^{\binom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}} +a\over {b\over c} + +

x^{\prime } x^{\prime \prime } x^{\prime \prime \prime } x^{\prime \prime \prime \prime } u_2^{\prime } v^{\prime 3}_4

+

\min _xf(x) >\operatorname{dmin}_xf(x).

+

\min _xf(x) >\mathmo{dmin}\mathattribute{form}{prefix}\mathattribute{movablelimits}{true}_xf(x).

+\begin{split} +\mathtt {Aa}\mathcal {A}\mathbf {Aa}\mathrm {Aa} +\mathit {Aa}\mathbb {A}\mathsf {Aa}\mathnormal {Aa} &\mathtt {Bb}\mathcal {B}\mathbf {Bb}\mathrm {Bb} +\mathit {Bb}\mathbb {B}\mathsf {Bb}\mathnormal {Bb}\\ +\mathtt {Cc}\mathcal {C}\mathbf {Cc}\mathrm {Cc} +\mathit {Cc}\mathbb {C}\mathsf {Cc}\mathnormal {Cc} &\mathtt {Dd}\mathcal {D}\mathbf {Dd}\mathrm {Dd} +\mathit {Dd}\mathbb {D}\mathsf {Dd}\mathnormal {Dd}\\ +\mathtt {Ee}\mathcal {E}\mathbf {Ee}\mathrm {Ee} +\mathit {Ee}\mathbb {E}\mathsf {Ee}\mathnormal {Ee} &\mathtt {Ff}\mathcal {F}\mathbf {Ff}\mathrm {Ff} +\mathit {Ff}\mathbb {F}\mathsf {Ff}\mathnormal {Ff}\\ +\mathtt {Gg}\mathcal {G}\mathbf {Gg}\mathrm {Gg} +\mathit {Gg}\mathbb {G}\mathsf {Gg}\mathnormal {Gg} &\mathtt {Hh}\mathcal {H}\mathbf {Hh}\mathrm {Hh} +\mathit {Hh}\mathbb {H}\mathsf {Hh}\mathnormal {Hh}\\ +\mathtt {Ii}\mathcal {I}\mathbf {Ii}\mathrm {Ii} +\mathit {Ii}\mathbb {I}\mathsf {Ii}\mathnormal {Ii} &\mathtt {Jj}\mathcal {J}\mathbf {Jj}\mathrm {Jj} +\mathit {Jj}\mathbb {J}\mathsf {Jj}\mathnormal {Jj}\\ +\mathtt {Kk}\mathcal {K}\mathbf {Kk}\mathrm {Kk} +\mathit {Kk}\mathbb {K}\mathsf {Kk}\mathnormal {Kk} &\mathtt {Ll}\mathcal {L}\mathbf {Ll}\mathrm {Ll} +\mathit {Ll}\mathbb {L}\mathsf {Ll}\mathnormal {Ll}\\ +\mathtt {Mm}\mathcal {M}\mathbf {Mm}\mathrm {Mm} +\mathit {Mm}\mathbb {M}\mathsf {Mm}\mathnormal {Mm} &\mathtt {Nn}\mathcal {N}\mathbf {Nn}\mathrm {Nn} +\mathit {Nn}\mathbb {N}\mathsf {Nn}\mathnormal {Nn}\\ +\mathtt {Oo}\mathcal {O}\mathbf {Oo}\mathrm {Oo} +\mathit {Oo}\mathbb {O}\mathsf {Oo}\mathnormal {Oo} &\mathtt {Pp}\mathcal {P}\mathbf {Pp}\mathrm {Pp} +\mathit {Pp}\mathbb {P}\mathsf {Pp}\mathnormal {Pp}\\ +\mathtt {Qq}\mathcal {Q}\mathbf {Qq}\mathrm {Qq} +\mathit {Qq}\mathbb {Q}\mathsf {Qq}\mathnormal {Qq} &\mathtt {Rr}\mathcal {R}\mathbf {Rr}\mathrm {Rr} +\mathit {Rr}\mathbb {R}\mathsf {Rr}\mathnormal {Rr}\\ +\mathtt {Ss}\mathcal {S}\mathbf {Ss}\mathrm {Ss} +\mathit {Ss}\mathbb {S}\mathsf {Ss}\mathnormal {Ss} &\mathtt {Tt}\mathcal {T}\mathbf {Tt}\mathrm {Tt} +\mathit {Tt}\mathbb {T}\mathsf {Tt}\mathnormal {Tt}\\ +\mathtt {Uu}\mathcal {U}\mathbf {Uu}\mathrm {Uu} +\mathit {Uu}\mathbb {U}\mathsf {Uu}\mathnormal {Uu} &\mathtt {Vv}\mathcal {V}\mathbf {Vv}\mathrm {Vv} +\mathit {Vv}\mathbb {V}\mathsf {Vv}\mathnormal {Vv}\\ +\mathtt {Ww}\mathcal {W}\mathbf {Ww}\mathrm {Ww} +\mathit {Ww}\mathbb {W}\mathsf {Ww}\mathnormal {Ww} &\mathtt {Xx}\mathcal {X}\mathbf {Xx}\mathrm {Xx} +\mathit {Xx}\mathbb {X}\mathsf {Xx}\mathnormal {Xx}\\ +\mathtt {Yy}\mathcal {Y}\mathbf {Yy}\mathrm {Yy} +\mathit {Yy}\mathbb {Y}\mathsf {Yy}\mathnormal {Yy} &\mathtt {Zz}\mathcal {Z}\mathbf {Zz}\mathrm {Zz} +\mathit {Zz}\mathbb {Z}\mathsf {Zz}\mathnormal {Zz}\\ +\end{split} + +

{\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ}

+

\bf a \mathrm {a \mathcal {c} d}

+

a^c_b +a_b^c

+

x\Box

+\left| +\begin{array}{lcr} +AAAAAAA&BBBBBCC&CCCCCCC\\ +A&B&C\\ +\multicolumn{1}{c}{A}&\multicolumn{1}{c}{B}&\multicolumn{1}{c}{C}\\ +\multicolumn{1}{r}{A}&\multicolumn{1}{r}{B}&\multicolumn{r}{c}{C}\\ +\multicolumn{1}{l}{A}&\multicolumn{1}{l}{B}&\multicolumn{l}{c}{C}\\ +\begin{array}{cl}1&22\\3&4\end{array}&\begin{array}{cc}1&22\\3&4\end{array}&\begin{array}{cr}1&22\\3&4\end{array}\\ +\multicolumn{2}{c}{0123456789abcdef}&C\\ +A&\multicolumn{2}{c}{0123456789abcdef}\\ +\multicolumn{2}{r}{0123456789abcdef}&C\\ +A&\multicolumn{2}{l}{0123456789abcdef}\\ +A&B&C\\ +\end{array} +\right| + +\left\lbrace \begin{array}{lcl} +\dot{x} & = & Ax+g(x,u)\\ +y & = & Cx \\ +\multicolumn{3}{l}{x\in \mathbf {R}^n} +\end{array} +\right. + +

a) x1 +b) x2 +c)

+ x3 +

d)

+ x4 +

e)

+ x5 +

text A

+

text B

+

text C

+

line one

+

this is the second line

+

1^efoobar.

+

1^efoobar. +FooBar

+ +\begin{array}{lcl} +\dot{x} & = & Ax+g(x,u)\\[2mm] +y & = & Cx \\ +\multicolumn{3}{l}{x\in R^n} +\end{array} + +a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F + + + + + + + + + +aaa +bbb +ccc +ddd +eee +fff +
+ \arccos ^2 (x),\, \arcsin ^2(x) ,\, \arctan ^2(x) ,\, \arg ^2(x),\, +\cos ^2(x) ,\, \cosh ^2(x) ,\, \cot ^2(x) + \coth ^2(x) ,\, \csc ^2(x),\, \deg ^2(x),\, \dim ^2(x),\, \exp ^2(x),\, +\hom ^2(x),\, \ker ^2(x) ,\, \lg ^2(x) + \ln ^2(x),\, \log ^2(x),\, \Pr ^2(x),\, \sec ^2(x),\, \sin ^2(x) ,\, +\sinh ^2(x),\, \tan ^2(x),\, \tanh ^2(x) + \det _{x=1},\, \gcd _{x=1},\, \inf _{x=1},\, \injlim _{x=1},\, +\lim _{x=1},\, \liminf _{x=1},\,\limsup _{x=1},\, +\max _{x=1},\, \min _{x=1},\, \projlim _{x=1},\, \sup _{x=1} + +

\stackrel{j}{\longrightarrow } \overset{*}{X} \underset{*}{X} +\sqrt{abc} \@root n \of {abc} \@root n \of {abc} +\frac{abc}{xyz} \dfrac{abc}{xyz} +

+\binom{\frac{n+m}{2}}{n} \quad \tbinom{\frac{n+m}{2}}{n} \quad \dbinom{\frac{n+m}{2}}{n}\qquad {}^{\binom{\frac{n+m}{2}}{n} \quad \tbinom{\frac{n+m}{2}}{n} \quad \dbinom{\frac{n+m}{2}}{n}} +

\Leftrightarrow

+

1st xième ysome text.

+\genfrac{}{}{}{}{1}{2} +\genfrac[]{2.0pt}2{aaa}{bbb} +\genfrac(){0.0pt}0{n}{m} + +

\genfrac{}{}{}0{a}{b} +\genfrac{}{}{}1{a}{b} +\genfrac{}{}{}2{a}{b} +\genfrac{}{}{}3{a}{b}

+

{a\over b}\quad {a\above 1pt b}\quad {a\atop b} +{a\overwithdelims () b}\quad {a\abovewithdelims ()1pt b}\quad {a\atopwithdelims () b} +\genfrac(){2.0pt}{}{foo}{bar}

+\frac{\frac{n+m}{2}}{n} \quad \tfrac{\frac{n+m}{2}}{n} \quad \dfrac{\frac{n+m}{2}}{n} + +\sup _{x=2}y~ +\frac{1}{k}\log _2 c(f)\; +\tfrac{1}{k}\log _2 c(f)\; +\sqrt{\frac{1}{k}\log _2 c(f)}\; +\sqrt{\dfrac{1}{k}\log _2 c(f)} + +

\genfrac(){2.84526pt}3{aaaaaaaaaaaaaaaaaa}{111111111} +\genfrac(){0.0pt}3{aaaaaaaaaaaaaaaaaa}{111111111} +\genfrac{}{}{}0{abc}{def} +\genfrac{}{}{}1{abc}{def} +\genfrac{}{}{}2{abc}{def} +\genfrac{}{}{}3{abc}{def}

+

\tilde{a},\tilde{z}, \tilde{a+b}

+

\overline{\tt P} P

+

á ááá á á á +\hat{a} \acute{a} \bar{a} \dot{a} \breve{a} +\check{a} \grave{a} \vec{a} \ddot{a} \tilde{a} +

+d=z^2=( I_t + \nabla I\vec{vvvv} +I div(\vec{vvvvv}) )^2, +

a\hbox{b=1} c +a\hbox{b~1}~c

+

x^{y^\epsilon _\varepsilon }

+ +\vec{B}(\vec{r}) = \frac{\mu _0}{4\pi }\left\lbrace +\frac{3\vec{m}({\vec{r}}^{\prime })\cdot (\vec{r}-{\vec{r}}^{\prime })}{|\vec{r}-{\vec{r}}^{\prime }|^5} +(\vec{r}-{\vec{r}}^{\prime }) - \frac{\vec{m}({\vec{r}}^{\prime })}{|\vec{r}-{\vec{r}}^{\prime }|^3} +\right\rbrace . + +

+ +\left\Vert \left|\left[\left(\left\lbrace \frac{x^1_2}{y^3_4}\right\rbrace \right)\right]\right|\right\Vert \left|\left|\left<\left\langle \frac{x^1_2}{y^3_4}\right\rangle \right>\right|\right|\left\lbrace \left\lceil \left\lfloor \frac{x^1_2}{y^3_4}\right\rfloor \right\rceil \right\rbrace []a\hspace{0.55542pt}b\hspace{1.111pt}c \hspace{2.22214pt}d \hspace{4.44443pt}e \hspace{8.88885pt}f +

+

+\left\moustache \left\uparrow \left\Uparrow \left\updownarrow \left\lgroup \frac{x^1_2}{y^3_4}\right\rgroup \right\Updownarrow \right\Downarrow \right\downarrow \right\moustache + +\left \lmoustache \left \uparrow \left \Uparrow \left \updownarrow \left \lgroup \frac{x^1_2}{y^3_4}\right \rgroup \right \Updownarrow \right \Downarrow \right \downarrow \right \rmoustache + +\left\moustache \left\uparrow \left\Uparrow \left\updownarrow \left\lgroup \int _0^{\frac{x^1_2}{y^3_4}}\right\rgroup \right\Updownarrow \right\Downarrow \right\downarrow \right\moustache

+

\Longrightarrow + +\cal X_yand \cal X_yZ +\sin (x) + \cos ^2(x) and \overbrace{xyz} ^t

+

\bigl [\frac{1}{a^2}\bigr [ +\left[\frac{1}{b^2}\right[ +[\frac{1}{x^2}[

+

\int f\mathopen )a+b\mathclose (=c+d +\int f(a+b)=c+d

+

a\limits \displaylimits \nolimits b

+

wwwwwwwwwwwwa...b...c   d      e f$g%h&ij k{l}mın♯o♮p♭q_

+

a\dots b\ldots c\quad d\qquad e f\$g\%h\&i\!j\,k\lbrace l\rbrace m\i n\sharp o\natural p\flat q\_

+

Math spacing

+

xxxxx

+

x\,x\:x\;x\!x

+

a\,\,\,\,\,a\:\:\:\:\:a

+

a\;\;\;a\;\;\;\;a

+

!?\#\_.@\%\Vert /|

+ +\mathop {\mathop {arg\,min}\nolimits _\Psi }\limits _{\theta \in \Theta } +\Delta \left( {\mathop \Phi \nolimits _\theta \left( {\Omega _s } +\right)-\Omega _t } \right) +\qquad x_{y_z} = {x_y}_z= +x^{y_z} = {x^y}_z= +x_{y^z} = {x_y}^z= +x^{y^z} = {x^y}^z +\left\lbrace \lbrace \frac{2}{3}\rbrace \right\rbrace + +

x=0123456789 +\@root 3 \of {4} \@root 3 \of {4}

+ +0=\hspace{11.38092pt}1 + +

 â Ấ ấ Ầ ầ Ẩ ẩ Ẫ ẫ +Ậ ậ Ĉ ĉ + Ê ê Ế ế Ề ề Ể +ể Ễ ễ Ệ ệ Ĝ ĝ Ĥ ĥ Î î Ĵ ĵ + +Ô ô Ố ố Ồ ồ Ổ ổ Ỗ ỗ +Ộ ộ Ŝ ŝ Û û Ŵ ŵ Ŷ ŷ Ẑ ẑ +Á á Ǻ ǻ Ǽ ǽ Ấ ấ Ắ ắ +Ć ć Ḉ ḉ É é Ḗ +ḗ Ế ế Ǵ ǵ Í í +Ḯ ḯ Ḱ ḱ Ĺ ĺ Ḿ +ḿ Ń ń Ó ó Ǿ ǿ Ṍ ṍ Ṓ ṓ Ố +ố Ớ ớ + Ṕ ṕ Ŕ ŕ Ś ś +Ṥ ṥ Ú ú Ǘ ǘ Ṹ ṹ Ứ ứ +Ẃ ẃ Ý ý Ź ź +À à Ầ ầ Ằ ằ È è Ḕ ḕ Ề +ề Ì ì Ǹ ǹ +Ò ò Ṑ ṑ Ồ ồ +Ờ ờ Ù ù Ǜ ǜ Ừ ừ Ẁ ẁ Ỳỳ +Ä ä Ǟ ǟ Ë ë Ḧ ḧ Ï ï Ḯ ḯ Ö ö +Ȫ ȫ Ṏ ṏ ẗ + Ü ü Ṻ ṻ Ǜ ǜ +Ǘ ǘ Ǚ ǚ Ẅ ẅ Ẍ ẍ Ÿ ÿ +Ç ç Ḉ ḉ Ḑ ḑ Ȩ ȩ Ḝ ḝ + +Ḩ ḩ Ģ ģ Ķ ķ Ļ ļ Ņ ņ Ŗ ŗ Ş ş Ţ ţ +Ȁ ȁ Ȅ ȅ Ȉ ȉ Ȍ ȍ Ȑ ȑ Ȕ ȕ +Ă ă Ằ ằ Ắ ắ Ẳ ẳ Ẵ ẵ +Ặ ặ + Ĕ ĕ Ḝ ḝ Ğ ğ Ĭ ĭ +Ŏ ŏ Ŭ ŭ +Ǎ ǎ Č č Ď ď Ě ě Ǧ ǧ Ȟ ȟ Ǩ ǩ +Ǐ ǐ ǰ Ľ ľ Ň ň + Ǒ +ǒ Ř ř Š š Ť ť Ǔ ǔ Ǚ ǚ Ṧ +ṧ Ž ž +Ő ő Ű ű + +Ớ ớ Ờ ờ Ở ở Ỡ ỡ +Ợ ợ + Ứ ứ Ừ ừ Ử ử Ữ +ữ Ự ự +Ả ả Ẩ ẩ Ẳ ẳ Ẻ ẻ Ể ể Ỉ +ỉ + Ỏ ỏ Ổ ổ Ở ở Ủ ủ +Ử ử Ỷ ỷ +Ą ą Ę ę Į į Ǫ ǫ Ǭ ǭ Ų ų +Å å Ů ů ẘ ẙ +Ạ ạ Ậ ậ Ặ ặ Ḅ ḅ Ḍ ḍ Ẹ ẹ +Ệ ệ Ḥ ḥ Ị ị Ḳ ḳ Ḷ ḷ Ḹ ḹ + +Ṃ ṃ Ṇ ṇ Ọ ọ Ộ ộ Ợ ợ +Ṛ ṛ Ṝ ṝ Ṣ ṣ Ṩ ṩ Ṭ + +ṭ Ụ ụ Ự ự Ṿ +ṿ Ẉ ẉ Ỵ ỵ Ẓ ẓ +Ḁ ḁ +Ḇ ḇ Ḏ ḏ ẖ Ḵ ḵ Ḻ ḻ +Ṉ ṉ Ṟ ṟ Ṯ ṯ Ẕ ẕ +Ȃ ȃ Ȇ ȇ Ȋ ȋ Ȏ ȏ Ȓ ȓ Ȗ ȗ +Ḛ ḛ Ḭ ḭ Ṵ ṵ +Ḓ ḓ Ḙ ḙ Ḽ ḽ Ṋ ṋ Ṱ ṱ Ṷ ṷ +Ā ā Ǟ ǟ Ǡ ǡ ǢǣĒ ē Ḗ ḗ +Ḕ ḕ Ḡ ḡ Ħ ħ + +Ī ī Ḹ ḹ Ō ō Ǭ ǭ Ȫ ȫ Ȭ +ȭ Ȱ ȱ Ṑ ṑ Ṓ ṓ + Ṝ ṝ +Ŧ ŧ Ū ū Ṻ ṻ Ȳ ȳ +Ȧ ȧ Ǡ ǡ Ḃ ḃ Ċ ċ Ḋ ḋ Ė ė Ḟ ḟ Ġ ġ Ḣ +ḣ İ +Ŀ ŀ Ṁ ṁ Ṅ ṅ Ȯ ȯ Ȱ ȱ Ṗ ṗ Ṙ ṙ + +Ṡ +ṡ Ṩ ṩ Ṧ ṧ Ṥ ṥ Ṫ ṫ Ẇ ẇ Ẋ +ẋ Ẏ ẏ Ż ż +

+

B

+

\mml@font@normal ab+2c=DE\mml@font@upright ab+2c=DE\mml@font@bold ab+2c=DE\mml@font@italic ab+2c=DE\mml@font@bolditalic ab+2c=DE\mml@font@script ab+2c=DE\mml@font@boldscript ab+2c=DE\mml@font@fraktur ab+2c=DE\mml@font@doublestruck ab+2c=DE\mml@font@boldfraktur ab+2c=DE\mml@font@sansserif ab+2c=DE\mml@font@boldsansserif ab+2c=DE\mml@font@sansserifitalic ab+2c=DE\mml@font@sansserifbolditalic ab+2c=DE\mml@font@monospace ab+2c=DE

+

Xx\mathcal {Cal}\mathrm {Rm}\mathbf {Bf}\mathsf {Sf}\mathtt {Tt}\mathtt {x}\mathtt {y+1}\mathnormal {No} \mathit {It}\mathfrak {Fr} +Xx\mathcal {Cal}\mathrm {Rm}\mathbf {Bf}\mathsf {Sf}\mathtt {Tt}\mathtt {x}\mathtt {y+1}\mathnormal {No} \mathit {It}\mathfrak {Fr} + +\frac{\mathit {\mathbf {foo}}}{\mathrm {bar}+1}=3 + +a\text{b=1} c

+

oooooooooooooo +a\myhbox{b=1} c +a\text{b=1} c +a\mbox{b=1} c +a\hbox{b=1} c

+

a\mbox{b=1} c

+

\begin{pmatrix} +\binom{1}{2}&\int _0^\infty f(x)dx\\[2cm] +\mathfrak {W}_2&\text{xyz}=\sqrt{xxyyzz} +\end{pmatrix}

+

signal \bar{x }\in \mathcal {F} (y ) with smallest support.

+

\mbox{(\ref {W102})}=(\ref {W102})=\mbox{(\ref {W102})}

+ +a & = & b \\ +& = & c +\mbox{by (\ref {eqn:main2})} +1234 +

Non math version +Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

{}\left\lbrace \begin{array}{ll} 2 h(n) &\text{ for $0 \le n \le N/2-1$ }\\0 &\text{ otherwise }\\\end{array}\right.

+x +\rm \binom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \tbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \dbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}}\qquad {}^{\binom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \tbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \dbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}}} +

Additional tests +\hspace{20.0pt}, \hspace*{56.9055pt} 12>10\,\$ +\left[\mathit {x}^1_2 y^{22}_{33}\right\lbrace +\overline{x}\frac{1}{2} \mathmi[A='B']{c} +\genfrac{}{}{2.0pt}3{u}{v} \genfrac[]{}{}{u}{v} +\sqrt{10} \@root 3 \of {4} \@root 6 \of {7} +If x\in \emptyset then \forall n>0, \dfrac{1}{n^2}<0

+

Kumar test +x_{\mbox{{\scriptsize {H\,{\sc i}}}}} +x_{\mbox{{\scriptsize {H\,\quad \qquad \!\,\:\;{\sc i}}}}} +Testing references +a\mbox{b=1} c + + +\varPi =\varPsi

+ 123&34\\56&78 + 123&34\\56&78 + 123&34\\56&78 + 123&34\\56&78 +23&34\\56&78 +23&34\\56&78 +23&34\\56&78 +23&34\\56&78 +23&34\\56&78 +23&34\\56&78 +

+ok

+

AT_DOC_END

+
diff --git a/thirdparty/tralics-2.15.2/Modele/tormath1.xml b/thirdparty/tralics-2.15.2/Modele/tormath1.xml new file mode 100644 index 0000000..6ff6d03 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tormath1.xml @@ -0,0 +1,293 @@ + + + + +

DOCSTART

+x6 +simple math +

+

ıj$_&{}%...# += + + +abcdefghijklmnopqrstuvwxyz +ABCDEFGHIJKLMNOPQRSTUVWXYZ +<>,?;./:+=- " ' ()§!` ' " +aà

+

αβγδϵϵζηθικλμνξπρστυϕχψωϖϱςφϰϑ +ΓΔΘΛΞΣϒΦΠΨΩ

+

+

arccosarcsinarctanargcoscoshcotcothcscdegdim +exphomkerlglnlogPrsecsinsinhtantanhdetgcd +infinj limlimlim inflim supmaxminproj limsup

+

+

+

⨿÷±·*×

+

¬

+

ıȷ|}{¬¬'

+

<>,.:;*?!()[]|+-/=

+

+

...¬

+

α=β and +γ=δ and ϕ=ψ; +and 0

+
+Mathaccents +

HAT:a ^b ´c d ˙e ˘f ˇg `h k ¨l ˜abc

+

ACUTE:x ´x x ˘x ˇx x x ¨x ˙x `x ^x ˚x ˜x xyz ^xyz ˜

+

WIDETILDE:abc ˜abc ^abc abc abc abc _abc abc abc abc

+
+Commands +

min x f(x)>dmin x f(x). + +min x f(x)>dmin x f(x).

+

foo bar _ + j +X *X * +xyz +xyz +abc xyzabc xyzabc xyz +abcabc nabc n

+

1 a 2 +1 b 2 +[1 x 2 [

+1 2aaa bbbn m +

ab cd ab cd

+a=b b=1 cd d =2 cd d +

b=c c=1 cd d =2 cd d

+

1 2x1 2x1 2x1 2x1 2xa+xa+xa+xaxa xb+xa xb

+
+Environments + +Other +x 2 +y 2 =11=X 2 +Y 2 x=0.010.001=X +sin=cosccossin1+2 +ccaaAbbBaaβAaaBαCD +

AB

+ABCD +

a+b a+b

+0=1 +0=2 +0=3 +0=4 +0=5 +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +x 2 +y 2 =1x=1-y 2 +xy 1 ++y n z +x=17yy>a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p +EQ1 +

etc

+EQ2 +

etc

+EQ3 +uv+1modn 2 uv+1modn 2 u=v+1(modn 2 )u=v+1(n 2 ) +1 21 21 2 1 21 21 2 +bc+m 2 bcd+m 2 cbc+m 2 b +

o ˙ +a - b – c — d

+c+m 2 bd+m 2 cc+m 2 b d+m 2 dd+m 2 cc+m 2 b +a b c +

x ' x '' x ''' x '''' u 2 ' v 4 '3

+

min x f(x)>dmin x f(x).

+

min x f(x)>dmin x f(x).

+𝙰𝚊𝒜𝐀𝐚 Aa 𝐴𝑎𝔸𝖠𝖺Aa𝙱𝚋𝐁𝐛 Bb 𝐵𝑏𝔹𝖡𝖻Bb𝙲𝚌𝒞𝐂𝐜 Cc 𝐶𝑐𝖢𝖼Cc𝙳𝚍𝒟𝐃𝐝 Dd 𝐷𝑑𝔻𝖣𝖽Dd𝙴𝚎𝐄𝐞 Ee 𝐸𝑒𝔼𝖤𝖾Ee𝙵𝚏𝐅𝐟 Ff 𝐹𝑓𝔽𝖥𝖿Ff𝙶𝚐𝒢𝐆𝐠 Gg 𝐺𝑔𝔾𝖦𝗀Gg𝙷𝚑𝐇𝐡 Hh 𝐻ℎ𝖧𝗁Hh𝙸𝚒𝐈𝐢 Ii 𝐼𝑖𝕀𝖨𝗂Ii𝙹𝚓𝒥𝐉𝐣 Jj 𝐽𝑗𝕁𝖩𝗃Jj𝙺𝚔𝒦𝐊𝐤 Kk 𝐾𝑘𝕂𝖪𝗄Kk𝙻𝚕𝐋𝐥 Ll 𝐿𝑙𝕃𝖫𝗅Ll𝙼𝚖𝐌𝐦 Mm 𝑀𝑚𝕄𝖬𝗆Mm𝙽𝚗𝒩𝐍𝐧 Nn 𝑁𝑛𝖭𝗇Nn𝙾𝚘𝒪𝐎𝐨 Oo 𝑂𝑜𝕆𝖮𝗈Oo𝙿𝚙𝒫𝐏𝐩 Pp 𝑃𝑝𝖯𝗉Pp𝚀𝚚𝒬𝐐𝐪 Qq 𝑄𝑞𝖰𝗊Qq𝚁𝚛𝐑𝐫 Rr 𝑅𝑟𝖱𝗋Rr𝚂𝚜𝒮𝐒𝐬 Ss 𝑆𝑠𝕊𝖲𝗌Ss𝚃𝚝𝒯𝐓𝐭 Tt 𝑇𝑡𝕋𝖳𝗍Tt𝚄𝚞𝒰𝐔𝐮 Uu 𝑈𝑢𝕌𝖴𝗎Uu𝚅𝚟𝒱𝐕𝐯 Vv 𝑉𝑣𝕍𝖵𝗏Vv𝚆𝚠𝒲𝐖𝐰 Ww 𝑊𝑤𝕎𝖶𝗐Ww𝚇𝚡𝒳𝐗𝐱 Xx 𝑋𝑥𝕏𝖷𝗑Xx𝚈𝚢𝒴𝐘𝐲 Yy 𝑌𝑦𝕐𝖸𝗒Yy𝚉𝚣𝒵𝐙𝐳 Zz 𝑍𝑧𝖹𝗓Zz +

𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵

+

𝐚a𝒸d

+

a b c +a b c

+

x

+AAAAAAABBBBBCCCCCCCCCABCABCABCABC1223412234122340123456789abcdefCA0123456789abcdef0123456789abcdefCA0123456789abcdefABC +x ˙=Ax+g(x,u)y=Cxx𝐑 n +

a) x1 +b) x2 +c)

+x3 +

d)

+x4 +

e)

+x5 +

text A

+

text B

+

text C

+

line one

+

this is the second line

+

1efoobar.

+

1efoobar. +FooBar

+x ˙=Ax+g(x,u)y=CxxR n +a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F + + + + + + + + + +aaa +bbb +ccc +ddd +eee +fff +
+arccos 2 (x),arcsin 2 (x),arctan 2 (x),arg 2 (x),cos 2 (x),cosh 2 (x),cot 2 (x) +coth 2 (x),csc 2 (x),deg 2 (x),dim 2 (x),exp 2 (x),hom 2 (x),ker 2 (x),lg 2 (x) +ln 2 (x),log 2 (x),Pr 2 (x),sec 2 (x),sin 2 (x),sinh 2 (x),tan 2 (x),tanh 2 (x) +det x=1 ,gcd x=1 ,inf x=1 ,inj lim x=1 ,lim x=1 ,lim inf x=1 ,lim sup x=1 ,max x=1 ,min x=1 ,proj lim x=1 ,sup x=1 +

jX *X *abcabc nabc nabc xyzabc xyz

+n+m 2 nn+m 2 nn+m 2 n n+m 2 nn+m 2 nn+m 2 n +

+

1st xième ysome text.

+1 2aaa bbbn m +

a ba ba ba b

+

a ba ba b +a ba ba b +foo bar

+n+m 2 nn+m 2 nn+m 2 n +sup x=2 y1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f) +

aaaaaaaaaaaaaaaaaa 111111111 +aaaaaaaaaaaaaaaaaa 111111111 +abc def +abc def +abc def +abc def

+

a ˜,z ˜,a+b ˜

+

𝙿 P

+

á ááá á á á +a ^a ´a a ˙a ˘a ˇa `a a ¨a ˜

+d=z 2 =(I t +Ivvvv +Idiv(vvvvv )) 2 , +

ab=1c +ab1c

+

x y ϵ ϵ

+B (r )=μ 0 4π3m (r ' )·(r -r ' ) |r -r ' | 5 (r -r ' )-m (r ' ) |r -r ' | 3 . +

x 2 1 y 4 3 x 2 1 y 4 3 x 2 1 y 4 3 []abcdef

+

x 2 1 y 4 3 +x 2 1 y 4 3 + 0 x 2 1 y 4 3

+

+ +𝒳 𝓎 and 𝒳 𝓎 𝒵 +sin(x)+cos 2 (x) and xyz t

+

1 a 2 +1 b 2 +[1 x 2 [

+

f)a+b(=c+d +f(a+b)=c+d

+

ab

+

wwwwwwwwwwwwa...b...c   d      e f$g%h&ij k{l}mın♯o♮p♭q_

+

ab...cdef$g%h&ijk{l}mınopq_

+

Math spacing

+

xxxxx

+

xxxxx

+

aaa

+

aaa

+

!?#_.@%/|

+argmin Ψ θΘ ΔΦ θ Ω s -Ω t x y z =x y z =x y z =x y z =x y z =x y z =x y z =x y z {2 3} +

x=0123456789 +4 3 4 3

+0=1 +

ÂâĈĉ +ÊêếĜĝĤĥÎîĴĵ +ÔôŜŝÛûŴŵŶŷÁáǺǻǼǽĆćÉéếǴǵÍí +ĹĺḿŃńÓóǾǿ +ŔশÚúǗǘÝýŹźÀàÈèÌìǸǹ +ÒòÙùǛǜÄäǞǟËëÏïÖöȪȫ +ÜüǛǜǗǘǙǚŸÿÇçȨȩ +ĢģĶķĻļŅņŖŗŞşŢţȀȁȄȅȈȉȌȍȐȑȔȕĂă +ĔĕĞğĬĭŎŏŬŭǍǎČčĎďĚěǦǧȞȟǨǩǏǐǰĽľŇň +ǑǒŘřŠšŤťǓǔǙǚŽžŐőŰű + + +ĄąĘęĮįǪǫǬǭŲųÅåŮů + +ṿȂȃȆȇȊȋȎȏȒȓȖȗĀāǞǟǠǡǢǣĒēĦħ +ĪīŌōǬǭȪȫȬȭȰȱ +ŦŧŪūȲȳȦȧǠǡĊċĖėĠġİ +ĿŀȮȯȰȱ +Żż

+

B

+

ab+2c=DE ab +2c= DE 𝐚𝐛+2𝐜=𝐃𝐄𝑎𝑏+2𝑐=𝐷𝐸𝒂𝒃+2𝒄=𝑫𝑬𝒶𝒷+2𝒸=𝒟ℰ𝓪𝓫+2𝓬=𝓓𝓔𝔞𝔟+2𝔠=𝔇𝔈𝕒𝕓+2𝕔=𝔻𝔼𝖆𝖇+2𝖈=𝕯𝕰𝖺𝖻+2𝖼=𝖣𝖤𝗮𝗯+2𝗰=𝗗𝗘𝘢𝘣+2𝘤=𝘋𝘌𝙖𝙗+2𝙘=𝘿𝙀𝚊𝚋+2𝚌=𝙳𝙴

+

Xx𝒞𝒶𝓁 Rm 𝐁𝐟𝖲𝖿𝚃𝚝𝚡𝚢+1No𝐼𝑡𝔉𝔯 +𝐗𝐱𝓒𝓪𝓵 Rm 𝐁𝐟𝗦𝗳𝚃𝚝𝚡𝚢+1𝐍𝐨𝑰𝒕𝕱𝖗 + +𝐟𝐨𝐨 bar +1=3 + +𝐚b=1𝐜

+

oooooooooooooo +ab=1c +ab=1c +ab=1c +ab=1c

+

ab=1c

+

1 2 0 f(x)dx𝔚 2 xyz=xxyyzz

+

signal x (y) with smallest support.

+

()=()=()

+a=b=cby() +1234 +

Non math version +Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

2h(n)for0nN/2-10otherwise

+x +\scriptstyle+m 2 \textstyle0\scriptscriptstyle+m 2 \scriptstyle0\scriptstyle+m 2 \textstyle0 \scriptscriptstyle+m 2 \scriptscriptstyle0\scriptscriptstyle+m 2 \scriptstyle0\scriptstyle+m 2 \textstyle0 +

Additional tests +,12>10$ +𝑥 2 1 y 33 22 +x 1 2c +u vu v +104 37 6 +If x then n>0,1 n 2 <0

+

Kumar test +x Hi +x Hi +Testing references +ab=1c + + +Π=Ψ

+123345678 +123345678 +123345678 +123345678 +23345678 +23345678 +23345678 +23345678 +23345678 +23345678 +

+ok

+

AT_DOC_END

+
diff --git a/thirdparty/tralics-2.15.2/Modele/tormath2.xml b/thirdparty/tralics-2.15.2/Modele/tormath2.xml new file mode 100644 index 0000000..8066fc6 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tormath2.xml @@ -0,0 +1,523 @@ + + + + +

DOCSTART

+x6 +simple math +

+

+ ~ += +56.9055pt 569.05511pt 3.0pt4.0pt5.0pt6.0pt +-24.0pt -24.0pt -3.0pt4.0pt-5.0pt-6.0pt +abcdefghijklmnopqrstuvwxyz +ABCDEFGHIJKLMNOPQRSTUVWXYZ +<>,?;./:+=-"()!` " +ሴa

+

+

+

+

+ +

+

+

+

+

+

+

<>,.:;*?!()[]|+-/=

+

5.0pt ~

+

+

= and += and =; +and 0

+ +Mathaccents +

HAT: a b c d e f g h +k labc

+

ACUTE: x x x x +x x x x +x x x x +x xyz xyz

+

WIDETILDE: abc abc abc abc +abc abc abc abc +abc abc +

+
+Commands +

xf(x) >dminxf(x). + +xf(x) >dminxf(x).

+

foobar +j +*X *X +xyz +xyz +abcxyz abcxyz abcxyz +abc nabc n abc

+

[1a2[ +1b2 +[1x2[

+12 +aaabbb +nm + +

abcd abcd

+abcd= abcdabcd = +1abcdabcdabcd = 2 abcdabcdabcd +

abcd= abcdabcd = +1abcdabcdabcd = 2 abcdabcdabcd

+

12x12 +x12x12x12 xa+xa+xa+xaxaxb+xaxb

+
+Environments + +Other + + +x2+y2&=1 & 1 &=X2+Y2 +x &=0.01& 0.001&=X + + + += +abc +1r +1l +1+2 + +ccaaAbbBaa AaaB C D +

AB

+ AB C D +

a+b a+b

+ 0=1 + 0=2 + 0=3 + 0=4 + 0 = 5 + + +(a+b)4 &= (a+b) 2 (a+b)2 +&= (a2+2ab+b2)(a2+2ab+b2) +&= a4+4a3b+6a2b2+4ab3+b4 + + + + +(a+b)4 &= (a+b) 2 (a+b)2 +&= (a2+2ab+b2)(a2+2ab+b2) +&= a4+4a3b+6a2b2+4ab3+b4 + + + +x2+y2&=1 x&=1-y2 + + +x & & y1 + + yn +& &z + + +x & = &17y +y & > & a + b + c+d+e+f+g+h+i+j+ +& & k+l+m+n+o+p + +EQ1 +

etc

+EQ2 +

etc

+EQ3 + +u& v+1 n2 +u& v+1 n2 +u& = v+1 n2 +u& = v+1 10.0pt(n2) + +12 12 12 12 12 12 +abcdabcd+m2abcdabcdabcd+m2abcdabcdabcd+m2abcd +

o +a - b – c — d

+abcd+m2abcdabcd+m2abcdabcd+m2abcdabcd+m2abcdabcd+m2abcdabcd+m2abcd +abc + +

yx x x x u2 v34

+

xf(x) >dminxf(x).

+

xf(x) >dminformprefixmovablelimitstruexf(x).

+ +AaAAaAa +AaAAaAa &BbBBbBb +BbBBbBb +CcCCcCc +CcCCcCc &DdDDdDd +DdDDdDd +EeEEeEe +EeEEeEe &FfFFfFf +FfFFfFf +GgGGgGg +GgGGgGg &HhHHhHh +HhHHhHh +IiIIiIi +IiIIiIi &JjJJjJj +JjJJjJj +KkKKkKk +KkKKkKk &LlLLlLl +LlLLlLl +MmMMmMm +MmMMmMm &NnNNnNn +NnNNnNn +OoOOoOo +OoOOoOo &PpPPpPp +PpPPpPp +QqQQqQq +QqQQqQq &RrRRrRr +RrRRrRr +SsSSsSs +SsSSsSs &TtTTtTt +TtTTtTt +UuUUuUu +UuUUuUu &VvVVvVv +VvVVvVv +WwWWwWw +WwWWwWw &XxXXxXx +XxXXxXx +YyYYyYy +YyYYyYy &ZzZZzZz +ZzZZzZz + + +

ABCDEFGHIJKLMNOPQRSTUVWXYZ

+

a a c d

+

acb +abc

+

x

+ +lcr +AAAAAAA&BBBBBCC&CCCCCCC +A&B&C +1cA&1cB&1cC +1rA&1rB&rcC +1lA&1lB&lcC +cl1&223&4&cc1&223&4&cr1&223&4 +2c0123456789abcdef&C +A&2c0123456789abcdef +2r0123456789abcdef&C +A&2l0123456789abcdef +A&B&C + + + +lcl +x & = & Ax+g(x,u) +y & = & Cx +3lxRn + + + +

a) x1 +b) x2 +c)

+ x3 +

d)

+ x4 +

e)

+ x5 +

text A

+

text B

+

text C

+

line one

+

this is the second line

+

1efoobar.

+

1efoobar. +FooBar

+ +lcl +x & = & Ax+g(x,u)[2mm] +y & = & Cx +3lxRn + + +a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F + + + + + + + + + +aaa +bbb +ccc +ddd +eee +fff +
+ 2 (x), 2(x) , 2(x) , 2(x), +2(x) , 2(x) , 2(x) + 2(x) , 2(x), 2(x), 2(x), 2(x), +2(x), 2(x) , 2(x) + 2(x), 2(x), 2(x), 2(x), 2(x) , +2(x), 2(x), 2(x) + x=1, x=1, x=1, x=1, +x=1, x=1,x=1, +x=1, x=1, x=1, x=1 + +

j *X *X +abc nabc n abc +abcxyz abcxyz +

+n+m2n n+m2n n+m2nn+m2n n+m2n n+m2n +

+

1st xime ysome text.

+12 +aaabbb +nm + +

ab +ab +ab +ab

+

aba1pt bab +a() ba()1pt ba() b +foobar

+n+m2n n+m2n n+m2n + +x=2y~ +1k2 c(f) +1k2 c(f) +1k2 c(f) +1k2 c(f) + +

aaaaaaaaaaaaaaaaaa111111111 +aaaaaaaaaaaaaaaaaa111111111 +abcdef +abcdef +abcdef +abcdef

+

a,z, a+b

+

P P

+

á á +a a a a a +a a a a a +

+d=z2=( It + Ivvvv +I div(vvvvv) )2, +

ab=1 c +ab~1~c

+

xy

+ +B(r) = 04 +3m(r)(r-r)|r-r|5 +(r-r) - m(r)|r-r|3 +. + +

+ + x12y34x12y34x12y34[]a0.55542ptb1.111ptc 2.22214ptd 4.44443pte 8.88885ptf +

+

+x12y34 + +x12y34 + +0x12y34

+

+ +Xyand XyZ +(x) + 2(x) and xyz t

+

[1a2[ +1b2 +[1x2[

+

f)a+b(=c+d +f(a+b)=c+d

+

ab

+

wwwwwwwwwwwwa...b...cde f$g%h&ijk{l}mın♯o♮p♭q_

+

abcde fghijklmnopq

+

Math spacing

+

xxxxx

+

xxxxx

+

aaa

+

aaa

+

!?.@/|

+ +argmin + s +-t +xyz = xyz= +xyz = xyz= +xyz = xyz= +xyz = xyz +23 + +

x=0123456789 +3 4 34

+ +0=11.38092pt1 + +

Ấ ấ Ầ ầ Ẩ ẩ Ẫ ẫ +Ậ ậ Ĉ ĉ + Ế ế Ề ề Ể +ể Ễ ễ Ệ ệ Ĝ ĝ Ĥ ĥ Ĵ ĵ + + Ố ố Ồ ồ Ổ ổ Ỗ ỗ +Ộ ộ Ŝ ŝ Ŵ ŵ Ŷ ŷ Ẑ ẑ + Ǻ ǻ Ǽ ǽ Ấ ấ Ắ ắ +Ć ć Ḉ ḉ Ḗ +ḗ Ế ế Ǵ ǵ +Ḯ ḯ Ḱ ḱ Ĺ ĺ Ḿ +ḿ Ń ń Ǿ ǿ Ṍ ṍ Ṓ ṓ Ố +ố Ớ ớ + Ṕ ṕ Ŕ ŕ Ś ś +Ṥ ṥ Ǘ ǘ Ṹ ṹ Ứ ứ +Ẃ ẃ Ź ź + Ầ ầ Ằ ằ Ḕ ḕ Ề +ề Ǹ ǹ + Ṑ ṑ Ồ ồ +Ờ ờ Ǜ ǜ Ừ ừ Ẁ ẁ Ỳỳ + Ǟ ǟ Ḧ ḧ Ḯ ḯ +Ȫ ȫ Ṏ ṏ ẗ + Ṻ ṻ Ǜ ǜ +Ǘ ǘ Ǚ ǚ Ẅ ẅ Ẍ ẍ Ÿ + Ḉ ḉ Ḑ ḑ Ȩ ȩ Ḝ ḝ + +Ḩ ḩ Ģ ģ Ķ ķ Ļ ļ Ņ ņ Ŗ ŗ Ş ş Ţ ţ +Ȁ ȁ Ȅ ȅ Ȉ ȉ Ȍ ȍ Ȑ ȑ Ȕ ȕ +Ă ă Ằ ằ Ắ ắ Ẳ ẳ Ẵ ẵ +Ặ ặ + Ĕ ĕ Ḝ ḝ Ğ ğ Ĭ ĭ +Ŏ ŏ Ŭ ŭ +Ǎ ǎ Č č Ď ď Ě ě Ǧ ǧ Ȟ ȟ Ǩ ǩ +Ǐ ǐ ǰ Ľ ľ Ň ň + Ǒ +ǒ Ř ř Š š Ť ť Ǔ ǔ Ǚ ǚ Ṧ +ṧ Ž ž +Ő ő Ű ű + +Ớ ớ Ờ ờ Ở ở Ỡ ỡ +Ợ ợ + Ứ ứ Ừ ừ Ử ử Ữ +ữ Ự ự +Ả ả Ẩ ẩ Ẳ ẳ Ẻ ẻ Ể ể Ỉ +ỉ + Ỏ ỏ Ổ ổ Ở ở Ủ ủ +Ử ử Ỷ ỷ +Ą ą Ę ę Į į Ǫ ǫ Ǭ ǭ Ų ų + Ů ů ẘ ẙ +Ạ ạ Ậ ậ Ặ ặ Ḅ ḅ Ḍ ḍ Ẹ ẹ +Ệ ệ Ḥ ḥ Ị ị Ḳ ḳ Ḷ ḷ Ḹ ḹ + +Ṃ ṃ Ṇ ṇ Ọ ọ Ộ ộ Ợ ợ +Ṛ ṛ Ṝ ṝ Ṣ ṣ Ṩ ṩ Ṭ + +ṭ Ụ ụ Ự ự Ṿ +ṿ Ẉ ẉ Ỵ ỵ Ẓ ẓ +Ḁ ḁ +Ḇ ḇ Ḏ ḏ ẖ Ḵ ḵ Ḻ ḻ +Ṉ ṉ Ṟ ṟ Ṯ ṯ Ẕ ẕ +Ȃ ȃ Ȇ ȇ Ȋ ȋ Ȏ ȏ Ȓ ȓ Ȗ ȗ +Ḛ ḛ Ḭ ḭ Ṵ ṵ +Ḓ ḓ Ḙ ḙ Ḽ ḽ Ṋ ṋ Ṱ ṱ Ṷ ṷ +Ā ā Ǟ ǟ Ǡ ǡ ǢǣĒ ē Ḗ ḗ +Ḕ ḕ Ḡ ḡ Ħ ħ + +Ī ī Ḹ ḹ Ō ō Ǭ ǭ Ȫ ȫ Ȭ +ȭ Ȱ ȱ Ṑ ṑ Ṓ ṓ + Ṝ ṝ +Ŧ ŧ Ū ū Ṻ ṻ Ȳ ȳ +Ȧ ȧ Ǡ ǡ Ḃ ḃ Ċ ċ Ḋ ḋ Ė ė Ḟ ḟ Ġ ġ Ḣ +ḣ İ +Ŀ ŀ Ṁ ṁ Ṅ ṅ Ȯ ȯ Ȱ ȱ Ṗ ṗ Ṙ ṙ + +Ṡ +ṡ Ṩ ṩ Ṧ ṧ Ṥ ṥ Ṫ ṫ Ẇ ẇ Ẋ +ẋ Ẏ ẏ Ż ż +

+

B

+

ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE ab+2c=DE

+

XxCalRmBfSfTtxy+1No ItFr +XxCalRmBfSfTtxy+1No ItFr + +foobar+1=3 + +ab=1 c

+

oooooooooooooo +ab=1 c +ab=1 c +ab=1 c +ab=1 c

+

ab=1 ctag8-2-3

+

+12&0f(x)dx[2cm] +W2&xyz=xxyyzz +

+

signal x F (y ) with smallest support.

+

(W102)=(W102)=(W102)

+ +a & = & b +& = & c +by (eqn:main2) +1234 +

Non math version +Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

ll 2 h(n) & for 0 n N/2-1 0 & otherwise

+xlabel1 +\displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0 \displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0 \displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0\displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0 \displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0 \displaystyle+\textstyle+\scriptstyle+\scriptscriptstyle+m2\displaystyle0\textstyle0\scriptstyle0\scriptscriptstyle0 +

Additional tests +20.0pt, 56.9055pt 12>10 +x12 y2233 +x12 c +uv uv +10 3 4 67 +If x then n>0, 1n2<0

+

Kumar test +xHi +xHi +Testing references +ab=1 ctag8-2-3xxyy + + +=

+ 123&3456&78 + 123&3456&78 + 123&3456&78 + 123&3456&78 +23&3456&78 +23&3456&78 +23&3456&78 +23&3456&78 +23&3456&78 +23&3456&78 +

+ok

+

AT_DOC_END

+ diff --git a/thirdparty/tralics-2.15.2/Modele/tormath3.xml b/thirdparty/tralics-2.15.2/Modele/tormath3.xml new file mode 100644 index 0000000..8dc028a --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tormath3.xml @@ -0,0 +1,523 @@ + + + + +

DOCSTART

+x6x6 +simple math +

\sharp

+

ıj$_&{}%...# +\i \j \$ ~\, \_ \& \lbrace \rbrace \% \ \! \quad \qquad \dots \ldots \# \sharp \natural \flat += +\hspace{56.9055pt} \vspace{569.05511pt} \hspace{3.0pt}\vspace{4.0pt}\hspace*{5.0pt}\vspace*{6.0pt} +\hspace{-24.0pt} \vspace{-24.0pt} \hspace{-3.0pt}\vspace{4.0pt}\hspace*{-5.0pt}\vspace*{-6.0pt} +abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ +<>,?;./:+=- " ' ()!` ' "<>,?;./:+=-_"^{\prime }()!` ^{\prime }" +aሴa

+

αβγδϵϵζηθικλμνξπρστυϕχψωϖϱςφϰϑ\alpha \beta \gamma \delta \epsilon \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega \varpi \varrho \varsigma \varphi \varkappa \vartheta +ΓΔΘΛΞΣϒΦΠΨΩ\Gamma \Delta \Theta \Lambda \Xi \Sigma \Upsilon \Phi \Pi \Psi \Omega

+

\hbar \ell \wp \Re \Im \partial \infty \emptyset \nabla \surd \top \bottom \bot \angle \triangle

+

arccosarcsinarctanargcoscoshcotcothcscdegdim \arccos \arcsin \arctan \arg \cos \cosh \cot \coth \csc \deg \dim +exphomkerlglnlogPrsecsinsinhtantanhdetgcd \exp \hom \ker \lg \ln \log \Pr \sec \sin \sinh \tan \tanh \det \gcd +infinj limlimlim inflim supmaxminproj limsup\inf \injlim \lim \liminf \limsup \max \min \projlim \sup

+

\forall \exists

+

\coprod \bigvee \bigwedge \biguplus \bigcap \bigcup \int \sum \prod \bigotimes \bigoplus \bigodot \oint \bigsqcup \smallint

+

⨿÷±·*×\triangleleft \triangleright \bigtriangleup \bigtriangledown \wedge \wedge \vee \vee \cap \cup \multimap \dagger \ddagger \sqcap \sqcup \amalg \diamond \Diamond \bullet \wr \div \odot \oslash \otimes \ominus \oplus \uplus \mp \pm \circ \bigcirc \setminus \cdot \ast \times \star

+

¬\propto \sqsubseteq \sqsupseteq \subseteq \sqsubset \parallel \mid \dashv \vdash \Vdash \models \nearrow \searrow \swarrow \nwarrow \Leftrightarrow \Leftarrow \Rightarrow \ne \ne \le \le \ge \ge \succ \approx \succeq \preceq \prec \doteq \subset \supset \supseteq \subseteq \bindnasrepma \ni \ni \gg \ll \gtrless \geqslant \leqslant \lnot \notin \leftrightarrow \leftarrow \leftarrow \rightarrow \rightarrow \mapsto \sim \simeq \perp \equiv \asymp \smile \frown \leftharpoonup \leftharpoondown \rightharpoonup \rightharpoondown \hookrightarrow \hookleftarrow \bowtie \bowtie \Longrightarrow \longrightarrow \longleftarrow \Longleftarrow \longmapsto \longleftrightarrow \Longleftrightarrow \iff

+

ıȷ|}{¬¬' \cdots \hdots \vdots \ddots \imath \jmath \Vert \Vert \vert \uparrow \downarrow \Uparrow \Downarrow \Updownarrow \updownarrow \mho \clubsuit \diamondsuit \heartsuit \spadesuit \aleph \backslash \Box \langle \rangle \rmoustache \lmoustache \rgroup \lgroup \rbrace \lbrace \rceil \lceil \rfloor \lfloor \square \cong \lnot \lnot \in \prime

+

<>,.:;*?!()[]|+-/= <>,.:;*?!()[]|+-/=

+

\hspace{5.0pt}\: \; \: \! \quad \qquad ~

+

...¬\smallint \int \vee \ni \ldots \top \bot \nabla \flat \Re \infty \surd \natural \Im \hbar \ell \sharp \angle \emptyset \triangle \lnot \wp \partial

+

α=β\alpha =\beta and +γ=δ\gamma =\delta and ϕ=ψ\phi =\psi ; +and 00\ne \infty

+
+Mathaccents +

HAT:a ^b ´c d ˙e ˘f ˇg `h k ¨l ˜abcHAT: \hat{a} \acute{b} \bar{c} \dot{d} \breve{e} \check{f} \grave{g} \vec{h} +\ddot{k} \tilde{l}a\rightarrow b\longrightarrow c

+

ACUTE:x ´x x ˘x ˇx x x ¨x ˙x `x ^x ˚x ˜x xyz ^xyz ˜ACUTE: \acute{x} \bar{x} \breve{x} \check{x} +\ddddot{x} \dddot{x} \ddot{x} \dot{x} +\grave{x} \hat{x} \mathring{x} \tilde{x} +\vec{x} \widehat{xyz} \widetilde{xyz}

+

WIDETILDE:abc ˜abc ^abc abc abc abc _abc abc abc abc WIDETILDE: \widetilde{abc} \widehat{abc} \overleftarrow{abc} \overrightarrow{abc} +\overline{abc} \underline{abc} \overbrace{abc} \underbrace{abc} +\underleftarrow{abc} \underrightarrow{abc} +

+
+Commands +

min x f(x)>dmin x f(x)\min _xf(x) >\operatorname{dmin}_xf(x). + +min x f(x)>dmin x f(x)\min _xf(x) >\operatornamewithlimits{dmin}_xf(x).

+

foo bar _\overline{foo}\underline{bar} + j\stackrel{j}{\longrightarrow } +X *X *\overset{*}{X} \underset{*}{X} +xyz \overbrace{xyz} +xyz \underbrace{xyz} +abc xyzabc xyzabc xyz\frac{abc}{xyz} \dfrac{abc}{xyz} \tfrac{abc}{xyz} +abcabc nabc n\sqrt{abc} \@root n \of {abc} \@root n \of {abc}

+

1 a 2 \bigl [\frac{1}{a^2}\bigr [ +1 b 2 \left[\frac{1}{b^2}\right[ +[1 x 2 [[\frac{1}{x^2}[

+1 2aaa bbbn m\genfrac{}{}{}{}{1}{2} +\genfrac[]{2.0pt}2{aaa}{bbb} +\genfrac(){0.0pt}0{n}{m} + +

ab cd ab cd a\nonscript \,b_{c\nonscript \,d} a\nonscript \,b_{\textstyle c\nonscript \,d}

+a=b b=1 cd d =2 cd d \mathchoice{a}{b}{c}{d}= \frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}} = +1_{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} = 2^ {\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} +

b=c c=1 cd d =2 cd d \mathchoice{a}{b}{c}{d}= \frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}} = +1_{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}} = 2^ {\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}}{\mathchoice{a}{b}{c}{d}}}

+

1 2x1 2x1 2x1 2x1 2xa+xa+xa+xaxa xb+xa xb{\frac{1}{2}}{x\displaystyle \frac{1}{2}} +{x\textstyle \frac{1}{2}}{x\scriptstyle \frac{1}{2}}{x\scriptscriptstyle \frac{1}{2}} \qquad {x\displaystyle a}+{x\textstyle a}+{x\scriptstyle a}+{x\scriptscriptstyle a}\qquad \frac{x\displaystyle a}{x\textstyle b}+\frac{x\scriptstyle a}{x\scriptscriptstyle b}

+
+Environments + +Other +x 2 +y 2 =11=X 2 +Y 2 x=0.010.001=X +\begin{aligned} +x^2+y^2&=1 & 1 &=X^2+Y^2\\ +x &=0.01& 0.001&=X +\end{aligned} + +sin=cosccossin1+2 +\sin =\cos \\ +\multicolumn{a}{b}{c}\\ +\multicolumn{1}{r}{\cos }\\ +\multicolumn{1}{l}{\sin }\\ +1+2 + +ccaaAbbBaaβAaaBαCD\beta A\hbox{aaB $\alpha C$} D +

AB

+ABCD A\hbox{B $C$} D +

a+ba+b a+ba\mathbin +b

+0=1 0=1 +0=2 0=2 +0=3 0=3 +0=4 0=4 +0=5 0 = 5 +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +\begin{split} +(a+b)^4 &= (a+b)^ 2 (a+b)^2 \\ +&= (a^2+2ab+b^2)(a^2+2ab+b^2) \\ +&= a^4+4a^3b+6a^2b^2+4ab^3+b^4 \\ +\end{split} + +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +\begin{aligned} +(a+b)^4 &= (a+b)^ 2 (a+b)^2 \\ +&= (a^2+2ab+b^2)(a^2+2ab+b^2) \\ +&= a^4+4a^3b+6a^2b^2+4ab^3+b^4 \\ +\end{aligned} + +x 2 +y 2 =1x=1-y 2 +x^2+y^2&=1\\ x&=\sqrt{1-y^2} + +xy 1 ++y n z +x & \ll & y_{1} + \cdots + y_{n} \\ +& \le &z + +x=17yy>a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p +x & = &17y \\ +y & > & a + b + c+d+e+f+g+h+i+j+ \nonumber \\ +& & k+l+m+n+o+p + +EQ1EQ1 +

etc

+EQ2EQ2 +

etc

+EQ3EQ3 +uv+1modn 2 uv+1modn 2 u=v+1(modn 2 )u=v+1(n 2 ) +u& \equiv v+1 \mod {n^2} \\ +u& \equiv v+1 \bmod {n^2} \\ +u& = v+1 \pmod {n^2} \\ +u& = v+1 \hspace{10.0pt}(n^2) \\ + +1 21 21 2 1 21 21 2 \frac{1}{2} \dfrac{1}{2} \tfrac{1}{2} \qquad {}^{\frac{1}{2} \dfrac{1}{2} \tfrac{1}{2}} +bc+m 2 bcd+m 2 cbc+m 2 b\frac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tfrac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dfrac{\mathchoice{a}{b}{c}{d}\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}} +

o ˙ \bar{\dot{\rm o}} +a - b – c — d

+c+m 2 bd+m 2 cc+m 2 b d+m 2 dd+m 2 cc+m 2 b \binom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\qquad {}^{\binom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \tbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}\quad \dbinom{\frac{\mathchoice{a}{b}{c}{d}+m}{2}}{\mathchoice{a}{b}{c}{d}}} +a b ca\over {b\over c} + +

yx ' x '' x ''' x '''' u 2 ' v 4 '3 x^{\prime } x^{\prime \prime } x^{\prime \prime \prime } x^{\prime \prime \prime \prime } u_2^{\prime } v^{\prime 3}_4

+

min x f(x)>dmin x f(x)\min _xf(x) >\operatorname{dmin}_xf(x).

+

min x f(x)>dmin x f(x)\min _xf(x) >\mathmo{dmin}\mathattribute{form}{prefix}\mathattribute{movablelimits}{true}_xf(x).

+𝙰𝚊𝒜𝐀𝐚 Aa 𝐴𝑎𝔸𝖠𝖺Aa𝙱𝚋𝐁𝐛 Bb 𝐵𝑏𝔹𝖡𝖻Bb𝙲𝚌𝒞𝐂𝐜 Cc 𝐶𝑐𝖢𝖼Cc𝙳𝚍𝒟𝐃𝐝 Dd 𝐷𝑑𝔻𝖣𝖽Dd𝙴𝚎𝐄𝐞 Ee 𝐸𝑒𝔼𝖤𝖾Ee𝙵𝚏𝐅𝐟 Ff 𝐹𝑓𝔽𝖥𝖿Ff𝙶𝚐𝒢𝐆𝐠 Gg 𝐺𝑔𝔾𝖦𝗀Gg𝙷𝚑𝐇𝐡 Hh 𝐻ℎ𝖧𝗁Hh𝙸𝚒𝐈𝐢 Ii 𝐼𝑖𝕀𝖨𝗂Ii𝙹𝚓𝒥𝐉𝐣 Jj 𝐽𝑗𝕁𝖩𝗃Jj𝙺𝚔𝒦𝐊𝐤 Kk 𝐾𝑘𝕂𝖪𝗄Kk𝙻𝚕𝐋𝐥 Ll 𝐿𝑙𝕃𝖫𝗅Ll𝙼𝚖𝐌𝐦 Mm 𝑀𝑚𝕄𝖬𝗆Mm𝙽𝚗𝒩𝐍𝐧 Nn 𝑁𝑛𝖭𝗇Nn𝙾𝚘𝒪𝐎𝐨 Oo 𝑂𝑜𝕆𝖮𝗈Oo𝙿𝚙𝒫𝐏𝐩 Pp 𝑃𝑝𝖯𝗉Pp𝚀𝚚𝒬𝐐𝐪 Qq 𝑄𝑞𝖰𝗊Qq𝚁𝚛𝐑𝐫 Rr 𝑅𝑟𝖱𝗋Rr𝚂𝚜𝒮𝐒𝐬 Ss 𝑆𝑠𝕊𝖲𝗌Ss𝚃𝚝𝒯𝐓𝐭 Tt 𝑇𝑡𝕋𝖳𝗍Tt𝚄𝚞𝒰𝐔𝐮 Uu 𝑈𝑢𝕌𝖴𝗎Uu𝚅𝚟𝒱𝐕𝐯 Vv 𝑉𝑣𝕍𝖵𝗏Vv𝚆𝚠𝒲𝐖𝐰 Ww 𝑊𝑤𝕎𝖶𝗐Ww𝚇𝚡𝒳𝐗𝐱 Xx 𝑋𝑥𝕏𝖷𝗑Xx𝚈𝚢𝒴𝐘𝐲 Yy 𝑌𝑦𝕐𝖸𝗒Yy𝚉𝚣𝒵𝐙𝐳 Zz 𝑍𝑧𝖹𝗓Zz\begin{split} +\mathtt {Aa}\mathcal {A}\mathbf {Aa}\mathrm {Aa} +\mathit {Aa}\mathbb {A}\mathsf {Aa}\mathnormal {Aa} &\mathtt {Bb}\mathcal {B}\mathbf {Bb}\mathrm {Bb} +\mathit {Bb}\mathbb {B}\mathsf {Bb}\mathnormal {Bb}\\ +\mathtt {Cc}\mathcal {C}\mathbf {Cc}\mathrm {Cc} +\mathit {Cc}\mathbb {C}\mathsf {Cc}\mathnormal {Cc} &\mathtt {Dd}\mathcal {D}\mathbf {Dd}\mathrm {Dd} +\mathit {Dd}\mathbb {D}\mathsf {Dd}\mathnormal {Dd}\\ +\mathtt {Ee}\mathcal {E}\mathbf {Ee}\mathrm {Ee} +\mathit {Ee}\mathbb {E}\mathsf {Ee}\mathnormal {Ee} &\mathtt {Ff}\mathcal {F}\mathbf {Ff}\mathrm {Ff} +\mathit {Ff}\mathbb {F}\mathsf {Ff}\mathnormal {Ff}\\ +\mathtt {Gg}\mathcal {G}\mathbf {Gg}\mathrm {Gg} +\mathit {Gg}\mathbb {G}\mathsf {Gg}\mathnormal {Gg} &\mathtt {Hh}\mathcal {H}\mathbf {Hh}\mathrm {Hh} +\mathit {Hh}\mathbb {H}\mathsf {Hh}\mathnormal {Hh}\\ +\mathtt {Ii}\mathcal {I}\mathbf {Ii}\mathrm {Ii} +\mathit {Ii}\mathbb {I}\mathsf {Ii}\mathnormal {Ii} &\mathtt {Jj}\mathcal {J}\mathbf {Jj}\mathrm {Jj} +\mathit {Jj}\mathbb {J}\mathsf {Jj}\mathnormal {Jj}\\ +\mathtt {Kk}\mathcal {K}\mathbf {Kk}\mathrm {Kk} +\mathit {Kk}\mathbb {K}\mathsf {Kk}\mathnormal {Kk} &\mathtt {Ll}\mathcal {L}\mathbf {Ll}\mathrm {Ll} +\mathit {Ll}\mathbb {L}\mathsf {Ll}\mathnormal {Ll}\\ +\mathtt {Mm}\mathcal {M}\mathbf {Mm}\mathrm {Mm} +\mathit {Mm}\mathbb {M}\mathsf {Mm}\mathnormal {Mm} &\mathtt {Nn}\mathcal {N}\mathbf {Nn}\mathrm {Nn} +\mathit {Nn}\mathbb {N}\mathsf {Nn}\mathnormal {Nn}\\ +\mathtt {Oo}\mathcal {O}\mathbf {Oo}\mathrm {Oo} +\mathit {Oo}\mathbb {O}\mathsf {Oo}\mathnormal {Oo} &\mathtt {Pp}\mathcal {P}\mathbf {Pp}\mathrm {Pp} +\mathit {Pp}\mathbb {P}\mathsf {Pp}\mathnormal {Pp}\\ +\mathtt {Qq}\mathcal {Q}\mathbf {Qq}\mathrm {Qq} +\mathit {Qq}\mathbb {Q}\mathsf {Qq}\mathnormal {Qq} &\mathtt {Rr}\mathcal {R}\mathbf {Rr}\mathrm {Rr} +\mathit {Rr}\mathbb {R}\mathsf {Rr}\mathnormal {Rr}\\ +\mathtt {Ss}\mathcal {S}\mathbf {Ss}\mathrm {Ss} +\mathit {Ss}\mathbb {S}\mathsf {Ss}\mathnormal {Ss} &\mathtt {Tt}\mathcal {T}\mathbf {Tt}\mathrm {Tt} +\mathit {Tt}\mathbb {T}\mathsf {Tt}\mathnormal {Tt}\\ +\mathtt {Uu}\mathcal {U}\mathbf {Uu}\mathrm {Uu} +\mathit {Uu}\mathbb {U}\mathsf {Uu}\mathnormal {Uu} &\mathtt {Vv}\mathcal {V}\mathbf {Vv}\mathrm {Vv} +\mathit {Vv}\mathbb {V}\mathsf {Vv}\mathnormal {Vv}\\ +\mathtt {Ww}\mathcal {W}\mathbf {Ww}\mathrm {Ww} +\mathit {Ww}\mathbb {W}\mathsf {Ww}\mathnormal {Ww} &\mathtt {Xx}\mathcal {X}\mathbf {Xx}\mathrm {Xx} +\mathit {Xx}\mathbb {X}\mathsf {Xx}\mathnormal {Xx}\\ +\mathtt {Yy}\mathcal {Y}\mathbf {Yy}\mathrm {Yy} +\mathit {Yy}\mathbb {Y}\mathsf {Yy}\mathnormal {Yy} &\mathtt {Zz}\mathcal {Z}\mathbf {Zz}\mathrm {Zz} +\mathit {Zz}\mathbb {Z}\mathsf {Zz}\mathnormal {Zz}\\ +\end{split} + +

𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵{\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ}

+

𝐚a𝒸d \bf a \mathrm {a \mathcal {c} d}

+

a b c a^c_b +a b c a_b^c

+

xx\Box

+AAAAAAABBBBBCCCCCCCCCABCABCABCABC1223412234122340123456789abcdefCA0123456789abcdef0123456789abcdefCA0123456789abcdefABC\left| +\begin{array}{lcr} +AAAAAAA&BBBBBCC&CCCCCCC\\ +A&B&C\\ +\multicolumn{1}{c}{A}&\multicolumn{1}{c}{B}&\multicolumn{1}{c}{C}\\ +\multicolumn{1}{r}{A}&\multicolumn{1}{r}{B}&\multicolumn{r}{c}{C}\\ +\multicolumn{1}{l}{A}&\multicolumn{1}{l}{B}&\multicolumn{l}{c}{C}\\ +\begin{array}{cl}1&22\\3&4\end{array}&\begin{array}{cc}1&22\\3&4\end{array}&\begin{array}{cr}1&22\\3&4\end{array}\\ +\multicolumn{2}{c}{0123456789abcdef}&C\\ +A&\multicolumn{2}{c}{0123456789abcdef}\\ +\multicolumn{2}{r}{0123456789abcdef}&C\\ +A&\multicolumn{2}{l}{0123456789abcdef}\\ +A&B&C\\ +\end{array} +\right| +x ˙=Ax+g(x,u)y=Cxx𝐑 n +\left\lbrace \begin{array}{lcl} +\dot{x} & = & Ax+g(x,u)\\ +y & = & Cx \\ +\multicolumn{3}{l}{x\in \mathbf {R}^n} +\end{array} +\right. + +

a) x1 x1 +b) x2 x2 +c)

+x3 x3 +

d)

+x4 x4 +

e)

+x5 x5 +

text A

+

text B

+

text C

+

line one

+

this is the second line

+

1efoobar.

+

1efoobar. +FooBar

+x ˙=Ax+g(x,u)y=CxxR n +\begin{array}{lcl} +\dot{x} & = & Ax+g(x,u)\\[2mm] +y & = & Cx \\ +\multicolumn{3}{l}{x\in R^n} +\end{array} + +a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F + + + + + + + + + +aaa +bbb +ccc +ddd +eee +fff +
+arccos 2 (x),arcsin 2 (x),arctan 2 (x),arg 2 (x),cos 2 (x),cosh 2 (x),cot 2 (x) \arccos ^2 (x),\, \arcsin ^2(x) ,\, \arctan ^2(x) ,\, \arg ^2(x),\, +\cos ^2(x) ,\, \cosh ^2(x) ,\, \cot ^2(x) +coth 2 (x),csc 2 (x),deg 2 (x),dim 2 (x),exp 2 (x),hom 2 (x),ker 2 (x),lg 2 (x) \coth ^2(x) ,\, \csc ^2(x),\, \deg ^2(x),\, \dim ^2(x),\, \exp ^2(x),\, +\hom ^2(x),\, \ker ^2(x) ,\, \lg ^2(x) +ln 2 (x),log 2 (x),Pr 2 (x),sec 2 (x),sin 2 (x),sinh 2 (x),tan 2 (x),tanh 2 (x) \ln ^2(x),\, \log ^2(x),\, \Pr ^2(x),\, \sec ^2(x),\, \sin ^2(x) ,\, +\sinh ^2(x),\, \tan ^2(x),\, \tanh ^2(x) +det x=1 ,gcd x=1 ,inf x=1 ,inj lim x=1 ,lim x=1 ,lim inf x=1 ,lim sup x=1 ,max x=1 ,min x=1 ,proj lim x=1 ,sup x=1 \det _{x=1},\, \gcd _{x=1},\, \inf _{x=1},\, \injlim _{x=1},\, +\lim _{x=1},\, \liminf _{x=1},\,\limsup _{x=1},\, +\max _{x=1},\, \min _{x=1},\, \projlim _{x=1},\, \sup _{x=1} + +

jX *X *abcabc nabc nabc xyzabc xyz\stackrel{j}{\longrightarrow } \overset{*}{X} \underset{*}{X} +\sqrt{abc} \@root n \of {abc} \@root n \of {abc} +\frac{abc}{xyz} \dfrac{abc}{xyz} +

+n+m 2 nn+m 2 nn+m 2 n n+m 2 nn+m 2 nn+m 2 n \binom{\frac{n+m}{2}}{n} \quad \tbinom{\frac{n+m}{2}}{n} \quad \dbinom{\frac{n+m}{2}}{n}\qquad {}^{\binom{\frac{n+m}{2}}{n} \quad \tbinom{\frac{n+m}{2}}{n} \quad \dbinom{\frac{n+m}{2}}{n}} +

\Leftrightarrow

+

1st xime ysome text.

+1 2aaa bbbn m\genfrac{}{}{}{}{1}{2} +\genfrac[]{2.0pt}2{aaa}{bbb} +\genfrac(){0.0pt}0{n}{m} + +

a ba ba ba b\genfrac{}{}{}0{a}{b} +\genfrac{}{}{}1{a}{b} +\genfrac{}{}{}2{a}{b} +\genfrac{}{}{}3{a}{b}

+

a ba ba b{a\over b}\quad {a\above 1pt b}\quad {a\atop b} +a ba ba b{a\overwithdelims () b}\quad {a\abovewithdelims ()1pt b}\quad {a\atopwithdelims () b} +foo bar\genfrac(){2.0pt}{}{foo}{bar}

+n+m 2 nn+m 2 nn+m 2 n\frac{\frac{n+m}{2}}{n} \quad \tfrac{\frac{n+m}{2}}{n} \quad \dfrac{\frac{n+m}{2}}{n} +sup x=2 y1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f) +\sup _{x=2}y~ +\frac{1}{k}\log _2 c(f)\; +\tfrac{1}{k}\log _2 c(f)\; +\sqrt{\frac{1}{k}\log _2 c(f)}\; +\sqrt{\dfrac{1}{k}\log _2 c(f)} + +

aaaaaaaaaaaaaaaaaa 111111111\genfrac(){2.84526pt}3{aaaaaaaaaaaaaaaaaa}{111111111} +aaaaaaaaaaaaaaaaaa 111111111\genfrac(){0.0pt}3{aaaaaaaaaaaaaaaaaa}{111111111} +abc def\genfrac{}{}{}0{abc}{def} +abc def\genfrac{}{}{}1{abc}{def} +abc def\genfrac{}{}{}2{abc}{def} +abc def\genfrac{}{}{}3{abc}{def}

+

a ˜,z ˜,a+b ˜\tilde{a},\tilde{z}, \tilde{a+b}

+

𝙿 P\overline{\tt P} P

+

á á +a ^a ´a a ˙a ˘a ˇa `a a ¨a ˜\hat{a} \acute{a} \bar{a} \dot{a} \breve{a} +\check{a} \grave{a} \vec{a} \ddot{a} \tilde{a} +

+d=z 2 =(I t +Ivvvv +Idiv(vvvvv )) 2 ,d=z^2=( I_t + \nabla I\vec{vvvv} +I div(\vec{vvvvv}) )^2, +

ab=1ca\hbox{b=1} c +ab1ca\hbox{b~1}~c

+

x y ϵ ϵ x^{y^\epsilon _\varepsilon }

+B (r )=μ 0 4π3m (r ' )·(r -r ' ) |r -r ' | 5 (r -r ' )-m (r ' ) |r -r ' | 3 . +\vec{B}(\vec{r}) = \frac{\mu _0}{4\pi }\left\lbrace +\frac{3\vec{m}({\vec{r}}^{\prime })\cdot (\vec{r}-{\vec{r}}^{\prime })}{|\vec{r}-{\vec{r}}^{\prime }|^5} +(\vec{r}-{\vec{r}}^{\prime }) - \frac{\vec{m}({\vec{r}}^{\prime })}{|\vec{r}-{\vec{r}}^{\prime }|^3} +\right\rbrace . + +

x 2 1 y 4 3 x 2 1 y 4 3 x 2 1 y 4 3 []abcdef + +\left\Vert \left|\left[\left(\left\lbrace \frac{x^1_2}{y^3_4}\right\rbrace \right)\right]\right|\right\Vert \left|\left|\left<\left\langle \frac{x^1_2}{y^3_4}\right\rangle \right>\right|\right|\left\lbrace \left\lceil \left\lfloor \frac{x^1_2}{y^3_4}\right\rfloor \right\rceil \right\rbrace []a\hspace{0.55542pt}b\hspace{1.111pt}c \hspace{2.22214pt}d \hspace{4.44443pt}e \hspace{8.88885pt}f +

+

x 2 1 y 4 3 +\left\moustache \left\uparrow \left\Uparrow \left\updownarrow \left\lgroup \frac{x^1_2}{y^3_4}\right\rgroup \right\Updownarrow \right\Downarrow \right\downarrow \right\moustache +x 2 1 y 4 3 +\left \lmoustache \left \uparrow \left \Uparrow \left \updownarrow \left \lgroup \frac{x^1_2}{y^3_4}\right \rgroup \right \Updownarrow \right \Downarrow \right \downarrow \right \rmoustache + 0 x 2 1 y 4 3 +\left\moustache \left\uparrow \left\Uparrow \left\updownarrow \left\lgroup \int _0^{\frac{x^1_2}{y^3_4}}\right\rgroup \right\Updownarrow \right\Downarrow \right\downarrow \right\moustache

+

\Longrightarrow + +𝒳 𝓎 \cal X_yand 𝒳 𝓎 𝒵\cal X_yZ +sin(x)+cos 2 (x)\sin (x) + \cos ^2(x) and xyz t \overbrace{xyz} ^t

+

1 a 2 \bigl [\frac{1}{a^2}\bigr [ +1 b 2 \left[\frac{1}{b^2}\right[ +[1 x 2 [[\frac{1}{x^2}[

+

f)a+b(=c+d\int f\mathopen )a+b\mathclose (=c+d +f(a+b)=c+d\int f(a+b)=c+d

+

aba\limits \displaylimits \nolimits b

+

wwwwwwwwwwwwa...b...cde f$g%h&ijk{l}mın♯o♮p♭q_

+

ab...cdef$g%h&ijk{l}mınopq_a\dots b\ldots c\quad d\qquad e f\$g\%h\&i\!j\,k\lbrace l\rbrace m\i n\sharp o\natural p\flat q\_

+

Math spacing

+

xxxxxxxxxx

+

xxxxxx\,x\:x\;x\!x

+

aaaa\,\,\,\,\,a\:\:\:\:\:a

+

aaaa\;\;\;a\;\;\;\;a

+

!?#_.@%/|!?\#\_.@\%\Vert /|

+argmin Ψ θΘ ΔΦ θ Ω s -Ω t x y z =x y z =x y z =x y z =x y z =x y z =x y z =x y z {2 3} +\mathop {\mathop {arg\,min}\nolimits _\Psi }\limits _{\theta \in \Theta } +\Delta \left( {\mathop \Phi \nolimits _\theta \left( {\Omega _s } +\right)-\Omega _t } \right) +\qquad x_{y_z} = {x_y}_z= +x^{y_z} = {x^y}_z= +x_{y^z} = {x_y}^z= +x^{y^z} = {x^y}^z +\left\lbrace \lbrace \frac{2}{3}\rbrace \right\rbrace + +

x=0123456789x=0123456789 +4 3\@root 3 \of {4} 4 3\@root 3 \of {4}

+0=1 +0=\hspace{11.38092pt}1 + +

Ĉĉ Ấ ấ Ầ ầ Ẩ ẩ Ẫ ẫ +Ậ ậ Ĉ ĉ +ếĜĝĤĥĴĵ Ế ế Ề ề Ể +ể Ễ ễ Ệ ệ Ĝ ĝ Ĥ ĥ Ĵ ĵ +ŜŝŴŵŶŷǺǻǼǽĆćếǴǵ + Ố ố Ồ ồ Ổ ổ Ỗ ỗ +Ộ ộ Ŝ ŝ Ŵ ŵ Ŷ ŷ Ẑ ẑ + Ǻ ǻ Ǽ ǽ Ấ ấ Ắ ắ +Ć ć Ḉ ḉ Ḗ +ḗ Ế ế Ǵ ǵ +ĹĺḿŃńǾǿḮ ḯ Ḱ ḱ Ĺ ĺ Ḿ +ḿ Ń ń Ǿ ǿ Ṍ ṍ Ṓ ṓ Ố +ố Ớ ớ +ŔশǗǘŹźǸǹ Ṕ ṕ Ŕ ŕ Ś ś +Ṥ ṥ Ǘ ǘ Ṹ ṹ Ứ ứ +Ẃ ẃ Ź ź + Ầ ầ Ằ ằ Ḕ ḕ Ề +ề Ǹ ǹ +ǛǜǞǟȪȫ Ṑ ṑ Ồ ồ +Ờ ờ Ǜ ǜ Ừ ừ Ẁ ẁ Ỳỳ + Ǟ ǟ Ḧ ḧ Ḯ ḯ +Ȫ ȫ Ṏ ṏ ẗ +ǛǜǗǘǙǚŸȨȩ Ṻ ṻ Ǜ ǜ +Ǘ ǘ Ǚ ǚ Ẅ ẅ Ẍ ẍ Ÿ + Ḉ ḉ Ḑ ḑ Ȩ ȩ Ḝ ḝ +ĢģĶķĻļŅņŖŗŞşŢţȀȁȄȅȈȉȌȍȐȑȔȕĂă +Ḩ ḩ Ģ ģ Ķ ķ Ļ ļ Ņ ņ Ŗ ŗ Ş ş Ţ ţ +Ȁ ȁ Ȅ ȅ Ȉ ȉ Ȍ ȍ Ȑ ȑ Ȕ ȕ +Ă ă Ằ ằ Ắ ắ Ẳ ẳ Ẵ ẵ +Ặ ặ +ĔĕĞğĬĭŎŏŬŭǍǎČčĎďĚěǦǧȞȟǨǩǏǐǰĽľŇň Ĕ ĕ Ḝ ḝ Ğ ğ Ĭ ĭ +Ŏ ŏ Ŭ ŭ +Ǎ ǎ Č č Ď ď Ě ě Ǧ ǧ Ȟ ȟ Ǩ ǩ +Ǐ ǐ ǰ Ľ ľ Ň ň +ǑǒŘřŠšŤťǓǔǙǚŽžŐőŰű Ǒ +ǒ Ř ř Š š Ť ť Ǔ ǔ Ǚ ǚ Ṧ +ṧ Ž ž +Ő ő Ű ű + +Ớ ớ Ờ ờ Ở ở Ỡ ỡ +Ợ ợ + Ứ ứ Ừ ừ Ử ử Ữ +ữ Ự ự +Ả ả Ẩ ẩ Ẳ ẳ Ẻ ẻ Ể ể Ỉ +ỉ +ĄąĘęĮįǪǫǬǭŲųŮů Ỏ ỏ Ổ ổ Ở ở Ủ ủ +Ử ử Ỷ ỷ +Ą ą Ę ę Į į Ǫ ǫ Ǭ ǭ Ų ų + Ů ů ẘ ẙ +Ạ ạ Ậ ậ Ặ ặ Ḅ ḅ Ḍ ḍ Ẹ ẹ +Ệ ệ Ḥ ḥ Ị ị Ḳ ḳ Ḷ ḷ Ḹ ḹ + +Ṃ ṃ Ṇ ṇ Ọ ọ Ộ ộ Ợ ợ +Ṛ ṛ Ṝ ṝ Ṣ ṣ Ṩ ṩ Ṭ +ṿȂȃȆȇȊȋȎȏȒȓȖȗĀāǞǟǠǡǢǣĒēĦħ +ṭ Ụ ụ Ự ự Ṿ +ṿ Ẉ ẉ Ỵ ỵ Ẓ ẓ +Ḁ ḁ +Ḇ ḇ Ḏ ḏ ẖ Ḵ ḵ Ḻ ḻ +Ṉ ṉ Ṟ ṟ Ṯ ṯ Ẕ ẕ +Ȃ ȃ Ȇ ȇ Ȋ ȋ Ȏ ȏ Ȓ ȓ Ȗ ȗ +Ḛ ḛ Ḭ ḭ Ṵ ṵ +Ḓ ḓ Ḙ ḙ Ḽ ḽ Ṋ ṋ Ṱ ṱ Ṷ ṷ +Ā ā Ǟ ǟ Ǡ ǡ ǢǣĒ ē Ḗ ḗ +Ḕ ḕ Ḡ ḡ Ħ ħ +ĪīŌōǬǭȪȫȬȭȰȱ +Ī ī Ḹ ḹ Ō ō Ǭ ǭ Ȫ ȫ Ȭ +ȭ Ȱ ȱ Ṑ ṑ Ṓ ṓ +ŦŧŪūȲȳȦȧǠǡĊċĖėĠġİ Ṝ ṝ +Ŧ ŧ Ū ū Ṻ ṻ Ȳ ȳ +Ȧ ȧ Ǡ ǡ Ḃ ḃ Ċ ċ Ḋ ḋ Ė ė Ḟ ḟ Ġ ġ Ḣ +ḣ İ +ĿŀȮȯȰȱĿ ŀ Ṁ ṁ Ṅ ṅ Ȯ ȯ Ȱ ȱ Ṗ ṗ Ṙ ṙ +Żż +Ṡ +ṡ Ṩ ṩ Ṧ ṧ Ṥ ṥ Ṫ ṫ Ẇ ẇ Ẋ +ẋ Ẏ ẏ Ż ż +

+

BB

+

ab+2c=DE ab +2c= DE 𝐚𝐛+2𝐜=𝐃𝐄𝑎𝑏+2𝑐=𝐷𝐸𝒂𝒃+2𝒄=𝑫𝑬𝒶𝒷+2𝒸=𝒟ℰ𝓪𝓫+2𝓬=𝓓𝓔𝔞𝔟+2𝔠=𝔇𝔈𝕒𝕓+2𝕔=𝔻𝔼𝖆𝖇+2𝖈=𝕯𝕰𝖺𝖻+2𝖼=𝖣𝖤𝗮𝗯+2𝗰=𝗗𝗘𝘢𝘣+2𝘤=𝘋𝘌𝙖𝙗+2𝙘=𝘿𝙀𝚊𝚋+2𝚌=𝙳𝙴 \mml@font@normal ab+2c=DE\mml@font@upright ab+2c=DE\mml@font@bold ab+2c=DE\mml@font@italic ab+2c=DE\mml@font@bolditalic ab+2c=DE\mml@font@script ab+2c=DE\mml@font@boldscript ab+2c=DE\mml@font@fraktur ab+2c=DE\mml@font@doublestruck ab+2c=DE\mml@font@boldfraktur ab+2c=DE\mml@font@sansserif ab+2c=DE\mml@font@boldsansserif ab+2c=DE\mml@font@sansserifitalic ab+2c=DE\mml@font@sansserifbolditalic ab+2c=DE\mml@font@monospace ab+2c=DE

+

Xx𝒞𝒶𝓁 Rm 𝐁𝐟𝖲𝖿𝚃𝚝𝚡𝚢+1No𝐼𝑡𝔉𝔯Xx\mathcal {Cal}\mathrm {Rm}\mathbf {Bf}\mathsf {Sf}\mathtt {Tt}\mathtt {x}\mathtt {y+1}\mathnormal {No} \mathit {It}\mathfrak {Fr} +𝐗𝐱𝓒𝓪𝓵 Rm 𝐁𝐟𝗦𝗳𝚃𝚝𝚡𝚢+1𝐍𝐨𝑰𝒕𝕱𝖗Xx\mathcal {Cal}\mathrm {Rm}\mathbf {Bf}\mathsf {Sf}\mathtt {Tt}\mathtt {x}\mathtt {y+1}\mathnormal {No} \mathit {It}\mathfrak {Fr} + +𝐟𝐨𝐨 bar +1=3\frac{\mathit {\mathbf {foo}}}{\mathrm {bar}+1}=3 + +𝐚b=1𝐜a\text{b=1} c

+

oooooooooooooo +ab=1ca\myhbox{b=1} c +ab=1ca\text{b=1} c +ab=1ca\mbox{b=1} c +ab=1ca\hbox{b=1} c

+

ab=1ca\mbox{b=1} c

+

1 2 0 f(x)dx𝔚 2 xyz=xxyyzz\begin{pmatrix} +\binom{1}{2}&\int _0^\infty f(x)dx\\[2cm] +\mathfrak {W}_2&\text{xyz}=\sqrt{xxyyzz} +\end{pmatrix}

+

signal x (y)\bar{x }\in \mathcal {F} (y ) with smallest support.

+

()=()=()\mbox{(\ref {W102})}=(\ref {W102})=\mbox{(\ref {W102})}

+a=b=cby() +a & = & b \\ +& = & c +\mbox{by (\ref {eqn:main2})} +12341234 +

Non math version +Is upper case : BAR

+

Is lower case : bar

+

Is upper case : FOO

+

Is lower case : foo

+

Is upper case : BAR

+

Is upper case : BAR

+

Is lower case : bar

+

Is lower case : bar

+

Is upper case : BARBAR

+

Is lower case : barbar

+

Is upper case : FOOFOO

+

Is lower case : foofoo

+

Is upper case : BARBAR

+

Is upper case : BARBAR

+

Is lower case : barbar

+

Is lower case : barbar

+

2h(n)for0nN/2-10otherwise{}\left\lbrace \begin{array}{ll} 2 h(n) &\text{ for $0 \le n \le N/2-1$ }\\0 &\text{ otherwise }\\\end{array}\right.

+xx +\scriptstyle+m 2 \textstyle0\scriptscriptstyle+m 2 \scriptstyle0\scriptstyle+m 2 \textstyle0 \scriptscriptstyle+m 2 \scriptscriptstyle0\scriptscriptstyle+m 2 \scriptstyle0\scriptstyle+m 2 \textstyle0 \rm \binom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \tbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \dbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}}\qquad {}^{\binom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \tbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}} \quad \dbinom{\frac{\mathchoice{\displaystyle+}{\textstyle+}{\scriptstyle+}{\scriptscriptstyle+}m}{2}}{\mathchoice{\displaystyle0}{\textstyle0}{\scriptstyle0}{\scriptscriptstyle0}}} +

Additional tests +,12>10$\hspace{20.0pt}, \hspace*{56.9055pt} 12>10\,\$ +𝑥 2 1 y 33 22 \left[\mathit {x}^1_2 y^{22}_{33}\right\lbrace +x 1 2c\overline{x}\frac{1}{2} \mathmi[A='B']{c} +u vu v\genfrac{}{}{2.0pt}3{u}{v} \genfrac[]{}{}{u}{v} +104 37 6\sqrt{10} \@root 3 \of {4} \@root 6 \of {7} +If xx\in \emptyset then n>0,1 n 2 <0\forall n>0, \dfrac{1}{n^2}<0

+

Kumar test +x Hi x_{\mbox{{\scriptsize {H\,{\sc i}}}}} +x Hi x_{\mbox{{\scriptsize {H\,\quad \qquad \!\,\:\;{\sc i}}}}} +Testing references +ab=1ca\mbox{b=1} c + + +Π=Ψ\varPi =\varPsi

+123345678 123&34\\56&78 +123345678 123&34\\56&78 +123345678 123&34\\56&78 +123345678 123&34\\56&78 +2334567823&34\\56&78 +2334567823&34\\56&78 +2334567823&34\\56&78 +2334567823&34\\56&78 +2334567823&34\\56&78 +2334567823&34\\56&78 +

+ok

+

AT_DOC_END

+
diff --git a/thirdparty/tralics-2.15.2/Modele/torture.xml b/thirdparty/tralics-2.15.2/Modele/torture.xml new file mode 100644 index 0000000..6741a9e --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/torture.xml @@ -0,0 +1,1443 @@ + + + + +

The time is 08h 47min, 22ndJanuary 2015.

+

DOCSTART

+First +

31.5pt0.0pt0.0mu1717.0pt17.0pt plus 1.0pt minus 2.0pt17.0mu plus 1.0mu minus 2.0mu119811511.0pt +45 +25cmr10 +foo= foo

+Macroexpansion +

Version2.15.2. +foo=foo. +foo=foo. +foo=bold-foo non-bold foo. +bold-foo=nonbold-foo +barbar=barbar +bold-barbar=bold-barbar +bold-barbar=nonbold-barbar +babar=babar +barbar=barbar

+

firstofone + +Testing addtohook.

+

__12345__12345__12345__12345abc +emptyempty + + + +abc=abc ++a++b++c+

+

=Textetexte=

+

aaaabbbbaaaabbbb ab

+

=_#&a~&#& _=

+

27e +27 jie `me

+
+hathat +

1;234okOK + x 2 M1 =A

+

œ=Œ=Ÿ= +Żx? +Compare:œŒŸŻ

+

Test for German thing +OK: SSSZckCKffFFllLLmmMMnnNNppPPrrRRttTT +Ok: --=„”

+
+accents + +latin extended-A +

ligne 010x: ĀāĂ㥹 ĆćĈ ĊċČčĎď

+

ligne 011x: ??ĒēĔĕĖėĘęĚěĜĝĞğ

+

ligne 013x: İıIJijĴĵĶķ?ĹĺĻļĽľ?

+

ligne 014x: ?ŁłŃńŅņŇň?ŊŋŌōŎŏ

+

ligne 015x: ŐőŒœŔŕŖŗŘřŚśŜŝŞş

+

ligne 016x: ŠšŢţŤť??ŨũŪūŬŭŮů

+

ligne 017x: ŰűŲųŴŵŶŷŸŹźŻżŽž?

+

testpar

+

a paragraph

+
+

A

+

B

+ +
+
Caption of the figure +
+

+
+
+
+

+a table with a caption +
+
+
+
+
+Glossary

y1

+

y2

+
+ + + + + + + + + + + +3 + + +

abstract +a body

+

additional information

+
+

ok

+x 2 +y 2 =11=X 2 +Y 2 x=0.010.001=X +sin=coscossin1+2 +

ABCABCABC

+

XX

+ccaaAbbBaaβAaaBαCD +

AB

+ABCD +

023400

+

ASSTEST + +.

+

a+b a+b

+

{\let\rm\bf\bftoto}

+

<!--thisisacomment-->

+

&dollar;not&equals;EURO&excl;

+

{\let\rm\bf \bf toto} + +$ not = EURO !

+

a ^b ´c d ˙e ˘f ˇg `h k ¨l ˜abc

+

x ´x x ˘x ˇx x x ¨x ˙x `x ^x ˚x ˜x xyz ^xyz ˜

+

α=β and γ=δ and ϕ=ψ; +and 0

+0=0 +0=0 +0=0 +0=0 +0=0 +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4 +x 2 +y 2 =1x=1-y 2 +xy 1 ++y n z +x=17yy>a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p +EQ1 +

etc

+EQ2 +

etc

+EQ3 +

etc

+

1 +2 +3 +4

+

Ḉ ḉ Ḗ ḗ Ḯ ḯ +ok

+

X

+uv+1modn 2 uv+1modn 2 u=v+1(modn 2 )u=v+1(n 2 ) +1 21 21 2 1 21 21 2 +bc+m 2 bcd+m 2 cbc+m 2 b + +

3 +1956-2008, Research Director + +1956-2008, Research Director +.

+

1Ǵǵ +Ǎǎ +ǵǴ

+

o ˙ +a - b – c — d

+

ABCABCŒŒĐĐŁŁŊŊSSSS

+

abcabcœœđđłłŋŋ

+

Check:foo=foo +Check:FOO=FOO

+

13

+c+m 2 bd+m 2 cc+m 2 b d+m 2 dd+m 2 cc+m 2 b +

ab cd ab cd

+1 2aaa bbbn m +a=b b=1 cd d =2 cd d +

b=c c=1 cd d =2 cd d

+

1 2x1 2x1 2x1 2x1 2xa+xa+xa+xaxa xb+xa xb

+a b c +

yx ' x '' x ''' x '''' u 2 ' v 4 '3

+t +

c + + +Testing raw XML. +texte1 + +texte2 + +

+

min x f(x)>dmin x f(x).

+

min x f(x)>dmin x f(x).

+

+

code starts here

+

ok

+

ok

+

ok + +ok +

+

= =

+ABy Cxbox contains foo

Optional argument trick. + +no-opt and opt-bar-arg[optional]

+

ncaand ncband nccarg1arg2 and +ncdarg1arg2 and ncdxarg2

+

Another idea (heiko) + no-opt and opt-bar-arg[optional]

+

xx +xyzxyz

+

31=31, +0=0 +11101=11101

+
+Test verbatim +

Essai de verbatim 1) ␣x␣y 2) ␣x␣y

+

5 test:!@#$%^&*()_$

+

6 test:{\foo\}etzxcvbnm,./

+

7 testZXVBNM<>?~

+

8 test\verb+\verb-xx-+

+

9 testligatures:<<>>``''--et---!

+

10 !\end{verbatim}Notthisone

+

11 \end{notverbatim}

+

Fin du verbatim. \toto et \verb+{}$$. +\begin{verbatim} doit passer Autre verbatim (sans numro)

+

test:!@#$%^&*()_$

+

test:{\foo\}etzxcvbnm,./

+

testZXVBNM<>?~

+

test\verb+\verb-xx-+

+

testligatures:<<>>``''--et---!

+

testBL:\\738!et\\838!.

+

Verbatim_line

+

Verbatim_line

+

Verbatim env with line numbers

+

1 TEST

+

and without

+

[ok]TEST

+

TEST

+

5 5,oneline

+

6 6,oneline

+

9 9,oneline

+

10 10,oneline

+

Test of \DefineShortVerb and \UndefineShortVerb. + +test 1 toto x +x- |t| + +test 2 toto +x+ +x- +t+ +espace: ++ + +Verbatimfoo: +foo+*foo*foo* +Verbatimfoo: +foo+*foo*foo*.

+

} +Test },|, $_.

+

+␣+

+

Some␣Verbatim␣text.

+

++, , .

+

MoreVerbatimtext.

+

SomeVerbatimtext.

+Thesignfunction:𝒮(x)=-1x<00x=01x>0 +

Verbatim test

+

\verb+{}$$. +\verb+␣{␣}␣$$. ++x+!

+
+ifthenelse +

ok1 +ok2 +ok3 +ok4 +ok5 +ok6 +ok7 +ok8 + + +ok9 +ok10 +ok11 +ok12 +ok13 +ok14 +ok15 +ok16 +ok17 +ok18 +ok19 +ok20 +ok21

+

dd et rr.

+

You agree “OK” or don't “not OK”. +D'accord “OK” ou pas “not OK”.

+
+CALC +

1=1 +-5=-5

+

28.4526pt=28.4526pt + 0.99985pt=0.99985pt + 0.99998pt=0.99998pt + 1.00018pt=1.00018pt + 0.99985pt=0.99985pt + 0.99985pt=0.99985pt + 1.00018pt=1.00018pt + 1.00018pt=1.00018pt

+

6 +10.0pt=10pt + 321=321

+

a +x

+

2

+ok

, and ok, and ok, and ! +okok3

+ok

and ; okok. +XY. +XxY. +XxY. +XxY. +XxY. +XxY. +XxY.

+

Test.236.47191pt plus 0.03815pt=236.47191pt plus 0.03815pt.

+x

axb +axb

+

test hbox AabB. +some box content.

+

UPPERCASE

+

33.4

+

+
+
+

+

{} +{} +YX

+

0

+ +Biblio +

This is some text +, text, +foo +p32, p32, +text, , +, p3,

+key1key2

MINIPAGE +Hn Thế Thnh designed pdf. ł and ł.

+

In Tralics version 2, you can say Thế

+𝙰𝚊𝒜𝐀𝐚 Aa 𝐴𝑎𝔸𝖠𝖺Aa𝙱𝚋𝐁𝐛 Bb 𝐵𝑏𝔹𝖡𝖻Bb𝙲𝚌𝒞𝐂𝐜 Cc 𝐶𝑐𝖢𝖼Cc𝙳𝚍𝒟𝐃𝐝 Dd 𝐷𝑑𝔻𝖣𝖽Dd𝙴𝚎𝐄𝐞 Ee 𝐸𝑒𝔼𝖤𝖾Ee𝙵𝚏𝐅𝐟 Ff 𝐹𝑓𝔽𝖥𝖿Ff𝙶𝚐𝒢𝐆𝐠 Gg 𝐺𝑔𝔾𝖦𝗀Gg𝙷𝚑𝐇𝐡 Hh 𝐻ℎ𝖧𝗁Hh𝙸𝚒𝐈𝐢 Ii 𝐼𝑖𝕀𝖨𝗂Ii𝙹𝚓𝒥𝐉𝐣 Jj 𝐽𝑗𝕁𝖩𝗃Jj𝙺𝚔𝒦𝐊𝐤 Kk 𝐾𝑘𝕂𝖪𝗄Kk𝙻𝚕𝐋𝐥 Ll 𝐿𝑙𝕃𝖫𝗅Ll𝙼𝚖𝐌𝐦 Mm 𝑀𝑚𝕄𝖬𝗆Mm𝙽𝚗𝒩𝐍𝐧 Nn 𝑁𝑛𝖭𝗇Nn𝙾𝚘𝒪𝐎𝐨 Oo 𝑂𝑜𝕆𝖮𝗈Oo𝙿𝚙𝒫𝐏𝐩 Pp 𝑃𝑝𝖯𝗉Pp𝚀𝚚𝒬𝐐𝐪 Qq 𝑄𝑞𝖰𝗊Qq𝚁𝚛𝐑𝐫 Rr 𝑅𝑟𝖱𝗋Rr𝚂𝚜𝒮𝐒𝐬 Ss 𝑆𝑠𝕊𝖲𝗌Ss𝚃𝚝𝒯𝐓𝐭 Tt 𝑇𝑡𝕋𝖳𝗍Tt𝚄𝚞𝒰𝐔𝐮 Uu 𝑈𝑢𝕌𝖴𝗎Uu𝚅𝚟𝒱𝐕𝐯 Vv 𝑉𝑣𝕍𝖵𝗏Vv𝚆𝚠𝒲𝐖𝐰 Ww 𝑊𝑤𝕎𝖶𝗐Ww𝚇𝚡𝒳𝐗𝐱 Xx 𝑋𝑥𝕏𝖷𝗑Xx𝚈𝚢𝒴𝐘𝐲 Yy 𝑌𝑦𝕐𝖸𝗒Yy𝚉𝚣𝒵𝐙𝐳 Zz 𝑍𝑧𝖹𝗓Zz +

𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵

+

xx

+

abc

+

xx

+

abc

+

abc

+

abc

+

abc

+

some text +some text

+

With opt AABBWithout opt CC + + +Without opt BBWithout opt CC

+

xfoo

+
+Letter c +

testchar< + Ĭ ~ -- '' `` << >> +;:!?&~--``xx''<<>>;:!?& +–“;:!?”& + +< + Ĭ ~ -- '' `` << >> +;:!?&~--``<<>>;:!?&'' +–“<<>>;:!?”& + +𝐚a𝒸d

+

a b c +a b c

+

the letter the letter %the character =

+

abc ˜abc ^abc abc abc abc _abc abc abc abc

+

x

+AAAAAAABBBBBCCCCCCCCCABCABCABCABC1223412234122340123456789abcdefCA0123456789abcdef0123456789abcdefCA0123456789abcdefABC +x ˙=Ax+g(x,u)y=Cxx𝐑 n +

1.123456789abc123456789abc

+

2.123456789abc

+

3.123456789abc123456789abc

+

4.123456789abc

+

5.123456789abc123456789abc

+

6.123456789abc

+

FILL

+

ABCparshape

+

11 +a '2 a '2

+

2

+

a) x1 +b) x2 +c)

+x3 +

d)

+x4 +

e)

+x5 +

text A

+

text B

+

text C

+

line one

+

this is the second line

+

text A

+

text B

+

text C

+

text D

+

short line

+

a longer line

+

a still longer line

+

a very long line of text

+

Some text Some text Some text +Some text Some text Some text Some text

+

1st xime ysome text +1efoobar.

+

+

1st xime ysome text +1efoobar. +FooBar

+

rmmdup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfmdup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttmdup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmbfup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfbfup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttbfup +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmmdit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfmdit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttmdit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmbfit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfbfit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttbfit +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmmdsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfmdsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttmdsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmbfsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfbfsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttbfsc +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmmdsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfmdsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttmdsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+rmbfsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+sfbfsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+ttbfsl +Textrm Textsf Texttt +Testbf Textit Textsc Textsl +Textnormal Textmd Emph Textup

+

+

1234567890

+

1234567890

+

AaBb Cc Dd Ee Ff +Gg Hh Ii Jj Kk

+

+x ˙=Ax+g(x,u)y=CxxR n +a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F + + + + + + + + + +aaa +bbb +ccc +ddd +eee +fff +
+
+A + +B + +C c +Ddd +E +F +G +

Text

+

more text + +

+
+A +

+

+
+B +x +
+ +

a

+
+

b

+
+ +xxxxx +

123

+
+xxxxx +

456

+
+

ENDOFSUBSECTION

+ +

Test tilde:~ab. +a~b~n_d +a~b~n_d +texta +a~b~n_d +URL in footnote.... +a~b~n_d +a~b~n_d +texta +a~b~n_d

+arccos 2 (x),arcsin 2 (x),arctan 2 (x),arg 2 (x),cos 2 (x),cosh 2 (x),cot 2 (x) +coth 2 (x),csc 2 (x),deg 2 (x),dim 2 (x),exp 2 (x),hom 2 (x),ker 2 (x),lg 2 (x) +

jX *X *abcabc nabc nabc xyzabc xyz

+n+m 2 nn+m 2 nn+m 2 n n+m 2 nn+m 2 nn+m 2 n +

+

+

1st xime ysome text.

+1 2aaa bbbn m +IngoZschoch01-01-2004

a ba ba ba b

+

a ba ba b +a ba ba b +foo bar

+n+m 2 nn+m 2 nn+m 2 n +ln 2 (x),log 2 (x),Pr 2 (x),sec 2 (x),sin 2 (x),sinh 2 (x),tan 2 (x),tanh 2 (x) +det x=1 ,gcd x=1 ,inf x=1 ,inj lim x=1 ,lim x=1 ,lim inf x=1 ,lim sup x=1 ,max x=1 ,min x=1 ,proj lim x=1 ,sup x=1 +sup x=2 y1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f)1 klog 2 c(f) +

aaaaaaaaaaaaaaaaaa 111111111 +aaaaaaaaaaaaaaaaaa 111111111 +abc def +abc def +abc def +abc def

+

1a, 2a, 3b, +4a~b~n_d, +5a~b~n_d,

+

1a, 2a, 3b, +4a~b~n_d, +5a~b~n_d.

+

a ˜,z ˜,a+b ˜

+

αβγδϵϵζηθικλμνξπρστυϕχψωϖϱςφϰϑ +ΓΔΘΛΞΣϒΦΠΨΩ

+

+

±×÷*·⨿

+

+

+ + + + + +

+

ok

+

oka +okb

+

okb

+

0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1

+

ok

+

ok +ok +ok +ok +ok

+

*****

+

y

+

0.0pt00.0pt

+

=1=2===3=4

+

=1=2==25=3=4

+

𝙿 P

+

The first thirty prime numbers are 2,3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, and113. trial division macro was +expanded 132 times.

+a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F +ab +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +
+

á á +a ^a ´a a ˙a ˘a ˇa `a a ¨a ˜

+d=z 2 =(I t +Ivvvv +Idiv(vvvvv )) 2 , +

ab=1c +ab1c

+

℃₩₦₤ƒ₫‰‱※†

+

‡‶″‵′⁅⁆Ω℧№

+

℗℞℠℮•‽

+

+

IEME 1er 1re 1ers 1res 2e 2es no No

+ +Propositional linear +logic + + +Rudimentary linear +logic + + +Negation +Multiplicatives +Additives +Exponentials +Negation +A + + + +Conjunction + +AB +A&B + +Disjunction + +AB +AB + +Implication + +AB + + +Constants + +1, +,0 + +Modalities + + + +!A, ?A +
+cm1 +2 +3 +4 +5 +car

http://www-sop.inria.fr/miaou/Jose&Grimm + + + + + + + +

+

+ + + + +1Ab2Ab3Ab4Ab5Ab6Ab7Ab

+ + + + + +

x y ϵ ϵ

+B (r )=μ 0 4π3m (r ' )·(r -r ' ) |r -r ' | 5 (r -r ' )-m (r ' ) |r -r ' | 3 . +

+

+

...'ıȷ¬

+

+

¬¬

+

x 2 1 y 4 3 x 2 1 y 4 3 x 2 1 y 4 3 []abcdef

+

1bcd

+

123

+ +aaabbbcccdddeeeW

1 i I a A * *

+

2 ii II b B

+

3 iii III c C

+

4 iv IV d D

+

5 v V e E

+

6 vi VI f F

+

7 vii VII g G ** **

+

8 viii VIII h H

+

9 ix IX i I

+

10

+

x 2 1 y 4 3 +x 2 1 y 4 3 + 0 x 2 1 y 4 3

+

+

Redefining par +!

+

!

+

Redefining par

+

3

+ +

This is the first item

+
+

This is the second item

+
+

This is the last item

+ +

description of a.

+
+

description of b.

+
+

description of cde.

+
+

description of other letters

+ +

One

+
+

Two

+
+

Threee

+
+
+
+

A:aa, B:bb, C:

+D:a=y, E: a=bbydefinition.

+

A:aa B:bb C:cc C:cc +Dtext +Etext +Ftext

+

+ +𝒳 𝓎 and 𝒳 𝓎 𝒵 +sin(x)+cos 2 (x) and xyz t

+

1 a 2 +1 b 2 +[1 x 2 [

+

f)a+b(=c+d +f(a+b)=c+d

+

ab

+

wwwwwwwwwwwwa...b...cde f$g%h&ijk{l}mın♯o♮p♭q_

+

ab...cdef$g%h&ijk{l}mınopq_

+

Math spacing

+

xxxxx

+

xxxxx

+

aaa

+

aaa

+

!?#_.@%/|

+List of Very Important Persons 1 + +author of + +No footnote here + +List of Very Important Persons 2 +Jeande la FontaineTalesFrenchphd +DonaldKnuthMathAmericanauthor of +LeslieLamportComputer ScienceAmerican +JoseGrimmSophiaInriaFrenchNo footnote here, funny text + +List of Very Important Persons 3 + +author of + + +List of Very Important Persons 4 +Jeande la FontaineDonaldKnuthauthor of LeslieLamport +Ok +Ok +Ok +Ok +Ok + +

B

+
+Glossary

y

+
+A + +B + +C +D +E +F +G + +first +second +

ab c 0 xxxxxxxxxxxxxxxxxxxxxxxxxxxx +foo +okopt +anote +

par1

+

pr2

+ +last +

+

A

+

B

+ +
+

+
+
+
+

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is normal

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is normal

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is normal

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is center

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is center

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is center

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is left

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is left

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is left

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is right

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is right

+

This is some text explaining and showing how text is centered, +flushed left or flushed right or indented or not indented. Mode is right

+a +b +c +s +e +
+

XX

+

0,

+

2294XX

+

2298XX

+

XX

+

X

+

2340XXbar

+

barX

+barY

2340AbcAbcAbc

+ +latex +xml +translator +

ligne2060

+a +b +c +s +e +
+

Gcd(144,272) = +gcd(144,128) = gcd(16,128) = gcd(16,112) = gcd(16,96) = gcd(16,80) = gcd(16,64) = gcd(16,48) = gcd(16,32) = gcd(16,16) = 16.

+

gcd(144,272) = gcd(144,128) = gcd(16,128) = gcd(16,112) = gcd(16,96) = gcd(16,80) = gcd(16,64) = gcd(16,48) = gcd(16,32) = gcd(16,16) = 16.

+

Gcd(144,272) = Gcd(128,144) = Gcd(16,128) = Gcd(16,112) = Gcd(16,96) = Gcd(16,80) = Gcd(16,64) = Gcd(16,48) = Gcd(16,32) = 16.

+

Xgcd(144,272) = Xgcd(144,128) = Xgcd(128,16) = Xgcd(16,112) = Xgcd(16,96) = Xgcd(16,80) = Xgcd(16,64) = Xgcd(16,48) = Xgcd(16,32) = 16.

+

* + + + + + +** + +

+

EOLy

+

FooBar +FooBar

+

3 23

+

123456789abc 123456789abc +7686 7686 +7686 7686 +7e8e 7e8e

+ +a +

aa

+
+b +

bb

+righmarkrighmarkleftmarkleftmarkOKOK

ok

+a +b +c +A +B +C +
+a1 +a2 +a3x +a4 +b1 +b2x +b3 +b4 +c1 +c2x +c3 +c4 +d1 +d2x +d3 +d4 +Wa1 +Wa2 +Wa3x +Wa4 +Wb1 +Wb2x +Wb3 +Wb4 +Wc1 +Wc2x +Wc3 +Wc4 +Wd1 +Wd2x +Wd3 +Wd4 +

+B

+

okok

+

+
+x +

xx

+

yy

+
+abc +

abc

+

def

+ab +
+abc +

abc

+

def

+
+abc +

abc

+

def

+
+abc +

abc

+

def

+
+abc +abc +

abc

+

def

+

+
+x

+

a

+

a1

+

a2

+

a3

+

a4

+

b

+

b1

+

b2

+

b3

+

b4

+

c

+

c1

+

c2

+

c3

+

c4

+

d

+

d1

+

d2

+

d3

+

d4

+

fe

+

e1

+

e2

+

e3

+

e4

+

A

+

A1

+

A2

+

A3

+

A4

+

B

+

B1

+

B2

+

B3

+

B4

+

C

+

C1

+

C2

+

C3

+

C4

+

D

+

D1

+

D2

+

D3

+

D4

+

F

+

E

+

E1

+

E2

+

E3

+

E4

+

I

+

I1

+

I2

+

I3

+

I4

+

J

+

J1

+

J2

+

J3

+

J4

+aaaaaaaac +b +c +d +
+a +b +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +A +BCD +E +F +ab +c +d +e +f +aaa +bbb +ccc +ddd +eee +fff +
+1Ax +2By +b3Cza +1100x +210y +b31za +
+

test de table

+ +

+
+
+a:c +
+ +

+

+
+
+
+
+

+

Corollary 1 This is a sentence typeset in the theorem environment Cor.

+ +

Example 17.1 This is a sentence typeset in the theorem environment Exa.

+ +

Remark 1 This is a sentence typeset in the theorem environment Rem.

+ +

lemma 2 (Ben User) +This is a sentence typeset in the theorem environment Lem.

+ +

Definition 3 (Very Impressive definition) +This is a sentence typeset in the theorem environment Def.

+ +argmin Ψ θΘ ΔΦ θ Ω s -Ω t x y z =x y z =x y z =x y z =x y z =x y z =x y z =x y z {2 3} + +

text

+

+ +0.366,2.133, 1.25,3.19, 2.5,4.42, +5.0,6.10, 7.5,7.24, 10,8.09, 15,9.28, 20,9.90, 30,10.3, +40,10.22, 50,9.80, 60,8.98, 70,7.70, 80,5.91, 90,3.79, +95,2.58, 99.24,1.52 + +1.25,0, 99.24,0 +

+

The RAF 6E has a flat undersurface.

+

+ + + + + + +0.366,2.133, 1.25,3.19, 2.5,4.42, +5.0,6.10, 7.5,7.24, 10,8.09, 15,9.28, 20,9.90, 30,10.3, +40,10.22, 50,9.80, 60,8.98, 70,7.70, 80,5.91, 90,3.79, +95,2.58, 99.24,1.52 + +1.25,0, 99.24,0 +

+

The RAF 6E has maximum lift at angles of attack over 12 .

+ +80,0, 0,0, 40,100, 80,0, 0,0 +150,0, 190,100, 230,0 +300,0, 340,100, 380,0 + + + + + + + + +
Protocol +Proof +
max # of +“back” steps +
+Time +ms. +
+Otway-Rees +Yes +0 +0.35 + +

112233

+

=torture

+

4

+

00

+

Bx

+

m

+

1 2 +1 2 +2 1

+1 +

x=0123456789 +4 3 4 3̡񔌡 +XYZ

+ + + +BRACETEST1 leave leave a leave H + + + +Some title +http://www.inria.fr/rrrt/rt-0265.html50 +70 +21 +some note + + + +Mathematical Markup Language (MathML) Version 2.0 +http://www.w3.org/TR/MathML2/ +2001 +

markXY +XYZ T

+

‰‱′″

+

‴‵‶‷

+

+

OK

+

Blabla

+

Blabla

+

Test: AfooA and AbarA

+

Bline1B

+

Bline2B

+

123

+0=1 +

Unskip:a bcde

+

DMObarOK*barok

+

ok +Ifempty 122112112122122112112122 222. +Ifempty 122112112122122112112122 222.

+

This is a date +a a b +ab

+

A

+BxyA +

D

+

Gobble:xxx

+

soul:ABCxyzwetc

+

HEY!

+ +

bla bla

+
+

ble ble

+
+

blu blu

+ +

e1

+
+

e1

+
+

e3

+
+ + +

i1

+
+

i2

+
+

i3

+
+

i5

+
+
+

e5

+
+
+

bli bli

+
+

-'`<><<>> + +-'`<>

+

00

+Vest1Vest2 3West1West2 3

A

+

B

+

C

+

D E F +G +

+

Reference to figure: +Reference to first subfigure: +Reference to second subfigure:

+
main figure caption +

+
+ + +
+ +(a) first subfigure caption(b) second subfigure caption

+
main figure caption +first subfigure caption +second subfigure caption + +
+Infinite and finite discrete time signal processing. +abcdefghiabcdefghi
+bar
+

+

Example 17.2 +This is a sentence typeset

+

in the theorem environment Exa.

+ +

Example 17.3 +This is a sentence typeset

+

in the theorem environment Exa.

+
+ +Example +

x

+
+

Example 17.5 x

+ + +Example +

x

+
+

Example 17.7 x

+ +

Aξξ 1 Bξ 1 +𝐀ξξ 1 𝐁ξ 1 +α

+

ABCDEFGHIJ +aBc +

+

+ +

one

+
+

two

+
+

three

+ +

three.one

+
+

three.two

+
+

three.three

+ +

three.three.one

+
+

three.three.two

+
+

three.three.three

+ +

three.three.three.one

+
+

three.three.three.two

+
+

three.three.three.three

+
+
+
+
+a table with a caption +opt arg for caption +
+
+
+
+
+

border matrix CIC ' C(100)Ib-b0Ca ' 1-a

+

+a: UPPER MiXeD Mixed UPPER

+

b: UPPER BarMixed Yy, Zz UPPER

+

c: TEXT AND UPPER +d: UPPER

+

a: lower MiXeD Mixed lower

+

b: lower BarMixed Yy, Zz lower

+

c: TEXT AND LOWER +d: lower

+

AT_DOC_END

+ diff --git a/thirdparty/tralics-2.15.2/Modele/tpa.xml b/thirdparty/tralics-2.15.2/Modele/tpa.xml new file mode 100644 index 0000000..5ab68e3 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tpa.xml @@ -0,0 +1,45 @@ + + + + + +Titlepage customisation in Tralics +No title +José Grimm +Knuth +JG +DEK + +No authors +

+This is an abstract with

+

some paragraphs in it

+

ok ? +

+ +This is an abstract without paragraphs in it + +

Another abstract

+

with

+

in it

+Another abstract without par +no abstract1 +no abstract2 +no abstract3 +no abstract4 + + + + + + + + + +
somewhere
+nodefault +CMDA +CMDB +CMDC +
+
diff --git a/thirdparty/tralics-2.15.2/Modele/tpa2.xml b/thirdparty/tralics-2.15.2/Modele/tpa2.xml new file mode 100644 index 0000000..8e0b866 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tpa2.xml @@ -0,0 +1,252 @@ + + + + + +Chapter one +

OK

+
+ +First Part of document +

Some text here

+
+Second Part +Chapter two +Section one +Subsection one +Subsubsection one +First paragraph +First sub paragraph +

Normal text

+
+

We are now in the backmatter.

+a +b +c +d +e +f +A +BCD +E +F +ab +c +d +e +f + +
+

+

+

Caption of the figure

+ +

(a)  one(b)

(c)  two(d)

+ +a +b +

ok

+
+

a

B

+

C

+

D

+
+

a caption

+
+ one

+

b x +ab

+a +

+

A

+

+ +a +

B

+
+

C

+ +
+

D

+ +ok +
+

a

+

c

+
b

+

fob +foo +foo +foo +foo +foob +x +foofoofoofoo

+ + +some text here150,0, 190,100, 230,0 +300,0, 340,100, 380,0 +80,0, 0,0, 40,100, 80,0, 0,0 + + +

b

+
+

b

+
+ +

item value

+ +

okok

+
+ + +

First

+
+

Second

+ +

some item

+
+

another one

+
+
+
+
+ +Corollary +Important +

this is easy

+
+

abcde +fg +hij

+

abcdefghij

+

abcdef +xxx abcd +efhhi +Normal text

+

+ +1bk=,BK=,N=Citation,S=Citation. + + +

+

p 30

+key1

OKOK

+

+2bk=toto,BK=,N=bibitem,S=p. +tata

+

+3bk=,BK=toto,N=Bibitem,S=p. +tata +()

+

No everything tested here

+ + + +xxOk +The famous glossaryaa

bb

+
cc

dd

+

Text +barbarbar

+

Word + +

+ +first +second +(max,+) +

éfoo

+

xy

+ x +

x

+

a

+

b

+

A

+

B

+

C

+

D

+

E

+a +b +x +

+abx

+

ok +

+ +Corollary +

This is a sentence typeset in the theorem environment Cor.

+
+

+ +Example +

+This is a sentence typeset

+

in the theorem environment Exa.

+
+ +Remark +

This is a sentence typeset in the theorem environment Rem.

+
+ +lemma +Ben User +

This is a sentence typeset in the theorem environment Lem.

+
+ +Definition +Very Impressive definition +

This is a sentence typeset in the theorem environment Def.

+
+ + + + +

            + +cm1 +2 +3 +4 +5 +car

+

On the fly changes are possible, for instance +ab + +ab

+

You can change attributes also

+

B

+

B

+Section twoSection 1 +Subsection twoSubsetion 2 +

A

+x +

B

+x +
+

C

+x +

+A

+x +

B

+x +
+

C

+x +
+

text

+ +

              

+

text

+

Same test as in torture file + +

+
+
+a :c +

+foo +barb +bara + diff --git a/thirdparty/tralics-2.15.2/Modele/tpa2x.xml b/thirdparty/tralics-2.15.2/Modele/tpa2x.xml new file mode 100644 index 0000000..fd74583 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/tpa2x.xml @@ -0,0 +1,265 @@ + + + + + +Chapter one +

OK

+
+ +First Part of document +

Some text here

+
+Second Part +Chapter two +Section one +Subsection one +Subsubsection one +First paragraph +First sub paragraph +

Normal text

+
+

We are now in the backmatter.

+a +b +c +d +e +f +A +BCD +E +F +ab +c +d +e +f + +
+

+

+

 one

+

 two

+

Caption of the figure

+

+ +

a +b +
+

ok

+

+
+

a

B

+

C

+

D

+
+

a caption

+
+ one

+

b x +ab

+a +

+

A

+

+

a +
+

B

+

+
+

+

C

+

+ +

+

D

+
ok

+ +

a

+

c

+
b

+

fob +foo +foo +foo +foo +foob +x +foofoofoofoo

+ + +some text here150,0, 190,100, 230,0 +300,0, 340,100, 380,0 +80,0, 0,0, 40,100, 80,0, 0,0 + + +

b

+
+

b

+
+ +

item value

+ +

okok

+
+ + +

First

+
+

Second

+ +

some item

+
+

another one

+
+
+
+
+ +Corollary +Important +

this is easy

+
+

abcde +fg +hij

+

abcdefghij

+

abcdef +xxx abcd +efhhi +Normal text

+

+ +1bk=,BK=,N=Citation,S=Citation. + + +

+

p 30

+key1

OKOK

+

+2bk=toto,BK=,N=bibitem,S=p. +tata

+

+3bk=,BK=toto,N=Bibitem,S=p. +tata +()

+

No everything tested here

+ + + +xxOk +The famous glossaryaa

bb

+
cc

dd

+

Text +barbarbar

+

Word + +

+ +first +second +(max,+) +

éfoo

+

xy

+ x +

x

+

a

+

b

+

A

+

B

+

C

+

D

+

E

+a +b +x +

+abx

+

ok +

+ +Corollary +

This is a sentence typeset in the theorem environment Cor.

+
+

+ +Example +

+This is a sentence typeset

+

in the theorem environment Exa.

+
+ +Remark +

This is a sentence typeset in the theorem environment Rem.

+
+ +lemma +Ben User +

This is a sentence typeset in the theorem environment Lem.

+
+ +Definition +Very Impressive definition +

This is a sentence typeset in the theorem environment Def.

+
+ + + + +

            + +cm1 +2 +3 +4 +5 +car

+

On the fly changes are possible, for instance +ab + +ab

+

You can change attributes also

+

B

+

B

+Section twoSection 1 +Subsection twoSubsetion 2 +

A

+

x

+
+

B

+

x +

+
+

C

+x +

+A

+

x

+
+

B

+

x +

+
+

C

+x +
+

text

+
+

+ +

              

+ +

text

+ +

Same test as in torture file + +

+
+
+a :c +

+foo +barb +bara + diff --git a/thirdparty/tralics-2.15.2/Modele/txerr.xml b/thirdparty/tralics-2.15.2/Modele/txerr.xml new file mode 100644 index 0000000..d913dff --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/txerr.xml @@ -0,0 +1,9 @@ + + + + +

This file contains a number of error + +Undefined environment

+

Now we have We have also !

+
diff --git a/thirdparty/tralics-2.15.2/Modele/txtc.xml b/thirdparty/tralics-2.15.2/Modele/txtc.xml new file mode 100644 index 0000000..3f17f3a --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/txtc.xml @@ -0,0 +1,209 @@ + + + + +A sample file for TralicsJosé Grimm

This document shows some commands of Tralics. +We use it also to show that characters are converted into the right encoding +in a lot of situations, including commands, titles, indices etc. +The XML result is translated via XSLT into HTML +and available on the web +http://www-sop.inria.fr/apics/tralics/txtc.html. +Source document can be found at +http://www-sop.inria.fr/apics/tralics/doc-step.html.

+
Latex, XML, HTML, UTF8, Hàn +Who is Hàn +

If you call tralics with options -te1a ou -te8a, the terminal should show +^^e0Index here for the section title; +if you say -te1, there is a single byte, if you say +-te8, there are two bytes. If you say -e1a or -e8a, the XML file should +contain &#E0;, in the case -oe1 ou -oe8, the XML file contains the +characters shown on the terminal.

+

The following lines try to demonstrate that Tralics handles 16bit characters. +An error will be signaled because the argument is out of range; but the +character with hex value 312 should be valid; the command defined here +by csname has two characters in its name, it must be followed by an +exclamation point (a space is allowed between the command and the exclamation +point). + + + +123! 123! 312!

+

This is standard verbatim: a _bç, a␣_bç, a _bç, +\verb+ { } $$, +x+. Think about this last example. +We index here a word. Location is just before period. +This is a verbatim environment

+

{\let\rm\bf \bf totoé}

+

<​!-​-​this is a comment -​-​>​

+

&Dollar; not &Equals; &Euro;

+

{\let\rm\bf \bf totoé} + +&Dollar; not &Equals; &Euro;

+

Note. A verbatim environment neutralises meaning of some commands. +The last line of the verbatim environment should start with an ampersand +character; since this is a special character in XML, it is represented as +&amp; or &#x26;. Lines can be numbered; spaces can be replaced +by non-breaking ones; lines can use special fonts; paragraphs can be +no-indented, etc.

+

On the other hand, a rawxml environment is left unchanged. Remember however +that end-of-line characters and spaces are removed from the end of the line; a +new line character is added at the end of the line. If you remove the comment +between the two environments, replacing it by an empty line, then the second +environment will be in vertical mode. Otherwise, the end of the verbatim +environment inserts a \noindent, and the environment that follows is in +horizontal mode. As a consequence, there will be a P element on the first +line of the raw xml; moreover, since the final space in a paragraph is +removed, you will find the end-P element at the end of the line.

+

The translation of the environment contains e-acute (its representation +depends on the output encoding), three ampersand characters, a less than sign, +a greater than sign. The second line is a valid XML comment, the third line is +well-formed XML (it contains three entities, so that the XML is valid only if +the DTD defines these entities); it is very easy to produce invalid and +ill-formed XML.

+

The xmllatex command is to be used with care. It can produce +Hàn Thế ThànhHàn is the author of +pdftex. The second argument is meant to be translated by , it is +ignored by Tralics. Instead of \xmllatex{foo}{bar}, define a command, +use it in the text, and overwrite it in a ult file (user configuratin file).

+

In the current version, you can say ế because the double-accent +mechanism is implemented, or ế, this is a character, as valid as the +other ones. This is possible and dangerous too .

+
+Index +

This demonstrates how accents work in the index +a +b +c +d +e +f +g +h +OK

+

These words are in the glossary +12 +34 +These are in the second index +12 +34

+

A verbatim test. We put some stuff in English and French before, in order +to show how it is translated differently. The end of the environment can +contain spaces (see example above), but nothing else. +test ligatures: <<>>“”– et — ! +test ligatures : «  »“”– et — !

+

1 test : !@#$%^&*()_$

+

2 test : {\foo\} et zxcvbnm,./

+

3 test ZXVBNM<​>​? ~

+

4 test \verb+\verb-​xx-​+

+

5 test ligatures: <​<​>​>​`​`​'​'​-​-​ et -​-​-​ !

+

6  \end+{verbatim} Not this one %% + added in version 2.11

+

7 \end{notverbatim}

+

Verbatim without line numbers.

+

test : !@#$%^&*()_$

+

test : {\foo\} et zxcvbnm,./

+

test ZXVBNM<​>​? ~

+

test \verb+\verb-​xx-​+

+

test ligatures: <​<​>​>​`​`​'​'​-​-​ et -​-​-​ !

+

test BL : \\738! et \\838!.

+

The BL test is funny ; why should it fail ? a long long time ago, before +it was called Tralics, our translator was written in Perl, and such a line +was illegal ; the math was converted by Omega, see . We cite also +(), and ().

+

We now test the verbatim extensions. We start with Verbatim +and demonstrate the counting possibilities

+

1 test line 1a

+

2 test line 1b

+

and without numbers

+

[numbers=true]test line 2a

+

[numbers=true]test line 2b

+

1 The environment has an optional argument; spaces but no newlines are allowed

+

2 between brace and bracket; what follows the argument on the line is ignored

+

We put here the first character of the line in italics

+

5 5 we use here counter number 3

+

6 6 for counting lines

+

Define our Verbatim hook now.

+

7 7 we use here counter number 03 (the same)

+

8 8 but the HTML output differs a lot.

+
+

9 9 we use here counter named vbcounter

+

10 10 initialised to the value of the previous counter

+
+

11 11 yet another verbatim line (ok with é^^e9?)

+

1 note that, if no counter is specified, it is FancyVerbLine

+
+

2 and that the first line is numbered one by default.

+

3 Of course, options given on the line have precedence over options

+

4 inherited from the definition.

+

In French, centré means centered.

+
+Short Verb, as in $_ +

Test of \DefineShortVerb and \UndefineShortVerb. Normally +the bar is used, but 16bit characters are possible. Example, with itrema : + +toto x +x-​ |t|, + +and without : +toto ïxï +x-​ ïtï +Spaces : like this + + or that +␣+ +Verbatimfoo : +␣foo␣+*foo*foo*.

+

Test of useverb A}A, A}A,A|A, A$_A.

+

BWe␣have␣changed␣the␣font,␣and␣added␣a␣prefixB

+

BSpaces␣are␣specialB

+

Testing accents

+

À È Ì Ò Ù Ǹ Ẁ Ỳ à è ì ò ù ǹ ẁ ỳ x̀

+

Á É Í Ó Ú Ý Ć Ĺ Ń Ŕ Ś Ź Ǵ Ḱ Ḿ Ṕ Ẃ Ǽ Ǻ Ǿ ǽ ǻ ǿ á é í ó ú ý ć ĺ ń ŕ ś ź ǵ ḱ ḿ ṕ ẃ v́

+

Â Ê Î Ô Û Ĉ Ĝ Ĥ Ĵ Ŝ Ŵ Ŷ Ẑ â ê î ô û ĉ ĝ ĥ ĵ ŝ ŵ ŷ ẑ

+

Ã Ñ Õ Ũ Ĩ Ṽ Ẽ Ỹ ĩ õ ã ñ õ ĩ õ ṽ ẽ ỹ w̃

+

Ä Ë Ï Ö Ü Ÿ Ḧ Ẅ Ẍ ä ë ï ö ü ÿ ḧ ẅ ẍ ẗ z̎

+

Ő Ű ő ű e̋

+

Å Ů å ů ẘ ẙ e̊

+

Č Ď Ě Ľ Ň Ř Š Ť Ž Ǎ Ǐ Ǔ Ǧ Ǩ Ȟ č ď ě ľ ň ř š ť ž ǎ ǐ ǔ ǧ ǩ ȟ ǰ x̌

+

Ă Ĕ Ğ Ĭ Ŏ Ŭ ă ĕ ğ ĭ ŏ ŭ x̆

+

Ā Ē Ħ Ī Ō Ŧ Ū Ȳ Ḡ Ǣ ǣ ā ē ħ ī ō ŧ ū ȳ ḡ

+

Ȧ Ḃ Ċ Ḋ Ė Ḟ Ġ Ḣ İ Ŀ Ṁ Ṅ Ȯ Ṗ Ṙ Ṡ Ṫ Ẇ Ẋ Ẏ Ż ȧ ḃ ċ ḋ ė ġ ḣ ŀ ṁ ṅ ȯ ṗ ṙ ṡ ṫ u̇ v̇ ẇ ż ẏ ż q̇

+

Ç Ģ Ķ Ļ Ņ Ŗ Ş Ţ Ȩ Ḑ Ḩ ç ģ ķ ļ ņ ŗ ş ţ ȩ ḑ ḩ b̧

+

Ą Ę Į Ǫ Ų ą ę į ǫ ų b̨

+

Ḁ E̥ I̥ O̥ U̥ R̥ ḁ e̥ i̥ o̥ u̥ r̥ y̥

+

Ḇ Ḏ Ḵ Ḻ Ṉ Ṟ Ṯ Ẕ ḇ ḏ ḵ ḻ ṉ ṟ ṯ ẕ ẖ e̠

+

Ḅ Ḍ Ḥ Ḳ Ḷ Ṃ Ṇ Ṛ Ṣ Ṭ Ṿ Ẉ Ẓ Ạ Ẹ Ị Ọ Ụ Ỵ ḅ ḍ ḥ ḳ ḷ ṃ ṇ ṛ ṣ ṭ ṿ ẉ ẓ ạ ẹ ị ọ ụ ỵ c̣

+

Ȃ Ȇ Ȋ Ȏ Ȗ Ȓ ȃ ȇ ȋ ȏ ȗ ȓ x̑

+

Ḛ Ḭ Ṵ ḛ ḭ ṵ o̰

+

Ḓ Ḙ Ḽ Ṋ Ṱ Ṷ ḓ ḙ ḽ ṋ ṱ ṷ a̭

+

Ḁ ḁ e̥

+

Ả Ẻ Ỉ Ỏ Ủ Ỷ ả ẻ ỉ ỏ ủ ỷ x̉

+

Some people dont like special characters + + +bad accent ̀ on x bad accent ̆ on z

+

Changing font size +xx +xyzxyz

+

Switch to English, for colons in URLs

+ + + +Mathematical Markup Language (MathML) Version 2.0 +2001 +http://www.w3.org/TR/MathML2/ + + +Produire du MathML et autres ...ML à partir d'Ω : Ω se généralise +Cahiers Gutenberg +33-34 +173-182 +1999 + + + +XSLT, Programmer's Reference +2nd +Wrox Press Ltd +2001 +
verb +vérb +vèrb +I1 +I2 +I3 +G1 +G2 +
diff --git a/thirdparty/tralics-2.15.2/Modele/txtd.xml b/thirdparty/tralics-2.15.2/Modele/txtd.xml new file mode 100644 index 0000000..804ff4e --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/txtd.xml @@ -0,0 +1,19 @@ + + + + + +

OK +a +b +c +d +e +f +g +h +OK

+verb +vérb +vèrb +
diff --git a/thirdparty/tralics-2.15.2/Modele/xii.xml b/thirdparty/tralics-2.15.2/Modele/xii.xml new file mode 100644 index 0000000..19acc14 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Modele/xii.xml @@ -0,0 +1,440 @@ + + + + +

On +the +first +day +of +Christmas +my +true +love +gave +to +me

+

a +partridge +in +a +pear +tree.

+

On +the +second +day +of +Christmas +my +true +love +gave +to +me

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +third +day +of +Christmas +my +true +love +gave +to +me

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +fourth +day +of +Christmas +my +true +love +gave +to +me

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +fifth +day +of +Christmas +my +true +love +gave +to +me

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +sixth +day +of +Christmas +my +true +love +gave +to +me

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +seventh +day +of +Christmas +my +true +love +gave +to +me

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +eighth +day +of +Christmas +my +true +love +gave +to +me

+

eight +maids +a +milking

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +ninth +day +of +Christmas +my +true +love +gave +to +me

+

nine +ladies +dancing

+

eight +maids +a +milking

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +tenth +day +of +Christmas +my +true +love +gave +to +me

+

ten +lords +a +leaping

+

nine +ladies +dancing

+

eight +maids +a +milking

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +eleventh +day +of +Christmas +my +true +love +gave +to +me

+

eleven +pipers +piping

+

ten +lords +a +leaping

+

nine +ladies +dancing

+

eight +maids +a +milking

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

+

On +the +twelfth +day +of +Christmas +my +true +love +gave +to +me

+

twelve +drummers +drumming

+

eleven +pipers +piping

+

ten +lords +a +leaping

+

nine +ladies +dancing

+

eight +maids +a +milking

+

seven +swans +a +swimming

+

six +geese +a +laying

+

five +gold +rings

+

four +calling +birds

+

three french +hens

+

two +turtle +doves

+

and +a +partridge +in +a +pear +tree.

diff --git a/thirdparty/tralics-2.15.2/README b/thirdparty/tralics-2.15.2/README new file mode 100644 index 0000000..1023fa2 --- /dev/null +++ b/thirdparty/tralics-2.15.2/README @@ -0,0 +1,56 @@ +This is the README file for Tralics + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL + http://www.cecill.info +See the files COPYING and Copyright for additional details. +Plain text version of the license are in the files + Licence_CeCILL_V2-en.txt Licence_CeCILL_V2-fr.txt + + +The archive contains four directories and some files. + + +The src directory contains the following files + Copyright: copy of the copyright notice + README: explains how to create the Tralics binary + Makefile : this is the Makefile + *.C *.h : the sources. +You get a binary version of Tralics by saying `make' in this directory. + +The confdir directory contains the following files + config_empty tralics_rc .tralics_rc + -> configuration files + - files of the form foo.tcf, these are Tralics configuration files + - files of the form foo.clt, these are Tralics version of class files + - files of the form foo.plt, these are Tralics version of packages +These files are used by Tralics; when you install a new version, you should +copy them in the appropriate place. + + +The Test directory contains some test files +The Modele directory contains translation of the test files. +The Test directory contains `alltests', + this is a shell script that compiles the test files and compares + them against models. + +Since July 2008, directories raweb, xml, styles, icons are distributed +in an alternate file, named tralics-extra-2.12.7.tar.gz +(the version number may vary). + + + +In case of problem contact : tralics@sophia.inria.fr +or consult the Web page: http://www.inria.fr/apics/tralics + + +The remaining of the archive is formed of miscellaneous files, that can be +used to convert the XML produced by Tralics into HTML, Pdf, or whatever. + + + +July 2008. + + diff --git a/thirdparty/tralics-2.15.2/Test/README b/thirdparty/tralics-2.15.2/Test/README new file mode 100644 index 0000000..2294ca5 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Test/README @@ -0,0 +1,34 @@ +Copyright Jos Grimm, Inria, projet APICS. 2004 +Email: Jose.Grimm@sophia.inria.fr + +This software is a computer program whose purpose is to +translate LaTeX documents into XML format. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + +------------------------------------------------------------------------------ + diff --git a/thirdparty/tralics-2.15.2/Test/alltests b/thirdparty/tralics-2.15.2/Test/alltests new file mode 100755 index 0000000..f41bba3 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Test/alltests @@ -0,0 +1,189 @@ +#!/bin/bash +# This file runs all Tralics tests +# Most file contain comment telling what happens +# The testb file requires bibtex. + +# We make sure that we call the right binary by saying ../src/tralics +# We also specify where to search for configuration files. + + +# This checks that no error is signaled. +run_tralics() { + local status + echo testing $1 + ../src/tralics -confdir=../confdir $* >> Trace + status=$? + if [[ $status != 0 ]] ; then + echo "Tralics failed for $1" + exit 1 + fi +} + +# in Tralics \read16 reads from the tty, and we use echo to provide a value +# the line is also printed on stderr, that we redirect to /dev/null +run_tralics_with_param() { + local status + echo testing $1 with $2 + echo $2 | ../src/tralics -confdir=../confdir $1 >> Trace 2>/dev/null + status=$? + if [[ $status != 0 ]] ; then + echo "Tralics failed for $1" + exit 1 + fi +} + +# Checking errors: we check for a string in the transcript file +# The XML file should contain an item for each error +run_tralics_with_err() { + local status + echo testing $1 + ../src/tralics -confdir=../confdir $1 $3 >> Trace + grep -q "$2" $1.log + status=$? + if [[ $status != 0 ]] ; then + echo "Tralics failed for $1" + exit 1 + fi +} + +# +compare_file () { + local nb hl + nb=4 + hl=2 + if [ $# = 2 ]; then + nb=$2 + fi + if [ $# = 3 ]; then + nb=$2 ; hl=$3 + fi + head -n $hl $1 > fileA + head -n $hl ../Modele/$1 > fileB + tail -n +$nb $1 >> fileA + tail -n +$nb ../Modele/$1 >> fileB + diff -q fileA fileB + if [[ $? != 0 ]] ; then + diff $1 ../Modele/$1 + echo "Wrong translation of $1 " + exit 1 + fi +} + + +echo "Tralics tests started at $(date) " > Trace +run_tralics hello +run_tralics hello1 +run_tralics hello2.tex -config=hello.tcf -oe8 +run_tralics hello3 +run_tralics testb +run_tralics_with_err txtc "There was one error." -nozerowidthelt +run_tralics txtd +run_tralics torture -oe1 -oldphi +run_tralics tormath +run_tralics tormath1 +run_tralics tormath2 -oe1 +run_tralics tormath3 -oe1 -oldphi +run_tralics amsldoc +run_tralics testmath +run_tralics fptest +run_tralics mathmlc +run_tralics_with_err tpa "No value given for command " +run_tralics tpa2 -nofloathack +mv tpa2.xml tpa2x.xml +run_tralics tpa2 +run_tralics_with_err txerr "There were 8 errors." -oe8a +run_tralics testpack +run_tralics testpackii -param bibtex_fields -year -param bibtex_extensions -phdthesis +run_tralics bo +run_tralics testhtml +run_tralics testclass -defaultclass=article +run_tralics_with_err testkeyval "There were 32 errors." +run_tralics xii +run_tralics_with_param comp_pi 100 +run_tralics_with_err teststr "There were 10 errors." +run_tralics_with_err testerr "Following images not defined: gee." "-year=2008" +run_tralics beauvilams2 +run_tralics testbe +run_tralics testb1 +mv testb1.xml testb0.xml +run_tralics testb1 -raw_bib +run_tralics exemple2003 +mv exemple.xml exemple2003.xml +run_tralics exemple2005 +mv exemple.xml exemple2005.xml +run_tralics exemple2006 +mv exemple.xml exemple2006.xml +run_tralics exemple2007 +mv exemple.xml exemple2007.xml +run_tralics exemple2008 +mv exemple.xml exemple2008.xml +run_tralics ex_emple2008 +mv ex_emple.xml ex_emple2008.xml +run_tralics exemple2009 +mv exemple.xml exemple2009.xml +run_tralics_with_err exempleb2011 "There were 8 errors." +mv exempleb.xml exempleb2011.xml +run_tralics exemple2011 +mv exemple.xml exemple2011.xml +run_tralics exemple2013 +mv exemple.xml exemple2013.xml +run_tralics testm1 -oe8 +mv testm1.xml testm1a.xml +run_tralics testm1 -nomathml -oe8 +mv testm1.xml testm1b.xml +run_tralics testm1 -dualmath -oe8 +mv testm1.xml testm1c.xml + +echo +echo Comparing results with models + +compare_file hello.xml +compare_file hello1.xml +compare_file hello2.xml 5 +compare_file hello3.xml 5 3 +compare_file fptest.xml 5 +compare_file testb.xml +compare_file txtc.xml +compare_file txtd.xml 5 3 +compare_file tpa.xml +compare_file tpa2.xml +compare_file tpa2x.xml +compare_file tormath.xml 5 +compare_file tormath1.xml 5 +compare_file tormath2.xml 5 +compare_file tormath3.xml 5 +compare_file amsldoc.xml +compare_file bo.xml 9 # there is a date on line 8 +compare_file testhtml.xml +compare_file testclass.xml +compare_file torture.xml 6 +compare_file txerr.xml +compare_file xii.xml +compare_file testkeyval.xml +compare_file comp_pi.xml +compare_file testpack.xml +compare_file testpackii.xml +compare_file teststr.xml +compare_file testerr.xml +compare_file testbe.xml +compare_file testb0.xml 5 +compare_file testb1.xml 5 +compare_file exemple2003.xml 5 +compare_file exemple2005.xml 5 +compare_file exemple2006.xml 5 +compare_file exemple2007.xml 5 +compare_file exemple2008.xml 5 +compare_file ex_emple2008.xml 5 +compare_file exemple2009.xml 5 +compare_file exemple2011.xml 5 +compare_file exempleb2011.xml 5 +compare_file exemple2013.xml 5 +compare_file beauvilams2.xml +compare_file testm1a.xml +compare_file testm1b.xml +compare_file testm1c.xml +compare_file testmath.xml + +echo done + + diff --git a/thirdparty/tralics-2.15.2/Test/amsldoc.tex b/thirdparty/tralics-2.15.2/Test/amsldoc.tex new file mode 100644 index 0000000..f2eba21 --- /dev/null +++ b/thirdparty/tralics-2.15.2/Test/amsldoc.tex @@ -0,0 +1,2691 @@ +%% HACK for Tralics, +\begin{filecontents+}{amsldoc.clt} +\ProvidesClass{amsldoc}[2004/08/06 v2.06] +\NeedsTeXFormat{LaTeX2e}[1995/12/01] + +\InputClass{std} +\@titlepagefalse +\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final} + +\ProcessOptions +\let\allowtthyphens \relax +\def\chaptername{Chapter} +\def\pkg#1{\xbox{EM}{\AddAttToCurrent{r}{pkg}#1}} +\def\opt#1{\xbox{EM}{\AddAttToCurrent{r}{opt}#1}} +\def\cn#1{\xbox{EM}{\AddAttToCurrent{r}{cn}#1}} +\def\ncn#1{\xbox{EM}{\AddAttToCurrent{r}{ncn}#1}} +\def\cs#1{\xbox{EM}{\AddAttToCurrent{r}{cs}#1}} +\def\indexcs#1{\xbox{EM}{\AddAttToCurrent{r}{indexcs}#1}} +\def\fn#1{\xbox{EM}{\AddAttToCurrent{r}{fn}#1}} +\def\cls#1{\xbox{EM}{\AddAttToCurrent{r}{cls}#1}} +\def\env#1{\xbox{EM}{\AddAttToCurrent{r}{cls}#1}} + +\providecommand{\mdash}{\textemdash\penalty\exhyphenpenalty} +\providecommand{\ndash}{\textendash\penalty\exhyphenpenalty} +\providecommand{\qq}[1]{\textquotedblleft#1\/\textquotedblright} +\def\mail{\texttt} +\def\<#1>{\textit{$\langle$#1\/$\rangle$}} +\def\addvspace#1{} + +\def\indexspace{ } +\def\tex/{\TeX} +\def\latex/{\LaTeX} +\def\amslatex/{\xbox{amslatex}{}} +\def\amstex/{\xbox{amstex}{}} +\def\xypic/{\xbox{xypic}{}} +\let\trivlist\relax \let\endtrivlist\relax +\chardef\bslchar=`\\ % p. 424, TeXbook +\let\addcontentsline\relax +\newenvironment{ctab}{ \begin{tabular}}{ \end{tabular}} +\newcommand*{\secref}[1]{\S\ref{#1}} + +\let\varGamma=\Gamma +\let\varSigma=\Sigma +\let\varDelta=\Delta +\let\varUpsilon=\Upsilon +\let\varTheta=\Theta +\let\varPhi=\Phi +\let\varLambda=\Lambda +\let\varPsi=\Psi +\let\varXi=\Xi +\let\varOmega=\Omega +\let\varPi=\Pi + +\let\error\relax +\newenvironment{error}{\tracingall% + \begingroup\catcode`\\=12 \catcode`\&=12 \expandafter\endgroup\errora +}{% +\end{xmlelement*} +} +\newcommand{\errora}[1]{\begin{xmlelement*}{error} \xbox{msg}{#1}} + + +\newcommand{\errexa}{\par\noindent\textit{Example}:\ } +\newcommand{\errexpl}{\par\noindent\textit{Explanation}:\ } + +\@nomathml=-3 +\end{filecontents+} + +%%% ==================================================================== +%%% @LaTeX-file{ +%%% filename = "amsldoc.tex", +%%% version = "2.09", +%%% date = "2004/04/06", +%%% time = "15:13:33 EDT", +%%% checksum = "39446 2620 11111 93831", +%%% author = "American Mathematical Society", +%%% address = "American Mathematical Society, +%%% Technical Support, +%%% Electronic Products and Services, +%%% P. O. Box 6248, +%%% Providence, RI 02940, +%%% USA", +%%% telephone = "401-455-4080 or (in the USA and Canada) +%%% 800-321-4AMS (321-4267)", +%%% FAX = "401-331-3842", +%%% email = "tech-support@ams.org (Internet)", +%%% copyright = "Copyright 1999 American Mathematical Society, +%%% all rights reserved. Copying of this file is +%%% authorized only if either: +%%% (1) you make absolutely no changes to your copy, +%%% including name; OR +%%% (2) if you do make changes, you first rename it +%%% to some other name.", +%%% supported = "yes", +%%% keywords = "latex, amsmath", +%%% abstract = "This file is the source file for the user's +%%% guide of the \LaTeX{} package amsmath .", +%%% docstring = "The checksum field above contains a CRC-16 +%%% checksum as the first value, followed by the +%%% equivalent of the standard UNIX wc (word +%%% count) utility output of lines, words, and +%%% characters. This is produced by Robert +%%% Solovay's checksum utility.", +%%% } +%%% ==================================================================== +\documentclass[leqno,titlepage,openany]{amsldoc}[1999/12/13] + +\ifx\UndEfiNed\url + \ClassError{amsldoc}{% + This version of amsldoc.tex must be processed\MessageBreak + with a newer version of amsldoc.cls (2.02 or later)}{} +\fi + +\title{User's Guide for the \pkg{amsmath} Package (Version~2.0)} +\author{American Mathematical Society} +\date{1999-12-13 (revised 2002-02-25)} + +% Use the amsmath package and amscd package in order to print +% examples. +\usepackage{amsmath} +\usepackage{amscd} + +\makeindex % generate index data +\providecommand{\see}[2]{\textit{see} #1} + +% The amsldoc class includes a number of features useful for +% documentation about TeX, including: +% +% ---Commands \tex/, \amstex/, \latex/, ... for uniform treatment +% of the various logos and easy handling of following spaces. +% +% ---Commands for printing various common elements: \cn for command +% names, \fn for file names (including font-file names), \env for +% environments, \pkg and \cls for packages and classes, etc. + +% Many of the command names used here are rather long and will +% contribute to poor linebreaking if we follow the \latex/ practice +% of not hyphenating anything set in tt font; instead we selectively +% allow some hyphenation. +\allowtthyphens % defined in amsldoc.cls + +\hyphenation{ac-cent-ed-sym-bol add-to-counter add-to-length align-at + aligned-at allow-dis-play-breaks ams-art ams-cd ams-la-tex amsl-doc + ams-symb ams-tex ams-text ams-xtra bmatrix bold-sym-bol cen-ter-tags + eqn-ar-ray idots-int int-lim-its latex med-space neg-med-space + neg-thick-space neg-thin-space no-int-lim-its no-name-lim-its + over-left-arrow over-left-right-arrow over-right-arrow pmatrix + qed-sym-bol set-length side-set small-er tbinom the-equa-tion + thick-space thin-space un-der-left-arrow un-der-left-right-arrow + un-der-right-arrow use-pack-age var-inj-lim var-proj-lim vmatrix + xalign-at xx-align-at} + +% Prepare for illustrating the \vec example +\newcommand{\vect}[1]{\mathbf{#1}} + +\newcommand{\booktitle}[1]{\textit{#1}} +\newcommand{\journalname}[1]{\textit{#1}} +\newcommand{\seriesname}[1]{\textit{#1}} + +% Command to insert and index a particular phrase. Doesn't work for +% certain kinds of special characters in the argument. +\newcommand{\ii}[1]{#1\index{#1}} + +\newcommand{\vstrut}[1]{\vrule width0pt height#1\relax} + +% An environment for presenting comprehensive address information: +\newenvironment{infoaddress}{% + \par\topsep\medskipamount + \trivlist\centering + \item[]% + \begin{minipage}{.7\columnwidth}% + \raggedright +}{% + \end{minipage}% + \endtrivlist +} + +\newenvironment{eqxample}{% + \par\addvspace\medskipamount + \noindent\begin{minipage}{.5\columnwidth}% + \def\producing{\end{minipage}\begin{minipage}{.5\columnwidth}% + \hbox\bgroup\kern-.2pt\vrule width.2pt% + \vbox\bgroup\parindent0pt\relax +% The 3pt is to cancel the -\lineskip from \displ@y + \abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip + \belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip + \noindent} +}{% + \par +% Ensure that a lonely \[\] structure doesn't take up width less than +% \hsize. + \hrule height0pt width\hsize + \egroup\vrule width.2pt\kern-.2pt\egroup + \end{minipage}% + \par\addvspace\medskipamount +} + +% The chapters are so short, perhaps we shouldn't call them by the +% name `Chapter'. We make \chaptername read an argument in order to +% remove a following \space or "{} " (both possibilities are present +% in book.cls). + +\renewcommand{\chaptername}[1]{} +\newcommand{\chapnum}[1]{\mdash #1\mdash } +\makeatletter +\def\@makechapterhead#1{% + \vspace{1.5\baselineskip}% + {\parindent \z@ \raggedright \reset@font + \ifnum \c@secnumdepth >\m@ne + \large\bfseries \chapnum{\thechapter}% + \par\nobreak + \vskip.5\baselineskip\relax + \fi + #1\par\nobreak + \vskip\baselineskip + }} +\makeatother + +% A command for ragged-right parbox in a tabular. +\newcommand{\rp}{\let\PBS\\\raggedright\let\\\PBS} + +% Non-indexed file name +\newcommand{\nfn}[1]{\texttt{#1}} + +% For the examples in the math spacing table. +%%\newcommand{\lspx}{\mbox{\rule{5pt}{.6pt}\rule{.6pt}{6pt}}} +%%\newcommand{\rspx}{\mbox{\rule[-1pt]{.6pt}{7pt}% +%% \rule[-1pt]{5pt}{.6pt}}} +\newcommand{\lspx}{\mathord{\Rightarrow\mkern-1mu}} +\newcommand{\rspx}{\mathord{\mkern-1mu\Leftarrow}} +\newcommand{\spx}[1]{$\lspx #1\rspx$} + +% For a list of characters representing document input. +\newcommand{\clist}[1]{% + \mbox{\ntt\spaceskip.2em plus.1em \xspaceskip\spaceskip#1}} + +% Fix weird \latex/ definition of rightmark. +\makeatletter +\def\rightmark{\expandafter\@rightmark\botmark{}{}} +% Also turn off section marks. +\let\sectionmark\@gobble +\renewcommand{\chaptermark}[1]{% + \uppercase{\markboth{\rhcn#1}{\rhcn#1}}} +\newcommand{\rhcn}{\thechapter. } +\makeatother + +% Include down to \section but not \subsection, in toc: +\setcounter{tocdepth}{1} + +\DeclareMathOperator{\ix}{ix} +\DeclareMathOperator{\nul}{nul} +\DeclareMathOperator{\End}{End} +\DeclareMathOperator{\xxx}{xxx} + +\begin{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\frontmatter + +\maketitle +\pagestyle{headings} +\tableofcontents +\cleardoublepage % for better page number placement + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mainmatter +\chapter{Introduction} + +The \pkg{amsmath} package is a \LaTeX{} package that provides +miscellaneous enhancements for improving the information structure and +printed output of documents that contain mathematical formulas. Readers +unfamiliar with \LaTeX{} should refer to \cite{lamport}. If you have an +up-to-date version of \LaTeX{}, the \pkg{amsmath} package is normally +provided along with it. Upgrading when a newer version of the +\pkg{amsmath} package is released can be done via +\url{http://www.ams.org/tex/amsmath.html} or +\url{ftp://ftp.ams.org/pub/tex/}. + +This documentation describes the features of the \pkg{amsmath} package +and discusses how they are intended to be used. It also covers some +ancillary packages: +\begin{ctab}{ll} +\pkg{amsbsy}& \pkg{amstext}\\ +\pkg{amscd}& \pkg{amsxtra}\\ +\pkg{amsopn} +\end{ctab} +These all have something to do with the contents of math formulas. For +information on extra math symbols and math fonts, see \cite{amsfonts} +and \url{http://www.ams.org/tex/amsfonts.html}. For documentation of the +\pkg{amsthm} package or AMS document classes (\cls{amsart}, +\cls{amsbook}, etc.\@) see \cite{amsthdoc} or \cite{instr-l} and +\url{http://www.ams.org/tex/author-info.html}. + +If you are a long-time \latex/ user and have lots of mathematics in what +you write, then you may recognize solutions for some familiar problems +in this list of \pkg{amsmath} features: +\begin{itemize} + +\item A convenient way to define new `operator name' commands analogous +to \cn{sin} and \cn{lim}, including proper side spacing and automatic +selection of the correct font style and size (even when used in +sub- or superscripts). + +\item Multiple substitutes for the \env{eqnarray} environment to make +various kinds of equation arrangements easier to write. + +\item Equation numbers automatically adjust up or down to avoid +overprinting on the equation contents (unlike \env{eqnarray}). + +\item Spacing around equals signs matches the normal spacing in the +\env{equation} environment (unlike \env{eqnarray}). + +\item A way to produce multiline subscripts as are often used with +summation or product symbols. + +\item An easy way to substitute a variant equation number for a given +equation instead of the automatically supplied number. + +\item An easy way to produce subordinate equation numbers of the form +(1.3a) (1.3b) (1.3c) for selected groups of equations. + +\end{itemize} + +The \pkg{amsmath} package is distributed together with some small +auxiliary packages: +\begin{description} +\item[\pkg{amsmath}] Primary package, provides various features for + displayed equations and other mathematical constructs. + +\item[\pkg{amstext}] Provides a \cn{text} command for + typesetting a fragment of text inside a display. + +\item[\pkg{amsopn}] Provides \cn{DeclareMathOperator} for defining new + `operator names' like \cn{sin} and \cn{lim}. + +\item[\pkg{amsbsy}] For backward compatibility this package continues +to exist but use of the newer \pkg{bm} package that comes with \LaTeX{} +is recommended instead. + +\item[\pkg{amscd}] Provides a \env{CD} environment for simple + commutative diagrams (no support for diagonal arrows). + +\item[\pkg{amsxtra}] Provides certain odds and ends such as + \cn{fracwithdelims} and \cn{accentedsymbol}, for compatibility with + documents created using version 1.1. + +\end{description} + +The \pkg{amsmath} package incorporates \pkg{amstext}, \pkg{amsopn}, and +\pkg{amsbsy}. The features of \pkg{amscd} and \pkg{amsxtra}, however, +are available only by invoking those packages separately. + +\chapter{Options for the \pkg{amsmath} package}\label{options} + +The \pkg{amsmath} package has the following options: +\begin{description} + +\item[\opt{centertags}] (default) For a split equation, place equation +numbers\index{equation numbers!vertical placement} vertically centered +on the total height of the equation. + +\item[\opt{tbtags}] `Top-or-bottom tags': For a split equation, place +equation numbers\index{equation numbers!vertical placement} level with +the last (resp.\@ first) line, if numbers are on the right (resp.\@ +left). + +\item[\opt{sumlimits}] (default) Place the subscripts and +superscripts\index{subscripts and superscripts!placement}\relax +\index{limits|see{subscripts and superscripts}} of summation symbols +above and below, in displayed equations. This option also affects other +symbols of the same type\mdash $\prod$, $\coprod$, $\bigotimes$, +$\bigoplus$, and so forth\mdash but excluding integrals (see below). + +\item[\opt{nosumlimits}] Always place the subscripts and superscripts of +summation-type symbols to the side, even in displayed equations. + +\item[\opt{intlimits}] Like \opt{sumlimits}, but for +integral\index{integrals!placement of limits} symbols. + +\item[\opt{nointlimits}] (default) Opposite of \opt{intlimits}. + +\item[\opt{namelimits}] (default) Like \opt{sumlimits}, but for certain +`operator names' such as $\det$, $\inf$, $\lim$, $\max$, $\min$, that +traditionally have subscripts \index{subscripts and +superscripts!placement} placed underneath when they occur in a displayed +equation. + +\item[\opt{nonamelimits}] Opposite of \opt{namelimits}. + +\end{description} + +To use one of these package options, put the option name in the optional +argument of the \cn{usepackage} command\mdash e.g., +\verb"\usepackage[intlimits]{amsmath}". + +The \pkg{amsmath} package also recognizes the following options which +are normally selected (implicitly or explicitly) through the +\cn{documentclass} command, and thus need not be repeated in the option +list of the \cn{usepackage}\verb|{amsmath}| statement. +\begin{description} + +\item[\opt{leqno}] Place equation numbers on the left.\index{equation +numbers!left or right placement} + +\item[\opt{reqno}] Place equation numbers on the right. + +\item[\opt{fleqn}] Position equations at a fixed indent from the left +margin rather than centered in the text column.\index{displayed +equations!centering} + +\end{description} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\chapter{Displayed equations} + +\section{Introduction} +The \pkg{amsmath} package provides a number of additional displayed +equation structures\index{displayed + equations}\index{equations|see{displayed equations}} beyond the ones +provided in basic \latex/. The augmented set includes: +\begin{verbatim} + equation equation* align align* + gather gather* flalign flalign* + multline multline* alignat alignat* + split +\end{verbatim} +(Although the standard \env{eqnarray} environment remains available, +it is better to use \env{align} or \env{equation}+\env{split} instead.) + +Except for \env{split}, each environment has both starred and unstarred +forms, where the unstarred forms have automatic numbering using +\latex/'s \env{equation} counter. You can suppress the number on any +particular line by putting \cn{notag} before the \cn{\bslchar\bslchar}; you can also +override\index{equation numbers!overriding} it with a tag of your own +using \cn{tag}\verb|{|\